An updated version of the URIBeacon implementation that uses the new Eddystone-URL format.
Dependencies: BLE_API mbed nRF51822
Diff: nrfConfigParamsPersistence.cpp
- Revision:
- 1:0ad7573b5918
- Parent:
- 0:094734b4e8bd
--- a/nrfConfigParamsPersistence.cpp Mon Aug 17 04:41:01 2015 +0000 +++ b/nrfConfigParamsPersistence.cpp Tue Aug 18 00:45:39 2015 +0000 @@ -20,10 +20,10 @@ /** * Nordic specific structure used to store params persistently. - * It extends URIBeaconConfigService::Params_t with a persistence signature. + * It extends EddystoneURLConfigService::Params_t with a persistence signature. */ struct PersistentParams_t { - URIBeaconConfigService::Params_t params; + EddystoneURLConfigService::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(URIBeaconConfigService::Params_t *paramsP) +bool loadEddystoneURLConfigParams(EddystoneURLConfigService::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(URIBeaconConfigService::Params_t)); + memset(paramsP, 0, sizeof(EddystoneURLConfigService::Params_t)); return false; } - memcpy(paramsP, &persistentParams.params, sizeof(URIBeaconConfigService::Params_t)); + memcpy(paramsP, &persistentParams.params, sizeof(EddystoneURLConfigService::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 URIBeaconConfigService::Params_t *paramsP) +void saveEddystoneURLConfigParams(const EddystoneURLConfigService::Params_t *paramsP) { - memcpy(&persistentParams.params, paramsP, sizeof(URIBeaconConfigService::Params_t)); + memcpy(&persistentParams.params, paramsP, sizeof(EddystoneURLConfigService::Params_t)); if (persistentParams.persistenceSignature != PersistentParams_t::MAGIC) { persistentParams.persistenceSignature = PersistentParams_t::MAGIC; pstorage_store(&pstorageHandle,