esp-nimble-cpp 2.0.2
Loading...
Searching...
No Matches
NimBLEScanResults Class Reference

A class that contains and operates on the results of a BLE scan. More...

#include <NimBLEScan.h>

Public Member Functions

void dump () const
 Dump the scan results to the log.
 
int getCount () const
 Get the count of devices found in the last scan.
 
const NimBLEAdvertisedDevicegetDevice (uint32_t idx) const
 Return the specified device at the given index. The index should be between 0 and getCount()-1.
 
const NimBLEAdvertisedDevicegetDevice (const NimBLEAddress &address) const
 Get a pointer to the specified device at the given address. If the address is not found a nullptr is returned.
 
std::vector< NimBLEAdvertisedDevice * >::const_iterator begin () const
 Get iterator to the beginning of the vector of advertised device pointers.
 
std::vector< NimBLEAdvertisedDevice * >::const_iterator end () const
 Get iterator to the end of the vector of advertised device pointers.
 

Detailed Description

A class that contains and operates on the results of a BLE scan.

When a scan completes, we have a set of found devices. Each device is described by a NimBLEAdvertisedDevice object. The number of items in the set is given by getCount(). We can retrieve a device by calling getDevice() passing in the index (starting at 0) of the desired device.

Member Function Documentation

◆ begin()

std::vector< NimBLEAdvertisedDevice * >::const_iterator NimBLEScanResults::begin ( ) const

Get iterator to the beginning of the vector of advertised device pointers.

Returns
An iterator to the beginning of the vector of advertised device pointers.

◆ end()

std::vector< NimBLEAdvertisedDevice * >::const_iterator NimBLEScanResults::end ( ) const

Get iterator to the end of the vector of advertised device pointers.

Returns
An iterator to the end of the vector of advertised device pointers.

◆ getCount()

int NimBLEScanResults::getCount ( ) const

Get the count of devices found in the last scan.

Returns
The number of devices found in the last scan.

◆ getDevice() [1/2]

const NimBLEAdvertisedDevice * NimBLEScanResults::getDevice ( const NimBLEAddress address) const

Get a pointer to the specified device at the given address. If the address is not found a nullptr is returned.

Parameters
[in]addressThe address of the device.
Returns
A pointer to the device at the specified address.

◆ getDevice() [2/2]

const NimBLEAdvertisedDevice * NimBLEScanResults::getDevice ( uint32_t  idx) const

Return the specified device at the given index. The index should be between 0 and getCount()-1.

Parameters
[in]idxThe index of the device.
Returns
The device at the specified index.