Button initiated config service

Dependencies:   BLE_API_EddystoneConfigService_2 mbed nRF51822

Fork of BLE_EddystoneBeaconConfigService_3 by URIBeacon

Revision:
2:8020d6d4455a
Parent:
0:c04d932e96c9
Child:
7:e9800c45e065
diff -r 25315b3a440c -r 8020d6d4455a main.cpp
--- a/main.cpp	Wed May 13 10:24:38 2015 +0000
+++ b/main.cpp	Thu May 14 16:54:00 2015 +0000
@@ -19,6 +19,7 @@
 #include "ZipBeaconConfigService.h"
 #include "DFUService.h"
 #include "DeviceInformationService.h"
+#include "ConfigParamsPersistence.h"
 
 BLEDevice ble;
 ZipBeaconConfigService *zipBeaconConfig;
@@ -32,7 +33,7 @@
  *
  * The following help with this switch.
  */
-static const int CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS = 30;  // Duration after power-on that config service is available.
+static const int CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS = 60;  // Duration after power-on that config service is available.
 Ticker configAdvertisementTimeoutTicker;
 
 /**
@@ -71,10 +72,11 @@
      * operation.
      */
     ZipBeaconConfigService::Params_t params;
+    bool fetchedFromPersistentStorage = loadURIBeaconConfigParams(&params);
 
     /* Initialize a zipBeaconConfig service providing config params, default URI, and power levels. */
     static ZipBeaconConfigService::PowerLevels_t defaultAdvPowerLevels = {-20, -4, 0, 10}; // Values for ADV packets related to firmware levels
-    zipBeaconConfig = new ZipBeaconConfigService(ble, params, true /*!fetchedFromPersistentStorage*/, "http://uribeacon.org", defaultAdvPowerLevels);
+    zipBeaconConfig = new ZipBeaconConfigService(ble, params, !fetchedFromPersistentStorage, "http://uribeacon.org", defaultAdvPowerLevels);
     if (!zipBeaconConfig->configuredSuccessfully()) {
         error("failed to accommodate URI");
     }