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
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
SavedRdmResponse Save() const
Save the data in this response for later use from a different context.
Definition: rdm_response.h:411
std::vector< uint8_t > GetData() const
Copy out the data in a RdmResponse.
Definition: rdm_response.h:374
constexpr uint16_t source_endpoint() const noexcept
Get the endpoint from which this response was sent.
Definition: rdm_response.h:185
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 bool IsNack() const noexcept
Whether this command has an RDM response type of NACK_REASON.
Definition: rdm_response.h:344
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 more_coming() const noexcept
This message contains partial RDM data.
Definition: rdm_response.h:296
constexpr bool HasData() const noexcept
Whether this RDM response includes any RDM parameter data.
Definition: rdm_response.h:312
constexpr rdm_command_class_t command_class() const noexcept
Get the RDM response class of this response.
Definition: rdm_response.h:261
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
rdm::Command OriginalCommandToRdm() const
Convert the original RDM command associated with this response to an RDM command type.
Definition: rdm_response.h:396
RdmResponse & operator=(const RdmResponse &other)=delete
Not copyable - use Save() to create a copyable version.
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 size_t data_len() const noexcept
Get the length of the RDM parameter data contained within this response.
Definition: rdm_response.h:285
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 rdm::ResponseHeader rdm_header() const noexcept
Get the RDM protocol header contained within this response.
Definition: rdm_response.h:273
RdmResponse()=delete
Not default-constructible.
constexpr bool OriginalCommandIncluded() const noexcept
Whether the original RDM command is included.
Definition: rdm_response.h:306
std::vector< uint8_t > GetOriginalCmdData() const
Copy out the original RDM command data in a RdmResponse.
Definition: rdm_response.h:382
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 bool IsGetResponse() const noexcept
Whether this response is an RDM GET response.
Definition: rdm_response.h:350
etcpal::Expected< rdm::NackReason > GetNackReason() const noexcept
Get the NACK reason code of this RDM response.
Definition: rdm_response.h:364
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 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 rdm::Uid rdmnet_source_uid() const noexcept
Get the UID of the RDMnet component that sent this response.
Definition: rdm_response.h:179
constexpr bool IsSetResponse() const noexcept
Whether this response is an RDM SET response.
Definition: rdm_response.h:356
rdm::Response ToRdm() const
Convert the RDM data in this response to an RDM response type.
Definition: rdm_response.h:404
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
constexpr bool IsAck() const noexcept
Whether this command has an RDM response type of ACK.
Definition: rdm_response.h:335
RdmResponse(const RdmResponse &other)=delete
Not copyable - use Save() to create a copyable version.
constexpr rdm_response_type_t response_type() const noexcept
Get the RDM response type of this response.
Definition: rdm_response.h:249
constexpr uint16_t param_id() const noexcept
Get the RDM parameter ID (PID) of this response.
Definition: rdm_response.h:267
constexpr bool IsFromDefaultResponder() const noexcept
Whether this RDM response is from a default responder.
Definition: rdm_response.h:319
constexpr rdm::Uid rdm_source_uid() const noexcept
Get the UID of the RDM responder that sent this response.
Definition: rdm_response.h:237
constexpr const RdmnetRdmResponse & get() const noexcept
Get a const reference to the underlying C type.
Definition: rdm_response.h:388
An RDM response received over RDMnet and saved for later processing.
Definition: rdm_response.h:111
std::vector< uint8_t > GetData() const
Copy out the data in a SavedRdmResponse.
Definition: rdm_response.h:665
uint16_t subdevice() const noexcept
Get the RDM subdevice from which this response originated (0 means the root device).
Definition: rdm_response.h:547
rdm_command_class_t command_class() const noexcept
Get the RDM response class of this response.
Definition: rdm_response.h:553
const rdm::ResponseHeader & rdm_header() const noexcept
Get the RDM protocol header contained within this response.
Definition: rdm_response.h:565
uint16_t source_endpoint() const noexcept
Get the endpoint from which this response was sent.
Definition: rdm_response.h:469
bool IsGetResponse() const noexcept
Whether this response is an RDM GET response.
Definition: rdm_response.h:644
const uint8_t * data() const noexcept
Get a pointer to the RDM parameter data buffer contained within this response.
Definition: rdm_response.h:571
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
bool IsSetResponse() const noexcept
Whether this response is an RDM SET response.
Definition: rdm_response.h:650
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
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
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
SavedRdmResponse()=default
Constructs an empty, invalid RDM response by default.
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 IsValid() const noexcept
Whether the values contained in this response are valid for an RDM response.
Definition: rdm_response.h:590
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
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
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
size_t data_len() const noexcept
Get the length of the RDM parameter data contained within this response.
Definition: rdm_response.h:577
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 OriginalCommandIncluded() const noexcept
Whether the original RDM command is included.
Definition: rdm_response.h:600
void AppendData(const RdmResponse &new_resp)
Append more data to this response's parameter data.
Definition: rdm_response.h:672
etcpal::Expected< rdm::NackReason > GetNackReason() const noexcept
Get the NACK reason code of this RDM response.
Definition: rdm_response.h:658
bool IsFromDefaultResponder() const noexcept
Whether this RDM response is from a default responder.
Definition: rdm_response.h:613
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 HasData() const noexcept
Whether this RDM response includes any RDM parameter data.
Definition: rdm_response.h:606
const rdm::Response & rdm() const noexcept
Get the RDM data in this response as an RDM response type.
Definition: rdm_response.h:583
uint16_t param_id() const noexcept
Get the RDM parameter ID (PID) of this response.
Definition: rdm_response.h:559
rdm::Uid rdm_source_uid() const noexcept
Get the UID of the RDM responder that sent this response.
Definition: rdm_response.h:529
rdm_response_type_t response_type() const noexcept
Get the RDM response type of this response.
Definition: rdm_response.h:541
const rdm::Uid & rdmnet_source_uid() const noexcept
Get the UID of the RDMnet component that sent this response.
Definition: rdm_response.h:463
bool IsAck() const noexcept
Whether this command has an RDM response type of ACK.
Definition: rdm_response.h:629
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
RdmCommandHeader original_cmd_header
Definition: message.h:105
const uint8_t * rdm_data
Definition: message.h:117
uint8_t original_cmd_data_len
Definition: message.h:112
uint16_t source_endpoint
Definition: message.h:95
size_t rdm_data_len
Definition: message.h:119
RdmResponseHeader rdm_header
Definition: message.h:115
uint32_t seq_num
Definition: message.h:97
RdmUid rdmnet_source_uid
Definition: message.h:93
bool more_coming
Definition: message.h:128
const uint8_t * original_cmd_data
Definition: message.h:107
bool is_response_to_me
Whether the response was sent in response to a command previously sent by this controller.
Definition: message.h:102
An RDM response received over RDMnet and saved for later processing.
Definition: message.h:139
RdmCommandHeader original_cmd_header
Definition: message.h:153
uint8_t original_cmd_data_len
Definition: message.h:160
uint16_t source_endpoint
Definition: message.h:143
size_t rdm_data_len
Definition: message.h:170
uint8_t original_cmd_data[RDM_MAX_PDL]
Definition: message.h:155
RdmResponseHeader rdm_header
Definition: message.h:163
uint32_t seq_num
Definition: message.h:145
RdmUid rdmnet_source_uid
Definition: message.h:141
uint8_t * rdm_data
Definition: message.h:168