Button initiated config service

Dependencies:   BLE_API_EddystoneConfigService_2 mbed nRF51822

Fork of BLE_EddystoneBeaconConfigService_3 by URIBeacon

Revision:
65:3b2f2a67840e
Parent:
64:6484b9e3aac0
Child:
66:e2522ba2de62
--- a/EddystoneConfigService.h	Mon Sep 21 16:49:35 2015 +0000
+++ b/EddystoneConfigService.h	Wed Sep 23 15:56:27 2015 +0000
@@ -170,11 +170,6 @@
             INFO("Reset to Defaults triggered");
             resetToDefaultsFlag = true;
         }
-        if (resetToDefaultsFlag) {
-            resetToDefaults();
-        } else {
-            updateCharacteristicValues();
-        }
 
         lockChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::lockAuthorizationCallback);
         unlockChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::unlockAuthorizationCallback);
@@ -193,6 +188,12 @@
         GattService configService(UUID_URI_BEACON_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
 
         ble.addService(configService);
+        if (resetToDefaultsFlag) {
+            resetToDefaults();
+        } else {
+            updateCharacteristicValues();
+        }
+        
         ble.onDataWritten(this, &EddystoneConfigService::onDataWrittenCallback);
 
         setupEddystoneConfigAdvertisements(); /* Setup advertising for the configService. */
@@ -422,7 +423,7 @@
     void updateCharacteristicValues(void) {
         ble.updateCharacteristicValue(lockedStateChar.getValueHandle(), &params.lockedState, 1);
         ble.updateCharacteristicValue(uriDataChar.getValueHandle(), params.uriData, params.uriDataLength); // TODO: this isnt updating the initial URI in config mode, need to figure out why.
-        //INFO("updating URI, %s : %d",params.uriData, params.uriDataLength);
+        INFO("updateCharacteristicValues - URI, %s : %d",params.uriData, params.uriDataLength);
         ble.updateCharacteristicValue(flagsChar.getValueHandle(), &params.flags, 1);
         ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(),
                                       reinterpret_cast<uint8_t *>(&params.beaconPeriod), sizeof(uint16_t));