From 040728e5019fce4eba5790939329fae0aa9104ff Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Mon, 30 Jun 2008 17:26:18 +0000 Subject: Added uuid128 support for device DiscoverServices --- hcid/adapter.c | 2 +- hcid/dbus-hci.c | 3 ++- hcid/dbus-sdp.c | 7 ------- hcid/device.c | 17 +++++++++-------- hcid/device.h | 2 +- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/hcid/adapter.c b/hcid/adapter.c index 75aa31a4..5879627c 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -3986,7 +3986,7 @@ static DBusMessage *create_device(DBusConnection *conn, device->temporary = FALSE; - device_browse(device, conn, msg, 0); + device_browse(device, conn, msg, NULL); adapter->devices = g_slist_append(adapter->devices, device); diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c index f9d87973..617ded21 100644 --- a/hcid/dbus-hci.c +++ b/hcid/dbus-hci.c @@ -1302,7 +1302,8 @@ proceed: dbus_message_unref(reply); } else { device->temporary = FALSE; - device_browse(device, bonding->conn, bonding->msg, 0); + device_browse(device, bonding->conn, + bonding->msg, NULL); } } diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c index 12de5edd..02f9e31c 100644 --- a/hcid/dbus-sdp.c +++ b/hcid/dbus-sdp.c @@ -86,13 +86,6 @@ struct pending_connect { connect_cb_t *conn_cb; }; -/* FIXME: move to a common file */ -typedef struct { - char *name; - uint16_t class; - char *info_name; -} sdp_service_t; - struct cached_session { sdp_session_t *session; guint timeout_id; diff --git a/hcid/device.c b/hcid/device.c index 706dcc1d..f94c610c 100644 --- a/hcid/device.c +++ b/hcid/device.c @@ -1058,15 +1058,16 @@ static DBusMessage *discover_services(DBusConnection *conn, goto fail; if (strlen(pattern) == 0) { - err = device_browse(device, conn, msg, 0); + err = device_browse(device, conn, msg, NULL); if (err < 0) goto fail; } else { - search = bt_string2class(pattern); - if (!search) + uuid_t uuid; + + if (bt_string2uuid(&uuid, pattern) < 0) return invalid_args(msg); - err = device_browse(device, conn, msg, search); + err = device_browse(device, conn, msg, &uuid); if (err < 0) goto fail; } @@ -1538,7 +1539,7 @@ cleanup: } int device_browse(struct device *device, DBusConnection *conn, - DBusMessage *msg, uint16_t search) + DBusMessage *msg, uuid_t *search) { struct adapter *adapter = device->adapter; struct browse_req *req; @@ -1559,7 +1560,7 @@ int device_browse(struct device *device, DBusConnection *conn, str2ba(device->address, &dst); if (search) { - sdp_uuid16_create(&uuid, search); + memcpy(&uuid, search, sizeof(uuid_t)); req->browse = FALSE; } else { sdp_uuid16_create(&uuid, uuid_list[req->search_uuid]); @@ -1568,8 +1569,8 @@ int device_browse(struct device *device, DBusConnection *conn, device->discov_active = 1; device->discov_requestor = g_strdup(dbus_message_get_sender(msg)); - /* track the request owner to cancel it automatically if the owner - * exits */ + /* Track the request owner to cancel it + * automatically if the owner exits */ device->discov_listener = g_dbus_add_disconnect_watch(conn, dbus_message_get_sender(msg), discover_services_req_exit, diff --git a/hcid/device.h b/hcid/device.h index e7cee9f7..e5a322b3 100644 --- a/hcid/device.h +++ b/hcid/device.h @@ -54,7 +54,7 @@ struct device *device_create(DBusConnection *conn, struct adapter *adapter, void device_remove(DBusConnection *conn, struct device *device); gint device_address_cmp(struct device *device, const gchar *address); int device_browse(struct device *device, DBusConnection *conn, - DBusMessage *msg, uint16_t search); + DBusMessage *msg, uuid_t *search); void device_probe_drivers(struct device *device, GSList *uuids); #define BTD_UUIDS(args...) ((const char *[]) { args, NULL } ) -- cgit