Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API LIS3DH mbed nRF51822 BMC050 nRF51_LowPwr nRF51_Vdd
Fork of BLE_EddystoneBeacon_Service by
Revision 4:4440953bde10, committed 2015-05-15
- Comitter:
- rgrover1
- Date:
- Fri May 15 08:13:35 2015 +0000
- Parent:
- 2:8020d6d4455a
- Child:
- 5:878741147deb
- Commit message:
- Get the Floor Period test to pass.
Changed in this revision
| ZipBeaconConfigService.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/ZipBeaconConfigService.h Thu May 14 16:54:00 2015 +0000
+++ b/ZipBeaconConfigService.h Fri May 15 08:13:35 2015 +0000
@@ -261,6 +261,21 @@
params.txPowerMode = *(writeParams->data);
} else if (handle == beaconPeriodChar.getValueHandle()) {
params.beaconPeriod = *((uint16_t *)(writeParams->data));
+
+ /* Re-map beaconPeriod to within permissible bounds if necessary. */
+ if (params.beaconPeriod != 0) {
+ bool paramsUpdated = false;
+ if (params.beaconPeriod < ble.getMinAdvertisingInterval()) {
+ params.beaconPeriod = ble.getMinAdvertisingInterval();
+ paramsUpdated = true;
+ } else if (params.beaconPeriod > ble.getMaxAdvertisingInterval()) {
+ params.beaconPeriod = ble.getMaxAdvertisingInterval();
+ paramsUpdated = true;
+ }
+ if (paramsUpdated) {
+ ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(), reinterpret_cast<uint8_t *>(¶ms.beaconPeriod), sizeof(uint16_t));
+ }
+ }
} else if (handle == resetChar.getValueHandle()) {
resetToDefaults();
}
