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

Restart advertisement timeout before its actual timeout (Restart whenever there is a button press)

Hello,

 

I am using nRF52832, SDK_15.3.0, S132 SoftDevice and Segger for flashing the image. I am using ‘ble_app_blinky’.

 

In my application, I am starting BLE advertisement only when button is pressed. Also advertisement will timeout after 3 minutes. Currently it is working fine.

But I have a requirement where BLE advertisement should restart. I mean if already advertisement happening and if it completed 2 minutes duration. Now if I press a button, advertisement should timeout after 3 minutes rather than after 1 minute.

 

For this I just called advertising_start(). For first time button press its working fine. But when I press the same button within 2 minutes I am getting exception with error NRF_ERROR_INVALID_STATE (8) within advertising_start().

 

void advertising_start(void)
{
    ret_code_t           err_code;

    err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);
    NRF_LOG_INFO("AdvFail %d", err_code);
    
    APP_ERROR_CHECK(err_code);
}

Please let me know how to implement above scenario.

 

Thanks & Regards

Vishnu Beema

Parents Reply Children
Related