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

advertising during connection [nrf5 sdk 11 s132]

Hello,

my application has to emit measurements in the manufacturer specific data structure continuously and has to accept a connection, for example for ANCS. Therefore I extended the BLE_GAP_EVT_CONNECTED case of the ble_app_ancs_c example like this:

case BLE_GAP_EVT_CONNECTED:
    NRF_LOG("Connected.\n\r");
    err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
    APP_ERROR_CHECK(err_code);
    
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code); // Error code 18 -> NRF_ERROR_CONN_COUNT
    break;

This is not working and i get an error code 18. I thought, that after entering BLE_GAP_EVT_CONNECTED the advertising is disabled, so i can enable it again. I know that i have to advertise in a non connactable mode if a connection exists and after the connection has been terminated i have to advertise in a contactable mode. How do I do that with the modern API of SDK 11? It should be possible without using the timeslot API. Could you please provide a skeleton template? Thanks.

Related