diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-10-09 15:00:09 +0200 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-10-09 15:13:28 +0200 | 
| commit | 17541956196b13ee083852fd4124cd8cfd0928a4 (patch) | |
| tree | cc258c9f0ff98572036eea7879e79fb443053913 /src/device.c | |
| parent | 548026e08bd9b83b3685d515a916e2cf674184f3 (diff) | |
Add mechanism for adding new UUIDs from the driver side
With this patch drivers can notify the core daemon that a device supports some
UUID. This is useful in case we don't have a service record for a profile which
the remote device initiates a connection for.
Diffstat (limited to 'src/device.c')
| -rw-r--r-- | src/device.c | 33 | 
1 files changed, 28 insertions, 5 deletions
diff --git a/src/device.c b/src/device.c index 3f70e647..6fba5352 100644 --- a/src/device.c +++ b/src/device.c @@ -827,10 +827,9 @@ static void discover_device_reply(struct browse_req *req, sdp_list_t *recs)  	dbus_message_unref(reply);  } -static void services_changed(struct browse_req *req) +static void services_changed(struct btd_device *device)  {  	DBusConnection *conn = get_dbus_connection(); -	struct btd_device *device = req->device;  	char **uuids;  	GSList *l;  	int i; @@ -952,7 +951,7 @@ static void update_services(struct browse_req *req, sdp_list_t *recs)  	}  } -static void store(struct btd_device *device) +static void store_profiles(struct btd_device *device)  {  	struct btd_adapter *adapter = device->adapter;  	bdaddr_t src; @@ -1028,11 +1027,11 @@ static void search_cb(sdp_list_t *recs, int err, gpointer user_data)  		device_remove_drivers(device, req->uuids_removed);  	/* Propagate services changes */ -	services_changed(req); +	services_changed(req->device);  proceed:  	/* Store the device's profiles in the filesystem */ -	store(device); +	store_profiles(device);  	if (req->msg) {  		if (dbus_message_is_method_call(req->msg, DEVICE_INTERFACE, @@ -1339,6 +1338,30 @@ int device_set_paired(DBusConnection *conn, struct btd_device *device,  	return 0;  } +void btd_device_add_uuid(struct btd_device *device, const char *uuid) +{ +	GSList *uuid_list; +	char *new_uuid; + +	if (g_slist_find_custom(device->uuids, uuid, +				(GCompareFunc) strcasecmp)) +		return; + +	new_uuid = g_strdup(uuid); + +	device->uuids = g_slist_append(device->uuids, new_uuid); + +	store_profiles(device); + +	uuid_list = g_slist_append(NULL, new_uuid); + +	device_probe_drivers(device, uuid_list); + +	g_slist_free(uuid_list); + +	services_changed(device); +} +  const sdp_record_t *btd_device_get_record(struct btd_device *device,  						const char *uuid)  {  | 
