RDM  HEAD (unstable)
Implementation of ANSI E1.31 (Streaming ACN)
View other versions:
Uid Class Reference

A C++ wrapper class for the RDM UID type. More...

Public Member Functions

 Uid ()=default
 Constructs a null UID by default.
 
constexpr Uid (uint16_t manu_val, uint32_t id_val) noexcept
 Construct a UID explicitly from an ESTA Manufacturer ID and a device ID.
 
constexpr Uid (const RdmUid &c_uid) noexcept
 Construct a UID copied from an instance of the C RdmUid type.
 
Uidoperator= (const RdmUid &c_uid) noexcept
 Assign an instance of the C RdmUid type to an instance of this class.
 
constexpr const RdmUidget () const noexcept
 Get a const reference to the underlying C type.
 
ETCPAL_CONSTEXPR_14 RdmUidget () noexcept
 Get a mutable reference to the underlying C type.
 
constexpr uint16_t manufacturer_id () const noexcept
 Get the ESTA Manufacturer ID portion of this UID.
 
constexpr uint32_t device_id () const noexcept
 Get the Device ID portion of this UID.
 
std::string ToString () const
 Convert a UID to a string representation. More...
 
constexpr bool IsValid () const noexcept
 Determine if a UID is valid. All UIDs are valid unless they are null (all 0's).
 
bool IsBroadcast () const noexcept
 Determine whether a UID is the E1.20 value BROADCAST_ALL_DEVICES_ID.
 
bool IsControllerBroadcast () const noexcept
 Determine whether a UID is the E1.33 value RPT_ALL_CONTROLLERS.
 
bool IsDeviceBroadcast () const noexcept
 Determine whether a UID is the E1.33 value RPT_ALL_DEVICES.
 
bool IsDeviceManufacturerBroadcast () const noexcept
 Determine whether a UID is one of the E1.33 values defined by RPT_ALL_MID_DEVICES. More...
 
constexpr bool BroadcastManufacturerIdMatches (uint16_t manu_val) const noexcept
 Determine whether an RDMnet Device Manufacturer Broadcast UID matches a specific ESTA Manufacturer ID.
 
constexpr uint16_t DeviceBroadcastManufacturerId () const noexcept
 Get the ESTA Manufacturer ID from an RDMnet Device Manufacturer Broadcast UID.
 
constexpr bool IsDynamic () const noexcept
 Determine whether a UID is a Dynamic UID as defined in ANSI E1.33. More...
 
constexpr bool IsDynamicUidRequest () const noexcept
 Determine whether a UID is a Dynamic UID Request as defined in ANSI E1.33.
 
constexpr bool IsStatic () const noexcept
 Determine whether a UID is a Static UID as defined in ANSI E1.33. More...
 
void SetManufacturerId (uint16_t manu_val) noexcept
 Set the ESTA Manufacturer ID portion of this UID. More...
 
void SetDeviceId (uint32_t id_val) noexcept
 Set the Device ID portion of this UID.
 

Static Public Member Functions

static Uid FromString (const std::string &uid_str) noexcept
 Create a UID from a string representation. More...
 
static Uid FromString (const char *uid_str) noexcept
 Create a UID from a string representation. More...
 
static Uid Broadcast () noexcept
 Create a UID representing BROADCAST_ALL_DEVICES_ID as defined in ANSI E1.20.
 
static Uid ControllerBroadcast () noexcept
 Create a UID representing RPT_ALL_CONTROLLERS as defined in ANSI E1.33.
 
static Uid DeviceBroadcast () noexcept
 Create a UID representing RPT_ALL_DEVICES as defined in ANSI E1.33.
 
static Uid DeviceBroadcast (uint16_t manu_val) noexcept
 Create a UID representing RPT_ALL_MID_DEVICES as defined in ANSI E1.33.
 
static Uid Static (uint16_t manu_val, uint32_t id_val) noexcept
 Explicitly create an RDMnet Static UID from an ESTA Manufacturer ID and Device ID. More...
 
static Uid DynamicUidRequest (uint16_t manu_val) noexcept
 Create an RDMnet Dynamic UID Request from a given ESTA Manufacturer ID.
 

Detailed Description

A C++ wrapper class for the RDM UID type.

Provides C++ syntactic sugar for working with RDM UIDs. You can convert from the basic C type implicitly, and to it explicitly:

RdmUid c_uid = { 0x1111u, 0x22222222u };
rdm::Uid uid = c_uid;
c_uid = uid.get();
A C++ wrapper class for the RDM UID type.
Definition: uid.h:82
constexpr const RdmUid & get() const noexcept
Get a const reference to the underlying C type.
Definition: uid.h:143
Definition: uid.h:65

Or construct directly from the ESTA Manufacturer ID and Device ID:

rdm::Uid uid(0x1111u, 0x22222222u);
EXPECT_EQ(uid.manufacturer_id(), 0x1111u);
EXPECT_EQ(uid.device_id(), 0x22222222u);
constexpr uint32_t device_id() const noexcept
Get the Device ID portion of this UID.
Definition: uid.h:161
constexpr uint16_t manufacturer_id() const noexcept
Get the ESTA Manufacturer ID portion of this UID.
Definition: uid.h:155

Or use one of the special UID generators:

auto uid_from_str = rdm::Uid::FromString("1111:22222222"); // Create from a string representation
auto bcast_uid = rdm::Uid::Broadcast(); // Creates E1.20's BROADCAST_ALL_DEVICES_ID
auto controller_bcast_uid = rdm::Uid::ControllerBroadcast(); // Creates E1.33's RPT_ALL_CONTROLLERS
auto device_bcast_uid = rdm::Uid::DeviceBroadcast(); // Creates E1.33's RPT_ALL_DEVICES
auto device_manu_bcast_uid = rdm::Uid::DeviceBroadcast(0x6574); // Creates E1.33's RPT_ALL_MID_DEVICES
auto static_uid = rdm::Uid::Static(0x1111u, 0x22222222u); // Explicitly create an RDMnet Static UID
auto dynamic_req = rdm::Uid::DynamicUidRequest(0x1111u); // Explicitly create an RDMnet Dynamic UID Request
static Uid FromString(const std::string &uid_str) noexcept
Create a UID from a string representation.
Definition: uid.h:258
static Uid DynamicUidRequest(uint16_t manu_val) noexcept
Create an RDMnet Dynamic UID Request from a given ESTA Manufacturer ID.
Definition: uid.h:309
static Uid ControllerBroadcast() noexcept
Create a UID representing RPT_ALL_CONTROLLERS as defined in ANSI E1.33.
Definition: uid.h:281
static Uid Static(uint16_t manu_val, uint32_t id_val) noexcept
Explicitly create an RDMnet Static UID from an ESTA Manufacturer ID and Device ID.
Definition: uid.h:303
static Uid DeviceBroadcast() noexcept
Create a UID representing RPT_ALL_DEVICES as defined in ANSI E1.33.
Definition: uid.h:287
static Uid Broadcast() noexcept
Create a UID representing BROADCAST_ALL_DEVICES_ID as defined in ANSI E1.20.
Definition: uid.h:275

There are also inspectors to check whether a UID is any of the above special types.

Use ToString() to get a string representation:

std::cout << "Discovered responder " << uid.ToString() << '\n';
// Or...
printf("Discovered responder %s\n", uid.ToString().c_str());
T c_str(T... args)
std::string ToString() const
Convert a UID to a string representation.
Definition: uid.h:168
T printf(T... args)

Member Function Documentation

◆ FromString() [1/2]

Uid FromString ( const char *  uid_str)
inlinestaticnoexcept

Create a UID from a string representation.

See rdm_string_to_uid() for more information.

◆ FromString() [2/2]

Uid FromString ( const std::string uid_str)
inlinestaticnoexcept

Create a UID from a string representation.

See rdm_string_to_uid() for more information.

◆ IsDeviceManufacturerBroadcast()

bool IsDeviceManufacturerBroadcast ( ) const
inlinenoexcept

Determine whether a UID is one of the E1.33 values defined by RPT_ALL_MID_DEVICES.

See RDMNET_UID_IS_DEVICE_MANU_BROADCAST() for more information.

◆ IsDynamic()

constexpr bool IsDynamic ( ) const
constexprnoexcept

Determine whether a UID is a Dynamic UID as defined in ANSI E1.33.

See RDMNET_UID_IS_DYNAMIC() for more information.

◆ IsStatic()

constexpr bool IsStatic ( ) const
constexprnoexcept

Determine whether a UID is a Static UID as defined in ANSI E1.33.

See RDMNET_UID_IS_STATIC() for more information.

◆ SetManufacturerId()

void SetManufacturerId ( uint16_t  manu_val)
inlinenoexcept

Set the ESTA Manufacturer ID portion of this UID.

The top bit of manu_val (the dynamic vs static bit in RDMnet) is disregarded and the top bit of manufacturer_id() remains as it was before this function was called.

◆ Static()

Uid Static ( uint16_t  manu_val,
uint32_t  id_val 
)
inlinestaticnoexcept

Explicitly create an RDMnet Static UID from an ESTA Manufacturer ID and Device ID.

The top bit of manu_val is masked off and the top bit of manufacturer_id() is always 0 after this function is called.

◆ ToString()

std::string ToString ( ) const
inline

Convert a UID to a string representation.

See rdm_uid_to_string() for more information on the format.


The documentation for this class was generated from the following file: