Add uint64_t cast of an address

This commit is contained in:
h2zero 2020-06-19 12:32:57 -06:00
parent f624deacb5
commit afb2f8d4c7
2 changed files with 7 additions and 0 deletions

View file

@ -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

View file

@ -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];