lemanhtrung / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

Conversion of serial parameters #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I needed to convert the serial parameters into values that can be
stored in human readable form with QSettings, so I implemented
conversion methods to and from the parameter enums and would like so
see that code in the package.
At the same time I was unhappy to be forced to provide the platform
dependent interface name, and moved the already implemented code into
another method which constructs the port name from an interface/port
index. Here the device name templates for the several Unix flavours
need to be reviewed, as I'm not familiar enough with most of them.
Also the coding style may need adaption to the projects standards, if there
are any.

Original issue reported on code.google.com by Martin.G...@alpha-bit.de on 3 Aug 2009 at 7:45

Attachments:

GoogleCodeExporter commented 9 years ago
Could not get this patch to work.
Which command should I use in POSIX? (MacOSX)

$ patch -p0 <qextserialbase-paramconversion.patch 
patching file qextserialbase.cpp
Hunk #1 FAILED at 20.
Hunk #2 FAILED at 226.
2 out of 2 hunks FAILED -- saving rejects to file qextserialbase.cpp.rej
patching file qextserialbase.h
Hunk #1 FAILED at 178.
1 out of 1 hunk FAILED -- saving rejects to file qextserialbase.h.rej
$

Original comment by bengt.ni...@spray.se on 8 Aug 2009 at 6:36

GoogleCodeExporter commented 9 years ago
Hi Bengt,

thank you for trying. I think the problem is that I based my patch on
qextserialport-1.1 (which I forgot to mention) as available from the old SF site
which is quite dated; that was before I came across the new homepage here, and 
there
isn't a more recent (stable) release available yet. I guess you tried against 
the
current development version? As I don't have a Mercurial setup here on my 
development
machine yet I can't even say how much 1.1 and the current trunk differ.
When I've got the time I'll install Mercurial and try to provide a patch 
against the
current version. If you're still interested, you could try to apply the changes 
by
hand as provided in the file attached below; it consists mainly of a stack of 
new
methods appended to the cpp file and just one simple change in constructor
QextSerialBase::QextSerialBase() (removed the ifdef'ed section, replaced by a 
method
call).

Martin

Original comment by Martin.G...@alpha-bit.de on 11 Aug 2009 at 8:27

Attachments:

GoogleCodeExporter commented 9 years ago
OK, here is the patch for the current trunk. Please note that it compiles in 
Visual
Studio 2008, but I didn't test it.

Original comment by Martin.G...@alpha-bit.de on 11 Aug 2009 at 12:49

Attachments:

GoogleCodeExporter commented 9 years ago
I also had this problem and also started with an old sf version, mine was
1.2.2alpha.
My thought was to create a class and use QTs meta object system for all further
processing, because this provides an automated approach. I just needed to create
some static wrapper functions.
In the future values stored behind the enums can also have really usable 
values. And
for now one just gets options available on the currently used platform.
I will add the sources to this file later as I'm not at work right now, sorry.

Original comment by ulrich.l...@hhi.fraunhofer.de on 2 Sep 2009 at 9:04

GoogleCodeExporter commented 9 years ago
The attached patch introduces a new class QextSerialPortSettings substituting 
the
PortSettings struct and providing advanced features for handling meta data of 
the
enums by using the QMetaObjectData system. This is achieved by making the
QextSerialPortSettings class a Q_GADGET a kind of lightweight Q_OBJECT as I 
understand.

There are also implemented some convenience funtions for retrieving QMaps or
QStringLists of meta data of the enums.

The attached patch contains every changes made to all classes for using the new
QextSerialPortSettings class and its enums.

Original comment by ulrich.l...@hhi.fraunhofer.de on 8 Sep 2009 at 1:25

Attachments:

GoogleCodeExporter commented 9 years ago
Is there a driver who would like to comment on this?

Would this patch be better if there was an example that specifically used the 
extra
functionality this conversion is desired to provide?

Original comment by bryant.m...@gmail.com on 23 Nov 2009 at 4:54

GoogleCodeExporter commented 9 years ago
Fixed In Version 2.0

Original comment by dbzhang...@gmail.com on 19 Apr 2012 at 2:09

GoogleCodeExporter commented 9 years ago

Original comment by dbzhang...@gmail.com on 13 Dec 2012 at 6:21