Base BLE structure ble_advertising_t contains a member structure ble_adv_mode_config_t. This structure contains two parameters that are meant to limit number of advertisements sent by the beacon : duration and max_adv_evts. Both, when set, are supposed to trigger BLE flag BLE_GAP_EVT_ADV_SET_TERMINATED.
In practise:
- setting duration parameter to valid value works as expected - after specified amount of time an event is registered in ble_event.c (seen in sd module debug log);
in ble_evt_handler, BLE_GAP_EVT_ADV_SET_TERMINATED flag is triggered correctly -
setting max_adv_evts parameter to valid value does not have any effect - advertisements continue to occur after number specified, no events are registered in ble_event.c log and BLE_GAP_EVT_ADV_SET_TERMINATED flag is not raised
This behavior was observed in:
- SDK 15.2.0., s132, using ble_app_hrs_freertos example
- SDK 15.2.0., s140, using ble_app_hrs_freertos example
- SDK 16.0.0, s132, using ble_app_hrs_freertos example
- SDK 16.0.0, s140, using ble_app_hrs_freertos example
Only modification to the ble_app_hrs_freertos example was to set adv interval to 1 second, timeout to 20 seconds, max_adv_evts to 10; no other functionality was altered; proper SDK functions and tokens were used for converting milliseconds to SDK units.
Is this a known bug?
If not, would appreciate for another pair of eyes to take a look and try to replicate the issue.