- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm working on customizing Day9 of the 100 Projects, Dynamic Broadcaster. Rather than have it hibernate after each advertisement timeout, I would like to keep advertising while its scanned (eventually implementing a whitelist), then hybernate/sleep after a certain length of time after the last scan. The first question is, what event or state tells the Broadcaster that it has been scanned? So, in a nutshell, it'd be coded as such:
case CYBLE_EVT_GAP_DEVICE_DISCONNECTED:
CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
isScanned = FALSE;
break;
case [Event when device is scanned]:
isScanned = TRUE;
case CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP:
if(CyBle_GetState() == [State if scanned]) or if (isScanned)
{
CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
isScanned = FALSE;
}
else {
Hibernate or Sleep
}
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Dynamic broadcaster does establish any connection.
When it is in advertising mode you won;t get to know whether some other central is scanning or not.
Your code snippet doesn;t work.
-->case CYBLE_EVT_GAP_DEVICE_DISCONNECTED will never trigger as it doesn;t establish connection
-->"case CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP:
if(CyBle_GetState() == [State if scanned]) or if (isScanned)
{
CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
isScanned = FALSE;
}
else {
Hibernate or Sleep
}"
Code is wrong. This event triggers only when advertisement is started or stopped.
When advertisement is stopped you can go to hibernate and wakeup on external GPIO interrupts.
As in hibernate all clocks are OFF. So if you want to wakeup after some time you need to use DEEPSLEEP mode and use WDT timers to triggers an interrupt after some time.
Regards,
Vikas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Dynamic broadcaster does establish any connection.
When it is in advertising mode you won;t get to know whether some other central is scanning or not.
Your code snippet doesn;t work.
-->case CYBLE_EVT_GAP_DEVICE_DISCONNECTED will never trigger as it doesn;t establish connection
-->"case CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP:
if(CyBle_GetState() == [State if scanned]) or if (isScanned)
{
CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
isScanned = FALSE;
}
else {
Hibernate or Sleep
}"
Code is wrong. This event triggers only when advertisement is started or stopped.
When advertisement is stopped you can go to hibernate and wakeup on external GPIO interrupts.
As in hibernate all clocks are OFF. So if you want to wakeup after some time you need to use DEEPSLEEP mode and use WDT timers to triggers an interrupt after some time.
Regards,
Vikas