diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-09-29 21:24:18 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-09-29 21:24:18 +0000 |
commit | a92ba8bfd77ffa09d2cd0809f801eff0984a11d8 (patch) | |
tree | 464cedf8e7c1eb06c849faf96b7e1e22550829de /hcid/dbus-sdp.c | |
parent | 940db9109c5bd40fb754d5804f6b5e61ed8cd8b0 (diff) |
support uuid128 and '0x' for service search match
Diffstat (limited to 'hcid/dbus-sdp.c')
-rw-r--r-- | hcid/dbus-sdp.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c index 6a101bd7..f17c8c31 100644 --- a/hcid/dbus-sdp.c +++ b/hcid/dbus-sdp.c @@ -934,7 +934,6 @@ static int remote_svc_handles_conn_cb(struct transaction_context *ctxt) const char *dst, *svc; uuid_t uuid; int err = 0; - uint32_t class; if (sdp_set_notify(ctxt->session, remote_svc_handles_completed_cb, ctxt) < 0) { err = -EINVAL; @@ -946,9 +945,13 @@ static int remote_svc_handles_conn_cb(struct transaction_context *ctxt) DBUS_TYPE_STRING, &svc, DBUS_TYPE_INVALID); - if (strlen(svc) > 0 ){ - class = sdp_str2svclass(svc); - sdp_uuid16_create(&uuid, class); + if (strlen(svc) > 0) { + /* Check if it is a service name string */ + if (str2uuid(&uuid, svc) < 0) { + /* check if the service string is a hex */ + uint32_t uuid_hex = strtol(svc, NULL, 16); + sdp_uuid16_create(&uuid, uuid_hex); + } } else sdp_uuid16_create(&uuid, PUBLIC_BROWSE_GROUP); @@ -973,7 +976,7 @@ DBusHandlerResult get_remote_svc_handles(DBusConnection *conn, DBusMessage *msg, struct hci_dbus_data *dbus_data = data; const char *dst, *svc; int err = 0; - uint32_t class; + uuid_t uuid; if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &dst, @@ -982,10 +985,14 @@ DBusHandlerResult get_remote_svc_handles(DBusConnection *conn, DBusMessage *msg, return error_invalid_arguments(conn, msg); if (strlen(svc) > 0) { - class = sdp_str2svclass(svc); - if (!class) { - error("Invalid service class name"); - return error_invalid_arguments(conn, msg); + /* Check if it is a service name string */ + if (str2uuid(&uuid, svc) < 0) { + /* check if the service string is a hex */ + uint32_t uuid_hex = strtol(svc, NULL, 16); + if (!uuid_hex) { + error("Invalid service class name"); + return error_invalid_arguments(conn, msg); + } } } |