esp-nimble-cpp 2.0.2
|
A BLE device address. More...
#include <NimBLEAddress.h>
Inherits ble_addr_t.
Public Member Functions | |
NimBLEAddress ()=default | |
Create a blank address, i.e. 00:00:00:00:00:00, type 0. | |
NimBLEAddress (const ble_addr_t address) | |
Create an address from the native NimBLE representation. | |
NimBLEAddress (const uint8_t address[BLE_DEV_ADDR_LEN], uint8_t type) | |
Constructor for compatibility with bluedroid esp library using native ESP representation. | |
NimBLEAddress (const std::string &stringAddress, uint8_t type) | |
Create an address from a hex string. | |
NimBLEAddress (const uint64_t &address, uint8_t type) | |
Constructor for address using a hex value. Use the same byte order, so use 0xa4c1385def16 for "a4:c1:38:5d:ef:16". | |
bool | isRpa () const |
Determine if this address is a Resolvable Private Address. | |
bool | isNrpa () const |
Determine if this address is a Non-Resolvable Private Address. | |
bool | isStatic () const |
Determine if this address is a Static Address. | |
bool | isPublic () const |
Determine if this address is a Public Address. | |
bool | isNull () const |
Determine if this address is a NULL Address. | |
bool | equals (const NimBLEAddress &otherAddress) const |
Determine if this address equals another. | |
const ble_addr_t * | getBase () const |
Get the NimBLE base struct of the address. | |
std::string | toString () const |
Convert a BLE address to a string. | |
uint8_t | getType () const |
Get the address type. | |
const uint8_t * | getVal () const |
Get the address value. | |
const NimBLEAddress & | reverseByteOrder () |
Reverse the byte order of the address. | |
bool | operator== (const NimBLEAddress &rhs) const |
Convenience operator to check if this address is equal to another. | |
bool | operator!= (const NimBLEAddress &rhs) const |
Convenience operator to check if this address is not equal to another. | |
operator std::string () const | |
Convenience operator to convert this address to string representation. | |
operator uint64_t () const | |
Convenience operator to convert the native address representation to uint_64. | |
A BLE device address.
Every BLE device has a unique address which can be used to identify it and form connections.
NimBLEAddress::NimBLEAddress | ( | const ble_addr_t | address | ) |
Create an address from the native NimBLE representation.
[in] | address | The native NimBLE address. |
NimBLEAddress::NimBLEAddress | ( | const uint8_t | address[BLE_DEV_ADDR_LEN], |
uint8_t | type | ||
) |
Constructor for compatibility with bluedroid esp library using native ESP representation.
[in] | address | A uint8_t[6] or esp_bd_addr_t containing the address. |
[in] | type | The type of the address should be one of:
|
NimBLEAddress::NimBLEAddress | ( | const std::string & | addr, |
uint8_t | type | ||
) |
Create an address from a hex string.
A hex string is of the format:
which is 17 characters in length.
[in] | addr | The hex string representation of the address. |
[in] | type | The type of the address, should be one of:
|
NimBLEAddress::NimBLEAddress | ( | const uint64_t & | address, |
uint8_t | type | ||
) |
Constructor for address using a hex value.
Use the same byte order, so use 0xa4c1385def16 for "a4:c1:38:5d:ef:16".
[in] | address | uint64_t containing the address. |
[in] | type | The type of the address should be one of:
|
bool NimBLEAddress::equals | ( | const NimBLEAddress & | otherAddress | ) | const |
Determine if this address equals another.
[in] | otherAddress | The other address to compare against. |
const ble_addr_t * NimBLEAddress::getBase | ( | ) | const |
Get the NimBLE base struct of the address.
uint8_t NimBLEAddress::getType | ( | ) | const |
Get the address type.
const uint8_t * NimBLEAddress::getVal | ( | ) | const |
Get the address value.
bool NimBLEAddress::isNrpa | ( | ) | const |
Determine if this address is a Non-Resolvable Private Address.
bool NimBLEAddress::isNull | ( | ) | const |
Determine if this address is a NULL Address.
bool NimBLEAddress::isPublic | ( | ) | const |
Determine if this address is a Public Address.
bool NimBLEAddress::isRpa | ( | ) | const |
Determine if this address is a Resolvable Private Address.
bool NimBLEAddress::isStatic | ( | ) | const |
Determine if this address is a Static Address.
NimBLEAddress::operator std::string | ( | ) | const |
Convenience operator to convert this address to string representation.
This allows passing NimBLEAddress to functions that accept std::string and/or it's methods as a parameter.
const NimBLEAddress & NimBLEAddress::reverseByteOrder | ( | ) |
Reverse the byte order of the address.
std::string NimBLEAddress::toString | ( | ) | const |
Convert a BLE address to a string.