esp-nimble-cpp  1.4.1
NimBLEScanResults Class Reference

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

Public Member Functions

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

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 * >::iterator NimBLEScanResults::begin ( )

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 * >::iterator NimBLEScanResults::end ( )

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

Get the count of devices found in the last scan.

Returns
The number of devices found in the last scan.

◆ getDevice() [1/2]

NimBLEAdvertisedDevice * NimBLEScanResults::getDevice ( const NimBLEAddress address)

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]

NimBLEAdvertisedDevice NimBLEScanResults::getDevice ( uint32_t  i)

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

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