BeeeOn Gateway
v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
|
#include <DeviceID.h>
Public Member Functions | |
DeviceID () | |
DeviceID (uint64_t value) | |
DeviceID (const DevicePrefix &prefix, uint64_t ident) | |
bool | isNull () const |
operator unsigned long long () const | |
DevicePrefix | prefix () const |
uint64_t | ident () const |
bool | is32bit () const |
std::string | toString () const |
bool | operator!= (const DeviceID &id) const |
bool | operator== (const DeviceID &id) const |
bool | operator< (const DeviceID &id) const |
bool | operator> (const DeviceID &id) const |
bool | operator<= (const DeviceID &id) const |
bool | operator>= (const DeviceID &id) const |
Static Public Member Functions | |
static DeviceID | parse (const std::string &s) |
static DeviceID | random (const DevicePrefix &prefix=DevicePrefix::fromRaw(DevicePrefix::PREFIX_INVALID)) |
Static Public Attributes | |
static const unsigned int | IDENT_WIDTH = 56 |
static const uint64_t | IDENT_MASK = (((uint64_t) 1) << IDENT_WIDTH) - 1 |
static const uint64_t | PREFIX_MASK = ~IDENT_MASK |
Device ID. Called EUID in the adapter software. An EUID contains a prefix (1 byte) that determines the device's domain. It usually denotes a vendor. An EUID is globally unique. The class supports both 32-bit and 64-bit EUIDs. The 32-bit EUID is recognized by having the higher half of the uint64_t equal to zero.
DeviceID::DeviceID | ( | ) |
Construct an empty ID. The isNull() method would return true.
DeviceID::DeviceID | ( | uint64_t | value | ) |
Cosntruct 32-bit or 64-bit ID. Having the higher half of the value equal to zero enables the 32-bit mode. E.g.:
DeviceID::DeviceID | ( | const DevicePrefix & | prefix, |
uint64_t | ident | ||
) |
Construct 64-bit ID only.
|
static |
Generate a random ID. If the prefix is zero a new one is generated randomly.