Perform and manage BLE scans.
More...
#include <BLEScan.hpp>
|
| void | setActiveScan (bool active) |
| | Should we perform an active or passive scan? The default is a passive scan. An active scan means that we will wish a scan response.
|
|
void | setAdvertisedDeviceCallbacks (BLEAdvertisedDeviceCallbacks *pAdvertisedDeviceCallbacks, bool wantDuplicates=false) |
| void | setInterval (uint16_t intervalMSecs) |
| | Set the interval to scan.
|
| void | setWindow (uint16_t windowMSecs) |
| | Set the window to actively scan.
|
| bool | start (uint32_t duration, void(*scanCompleteCB)(BLEScanResults), bool is_continue=false, uint8_t maxNumDevices=0) |
| | Start scanning.
|
| BLEScanResults | start (uint32_t duration, bool is_continue=false, uint8_t maxNumDevices=0) |
| | Start scanning and block until scanning has been completed.
|
| void | stop () |
| | Stop an in progress scan.
|
|
void | erase (BLEAddress address) |
|
BLEScanResults | getResults () |
| | Get scan results.
|
|
void | clearResults () |
Perform and manage BLE scans.
Scanning is associated with a BLE client that is attempting to locate BLE servers.
- Examples
- nordic-nrf52-dk/BLEScanner/main.cpp.
◆ setActiveScan()
| void BLEScan::setActiveScan |
( |
bool | active | ) |
|
Should we perform an active or passive scan? The default is a passive scan. An active scan means that we will wish a scan response.
- Parameters
-
| [in] | active | If true, we perform an active scan otherwise a passive scan. |
- Returns
- N/A.
- Examples
- nordic-nrf52-dk/BLEScanner/main.cpp.
◆ setInterval()
| void BLEScan::setInterval |
( |
uint16_t | intervalMSecs | ) |
|
Set the interval to scan.
- Parameters
-
| [in] | The | interval in msecs. |
◆ setWindow()
| void BLEScan::setWindow |
( |
uint16_t | windowMSecs | ) |
|
Set the window to actively scan.
- Parameters
-
| [in] | windowMSecs | How long to actively scan. |
◆ start() [1/2]
| BLEScanResults BLEScan::start |
( |
uint32_t | duration, |
|
|
bool | is_continue = false, |
|
|
uint8_t | maxNumDevices = 0 ) |
Start scanning and block until scanning has been completed.
- Parameters
-
| [in] | duration | The duration in seconds for which to scan. |
| [in] | is_continue | are we continue scan (true) or we want to clear stored devices (false) |
| [in] | maxNumDevices | The maximum device number of scan result. If the number of scanned devices reaches maxNumDevices, the scan is stopped and scanCompleteCB is called directly. If 0 (default), there is no limit. |
- Returns
- The BLEScanResults.
◆ start() [2/2]
| bool BLEScan::start |
( |
uint32_t | duration, |
|
|
void(* | scanCompleteCB )(BLEScanResults), |
|
|
bool | is_continue = false, |
|
|
uint8_t | maxNumDevices = 0 ) |
Start scanning.
- Parameters
-
| [in] | duration | The duration in seconds for which to scan. |
| [in] | scanCompleteCB | A function to be called when scanning has completed. |
| [in] | is_continue | are we continue scan (true) or we want to clear stored devices (false) |
| [in] | maxNumDevices | The maximum device number of scan result. If the number of scanned devices reaches maxNumDevices, the scan is stopped and scanCompleteCB is called directly. If 0 (default), there is no limit. |
- Returns
- True if scan started or false if there was an error.
- Examples
- nordic-nrf52-dk/BLEScanner/main.cpp.
◆ stop()
The documentation for this class was generated from the following file: