-
-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use QSerialPortInfo to detect presence of a serial port (fix #836) #837
use QSerialPortInfo to detect presence of a serial port (fix #836) #837
Conversation
…-project#836) * checking for existence of device file does not work on windows * instead: construct QSerialPortInfo from device name and check, if it is not null When constructing QSerialPortInfo from device name, this constructor finds the relevant serial port among the available ones according to the port name name, and constructs the serial port info instance for that port. (https://doc.qt.io/qt-5/qserialportinfo.html#QSerialPortInfo-2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Heiko
Thanks for highlighting the difference between Linux and Windows, as well as the suggested solution.
Nevertheless, could you do me a favor and set the device in error with a failure text, if the device name is invalid, please?
i.e.
if (!serialPortInfo.isNull())
{
...
}
else
{
QString errortext = QString("Invalid serial device name: [%1]!").arg(_deviceName);
this->setInError(errortext);
_preOpenDelayTimeOut = QDateTime::currentMSecsSinceEpoch() + _preOpenDelay;
return false;
}
Otherwise a user would wonder, why e.g. a non existing COM5 device is not working.
Thank you!
Here is your new link to your workflow artifacts. |
@heikobihr Thanks for the update. I am currently in the process refactoring the Led-Devices's code which included the Rs232 one. As it seems you have a serial device running with windows, would you mind testing my development branch from a Windows/Rs232 perspective? Many thanks in advance! |
@Lord-Grey |
I would like it if the available serial devices were transferred to the JsonAPI. With this one could create a drop down field in the WebUI and select connected devices. Examples can be found in the V4L2 Grabber. |
@Paulchen-Panther This is already available as part of my LedDevice Refactor Branch. |
@Lord-Grey |
Thank you for contribution and testing. |
Summary
ProviderRs232: checking for existence of device file does not work on windows.
instead: construct QSerialPortInfo from device name and check, if it is not null.
When constructing QSerialPortInfo from device name, this constructor finds the
relevant serial port among the available ones according to the port name name,
and constructs the serial port info instance for that port.
(https://doc.qt.io/qt-5/qserialportinfo.html#QSerialPortInfo-2)
Fixes: #836
What kind of change does this PR introduce? (check at least one)
If changing the UI of web configuration, please provide the before/after screenshot:
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing setups:
The PR fulfills these requirements:
Fixes: #xxx[,#xxx]
, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.
Other information: