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

How to send a single advertisement event?

Hi,

Is it possible to send a advertisements for a single (or a fixed number of) Advertising Events? I need to control the number of Advertising Events "sent" for a mesh application.

The method I use to day is to start an app_timer, set to a short time interval. Unfortunately, this method is not deterministic. Setting the time for (e.g.) 4 advertisements, I get between 3 and 5 advertisements sent.

regards, Elm

Parents
  • Hi Elm,

    In case your precision must be better then 1-second resolution of p_adv_params.timeout parameter - which you put into sd_ble_gap_adv_start(...) function call during advertisement start-up - then I recommend to enable ble_radio_notification module with respective callback which will notify your app before and/or after every adv. interval so you can put the counter there and stop it whenever you are done. Just note that you will get notifications also on every connection interval so be careful when you run advertisement simultaneously to any BLE connection.

    You can see some example code here (also in SDK and many places of this forum).

    Cheers Jan

Reply
  • Hi Elm,

    In case your precision must be better then 1-second resolution of p_adv_params.timeout parameter - which you put into sd_ble_gap_adv_start(...) function call during advertisement start-up - then I recommend to enable ble_radio_notification module with respective callback which will notify your app before and/or after every adv. interval so you can put the counter there and stop it whenever you are done. Just note that you will get notifications also on every connection interval so be careful when you run advertisement simultaneously to any BLE connection.

    You can see some example code here (also in SDK and many places of this forum).

    Cheers Jan

Children
No Data
Related