30 #ifndef INCLUDE_OLA_RDM_RDMCOMMAND_H_
31 #define INCLUDE_OLA_RDM_RDMCOMMAND_H_
34 #include <ola/io/OutputStream.h>
35 #include <ola/rdm/CommandPrinter.h>
38 #include <ola/rdm/RDMResponseCodes.h>
175 uint16_t
ParamId()
const {
return m_param_id; }
194 bool unpack_param_data)
const {
195 printer->Print(
this, summarize, unpack_param_data);
204 static const uint8_t START_CODE = 0xcc;
212 const UID &destination,
213 uint8_t transaction_number,
215 uint8_t message_count,
219 unsigned int length);
221 void SetParamData(
const uint8_t *data,
unsigned int length);
223 static rdm_response_code VerifyData(
233 uint8_t m_transaction_number;
234 uint8_t m_message_count;
235 uint16_t m_sub_device;
238 unsigned int m_data_length;
241 bool operator=(
const RDMCommand &other)
const;
243 static uint16_t CalculateChecksum(
const uint8_t *data,
244 unsigned int packet_length);
254 const UID &destination,
255 uint8_t transaction_number,
257 uint8_t message_count,
262 unsigned int length):
272 m_command_class(command_class) {
276 uint8_t PortId()
const {
return m_port_id; }
278 virtual RDMRequest *Duplicate()
const {
279 return DuplicateWithControllerParams(
285 virtual RDMRequest *DuplicateWithControllerParams(
287 uint8_t transaction_number,
288 uint8_t port_id)
const {
289 return new RDMRequest(
304 bool unpack_param_data)
const {
305 printer->Print(
this, summarize, unpack_param_data);
309 static RDMRequest* InflateFromData(
const uint8_t *data,
310 unsigned int length);
311 static RDMRequest* InflateFromData(
const std::string &data);
324 const UID &destination,
325 uint8_t transaction_number,
327 uint8_t message_count,
332 unsigned int length):
347 template <RDMCommand::RDMCommandClass command_
class>
351 const UID &destination,
352 uint8_t transaction_number,
354 uint8_t message_count,
358 unsigned int length):
373 return DuplicateWithControllerParams(
379 BaseRDMRequest<command_class> *DuplicateWithControllerParams(
381 uint8_t transaction_number,
382 uint8_t port_id)
const {
383 return new BaseRDMRequest<command_class>(
396 typedef BaseRDMRequest<RDMCommand::GET_COMMAND> RDMGetRequest;
397 typedef BaseRDMRequest<RDMCommand::SET_COMMAND> RDMSetRequest;
407 const UID &destination,
408 uint8_t transaction_number,
409 uint8_t response_type,
410 uint8_t message_count,
416 :
RDMCommand(source, destination, transaction_number, response_type,
417 message_count, sub_device, param_id, data, length),
418 m_command_class(command_class) {
421 uint8_t ResponseType()
const {
return m_port_id; }
425 bool unpack_param_data)
const {
426 printer->Print(
this, summarize, unpack_param_data);
433 static const unsigned int MAX_OVERFLOW_SIZE = 4 << 10;
438 rdm_response_code *response_code,
442 rdm_response_code *response_code,
444 uint8_t transaction_number);
446 rdm_response_code *response_code,
449 rdm_response_code *response_code,
451 uint8_t transaction_number);
468 const UID &destination,
469 uint8_t transaction_number,
470 uint8_t response_type,
471 uint8_t message_count,
477 :
RDMResponse(source, destination, transaction_number, response_type,
478 message_count, sub_device, command_class, param_id, data,
484 template <RDMCommand::RDMCommandClass command_
class>
488 const UID &destination,
489 uint8_t transaction_number,
490 uint8_t response_type,
491 uint8_t message_count,
497 response_type, message_count, sub_device,
498 command_class, param_id, data, length) {
510 unsigned int length);
515 rdm_nack_reason reason,
516 uint8_t outstanding_messages = 0);
521 const uint8_t *data = NULL,
522 unsigned int length = 0,
523 rdm_response_type type = RDM_ACK,
524 uint8_t outstanding_messages = 0);
533 uint8_t type = RDM_ACK,
534 uint8_t outstanding_messages = 0);
542 const UID &destination,
543 uint8_t transaction_number,
545 uint8_t message_count,
562 uint8_t PortId()
const {
return m_port_id; }
566 bool unpack_param_data)
const {
567 printer->Print(
this, summarize, unpack_param_data);
571 unsigned int length);
585 uint8_t transaction_number,
586 uint8_t port_id = 1);
593 const UID &destination,
594 uint8_t transaction_number,
595 uint8_t port_id = 1);
601 const UID &destination,
602 uint8_t transaction_number,
603 uint8_t port_id = 1);
612 const UID &destination,
613 uint8_t transaction_number,
615 uint8_t message_count,
634 bool unpack_param_data)
const {
635 printer->Print(
this, summarize, unpack_param_data);
639 unsigned int length);
645 #endif // INCLUDE_OLA_RDM_RDMCOMMAND_H_