ESP32  1.0.4
BLEAdvertisedDevice クラス

A representation of a BLE advertised device found by a scan. [詳解]

#include <BLEAdvertisedDevice.h>

公開メンバ関数

 BLEAdvertisedDevice ()
 
BLEAddress getAddress ()
 Get the address. [詳解]
 
uint16_t getAppearance ()
 Get the appearance. [詳解]
 
std::string getManufacturerData ()
 Get the manufacturer data. [詳解]
 
std::string getName ()
 Get the name. [詳解]
 
int getRSSI ()
 Get the RSSI. [詳解]
 
BLEScangetScan ()
 Get the scan object that created this advertisement. [詳解]
 
std::string getServiceData ()
 Get the service data. [詳解]
 
BLEUUID getServiceDataUUID ()
 Get the service data UUID. [詳解]
 
BLEUUID getServiceUUID ()
 Get the Service UUID. [詳解]
 
int8_t getTXPower ()
 Get the TX Power. [詳解]
 
uint8_tgetPayload ()
 
size_t getPayloadLength ()
 
esp_ble_addr_type_t getAddressType ()
 
void setAddressType (esp_ble_addr_type_t type)
 
bool isAdvertisingService (BLEUUID uuid)
 Check advertised serviced for existence required UUID [詳解]
 
bool haveAppearance ()
 Does this advertisement have an appearance value? [詳解]
 
bool haveManufacturerData ()
 Does this advertisement have manufacturer data? [詳解]
 
bool haveName ()
 Does this advertisement have a name value? [詳解]
 
bool haveRSSI ()
 Does this advertisement have a signal strength value? [詳解]
 
bool haveServiceData ()
 Does this advertisement have a service data value? [詳解]
 
bool haveServiceUUID ()
 Does this advertisement have a service UUID value? [詳解]
 
bool haveTXPower ()
 Does this advertisement have a transmission power value? [詳解]
 
std::string toString ()
 Create a string representation of this device. [詳解]
 

フレンド

class BLEScan
 

詳解

A representation of a BLE advertised device found by a scan.

When we perform a BLE scan, the result will be a set of devices that are advertising. This class provides a model of a detected device.

BLEAdvertisedDevice.h28 行目に定義があります。

構築子と解体子

◆ BLEAdvertisedDevice()

BLEAdvertisedDevice::BLEAdvertisedDevice ( )

BLEAdvertisedDevice.cpp21 行目に定義があります。

21  {
22  m_adFlag = 0;
23  m_appearance = 0;
24  m_deviceType = 0;
25  m_manufacturerData = "";
26  m_name = "";
27  m_rssi = -9999;
28  m_serviceData = "";
29  m_txPower = 0;
30  m_pScan = nullptr;
31 
32  m_haveAppearance = false;
33  m_haveManufacturerData = false;
34  m_haveName = false;
35  m_haveRSSI = false;
36  m_haveServiceData = false;
37  m_haveServiceUUID = false;
38  m_haveTXPower = false;
39 
40 } // BLEAdvertisedDevice

関数詳解

◆ getAddress()

BLEAddress BLEAdvertisedDevice::getAddress ( )

Get the address.

Every BLE device exposes an address that is used to identify it and subsequently connect to it. Call this function to obtain the address of the advertised device.

戻り値
The address of the advertised device.

BLEAdvertisedDevice.cpp51 行目に定義があります。

51  {
52  return m_address;
53 } // getAddress

◆ getAddressType()

esp_ble_addr_type_t BLEAdvertisedDevice::getAddressType ( )

BLEAdvertisedDevice.cpp516 行目に定義があります。

516  {
517  return m_addressType;
518 }

◆ getAppearance()

uint16_t BLEAdvertisedDevice::getAppearance ( )

Get the appearance.

A BLE device can declare its own appearance. The appearance is how it would like to be shown to an end user typcially in the form of an icon.

戻り値
The appearance of the advertised device.

BLEAdvertisedDevice.cpp64 行目に定義があります。

64  {
65  return m_appearance;
66 } // getAppearance

◆ getManufacturerData()

std::string BLEAdvertisedDevice::getManufacturerData ( )

Get the manufacturer data.

戻り値
The manufacturer data of the advertised device.

BLEAdvertisedDevice.cpp73 行目に定義があります。

73  {
74  return m_manufacturerData;
75 } // getManufacturerData

◆ getName()

std::string BLEAdvertisedDevice::getName ( )

Get the name.

戻り値
The name of the advertised device.

BLEAdvertisedDevice.cpp82 行目に定義があります。

82  {
83  return m_name;
84 } // getName

◆ getPayload()

uint8_t * BLEAdvertisedDevice::getPayload ( )

BLEAdvertisedDevice.cpp512 行目に定義があります。

512  {
513  return m_payload;
514 }

◆ getPayloadLength()

size_t BLEAdvertisedDevice::getPayloadLength ( )

BLEAdvertisedDevice.cpp524 行目に定義があります。

524  {
525  return m_payloadLength;
526 }

◆ getRSSI()

int BLEAdvertisedDevice::getRSSI ( )

Get the RSSI.

戻り値
The RSSI of the advertised device.

BLEAdvertisedDevice.cpp91 行目に定義があります。

91  {
92  return m_rssi;
93 } // getRSSI

◆ getScan()

BLEScan * BLEAdvertisedDevice::getScan ( )

Get the scan object that created this advertisement.

戻り値
The scan object.

BLEAdvertisedDevice.cpp100 行目に定義があります。

100  {
101  return m_pScan;
102 } // getScan

◆ getServiceData()

std::string BLEAdvertisedDevice::getServiceData ( )

Get the service data.

戻り値
The ServiceData of the advertised device.

BLEAdvertisedDevice.cpp109 行目に定義があります。

109  {
110  return m_serviceData;
111 } //getServiceData

◆ getServiceDataUUID()

BLEUUID BLEAdvertisedDevice::getServiceDataUUID ( )

Get the service data UUID.

戻り値
The service data UUID.

BLEAdvertisedDevice.cpp118 行目に定義があります。

118  {
119  return m_serviceDataUUID;
120 } // getServiceDataUUID

◆ getServiceUUID()

BLEUUID BLEAdvertisedDevice::getServiceUUID ( )

Get the Service UUID.

戻り値
The Service UUID of the advertised device.

BLEAdvertisedDevice.cpp127 行目に定義があります。

127  { //TODO Remove it eventually, is no longer useful
128  return m_serviceUUIDs[0];
129 } // getServiceUUID

◆ getTXPower()

int8_t BLEAdvertisedDevice::getTXPower ( )

Get the TX Power.

戻り値
The TX Power of the advertised device.

BLEAdvertisedDevice.cpp146 行目に定義があります。

146  {
147  return m_txPower;
148 } // getTXPower

◆ haveAppearance()

bool BLEAdvertisedDevice::haveAppearance ( )

Does this advertisement have an appearance value?

戻り値
True if there is an appearance value present.

BLEAdvertisedDevice.cpp156 行目に定義があります。

156  {
157  return m_haveAppearance;
158 } // haveAppearance

◆ haveManufacturerData()

bool BLEAdvertisedDevice::haveManufacturerData ( )

Does this advertisement have manufacturer data?

戻り値
True if there is manufacturer data present.

BLEAdvertisedDevice.cpp165 行目に定義があります。

165  {
166  return m_haveManufacturerData;
167 } // haveManufacturerData

◆ haveName()

bool BLEAdvertisedDevice::haveName ( )

Does this advertisement have a name value?

戻り値
True if there is a name value present.

BLEAdvertisedDevice.cpp174 行目に定義があります。

174  {
175  return m_haveName;
176 } // haveName

◆ haveRSSI()

bool BLEAdvertisedDevice::haveRSSI ( )

Does this advertisement have a signal strength value?

戻り値
True if there is a signal strength value present.

BLEAdvertisedDevice.cpp183 行目に定義があります。

183  {
184  return m_haveRSSI;
185 } // haveRSSI

◆ haveServiceData()

bool BLEAdvertisedDevice::haveServiceData ( )

Does this advertisement have a service data value?

戻り値
True if there is a service data value present.

BLEAdvertisedDevice.cpp192 行目に定義があります。

192  {
193  return m_haveServiceData;
194 } // haveServiceData

◆ haveServiceUUID()

bool BLEAdvertisedDevice::haveServiceUUID ( )

Does this advertisement have a service UUID value?

戻り値
True if there is a service UUID value present.

BLEAdvertisedDevice.cpp201 行目に定義があります。

201  {
202  return m_haveServiceUUID;
203 } // haveServiceUUID

◆ haveTXPower()

bool BLEAdvertisedDevice::haveTXPower ( )

Does this advertisement have a transmission power value?

戻り値
True if there is a transmission power value present.

BLEAdvertisedDevice.cpp210 行目に定義があります。

210  {
211  return m_haveTXPower;
212 } // haveTXPower

◆ isAdvertisingService()

bool BLEAdvertisedDevice::isAdvertisingService ( BLEUUID  uuid)

Check advertised serviced for existence required UUID

戻り値
Return true if service is advertised

BLEAdvertisedDevice.cpp135 行目に定義があります。

135  {
136  for (int i = 0; i < m_serviceUUIDs.size(); i++) {
137  if (m_serviceUUIDs[i].equals(uuid)) return true;
138  }
139  return false;
140 }

◆ setAddressType()

void BLEAdvertisedDevice::setAddressType ( esp_ble_addr_type_t  type)

BLEAdvertisedDevice.cpp520 行目に定義があります。

520  {
521  m_addressType = type;
522 }
type
Definition: mimetable.h:8

◆ toString()

std::string BLEAdvertisedDevice::toString ( void  )

Create a string representation of this device.

戻り値
A string representation of this device.

BLEAdvertisedDevice.cpp486 行目に定義があります。

486  {
487  std::string res = "Name: " + getName() + ", Address: " + getAddress().toString();
488  if (haveAppearance()) {
489  char val[6];
490  snprintf(val, sizeof(val), "%d", getAppearance());
491  res += ", appearance: ";
492  res += val;
493  }
494  if (haveManufacturerData()) {
496  res += ", manufacturer data: ";
497  res += pHex;
498  free(pHex);
499  }
500  if (haveServiceUUID()) {
501  res += ", serviceUUID: " + getServiceUUID().toString();
502  }
503  if (haveTXPower()) {
504  char val[4];
505  snprintf(val, sizeof(val), "%d", getTXPower());
506  res += ", txPower: ";
507  res += val;
508  }
509  return res;
510 } // toString
uint16_t getAppearance()
Get the appearance.
const char *const string
Definition: cJSON.h:170
std::string getManufacturerData()
Get the manufacturer data.
static char * buildHexData(uint8_t *target, uint8_t *source, uint8_t length)
Create a hex representation of data.
Definition: BLEUtils.cpp:774
std::string getName()
Get the name.
BLEUUID getServiceUUID()
Get the Service UUID.
bool haveAppearance()
Does this advertisement have an appearance value?
bool haveServiceUUID()
Does this advertisement have a service UUID value?
bool haveManufacturerData()
Does this advertisement have manufacturer data?
std::string toString()
Convert a BLE address to a string.
Definition: BLEAddress.cpp:86
bool haveTXPower()
Does this advertisement have a transmission power value?
int8_t getTXPower()
Get the TX Power.
char const int length
Definition: cJSON.h:161
std::string toString()
Get a string representation of the UUID.
Definition: BLEUUID.cpp:350
BLEAddress getAddress()
Get the address.
__uint8_t uint8_t
Definition: stdint.h:21

フレンドと関連関数の詳解

◆ BLEScan

friend class BLEScan
friend

BLEAdvertisedDevice.h60 行目に定義があります。


このクラス詳解は次のファイルから抽出されました: