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 | |
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')
-rw-r--r-- | src/device.c | 33 | ||||
-rw-r--r-- | src/device.h | 1 |
2 files changed, 29 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) { diff --git a/src/device.h b/src/device.h index e0d334f6..c0d3b2bb 100644 --- a/src/device.h +++ b/src/device.h @@ -33,6 +33,7 @@ int device_browse(struct btd_device *device, DBusConnection *conn, void device_probe_drivers(struct btd_device *device, GSList *uuids); const sdp_record_t *btd_device_get_record(struct btd_device *device, const char *uuid); +void btd_device_add_uuid(struct btd_device *device, const char *uuid); struct btd_adapter *device_get_adapter(struct btd_device *device); void device_get_address(struct btd_device *adapter, bdaddr_t *bdaddr); const gchar *device_get_path(struct btd_device *device); |