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

How to stop advertising ?

Hi,

I am testing **ble_app_uart example in the path of nRF51-SDK\nRF51_SDK_9.0.0_2e23562\examples\ble_peripheral\ble_app_uart\pca10028\s110 \arm5_no_packs\ble_app_uart_s100_pca10028.

I want to start and stop advertising manually on a certain condition.

ble_advertising_start(BLE_ADV_MODE_FAST) works for advertising . But I can't stop it.

I tried several ways, still in trouble.

I need help.

Thanks.

Parents
  • I believe you can use a combination of ble_advertising_start(BLE_ADV_MODE_IDLE); and sd_ble_gap_adv_stop(); to stop the advertisement and keep it stopped. Without the first call the library might restart advertisement on ble/sys events if you have them dispatched. Without the latter call the library won't stop advertising on its own.

    It's rather odd that the library doesn't provide an explicit way to stop advertising. Maybe a bug/lack of a feature or maybe I don't understand the use case. :)

Reply
  • I believe you can use a combination of ble_advertising_start(BLE_ADV_MODE_IDLE); and sd_ble_gap_adv_stop(); to stop the advertisement and keep it stopped. Without the first call the library might restart advertisement on ble/sys events if you have them dispatched. Without the latter call the library won't stop advertising on its own.

    It's rather odd that the library doesn't provide an explicit way to stop advertising. Maybe a bug/lack of a feature or maybe I don't understand the use case. :)

Children
Related