This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

change advertising every time (event ?)

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();
    ...
    }
    
Related