diff --git a/common/rdm/CommandPrinter.cpp b/common/rdm/CommandPrinter.cpp index 670f2c8532..4367ec049c 100644 --- a/common/rdm/CommandPrinter.cpp +++ b/common/rdm/CommandPrinter.cpp @@ -209,7 +209,7 @@ void CommandPrinter::DisplayDiscoveryRequest( UID upper(param_data + UID::UID_SIZE); *m_output << ", (" << lower << ", " << upper << ")"; } else { - *m_output << ", pdl: " << std::dec << request->ParamDataSize(); + *m_output << ", PDL: " << std::dec << request->ParamDataSize(); } *m_output << endl; } else { @@ -282,7 +282,7 @@ void CommandPrinter::DisplayDiscoveryResponse( UID upper(param_data + UID::UID_SIZE); *m_output << ", (" << lower << ", " << upper << ")"; } else { - *m_output << ", pdl: " << response->ParamDataSize(); + *m_output << ", PDL: " << response->ParamDataSize(); } *m_output << endl; } else { @@ -314,8 +314,8 @@ void CommandPrinter::AppendUIDsAndType(const class RDMCommand *command, const char *message_type) { *m_output << command->SourceUID() << " -> " << command->DestinationUID() << " " << - message_type << ", sub-device: " << std::dec << command->SubDevice() << - ", tn: " << static_cast(command->TransactionNumber()); + message_type << ", Sub-Device: " << std::dec << command->SubDevice() << + ", TN: " << static_cast(command->TransactionNumber()); } @@ -393,7 +393,7 @@ void CommandPrinter::AppendPidString(const RDMCommand *command, if (descriptor) { *m_output << " (" << descriptor->Name() << ")"; } - *m_output << ", pdl: " << command->ParamDataSize() << endl; + *m_output << ", PDL: " << command->ParamDataSize() << endl; } diff --git a/common/rdm/RDMCommandTest.cpp b/common/rdm/RDMCommandTest.cpp index 8502431f8d..77d160f6ca 100644 --- a/common/rdm/RDMCommandTest.cpp +++ b/common/rdm/RDMCommandTest.cpp @@ -33,6 +33,7 @@ #include "ola/rdm/RDMCommand.h" #include "ola/rdm/RDMCommandSerializer.h" #include "ola/rdm/RDMEnums.h" +#include "ola/rdm/RDMPacket.h" #include "ola/rdm/UID.h" #include "ola/util/Utils.h" #include "ola/testing/TestUtils.h" @@ -58,7 +59,7 @@ using std::string; * Calculate a checksum for a packet and update it */ void UpdateChecksum(uint8_t *expected, unsigned int expected_length) { - unsigned int checksum = RDMCommand::START_CODE; + unsigned int checksum = ola::rdm::START_CODE; for (unsigned int i = 0 ; i < expected_length - 2; i++) { checksum += expected[i]; } @@ -68,7 +69,7 @@ void UpdateChecksum(uint8_t *expected, unsigned int expected_length) { } void UpdateChecksum(ByteString *data) { - unsigned int checksum = RDMCommand::START_CODE; + unsigned int checksum = ola::rdm::START_CODE; for (unsigned int i = 0 ; i < data->size() - 2; i++) { checksum += (*data)[i]; } diff --git a/common/rdm/StringMessageBuilder.cpp b/common/rdm/StringMessageBuilder.cpp index 66b5c9fe61..a724fa0a85 100644 --- a/common/rdm/StringMessageBuilder.cpp +++ b/common/rdm/StringMessageBuilder.cpp @@ -343,8 +343,12 @@ void StringMessageBuilder::VisitInt( if (descriptor->LookupLabel(input, &int_value) || ola::PrefixedHexStringToInt(input, &int_value) || ola::StringToInt(input, &int_value)) { - m_groups.top().push_back( - new ola::messaging::BasicMessageField(descriptor, int_value)); + if (descriptor->IsValid(int_value)) { + m_groups.top().push_back( + new ola::messaging::BasicMessageField(descriptor, int_value)); + } else { + SetError(descriptor->Name()); + } } else { SetError(descriptor->Name()); } diff --git a/common/rdm/StringMessageBuilderTest.cpp b/common/rdm/StringMessageBuilderTest.cpp index 8ed48fccf1..de09265147 100644 --- a/common/rdm/StringMessageBuilderTest.cpp +++ b/common/rdm/StringMessageBuilderTest.cpp @@ -57,6 +57,8 @@ class StringBuilderTest: public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(StringBuilderTest); CPPUNIT_TEST(testSimpleBuilder); CPPUNIT_TEST(testBuilderWithLabels); + CPPUNIT_TEST(testBuilderWithIntervals); + CPPUNIT_TEST(testBuilderWithLabelsAndIntervals); CPPUNIT_TEST(testBuilderWithGroups); CPPUNIT_TEST(testBuilderWithNestedGroups); CPPUNIT_TEST(testBuilderWithVariableNestedGroups); @@ -69,6 +71,8 @@ class StringBuilderTest: public CppUnit::TestFixture { public: void testSimpleBuilder(); void testBuilderWithLabels(); + void testBuilderWithIntervals(); + void testBuilderWithLabelsAndIntervals(); void testBuilderWithGroups(); void testBuilderWithNestedGroups(); void testBuilderWithVariableNestedGroups(); @@ -82,6 +86,8 @@ class StringBuilderTest: public CppUnit::TestFixture { const Message *BuildMessage(const Descriptor &descriptor, const vector &inputs); + const Message *BuildMessageSingleInput(const Descriptor &descriptor, + const string &input); }; @@ -97,12 +103,26 @@ const Message *StringBuilderTest::BuildMessage( const vector &inputs) { StringMessageBuilder builder; const Message *message = builder.GetMessage(inputs, &descriptor); - if (!message) + if (!message) { OLA_WARN << "Error with field: " << builder.GetError(); + } return message; } +/** + * Build a message from a single input and return the string representation + * of the message. + */ +const Message *StringBuilderTest::BuildMessageSingleInput( + const Descriptor &descriptor, + const string &input) { + vector inputs; + inputs.push_back(input); + return BuildMessage(descriptor, inputs); +} + + /** * Check the StringBuilder works. */ @@ -188,6 +208,123 @@ void StringBuilderTest::testBuilderWithLabels() { string expected = "uint8: dozen\n"; OLA_ASSERT_EQ(expected, m_printer.AsString(message.get())); + + // Test an invalid case + // setup the inputs + vector inputs2; + inputs2.push_back("half_dozen"); + auto_ptr message2(BuildMessage(descriptor, inputs2)); + + // verify + OLA_ASSERT_NULL(message2.get()); +} + + +/** + * Check the builder accepts intervals + */ +void StringBuilderTest::testBuilderWithIntervals() { + // build the descriptor + UInt8FieldDescriptor::IntervalVector intervals; + intervals.push_back(UInt16FieldDescriptor::Interval(2, 8)); + intervals.push_back(UInt16FieldDescriptor::Interval(12, 14)); + UInt8FieldDescriptor::LabeledValues labels; + + vector fields; + fields.push_back(new UInt8FieldDescriptor("uint8", intervals, labels)); + Descriptor descriptor("Test Descriptor", fields); + + auto_ptr message(BuildMessageSingleInput(descriptor, "2")); + + // verify + OLA_ASSERT_NOT_NULL(message.get()); + OLA_ASSERT_EQ(static_cast(fields.size()), + message->FieldCount()); + + string expected = "uint8: 2\n"; + OLA_ASSERT_EQ(expected, m_printer.AsString(message.get())); + + + // Test an invalid case + auto_ptr message2(BuildMessageSingleInput(descriptor, + "dozen")); + + // verify + OLA_ASSERT_NULL(message2.get()); + + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "0")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "1")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "2")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "8")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "9")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "11")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "12")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "13")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "14")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "15")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "255")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "65535")); + + // check labels + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "one")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "dozen")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "bakers_dozen")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "twenty")); +} + + +/** + * Check the builder accepts labels and intervals + */ +void StringBuilderTest::testBuilderWithLabelsAndIntervals() { + // build the descriptor + UInt8FieldDescriptor::IntervalVector intervals; + intervals.push_back(UInt16FieldDescriptor::Interval(2, 8)); + intervals.push_back(UInt16FieldDescriptor::Interval(12, 14)); + UInt8FieldDescriptor::LabeledValues labels; + labels["dozen"] = 12; + labels["bakers_dozen"] = 13; + + vector fields; + fields.push_back(new UInt8FieldDescriptor("uint8", intervals, labels)); + Descriptor descriptor("Test Descriptor", fields); + + auto_ptr message(BuildMessageSingleInput(descriptor, "dozen")); + + // verify + OLA_ASSERT_NOT_NULL(message.get()); + OLA_ASSERT_EQ(static_cast(fields.size()), + message->FieldCount()); + + string expected = "uint8: dozen\n"; + OLA_ASSERT_EQ(expected, m_printer.AsString(message.get())); + + + // Test an invalid case + auto_ptr message2(BuildMessageSingleInput(descriptor, + "half_dozen")); + + // verify + OLA_ASSERT_NULL(message2.get()); + + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "0")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "1")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "2")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "8")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "9")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "11")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "12")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "13")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "14")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "15")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "255")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "65535")); + + // check labels + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "one")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "dozen")); + OLA_ASSERT_NOT_NULL(BuildMessageSingleInput(descriptor, "bakers_dozen")); + OLA_ASSERT_NULL(BuildMessageSingleInput(descriptor, "twenty")); } diff --git a/data/rdm/manufacturer_pids.proto b/data/rdm/manufacturer_pids.proto index b9169a2ab8..f59398dba4 100644 --- a/data/rdm/manufacturer_pids.proto +++ b/data/rdm/manufacturer_pids.proto @@ -2495,6 +2495,132 @@ manufacturer { manufacturer { manufacturer_id: 17742 manufacturer_name: "ENTTEC Pty Ltd" + pid { + name: "AUTO_MODE" + value: 34559 + get_request { + } + get_response { + field { + type: UINT8 + name: "program" + range { + min: 0 + max: 9 + } + label { + value: 0 + label: "Disabled" + } + label { + value: 6 + label: "1 colour chase, 4 chans" + } + label { + value: 7 + label: "2 colour chase, 4 chans" + } + label { + value: 8 + label: "1 colour chase, 3 chans FW>=1.2" + } + } + field { + type: UINT8 + name: "speed" + range { + min: 0 + max: 9 + } + label { + value: 0 + label: "Fastest" + } + label { + value: 9 + label: "Slowest" + } + } + field { + type: UINT8 + name: "delay" + range { + min: 0 + max: 9 + } + label { + value: 0 + label: "Shortest" + } + label { + value: 9 + label: "Longest" + } + } + } + get_sub_device_range: ROOT_OR_SUBDEVICE + set_request { + field { + type: UINT8 + name: "program" + range { + min: 0 + max: 9 + } + label { + value: 0 + label: "Disabled" + } + label { + value: 6 + label: "1 colour chase, 4 chans" + } + label { + value: 7 + label: "2 colour chase, 4 chans" + } + label { + value: 8 + label: "1 colour chase, 3 chans FW>=1.2" + } + } + field { + type: UINT8 + name: "speed" + range { + min: 0 + max: 9 + } + label { + value: 0 + label: "Fastest" + } + label { + value: 9 + label: "Slowest" + } + } + field { + type: UINT8 + name: "delay" + range { + min: 0 + max: 9 + } + label { + value: 0 + label: "Shortest" + } + label { + value: 9 + label: "Longest" + } + } + } + set_response { + } + set_sub_device_range: ROOT_OR_ALL_SUBDEVICE + } pid { name: "PWM_OUTPUT_FREQUENCY" value: 32770 diff --git a/include/ola/messaging/Descriptor.h b/include/ola/messaging/Descriptor.h index ac59790859..faaf2a4f0e 100644 --- a/include/ola/messaging/Descriptor.h +++ b/include/ola/messaging/Descriptor.h @@ -281,11 +281,13 @@ typedef IntegerFieldDescriptor Int32FieldDescriptor; * * An example of this type of group would be: * + * @verbatim * +----------------+ * | bool (1) | * +----------------+ * | string (0, 32) | * +----------------+ + * @endverbatim * * This could hold data like: * (true, "foo"), @@ -299,11 +301,13 @@ typedef IntegerFieldDescriptor Int32FieldDescriptor; * * An example of this type of group would be: * + * @verbatim * +----------------+ * | bool (1) | * +----------------+ * | uint16 (2) | * +----------------+ + * @endverbatim * * This could hold data like: * (true, 1000), diff --git a/include/ola/rdm/RDMCommand.h b/include/ola/rdm/RDMCommand.h index 2062be6064..56d02dabd0 100644 --- a/include/ola/rdm/RDMCommand.h +++ b/include/ola/rdm/RDMCommand.h @@ -175,8 +175,9 @@ class RDMCommand { /** * @brief The RDM Start Code. + * @deprecated Use ola::rdm::START_CODE from RDMPacket.h instead (10 Mar 2019). */ - static const uint8_t START_CODE = 0xcc; + static const uint8_t START_CODE = ola::rdm::START_CODE; /** * @brief Extract a RDMCommand from raw data. diff --git a/libs/usb/JaRulePortHandleImpl.cpp b/libs/usb/JaRulePortHandleImpl.cpp index 088bcee554..a7387cec36 100644 --- a/libs/usb/JaRulePortHandleImpl.cpp +++ b/libs/usb/JaRulePortHandleImpl.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -346,7 +347,7 @@ ola::rdm::RDMResponse* JaRulePortHandleImpl::UnpackRDMResponse( const RDMRequest *request, const ByteString &payload, ola::rdm::RDMStatusCode *status_code) { - if (payload.empty() || payload[0] != RDMCommand::START_CODE) { + if (payload.empty() || payload[0] != ola::rdm::START_CODE) { *status_code = rdm::RDM_INVALID_RESPONSE; return NULL; } diff --git a/plugins/usbpro/ArduinoWidgetTest.cpp b/plugins/usbpro/ArduinoWidgetTest.cpp index e7c6e7150e..9d945ddb47 100644 --- a/plugins/usbpro/ArduinoWidgetTest.cpp +++ b/plugins/usbpro/ArduinoWidgetTest.cpp @@ -28,6 +28,7 @@ #include "ola/Callback.h" #include "ola/Logging.h" #include "ola/rdm/RDMCommandSerializer.h" +#include "ola/rdm/RDMPacket.h" #include "plugins/usbpro/ArduinoWidget.h" #include "plugins/usbpro/CommonWidgetTest.h" #include "ola/testing/TestUtils.h" @@ -203,7 +204,7 @@ uint8_t *ArduinoWidgetTest::PackRDMRequest(const RDMRequest *request, unsigned int *size) { unsigned int request_size = RDMCommandSerializer::RequiredSize(*request); uint8_t rdm_data[request_size + 1]; - rdm_data[0] = ola::rdm::RDMCommand::START_CODE; + rdm_data[0] = ola::rdm::START_CODE; OLA_ASSERT(RDMCommandSerializer::Pack(*request, rdm_data + 1, &request_size)); uint8_t *frame = BuildUsbProMessage(RDM_REQUEST_LABEL, rdm_data, @@ -221,7 +222,7 @@ uint8_t *ArduinoWidgetTest::PackRDMResponse(const RDMResponse *response, unsigned int response_size = RDMCommandSerializer::RequiredSize(*response); uint8_t rdm_data[response_size + 2]; rdm_data[0] = ola::rdm::RDM_COMPLETED_OK; - rdm_data[1] = ola::rdm::RDMCommand::START_CODE; + rdm_data[1] = ola::rdm::START_CODE; OLA_ASSERT( RDMCommandSerializer::Pack(*response, rdm_data + 2, &response_size)); uint8_t *frame = BuildUsbProMessage(RDM_REQUEST_LABEL, @@ -382,7 +383,7 @@ void ArduinoWidgetTest::testErrorCodes() { response_size = RDMCommandSerializer::RequiredSize(*response); uint8_t rdm_data[response_size + 2]; rdm_data[0] = ola::rdm::RDM_COMPLETED_OK; - rdm_data[1] = ola::rdm::RDMCommand::START_CODE; + rdm_data[1] = ola::rdm::START_CODE; OLA_ASSERT( RDMCommandSerializer::Pack(*response, rdm_data + 2, &response_size)); response_frame = BuildUsbProMessage( diff --git a/plugins/usbpro/DmxterWidgetTest.cpp b/plugins/usbpro/DmxterWidgetTest.cpp index b327d59425..72d5754fac 100644 --- a/plugins/usbpro/DmxterWidgetTest.cpp +++ b/plugins/usbpro/DmxterWidgetTest.cpp @@ -29,6 +29,7 @@ #include "ola/Logging.h" #include "ola/base/Array.h" #include "ola/rdm/RDMCommandSerializer.h" +#include "ola/rdm/RDMPacket.h" #include "plugins/usbpro/DmxterWidget.h" #include "plugins/usbpro/CommonWidgetTest.h" #include "ola/testing/TestUtils.h" @@ -343,7 +344,7 @@ void DmxterWidgetTest::testSendRDMMute() { uint8_t *response_frame = new uint8_t[response_size + 3]; response_frame[0] = 0; // version response_frame[1] = 14; // status ok - response_frame[2] = ola::rdm::RDMCommand::START_CODE; + response_frame[2] = ola::rdm::START_CODE; memset(&response_frame[3], 0, response_size); OLA_ASSERT(RDMCommandSerializer::Pack(*response, &response_frame[3], &response_size)); diff --git a/plugins/usbpro/EnttecUsbProWidgetTest.cpp b/plugins/usbpro/EnttecUsbProWidgetTest.cpp index 3c750722fe..415cadf7a1 100644 --- a/plugins/usbpro/EnttecUsbProWidgetTest.cpp +++ b/plugins/usbpro/EnttecUsbProWidgetTest.cpp @@ -29,6 +29,7 @@ #include "ola/Logging.h" #include "ola/base/Array.h" #include "ola/rdm/RDMCommandSerializer.h" +#include "ola/rdm/RDMPacket.h" #include "ola/rdm/UID.h" #include "ola/testing/TestUtils.h" #include "plugins/usbpro/CommonWidgetTest.h" @@ -178,7 +179,7 @@ uint8_t *EnttecUsbProWidgetTest::PackRDMRequest(const RDMRequest *request, unsigned int *size) { unsigned int request_size = RDMCommandSerializer::RequiredSize(*request); uint8_t *rdm_data = new uint8_t[request_size + 1]; - rdm_data[0] = ola::rdm::RDMCommand::START_CODE; + rdm_data[0] = ola::rdm::START_CODE; memset(&rdm_data[1], 0, request_size); OLA_ASSERT(RDMCommandSerializer::Pack(*request, &rdm_data[1], &request_size)); *size = request_size + 1; @@ -194,7 +195,7 @@ uint8_t *EnttecUsbProWidgetTest::PackRDMResponse(const RDMResponse *response, unsigned int response_size = RDMCommandSerializer::RequiredSize(*response); uint8_t *rdm_data = new uint8_t[response_size + 2]; rdm_data[0] = 0; // status ok - rdm_data[1] = ola::rdm::RDMCommand::START_CODE; + rdm_data[1] = ola::rdm::START_CODE; memset(&rdm_data[2], 0, response_size); OLA_ASSERT(RDMCommandSerializer::Pack(*response, &rdm_data[2], &response_size)); @@ -732,7 +733,7 @@ void EnttecUsbProWidgetTest::testMuteDevice() { // TODO(simon): make this better uint8_t mute_response_frame[] = { 0, - ola::rdm::RDMCommand::START_CODE, + ola::rdm::START_CODE, 0}; // add the expected response, send and verify diff --git a/tools/ja-rule/ja-rule.cpp b/tools/ja-rule/ja-rule.cpp index be24172ee1..9f478db4d6 100644 --- a/tools/ja-rule/ja-rule.cpp +++ b/tools/ja-rule/ja-rule.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -396,7 +397,7 @@ class Controller { return; } - if (payload[0] == RDMCommand::START_CODE) { + if (payload[0] == ola::rdm::START_CODE) { RDMStatusCode status_code; // Skip over the start code. auto_ptr response(RDMResponse::InflateFromData( diff --git a/tools/logic/logic-rdm-sniffer.cpp b/tools/logic/logic-rdm-sniffer.cpp index 6dc24695da..3319586162 100644 --- a/tools/logic/logic-rdm-sniffer.cpp +++ b/tools/logic/logic-rdm-sniffer.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -225,10 +226,10 @@ void LogicReader::FrameReceived(const uint8_t *data, unsigned int length) { } switch (data[0]) { - case 0: + case ola::DMX512_START_CODE: DisplayDMXFrame(data + 1, length - 1); break; - case RDMCommand::START_CODE: + case ola::rdm::START_CODE: DisplayRDMFrame(data + 1, length - 1); break; default: diff --git a/tools/ola_trigger/Action.h b/tools/ola_trigger/Action.h index 9795e62d70..ff4ac93143 100644 --- a/tools/ola_trigger/Action.h +++ b/tools/ola_trigger/Action.h @@ -103,8 +103,7 @@ class CommandAction: public Action { /** - * @brief An interval of DMX values and then action to be taken for matching - * values. + * @brief An interval of DMX values */ class ValueInterval { public: @@ -175,6 +174,10 @@ class Slot { uint8_t m_old_value; bool m_old_value_defined; + /** + * @brief An interval of DMX values and the action to be taken for matching + * values. + */ class ActionInterval { public: ActionInterval(const ValueInterval *interval, diff --git a/tools/rdm/ResponderTest.py b/tools/rdm/ResponderTest.py index 30803cfbe3..4ed059bd3d 100644 --- a/tools/rdm/ResponderTest.py +++ b/tools/rdm/ResponderTest.py @@ -255,7 +255,7 @@ def __init__(self, self._broadcast_write_delay_s = broadcast_write_delay / 1000.0 self._timing_stats = timing_stats - # This is set to the tuple of (sub_device, command_class, pid) when we sent + # This is set to the tuple of (sub_device, command_class, pid) when we send # a message. It's used to identify the response if we get an ACK_TIMER and # use QUEUED_MESSAGEs self._outstanding_request = None @@ -591,12 +591,17 @@ def _HandleQueuedResponse(self, response, unpacked_data, unpack_exception): self.Stop() return elif (response.pid == status_messages_pid.value and + response.response_type != OlaClient.RDM_NACK_REASON and unpacked_data.get('messages', None) == []): # This means we've run out of messages if self._state == TestState.NOT_RUN: self.SetFailed('ACK_TIMER issued but the response was never queued') self.Stop() return + elif (response.pid == status_messages_pid.value and + response.response_type == OlaClient.RDM_NACK_REASON): + self.LogDebug('Status message returned nack, fetching next message: %s' + % response.nack_reason) # Otherwise fetch the next one self._GetQueuedMessage() diff --git a/tools/rdmpro/rdm-sniffer.cpp b/tools/rdmpro/rdm-sniffer.cpp index 77b58e7dae..62ff56e609 100644 --- a/tools/rdmpro/rdm-sniffer.cpp +++ b/tools/rdmpro/rdm-sniffer.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -305,7 +306,7 @@ void RDMSniffer::ProcessFrame() { DisplayDmxFrame(); } break; - case RDMCommand::START_CODE: + case ola::rdm::START_CODE: DisplayRDMFrame(); break; default: