Detailed Description
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:
Public Types |
enum | { LENGTH = 6
} |
enum | { UID_SIZE = 6
} |
Public Member Functions |
| UID (uint16_t esta_id, uint32_t device_id) |
| Constructs a new UID.
|
| UID (const UID &uid) |
| Copy constructor.
|
| UID (const uint8_t *data) |
| Construct a new UID from binary data.
|
UID & | operator= (const UID &other) |
| Assignment operator.
|
bool | operator== (const UID &other) const |
| Equality operator.
|
bool | operator!= (const UID &other) const |
| Inequality operator.
|
bool | operator> (const UID &other) const |
| Greater than.
|
bool | operator< (const UID &other) const |
| Less than.
|
uint16_t | ManufacturerId () const |
| The manufacturer ID for this UID.
|
uint32_t | DeviceId () const |
| The device ID for this UID.
|
bool | IsBroadcast () const |
| Check if this UID is a broadcast or vendorcast UID.
|
bool | DirectedToUID (const UID &uid) const |
| Check if this UID matches against another.
|
std::string | ToString () const |
| Convert a UID to a human readable string.
|
bool | Pack (uint8_t *buffer, unsigned int length) const |
| Write the binary representation of the UID to memory.
|
Static Public Member Functions |
static UID | AllDevices () |
| Returns a UID that matches all devices (ffff:ffffffff).
|
static UID | VendorcastAddress (uint16_t esta_id) |
| Returns a UID that matches all devices for a particular manufacturer.
|
static UID | VendorcastAddress (UID uid) |
| Returns a UID that matches all devices for a particular manufacturer.
|
static UID * | FromString (const std::string &uid) |
| Return a new UID from a string.
|
Static Public Attributes |
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.
|
Friends |
std::ostream & | operator<< (std::ostream &out, const UID &uid) |
| A helper function to write a UID to an ostream.
|
Member Enumeration Documentation
The size of a UID.
- Enumerator:
UID_SIZE |
The size of a UID in binary form
|
Constructor & Destructor Documentation
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. |
ola::rdm::UID::UID |
( |
const UID & |
uid | ) |
|
|
inline |
Copy constructor.
- Parameters
-
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. |
Member Function Documentation
static UID ola::rdm::UID::AllDevices |
( |
| ) |
|
|
inlinestatic |
Returns a UID that matches all devices (ffff:ffffffff).
- Returns
- a UID(0xffff, 0xffffffff).
uint32_t ola::rdm::UID::DeviceId |
( |
| ) |
const |
|
inline |
The device ID for this UID.
- Returns
- the device id for this UID.
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);
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.
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.
uint16_t ola::rdm::UID::ManufacturerId |
( |
| ) |
const |
|
inline |
The manufacturer ID for this UID.
- Returns
- the manufacturer id for this UID.
bool ola::rdm::UID::operator!= |
( |
const UID & |
other | ) |
const |
|
inline |
Inequality operator.
- Parameters
-
other | the UID to compare to. |
bool ola::rdm::UID::operator< |
( |
const UID & |
other | ) |
const |
|
inline |
Less than.
- Parameters
-
other | the UID to compare to. |
bool ola::rdm::UID::operator== |
( |
const UID & |
other | ) |
const |
|
inline |
Equality operator.
- Parameters
-
other | the UID to compare to. |
bool ola::rdm::UID::operator> |
( |
const UID & |
other | ) |
const |
|
inline |
Greater than.
- Parameters
-
other | the UID to compare to. |
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.
std::string ola::rdm::UID::ToString |
( |
| ) |
const |
|
inline |
Convert a UID to a human readable string.
- Returns
- a string in the form XXXX:YYYYYYYY.
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).
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).
Friends And Related Function Documentation
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