NimBLEUUID: Add operator == and != + correct equals() to test if values are set.

Adds convenience operators == and != to NimBLEUUID class.

Tests if both values are not set in equals operation and returns true if so.
This commit is contained in:
h2zero
2020-05-06 21:08:50 -06:00
parent 1779a3f723
commit 04b524d1f8
2 changed files with 44 additions and 75 deletions
+5 -1
View File
@@ -40,10 +40,14 @@ public:
uint8_t bitSize(); // Get the number of bits in this uuid.
bool equals(NimBLEUUID uuid);
ble_uuid_any_t* getNative();
NimBLEUUID to128();
NimBLEUUID & to128();
std::string toString();
static NimBLEUUID fromString(std::string uuid); // Create a NimBLEUUID from a string
bool operator ==(const NimBLEUUID & rhs);
bool operator !=(const NimBLEUUID & rhs);
operator std::string() const;
private:
ble_uuid_any_t m_uuid; // The underlying UUID structure that this class wraps.
bool m_valueSet = false; // Is there a value set for this instance.