Improve readability with getHandle inline
Fork of BLE_API by
Revision 212:852d45a52016, committed 2014-12-01
- Comitter:
- rgrover1
- Date:
- Mon Dec 01 14:31:18 2014 +0000
- Parent:
- 211:f181effe5de3
- Child:
- 213:ac3b745af1d0
- Commit message:
- Synchronized with git rev 19f5054a
Author: Rohit Grover
no need to save defaults; they are implicit.
Changed in this revision
services/URIBeaconConfigService.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/services/URIBeaconConfigService.h Mon Dec 01 14:31:18 2014 +0000 +++ b/services/URIBeaconConfigService.h Mon Dec 01 14:31:18 2014 +0000 @@ -90,9 +90,6 @@ strcpy(reinterpret_cast<char *>(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 @@ 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 @@ 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;