esp-nimble-cpp / NimBLE-Arduino  1.3.1
NimBLEAddress.h
1 /*
2  * NimBLEAddress.h
3  *
4  * Created: on Jan 24 2020
5  * Author H2zero
6  *
7  * Originally:
8  *
9  * BLEAddress.h
10  *
11  * Created on: Jul 2, 2017
12  * Author: kolban
13  */
14 
15 #ifndef COMPONENTS_NIMBLEADDRESS_H_
16 #define COMPONENTS_NIMBLEADDRESS_H_
17 #include "sdkconfig.h"
18 #if defined(CONFIG_BT_ENABLED)
19 
20 #include "nimble/ble.h"
21 /**** FIX COMPILATION ****/
22 #undef min
23 #undef max
24 /**************************/
25 
26 #include <string>
27 #include <algorithm>
28 
35 public:
36  NimBLEAddress();
37  NimBLEAddress(ble_addr_t address);
38  NimBLEAddress(uint8_t address[6], uint8_t type = BLE_ADDR_PUBLIC);
39  NimBLEAddress(const std::string &stringAddress, uint8_t type = BLE_ADDR_PUBLIC);
40  NimBLEAddress(const uint64_t &address, uint8_t type = BLE_ADDR_PUBLIC);
41  bool equals(const NimBLEAddress &otherAddress) const;
42  const uint8_t* getNative() const;
43  std::string toString() const;
44  uint8_t getType() const;
45 
46  bool operator ==(const NimBLEAddress & rhs) const;
47  bool operator !=(const NimBLEAddress & rhs) const;
48  operator std::string() const;
49  operator uint64_t() const;
50 
51 private:
52  uint8_t m_address[6];
53  uint8_t m_addrType;
54 };
55 
56 #endif /* CONFIG_BT_ENABLED */
57 #endif /* COMPONENTS_NIMBLEADDRESS_H_ */
A BLE device address.
Definition: NimBLEAddress.h:34
uint8_t getType() const
Get the address type.
Definition: NimBLEAddress.cpp:136
NimBLEAddress()
Create a blank address, i.e. 00:00:00:00:00:00, type 0.
Definition: NimBLEAddress.cpp:43
bool equals(const NimBLEAddress &otherAddress) const
Determine if this address equals another.
Definition: NimBLEAddress.cpp:118
bool operator==(const NimBLEAddress &rhs) const
Convienience operator to check if this address is equal to another.
Definition: NimBLEAddress.cpp:161
std::string toString() const
Convert a BLE address to a string.
Definition: NimBLEAddress.cpp:153
const uint8_t * getNative() const
Get the native representation of the address.
Definition: NimBLEAddress.cpp:127
bool operator!=(const NimBLEAddress &rhs) const
Convienience operator to check if this address is not equal to another.
Definition: NimBLEAddress.cpp:169