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.
Fork of BLE_API by
Diff: ble/GapAdvertisingParams.h
- Revision:
- 766:03f1a26f132f
- Parent:
- 710:b2e1a2660ec2
- Child:
- 778:04488024e560
--- a/ble/GapAdvertisingParams.h Fri Aug 07 15:53:50 2015 +0100 +++ b/ble/GapAdvertisingParams.h Fri Aug 07 15:53:50 2015 +0100 @@ -86,8 +86,16 @@ } } + static const uint16_t UNIT_0_625_MS = 625; /**< Number of microseconds in 0.625 milliseconds. */ + static uint16_t MSEC_TO_ADVERTISEMENT_DURATION_UNITS(uint32_t durationInMillis) { + return (durationInMillis * 1000) / UNIT_0_625_MS; + } + static uint16_t ADVERTISEMENT_DURATION_UNITS_TO_MS(uint16_t gapUnits) { + return (gapUnits * UNIT_0_625_MS) / 1000; + } + AdvertisingType_t getAdvertisingType(void) const {return _advType; } - uint16_t getInterval(void) const {return _interval;} + uint16_t getInterval(void) const {return ADVERTISEMENT_DURATION_UNITS_TO_MS(_interval);} uint16_t getTimeout(void) const {return _timeout; } void setAdvertisingType(AdvertisingType_t newAdvType) {_advType = newAdvType; }