
Button initiated config service
Dependencies: BLE_API_EddystoneConfigService_2 mbed nRF51822
Fork of BLE_EddystoneBeaconConfigService_3 by
Diff: nrfConfigParamsPersistence.cpp
- Revision:
- 23:05e9bb3b13af
- Parent:
- 2:8020d6d4455a
- Child:
- 67:345bc62c748d
--- a/nrfConfigParamsPersistence.cpp Thu Jul 23 18:00:59 2015 +0000 +++ b/nrfConfigParamsPersistence.cpp Thu Jul 23 20:17:11 2015 +0000 @@ -20,10 +20,10 @@ /** * Nordic specific structure used to store params persistently. - * It extends ZipBeaconConfigService::Params_t with a persistence signature. + * It extends EddystoneConfigService::Params_t with a persistence signature. */ struct PersistentParams_t { - ZipBeaconConfigService::Params_t params; + EddystoneConfigService::Params_t params; uint32_t persistenceSignature; /* This isn't really a parameter, but having the expected * magic value in this field indicates persistence. */ @@ -57,7 +57,7 @@ /* Platform-specific implementation for persistence on the nRF5x. Based on the * pstorage module provided by the Nordic SDK. */ -bool loadURIBeaconConfigParams(ZipBeaconConfigService::Params_t *paramsP) +bool loadURIBeaconConfigParams(EddystoneConfigService::Params_t *paramsP) { static bool pstorageInitied = false; if (!pstorageInitied) { @@ -75,19 +75,19 @@ if ((pstorage_load(reinterpret_cast<uint8_t *>(&persistentParams), &pstorageHandle, sizeof(PersistentParams_t), 0) != NRF_SUCCESS) || (persistentParams.persistenceSignature != PersistentParams_t::MAGIC)) { // On failure zero out and let the service reset to defaults - memset(paramsP, 0, sizeof(ZipBeaconConfigService::Params_t)); + memset(paramsP, 0, sizeof(EddystoneConfigService::Params_t)); return false; } - memcpy(paramsP, &persistentParams.params, sizeof(ZipBeaconConfigService::Params_t)); + memcpy(paramsP, &persistentParams.params, sizeof(EddystoneConfigService::Params_t)); return true; } /* Platform-specific implementation for persistence on the nRF5x. Based on the * pstorage module provided by the Nordic SDK. */ -void saveURIBeaconConfigParams(const ZipBeaconConfigService::Params_t *paramsP) +void saveURIBeaconConfigParams(const EddystoneConfigService::Params_t *paramsP) { - memcpy(&persistentParams.params, paramsP, sizeof(ZipBeaconConfigService::Params_t)); + memcpy(&persistentParams.params, paramsP, sizeof(EddystoneConfigService::Params_t)); if (persistentParams.persistenceSignature != PersistentParams_t::MAGIC) { persistentParams.persistenceSignature = PersistentParams_t::MAGIC; pstorage_store(&pstorageHandle,