Button initiated config service
Dependencies: BLE_API_EddystoneConfigService_2 mbed nRF51822
Fork of BLE_EddystoneBeaconConfigService_3 by
Diff: EddystoneConfigService.h
- Revision:
- 55:3818a9fa827d
- Parent:
- 50:52a8b18d5bf1
- Child:
- 56:f95c72f9c504
--- a/EddystoneConfigService.h Wed Sep 16 17:29:51 2015 +0000 +++ b/EddystoneConfigService.h Thu Sep 17 20:23:46 2015 +0000 @@ -123,7 +123,8 @@ */ EddystoneConfigService(BLEDevice &bleIn, Params_t ¶msIn, - PowerLevels_t &defaultAdvPowerLevelsIn) : + PowerLevels_t &defaultAdvPowerLevelsIn, + PowerLevels_t &radioPowerLevelsIn) : ble(bleIn), params(paramsIn), // Initialize URL Data defaultUriDataLength(0), @@ -133,6 +134,7 @@ defaultUrlPower(defaultAdvPowerLevelsIn[params.txPowerMode]), defaultUidPower(defaultAdvPowerLevelsIn[params.txPowerMode]), defaultAdvPowerLevels(defaultAdvPowerLevelsIn), + radioPowerLevels(radioPowerLevelsIn), initSucceeded(false), resetFlag(), tlmIsSet(false), @@ -284,7 +286,7 @@ reinterpret_cast<uint8_t *>(&defaultAdvPowerLevels[EddystoneConfigService::TX_POWER_MODE_LOW]), sizeof(uint8_t)); - ble.setTxPower(params.advPowerLevels[params.txPowerMode]); + ble.setTxPower(radioPowerLevels[params.txPowerMode]); ble.setDeviceName(reinterpret_cast<const uint8_t *>(&DEVICE_NAME)); ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); ble.setAdvertisingInterval(GapAdvertisingParams::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(ADVERTISING_INTERVAL_MSEC)); @@ -301,7 +303,7 @@ extern void saveURIBeaconConfigParams(const Params_t *paramsP); /* forward declaration; necessary to avoid a circular dependency. */ saveURIBeaconConfigParams(¶ms); // Setup Eddystone Service - static EddystoneService eddyServ(ble,params.beaconPeriod,params.advPowerLevels[params.txPowerMode]); + static EddystoneService eddyServ(ble,params.beaconPeriod,radioPowerLevels[params.txPowerMode]); // Set configured frames (TLM,UID,URI...etc) if(params.tlmEnabled){ eddyServ.setTLMFrameData(params.tlmVersion,params.tlmBeaconPeriod); @@ -495,7 +497,8 @@ Ticker timeSinceBootTick; Timeout switchFrame; // Default value that is restored on reset - PowerLevels_t &defaultAdvPowerLevels; + PowerLevels_t &defaultAdvPowerLevels; // this goes into the advertising frames (radio power measured at 1m from device) + PowerLevels_t &radioPowerLevels; // this configures the power levels of the radio uint8_t lockedState; bool initSucceeded; uint8_t resetFlag;