summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorSergey Belyashov <Sergey.Belyashov@gmail.com>2011-07-03 22:26:43 +0400
committerSergey Belyashov <Sergey.Belyashov@gmail.com>2011-07-03 22:26:43 +0400
commit1e513e9e5ca12f8759cef80cc963b38b6725ed19 (patch)
tree2ea98672efd12486fcce3f2d7d95e41473b4cec1 /examples
parentd7fb55ca4907e7617f3269d5246c8d11cb442d8f (diff)
consoleportinfo is not test it is simple example
Diffstat (limited to 'examples')
-rw-r--r--examples/consoleportinfo/consoleportinfo.pro35
-rw-r--r--examples/consoleportinfo/main.cpp22
-rw-r--r--examples/examples.pro2
3 files changed, 59 insertions, 0 deletions
diff --git a/examples/consoleportinfo/consoleportinfo.pro b/examples/consoleportinfo/consoleportinfo.pro
new file mode 100644
index 00000000..d0087aad
--- /dev/null
+++ b/examples/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/examples/consoleportinfo/main.cpp b/examples/consoleportinfo/main.cpp
new file mode 100644
index 00000000..c1a3d564
--- /dev/null
+++ b/examples/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();
+}
diff --git a/examples/examples.pro b/examples/examples.pro
new file mode 100644
index 00000000..43c38e28
--- /dev/null
+++ b/examples/examples.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS += consoleportinfo