abc

Fork of BLE_API by Bluetooth Low Energy

Revision:
205:c957765916e2
Parent:
204:479f81fd5d3b
Child:
206:49646c933822
--- a/services/URIBeacon2Service.h	Mon Dec 01 14:31:17 2014 +0000
+++ b/services/URIBeacon2Service.h	Mon Dec 01 14:31:17 2014 +0000
@@ -91,11 +91,7 @@
 
         configure();
         if (initSucceeded) {
-            /* Preserve the originals to be able to reset() upon request. */
-            memcpy(defaultURIData, uriDataIn, MAX_SIZE_URI_DATA_CHAR_VALUE);
-            defaultFlags            = flagsIn;
-            defaultEffectiveTxPower = effectiveTxPowerIn;
-            defaultBeaconPeriod     = beaconPeriodIn;
+            saveDefaults();
         }
 
         GattCharacteristic *charTable[] = {&lockedStateChar, &uriDataChar, &flagsChar, &txPowerLevelsChar, &beaconPeriodChar, &resetChar};
@@ -310,6 +306,14 @@
         ble.setAdvertisingPayload();
     }
 
+    /* Preserve the defaults to be able to reset() upon request. */
+    void saveDefaults(void) {
+        memcpy(defaultURIData, uriData, MAX_SIZE_URI_DATA_CHAR_VALUE);
+        defaultFlags            = flags;
+        defaultEffectiveTxPower = effectiveTxPower;
+        defaultBeaconPeriod     = beaconPeriod;
+    }
+
     void resetDefaults(void) {
         memcpy(uriData, defaultURIData, MAX_SIZE_URI_DATA_CHAR_VALUE);
         memset(powerLevels, 0, sizeof(powerLevels));