This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Service Discovery Issues using the discovery manager.

I am trying to do service discovery using the discovery manager library on any BLE device I connect to my central. I start the service with bt_gatt_dm_start(conn, NULL, &discovery_cb, NULL) and every works fine on the first service discovered. I run into an issue when I try to continue the discovery on the remaining services. The asserts on line 2927 and 2929 in the bt_gatt_discover function of Zephyr's gatt.c library are asserted upon running bt_gatt_dm_continue.  If I remove these asserts everything runs fine and I am able to continue discovery of all the services for my device as intended. Is this a bug in the DM or am I using it incorrectly?

Here is my discover complete callback with the dm continue function

static void discovery_completed(struct bt_gatt_dm *disc, void *ctx)
{

  printk("Attribute count: %d\n", bt_gatt_dm_attr_cnt(disc));

  bt_gatt_dm_data_release(disc);
  bt_gatt_dm_continue(disc, NULL);

}


The asserts causing the issues:
int bt_gatt_discover(struct bt_conn *conn, struct bt_gatt_discover_params *params)
{
__ASSERT((params->start_handle && params->end_handle),
"invalid parameters\n");
__ASSERT((params->start_handle <= params->end_handle),
"invalid parameters\n");


Parents Reply Children
No Data
Related