mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-12-22 19:10:46 +01:00
Add isRpa
method to NimBLEAddress.
This provides and easy way to check if the peer address is a Resolvable Private Address.
This commit is contained in:
parent
ef90a8aa95
commit
c156b0202c
2 changed files with 10 additions and 0 deletions
|
@ -138,6 +138,15 @@ uint8_t NimBLEAddress::getType() const {
|
|||
} // getType
|
||||
|
||||
|
||||
/**
|
||||
* @brief Determine if this address is a Resolvable Private Address.
|
||||
* @return True if the address is a RPA.
|
||||
*/
|
||||
bool NimBLEAddress::isRpa() const {
|
||||
return (m_addrType && ((m_address[5] & 0xc0) == 0x40));
|
||||
} // isRpa
|
||||
|
||||
|
||||
/**
|
||||
* @brief Convert a BLE address to a string.
|
||||
*
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
NimBLEAddress(uint8_t address[6], uint8_t type = BLE_ADDR_PUBLIC);
|
||||
NimBLEAddress(const std::string &stringAddress, uint8_t type = BLE_ADDR_PUBLIC);
|
||||
NimBLEAddress(const uint64_t &address, uint8_t type = BLE_ADDR_PUBLIC);
|
||||
bool isRpa() const;
|
||||
bool equals(const NimBLEAddress &otherAddress) const;
|
||||
const uint8_t* getNative() const;
|
||||
std::string toString() const;
|
||||
|
|
Loading…
Reference in a new issue