summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-06-15 14:12:51 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-06-15 14:12:51 +0000
commit5df25027b4e328227b5bc709b3cbab990bef36c6 (patch)
tree5266cb10cade6938d3d6b86d6002886ed9249bee
parent056164940832601cef0bb547f885eada7c911806 (diff)
GetRemoteServiceIdentifiers: retrieve all record attributes instead of the service class only
-rw-r--r--hcid/dbus-sdp.c55
1 files changed, 21 insertions, 34 deletions
diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c
index 8fb8dbf6..c2b943cb 100644
--- a/hcid/dbus-sdp.c
+++ b/hcid/dbus-sdp.c
@@ -742,7 +742,7 @@ static void remote_svc_identifiers_completed_cb(uint8_t type, uint16_t err,
struct transaction_context *ctxt = udata;
DBusMessage *reply;
DBusMessageIter iter, array_iter;
- int scanned, n, attrlen, extracted = 0, len = 0;
+ int scanned, extracted = 0, len = 0;
uint8_t dtd = 0;
if (!ctxt)
@@ -781,44 +781,32 @@ static void remote_svc_identifiers_completed_cb(uint8_t type, uint16_t err,
/* Expected sequence of service class id list */
scanned = sdp_extract_seqtype(rsp, &dtd, &len);
- if (!scanned || !len)
- goto done;
rsp += scanned;
while (extracted < len) {
- const char *puuid;
+ sdp_record_t *rec;
sdp_data_t *d;
- int seqlen;
- uint16_t attr;
-
- seqlen = 0;
- scanned = sdp_extract_seqtype(rsp, &dtd, &seqlen);
- if (!scanned || !seqlen)
- goto done;
-
- extracted += (seqlen + scanned);
-
- n = sizeof(uint8_t);
- attrlen = 0;
+ int recsize;
- rsp += scanned;
- attr = ntohs(bt_get_unaligned((uint16_t *) (rsp + n)));
- n += sizeof(uint16_t);
- d = sdp_extract_attr(rsp + n, &attrlen, NULL);
- if (!d)
+ recsize = 0;
+ rec = sdp_extract_pdu(rsp, &recsize);
+ if (!rec)
break;
- d->attrId = attr;
- puuid = extract_service_class(d);
- if (puuid)
- dbus_message_iter_append_basic(&array_iter,
- DBUS_TYPE_STRING, &puuid);
- sdp_data_free(d);
+ rsp += recsize;
+ extracted += recsize;
- n += attrlen;
- rsp += n;
+ d = sdp_data_get(rec, SDP_ATTR_SVCLASS_ID_LIST);
+ if (d) {
+ const char *puuid;
+ puuid = extract_service_class(d);
+ if (puuid)
+ dbus_message_iter_append_basic(&array_iter,
+ DBUS_TYPE_STRING, &puuid);
+ }
+ sdp_record_free(rec);
}
-done:
+
dbus_message_iter_close_container(&iter, &array_iter);
send_message_and_unref(ctxt->conn, reply);
@@ -1062,7 +1050,7 @@ static int remote_svc_identifiers_conn_cb(struct transaction_context *ctxt)
{
sdp_list_t *attrids, *search;
uuid_t uuid;
- uint16_t attr;
+ uint32_t range = 0x0000ffff;
if (sdp_set_notify(ctxt->session,
remote_svc_identifiers_completed_cb, ctxt) < 0)
@@ -1071,15 +1059,14 @@ static int remote_svc_identifiers_conn_cb(struct transaction_context *ctxt)
sdp_uuid16_create(&uuid, PUBLIC_BROWSE_GROUP);
search = sdp_list_append(0, &uuid);
- attr = SDP_ATTR_SVCLASS_ID_LIST;
- attrids = sdp_list_append(NULL, &attr);
+ attrids = sdp_list_append(NULL, &range);
/*
* Create/send the search request and set the
* callback to indicate the request completion
*/
if (sdp_service_search_attr_async(ctxt->session, search,
- SDP_ATTR_REQ_INDIVIDUAL, attrids) < 0) {
+ SDP_ATTR_REQ_RANGE, attrids) < 0) {
sdp_list_free(search, NULL);
sdp_list_free(attrids, NULL);
return -sdp_get_error(ctxt->session);