Lightly modified version of the BLE stack, that doesn't bring up a DFUService by default... as we have our own.
Fork of BLE_API by
Diff: services/URIBeaconConfigService.h
- Revision:
- 256:a6e651374060
- Parent:
- 255:cdb7231f83df
- Child:
- 268:bc525cdc88f7
--- a/services/URIBeaconConfigService.h Wed Jan 21 09:32:47 2015 +0000 +++ b/services/URIBeaconConfigService.h Wed Jan 21 09:32:48 2015 +0000 @@ -109,7 +109,7 @@ uriDataChar.setWriteAuthorizationCallback(this, &URIBeaconConfigService::uriDataWriteAuthorizationCallback); flagsChar.setWriteAuthorizationCallback(this, &URIBeaconConfigService::flagsAuthorizationCallback); txPowerLevelsChar.setWriteAuthorizationCallback(this, &URIBeaconConfigService::denyGATTWritesIfLocked); - txPowerModeChar.setWriteAuthorizationCallback(this, &URIBeaconConfigService::denyGATTWritesIfLocked); + txPowerModeChar.setWriteAuthorizationCallback(this, &URIBeaconConfigService::powerModeAuthorizationCallback); beaconPeriodChar.setWriteAuthorizationCallback(this, &URIBeaconConfigService::denyGATTWritesIfLocked); resetChar.setWriteAuthorizationCallback(this, &URIBeaconConfigService::denyGATTWritesIfLocked); @@ -395,6 +395,12 @@ } } + void powerModeAuthorizationCallback(GattCharacteristicWriteAuthCBParams *params) { + if (lockedState || (*(params->data) >= NUM_POWER_MODES)) { + params->authorizationReply = false; + } + } + void denyGATTWritesIfLocked(GattCharacteristicWriteAuthCBParams *params) { if (lockedState) { params->authorizationReply = false;