diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-09-11 11:00:24 -0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-09-11 11:18:19 -0300 |
commit | 58d8ea3c3a8ea69e652d8a39649a19426f31933b (patch) | |
tree | c0bc01b54f9e4cea37c1b74797c9219b3b978d6b /src/device.c | |
parent | da8ef81cf060726782614baeea5b7e2c466b2341 (diff) |
Make discovery service routine to search for driver uuids.
Diffstat (limited to 'src/device.c')
-rw-r--r-- | src/device.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/device.c b/src/device.c index 7de2e8af..9acbe334 100644 --- a/src/device.c +++ b/src/device.c @@ -85,6 +85,7 @@ struct browse_req { DBusConnection *conn; DBusMessage *msg; struct btd_device *device; + GSList *uuids; GSList *uuids_added; GSList *uuids_removed; sdp_list_t *records; @@ -823,10 +824,18 @@ static void update_services(struct browse_req *req, sdp_list_t *recs) if (!uuid_str) continue; + /* Driver uuid found */ + l = g_slist_find_custom(req->uuids, uuid_str, + (GCompareFunc) strcasecmp); + if (l) + req->uuids = g_slist_remove(req->uuids, l->data); + /* Check for duplicates */ if (sdp_list_find(req->records, rec, rec_cmp)) continue; + debug("New record found: %s", uuid_str); + store_record(src_addr, device->address, rec); /* Copy record */ @@ -975,6 +984,14 @@ static void browse_cb(sdp_list_t *recs, int err, gpointer user_data) return; } + /* Search for drivers uuids */ + if (req->uuids) { + bt_string2uuid(&uuid, req->uuids->data); + req->uuids = g_slist_remove(req->uuids, req->uuids->data); + bt_search_service(&src, &dst, &uuid, browse_cb, user_data, NULL); + return; + } + done: search_cb(recs, err, user_data); } @@ -983,6 +1000,19 @@ static void init_browse(struct browse_req *req) { GSList *l; + for (l = device_drivers; l; l = l->next) { + struct btd_device_driver *driver = l->data; + int i; + + for (i = 0; driver->uuids[i]; i++) { + if (g_slist_find_custom(req->uuids, driver->uuids[i], + (GCompareFunc) strcasecmp)) + return; + req->uuids = g_slist_append(req->uuids, + g_strdup(driver->uuids[i])); + } + } + for (l = req->device->uuids; l; l = l->next) req->uuids_removed = g_slist_append(req->uuids_removed, l->data); |