Hello I have trouble that when I call sd_ble_gattc_read()
I get error NRF_ERROR_BUSY
.
This also happens only when I discover more services (before I discover Alert Notification Service and read from some characteristic on discovery).
Basically what I do is that after
db_disc_handler(ble_db_discovery_evt_t * p_evt)
When I find my service:
p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE &&
p_evt->params.discovered_db.srv_uuid.uuid == BLE_UUID_GAP &&
I call
sd_ble_gattc_read(m_conn_handle, m_dev_name_char.handle_value, 0);
But I receive NRF_ERROR_BUSY
It works when I do not discover and read ANS before. I tried to call sd_ble_gattc_read() in loop when I get error NRF_ERROR_BUSY. But it seems to be permanently busy.
Do you know what is wrong? Or perhaps when it is safe to read from characteristic?
[EDIT] ============
So I analyzed Nordic ANS example and it seems they create proprietary internal buffer and try to recall it on 2 following events:
- BLE_GATTC_EVT_READ_RSP
- BLE_GATTC_EVT_WRITE_RSP
So first I do not like it. It would be more user friendly when queue is done internally in SD. And not for every client separately. Especially when one client read influences another client read from another service and characteristic.
But OK. My question is now what EVENTS I shall monitor when sd_ble_gattc_read() returns BUSY. Is it OK to monitor only 2 events from ANS example: (ie.: BLE_GATTC_EVT_READ_RSP, BLE_GATTC_EVT_WRITE_RSP) or can other events make SD internally busy??? Where in documentation is written what EVENTS can put SD into BUSY state?