30 #ifndef INCLUDE_OLA_RDM_RDMCOMMAND_H_
31 #define INCLUDE_OLA_RDM_RDMCOMMAND_H_
35 #include <ola/io/ByteString.h>
36 #include <ola/io/OutputStream.h>
37 #include <ola/rdm/CommandPrinter.h>
40 #include <ola/rdm/RDMResponseCodes.h>
137 uint16_t
ParamId()
const {
return m_param_id; }
154 virtual uint16_t
Checksum(uint16_t checksum)
const {
return checksum; }
165 bool unpack_param_data)
const {
166 printer->Print(
this, summarize, unpack_param_data);
193 uint8_t m_transaction_number;
199 const UID &destination,
200 uint8_t transaction_number,
202 uint8_t message_count,
206 unsigned int length);
208 void SetParamData(
const uint8_t *data,
unsigned int length);
210 static RDMStatusCode VerifyData(
const uint8_t *data,
217 uint8_t m_message_count;
218 uint16_t m_sub_device;
221 unsigned int m_data_length;
223 static uint16_t CalculateChecksum(
const uint8_t *data,
224 unsigned int packet_length);
242 : has_message_length(false),
244 sub_start_code(SUB_START_CODE),
250 void SetMessageLength(uint8_t message_length_arg) {
251 has_message_length =
true;
252 message_length = message_length_arg;
255 void SetChecksum(uint16_t checksum_arg) {
257 checksum = checksum_arg;
260 bool has_message_length;
263 uint8_t sub_start_code;
264 uint8_t message_length;
265 uint8_t message_count;
283 const UID &destination,
284 uint8_t transaction_number,
291 const OverrideOptions &options = OverrideOptions());
299 uint8_t
PortId()
const {
return m_port_id; }
321 bool unpack_param_data)
const {
322 printer->Print(
this, summarize, unpack_param_data);
333 uint16_t
Checksum(uint16_t checksum)
const;
345 m_source = source_uid;
353 m_transaction_number = transaction_number;
373 unsigned int length);
376 OverrideOptions m_override_options;
402 const UID &destination,
403 uint8_t transaction_number,
411 :
RDMRequest(source, destination, transaction_number, port_id,
412 sub_device, command_class, param_id, data, length, options) {
417 template <RDMCommand::RDMCommandClass command_
class>
421 const UID &destination,
422 uint8_t transaction_number,
430 sub_device, command_class, param_id, data, length,
448 typedef BaseRDMRequest<RDMCommand::GET_COMMAND> RDMGetRequest;
449 typedef BaseRDMRequest<RDMCommand::SET_COMMAND> RDMSetRequest;
472 const UID &destination,
473 uint8_t transaction_number,
474 uint8_t response_type,
475 uint8_t message_count,
481 :
RDMCommand(source, destination, transaction_number, response_type,
482 message_count, sub_device, param_id, data, length),
483 m_command_class(command_class) {
488 bool unpack_param_data)
const {
489 printer->Print(
this, summarize, unpack_param_data);
535 m_destination = destination_uid;
543 m_transaction_number = transaction_number;
565 RDMStatusCode *status_code,
576 RDMStatusCode *status_code,
578 return InflateFromData(input.data(), input.size(), status_code, request);
605 const UID &destination,
606 uint8_t transaction_number,
607 uint8_t response_type,
608 uint8_t message_count,
614 :
RDMResponse(source, destination, transaction_number, response_type,
615 message_count, sub_device, command_class, param_id, data,
621 template <RDMCommand::RDMCommandClass command_
class>
625 const UID &destination,
626 uint8_t transaction_number,
627 uint8_t response_type,
628 uint8_t message_count,
634 response_type, message_count, sub_device,
635 command_class, param_id, data, length) {
649 rdm_nack_reason reason,
650 uint8_t outstanding_messages = 0);
655 const uint8_t *data = NULL,
656 unsigned int length = 0,
657 rdm_response_type type = RDM_ACK,
658 uint8_t outstanding_messages = 0);
667 uint8_t type = RDM_ACK,
668 uint8_t outstanding_messages = 0);
676 const UID &destination,
677 uint8_t transaction_number,
696 uint8_t
PortId()
const {
return m_port_id; }
700 bool unpack_param_data)
const {
701 printer->Print(
this, summarize, unpack_param_data);
705 unsigned int length);
718 uint8_t transaction_number,
719 uint8_t port_id = 1);
726 const UID &destination,
727 uint8_t transaction_number,
728 uint8_t port_id = 1);
734 const UID &destination,
735 uint8_t transaction_number,
736 uint8_t port_id = 1);
745 const UID &destination,
746 uint8_t transaction_number,
748 uint8_t message_count,
767 bool unpack_param_data)
const {
768 printer->Print(
this, summarize, unpack_param_data);
772 unsigned int length);
777 #endif // INCLUDE_OLA_RDM_RDMCOMMAND_H_