예제 #1
0
/*
 * Given a service record handle, remove its record from the repository
 */
int sdp_record_remove(uint32_t handle)
{
	sdp_list_t *p = record_locate(handle);
	sdp_record_t *r;
	sdp_access_t *a;

	if (!p) {
		error("Remove : Couldn't find record for : 0x%x", handle);
		return -1;
	}

	r = p->data;
	if (r)
		service_db = sdp_list_remove(service_db, r);

	p = access_locate(handle);
	if (p == NULL || p->data == NULL)
		return 0;

	a = p->data;

	if (bacmp(&a->device, BDADDR_ANY) != 0) {
		struct btd_adapter *adapter = adapter_find(&a->device);
		if (adapter)
			adapter_service_remove(adapter, r);
	} else
		adapter_foreach(adapter_service_remove, r);

	access_db = sdp_list_remove(access_db, a);
	access_free(a);

	return 0;
}
예제 #2
0
/*
 * Add a service record to the repository
 */
void sdp_record_add(const bdaddr_t *device, sdp_record_t *rec)
{
	struct btd_adapter *adapter;
	sdp_access_t *dev;

	SDPDBG("Adding rec : 0x%lx", (long) rec);
	SDPDBG("with handle : 0x%x", rec->handle);

	service_db = sdp_list_insert_sorted(service_db, rec, record_sort);

	dev = malloc(sizeof(*dev));
	if (!dev)
		return;

	bacpy(&dev->device, device);
	dev->handle = rec->handle;

	access_db = sdp_list_insert_sorted(access_db, dev, access_sort);

	if (bacmp(device, BDADDR_ANY) == 0) {
		adapter_foreach(adapter_service_insert, rec);
		return;
	}

	adapter = adapter_find(device);
	if (adapter)
		adapter_service_insert(adapter, rec);
}
예제 #3
0
파일: agent.c 프로젝트: DaisyPi/sensortag
static void set_default_agent(struct agent *agent)
{
	if (default_agent == agent)
		return;

	if (agent)
		DBG("Default agent set to %s %s", agent->owner, agent->path);
	else
		DBG("Default agent cleared");

	default_agent = agent;

	adapter_foreach(set_io_cap, agent);
}
예제 #4
0
파일: agent.c 프로젝트: ghent360/bluez
static bool add_default_agent(struct agent *agent)
{
	if (queue_peek_head(default_agents) == agent)
		return true;

	queue_remove(default_agents, agent);

	if (!queue_push_head(default_agents, agent))
		return false;

	DBG("Default agent set to %s %s", agent->owner, agent->path);

	adapter_foreach(set_io_cap, agent);

	return true;
}
예제 #5
0
파일: agent.c 프로젝트: ghent360/bluez
static void remove_default_agent(struct agent *agent)
{
	if (queue_peek_head(default_agents) != agent) {
		queue_remove(default_agents, agent);
		return;
	}

	queue_remove(default_agents, agent);

	agent = queue_peek_head(default_agents);
	if (agent)
		DBG("Default agent set to %s %s", agent->owner, agent->path);
	else
		DBG("Default agent cleared");

	adapter_foreach(set_io_cap, agent);
}
예제 #6
0
void sdp_init_services_list(bdaddr_t *device)
{
	sdp_list_t *p;

	DBG("");

	for (p = access_db; p != NULL; p = p->next) {
		sdp_access_t *access = p->data;
		sdp_record_t *rec;

		if (bacmp(BDADDR_ANY, &access->device))
			continue;

		rec = sdp_record_find(access->handle);
		if (rec == NULL)
			continue;

		SDPDBG("adding record with handle %x", access->handle);

		adapter_foreach(adapter_service_insert, rec);
	}
}
예제 #7
0
파일: manager.c 프로젝트: VinceGa/bluez
void manager_set_fast_connectable(gboolean enable)
{
	adapter_foreach(set_fast_connectable, GUINT_TO_POINTER(enable));
}