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

Basic RDM message packing and unpacking. More...

Data Structures

struct  RdmBuffer
 
struct  RdmCommandHeader
 
struct  RdmResponseHeader
 

Macros

#define RDM_MAX_BYTES   257
 
#define RDM_MIN_BYTES   26
 
#define RDM_MAX_PDL   231
 
#define RDM_HEADER_SIZE   24
 
#define RDM_NUM_STANDARD_NR_CODES   20
 
#define RDM_GET_COMMAND_CLASS(rdmbufptr)   ((rdmbufptr)->data[RDM_OFFSET_COMMAND_CLASS])
 Get the command class value from a packed RDM command. More...
 
#define RDM_GET_TRANSACTION_NUM(rdmbufptr)   ((rdmbufptr)->data[RDM_OFFSET_TRANSACTION])
 Get the RDM transaction number from a packed RDM command. More...
 
#define RDM_PACKED_SIZE(data_len)   (RDM_HEADER_SIZE + (data_len) + 2u)
 Get the packed size in bytes of an RDM message. More...
 

Typedefs

typedef struct RdmBuffer RdmBuffer
 
typedef struct RdmCommandHeader RdmCommandHeader
 
typedef struct RdmResponseHeader RdmResponseHeader
 

Enumerations

enum  rdm_command_class_t {
  kRdmCCDiscoveryCommand = E120_DISCOVERY_COMMAND , kRdmCCDiscoveryCommandResponse = E120_DISCOVERY_COMMAND_RESPONSE , kRdmCCGetCommand = E120_GET_COMMAND , kRdmCCGetCommandResponse = E120_GET_COMMAND_RESPONSE ,
  kRdmCCSetCommand = E120_SET_COMMAND , kRdmCCSetCommandResponse = E120_SET_COMMAND_RESPONSE
}
 
enum  rdm_response_type_t { kRdmResponseTypeAck = E120_RESPONSE_TYPE_ACK , kRdmResponseTypeAckTimer = E120_RESPONSE_TYPE_ACK_TIMER , kRdmResponseTypeNackReason = E120_RESPONSE_TYPE_NACK_REASON , kRdmResponseTypeAckOverflow = E120_RESPONSE_TYPE_ACK_OVERFLOW }
 
enum  rdm_nack_reason_t {
  kRdmNRUnknownPid = E120_NR_UNKNOWN_PID , kRdmNRFormatError = E120_NR_FORMAT_ERROR , kRdmNRHardwareFault = E120_NR_HARDWARE_FAULT , kRdmNRProxyReject = E120_NR_PROXY_REJECT ,
  kRdmNRWriteProtect = E120_NR_WRITE_PROTECT , kRdmNRUnsupportedCommandClass = E120_NR_UNSUPPORTED_COMMAND_CLASS , kRdmNRDataOutOfRange = E120_NR_DATA_OUT_OF_RANGE , kRdmNRBufferFull = E120_NR_BUFFER_FULL ,
  kRdmNRPacketSizeUnsupported = E120_NR_PACKET_SIZE_UNSUPPORTED , kRdmNRSubDeviceOutOfRange = E120_NR_SUB_DEVICE_OUT_OF_RANGE , kRdmNRProxyBufferFull = E120_NR_PROXY_BUFFER_FULL , kRdmNRActionNotSupported = E137_2_NR_ACTION_NOT_SUPPORTED ,
  kRdmNREndpointNumberInvalid = E137_7_NR_ENDPOINT_NUMBER_INVALID , kRdmNRInvalidEndpointMode = E137_7_NR_INVALID_ENDPOINT_MODE , kRdmNRUnknownUid = E137_7_NR_UNKNOWN_UID , kRdmNRUnknownScope = E133_NR_UNKNOWN_SCOPE ,
  kRdmNRInvalidStaticConfigType = E133_NR_INVALID_STATIC_CONFIG_TYPE , kRdmNRInvalidIpv4Address = E133_NR_INVALID_IPV4_ADDRESS , kRdmNRInvalidIpv6Address = E133_NR_INVALID_IPV6_ADDRESS , kRdmNRInvalidPort = E133_NR_INVALID_PORT
}
 

Functions

void rdm_pack_checksum (uint8_t *buffer, size_t data_len_without_checksum)
 Calculate and pack an RDM checksum at the end of an RDM message. More...
 
bool rdm_validate_msg (const RdmBuffer *buffer)
 Perform basic validation of a packed RDM message. More...
 
bool rdm_command_header_is_valid (const RdmCommandHeader *cmd_header)
 Determine whether the values contained in a command header are valid for an RDM command. More...
 
bool rdm_response_header_is_valid (const RdmResponseHeader *resp_header)
 Determine whether the values contained in a response header are valid for an RDM response. More...
 
etcpal_error_t rdm_pack_command (const RdmCommandHeader *cmd_header, const uint8_t *cmd_data, uint8_t cmd_data_len, RdmBuffer *buffer)
 Convert an RDM command header and data to the RDM wire format. More...
 
etcpal_error_t rdm_pack_command_with_custom_buf (const RdmCommandHeader *cmd_header, const uint8_t *cmd_data, uint8_t cmd_data_len, uint8_t *buf, size_t buf_len)
 Convert an RDM command header and data to the RDM wire format in a user-provided buffer. More...
 
etcpal_error_t rdm_pack_response (const RdmCommandHeader *cmd_header, uint8_t msg_count, const uint8_t *response_data, uint8_t response_data_len, RdmBuffer *buffer)
 Serialize an RDM ACK response to a previously-received command. More...
 
etcpal_error_t rdm_pack_overflow_response (const RdmCommandHeader *cmd_header, const uint8_t *response_data, uint8_t response_data_len, RdmBuffer *buffer)
 Serialize an RDM ACK_OVERFLOW response to a previously-received command. More...
 
etcpal_error_t rdm_pack_nack_response (const RdmCommandHeader *cmd_header, uint8_t msg_count, rdm_nack_reason_t nack_reason, RdmBuffer *buffer)
 Serialize an RDM NACK response to a previously-received command. More...
 
etcpal_error_t rdm_pack_timer_response (const RdmCommandHeader *cmd_header, uint8_t msg_count, unsigned int delay_time_ms, RdmBuffer *buffer)
 Serialize an RDM ACK_TIMER response to a previously-received command. More...
 
etcpal_error_t rdm_pack_dub_response (const RdmUid *responder_uid, RdmBuffer *buffer)
 Serialize an RDM DISC_UNIQUE_BRANCH response. More...
 
size_t rdm_get_num_responses_needed (uint16_t param_id, size_t response_data_len)
 Get the number of RDM responses needed to send the given response data. More...
 
etcpal_error_t rdm_pack_full_response (const RdmCommandHeader *cmd_header, const uint8_t *response_data, size_t response_data_len, RdmBuffer *buffers, size_t num_buffers)
 Serialize a full RDM ACK response, splitting ACK_OVERFLOW responses if necessary. More...
 
etcpal_error_t rdm_append_parameter_data (RdmBuffer *buffer, const uint8_t *additional_data, uint8_t additional_data_len)
 Add additional parameter data to an already-serialized RDM command. More...
 
etcpal_error_t rdm_unpack_command (const RdmBuffer *buffer, RdmCommandHeader *cmd_header, const uint8_t **param_data, uint8_t *param_data_len)
 Deserialize an RDM command from its wire format. More...
 
etcpal_error_t rdm_unpack_response (const RdmBuffer *buffer, RdmResponseHeader *resp_header, const uint8_t **param_data, uint8_t *param_data_len)
 Deserialize an RDM response from its wire format. More...
 
etcpal_error_t rdm_unpack_dub_response (const RdmBuffer *buffer, RdmUid *responder_uid)
 Deserialize an RDM DISC_UNIQUE_BRANCH from its wire format. More...
 
unsigned int rdm_get_ack_timer_delay (const uint8_t *param_data)
 Get the ACK_TIMER delay in milliseconds from an ACK_TIMER message. More...
 
rdm_nack_reason_t rdm_get_nack_reason_code (const uint8_t *param_data)
 Get the NACK reason code from a NACK_REASON message. More...
 
const char * rdm_command_class_to_string (rdm_command_class_t command_class)
 Get a string representation of an RDM command class. More...
 
const char * rdm_response_type_to_string (rdm_response_type_t resp_type)
 Get a string representation of an RDM response type. More...
 
const char * rdm_nack_reason_to_string (rdm_nack_reason_t reason_code)
 Get a string representation of an RDM NACK reason code. More...
 

RDM packet offsets

#define RDM_OFFSET_STARTCODE   0
 
#define RDM_OFFSET_SUBSTART   1
 
#define RDM_OFFSET_LENGTH   2
 
#define RDM_OFFSET_DEST_MANUFACTURER   3
 
#define RDM_OFFSET_DEST_DEVICE   5
 
#define RDM_OFFSET_SRC_MANUFACTURER   9
 
#define RDM_OFFSET_SRC_DEVICE   11
 
#define RDM_OFFSET_TRANSACTION   15
 
#define RDM_OFFSET_PORTID_RESPTYPE   16
 
#define RDM_OFFSET_MSGCOUNT   17
 
#define RDM_OFFSET_SUBDEVICE   18
 
#define RDM_OFFSET_COMMAND_CLASS   20
 
#define RDM_OFFSET_PARAM_ID   21
 
#define RDM_OFFSET_PARAM_DATA_LEN   23
 
#define RDM_OFFSET_PARAM_DATA   24
 

Detailed Description

Basic RDM message packing and unpacking.

Macro Definition Documentation

◆ RDM_GET_COMMAND_CLASS

#define RDM_GET_COMMAND_CLASS (   rdmbufptr)    ((rdmbufptr)->data[RDM_OFFSET_COMMAND_CLASS])

Get the command class value from a packed RDM command.

Parameters
rdmbufptrPointer to RdmBuffer containing the packed RDM command.
Returns
Command class (uint8_t).

◆ RDM_GET_TRANSACTION_NUM

#define RDM_GET_TRANSACTION_NUM (   rdmbufptr)    ((rdmbufptr)->data[RDM_OFFSET_TRANSACTION])

Get the RDM transaction number from a packed RDM command.

Parameters
rdmbufptrPointer to RdmBuffer containing the packed RDM command.
Returns
Transaction number (uint8_t).

◆ RDM_HEADER_SIZE

#define RDM_HEADER_SIZE   24

The length of the RDM message preceding the Parameter Data.

◆ RDM_MAX_BYTES

#define RDM_MAX_BYTES   257

The maximum size for an RDM packet, including the two checksum bytes.

◆ RDM_MAX_PDL

#define RDM_MAX_PDL   231

The maximum length of the Parameter Data in an RDM packet.

◆ RDM_MIN_BYTES

#define RDM_MIN_BYTES   26

The minimum size for an RDM packet.

◆ RDM_NUM_STANDARD_NR_CODES

#define RDM_NUM_STANDARD_NR_CODES   20

The number of enumerated values in the rdm_nack_reason_t type.

◆ RDM_PACKED_SIZE

#define RDM_PACKED_SIZE (   data_len)    (RDM_HEADER_SIZE + (data_len) + 2u)

Get the packed size in bytes of an RDM message.

Parameters
data_lenLength in bytes of the parameter data that the RDM message will contain.
Returns
The packed size in bytes.

Typedef Documentation

◆ RdmBuffer

typedef struct RdmBuffer RdmBuffer

A structure that represents a packed RDM message.

◆ RdmCommandHeader

A structure that represents the header fields of an RDM command. This includes everything except the parameter data.

◆ RdmResponseHeader

A structure that represents the header fields of an RDM response. This includes everything except the parameter data.

Enumeration Type Documentation

◆ rdm_command_class_t

An enumeration representing the RDM Command Class (CC) field.

Enumerator
kRdmCCDiscoveryCommand 

Messages related to the RDM discovery process.

kRdmCCDiscoveryCommandResponse 

Response from a kRdmCCDiscoveryCommand message.

kRdmCCGetCommand 

Request the value or status of a parameter from the device.

kRdmCCGetCommandResponse 

Response from a kRdmCCGetCommand message.

kRdmCCSetCommand 

Change the value of a parameter within the device.

kRdmCCSetCommandResponse 

Response from a kRdmCCSetCommand message.

◆ rdm_nack_reason_t

An enumeration representing a standard RDM NACK reason.

Enumerator
kRdmNRUnknownPid 

The responder cannot comply with request because the message is not implemented in responder.

kRdmNRFormatError 

The responder cannot interpret request as controller data was not formatted correctly.

kRdmNRHardwareFault 

The responder cannot comply due to an internal hardware fault.

kRdmNRProxyReject 

Proxy is not the RDM line master and cannot comply with message.

kRdmNRWriteProtect 

SET Command normally allowed but being blocked currently.

kRdmNRUnsupportedCommandClass 

Not valid for Command Class attempted. May be used where GET allowed but SET is not supported.

kRdmNRDataOutOfRange 

Value for given Parameter out of allowable range or not supported.

kRdmNRBufferFull 

Buffer or Queue space currently has no free space to store data.

kRdmNRPacketSizeUnsupported 

Incoming message exceeds buffer capacity.

kRdmNRSubDeviceOutOfRange 

Sub-Device is out of range or unknown.

kRdmNRProxyBufferFull 

The proxy buffer is full and cannot store any more Queued Message or Status Message responses.

kRdmNRActionNotSupported 

The specified action is not supported.

kRdmNREndpointNumberInvalid 

The specified endpoint is invalid.

kRdmNRInvalidEndpointMode 

The specified endpoint is in an invalid Endpoint Mode for the requested action.

kRdmNRUnknownUid 

The specified UID is not recognized.

kRdmNRUnknownScope 

The Component is not participating in the given Scope.

kRdmNRInvalidStaticConfigType 

The Static Config Type provided is invalid.

kRdmNRInvalidIpv4Address 

The IPv4 Address provided is invalid.

kRdmNRInvalidIpv6Address 

The IPv6 Address provided is invalid.

kRdmNRInvalidPort 

The transport layer port provided is invalid.

◆ rdm_response_type_t

An enumeration representing the RDM Response Type field.

Enumerator
kRdmResponseTypeAck 

The responder has correctly received the message and is acting upon it.

kRdmResponseTypeAckTimer 

The responder is unable to supply the requested GET information or SET confirmation within the required response time.

kRdmResponseTypeNackReason 

The responder is unable to reply with the requested GET information or unable to process the specified SET command.

kRdmResponseTypeAckOverflow 

The responder has correctly received the message and is acting upon it, but there is more response data available than will fit in a single response message.

Function Documentation

◆ rdm_append_parameter_data()

etcpal_error_t rdm_append_parameter_data ( RdmBuffer buffer,
const uint8_t *  additional_data,
uint8_t  additional_data_len 
)

Add additional parameter data to an already-serialized RDM command.

This function is useful when building an RDM command or response progressively. The length and checksum will be updated.

Parameters
[in,out]bufferPacked RDM command to which to append data.
[in]additional_dataParameter data to append.
[in]additional_data_lenLength of the parameter data to append.
Returns
kEtcPalErrOk: Data appended successfully.
kEtcPalErrInvalid: Invalid argument provided.
kEtcPalErrBufSize: Not enough space in RDM command for additional data.

◆ rdm_command_class_to_string()

const char* rdm_command_class_to_string ( rdm_command_class_t  command_class)

Get a string representation of an RDM command class.

Parameters
[in]command_classCommand class for which to get a string representation.
Returns
The command class string, or a placeholder string if an invalid command class was given.

◆ rdm_command_header_is_valid()

bool rdm_command_header_is_valid ( const RdmCommandHeader cmd_header)

Determine whether the values contained in a command header are valid for an RDM command.

Parameters
[in]cmd_headerHeader to validate.

◆ rdm_get_ack_timer_delay()

unsigned int rdm_get_ack_timer_delay ( const uint8_t *  param_data)

Get the ACK_TIMER delay in milliseconds from an ACK_TIMER message.

Parameters
[in]param_dataThe message parameter data. Must be at least 2 bytes in length.
Returns
The ACK_TIMER delay in milliseconds, or 0 if invalid argument provided.

◆ rdm_get_nack_reason_code()

rdm_nack_reason_t rdm_get_nack_reason_code ( const uint8_t *  param_data)

Get the NACK reason code from a NACK_REASON message.

Parameters
[in]param_dataThe message parameter data. Must be at least 2 bytes in length.
Returns
The NACK reason code, or an invalid code if an invalid argument was provided.

◆ rdm_get_num_responses_needed()

size_t rdm_get_num_responses_needed ( uint16_t  param_id,
size_t  response_data_len 
)

Get the number of RDM responses needed to send the given response data.

If this functions returns greater than 1, ACK_OVERFLOW responses must be sent.

This function takes into account parameter data which the RDM standard family requires to be split on specified boundaries.

Parameters
[in]param_idThe RDM parameter ID for the response being generated.
[in]response_data_lenThe length in bytes of the requested response data.
Returns
The number of responses that will be necessary.

◆ rdm_nack_reason_to_string()

const char* rdm_nack_reason_to_string ( rdm_nack_reason_t  reason_code)

Get a string representation of an RDM NACK reason code.

Parameters
[in]reason_codeReason code for which to get a string representation.
Returns
The reason string, or a placeholder string if an invalid or manufacturer-specific reason code was given.

◆ rdm_pack_checksum()

void rdm_pack_checksum ( uint8_t *  buffer,
size_t  data_len_without_checksum 
)

Calculate and pack an RDM checksum at the end of an RDM message.

Parameters
[in,out]bufferBuffer representing packed RDM message without checksum. Two-byte checksum is packed starting at &buffer[data_len_without_checksum].
[in]data_len_without_checksumLength of the RDM message without checksum.

◆ rdm_pack_command()

etcpal_error_t rdm_pack_command ( const RdmCommandHeader cmd_header,
const uint8_t *  cmd_data,
uint8_t  cmd_data_len,
RdmBuffer buffer 
)

Convert an RDM command header and data to the RDM wire format.

Parameters
[in]cmd_headerThe header data for the command.
[in]cmd_dataThe parameter data that accompanies the command, or NULL if no data.
[in]cmd_data_lenLength in bytes of cmd_data, or 0 if no data.
[out]bufferRdmBuffer struct to hold the serialized command.
Returns
kEtcPalErrOk: Command packed successfully.
kEtcPalErrInvalid: Invalid argument provided.
kEtcPalErrMsgSize: Parameter data length is too long.

◆ rdm_pack_command_with_custom_buf()

etcpal_error_t rdm_pack_command_with_custom_buf ( const RdmCommandHeader cmd_header,
const uint8_t *  cmd_data,
uint8_t  cmd_data_len,
uint8_t *  buf,
size_t  buf_len 
)

Convert an RDM command header and data to the RDM wire format in a user-provided buffer.

Parameters
[in]cmd_headerThe header data for the command.
[in]cmd_dataThe parameter data that accompanies the command, or NULL if no data.
[in]cmd_data_lenLength in bytes of cmd_data, or 0 if no data.
[out]bufData buffer to hold the serialized command.
[out]buf_lenLength in bytes of buf.
Returns
kEtcPalErrOk: Command packed successfully.
kEtcPalErrInvalid: Invalid argument provided.
kEtcPalErrMsgSize: Parameter data length is too long.
kEtcPalErrBufSize: Buffer not long enough to hold RDM message.

◆ rdm_pack_dub_response()

etcpal_error_t rdm_pack_dub_response ( const RdmUid responder_uid,
RdmBuffer buffer 
)

Serialize an RDM DISC_UNIQUE_BRANCH response.

The DISC_UNIQUE_BRANCH response does not adhere to the normal RDM packet format and is sent without a break. The only information encoded is this responder's UID.

Parameters
[in]responder_uidUID of the responder responding to the DISC_UNIQUE_BRANCH command.
[out]bufferData buffer filled in with serialized response.
Returns
kEtcPalErrOk: Response packed successfully.
kEtcPalErrInvalid: Invalid argument.

◆ rdm_pack_full_response()

etcpal_error_t rdm_pack_full_response ( const RdmCommandHeader cmd_header,
const uint8_t *  response_data,
size_t  response_data_len,
RdmBuffer buffers,
size_t  num_buffers 
)

Serialize a full RDM ACK response, splitting ACK_OVERFLOW responses if necessary.

This function will pack a potentially-oversized RDM ACK response into one or more RDM buffers, splitting it into ACK_OVERFLOW responses if necessary. It is most often used by higher-level protocols like RDMnet.

Parameters
[in]cmd_headerHeader from the received RDM command.
[in]response_dataThe full response parameter data.
[in]response_data_lenThe length of the response parameter data.
[out]buffersSet of buffers into which to pack serialized RDM ACK_OVERFLOW/ACK responses in order.
[out]num_buffersSize of buffers array.
Returns
kEtcPalErrOk: Response(s) packed successfully.
kEtcPalErrInvalid: Invalid argument provided.
kEtcPalErrBufSize: Not enough RdmBuffers to hold the response data.

◆ rdm_pack_nack_response()

etcpal_error_t rdm_pack_nack_response ( const RdmCommandHeader cmd_header,
uint8_t  msg_count,
rdm_nack_reason_t  nack_reason,
RdmBuffer buffer 
)

Serialize an RDM NACK response to a previously-received command.

Creates and serializes the NACK response into a format suitable for sending on the wire.

Parameters
[in]cmd_headerHeader from the received RDM command.
[in]msg_countThe current queued message count.
[in]nack_reasonThe RDM NACK reason to send.
[out]bufferData buffer filled in with serialized response.
Returns
kEtcPalErrOk: Response packed successfully.
kEtcPalErrInvalid: Invalid argument.

◆ rdm_pack_overflow_response()

etcpal_error_t rdm_pack_overflow_response ( const RdmCommandHeader cmd_header,
const uint8_t *  response_data,
uint8_t  response_data_len,
RdmBuffer buffer 
)

Serialize an RDM ACK_OVERFLOW response to a previously-received command.

ACK_OVERFLOW responses represent part of an RDM response whose data is too large to send in a single response. Creates and serializes the ACK_OVERFLOW response into a format suitable for sending on the wire.

Parameters
[in]cmd_headerHeader from the received RDM command.
[in]response_dataThe portion of the response parameter data being sent in this overflow response.
[in]response_data_lenThe length of the response_data.
[out]bufferData buffer filled in with serialized response.
Returns
kEtcPalErrOk: Response packed successfully.
kEtcPalErrInvalid: Invalid argument.
kEtcPalErrMsgSize: Response data too long.

◆ rdm_pack_response()

etcpal_error_t rdm_pack_response ( const RdmCommandHeader cmd_header,
uint8_t  msg_count,
const uint8_t *  response_data,
uint8_t  response_data_len,
RdmBuffer buffer 
)

Serialize an RDM ACK response to a previously-received command.

Creates and serializes the ACK response into a format suitable for sending on the wire. Response data must fit in a single response (must be <= RDM_MAX_PDL); if it doesn't, split the data into N chunks and call rdm_pack_overflow_response() for the first N - 1, and this function for the Nth chunk.

Parameters
[in]cmd_headerHeader from the received RDM command.
[in]msg_countThe current queued message count.
[in]response_data(optional) The response parameter data, if any.
[in]response_data_len(optional) The length of the response parameter data, if any.
[out]bufferData buffer filled in with serialized response.
Returns
kEtcPalErrOk: Response packed successfully.
kEtcPalErrInvalid: Invalid argument.
kEtcPalErrMsgSize: Response data too long.

◆ rdm_pack_timer_response()

etcpal_error_t rdm_pack_timer_response ( const RdmCommandHeader cmd_header,
uint8_t  msg_count,
unsigned int  delay_time_ms,
RdmBuffer buffer 
)

Serialize an RDM ACK_TIMER response to a previously-received command.

Creates and serializes the ACK_TIMER response into a format suitable for sending on the wire.

Parameters
[in]cmd_headerHeader from the received RDM command.
[in]msg_countThe current queued message count.
[in]delay_time_msThe amount of time in milliseconds before the response will be available. Must be in the range [1, 6553500].
[out]bufferData buffer filled in with serialized response.
Returns
kEtcPalErrOk: Response packed successfully.
kEtcPalErrInvalid: Invalid argument.

◆ rdm_response_header_is_valid()

bool rdm_response_header_is_valid ( const RdmResponseHeader resp_header)

Determine whether the values contained in a response header are valid for an RDM response.

Parameters
[in]resp_headerHeader to validate.

◆ rdm_response_type_to_string()

const char* rdm_response_type_to_string ( rdm_response_type_t  resp_type)

Get a string representation of an RDM response type.

Parameters
[in]resp_typeResponse type for which to get a string representation.
Returns
The response type string, or a placeholder string if an invalid response type was given.

◆ rdm_unpack_command()

etcpal_error_t rdm_unpack_command ( const RdmBuffer buffer,
RdmCommandHeader cmd_header,
const uint8_t **  param_data,
uint8_t *  param_data_len 
)

Deserialize an RDM command from its wire format.

Parameters
[in]bufferBuffer holding serialized RDM command data.
[out]cmd_headerFilled in with the RDM command header data.
[out]param_dataFilled in with pointer to the start of the RDM parameter data in the original buffer.
[out]param_data_lenFilled in with the length of the RDM parameter data accompanying the command.
Returns
kEtcPalErrOk: Command unpacked successfully.
kEtcPalErrInvalid: Invalid argument provided.
kEtcPalErrProtocol: RDM protocol error in packed command.

◆ rdm_unpack_dub_response()

etcpal_error_t rdm_unpack_dub_response ( const RdmBuffer buffer,
RdmUid responder_uid 
)

Deserialize an RDM DISC_UNIQUE_BRANCH from its wire format.

DISC_UNIQUE_BRANCH (aka DUB) responses have a special format. The only information encoded is the responder's UID.

Parameters
[in]bufferBuffer holding serialized RDM DISC_UNIQUE_BRANCH response data.
[out]responder_uidFilled in with the RDM responder's UID.
Returns
kEtcPalErrOk: DISC_UNIQUE_BRANCH response unpacked successfully.
kEtcPalErrInvalid: Invalid argument provided.
kEtcPalErrProtocol: RDM protocol error in packed response.

◆ rdm_unpack_response()

etcpal_error_t rdm_unpack_response ( const RdmBuffer buffer,
RdmResponseHeader resp_header,
const uint8_t **  param_data,
uint8_t *  param_data_len 
)

Deserialize an RDM response from its wire format.

Parameters
[in]bufferBuffer holding serialized RDM response data.
[out]resp_headerFilled in with the RDM response header data.
[out]param_dataFilled in with pointer to the start of the RDM parameter data in the original buffer.
[out]param_data_lenFilled in with the length of the RDM parameter data accompanying the response.
Returns
kEtcPalErrOk: Response unpacked successfully.
kEtcPalErrInvalid: Invalid argument provided.
kEtcPalErrProtocol: RDM protocol error in packed response.

◆ rdm_validate_msg()

bool rdm_validate_msg ( const RdmBuffer buffer)

Perform basic validation of a packed RDM message.

Checks that the message has a correctly formed length, the correct start code values, and that the checksum is correct.

Parameters
[in]bufferRDM message to validate.
Returns
true (RDM message is valid) or false (RDM message is invalid).