Rtos API example
GapScanningParams Class Reference
[Gap]
Parameters defining the scan process. More...
#include <GapScanningParams.h>
Public Member Functions | |
GapScanningParams (uint16_t interval=SCAN_INTERVAL_MAX, uint16_t window=SCAN_WINDOW_MAX, uint16_t timeout=0, bool activeScanning=false) | |
Construct an instance of GapScanningParams. | |
ble_error_t | setInterval (uint16_t newIntervalInMS) |
Update the scan interval. | |
ble_error_t | setWindow (uint16_t newWindowInMS) |
Update the scan window. | |
ble_error_t | setTimeout (uint16_t newTimeout) |
Update the scan timeout. | |
void | setActiveScanning (bool activeScanning) |
Update the active scanning flag. | |
uint16_t | getInterval (void) const |
Get the scan interval. | |
uint16_t | getWindow (void) const |
Get the scan window. | |
uint16_t | getTimeout (void) const |
Get the scan timeout. | |
bool | getActiveScanning (void) const |
Check whether active scanning is set. | |
Static Public Member Functions | |
static uint16_t | MSEC_TO_SCAN_DURATION_UNITS (uint32_t durationInMillis) |
Convert milliseconds to units of 0.625ms. | |
Static Public Attributes | |
static const unsigned | SCAN_INTERVAL_MIN = 0x0004 |
Minimum Scan interval in 625us units - 2.5ms. | |
static const unsigned | SCAN_INTERVAL_MAX = 0x4000 |
Maximum Scan interval in 625us units - 10.24s. | |
static const unsigned | SCAN_WINDOW_MIN = 0x0004 |
Minimum Scan window in 625us units - 2.5ms. | |
static const unsigned | SCAN_WINDOW_MAX = 0x4000 |
Maximum Scan window in 625us units - 10.24s. | |
static const unsigned | SCAN_TIMEOUT_MIN = 0x0001 |
Minimum Scan duration in seconds. | |
static const unsigned | SCAN_TIMEOUT_MAX = 0xFFFF |
Maximum Scan duration in seconds. | |
static const uint16_t | UNIT_0_625_MS = 625 |
Number of microseconds in 0.625 milliseconds. |
Detailed Description
Parameters defining the scan process.
Four distinct parameters define the scan procedure:
- Scan window: Period during which the scanner listens to advertising channels. That value is in the range of 2.5ms to 10.24s. This value can be set at construction time, updated by calling setWindow() and retrieved by invoking getWindow().
- Scan interval: Interval between the start of two consecutive scan windows. That value shall be greater or equal to the scan window value. The maximum allowed value is 10.24ms. The scan interval value can be set at construction time, updated with a call to setInterval() and queried by a call to getInterval().
- Timeout: The duration of the scan procedure if any. It can be set at construction time, updated with setTimeout() and obtained from getTimeout().
- Active scanning: If set, then the scanner sends scan requests to a scannable or connectable advertiser. Advertisers may respond to the scan request by a scan response containing the scan response payload. If not set, then the scanner does not send any request. This flag is set at construction time, may be updated with the help of setActiveScanning() and retrieved by getActiveScanning().
- Note:
- If the scan window's duration is equal to the scan interval, then the device listens continuously during the scan procedure.
Definition at line 56 of file GapScanningParams.h.
Constructor & Destructor Documentation
GapScanningParams | ( | uint16_t | interval = SCAN_INTERVAL_MAX , |
uint16_t | window = SCAN_WINDOW_MAX , |
||
uint16_t | timeout = 0 , |
||
bool | activeScanning = false |
||
) |
Construct an instance of GapScanningParams.
- Parameters:
-
[in] interval Milliseconds interval between the start of two consecutive scan windows. The value passed is between the scan window value and 10.24 seconds. [in] window Milliseconds period during which the device listens to advertising channels. The value of the scan window is in the range of 2.5ms to 10.24s. [in] timeout Duration in seconds of the scan procedure. The special value 0 may be used when the scan procedure is not time bounded. [in] activeScanning If true, then the scanner sends scan requests to to scannable or connectable advertiser. Advertisers may respond to the scan request by a scan response containing the scan response payload. If false, the scanner does not send any request.
- Note:
- If interval is equal to window
Definition at line 20 of file GapScanningParams.cpp.
Member Function Documentation
bool getActiveScanning | ( | void | ) | const |
Check whether active scanning is set.
- Returns:
- True if active scanning is set, false otherwise.
Definition at line 204 of file GapScanningParams.h.
uint16_t getInterval | ( | void | ) | const |
Get the scan interval.
- Returns:
- the scan interval in units of 0.625ms.
Definition at line 174 of file GapScanningParams.h.
uint16_t getTimeout | ( | void | ) | const |
Get the scan timeout.
- Returns:
- The scan timeout in seconds.
Definition at line 194 of file GapScanningParams.h.
uint16_t getWindow | ( | void | ) | const |
Get the scan window.
- Returns:
- the scan window in units of 0.625ms.
Definition at line 184 of file GapScanningParams.h.
static uint16_t MSEC_TO_SCAN_DURATION_UNITS | ( | uint32_t | durationInMillis ) | [static] |
Convert milliseconds to units of 0.625ms.
- Parameters:
-
[in] durationInMillis Milliseconds to convert.
- Returns:
- The value of
durationInMillis
in units of 0.625ms.
Definition at line 129 of file GapScanningParams.h.
void setActiveScanning | ( | bool | activeScanning ) |
Update the active scanning flag.
- Parameters:
-
[in] activeScanning New boolean value of active scanning.
Definition at line 72 of file GapScanningParams.cpp.
ble_error_t setInterval | ( | uint16_t | newIntervalInMS ) |
Update the scan interval.
- Parameters:
-
[in] newIntervalInMS New scan interval in milliseconds.
- Returns:
- BLE_ERROR_NONE if the new scan interval was set successfully.
Definition at line 41 of file GapScanningParams.cpp.
ble_error_t setTimeout | ( | uint16_t | newTimeout ) |
Update the scan timeout.
- Parameters:
-
[in] newTimeout New scan timeout in seconds.
- Returns:
- BLE_ERROR_NONE if the new scan window was set successfully.
Definition at line 65 of file GapScanningParams.cpp.
ble_error_t setWindow | ( | uint16_t | newWindowInMS ) |
Update the scan window.
- Parameters:
-
[in] newWindowInMS New scan window in milliseconds.
- Returns:
- BLE_ERROR_NONE if the new scan window was set successfully.
Definition at line 53 of file GapScanningParams.cpp.
Field Documentation
const unsigned SCAN_INTERVAL_MAX = 0x4000 [static] |
Maximum Scan interval in 625us units - 10.24s.
Definition at line 66 of file GapScanningParams.h.
const unsigned SCAN_INTERVAL_MIN = 0x0004 [static] |
Minimum Scan interval in 625us units - 2.5ms.
Definition at line 61 of file GapScanningParams.h.
const unsigned SCAN_TIMEOUT_MAX = 0xFFFF [static] |
Maximum Scan duration in seconds.
Definition at line 86 of file GapScanningParams.h.
const unsigned SCAN_TIMEOUT_MIN = 0x0001 [static] |
Minimum Scan duration in seconds.
Definition at line 81 of file GapScanningParams.h.
const unsigned SCAN_WINDOW_MAX = 0x4000 [static] |
Maximum Scan window in 625us units - 10.24s.
Definition at line 76 of file GapScanningParams.h.
const unsigned SCAN_WINDOW_MIN = 0x0004 [static] |
Minimum Scan window in 625us units - 2.5ms.
Definition at line 71 of file GapScanningParams.h.
const uint16_t UNIT_0_625_MS = 625 [static] |
Number of microseconds in 0.625 milliseconds.
Definition at line 120 of file GapScanningParams.h.
Generated on Sun Jul 17 2022 08:25:40 by 1.7.2