From: John Munroe <munddr@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: Issue with gatt_discover_primary()
Date: Sun, 20 Dec 2015 03:18:04 +0800 [thread overview]
Message-ID: <etPan.5675ad6c.5a2be03b.9abd@guardian> (raw)
Hi all,
I'm using bluez on a GATT client (PC) and TI's SimpleBLEPeripheral code on a GATT server (PCB). The PCB's UUID is:
0000fff0-0000-1000-8000-00805f9b34fb
Using bluez, I have the following
static GAttrib *attrib = NULL;
...
static void cmd_primary(int argcp, char **argvp)
{
bt_uuid_t uuid;
if (conn_state != STATE_CONNECTED) {
resp_error(err_BAD_STATE);
return;
}
if (argcp == 1) {
gatt_discover_primary(attrib, NULL, primary_all_cb, NULL);
return;
}
if (bt_string_to_uuid(&uuid, argvp[1]) < 0) {
resp_error(err_BAD_PARAM);
return;
}
gatt_discover_primary(attrib, &uuid, primary_by_uuid_cb, NULL);
}
static void primary_by_uuid_cb(uint8_t status, GSList *ranges, void *user_data)
{
GSList *l;
if (status) {
resp_error(err_COMM_ERR); // Todo: status
return;
}
resp_begin(rsp_DISCOVERY);
for (l = ranges; l; l = l->next) {
struct att_range *range = l->data;
send_uint(tag_RANGE_START, range->start);
send_uint(tag_RANGE_END, range->end);
}
resp_end();
}
After successfully connecting to the PCB, running
cmd_primary(2, (char *[]){"svcs", "0000fff0-0000-1000-0000-000000000000”})
leads the callback primary_by_uuid_cb() to be called with the parameter ‘ranges' being NULL. If the service is recognised, ‘ranges' shouldn't be NULL - correct?
If that's the case, does anyone know why the service is not found (or why ‘ranges' is NULL if it shouldn't be)?
Any help will be appreciated.
Thanks
John
reply other threads:[~2015-12-19 19:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=etPan.5675ad6c.5a2be03b.9abd@guardian \
--to=munddr@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox