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.
Dependents: BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate BLE_ANCS_SDAPI_IRC ... more
Diff: public/GapScanningParams.h
- Revision:
- 386:d30591c3d39c
- Parent:
- 380:2109a08c311c
- Child:
- 393:77d0399da8aa
diff -r 6e66d1c6de00 -r d30591c3d39c public/GapScanningParams.h
--- a/public/GapScanningParams.h Wed May 13 08:51:08 2015 +0100
+++ b/public/GapScanningParams.h Wed May 13 08:51:08 2015 +0100
@@ -39,14 +39,43 @@
if (_interval > SCAN_INTERVAL_MAX) {
_interval = SCAN_INTERVAL_MAX;
}
+ if (_window < SCAN_WINDOW_MIN) {
+ _window = SCAN_WINDOW_MIN;
+ }
+ if (_window > SCAN_WINDOW_MAX) {
+ _window = SCAN_WINDOW_MAX;
+ }
if (_timeout > SCAN_TIMEOUT_MAX) {
_timeout = SCAN_TIMEOUT_MAX;
}
}
- void setInterval(uint16_t newInterval) {_interval = newInterval;}
- void setWindow(uint16_t newWindow) {_window = newWindow; }
- void setTimeout(uint16_t newTimeout) {_timeout = newTimeout; }
+ ble_error_t setInterval(uint16_t newInterval) {
+ if ((newInterval >= SCAN_INTERVAL_MIN) && (newInterval < SCAN_INTERVAL_MAX)) {
+ _interval = newInterval;
+ return BLE_ERROR_NONE;
+ }
+
+ return BLE_ERROR_PARAM_OUT_OF_RANGE;
+ }
+
+ ble_error_t setWindow(uint16_t newWindow) {
+ if ((newWindow >= SCAN_WINDOW_MIN) && (newWindow < SCAN_WINDOW_MAX)) {
+ _window = newWindow;
+ return BLE_ERROR_NONE;
+ }
+
+ return BLE_ERROR_PARAM_OUT_OF_RANGE;
+ }
+
+ ble_error_t setTimeout(uint16_t newTimeout) {
+ if (newTimeout <= SCAN_TIMEOUT_MAX) {
+ _timeout = newTimeout;
+ return BLE_ERROR_NONE;
+ }
+
+ return BLE_ERROR_PARAM_OUT_OF_RANGE;
+ }
uint16_t getInterval(void) const {return _interval;}
uint16_t getWindow(void) const {return _window; }