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

Pre/Post Advertise Hook

Hi all,

My application gathers sensor data and uses the advertisement packet to broadcast the values (much the same as the nordic temp sensor example). Rather than having to have a separate timer which aligns with the advertise interval (which is what the example does), is there a pre-transmit hook i can use which will synchronise my sensor reads with the advertisement transmission?

Or, is the advertisement interval handled (via the SD) through an application timer? in which case is there a way i could identify which timer it is and somehow run a pre-transmit function?

Thanks for your help..

Parents
  • This is a great question. If you're not in the connected state then the only radio notifications you'll get are before and after the SD grabs the CPU to advertise.

    Using the function that Petter mentioned is easy. Invoke it in main():

    ble_radio_notification_init(NRF_APP_PRIORITY_HIGH, NRF_RADIO_NOTIFICATION_DISTANCE_800US, InterruptEvent);
    

    and define the pre/post event function that takes your sensor sample and adjusts the advertising payload:

    void InterruptEvent(bool radio_active)
    {
    }
    

    Dan

Reply
  • This is a great question. If you're not in the connected state then the only radio notifications you'll get are before and after the SD grabs the CPU to advertise.

    Using the function that Petter mentioned is easy. Invoke it in main():

    ble_radio_notification_init(NRF_APP_PRIORITY_HIGH, NRF_RADIO_NOTIFICATION_DISTANCE_800US, InterruptEvent);
    

    and define the pre/post event function that takes your sensor sample and adjusts the advertising payload:

    void InterruptEvent(bool radio_active)
    {
    }
    

    Dan

Children
Related