SDK  23.9.2
For IoT System Software Development
Public Member Functions | List of all members
BLEScanResults Class Reference

The result of having performed a scan. When a scan completes, we have a set of found devices. Each device is described by a BLEAdvertisedDevice 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. More...

#include <BLEScan.hpp>

Public Member Functions

void dump ()
 Dump the scan results to the log.
 
int getCount ()
 Return the count of devices found in the last scan. More...
 
BLEAdvertisedDevice getDevice (uint32_t i)
 Return the specified device at the given index. The index should be between 0 and getCount()-1. More...
 

Detailed Description

The result of having performed a scan. When a scan completes, we have a set of found devices. Each device is described by a BLEAdvertisedDevice 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

◆ getCount()

int BLEScanResults::getCount ( )

Return the count of devices found in the last scan.

Returns
The number of devices found in the last scan.
76  {
77  return m_vectorAdvertisedDevices.size();
78 } // getCount

◆ getDevice()

BLEAdvertisedDevice BLEScanResults::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.
87  {
88  uint32_t x = 0;
89  BLEAdvertisedDevice dev = *m_vectorAdvertisedDevices.begin()->second;
90  for (auto it = m_vectorAdvertisedDevices.begin(); it != m_vectorAdvertisedDevices.end(); it++) {
91  dev = *it->second;
92  if (x==i) break;
93  x++;
94  }
95  return dev;
96 }

The documentation for this class was generated from the following files:
BLEAdvertisedDevice
A representation of a BLE advertised device found by a scan.
Definition: BLEAdvertisedDevice.hpp:50