File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Original file line number Diff line number Diff line change @@ -59,14 +59,37 @@ BLEAddress::BLEAddress(std::string stringAddress) {
59
59
* @return True if the addresses are equal.
60
60
*/
61
61
bool BLEAddress::equals (BLEAddress otherAddress) {
62
- return memcmp (otherAddress.getNative (), m_address, 6 ) == 0 ;
62
+ return memcmp (otherAddress.getNative (), m_address, ESP_BD_ADDR_LEN ) == 0 ;
63
63
} // equals
64
64
65
+ bool BLEAddress::operator ==(const BLEAddress& otherAddress) const {
66
+ return memcmp (otherAddress.m_address , m_address, ESP_BD_ADDR_LEN) == 0 ;
67
+ }
68
+
69
+ bool BLEAddress::operator !=(const BLEAddress& otherAddress) const {
70
+ return !(*this == otherAddress);
71
+ }
72
+
73
+ bool BLEAddress::operator <(const BLEAddress& otherAddress) const {
74
+ return memcmp (otherAddress.m_address , m_address, ESP_BD_ADDR_LEN) < 0 ;
75
+ }
76
+
77
+ bool BLEAddress::operator <=(const BLEAddress& otherAddress) const {
78
+ return !(*this > otherAddress);
79
+ }
80
+
81
+ bool BLEAddress::operator >=(const BLEAddress& otherAddress) const {
82
+ return !(*this < otherAddress);
83
+ }
84
+
85
+ bool BLEAddress::operator >(const BLEAddress& otherAddress) const {
86
+ return memcmp (otherAddress.m_address , m_address, ESP_BD_ADDR_LEN) > 0 ;
87
+ }
65
88
66
89
/* *
67
90
* @brief Return the native representation of the address.
68
91
* @return The native representation of the address.
69
- */
92
+ */
70
93
esp_bd_addr_t *BLEAddress::getNative () {
71
94
return &m_address;
72
95
} // getNative
Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ class BLEAddress {
23
23
BLEAddress (esp_bd_addr_t address);
24
24
BLEAddress (std::string stringAddress);
25
25
bool equals (BLEAddress otherAddress);
26
+ bool operator ==(const BLEAddress& otherAddress) const ;
27
+ bool operator !=(const BLEAddress& otherAddress) const ;
28
+ bool operator <(const BLEAddress& otherAddress) const ;
29
+ bool operator <=(const BLEAddress& otherAddress) const ;
30
+ bool operator >(const BLEAddress& otherAddress) const ;
31
+ bool operator >=(const BLEAddress& otherAddress) const ;
26
32
esp_bd_addr_t * getNative ();
27
33
std::string toString ();
28
34
You can’t perform that action at this time.
0 commit comments