Hi,
I'm using the nrf52840 with sdk v15.3 and I'm trying to list of the characteristics of a specific service that has a 128 bit uuid running on a peripheral. However, even though I'm able to connect to the peripheral, I'm encountering problems when trying to retrieve characteristics using the db discovery module.
Here's a sample of the code that doesn't work:
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
ret_code_t err_code;
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
NRF_LOG_INFO("Connected.");
err_code = ble_db_discovery_start(&m_db_disc, p_ble_evt->evt.gap_evt.conn_handle);
APP_ERROR_CHECK(err_code);
break;
[...]
}
}
static void db_discovery_init(void)
{
ble_db_discovery_init_t db_init;
memset(&db_init, 0, sizeof(db_init));
db_init.evt_handler = db_disc_handler;
db_init.p_gatt_queue = &m_ble_gatt_queue;
ret_code_t err_code = ble_db_discovery_init(&db_init);
APP_ERROR_CHECK(err_code);
ble_uuid128_t service_uuid = {{0x6d, 0x7d, 0x66, 0xec,
0x0c, 0xf1, 0x11, 0xea,
0x8d, 0x71, 0x36, 0x2b,
0x9e, 0x15, 0x56, 0x67}};
sd_ble_uuid_vs_add(&service_uuid, &custom_uuid_type);
ble_uuid_t uuid;
uuid.type = custom_uuid_type;
uuid.uuid = 0x66ec;
ble_db_discovery_evt_register(&uuid);
}
The issue is that my handler consistenly gets BLE_DB_DISCOVERY_ERROR events because, in ${SDK}/components/ble/nrf_ble_gq/nrf_ble_gq.c, the call to sd_ble_gattc_primary_services_discover() is failing in request_process() with NRF_ERROR_INVALID_PARAM, which I assume is because of my UUID.
Am I doing something fundamentally wrong here?
Thanks,