Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ble_cts_c indicates discovery failure for every registered discovery service

I noticed a bug in ble_cts_c.  The BLE_CTS_C_EVT_DISCOVERY_FAILED event is sent to the event handler for every UUID registered for discovery.  The BLE_CTS_C_EVT_DISCOVERY_FAILED should only be sent when the CTS_C service discovery fails.

The fix for the code is:

    else if (
    ((p_evt->evt_type == BLE_DB_DISCOVERY_SRV_NOT_FOUND) ||
             (p_evt->evt_type == BLE_DB_DISCOVERY_ERROR))
             //additional code starts here
                     && (p_evt->params.discovered_db.srv_uuid.uuid == BLE_UUID_CURRENT_TIME_SERVICE)
        && (p_evt->params.discovered_db.srv_uuid.type == BLE_UUID_TYPE_BLE)
        
        )
    {
        evt.evt_type    = BLE_CTS_C_EVT_DISCOVERY_FAILED;
    }
    else

Parents Reply Children
No Data
Related