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> wdgts;
// evaluate all system serial ports
const auto ports = QSerialPortInfo::availablePorts();
for (const QSerialPortInfo &port : ports) {
auto widget = new DmxWidget();
widget->setPort(port);
widget->open();
if (widget->isConnected())
{
WidgetInfo wdgt;
wdgt.serialNo = widget->serialNumber();
wdgt.port = port;
wdgts.push_back(wdgt);
}
delete widget;
// try to open a widget on each port
auto widget = new DmxWidget();
widget->setPort(port);
widget->open();
if (widget->isConnected())
{
// add ports with valid widgets to the list
WidgetInfo wdgt;
wdgt.serialNo = widget->serialNumber();
wdgt.fwVersion = widget->firmwareVersion();
wdgt.port = port;
wdgts.push_back(wdgt);
}
delete widget;
}
return wdgts;
}

View File

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