QSerialDevice v 0.2.0 released
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....d0a355634137ac
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
Re: QSerialDevice v 0.2.0 released
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
Quote:
/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
Quote:
/moc_serialdevicewatcher.cpp:78: error: invalid use of incomplete type ‘struct SerialDeviceWatcherPrivate’
and
Quote:
/../QSerialDevice/serialdevicewatcher.h:33: error: forward declaration of ‘struct SerialDeviceWatcherPrivate’
moc_serialdevicewatcher.cpp:78 is
Code:
case 1: d_func()->_q_processAvailableNotifier(); break;
As I try to fix these, the errors start to multiply. Any ideas?
Re: QSerialDevice v 0.2.0 released
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)
Re: QSerialDevice v 0.2.0 released
Thanks. That was helpful. Builds fine now.
Re: QSerialDevice v 0.2.0 released
QSerialDevice is very helpful! I'ved been using this in LINUX and WINDOWS. Thanks to the author..
Re: QSerialDevice v 0.2.0 released
NEWS!
QSerialDevice moved to Git: http://gitorious.org/qserialdevice
Now the main line (master) and the development will be on Git!!!
Re: QSerialDevice v 0.2.0 released
Cool. I've been using QextSerialPort, but it isn't without its problems. How is QSerialDevice different/better than QExtSerialPort? Why was it created?
Re: QSerialDevice v 0.2.0 released
Quote:
Cool. I've been using QextSerialPort, but it isn't without its problems.
What's the problem with QextSerialPort?
Quote:
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.
Quote:
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! :)
Re: QSerialDevice v 0.2.0 released
Quote:
Originally Posted by
kuzulis
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.
Quote:
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...
Re: QSerialDevice v 0.2.0 released
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.
1 Attachment(s)
problems compiling QSerialDevice under visual studio 2008
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
Re: problems compiling QSerialDevice under visual studio 2008
I am not familiar with your dev env but you may have better luck with QextSerialPort
Re: problems compiling QSerialDevice under visual studio 2008
2 zazarb .
1. Try http://gitorious.org/qserialdevice
2. If you're doing a compilation with CMake, then you must do so:
Quote:
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) :)
Quote:
I've created a CMakeLists file (attached)
Thank you. I have in the future to add CMake QSerialDevice.
1 Attachment(s)
Re: QSerialDevice v 0.2.0 released
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-")
Re: QSerialDevice v 0.2.0 released
2 zazarb
Quote:
(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!
Quote:
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.
Quote:
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. :(
Re: QSerialDevice v 0.2.0 released
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
Re: QSerialDevice v 0.2.0 released
Quote:
Originally Posted by
kuzulis
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
Re: QSerialDevice v 0.2.0 released
Quote:
Originally Posted by
mastupristi
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:
Code:
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
Re: QSerialDevice v 0.2.0 released
Try download current Git snapshot and rebuild library.
Classes SerialDeviceWatcher and SerialDeviceInfo more is not supported (deprecated). Try class SerialDeviceEnumerator.
Re: QSerialDevice v 0.2.0 released
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-