diff --git a/src/NimBLEAddress.cpp b/src/NimBLEAddress.cpp index b6bc952..8c2c68f 100644 --- a/src/NimBLEAddress.cpp +++ b/src/NimBLEAddress.cpp @@ -142,4 +142,10 @@ NimBLEAddress::operator std::string() const { return std::string(buffer); } +NimBLEAddress::operator uint64_t() const { + uint64_t address = 0; + memcpy(&address, m_address, sizeof m_address); + return address; +} + #endif diff --git a/src/NimBLEAddress.h b/src/NimBLEAddress.h index e81a2bd..778ff86 100644 --- a/src/NimBLEAddress.h +++ b/src/NimBLEAddress.h @@ -44,6 +44,7 @@ public: bool operator ==(const NimBLEAddress & rhs) const; bool operator !=(const NimBLEAddress & rhs) const; operator std::string() const; + operator uint64_t() const; private: uint8_t m_address[6];