Open Lighting Architecture: ola::client::UID Class Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
ola::client::UID Class Reference

## 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:

XXXX:YYYYYYYY

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

## ◆ anonymous enum

anonymous enum

The size of a UID.

Enumerator
UID_SIZE | The size of a UID in binary form

## Constructor & Destructor Documentation

## ◆ UID() [1/3]

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/3]

ola::rdm::UID::UID | ( | const UID & | uid | ) |
| inline

Copy constructor.

Parameters

  uid | the UID to copy.

## ◆ UID() [3/3]

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

## ◆ AllDevices()

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 uid(0x7a70, 1);
  uid.DirectedToUID(uid); // always true.
  UID broadcast_uid(UID::AllDevices());
  broadcast_uid.DirectedToUID(uid); // true
  UID vendorcast_uid(UID::VendorcastAddress(0x7a70));
  vendorcast_uid.DirectedToUID(uid); // true
  UID other_vendorcast_uid(UID::VendorcastAddress(0x0808));
  other_vendorcast_uid.DirectedToUID(uid); // false
  ola::client::UID::VendorcastAddress
  static UID VendorcastAddress(uint16_t esta_id)
  Returns a UID that matches all devices for a particular manufacturer.
  Definition UID.h:234
  ola::client::UID::UID
  UID(uint16_t esta_id, uint32_t device_id)
  Constructs a new UID.
  Definition UID.h:66
  ola::client::UID::AllDevices
  static UID AllDevices()
  Returns a UID that matches all devices (ffff:ffffffff).
  Definition UID.h:224

## ◆ 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

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.

## ◆ 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.

## ◆ VendorcastAddress() [1/2]

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).

## ◆ VendorcastAddress() [2/2]

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).

## Friends And Related Symbol Documentation

## ◆ 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