I had an issue when using both the current time service (CTS client, getting time from phone) and the battery service (BAS getting battery level from phone).
When requesting the battery level of the phone (which works), I would also receive an unexpected `BLE_CTS_C_EVT_INVALID_TIME` event.
The CTS client handles the `BLE_GATTC_EVT_READ_RSP` event assuming it is a response to a `cts_c` request, while this event was addressed to the `bas_c` client.
Looking at the SDK code, I found that there is no check to see who made that request. Other components include a similar check. So I went ahead and added it myself. And it appears to work.
Here is a fix, but I'd like a confirmation that this is indeed a bug and not something I'm doing wrong:
// In components/ble/ble_services/ble_cts_c/ble_cts_c.c,
// Function: ble_cts_c_on_ble_evt
// Bail if the response is not targetting CTS
if (p_ble_evt->evt.gattc_evt.params.read_rsp.handle != p_cts->char_handles.cts_handle) {
return;
}