Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
Diff: services/URIBeaconConfigService.h
- Revision:
- 321:6330d9b08295
- Parent:
- 320:c39b901dca81
- Child:
- 322:28cd17c1b6dd
--- 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 ¶msIn,
+ 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);
