
Button initiated config service
Dependencies: BLE_API_EddystoneConfigService_2 mbed nRF51822
Fork of BLE_EddystoneBeaconConfigService_3 by
Revision 65:3b2f2a67840e, committed 2015-09-23
- Comitter:
- mbedAustin
- Date:
- Wed Sep 23 15:56:27 2015 +0000
- Parent:
- 64:6484b9e3aac0
- Child:
- 66:e2522ba2de62
- Commit message:
- modified initialization routine order for config service to update characteristics only after they had been initialized.
Changed in this revision
BLE_API.lib | Show annotated file Show diff for this revision Revisions of this file |
EddystoneConfigService.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/BLE_API.lib Mon Sep 21 16:49:35 2015 +0000 +++ b/BLE_API.lib Wed Sep 23 15:56:27 2015 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/URIBeacon/code/BLE_API_EddystoneConfigService_2/#5ee540bd2bac +https://developer.mbed.org/teams/URIBeacon/code/BLE_API_EddystoneConfigService_2/#e6196f12f1fa
--- a/EddystoneConfigService.h Mon Sep 21 16:49:35 2015 +0000 +++ b/EddystoneConfigService.h Wed Sep 23 15:56:27 2015 +0000 @@ -170,11 +170,6 @@ INFO("Reset to Defaults triggered"); resetToDefaultsFlag = true; } - if (resetToDefaultsFlag) { - resetToDefaults(); - } else { - updateCharacteristicValues(); - } lockChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::lockAuthorizationCallback); unlockChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::unlockAuthorizationCallback); @@ -193,6 +188,12 @@ GattService configService(UUID_URI_BEACON_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); ble.addService(configService); + if (resetToDefaultsFlag) { + resetToDefaults(); + } else { + updateCharacteristicValues(); + } + ble.onDataWritten(this, &EddystoneConfigService::onDataWrittenCallback); setupEddystoneConfigAdvertisements(); /* Setup advertising for the configService. */ @@ -422,7 +423,7 @@ void updateCharacteristicValues(void) { ble.updateCharacteristicValue(lockedStateChar.getValueHandle(), ¶ms.lockedState, 1); ble.updateCharacteristicValue(uriDataChar.getValueHandle(), params.uriData, params.uriDataLength); // TODO: this isnt updating the initial URI in config mode, need to figure out why. - //INFO("updating URI, %s : %d",params.uriData, params.uriDataLength); + INFO("updateCharacteristicValues - URI, %s : %d",params.uriData, params.uriDataLength); ble.updateCharacteristicValue(flagsChar.getValueHandle(), ¶ms.flags, 1); ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(), reinterpret_cast<uint8_t *>(¶ms.beaconPeriod), sizeof(uint16_t));