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

Calling sd_ble_gap_adv_stop() does not emit an on_adv_evt event

I'm a bit at a loss of how to voluntarily stop advertising:
My related thread says I should call sd_ble_gap_adv_stop(), but when I do, no corresponding event is raised by the soft-device. This ultimately means that on_adv_evt() in main.c does not get called, the static m_adv_mode_current in ble_advertising.c does not change state to BLE_ADV_MODE_IDLE, and the ble_advertising module in an unmatching state.

How can I overcome this? Is the only way to reliably stop advertising is to wait for it to time-out?

Version: nRF5 SDK 11.0.0, s132, with PCA10040 EVB

Parents
  • The Advertising Module can be used for many typical "Connectable Advertising" scenarios, but if you want other functionality you are free to modify it, or not use it at all.

    You can set the advertising data with ble_advdata_set(), and then call sd_ble_gap_adv_start() with the parameters you like. Maybe you want to advertise forever, and always stop it manually with sd_ble_gap_adv_stop()?

Reply
  • The Advertising Module can be used for many typical "Connectable Advertising" scenarios, but if you want other functionality you are free to modify it, or not use it at all.

    You can set the advertising data with ble_advdata_set(), and then call sd_ble_gap_adv_start() with the parameters you like. Maybe you want to advertise forever, and always stop it manually with sd_ble_gap_adv_stop()?

Children
Related