Open Lighting Architecture  Latest Git
Public Types | Static Public Member Functions | List of all members
ola::rdm::RDMCommandSerializer Class Reference

Detailed Description

Serializes RDMCommands.

This creates the binary representation of an RDMCommand. The binary representation is restricted to 231 bytes of parameter data. If the message is more than 231 bytes then the methods will return false.

Public Types

enum  { MAX_PARAM_DATA_LENGTH = 231 }
 The maximum parameter data a single command can contain.
 

Static Public Member Functions

static bool Pack (const RDMCommand &command, ola::io::ByteString *output)
 Serialize a RDMCommand to a ByteString, without the RDM Start Code. More...
 
static bool PackWithStartCode (const RDMCommand &command, ola::io::ByteString *output)
 Serialize a RDMCommand to a ByteString, with the RDM Start Code. More...
 
static unsigned int RequiredSize (const RDMCommand &command)
 Return the number of bytes required to store the serialized version of the RDMCommand. More...
 
static bool Pack (const RDMCommand &command, uint8_t *buffer, unsigned int *size)
 Serialize a RDMCommand to an array of bytes. More...
 
static bool Write (const RDMCommand &command, ola::io::IOStack *stack)
 Write the binary representation of an RDMCommand to an IOStack. More...
 

Member Function Documentation

◆ Pack() [1/2]

bool ola::rdm::RDMCommandSerializer::Pack ( const RDMCommand command,
ola::io::ByteString output 
)
static

Serialize a RDMCommand to a ByteString, without the RDM Start Code.

Parameters
commandthe RDMCommand to serialize.
[out]outputThe ByteString to append to.
Returns
True if the command was serialized correctly, false otherwise.

◆ Pack() [2/2]

bool ola::rdm::RDMCommandSerializer::Pack ( const RDMCommand command,
uint8_t *  buffer,
unsigned int *  size 
)
static

Serialize a RDMCommand to an array of bytes.

Parameters
commandthe RDMCommand to serialize.
bufferThe memory location to serialize to.
[in,out]sizeThe size of the memory location.
Returns
True if the command was serialized correctly, false otherwise.

The size of the memory location should be at least as large as what was returned from RequiredSize().

◆ PackWithStartCode()

bool ola::rdm::RDMCommandSerializer::PackWithStartCode ( const RDMCommand command,
ola::io::ByteString output 
)
static

Serialize a RDMCommand to a ByteString, with the RDM Start Code.

Parameters
commandthe RDMCommand to serialize.
[out]outputThe ByteString to append to.
Returns
True if the command was serialized correctly, false otherwise.

◆ RequiredSize()

unsigned int ola::rdm::RDMCommandSerializer::RequiredSize ( const RDMCommand command)
static

Return the number of bytes required to store the serialized version of the RDMCommand.

Parameters
commandThe RDMCommand which will be serialized.
Returns
The number of bytes required for the serialized form of the command or 0 if the command contains more than 231 bytes of parameter data.

◆ Write()

bool ola::rdm::RDMCommandSerializer::Write ( const RDMCommand command,
ola::io::IOStack stack 
)
static

Write the binary representation of an RDMCommand to an IOStack.

Parameters
commandthe RDMCommand
stackthe IOStack to write to.
Returns
true if the write was successful, false if the RDM command needs to be fragmented.

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