1
0
Fork 0

initialize at construction

This commit is contained in:
Kevin Matz 2021-08-13 09:57:53 -04:00
parent 966e3f3909
commit ee6bed286e
1 changed files with 13 additions and 3 deletions

View File

@ -29,12 +29,22 @@
namespace RDM {
struct UID {
UID(uint32_t dev = 0, uint16_t man = 0, bool flag = false)
: device(dev)
, esta_man(man)
, flag(flag)
{};
union {
uint64_t uid : 48;
struct __attribute__((packed)) {
uint32_t device;
uint16_t manufacturer : 15;
bool flag : 1;
union {
uint16_t manufacturer;
struct {
uint16_t esta_man : 15;
bool flag : 1;
};
};
};
};
bool isBroadcast() const {
@ -45,7 +55,7 @@ struct UID {
if (a.uid == BROADCAST_ALL_DEVICES_ID || b.uid == BROADCAST_ALL_DEVICES_ID)
return true;
if (a.device == ALL_DEVICE_ID_MASK || b.device == ALL_DEVICE_ID_MASK)
return (a.manufacturer == b.manufacturer);
return (a.esta_man == b.esta_man);
return (a.uid == b.uid);
}
friend bool operator!= (const UID& a, const UID& b)