Home · All Classes · |
QextSerialPort provides an interface to old fashioned serial ports for Qt-based applications. It currently supports Mac OS X, Windows, Linux, FreeBSD.
From QextSerialPort 1.2-beta on, license of the project has been changed to MIT.
This simplest way to play with this library is using Qt Creator. You can open the toplevel qextserialport.pro with Qt Creator, or open other xxxx.pro seperately.
The package contains a qextserialport.pri file that allows you to integrate the component into programs that use qmake for the build step.
All you need is adding following line to your qmake's project file:
include(pathToPri/qextserialport.pri)
Then, using QextSerialPort in your code
#include "qextserialport.h" ... MyClass::MyClass() { port = new QextSerialPort("COM1"); connect(port, SIGNAL(readyRead()), this, SLOT(onDataAvailable())); port->open(); } void MyClass::onDataAvailable() { QByteArray data = port->readAll(); processNewData(usbdata); }
Although QextSerialPort can be directly compiled into your application, You may prefer to use QextSerailPort as an library, which is very easy too.
1. Download the source code, and put it in any location you like.
2. Goto qextserialport/buildlib, and run following command to generate library. (Yes, config.pri is not needed.)
qmake make (or nmake) sudo make install (or nmake install)
3. Add following line to your project's file
CONFIG += extserialport
4. Using QextSerialPort in your code. Enjoy it!
#include "qextserialport.h" .... QextSerialPort * port = new QextSerialPort(); ....
Although QextSerialPort can be directly compiled into your application, You may prefer to use QextSerailPort as an library, which is very easy too.
1. Write a config.pri file.(read config_example.pri for reference):
2. Changed to subdirectory 'buildlib', run
qmake make
shared or static library will be generated.
3. Add following line to your qmake project file:
include(pathToPri/qextserialport.pri)
Run qdoc3 from the doc directory.
qdoc3 qextserialport.qdocconf
Note: qdoc3 has been renamed to qdoc under Qt5.
Run following commands at toplevel directory
qmake make
or simply open the qextserialport.pro using Qt Creator.
Copyright © 2000-2012 | QextSerialPort Project | QextSerialPort Manual |