Hello,
I have to change custom advertising every time to create an anti replay system.
Is there any event fired after each advertising sent ?
Hello,
I have to change custom advertising every time to create an anti replay system.
Is there any event fired after each advertising sent ?
You need to enable radio notification. You can enable it for nACTIVE signal, which will make SD to send the application an event after every advertising event ended. Then you can configure your packet for next packet in that event.
Here is an example
void ble_on_radio_active_evt(bool radio_active)
{
// change adv packet here
}
static void radio_notification_init(void)
{
uint32_t err_code;
err_code = ble_radio_notification_init(NRF_APP_PRIORITY_LOW,
NRF_RADIO_NOTIFICATION_DISTANCE_800US,
ble_on_radio_active_evt);
err_code = sd_radio_notification_cfg_set(NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE,
NRF_RADIO_NOTIFICATION_DISTANCE_800US);
APP_ERROR_CHECK(err_code);
}
int main(void)
{
...
radio_notification_init();
...
}
You need to enable radio notification. You can enable it for nACTIVE signal, which will make SD to send the application an event after every advertising event ended. Then you can configure your packet for next packet in that event.
Here is an example
void ble_on_radio_active_evt(bool radio_active)
{
// change adv packet here
}
static void radio_notification_init(void)
{
uint32_t err_code;
err_code = ble_radio_notification_init(NRF_APP_PRIORITY_LOW,
NRF_RADIO_NOTIFICATION_DISTANCE_800US,
ble_on_radio_active_evt);
err_code = sd_radio_notification_cfg_set(NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE,
NRF_RADIO_NOTIFICATION_DISTANCE_800US);
APP_ERROR_CHECK(err_code);
}
int main(void)
{
...
radio_notification_init();
...
}