Sample program

Dependencies:   BLE_API mbed nRF51822

Fork of mbed_EddystoneURL_Beacon_ssci by Mako SHIMURA

Revision:
2:420532c6dd54
Parent:
1:0ad7573b5918
Child:
3:159eb1a94bbb
--- a/main.cpp	Tue Aug 18 00:45:39 2015 +0000
+++ b/main.cpp	Wed Aug 19 04:41:21 2015 +0000
@@ -33,7 +33,7 @@
  *
  * The following help with this switch.
  */
-static const int CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS = 15;  // Duration after power-on that config service is available.
+static const int CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS = 30;  // Duration after power-on that config service is available.
 Ticker configAdvertisementTimeoutTicker;
 
 /**
@@ -44,10 +44,9 @@
     Gap::GapState_t state;
     state = ble.getGapState();
     if (!state.connected) { /* don't switch if we're in a connected state. */
+        configAdvertisementTimeoutTicker.detach(); /* disable the callback from the timeout Ticker. */
         eddystoneUrlConfig->setupEddystoneURLAdvertisements();
         ble.startAdvertising();
-
-        configAdvertisementTimeoutTicker.detach(); /* disable the callback from the timeout Ticker. */
     }
 }
 
@@ -56,6 +55,8 @@
  */
 void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
 {
+    configAdvertisementTimeoutTicker.detach(); /* disable the callback from the timeout Ticker. */
+    eddystoneUrlConfig->setupEddystoneURLAdvertisements();
     ble.startAdvertising();
 }