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);
512 rdm_nack_reason reason,
513 uint8_t outstanding_messages = 0);
515 const uint8_t *data = NULL,
516 unsigned int length = 0,
517 rdm_response_type type = RDM_ACK,
518 uint8_t outstanding_messages = 0);
524 uint8_t type = RDM_ACK,
525 uint8_t outstanding_messages = 0);
533 const UID &destination,
534 uint8_t transaction_number,
536 uint8_t message_count,
553 uint8_t PortId()
const {
return m_port_id; }
557 bool unpack_param_data)
const {
558 printer->Print(
this, summarize, unpack_param_data);
562 unsigned int length);
576 uint8_t transaction_number,
577 uint8_t port_id = 1);
584 const UID &destination,
585 uint8_t transaction_number,
586 uint8_t port_id = 1);
592 const UID &destination,
593 uint8_t transaction_number,
594 uint8_t port_id = 1);
603 const UID &destination,
604 uint8_t transaction_number,
606 uint8_t message_count,
625 bool unpack_param_data)
const {
626 printer->Print(
this, summarize, unpack_param_data);
630 unsigned int length);
636 #endif // INCLUDE_OLA_RDM_RDMCOMMAND_H_