Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
BLEScan Class Reference

Perform and manage BLE scans. More...

#include <BLEScan.hpp>

Public Member Functions

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 ()

Detailed Description

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.

Member Function Documentation

◆ 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]activeIf 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]Theinterval in msecs.

◆ setWindow()

void BLEScan::setWindow ( uint16_t windowMSecs)

Set the window to actively scan.

Parameters
[in]windowMSecsHow 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]durationThe duration in seconds for which to scan.
[in]is_continueare we continue scan (true) or we want to clear stored devices (false)
[in]maxNumDevicesThe 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]durationThe duration in seconds for which to scan.
[in]scanCompleteCBA function to be called when scanning has completed.
[in]is_continueare we continue scan (true) or we want to clear stored devices (false)
[in]maxNumDevicesThe 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()

void BLEScan::stop ( )

Stop an in progress scan.

Returns
N/A.
Examples
nordic-nrf52-dk/BLEScanner/main.cpp.

The documentation for this class was generated from the following file: