esp-nimble-cpp
1.4.1
|
Perform and manage BLE scans. More...
Public Member Functions | |
bool | start (uint32_t duration, void(*scanCompleteCB)(NimBLEScanResults), bool is_continue=false) |
Start scanning. More... | |
NimBLEScanResults | start (uint32_t duration, bool is_continue=false) |
Start scanning and block until scanning has been completed. More... | |
bool | isScanning () |
Get the status of the scanner. More... | |
void | setAdvertisedDeviceCallbacks (NimBLEAdvertisedDeviceCallbacks *pAdvertisedDeviceCallbacks, bool wantDuplicates=false) |
Set the call backs to be invoked. More... | |
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 request a scan response. More... | |
void | setInterval (uint16_t intervalMSecs) |
Set the interval to scan. More... | |
void | setWindow (uint16_t windowMSecs) |
Set the window to actively scan. More... | |
void | setDuplicateFilter (bool enabled) |
Set whether or not the BLE controller should only report results from devices it has not already seen. More... | |
void | setLimitedOnly (bool enabled) |
Set whether or not the BLE controller only report scan results from devices advertising in limited discovery mode, i.e. directed advertising. More... | |
void | setFilterPolicy (uint8_t filter) |
Sets the scan filter policy. More... | |
void | clearDuplicateCache () |
Clears the duplicate scan filter cache. | |
bool | stop () |
Stop an in progress scan. More... | |
void | clearResults () |
Clear the results of the scan. | |
NimBLEScanResults | getResults () |
Get the results of the scan. More... | |
void | setMaxResults (uint8_t maxResults) |
Sets the max number of results to store. More... | |
void | erase (const NimBLEAddress &address) |
Delete peer device from the scan results vector. More... | |
Perform and manage BLE scans.
Scanning is associated with a BLE client that is attempting to locate BLE servers.
void NimBLEScan::erase | ( | const NimBLEAddress & | address | ) |
Delete peer device from the scan results vector.
[in] | address | The address of the device to delete from the results. |
After disconnecting, it may be required in the case we were connected to a device without a public address.
NimBLEScanResults NimBLEScan::getResults | ( | ) |
Get the results of the scan.
bool NimBLEScan::isScanning | ( | ) |
Get the status of the scanner.
void NimBLEScan::setActiveScan | ( | bool | active | ) |
Should we perform an active or passive scan? The default is a passive scan. An active scan means that we will request a scan response.
[in] | active | If true, we perform an active scan otherwise a passive scan. |
void NimBLEScan::setAdvertisedDeviceCallbacks | ( | NimBLEAdvertisedDeviceCallbacks * | pAdvertisedDeviceCallbacks, |
bool | wantDuplicates = false |
||
) |
Set the call backs to be invoked.
[in] | pAdvertisedDeviceCallbacks | Call backs to be invoked. |
[in] | wantDuplicates | True if we wish to be called back with duplicates. Default is false. |
void NimBLEScan::setDuplicateFilter | ( | bool | enabled | ) |
Set whether or not the BLE controller should only report results from devices it has not already seen.
[in] | enabled | If true, scanned devices will only be reported once. |
The controller has a limited buffer and will start reporting duplicate devices once the limit is reached.
void NimBLEScan::setFilterPolicy | ( | uint8_t | filter | ) |
Sets the scan filter policy.
[in] | filter | Can be one of:
|
void NimBLEScan::setInterval | ( | uint16_t | intervalMSecs | ) |
Set the interval to scan.
[in] | intervalMSecs | The scan interval (how often) in milliseconds. |
void NimBLEScan::setLimitedOnly | ( | bool | enabled | ) |
Set whether or not the BLE controller only report scan results from devices advertising in limited discovery mode, i.e. directed advertising.
[in] | enabled | If true, only limited discovery devices will be in scan results. |
void NimBLEScan::setMaxResults | ( | uint8_t | maxResults | ) |
Sets the max number of results to store.
[in] | maxResults | The number of results to limit storage to 0 == none (callbacks only) 0xFF == unlimited, any other value is the limit. |
void NimBLEScan::setWindow | ( | uint16_t | windowMSecs | ) |
Set the window to actively scan.
[in] | windowMSecs | How long to actively scan. |
NimBLEScanResults NimBLEScan::start | ( | uint32_t | duration, |
bool | is_continue = false |
||
) |
Start scanning and block until scanning has been completed.
[in] | duration | The duration in seconds for which to scan. |
[in] | is_continue | Set to true to save previous scan results, false to clear them. |
bool NimBLEScan::start | ( | uint32_t | duration, |
void(*)(NimBLEScanResults) | scanCompleteCB, | ||
bool | is_continue = false |
||
) |
Start scanning.
[in] | duration | The duration in seconds for which to scan. |
[in] | scanCompleteCB | A function to be called when scanning has completed. |
[in] | is_continue | Set to true to save previous scan results, false to clear them. |
bool NimBLEScan::stop | ( | ) |
Stop an in progress scan.