include the fw version in widget info struct

This commit is contained in:
Kevin Matz 2023-04-06 19:55:08 -04:00
parent c12044326f
commit 3ab0c1141c
2 changed files with 16 additions and 11 deletions

View File

@ -60,19 +60,23 @@ void DmxWidget::close()
QList<WidgetInfo> DmxWidget::availableWidgets() QList<WidgetInfo> DmxWidget::availableWidgets()
{ {
QList<WidgetInfo> wdgts; QList<WidgetInfo> wdgts;
// evaluate all system serial ports
const auto ports = QSerialPortInfo::availablePorts(); const auto ports = QSerialPortInfo::availablePorts();
for (const QSerialPortInfo &port : ports) { for (const QSerialPortInfo &port : ports) {
auto widget = new DmxWidget(); // try to open a widget on each port
widget->setPort(port); auto widget = new DmxWidget();
widget->open(); widget->setPort(port);
if (widget->isConnected()) widget->open();
{ if (widget->isConnected())
WidgetInfo wdgt; {
wdgt.serialNo = widget->serialNumber(); // add ports with valid widgets to the list
wdgt.port = port; WidgetInfo wdgt;
wdgts.push_back(wdgt); wdgt.serialNo = widget->serialNumber();
} wdgt.fwVersion = widget->firmwareVersion();
delete widget; wdgt.port = port;
wdgts.push_back(wdgt);
}
delete widget;
} }
return wdgts; return wdgts;
} }

View File

@ -39,6 +39,7 @@ using ENTTEC::Pro::DMX_RX_MODE;
struct WidgetInfo struct WidgetInfo
{ {
uint32_t serialNo; uint32_t serialNo;
uint16_t fwVersion;
QSerialPortInfo port; QSerialPortInfo port;
}; };