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

Stop Advertising on nrf52832

Hi! What is the proper use of sd_ble_gap_adv_stop in SDK 15? I'm using nrf52832 in my application but can't seen to find a corret way to stop advertising.

Looking on ble_gap.h I've seen that this function requires a adv_handle as a parameter but what exactly is it expecting?

Parents Reply Children
  • I've found a workaround.

    I was using sd_ble_gap_adv_stop(m_advertising.adv_handle)  inside a timer handler which had a return type of void while sd_ble_gap_adv_stop has a return type of uint32_t, so I just adjusted that and now it's stopping advertising and not showing the error.

    Since app_timer_create was complaining about the uint32_t type I just called a function inside it to match the types.

    //handler
    void test_handler(void *p_context){
    
    advertising_stop();
    
    }
    //advertising_stop
    uint32_t advertising_stop(void)
    {
    
    uint32_t ret_error2;
    ret_error2=sd_ble_gap_adv_stop(m_advertising.adv_handle);
    APP_ERROR_CHECK(ret_error2);
    NRF_LOG_INFO("ADV. Stopped");
    
    }
    

Related