QSerialDevice

Qt Components

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

13
Become a Fan
7.9

Description:
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)
Last changelog:

More changes.


Ratings & Comments

143 Comments

momomo34

Hello, I am using your example to develop my own application. I found a problem with the buffer size in reception. Can you explain me how is it possible to change the receiving buffer size. It is now 14 bytes. For my application I need a buffer at 255 bytes. How is it possible to do this? Thank you.

kuzulis

Hi. A little unclear about which library it, about what examples and what kind of buffer do you mean?

RomanG

Hi, a while ago I downloaded your source version 0.3.0. and included it in my App. Wrote a Thread which handels the serial port (AbstractSerial), to be sure that no data can be lost. Everything worked fine. After the info that your source will be an addon to Qt5 I downloaded your new version 2.0. and replaced the old version in my app. The new version works as long as no interactions on the gui will take place. But as soon as for example I hold the Main-Window at its windowframetitle the readyRead() SIGNAL will not be triggeret any more. I still can write to the Port and also input data wont be lost its just that the SIGNAL will not be triggeret. Why is this? What do I have to do, in order to get the SIGNAL even if my window is in action? thanks. regards Roman

kuzulis

Hi. 1. Use QtSerialPort, because in QSerialDevice 2.0 has some bugs. 2. Give a minimal example that reproduces the problem.

goeck

Hey, I really liked versions prior to 2.0, but now I find almost totally undocumented and massively changed code (which is OK regarding the code...). I fumbled around and got it back running, but now the readyRead() signal seems to emit never. As I can see on the wires, using Logic, sending Bytes works out fine; the RS232 device answers as expected, but my reading routine doesn't get called due to missing readyRead() signal. What do I do wrong? Where can I find the new documentation, or how can I build it? Am missing the doxygen style... THX for the work Keep it up goeck

kuzulis

Version 2.0 is the transition. For details, see here http://qt-project.org/wiki/QtSerialPort It says how to build a library. Documentation is now done in QDoc, therefore, if you will use QtSerialPort - then run "make docs". Perhaps this is also true in relation to QSerialDevice. ReadyRead () signal is working. Maybe you do something wrong. For QSerialDevice 2.0 see examples in /examples and /tests

goeck

Hey, thanks for the quick reply and the hint with QDoc. I applied qdoc3.exe to the qdocconf file, but it says: Environment variable 'SERIALDEVICE_DIR' undefined Actually on my MinGW MSYS windows machine running 'make.exe docs' leads to an error message, saying that no makefile was found... I don't know what can be done wrongly when connecting to the signal... It only seems to partly work, when calling 'waitForReadyRead(100);' right after something was written on RS232, which is blocking. It worked out pretty fine using qserialdevice 0.4.1... I simply updated the code. Hope you have some more hints for me. thanks and Cheers goeck

kuzulis

Do not use waitForReadyRead () - it blocks EventLoop. It can be used only to block the operations of I/O only in a separate thread. See, for example, by analogy to the description of QAbstractSocket http://qt-project.org/doc/qt-4.8/qabstractsocket.html Look for it in the documentation below in compliance with such as: "Programming with a blocking socket is radically different from programming with a non-blocking socket..." When using waitForReadyRead() does not make sense in the signal readyRead()! :)

goeck

OK, I got a handle on it. Using the debug DLL doesn't work, but using the release DLL works like a charm. I'll recompile the stuff. Maybe there was something going wrong. Yeah, you're right, using waitForReadyRead() was the only thing that kind of worked for me, no signaling, nothing. I now compiled some Doxygen help with the 2.0 code. It mostly workes. Cheers goeck

kuzulis

>got a handle on it. Using the debug DLL doesn't work Strange, but I'll check it in the future, maybe :)

kuzulis

>got a handle on it. Using the debug DLL doesn't work Strange, but I'll check it in the future, maybe :)

goeck

Also I found that when building the libraries using MinGW on Win7 x64, file ntddser.h is missing. Had to grab it from the wine project online portal.

kuzulis

Ok. I will take note of this in the future. But you could just remove in serialportengine_p_win.cpp here lines: ... 53 #ifndef Q_CC_MSVC 54 # include <ddk/ntddser.h> 55 #else ... 88 #endif

goeck

I did this in the first run, but my concern was, that those tons of definitions are suitable for at least something. So I grabbed them from the net.

EvilTosha

При попытке скомпилировать BuildLibrary вылезает окошко "could not find the executable, please specify one" с несколькими инпутами. Система вин7 64, Qt 4.8.0

kuzulis

use last version: http://gitorious.org/qserialdevice/qserialdevice/trees/2.0

EvilTosha

К сожалению проблема не исчезла

kuzulis

Значит неправильно собираешь. Это не проблемы библиотеки - а твои: отсутствие минимальных знаний о процессе сборки. Разбирайся что ты делаешь не так.

EvilTosha

Отличная поддержка проекта! Спасибо за помощь и обсуждение проблемы.

tony1tf

I have mac os x 10.6.8 and Qt Creator 2.0.1 Based on Qt 4.7.0 (64 bit) Built on Sep 15 2010 at 14:09:02 I am a relative beginner at this and dont have enough knowledge to debug the problem - all I wanted to do was to write a small Qt application to send a few characters to the serial port (prolific usb to serial adaptor) when a button is pressed. I can do this manually from the mac os x terminal with the command "screen -U /dev/tty.usbserial 9600 " I have had several goes at compiling the QSerialDevice build examples anymaster app compiles but crashes my mac anyslave app compiles but hangs emumerator starts compiling but stops with this warning: ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -L not found. Undefined symbols: "_CFDictionaryAddValue", referenced from: SerialDeviceEnumeratorPrivate::SerialDeviceEnumeratorPrivate()in libqserialdevice.a(serialdeviceenumerator_p_mac.o) SerialDeviceEnumeratorPrivate::SerialDeviceEnumeratorPrivate()in libqserialdevice.a(serialdeviceenumerator_p_mac.o) "_CFRunLoopGetCurrent", referenced from: SerialDeviceEnumeratorPrivate::setEnabled(bool) in libqserialdevice.a(serialdeviceenumerator_p_mac.o) "_CFNumberGetValue", referenced from: SerialDeviceEnumeratorPrivate::updateInfo() const in libqserialdevice.a(serialdeviceenumerator_p_mac.o) SerialDeviceEnumeratorPrivate::updateInfo() const in libqserialdevice.a(serialdeviceenumerator_p_mac.o) "_IORegistryEntryCreateCFProperty", referenced from: SerialDeviceEnumeratorPrivate::updateInfo() const in libqserialdevice.a(serialdeviceenumerator_p_mac.o) "_IONotificationPortCreate", referenced from: SerialDeviceEnumeratorPrivate::setEnabled(bool) in libqserialdevice.a(serialdeviceenumerator_p_mac.o) "_CFRelease", referenced from: SerialDeviceEnumeratorPrivate::updateInfo() const in libqserialdevice.a(serialdeviceenumerator_p_mac.o) and so many similar error messages The compilation never gets as far as the remainder of the apps Any help appreciated, thanks Tony

kuzulis

Tony, I have no way to test for all MacOSX work library. I tested only on Leopard 10.6.6 + QtSDK 4.6.x + Xcode. Especially, the class SerialDeviceEnumerator in MacOSX is not working properly and it is not fully implemented. Use the new version 2.0 of the library - there are many changes and everything should work fine. http://gitorious.org/qserialdevice/qserialdevice/trees/2.0

tony1tf

Hi kuzulis Thanks for your fast reply. I downloaded version 2, but it produces a different error - here is the compiler output just before the error: make[1]: Entering directory `/Users/afa/Documents/Astronomy/serialport-build-desktop/src' /Developer/Tools/Qt/moc -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I../../qserialdevice-qserialdevice\ 2/src -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/usr/include -I../../qserialdevice-qserialdevice\ 2/include -I/Users/afa/Documents/Astronomy/serialport-build-desktop/src/. -I../../qserialdevice-qserialdevice\ 2/src -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ ../../qserialdevice-qserialdevice 2/include/serialport.h -o moc_serialport.cpp moc: Too many input files specified I also had the same "too many files error" when trying to compile another serial port implementation. Obviously yet another Mac compatibility issue Tony

tony1tf

Hi Kuzulis again I found the reason for the "too many files" error was because of the space in the file name - you had added <space>2 to the Qserial-device application. So now I can compile, but cannot get the test apps to run - QT is asking for an executable and run environment, and then I get the error message "Failed to start program. Path or permissions wrong?" or if I tell it to start in a terminal window it cant start xterm. Then from time to time I get another error message in a pop up window in QT "The file serialport.pro.user has changed outside Qt Creator. Do you want to reload it?" So no success yet. Tony

kuzulis

I have everything working. For example, a test application: qserialdevice-qserialdevice\tests\guiapp\guiapp.pro I opened a QtCreator, compile and run without problems.

tony1tf

Hi I'm sorry - I cannot follow what you do. Please tell me what your setup is. If I try and compile and run I get a whole stack of errors as I have stated before. What environment are you setting up - "Shadow build" etc etc. Tony

Pling
0 Affiliates
Details
license
version 2.0
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 0

Other Qt Components:

QyurVisualSqlFilter
purser79
last update date: 8 years ago

Score 5.0

QyurSqlTreeView
purser79
last update date: 8 years ago

Score 6.5

QtBasic
mantur
last update date: 13 years ago

Score 5.0

up2Date
seanpatti
last update date: 9 years ago

Score 5.0

MStyles
mchara
last update date: 17 years ago

Score 5.0

Hdr reading plugin
mchara
last update date: 17 years ago

Score 5.0