Setting a Timer
The easiest way I found to set a timer is to call
This call is used for setting the timeout value for turning the advertising back on in the code. We are going to modify it so that we can turn the advertising off. I don’t know the framework good enough to start adding tasks. Instead we are going to modify
GAPRole_ProcessEvent( uint8 task_id, uint16 events ) to take a new message that tells it to turn off the radio. In my case I called it STOP_ADVERTISING_EVT. This needs to run the following commands:
else if (events & STOP_ADVERTISING_EVT)
gapRole_AdvEnabled = FALSE;
return ( events ^ STOP_ADVERTISING_EVT );
This should help you as you work on making the example project match what you are actually doing. Don’t expect this to be a one day project. There’s a lot (remove the static typing from this variable, include this header, etc.). I left out in the name of brevity here. Hopefully I’ll get another post out to go along with this. Until next time.