PDA

View Full Version : QSerialDevice v 0.2.0 released



kuzulis
2nd March 2010, 18:08
Hi

So, announces release: QSerialDevice v 0.2.0

Many amendments, write makes no sense, therefore, give a brief clipping annotations:

QSerialDevice - a cross-platform library for serial devices, which uses framework Qt4 (see http://qt.nokia.com/).

Requirements:

OC: Win2K/WinXP/WinVista/Win7 or any GNU / Linux distribution
Qt4:>=4.5.0
Processor: any (which is supported by Qt4)
Compiler: any (which is supported by Qt4)

Notes:

Due to the fact that I (the author) do not have the opportunity to test the library at all possible operating systems, all compilers, processors, etc. - It is possible that the library in some cases will not work: (.
Library tested only on:
OC: Windows XP Pro Sp3 (win32) and GNU ArchLinux x86_64
Qt4: from 4.5.3 to 4.6.2
Processor: AMD Athlon 4400 + 64x2 Socket AM2
Compiler: gcc, MinGw
Theoretically (with minor fixes source code) can ensure that the library has worked on other platforms.

QSerialDevice Library contains the following classes:

* AbstractSerial
* SerialDeviceWatcher
* SerialDeviceInfo

AbstractSerial

Class AbstractSerial - provides a self-contained set of methods and properties for light and easy to work with serial devices (serial port) of your PC (or other device).

The class supports the following features:
- to set the speed of data exchange
- to set the number of bits of data
- to set the number of stop bit
- set modes parity
- to establish regimes of control flow
- set timeout symbol
- write data to the serial device
- read data from serial device
- manage such lines as a port: DTR, RTS
- reading of such lines as a port: CTS, DSR, DCD, RI, RTS, DTR, ST, SR
- automatically receive notification when:
- receiving at least one byte (character) in the input buffer
- writing the last byte in the output buffer
- change of status of the serial device (for errors, etc.)
- to get the current value of the number of bytes in the receiving buffer
- set timeout joining at least one byte (character) in the input buffer

(see further description AbstractSerial and source code)

SerialDeviceWatcher

Class SerialDeviceWatcher - is a helper class for the monitoring of serial devices.

Class provides the following features:
- to obtain a list of names of all serial devices that are available in the system
- automatically receive notification when adding / removing of any serial device

(see further description SerialDeviceWatcher and source code)

SerialDeviceInfo

Class SerialDeviceInfo - also is a helper class to obtain information about the serial device.

Class provides the following features:
- to get "friendly" name interesuyushego us serial device
- to obtain the "description" interesuyushego us serial device
- to get VID and PID interesuyushego us serial device (experimental)
- we are interested to check the serial device to the existence of
- we are interested to check the serial device on employment (lock)
-, etc.

(see further description SerialDeviceInfo and source code)

Download from Qt-Apps.org: http://www.qt-apps.org/content/show.php/QSerialDevice?content=112039&PHPSESSID=fcb410664e641afec5d0a355634137ac
Download Releases can be the home page of the project: http://fireforge.net/frs/?group_id=199
Download the latest cuts SVN: http://fireforge.net/snapshots.php?group_id=199

jnadelman
11th June 2010, 21:28
Is there something special I need to do to build QSerialDevice on an Ubuntu Linux platform? I have no trouble building and running successfully on windows, but building on Linux I get

/moc_serialdevicewatcher.cpp:12: error: #error "The header file 'serialdevicewatcher.h' doesn't include <QObject>."If I add "#include <QObject>" to serialdevicewatcher.h I get

/moc_serialdevicewatcher.cpp:78: error: invalid use of incomplete type ‘struct SerialDeviceWatcherPrivate’
and

/../QSerialDevice/serialdevicewatcher.h:33: error: forward declaration of ‘struct SerialDeviceWatcherPrivate’
moc_serialdevicewatcher.cpp:78 is

case 1: d_func()->_q_processAvailableNotifier(); break;
As I try to fix these, the errors start to multiply. Any ideas?

kuzulis
12th June 2010, 15:10
I just checked the compilation of: svn checkout svn://scm.fireforge.net/svnroot/qserialdevice
and I have all good compile. OS ArchLinux x86_64.

Try has make the so:
- Remove from the project all Makefile, *. moc, *. obj files and then compile. (Or equivalent to do: # make distclean)

jnadelman
14th June 2010, 15:02
Thanks. That was helpful. Builds fine now.

cutie.monkey
15th June 2010, 08:41
QSerialDevice is very helpful! I'ved been using this in LINUX and WINDOWS. Thanks to the author..

kuzulis
23rd June 2010, 19:06
NEWS!

QSerialDevice moved to Git: http://gitorious.org/qserialdevice

Now the main line (master) and the development will be on Git!!!

pherthyl
30th June 2010, 00:08
Cool. I've been using QextSerialPort, but it isn't without its problems. How is QSerialDevice different/better than QExtSerialPort? Why was it created?

kuzulis
30th June 2010, 06:49
Cool. I've been using QextSerialPort, but it isn't without its problems.
What's the problem with QextSerialPort?


How is QSerialDevice different/better than QExtSerialPort?
Difference is enormous. As in the very architecture of the library, and additional opportunities.
There are only a small minus, which lies in the fact that at the moment fully supported by OS Win 2k/XP/Vista/7 + GNU / Linux. Other OS partially supported.
More information you will find viewing the source code and documentation. And compare for yourself.


Why was it created?
Yes just like that! You will not believe it! :)
I am not happy QextSerialPort. I could add a functional - but this would alter the entire architecture QextSerialPort. But then it was already not QextSerialPort - but something else! :)
So I decided to create a new library from scratch.

----
Another remark for all:
Need help in implementation of native support for classes SerialDeviceWatcher and SerialDeviceInfo for MacOSX and other operating systems (if possible).
It would be nice for that "steal" code from QextSerialPort - but I do not know MacOSX and I have no time! Still, it's summer - a summer to relax! :)

pherthyl
30th June 2010, 17:34
What's the problem with QextSerialPort?

I never got the enumerator to work properly, and also never got it working by listening for readyRead. It seems to only work using polling.


More information you will find viewing the source code and documentation. And compare for yourself.

Thanks, will do. I guess the other difference is that QextSerialPort is BSD or public domain instead of GPL...

jnadelman
30th June 2010, 17:38
I was able to get QSerialDevice working on linux and windows without too much trouble. I was only able to get QextSerialPort working on windows.

zazarb
11th August 2010, 19:34
Hello all,

I'm trying to compile QSerialDevice v 0.2.0 on windows with VisualStudio 2008.
* I've created a CMakeLists file (attached)
* When I compile the project i have the two (similar) following errors:

- in moc_serialdevicewatcher.cxx, I get a compiler error because I use the undefined type SerialDeviceWatcherPrivate in the function SerialDeviceWatcher::qt_metacall (the d_func() is supposed to return a SerialDeviceWatcherPrivate object)

- in moc_serialdevicenotifier.cxx, I get a compiler error because I use the undefined type SerialNotifierPrivate in the function SerialNotifier::qt_metacall (the d_func() is supposed to return a SerialNotifierPrivate object)

If in moc_serialdevicewatcher.cxx I replace the include file
#include "../../qserialdevice/serialdevicewatcher.h"
by the include file
#include "../../qserialdevice/serialdevicewatcher_p.h" in

And in moc_serialdevicenotifier.cxx I replace the include file
#include "../../qserialdevice/serialnotifier.h" in
by the include file
#include "../../qserialdevice/serialnotifier_p.h"

I can compile everything without problem. However I get linker errors like this :

warning LNK4006: "public: virtual struct QMetaObject const * __thiscall SerialDeviceWatcher::metaObject(void)const " (?metaObject@SerialDeviceWatcher@@UBEPBUQMetaObjec t@@XZ) déjà défini dans moc_serialdevicewatcher.obj

which i think suggest that i have problems with my .moc files

Would anyone have some insight on why I get this compiler error and how I could compile the library correctly with MSVS2008 ?

Thanks a lot,
Best

jnadelman
11th August 2010, 20:08
I am not familiar with your dev env but you may have better luck with QextSerialPort (http://qextserialport.sourceforge.net/)

kuzulis
11th August 2010, 20:21
2 zazarb .

1. Try http://gitorious.org/qserialdevice

2. If you're doing a compilation with CMake, then you must do so:


ie to gather with CMake need:

//#include "moc_serialdevicewatcher.cpp"
#include "serialdevicewatcher.moc"

ie to gather with qmake need:

#include "moc_serialdevicewatcher.cpp"
//#include "serialdevicewatcher.moc"



etc. do the same in other *. cpp files where there is # include "moc_xx.cpp"

If more, then see the topic: http://www.prog.org.ru/topic_12491_0.html
(Translated into Russian with the help of Google Translate) :)


I've created a CMakeLists file (attached)
Thank you. I have in the future to add CMake QSerialDevice.

zazarb
13th August 2010, 09:57
Hello and thanks for your quick reply.

I was finally able to compile the CSerialDevice library for VS2008 (I'm not sure yet it works with virtual ports though), and thought I'd just describe my steps to make it work for below in the post (I've also included all the CMakeLists files). Now I have also compiled the SerialDeviceInfo example, but using virtual ports on my PC, it seems that they are not recognized. I still need to check things out a bit, but would anybody have insights on that matter?

Unrelated question : now that the project is on Gitorious, is this website the place where I should post these remarks/questions, or should I ask them on Gitorious ?

1) I downloaded the latest version of the library on Gitorious

2) I included a missing #include <QObject> header where missing

3) I corrected a PCVOID error by adding a #define PCVOID LPCVOID in nativeserialengine.h

4) In the cmake file, the moc files can either be created using:

* qt4_wrap_cpp(MOC_SRCS ${MOC_SRCS}) : it creates some moc_xxx.cxx files included at the end of serialnotifier_p_win.cpp and serialdevicewatcher_p_win.cpp. Even after replacing the #include "moc_xxx.cpp" by "moc_xxx.cxx" at the end of the files to remove compiler errors, I couldn't remove the errors mentioned in the previous posts, I think that it is due to a problem of compiling order (it seems that vs2008 creates the moc_xxx.cxx files but then does not compile them.

* qt4_automoc(${SRCS}) : to make this work,
- I had to add at the beginning of every file inheriting QObject a #include "myclass.moc" (abstractserial.cpp, abstractserialengine.cpp, nativeserialengine.cpp, serialnotifier.cpp, serialdeviceinfo.cpp serialdevicewatcher.cpp
- I had to remove the #include "moc_xxx.cxx" at the end of serialnotifier_p_win.cpp and serialdevicewatcher_p_win.cpp.

After all this I still had a linker error: __declspec(dllimport) public: static class QString __cdecl QString::fromWCharArray(wchar_t const *,int). This is due to a wrong setting in the default config properties of vs2008: you need to set properties->configuration options->C++-> language->"treat wchar_t as integrated type" or some name like that to NO (actually, I think that this is only needed in the qserialdeviceinfoLib project but i haven't confirmed).
This option can be set through the CMakes using this:
set_target_properties(qserialdeviceinfoLib PROPERTIES COMPILE_FLAGS "/Zc:wchar_t-")

kuzulis
13th August 2010, 13:55
2 zazarb



(I'm not sure yet it works with virtual ports though),

What exactly does not work? AbstractSerial or SerialDeviceWatcher or SerialDeviceInfo?
If SerialDeviceInfo - then try a new experimental class SeialDeviceEnumerator!


where I should post these remarks/questions, or should I ask them on Gitorious ?
Yes, now the project is at Gitorgious. Bugs and ask questions there. Or send e-mail me at. Let's stay together to deal with problems.


After all this I still had a linker error: __declspec(dllimport) public: stat
Maybe you need to change the file "qserialdevice_global.h" i.e. part macros Q_DECL_EXPORT etc.
I realized this is bad, because wanted to be able to compile the library as static and shared for all compilers and all operating systems.
If you follow the recommendations of the Nokia "Creating Shared Libraries" (search in QtAssistant) and make "qserialdevice_global.h" as they say - it will compile only the shared library. :(

zazarb
17th August 2010, 10:44
Hello,
Actually, by applying all the modifications that I posted in the previous email, and by installing a nice virtual serial port software, I was able to build the whole library+examples correctly, everything works fine !
Thanks for your help, and I'll move to Gitorious now if i have further questions/problems.
Sandrine

mastupristi
13th September 2010, 18:36
I just checked the compilation of: svn checkout svn://scm.fireforge.net/svnroot/qserialdevice
and I have all good compile. OS ArchLinux x86_64.

Try has make the so:
- Remove from the project all Makefile, *. moc, *. obj files and then compile. (Or equivalent to do: # make distclean)

I have the same problem, but also distcleaning the problem is still present.
I am able to correclty compile the integrated library

here is the project:
http://dl.dropbox.com/u/7966431/testQSer.zip

I run Ubuntu 9.10 64 bit, gcc 4.4.1, qt 4.5.2

thanks

Maybe I am wrong but I can check only tomorrow morning

thanks

mastupristi
14th September 2010, 09:00
I have the same problem, but also distcleaning the problem is still present.
I am able to correclty compile the integrated library

here is the project:
http://dl.dropbox.com/u/7966431/testQSer.zip

I run Ubuntu 9.10 64 bit, gcc 4.4.1, qt 4.5.2

thanks

Maybe I am wrong but I can check only tomorrow morning

Unfortunately I must confirm the problem, even if I delete all generated files:

the errors are:

Running build steps for project testQSer...
Starting: "/usr/bin/qmake-qt4" /home/POWERSOFT/massimiliano/prog/testQser/testQSer/testQSer.pro -r -spec linux-g++ CONFIG+=debug
The process "/usr/bin/qmake-qt4" exited normally.
Starting: "/usr/bin/make" -w
make: ingresso nella directory «/home/POWERSOFT/massimiliano/prog/testQser/testQSer-build-desktop»
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testQSer -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I../testQSer -I. -o main.o ../testQSer/main.cpp
/usr/bin/moc-qt4 -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testQSer -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I../testQSer -I. ../testQSer/myclass.h -o moc_myclass.cpp
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testQSer -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I../testQSer -I. -o moc_myclass.o moc_myclass.cpp
/usr/bin/moc-qt4 -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testQSer -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I../testQSer -I. ../testQSer/seriale/serialdevicewatcher.h -o moc_serialdevicewatcher.cpp
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testQSer -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I../testQSer -I. -o moc_serialdevicewatcher.o moc_serialdevicewatcher.cpp
moc_serialdevicewatcher.cpp:12:2: error: #error "The header file 'serialdevicewatcher.h' doesn't include <QObject>."
In file included from moc_serialdevicewatcher.cpp:10:
../testQSer/seriale/serialdevicewatcher.h:29: error: expected class-name before ‘{’ token
../testQSer/seriale/serialdevicewatcher.h:30: error: ‘Q_OBJECT’ does not name a type
../testQSer/seriale/serialdevicewatcher.h:36: error: expected ‘)’ before ‘*’ token
../testQSer/seriale/serialdevicewatcher.h:41: error: ‘QStringList’ does not name a type
../testQSer/seriale/serialdevicewatcher.h:47: error: ISO C++ forbids declaration of ‘Q_DECLARE_PRIVATE’ with no type
../testQSer/seriale/serialdevicewatcher.h:48: error: expected ‘;’ before ‘Q_DISABLE_COPY’
../testQSer/seriale/serialdevicewatcher.h:50: error: expected ‘;’ before ‘}’ token
../testQSer/seriale/serialdevicewatcher.h:44: warning: non-static const member ‘SerialDeviceWatcherPrivate* const SerialDeviceWatcher::d_ptr’ in class without a constructor
moc_serialdevicewatcher.cpp:20: error: expected constructor, destructor, or type conversion before ‘static’
moc_serialdevicewatcher.cpp:46: error: ‘QMetaObject’ does not name a type
moc_serialdevicewatcher.cpp:51: error: expected initializer before ‘*’ token
moc_serialdevicewatcher.cpp:56: error: no ‘void* SerialDeviceWatcher::qt_metacast(const char*)’ member function declared in class ‘SerialDeviceWatcher’
moc_serialdevicewatcher.cpp:64: error: ‘int SerialDeviceWatcher::qt_metacall’ is not a static member of ‘class SerialDeviceWatcher’
moc_serialdevicewatcher.cpp:64: error: ‘QMetaObject’ has not been declared
moc_serialdevicewatcher.cpp:64: error: expected primary-expression before ‘int’
moc_serialdevicewatcher.cpp:64: error: expected primary-expression before ‘void’
moc_serialdevicewatcher.cpp:64: error: initializer expression list treated as compound expression
moc_serialdevicewatcher.cpp:65: error: expected ‘,’ or ‘;’ before ‘{’ token
make: uscita dalla directory «/home/POWERSOFT/massimiliano/prog/testQser/testQSer-build-desktop»
make: *** [moc_serialdevicewatcher.o] Errore 1
The process "/usr/bin/make" exited with code %2.
Error while building project testQSer (target: Desktop)
When executing build step 'Make'

my test project has been updated:
http://dl.dropbox.com/u/7966431/testQSer.zip

any idea?

thanks

kuzulis
14th September 2010, 20:13
Try download current Git snapshot and rebuild library.
Classes SerialDeviceWatcher and SerialDeviceInfo more is not supported (deprecated). Try class SerialDeviceEnumerator.

rmeeh
15th September 2010, 23:25
Hello, I´m using QT4.6.3 in conjunction with VS2008.... so i downloaded QSERIALDEVICE 2.0 and tried to compile the QserialDevice.Lib in the way documented in the file readme_en.txt....... so qmake BuildIntegr........... works fine....the when i type the command "make" ther appears the Error Message "makefile:83: *** missing separator. Stop" so the tree under the directory build stays nearly empty..... Do anyone have an Idea? Without the Lib there ist no way to try serial programming :( Thanks for every help -Ralf-

kuzulis
16th September 2010, 08:08
2 rmeeh

1. Try download from Git : http://gitorious.org/qserialdevice
2. The current version (Git) is not 0.2.0! (It is closer to 0.3.0).
3. Do not use "readme_en.txt" and etc.
4. To build the library, use only "BuildLibrary.pro":


#qmake BuildLibrary.pro
#make

(Preset project to build DEBUG or RELEASE)

rmeeh
18th September 2010, 00:59
Thank´s for your mail.
I don´t have a cvs system in use, so i´m not able to download the sources.
Is there no way to get a ZIP or rar archive with an actual snapshot? Normaly i develop small projects for Amateur Radio (technical things) so i don´t need a cvs. This time i need a serial asyncronus communication to an ATMEGA Microcontroller which controlls an Axis.......and i´ve never used a CVS in my life ;-)
best Regards, -Ralf-

kuzulis
18th September 2010, 17:38
2 rmeeh,

You're not looking for and inconsiderate! :)

Download here http://gitorious.org/qserialdevice/qserialdevice/archive-tarball/master

rmeeh
19th September 2010, 00:30
[QUOTE=kuzulis;158746]2 rmeeh,

You're not looking for and inconsiderate! :)

Thank´s very much, you´re right, how could i belive that you would not be prepeared..
with a little trouble the library compiled using Visual Studio 2008
Now the work will start understanding the classes.
Have a nice weekend
-Ralf-