Changing Advertisement and connection intervals at run time? NCS

Hi all,

I have an BLE application where i wish to measure the devices power consumption. I am trying to measure the affect of changing the connection interval, MTU size and advertisement interval. I'd like to connect with default parameters, then once connected, write the new connection interval, advertisement interval and MTU size to characteristics. I then want to disconnect the device, for the device to go back into advertising mode, (with the new period set), ask for he newly set connection period on the next request, and have a different MTU size. Is this possible to do at runtime?

Using the NCS it's quite difficult to find where these values are passed in and initialised. for advertisement i see the following:

bt_le_adv_start(..) - Easy to set the initial configuration parameters...
But after that, once connected, i don't see a call to something to stop the advertising such as bt_le_adv_stop()? I see that once a connection is terminated it calls (conn.c) bt_le_adv_resume. Is there any way that i can have the resume function, take new parameters? Is there a data structure visible to me after the initial bt_le_adv_start function, that i can modify? if so, how to i get it? I see there are functions in the adv.c API to change the params, but they require a refence to an advertising object that i do not have a reference to when dealing with legacy mode.
I tried calling bt_le_adv_start, with new params while connected in the callback for setting a characteristic, in the hope that it might update the current params, but this caused a stack overflow.
As for connection, I am currently changing the connection interval in  the prj.conf file. I am not sure how i would go about changing this or calling the required sequence of functions in order to change this at runtime. Is this possible? It doesn't have to change immediately, could also be on reconnection.ble
Thanks

 
Parents Reply Children
No Data
Related