Represents a RDM UID.
UIDs are 6 bytes, the first two bytes are the manufacturer code and the last 4 bytes are the device id. UIDs are written as:
|
enum | { LENGTH = 6
} |
|
enum | { UID_SIZE = LENGTH
} |
|
|
static const uint16_t | ALL_MANUFACTURERS = 0xffff |
| The value for the 'all manufacturers' id.
|
|
static const uint32_t | ALL_DEVICES = 0xffffffff |
| The value for the 'all devices' id.
|
|
|
std::ostream & | operator<< (std::ostream &out, const UID &uid) |
| A helper function to write a UID to an ostream. More...
|
|
◆ anonymous enum
The size of a UID.
Enumerator |
---|
UID_SIZE | The size of a UID in binary form
|
◆ UID() [1/4]
ola::rdm::UID::UID |
( |
uint16_t |
esta_id, |
|
|
uint32_t |
device_id |
|
) |
| |
|
inline |
Constructs a new UID.
- Parameters
-
esta_id | the ESTA (manufacturer ID). |
device_id | the device ID. |
◆ UID() [2/4]
ola::rdm::UID::UID |
( |
uint64_t |
uid | ) |
|
|
inlineexplicit |
Constructs a new UID from a uint64_t.
- Parameters
-
uid | a uint64_t in the form 0x0000XXXXYYYYYYYY. |
◆ UID() [3/4]
ola::rdm::UID::UID |
( |
const UID & |
uid | ) |
|
|
inline |
Copy constructor.
- Parameters
-
◆ UID() [4/4]
ola::rdm::UID::UID |
( |
const uint8_t * |
data | ) |
|
|
inlineexplicit |
Construct a new UID from binary data.
- Parameters
-
data | a pointer to the memory containing the UID data. The data should be most significant byte first. |
◆ AllDevices()
static UID ola::rdm::UID::AllDevices |
( |
| ) |
|
|
inlinestatic |
Returns a UID that matches all devices (ffff:ffffffff).
- Returns
- a UID(0xffff, 0xffffffff).
◆ DeviceId()
uint32_t ola::rdm::UID::DeviceId |
( |
| ) |
const |
|
inline |
The device ID for this UID.
- Returns
- the device id for this UID.
◆ DirectedToUID()
bool ola::rdm::UID::DirectedToUID |
( |
const UID & |
uid | ) |
const |
|
inline |
Check if this UID matches against another.
- Parameters
-
uid | the UID to check against |
- Returns
- true if the UIDs are equal or if this UID is a broadcast UID and the uid argument falls within the broadcast range.
This is useful to determine if a responder should reply to a message.
- Example
uid.DirectedToUID(uid);
broadcast_uid.DirectedToUID(uid);
vendorcast_uid.DirectedToUID(uid);
other_vendorcast_uid.DirectedToUID(uid);
◆ FromString()
UID * ola::rdm::UID::FromString |
( |
const std::string & |
uid | ) |
|
|
static |
Return a new UID from a string.
- Parameters
-
uid | the UID as a string i.e. XXXX:YYYYYYYY. |
- Returns
- a new UID object, or NULL if the string is not a valid UID. Ownership of the new UID object is transferred to the caller.
◆ IsBroadcast()
bool ola::rdm::UID::IsBroadcast |
( |
| ) |
const |
|
inline |
Check if this UID is a broadcast or vendorcast UID.
- Returns
- true if the device id is 0xffffffff.
◆ ManufacturerId()
uint16_t ola::rdm::UID::ManufacturerId |
( |
| ) |
const |
|
inline |
The manufacturer ID for this UID.
- Returns
- the manufacturer id for this UID.
◆ operator!=()
bool ola::rdm::UID::operator!= |
( |
const UID & |
other | ) |
const |
|
inline |
Inequality operator.
- Parameters
-
other | the UID to compare to. |
◆ operator<()
bool ola::rdm::UID::operator< |
( |
const UID & |
other | ) |
const |
|
inline |
Less than.
- Parameters
-
other | the UID to compare to. |
◆ operator<=()
bool ola::rdm::UID::operator<= |
( |
const UID & |
other | ) |
const |
|
inline |
Less than or equal to.
- Parameters
-
other | the UID to compare to. |
◆ operator==()
bool ola::rdm::UID::operator== |
( |
const UID & |
other | ) |
const |
|
inline |
Equality operator.
- Parameters
-
other | the UID to compare to. |
◆ operator>()
bool ola::rdm::UID::operator> |
( |
const UID & |
other | ) |
const |
|
inline |
Greater than.
- Parameters
-
other | the UID to compare to. |
◆ operator>=()
bool ola::rdm::UID::operator>= |
( |
const UID & |
other | ) |
const |
|
inline |
Greater than or equal to.
- Parameters
-
other | the UID to compare to. |
◆ Pack()
bool ola::rdm::UID::Pack |
( |
uint8_t * |
buffer, |
|
|
unsigned int |
length |
|
) |
| const |
|
inline |
Write the binary representation of the UID to memory.
- Parameters
-
buffer | a pointer to memory to write the UID to |
length | the size of the memory block, should be at least UID_SIZE. |
- Returns
- true if length was >= UID_SIZE, false otherwise.
◆ ToString()
std::string ola::rdm::UID::ToString |
( |
| ) |
const |
|
inline |
Convert a UID to a human readable string.
- Returns
- a string in the form XXXX:YYYYYYYY.
◆ ToUInt64()
uint64_t ola::rdm::UID::ToUInt64 |
( |
| ) |
const |
|
inline |
Convert a UID to a uint64_t.
- Returns
- a uint64_t in the form 0x0000XXXXYYYYYYYY.
◆ VendorcastAddress() [1/2]
static UID ola::rdm::UID::VendorcastAddress |
( |
uint16_t |
esta_id | ) |
|
|
inlinestatic |
Returns a UID that matches all devices for a particular manufacturer.
- Parameters
-
esta_id | the manufacturer id of the devices to match. |
- Returns
- a UID(X, 0xffffffff).
◆ VendorcastAddress() [2/2]
static UID ola::rdm::UID::VendorcastAddress |
( |
UID |
uid | ) |
|
|
inlinestatic |
Returns a UID that matches all devices for a particular manufacturer.
- Parameters
-
uid | a UID whose manufacturer id you want to match. |
- Returns
- a UID(X, 0xffffffff).
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const UID & |
uid |
|
) |
| |
|
friend |
A helper function to write a UID to an ostream.
- Parameters
-
out | the ostream |
uid | the UID to write. |
The documentation for this class was generated from the following files:
- include/ola/rdm/UID.h
- common/rdm/UID.cpp