I would like my device to advertise for 10s and then begin advertising again only on an external interrupt.
What steps are required to restart advertising without restarting the device after a timeout event has occurred?
I would like my device to advertise for 10s and then begin advertising again only on an external interrupt.
What steps are required to restart advertising without restarting the device after a timeout event has occurred?
Building a bit on what @Artucas answered: On the call to advertising_init during startup I would set the advertising timeout to 10 seconds. After advertising_start is called the device will only advertise for 10 seconds. Then in the button push handler (assuming it is done in an interrupt) I'd set a flag which I can check in the main loop. If the main loop sees the flag set I'd call advertising_init again if I needed to change the timeout to something longer/shorter and then call advertising_start again. Clear the button pushed flag when complete.
Building a bit on what @Artucas answered: On the call to advertising_init during startup I would set the advertising timeout to 10 seconds. After advertising_start is called the device will only advertise for 10 seconds. Then in the button push handler (assuming it is done in an interrupt) I'd set a flag which I can check in the main loop. If the main loop sees the flag set I'd call advertising_init again if I needed to change the timeout to something longer/shorter and then call advertising_start again. Clear the button pushed flag when complete.