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

EDDYSTONE ADVERTISEMENT IN CONNECTABLE MODE FROM BEGINNING

Hello Nordic Team
I want to use the ble_app_eddystone example found in SDK 15.3 on NRF52832 to advertise in connectable mode from the beginning. I tried to add nrf_ble_es_on_start_connectable_advertising() after nrf_ble_es_init(on_es_evt) but i did not work.  Please help me with this problem.


Best regards

Parents
  • Hi,

    With this you get a BLE_ERROR_INVALID_ADV_HANDLE returned from the call to sd_ble_gap_adv_stop() on line 158 in es_adv.c. One fix is to wait a bit so that everything is in place and then do this. A simpler and perhaps better approach as we understand what happens here is to just add special handlign for BLE_ERROR_INVALID_ADV_HANDLE in the implementation of the adv_stop() function in es_adv.c so that it looks like this:

    static void adv_stop(void)
    {
        ret_code_t err_code;
    
        err_code = sd_ble_gap_adv_stop(*mp_adv_handle);
        if (err_code != NRF_ERROR_INVALID_STATE && err_code != BLE_ERROR_INVALID_ADV_HANDLE)
        {
            APP_ERROR_CHECK(err_code);
        }
    
        es_adv_timing_stop();
    }

    With this modification you can safely call nrf_ble_es_on_start_connectable_advertising() after nrf_ble_es_init().

Reply
  • Hi,

    With this you get a BLE_ERROR_INVALID_ADV_HANDLE returned from the call to sd_ble_gap_adv_stop() on line 158 in es_adv.c. One fix is to wait a bit so that everything is in place and then do this. A simpler and perhaps better approach as we understand what happens here is to just add special handlign for BLE_ERROR_INVALID_ADV_HANDLE in the implementation of the adv_stop() function in es_adv.c so that it looks like this:

    static void adv_stop(void)
    {
        ret_code_t err_code;
    
        err_code = sd_ble_gap_adv_stop(*mp_adv_handle);
        if (err_code != NRF_ERROR_INVALID_STATE && err_code != BLE_ERROR_INVALID_ADV_HANDLE)
        {
            APP_ERROR_CHECK(err_code);
        }
    
        es_adv_timing_stop();
    }

    With this modification you can safely call nrf_ble_es_on_start_connectable_advertising() after nrf_ble_es_init().

Children
Related