Lightly modified version of the BLE stack, that doesn't bring up a DFUService by default... as we have our own.

Fork of BLE_API by Bluetooth Low Energy

Revision:
321:6330d9b08295
Parent:
320:c39b901dca81
Child:
322:28cd17c1b6dd
diff -r c39b901dca81 -r 6330d9b08295 services/URIBeaconConfigService.h
--- a/services/URIBeaconConfigService.h	Fri Mar 13 09:57:57 2015 +0000
+++ b/services/URIBeaconConfigService.h	Fri Mar 13 09:57:57 2015 +0000
@@ -71,9 +71,6 @@
         PowerLevels_t advPowerLevels; // Current value of AdvertisedPowerLevels
         uint8_t       txPowerMode;    // Firmware power levels used with setTxPower()
         uint16_t      beaconPeriod;
-        uint32_t      persistenceSignature; /* This isn't really a parameter, but having the expected magic value in
-                                             * this field indicates persistence. */
-        static const uint32_t MAGIC = 0x1BEAC000; // Magic that identifies persistence
     };
 
     /**
@@ -82,6 +79,11 @@
      * @param[in/out] paramsIn
      *                    Reference to application-visible beacon state, loaded
      *                    from persistent storage at startup.
+     * @paramsP[in]   resetToDefaultsFlag
+     *                    Applies to the state of the 'paramsIn' parameter.
+     *                    If true, it indicates that paramsIn is potentially
+     *                    un-initialized, and default values should be used
+     *                    instead. Otherwise, paramsIn overrides the defaults.
      * @param[in]     defaultUriDataIn
      *                    Default un-encoded URI; applies only if the resetToDefaultsFlag is true.
      * @param[in]     defaultAdvPowerLevelsIn
@@ -89,6 +91,7 @@
      */
     URIBeaconConfigService(BLEDevice     &bleIn,
                            Params_t      &paramsIn,
+                           bool          resetToDefaultsFlag,
                            const char   *defaultURIDataIn,
                            PowerLevels_t &defaultAdvPowerLevelsIn) :
         ble(bleIn),
@@ -114,19 +117,17 @@
             return;
         }
 
-        bool resetToDefaultsFlag = params.persistenceSignature != Params_t::MAGIC;
         if (!resetToDefaultsFlag && (params.uriDataLength > URI_DATA_MAX)) {
             resetToDefaultsFlag = true;
         }
-
-        lockedState = isLocked();
-
         if (resetToDefaultsFlag) {
             resetToDefaults();
         } else {
             updateCharacteristicValues();
         }
 
+        lockedState = isLocked();
+
         lockChar.setWriteAuthorizationCallback(this, &URIBeaconConfigService::lockAuthorizationCallback);
         unlockChar.setWriteAuthorizationCallback(this, &URIBeaconConfigService::unlockAuthorizationCallback);
         uriDataChar.setWriteAuthorizationCallback(this, &URIBeaconConfigService::uriDataWriteAuthorizationCallback);