From 9ea6d8b6c176dcb87579fcf90bc247fe0ca3c156 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Mon, 1 Dec 2014 13:39:19 +0000 Subject: [PATCH] allow update to txPowerMode from onDataWritten() --- services/URIBeaconConfigService.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/services/URIBeaconConfigService.h b/services/URIBeaconConfigService.h index 6f6e9cb..52f6195 100644 --- a/services/URIBeaconConfigService.h +++ b/services/URIBeaconConfigService.h @@ -301,11 +301,19 @@ private: } else if (params->charHandle == txPowerLevelsChar.getValueAttribute().getHandle()) { if (lockedState) { /* When locked, the device isn't allowed to update the characteristic. */ /* Restore GATT database with previous value. */ - ble.updateCharacteristicValue(txPowerLevelsChar.getValueAttribute().getHandle(), reinterpret_cast(powerLevels), NUM_POWER_MODES * sizeof(int8_t)); + updateTxPowerLevelsCharacteristic(); return; } else { memcpy(powerLevels, params->data, NUM_POWER_MODES * sizeof(int8_t)); } + } else if (params->charHandle == txPowerModeChar.getValueAttribute().getHandle()) { + if (lockedState) { /* When locked, the device isn't allowed to update the characteristic. */ + /* Restore GATT database with previous value. */ + updateTxPowerModeCharacteristic(); + return; + } else { + txPowerMode = *reinterpret_cast(params->data); + } } else if (params->charHandle == beaconPeriodChar.getValueAttribute().getHandle()) { if (lockedState) { /* When locked, the device isn't allowed to update the characteristic. */ /* Restore GATT database with previous value. */