Serial port number in windows
-
Looks like an interesting project. If anything, it shows that Windows is a bit of a mess if you need to try 9 ways to actually get all the serial ports. If it is hard to use with MinGw, then why not use it with MSVC instead? You could make it a small, separate process that just communicates the data to your main application when needed. You can use any IPC mechanism you want for that, including just outputting the data over the stdout and reading that with QProcess.
Still, you could try and see if the simple way of reading out the registry would be enough in your case? You can use QSettings for that...
-
You can do with QextSerialPort. Example code:
@QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
qDebug() << "SerialSettings::LoadPorts(): List of ports availables:\n";
for (int i = 0; i < ports.size(); i++) {
qDebug() << "port name: " << ports.at(i).portName;
qDebug() << "friendly name: " << ports.at(i).friendName;
qDebug() << "physical name: " << ports.at(i).physName;
qDebug() << "enumerator name: " << ports.at(i).enumName;
qDebug() << "===================================";
}
@ -
What is it?!?
When this function was added to the project?!?
QextSerialEnumerator?!? QextPortInfo?!?[quote author="gronerth" date="1293126666"]You can do with QextSerialPort. Example code:
@QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
qDebug() << "SerialSettings::LoadPorts(): List of ports availables:\n";
for (int i = 0; i < ports.size(); i++) {
qDebug() << "port name: " << ports.at(i).portName;
qDebug() << "friendly name: " << ports.at(i).friendName;
qDebug() << "physical name: " << ports.at(i).physName;
qDebug() << "enumerator name: " << ports.at(i).enumName;
qDebug() << "===================================";
}
@[/quote] -
This methods of this library: "QExtSerialPort":http://qextserialport.sourceforge.net/
-
It might just be me, but I don't see the classes mentioned in the code fragment in the documentation linked from the page you give. I am looking at http://qextserialport.sourceforge.net/qextserialport-1.1.x/
Is this new API? Newer than the latest API docs on the webpage?
-
This API is very strange!
Look this "http://code.google.com/p/qextserialport/source/browse/#hg/src":http://code.google.com/p/qextserialport/source/browse/#hg/src
-
The api version that i have downloaded is: qextserialport-1.2win-alpha (win version), you can download from here: http://sourceforge.net/projects/qextserialport/files/qextserialport alpha/
-
This is a new alpha API, that include enumerator :) Great news!
[quote author="gronerth" date="1293458810"]The api version that i have downloaded is: qextserialport-1.2win-alpha (win version), you can download from here: http://sourceforge.net/projects/qextserialport/files/qextserialport alpha/
[/quote]
-
Yes, i use the old api in static mode, this api is writing for build shared library, look the macro
@define QEXTSERIALPORT_EXPORT Q_DECL_EXPORT
@ in the code
[quote author="gronerth" date="1293461425"]Well, i have worked with that api, using the dlls, do you mean that u need to link statically?[/quote]
-
Where is that definition?, i have never tried to link statically, but in the "qextserialport.pro" there is a line that says: #CONFIG += staticlib, have you tried to uncomment it?, and then compile it again( qmake, make)....
-
Yes, but many error give to me.
That line is in the class QextSerialEnumerator
@
class QEXTSERIALPORT_EXPORT QextSerialEnumerator : public QObject@[quote author="gronerth" date="1293463915"]Where is that definition?, i have never tried to link statically, but in the "qextserialport.pro" there is a line that says: #CONFIG += staticlib, have you tried to uncomment it?, and then compile it again( qmake, make)....[/quote]
-
mmm Maybe i have a differente version, because the QextSerialEnumerator doenst inherit from QObject:
@/*!
- Serial port enumerator. This class provides list of ports available in the system.
- Windows implementation is based on Zach Gorman's work from
- <a href="http://www.codeproject.com">The Code Project</a> (http://www.codeproject.com/system/setupdi.asp).
*/
class QextSerialEnumerator
@
-
@
\section Credits
Windows implementation is based on Zach Gorman's work from
<a href="http://www.codeproject.com">The Code Project</a> (http://www.codeproject.com/system/setupdi.asp).OS X implementation, see
http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/AH_Finding_Devices/chapter_4_section_2.html\author Michal Policht, Liam Staskawicz
*/
class QEXTSERIALPORT_EXPORT QextSerialEnumerator : public QObject
@What version do you have of the library ?
[quote author="gronerth" date="1293464466"]mmm Maybe i have a differente version, because the QextSerialEnumerator doenst inherit from QObject:@/*!
- Serial port enumerator. This class provides list of ports available in the system.
- Windows implementation is based on Zach Gorman's work from
- <a href="http://www.codeproject.com">The Code Project</a> (http://www.codeproject.com/system/setupdi.asp).
*/
class QextSerialEnumerator
@
[/quote]
-
The same of me, but you download it from sourceforge, me from googlecode.
Now i trying your lib, this not build a dll but the code you post don't display any port.
The same code work well in googlecode library with a dll.[quote author="gronerth" date="1293466419"]Version: qextserialport-1.2win-alpha, but i have downloaded many months ago (beggining of 2010).[/quote]