updating periodic advertising data after each advert

Hi, I use periodic advertising to send live data based on readings from an accelerometer. I want to change the advertising packet after every advert to the new values.

My advertising interval is currently set with 

    struct bt_le_per_adv_param per_adv_param =
        {
            .interval_min = 80, // 100ms		N * 1.25 milliseconds
            .interval_max = 100, // 125ms
            .options = BT_LE_PER_ADV_OPT_NONE,
        };

At the moment I just change the advertising data by calling bt_le_per_adv_set_data every 100ms. But this seems quite imprecise

Is there a way to get a callback when the advert goes out? Or to read a counter of advertisements sent? Or to stack up an array of adverts somehow?

I've looked in the docs and all I can find is radio notify event which isn't quite what I want. I don't think it differentiates between connection events and advertisements.

I've also looked through zephyr/include/zephyr/bluetooth/bluetooth.h but I couldn't find anything that looked useful

Is there an easy way to do this?

Thanks for your help.

-Jason

Related