Switch between broadcaster and peripheral | Cypress Semiconductor
Switch between broadcaster and peripheral
In a project in which it is required the embedded BLE device broadcasts permanently (the iBeacon way) when in "regular" mode and records some external sensor events. In case such event occurs:
1 - the broadcast message changes (the iBeacon minor in my case) to "I have data" mode
2 - the device switches between broadcaster and peripheral modes (say 20-30 seconds in each mode) so that another device can connect and retrieve the data and acknowledge them
It is in fact very close from Paul Donnely's topic except for the continuous switch as this project waits for acknowledge before switching back to broadcaster role.
The Day 007 peripheral and broadcaster is a good starting point but does not handle the switch aspect the way my project is expected to work.
I could not find the proper way to switch between those modes a regular time basis, for the moment the best clue I got is to decide what kind of role to start in the CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP event of my custom callback, having some WDT timer mechanism giving the time limit by stopping the current BLE advertisement or broadcast mode.
My issues are :
a - I can not determine the frequency of broadcast packets (the specifications require 2 seconds between between two packets)
b - I have no clue of the latency between stopping a mode (broadcaster or peripheral) and the beginning of the other (4 to 5 seconds would be OK)
c - Connection time in peripheral mode is very slow (about 4 seconds)
Is there some documentation and/or sample I missed that would help fixing that ?
Thanks a lot for your help,