* Issue with gatt_discover_primary()
@ 2015-12-19 19:18 John Munroe
0 siblings, 0 replies; only message in thread
From: John Munroe @ 2015-12-19 19:18 UTC (permalink / raw)
To: linux-bluetooth
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-12-19 19:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-19 19:18 Issue with gatt_discover_primary() John Munroe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.