diff options
author | Denis Shienkov <scapig2@yandex.ru> | 2011-06-25 13:37:47 +0400 |
---|---|---|
committer | Denis Shienkov <scapig2@yandex.ru> | 2011-06-25 13:37:47 +0400 |
commit | a0dd6d72373477361f000b2b67022ee2717486fd (patch) | |
tree | 36450fb6df7c6a4ffef09ec6a9dbb62bd60c6fa2 /tests | |
parent | 412f40b45f5d6d48e164160e8c918e3adbcc75eb (diff) |
Added console test application for demonstrate work class SerialPortInfo.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/consoleportinfo/consoleportinfo.pro | 35 | ||||
-rw-r--r-- | tests/consoleportinfo/main.cpp | 22 |
2 files changed, 57 insertions, 0 deletions
diff --git a/tests/consoleportinfo/consoleportinfo.pro b/tests/consoleportinfo/consoleportinfo.pro new file mode 100644 index 00000000..d0087aad --- /dev/null +++ b/tests/consoleportinfo/consoleportinfo.pro @@ -0,0 +1,35 @@ +TEMPLATE = app +CONFIG += console +QT -= gui +OBJECTS_DIR = obj +MOC_DIR = moc + +INCLUDEPATH += \ + ../../include \ + ../../src + +HEADERS += \ + ../../include/serialport.h \ + ../../include/serialportinfo.h + +SOURCES += main.cpp + +include(../../src/src.pri) + +CONFIG(debug, debug|release) { + DESTDIR = debug + TARGET = consoleinfod +} else { + DESTDIR = release + TARGET = consoleinfo +} + +win32 { + LIBS += -lsetupapi -luuid -ladvapi32 +} +unix:!macx { + LIBS += -ludev +} +macx { + LIBS += -framework IOKit -framework CoreFoundation +} diff --git a/tests/consoleportinfo/main.cpp b/tests/consoleportinfo/main.cpp new file mode 100644 index 00000000..c1a3d564 --- /dev/null +++ b/tests/consoleportinfo/main.cpp @@ -0,0 +1,22 @@ +#include <QtCore/QCoreApplication> +#include <QtCore/QStringList> +#include <QtCore/QDebug> + +#include "serialportinfo.h" + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + + QList<SerialPortInfo> list = SerialPortInfo::availablePorts(); + int item = 0; + foreach(SerialPortInfo info, list) { + qDebug() << "--> Item: " << item++; + qDebug() << "Port name : " << info.portName(); + qDebug() << "Port location : " << info.systemLocation(); + qDebug() << "Port description : " << info.description(); + qDebug() << "Port manufacturer: " << info.manufacturer(); + } + + return a.exec(); +} |