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
GapScanningParams.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef __GAP_SCANNING_PARAMS_H__ 00018 #define __GAP_SCANNING_PARAMS_H__ 00019 00020 class GapScanningParams { 00021 public: 00022 static const unsigned SCAN_INTERVAL_MIN = 0x0004; /**< Minimum Scan interval in 625 us units, i.e. 2.5 ms. */ 00023 static const unsigned SCAN_INTERVAL_MAX = 0x4000; /**< Maximum Scan interval in 625 us units, i.e. 10.24 s. */ 00024 static const unsigned SCAN_WINDOW_MIN = 0x0004; /**< Minimum Scan window in 625 us units, i.e. 2.5 ms. */ 00025 static const unsigned SCAN_WINDOW_MAX = 0x4000; /**< Maximum Scan window in 625 us units, i.e. 10.24 s. */ 00026 static const unsigned SCAN_TIMEOUT_MIN = 0x0001; /**< Minimum Scan timeout in seconds. */ 00027 static const unsigned SCAN_TIMEOUT_MAX = 0xFFFF; /**< Maximum Scan timeout in seconds. */ 00028 00029 public: 00030 GapScanningParams(uint16_t interval = SCAN_INTERVAL_MAX, 00031 uint16_t window = SCAN_WINDOW_MAX, 00032 uint16_t timeout = 0, 00033 bool activeScanning = false); 00034 00035 ble_error_t setInterval(uint16_t newIntervalInMS); 00036 00037 ble_error_t setWindow(uint16_t newWindowInMS); 00038 00039 ble_error_t setTimeout(uint16_t newTimeout); 00040 00041 void setActiveScanning(bool activeScanning); 00042 00043 public: 00044 /* @Note: The following return durations in units of 0.625 ms */ 00045 uint16_t getInterval(void) const {return _interval;} 00046 uint16_t getWindow(void) const {return _window; } 00047 00048 uint16_t getTimeout(void) const {return _timeout; } 00049 bool getActiveScanning(void) const {return _activeScanning;} 00050 00051 private: 00052 uint16_t _interval; /**< Scan interval in units of 625us (between 2.5ms to 10.24s). */ 00053 uint16_t _window; /**< Scan window in units of 625us (between 2.5ms to 10.24s). */ 00054 uint16_t _timeout; /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ 00055 bool _activeScanning; /**< obtain not only the advertising data from the peer device, but also their scanResponse if possible. */ 00056 00057 private: 00058 /* disallow copy constructor */ 00059 GapScanningParams(const GapScanningParams &); 00060 GapScanningParams& operator =(const GapScanningParams &in); 00061 }; 00062 00063 #endif // ifndef __GAP_SCANNING_PARAMS_H__
Generated on Wed Jul 13 2022 03:06:59 by
1.7.2
