From 4c0bf5ded8ce1958386a9369ed8aea31e5a28284 Mon Sep 17 00:00:00 2001 From: Kevin Matz Date: Sun, 9 Apr 2023 20:06:43 -0400 Subject: [PATCH] use the MessageData creator to instantiate the correct specialized type --- platform/qt/dmxwidget/dmxwidget.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/platform/qt/dmxwidget/dmxwidget.cpp b/platform/qt/dmxwidget/dmxwidget.cpp index fba5ab8..b1e35a6 100644 --- a/platform/qt/dmxwidget/dmxwidget.cpp +++ b/platform/qt/dmxwidget/dmxwidget.cpp @@ -63,6 +63,17 @@ void DmxWidget::close() */ void DmxWidget::parseMessageBuffer() { + OperatingMode other_side = USBunknown; + switch (usb_mode) { + case ENTTEC::Widget::USBdevice: + other_side = USBhost; + break; + case ENTTEC::Widget::USBhost: + other_side = USBdevice; + break; + default: + break; + } uint16_t length; const int fixed_length = 5; // start + label + 2xlength + end auto fast_forward = [this](int offset = 0) { @@ -90,7 +101,7 @@ void DmxWidget::parseMessageBuffer() continue; } // make a new message data - auto msg = std::make_shared((uint8_t)message_rx_buffer_[1]); + auto msg = MessageDataFactory((MESSAGE_LABEL)message_rx_buffer_[1], other_side); // fill it with data std::shared_ptr stream(new bufferstream( reinterpret_cast(message_rx_buffer_.data())+fixed_length-1,