
QSerialDevice
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
So, announces release: QSerialDevice 2.0
QSerialDevice – cross-platform library for serial devices based on Qt4.
Release 2.0 will be the last for the library QSerialDevice.
Recently the project (2.0 branch) has been accepted into Qt as an addon (renamed to QtSerialPort), therefore, the current Gitorious repository is no longer used, and his development frozen. Ie do not send more here merge requests, etc., his repository works only in r/o mode.
The new repository is now available here (only available to registered developers):
git clone ssh://codereview.qt-project.org:29418/playground/qtserialport.git
More see: http://qt-project.org/wiki/QtSerialPort
In the future, after the stabilization of the code will create a public repository QtSerialPort, which is an addon for Qt (LGPL + commercial).
Version history:
v 0.4.0 (Outdated)
v 0.3.0 (Outdated)
v 0.2.0 (Outdated)
v 0.1.0 (Outdated)
9 years ago
More changes.
9 years ago
More changes.
woodywoodpecker
9 years ago
Report
kuzulis
9 years ago
Report
woodywoodpecker
9 years ago
Report
woodywoodpecker
9 years ago
Report
kuzulis
9 years ago
Report
Krozac
10 years ago
thank you very much for share this lib ;)
I have a problem when I try to compile under linux with arm-gcc:
arm-linux-g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/QtEmbedded-4.7.2-arm/mkspecs/qws/linux-arm-g++ -I. -I/usr/local/Trolltech/QtEmbedded-4.7.2-arm/$
In file included from ./windef.h:253,
from ./ddk/ntddk.h:44,
from ./ddk/ntddser.h:34,
from nativeserialengine_win.cpp:27:
./winnt.h:2377:2: error: #error "undefined processor type"
In file included from /usr/local/Trolltech/QtEmbedded-4.7.2-arm/include/QtCore/qbytearray.h:48,
from /usr/local/Trolltech/QtEmbedded-4.7.2-arm/include/QtCore/qstring.h:46,
from /usr/local/Trolltech/QtEmbedded-4.7.2-arm/include/QtCore/qobject.h:48,
from /usr/local/Trolltech/QtEmbedded-4.7.2-arm/include/QtCore/QObject:1,
from abstractserialengine.h:27,
from nativeserialengine.h:27,
from nativeserialengine_p.h:4,
from nativeserialengine_win.cpp:24:
./string.h:36: warning: '__cdecl__' attribute directive ignored
./string.h:37: warning: '__cdecl__' attribute directive ignored
./string.h:38: warning: '__cdecl__' attribute directive ignored
./string.h:39: warning: '__cdecl__' attribute directive ignored
./string.h:40: warning: '__cdecl__' attribute directive ignored
./string.h:41: warning: '__cdecl__' attribute directive ignored
./string.h:42: warning: '__cdecl__' attribute directive ignored
./string.h:43: warning: '__cdecl__' attribute directive ignored
I copied the dir include from mingw to compile until here.
Have any suggestion to compile it?
I don't need the windows support.ù
It is available a qserialdevice with only support for linux?
Best regards,
Krozac
Report
kuzulis
10 years ago
Try to remove it from *. pri / *. pro files, everything related to ** _win.
I (and others) in such a PC with Linux is compiled without any problems.
I did not use Embedded ARM so I can not help you.
Report
Krozac
10 years ago
Thank you very much.
I have to remove all lines with *win* from .pri and .pro AND delete all files named *win*.
Now I can compile test1.pro but when I try to compile guiapp2.pro I have this error:
arm-linux-g++ -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/QtEmbedded-4.7.2-arm/lib -o guiapp2 infowidget.o main.o mainwidget.o optionswidget.o tracewidget.o serialdeviceenumerator.o abstractserial.o moc_infowidget.o moc_mainwidget.o moc_optionswidget.o moc_tracewidget.o moc_abstractserial.o -L/usr/local/Trolltech/QtEmbedded-4.7.2-arm/lib -lQtGui -L/usr/local/Trolltech/QtEmbedded-4.7.2-arm/lib -lQtNetwork -lQtCore -lpthread
moc_abstractserial.o: In function `AbstractSerial::metaObject() const':
moc_abstractserial.cpp:(.text+0x0): multiple definition of `AbstractSerial::metaObject() const'
abstractserial.o:abstractserial.cpp:(.text+0x178): first defined here
moc_abstractserial.o: In function `AbstractSerial::ringChanged(bool)':
moc_abstractserial.cpp:(.text+0x1c): multiple definition of `AbstractSerial::ringChanged(bool)'
abstractserial.o:abstractserial.cpp:(.text+0x194): first defined here
moc_abstractserial.o: In function `AbstractSerial::dsrChanged(bool)':
moc_abstractserial.cpp:(.text+0x58): multiple definition of `AbstractSerial::dsrChanged(bool)'
abstractserial.o:abstractserial.cpp:(.text+0x1d0): first defined here
moc_abstractserial.o: In function `AbstractSerial::ctsChanged(bool)':
moc_abstractserial.cpp:(.text+0x94): multiple definition of `AbstractSerial::ctsChanged(bool)'
abstractserial.o:abstractserial.cpp:(.text+0x20c): first defined here
moc_abstractserial.o: In function `AbstractSerial::exception()':
moc_abstractserial.cpp:(.text+0xd0): multiple definition of `AbstractSerial::exception()'
abstractserial.o:abstractserial.cpp:(.text+0x2f4): first defined here
moc_abstractserial.o: In function `AbstractSerial::signalStatus(QString const&, QDateTime)':
moc_abstractserial.cpp:(.text+0xf0): multiple definition of `AbstractSerial::signalStatus(QString const&, QDateTime)'
abstractserial.o:abstractserial.cpp:(.text+0x32c): first defined here
moc_abstractserial.o: In function `AbstractSerial::qt_metacall(QMetaObject::Call, int, void**)':
moc_abstractserial.cpp:(.text+0x128): multiple definition of `AbstractSerial::qt_metacall(QMetaObject::Call, int, void**)'
abstractserial.o:abstractserial.cpp:(.text+0x364): first defined here
moc_abstractserial.o: In function `AbstractSerial::qt_metacast(char const*)':
moc_abstractserial.cpp:(.text+0x21c): multiple definition of `AbstractSerial::qt_metacast(char const*)'
abstractserial.o:abstractserial.cpp:(.text+0x458): first defined here
moc_abstractserial.o:(.rodata+0x0): multiple definition of `AbstractSerial::staticMetaObject'
abstractserial.o:(.rodata+0x0): first defined here
moc_abstractserial.o:(.rodata+0x98): multiple definition of `vtable for AbstractSerial'
abstractserial.o:(.rodata+0x148): first defined here
moc_abstractserial.o:(.rodata+0x110): multiple definition of `typeinfo name for AbstractSerial'
abstractserial.o:(.rodata+0x1e4): first defined here
moc_abstractserial.o:(.rodata+0x124): multiple definition of `typeinfo for AbstractSerial'
abstractserial.o:(.rodata+0x1f8): first defined here
serialdeviceenumerator.o: In function `SerialDeviceEnumerator::qt_metacall(QMetaObject::Call, int, void**)':
serialdeviceenumerator.cpp:(.text+0xa4): undefined reference to `SerialDeviceEnumeratorPrivate::_q_processWatcher()'
serialdeviceenumerator.o: In function `SerialDeviceEnumerator::isBusy() const':
serialdeviceenumerator.cpp:(.text+0xf8): undefined reference to `SerialDeviceEnumeratorPrivate::nativeIsBusy() const'
serialdeviceenumerator.o: In function `SerialDeviceEnumerator::isEnabled() const':
serialdeviceenumerator.cpp:(.text+0x10c): undefined reference to `SerialDeviceEnumeratorPrivate::isEnabled() const'
serialdeviceenumerator.o: In function `SerialDeviceEnumerator::setEnabled(bool)':
serialdeviceenumerator.cpp:(.text+0x120): undefined reference to `SerialDeviceEnumeratorPrivate::setEnabled(bool)'
serialdeviceenumerator.o: In function `SerialDeviceEnumerator::SerialDeviceEnumerator(QObject*)':
serialdeviceenumerator.cpp:(.text+0x25c): undefined reference to `SerialDeviceEnumeratorPrivate::SerialDeviceEnumeratorPrivate()'
serialdeviceenumerator.o: In function `SerialDeviceEnumerator::SerialDeviceEnumerator(QObject*)':
serialdeviceenumerator.cpp:(.text+0x2bc): undefined reference to `SerialDeviceEnumeratorPrivate::SerialDeviceEnumeratorPrivate()'
abstractserial.o: In function `AbstractSerial::setDeviceName(QString const&)':
abstractserial.cpp:(.text+0x520): undefined reference to `AbstractSerialEngine::setDeviceName(QString const&)'
abstractserial.o: In function `AbstractSerialPrivate::initSerialLayer()':
abstractserial.cpp:(.text+0x540): undefined reference to `AbstractSerialEngine::createSerialEngine(QObject*)'
abstractserial.cpp:(.text+0x558): undefined reference to `AbstractSerialEngine::setReceiver(AbstractSerialEngineReceiver*)'
abstractserial.o: In function `AbstractSerial::baudRate(QFlags<AbstractSerial::BaudRateDirectionFlag>) const':
abstractserial.cpp:(.text+0x2cf8): undefined reference to `AbstractSerialEngine::baudRate(QFlags<AbstractSerial::BaudRateDirectionFlag>) const'
abstractserial.o: In function `AbstractSerial::parity() const':
abstractserial.cpp:(.text+0x2e68): undefined reference to `AbstractSerialEngine::parity() const'
abstractserial.o: In function `AbstractSerial::stopBits() const':
abstractserial.cpp:(.text+0x2f54): undefined reference to `AbstractSerialEngine::stopBits() const'
abstractserial.o: In function `AbstractSerial::dataBits() const':
abstractserial.cpp:(.text+0x3040): undefined reference to `AbstractSerialEngine::dataBits() const'
abstractserial.o: In function `AbstractSerial::flowControl() const':
abstractserial.cpp:(.text+0x312c): undefined reference to `AbstractSerialEngine::flow() const'
abstractserial.o: In function `AbstractSerial::deviceName() const':
abstractserial.cpp:(.text+0x3c7c): undefined reference to `AbstractSerialEngine::deviceName() const'
collect2: ld returned 1 exit status
make: *** [guiapp2] Errore 1
Any suggestions?
Best regards,
Krozac
Report
kuzulis
10 years ago
Oh, a lot of mistakes building... :)
I do not know where you have so many errors. Perhaps the reason is that you have a poorly installed or compiled by myself Qt-Embedded-arm. You first try to collect for their Qt-Embedded-arm any application of the examples of Qt (eg network, etc.).
And if you all get - that means the problem is QSerialDevice, but I can not help you solve it.
Report
Krozac
9 years ago
I have try to build guiapp in windows + qtsdk 1.1 mingw I think there are the same errors:
mingw32-make: Leaving directory `C:/Users/Luca/Desktop/qserialdevice-linux/test/guiapp-build-desktop'
./debug\serialdeviceenumerator.o: In function `SerialDeviceEnumerator':
qserialdevice\test\guiapp-build-desktop/../../src/qserialdeviceenumerator/serialdeviceenumerator.cpp:268: undefined reference to `SerialDeviceEnumeratorPrivate::SerialDeviceEnumeratorPrivate()'
qserialdevice\test\guiapp-build-desktop/../../src/qserialdeviceenumerator/serialdeviceenumerator.cpp:268: undefined reference to `SerialDeviceEnumeratorPrivate::SerialDeviceEnumeratorPrivate()'
./debug\serialdeviceenumerator.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdeviceenumerator/serialdeviceenumerator.cpp:294: undefined reference to `SerialDeviceEnumeratorPrivate::setEnabled(bool)'
./debug\serialdeviceenumerator.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdeviceenumerator/serialdeviceenumerator.cpp:304: undefined reference to `SerialDeviceEnumeratorPrivate::isEnabled() const'
./debug\serialdeviceenumerator.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdeviceenumerator/serialdeviceenumerator.cpp:518: undefined reference to `SerialDeviceEnumeratorPrivate::nativeIsBusy() const'
./debug\serialdeviceenumerator.o:qserialdevice\test\guiapp-build-desktop/debug/moc_serialdeviceenumerator.cpp:77: undefined reference to `SerialDeviceEnumeratorPrivate::_q_processWatcher()'
./debug\nativeserialengine.o: In function `NativeSerialEngine':
qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:41: undefined reference to `NativeSerialEnginePrivate::NativeSerialEnginePrivate()'
qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:41: undefined reference to `NativeSerialEnginePrivate::NativeSerialEnginePrivate()'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:53: undefined reference to `NativeSerialEnginePrivate::nativeOpen(QFlags<QIODevice::OpenModeFlag>)'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:55: undefined reference to `NativeSerialEnginePrivate::nativeClose()'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:62: undefined reference to `NativeSerialEnginePrivate::nativeClose()'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:68: undefined reference to `NativeSerialEnginePrivate::nativeSetBaudRate(int, QFlags<AbstractSerial::BaudRateDirectionFlag>)'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:74: undefined reference to `NativeSerialEnginePrivate::nativeSetDataBits(AbstractSerial::DataBits)'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:80: undefined reference to `NativeSerialEnginePrivate::nativeSetParity(AbstractSerial::Parity)'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:86: undefined reference to `NativeSerialEnginePrivate::nativeSetStopBits(AbstractSerial::StopBits)'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:92: undefined reference to `NativeSerialEnginePrivate::nativeSetFlowControl(AbstractSerial::Flow)'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:98: undefined reference to `NativeSerialEnginePrivate::nativeSetCharReadTimeout(int)'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:104: undefined reference to `NativeSerialEnginePrivate::nativeCharReadTimeout() const'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:110: undefined reference to `NativeSerialEnginePrivate::nativeSetTotalReadConstantTimeout(int)'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:116: undefined reference to `NativeSerialEnginePrivate::nativeTotalReadConstantTimeout() const'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:122: undefined reference to `NativeSerialEnginePrivate::nativeSetDtr(bool) const'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:128: undefined reference to `NativeSerialEnginePrivate::nativeSetRts(bool) const'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:134: undefined reference to `NativeSerialEnginePrivate::nativeLineStatus() const'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:140: undefined reference to `NativeSerialEnginePrivate::nativeSendBreak(int) const'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:146: undefined reference to `NativeSerialEnginePrivate::nativeSetBreak(bool) const'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:152: undefined reference to `NativeSerialEnginePrivate::nativeFlush() const'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:158: undefined reference to `NativeSerialEnginePrivate::nativeReset() const'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:164: undefined reference to `NativeSerialEnginePrivate::nativeBytesAvailable() const'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:173: undefined reference to `NativeSerialEnginePrivate::nativeWrite(char const*, long long)'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:192: undefined reference to `NativeSerialEnginePrivate::nativeRead(char*, long long)'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:209: undefined reference to `NativeSerialEnginePrivate::nativeSelect(int, bool, bool, bool*, bool*)'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:317: undefined reference to `NativeSerialEnginePrivate::nativeCurrentQueue(NativeSerialEngine::ioQueue) const'
./debug\nativeserialengine.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/nativeserialengine.cpp:324: undefined reference to `NativeSerialEnginePrivate::nativeCurrentQueue(NativeSerialEngine::ioQueue) const'
./debug\abstractserialnotifier.o:qserialdevice\test\guiapp-build-desktop/../../src/qserialdevice/abstractserialnotifier.cpp:7: undefined reference to `NativeSerialNotifier::NativeSerialNotifier(NativeSerialEngine*)'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\guiapp.exe] Error 1
mingw32-make: *** [debug] Error 2
The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project guiapp (target: Desktop)
When executing build step 'Make'
It is missing some code from the *win* *mac* files that I delete all references and files?
Best regards
Report
kuzulis
9 years ago
1. Reinstall the new Qt SDK (example, stable SDK for Windows):
http://get.qt.nokia.com/qtsdk/qt-sdk-win-opensource-2010.05.exe
2. Download stable QSerialDevice version 0.4.0 :
https://gitorious.org/qserialdevice/qserialdevice/archive-tarball/0.4.0
3. And build!
PS: In those errors (which you post it above) are analyzed myself, I do not know these errors.
Report
rdelgado
10 years ago
I am trying to use the QSerialDevice library, I've downloaded the files and I do the build with QtCreator and everything builds fine. Then I open the writer example but when I try to compile I get the following error:
error: cannot find -lqserialdeviced
error: collect2: ld returned 1 exit status
Do you know how can I fix it to be able to use the QSerialDevice?
Thank you very much and good work!
Report
kuzulis
10 years ago
Report
rdelgado
10 years ago
I tried it and the examples are working now, but I tried to write a simple test code from scratch and I can't make it work.
Do I need to copy the qserialdevice and qserialdeviceenumerator folders to my project in order to use the QSerialDevice.
I've included the abstractserial.h to my project but it won't compile.
I thought that since I build the BuildLibrary it would work on any other project.
What am I doing wrong?
Thanks for the help!
Report
kuzulis
10 years ago
1. You can in your project to use copies of the library folder (qserialdevice and qserialdeviceenumerator) and connect them to the project over (with) *. pri files.
(see examples \test\guiapp(guiapp2).
2. You can separately compile (default) static library with the aid of BuildLibrary.pro. For inclusion in the project you only need the header files (abstractserial.h, serialdeviceenumerator.h) and the file library (libqserialdevice(d).a).
3. Also similar to step 2. you can dynamically build the library and use it as in step 2. (ie, the library file will libqserialdevice (d). dll (so)).
--
For using p.2 and/or p.3 in your project file, you must specify:
- INCLUDEPATH += <the path to directory where are the header files>
- QMAKE_LIBDIR += <the path to directory where are the library file>
- LIBS += -l<name of library file>
see examples in /examples directory
Report
woodywoodpecker
9 years ago
Report
woodywoodpecker
9 years ago
Report
kuzulis
9 years ago
1. You first need to compile it as dynamic.
Change /src/src.pro:
---
#CONFIG += staticlib
CONFIG += dll
---
2. Build liblary, use BuildLibrary.pro.
After this, you will be ready to Library,
example here: ../build/(debug/release)/qserialdevice(d).dll
3. Copy header files (abstractserial.h, serialdeviceenumerator.h), and library (qserialdevice(d).dll)
to your project directory, example:
---
/yourproject
|-/lib
| |->qserialdevice(d).dll
|-/includes
| |->abstractserial.h
| |->serialdeviceenumerator.h
|-/yoursrc
|->your *.cpp/*.h
|->your.pro
---
4. For compile your project - change your your.pro, example:
---
INCLUDEPATH += ../includes
QMAKE_LIBDIR += ../lib
LIBS += -lqserialdevice(d)
---
5. After compile, for running your application, move (or copy) library qserialdevice(d).dll
to directory with yourapplication.exe
6. Running yourapplication.exe
Report
MaX-MoD
10 years ago
under windows, I find it better than Qextserialport.
will try on linux too, soon.
Report
kuzulis
10 years ago
Report
ssaku
10 years ago
Thanks for help
Report
ssaku
10 years ago
Report
kuzulis
10 years ago
data[0] = 0x00;
...
data[255] = 0xFF;
...
port->write(data, 256);
...
Report
bronkopavel
10 years ago
is in the windows code the SDK now required? (Compiler is showing missing header file)?
Bronko
Report
kuzulis
10 years ago
Report