23 #ifndef RDMNET_CPP_MESSAGE_TYPES_RDM_RESPONSE_H_
24 #define RDMNET_CPP_MESSAGE_TYPES_RDM_RESPONSE_H_
29 #include "etcpal/common.h"
31 #include "etcpal/pack.h"
32 #include "rdm/cpp/message.h"
33 #include "rdm/cpp/uid.h"
34 #include "rdmnet/defs.h"
39 class SavedRdmResponse;
60 constexpr uint32_t
seq_num() const noexcept;
71 constexpr uint16_t
subdevice() const noexcept;
73 constexpr uint16_t
param_id() const noexcept;
74 constexpr rdm::ResponseHeader
rdm_header() const noexcept;
75 constexpr const uint8_t*
data() const noexcept;
76 constexpr
size_t data_len() const noexcept;
80 constexpr
bool HasData() const noexcept;
84 constexpr
bool IsAck() const noexcept;
85 constexpr
bool IsNack() const noexcept;
97 rdm::Response
ToRdm() const;
122 uint32_t
seq_num() const noexcept;
129 const rdm::Command& original_cmd() const noexcept;
137 const rdm::ResponseHeader&
rdm_header() const noexcept;
138 const uint8_t*
data() const noexcept;
140 const rdm::Response& rdm() const noexcept;
142 bool IsValid() const noexcept;
148 bool IsAck() const noexcept;
149 bool IsNack() const noexcept;
158 void AppendData(const uint8_t*
data,
size_t size);
161 rdm::Uid rdmnet_source_uid_;
162 uint16_t source_endpoint_{0};
163 uint32_t seq_num_{0};
164 bool is_response_to_me_{
false};
165 rdm::Command original_cmd_;
337 return (resp_.
rdm_header.resp_type == kRdmResponseTypeAck);
346 return (resp_.
rdm_header.resp_type == kRdmResponseTypeNackReason);
352 return (resp_.
rdm_header.command_class == kRdmCCGetCommandResponse);
358 return (resp_.
rdm_header.command_class == kRdmCCSetCommandResponse);
426 , rdm_(c_resp.
rdm_header, c_resp.rdm_data, c_resp.rdm_data_len)
443 : rdmnet_source_uid_(resp.rdmnet_source_uid())
444 , source_endpoint_(resp.source_endpoint())
445 , seq_num_(resp.seq_num())
446 , original_cmd_(resp.OriginalCommandToRdm())
465 return rdmnet_source_uid_;
471 return source_endpoint_;
501 return original_cmd_.header();
525 return original_cmd_;
531 return rdm_.source_uid();
537 return rdm_.dest_uid();
543 return rdm_.response_type();
549 return rdm_.subdevice();
555 return rdm_.command_class();
561 return rdm_.param_id();
567 return rdm_.header();
579 return rdm_.data_len();
592 return rdm_.IsValid();
602 return (seq_num_ != 0);
608 return rdm_.HasData();
615 return (source_endpoint_ == E133_NULL_ENDPOINT);
622 return is_response_to_me_;
640 return rdm_.IsNack();
646 return rdm_.IsGetResponse();
652 return rdm_.IsSetResponse();
660 return rdm_.GetNackReason();
667 return rdm_.GetData();
An RDM response received over RDMnet and delivered to an RDMnet callback function.
Definition: rdm_response.h:47
RdmResponse(const RdmResponse &other)=delete
Not copyable - use Save() to create a copyable version.
constexpr rdm::Uid rdm_dest_uid() const noexcept
Get the UID of the RDM controller to which this response is addressed.
Definition: rdm_response.h:243
constexpr bool IsResponseToMe() const noexcept
Whether the response was sent in response to a command previously sent by this controller.
Definition: rdm_response.h:326
constexpr rdm::ResponseHeader rdm_header() const noexcept
Get the RDM protocol header contained within this response.
Definition: rdm_response.h:273
constexpr const RdmnetRdmResponse & get() const noexcept
Get a const reference to the underlying C type.
Definition: rdm_response.h:388
constexpr bool IsSetResponse() const noexcept
Whether this response is an RDM SET response.
Definition: rdm_response.h:356
constexpr const uint8_t * data() const noexcept
Get a pointer to the RDM parameter data buffer contained within this response.
Definition: rdm_response.h:279
constexpr bool IsAck() const noexcept
Whether this command has an RDM response type of ACK.
Definition: rdm_response.h:335
constexpr uint8_t original_cmd_data_len() const noexcept
Get the length of the RDM parameter data accompanying the original RDM command, if available.
Definition: rdm_response.h:231
RdmResponse()=delete
Not default-constructible.
constexpr rdm_command_class_t command_class() const noexcept
Get the RDM response class of this response.
Definition: rdm_response.h:261
constexpr rdm::CommandHeader original_cmd_header() const noexcept
Get the RDM protocol header of the original RDM command, if available.
Definition: rdm_response.h:215
constexpr bool more_coming() const noexcept
This message contains partial RDM data.
Definition: rdm_response.h:296
constexpr bool IsNack() const noexcept
Whether this command has an RDM response type of NACK_REASON.
Definition: rdm_response.h:344
constexpr rdm_response_type_t response_type() const noexcept
Get the RDM response type of this response.
Definition: rdm_response.h:249
std::vector< uint8_t > GetOriginalCmdData() const
Copy out the original RDM command data in a RdmResponse.
Definition: rdm_response.h:382
constexpr rdm::Uid rdm_source_uid() const noexcept
Get the UID of the RDM responder that sent this response.
Definition: rdm_response.h:237
SavedRdmResponse Save() const
Save the data in this response for later use from a different context.
Definition: rdm_response.h:411
constexpr rdm::Uid rdmnet_source_uid() const noexcept
Get the UID of the RDMnet component that sent this response.
Definition: rdm_response.h:179
constexpr rdm::Uid original_cmd_source_uid() const noexcept
Get the RDM source UID of the original RDM command, if available.
Definition: rdm_response.h:199
constexpr uint32_t seq_num() const noexcept
Get the RDMnet sequence number of this response, for matching with a corresponding command.
Definition: rdm_response.h:191
constexpr bool IsGetResponse() const noexcept
Whether this response is an RDM GET response.
Definition: rdm_response.h:350
constexpr const uint8_t * original_cmd_data() const noexcept
Get the RDM parameter data of the original RDM command, if available.
Definition: rdm_response.h:223
rdm::Response ToRdm() const
Convert the RDM data in this response to an RDM response type.
Definition: rdm_response.h:404
constexpr bool HasData() const noexcept
Whether this RDM response includes any RDM parameter data.
Definition: rdm_response.h:312
RdmResponse & operator=(const RdmResponse &other)=delete
Not copyable - use Save() to create a copyable version.
constexpr uint16_t source_endpoint() const noexcept
Get the endpoint from which this response was sent.
Definition: rdm_response.h:185
std::vector< uint8_t > GetData() const
Copy out the data in a RdmResponse.
Definition: rdm_response.h:374
constexpr rdm::Uid original_cmd_dest_uid() const noexcept
Get the RDM destination UID of the original RDM command, if available.
Definition: rdm_response.h:207
constexpr bool IsFromDefaultResponder() const noexcept
Whether this RDM response is from a default responder.
Definition: rdm_response.h:319
constexpr bool OriginalCommandIncluded() const noexcept
Whether the original RDM command is included.
Definition: rdm_response.h:306
constexpr uint16_t subdevice() const noexcept
Get the RDM subdevice from which this response originated (0 means the root device).
Definition: rdm_response.h:255
etcpal::Expected< rdm::NackReason > GetNackReason() const noexcept
Get the NACK reason code of this RDM response.
Definition: rdm_response.h:364
rdm::Command OriginalCommandToRdm() const
Convert the original RDM command associated with this response to an RDM command type.
Definition: rdm_response.h:396
constexpr size_t data_len() const noexcept
Get the length of the RDM parameter data contained within this response.
Definition: rdm_response.h:285
constexpr uint16_t param_id() const noexcept
Get the RDM parameter ID (PID) of this response.
Definition: rdm_response.h:267
An RDM response received over RDMnet and saved for later processing.
Definition: rdm_response.h:111
SavedRdmResponse & operator=(const RdmnetSavedRdmResponse &c_resp)
Assign an instance of the C RdmnetSavedRdmResponse type to an instance of this class.
Definition: rdm_response.h:431
bool OriginalCommandIncluded() const noexcept
Whether the original RDM command is included.
Definition: rdm_response.h:600
rdm::Uid rdm_dest_uid() const noexcept
Get the UID of the RDM controller to which this response is addressed.
Definition: rdm_response.h:535
bool IsSetResponse() const noexcept
Whether this response is an RDM SET response.
Definition: rdm_response.h:650
size_t data_len() const noexcept
Get the length of the RDM parameter data contained within this response.
Definition: rdm_response.h:577
std::vector< uint8_t > GetData() const
Copy out the data in a SavedRdmResponse.
Definition: rdm_response.h:665
uint16_t source_endpoint() const noexcept
Get the endpoint from which this response was sent.
Definition: rdm_response.h:469
const uint8_t * original_cmd_data() const noexcept
Get the RDM parameter data of the original RDM command, if available.
Definition: rdm_response.h:507
const rdm::Response & rdm() const noexcept
Get the RDM data in this response as an RDM response type.
Definition: rdm_response.h:583
bool IsValid() const noexcept
Whether the values contained in this response are valid for an RDM response.
Definition: rdm_response.h:590
uint8_t original_cmd_data_len() const noexcept
Get the length of the RDM parameter data accompanying the original RDM command, if available.
Definition: rdm_response.h:515
rdm::Uid rdm_source_uid() const noexcept
Get the UID of the RDM responder that sent this response.
Definition: rdm_response.h:529
const rdm::CommandHeader & original_cmd_header() const noexcept
Get the RDM protocol header of the original RDM command, if available.
Definition: rdm_response.h:499
bool IsFromDefaultResponder() const noexcept
Whether this RDM response is from a default responder.
Definition: rdm_response.h:613
void AppendData(const RdmResponse &new_resp)
Append more data to this response's parameter data.
Definition: rdm_response.h:672
bool IsNack() const noexcept
Whether this command has an RDM response type of NACK_REASON.
Definition: rdm_response.h:638
bool IsResponseToMe() const noexcept
Whether the response was sent in response to a command previously sent by this controller.
Definition: rdm_response.h:620
bool IsAck() const noexcept
Whether this command has an RDM response type of ACK.
Definition: rdm_response.h:629
const rdm::Command & original_cmd() const noexcept
Get the original RDM command that resulted in this RDM response, if available.
Definition: rdm_response.h:523
const rdm::ResponseHeader & rdm_header() const noexcept
Get the RDM protocol header contained within this response.
Definition: rdm_response.h:565
rdm::Uid original_cmd_source_uid() const noexcept
Get the RDM source UID of the original RDM command, if available.
Definition: rdm_response.h:483
bool IsGetResponse() const noexcept
Whether this response is an RDM GET response.
Definition: rdm_response.h:644
uint16_t param_id() const noexcept
Get the RDM parameter ID (PID) of this response.
Definition: rdm_response.h:559
rdm_response_type_t response_type() const noexcept
Get the RDM response type of this response.
Definition: rdm_response.h:541
bool HasData() const noexcept
Whether this RDM response includes any RDM parameter data.
Definition: rdm_response.h:606
uint32_t seq_num() const noexcept
Get the RDMnet sequence number of this response, for matching with a corresponding command.
Definition: rdm_response.h:475
rdm_command_class_t command_class() const noexcept
Get the RDM response class of this response.
Definition: rdm_response.h:553
SavedRdmResponse()=default
Constructs an empty, invalid RDM response by default.
etcpal::Expected< rdm::NackReason > GetNackReason() const noexcept
Get the NACK reason code of this RDM response.
Definition: rdm_response.h:658
uint16_t subdevice() const noexcept
Get the RDM subdevice from which this response originated (0 means the root device).
Definition: rdm_response.h:547
const rdm::Uid & rdmnet_source_uid() const noexcept
Get the UID of the RDMnet component that sent this response.
Definition: rdm_response.h:463
rdm::Uid original_cmd_dest_uid() const noexcept
Get the RDM destination UID of the original RDM command, if available.
Definition: rdm_response.h:491
const uint8_t * data() const noexcept
Get a pointer to the RDM parameter data buffer contained within this response.
Definition: rdm_response.h:571
uint16_t etcpal_unpack_u16b(const uint8_t *buf)
Basic types for parsed RDMnet messages.
A namespace which contains all C++ language definitions in the RDMnet library.
Definition: broker.h:45
An RDMnet RDM response received by a local component.
Definition: message.h:90
RdmCommandHeader original_cmd_header
The header of the original command associated with this response; valid if seq_num !...
Definition: message.h:104
uint8_t original_cmd_data_len
The length of the parameter data associated with the original RDM command; valid if seq_num !...
Definition: message.h:111
const uint8_t * original_cmd_data
Any parameter data associated with the original RDM command; valid if seq_num != 0.
Definition: message.h:106
size_t rdm_data_len
The length of the parameter data associated with the RDM response.
Definition: message.h:118
RdmUid rdmnet_source_uid
The UID of the RDMnet component that sent this response.
Definition: message.h:92
uint16_t source_endpoint
The endpoint from which the response was sent.
Definition: message.h:94
bool is_response_to_me
Whether the response was sent in response to a command previously sent by this controller.
Definition: message.h:101
RdmResponseHeader rdm_header
The header information from the encapsulated RDM response.
Definition: message.h:114
const uint8_t * rdm_data
Any parameter data associated with the RDM response.
Definition: message.h:116
bool more_coming
This message contains partial RDM data.
Definition: message.h:127
uint32_t seq_num
The sequence number of the response, for matching with a corresponding command.
Definition: message.h:96
An RDM response received over RDMnet and saved for later processing.
Definition: message.h:138
uint8_t * rdm_data
Any parameter data associated with the RDM response.
Definition: message.h:167
RdmResponseHeader rdm_header
The header information from the encapsulated RDM response.
Definition: message.h:162
RdmUid rdmnet_source_uid
The UID of the RDMnet component that sent this response.
Definition: message.h:140
uint16_t source_endpoint
The endpoint from which the response was sent.
Definition: message.h:142
size_t rdm_data_len
The length of the parameter data associated with the RDM response.
Definition: message.h:169
uint32_t seq_num
The sequence number of the response, for matching with a corresponding command.
Definition: message.h:144
uint8_t original_cmd_data[RDM_MAX_PDL]
Any parameter data associated with the original RDM command; valid if seq_num != 0.
Definition: message.h:154
RdmCommandHeader original_cmd_header
The header of the original command associated with this response; valid if seq_num !...
Definition: message.h:152
uint8_t original_cmd_data_len
The length of the parameter data associated with the original RDM command; valid if seq_num !...
Definition: message.h:159