From 19f5054adfa73f777df60ddd42297833a1a04e83 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Mon, 1 Dec 2014 10:57:36 +0000 Subject: [PATCH] no need to save defaults; they are implicit. --- services/URIBeaconConfigService.h | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/services/URIBeaconConfigService.h b/services/URIBeaconConfigService.h index 307ae83..19eb5ed 100644 --- a/services/URIBeaconConfigService.h +++ b/services/URIBeaconConfigService.h @@ -90,9 +90,6 @@ public: strcpy(reinterpret_cast(uriData), uriDataIn); configureGAP(); - if (initSucceeded) { - saveDefaults(); - } GattCharacteristic *charTable[] = {&lockedStateChar, &uriDataChar, &flagsChar, &txPowerLevelsChar, &beaconPeriodChar, &resetChar}; GattService beaconControlService(URIBeacon2ControlServiceUUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); @@ -308,20 +305,13 @@ private: 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(uriData, 0, MAX_SIZE_URI_DATA_CHAR_VALUE); + uriDataLength = 0; memset(powerLevels, 0, sizeof(powerLevels)); - flags = defaultFlags; - effectiveTxPower = defaultEffectiveTxPower; - beaconPeriod = defaultBeaconPeriod; + flags = 0; + effectiveTxPower = 0; + beaconPeriod = 0; updateGATT(); } @@ -377,11 +367,6 @@ private: uint16_t beaconPeriod; bool resetFlag; - uint8_t defaultURIData[MAX_SIZE_URI_DATA_CHAR_VALUE]; - uint8_t defaultFlags; - int8_t defaultEffectiveTxPower; - uint16_t defaultBeaconPeriod; - GattCharacteristic lockedStateChar; GattCharacteristic uriDataChar; GattCharacteristic flagsChar;