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

Smallest amount of advertising time?

Hi,

I would like to misuse the SDK by creating an communications systems based on advertising. From several Q&A posts, e.g. this one), I understand that the current S130 softdevice (1.0.0) does not support simultaneous advertising and scanning. If I understand that post correctly, it suggests using:

  ble_gap_adv_start(), 
  ble_gap_adv_stop(), 
  sd_ble_gap_scan_start() and
  sd_ble_gap_scan_stop()

to control the advertising.

Now, how do I create the minimum advertising/non-scanning time? I would like to send exactly one BLE Advertisement Event (i.e one advertisement on each of the three advertisement channels.)

Could I do like this: After a ble_gap_adv_start(), start a timer, set to maybe 20ms, after which I call ble_gap_adv_stop()?

Or, is there any Softdevice event that I can use to catch when the BLE Advertising Event is over?

any help appreciated.

regards, Elm

Parents
  • You can use the radio notifications in order to get notified once the radio has gone from disabled to enabled back to disabled state. The SDK module "ble_radio_notifications.c" provides simplified functionality for this.

    static void my_radio_event_handler(bool radio_active) { ... }
    
    ...
        err_code = ble_radio_notification_init(NRF_APP_PRIORITY_HIGH,
                                           NRF_RADIO_NOTIFICATION_DISTANCE_800US,
                                           my_radio_event_handler);
    

    This will then register a callback to my_radio_event_handler when the radio changes state (active/not active).

Reply
  • You can use the radio notifications in order to get notified once the radio has gone from disabled to enabled back to disabled state. The SDK module "ble_radio_notifications.c" provides simplified functionality for this.

    static void my_radio_event_handler(bool radio_active) { ... }
    
    ...
        err_code = ble_radio_notification_init(NRF_APP_PRIORITY_HIGH,
                                           NRF_RADIO_NOTIFICATION_DISTANCE_800US,
                                           my_radio_event_handler);
    

    This will then register a callback to my_radio_event_handler when the radio changes state (active/not active).

Children
Related