pafra88 / qextserialport

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

Nice enum BaudRateType #76

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I think it will be nice to make enum BaudRateType like this:
enum BaudRateType {
    BAUD50  =  50,
    BAUD75  =  75,
    BAUD110 = 110,
    BAUD134 = 134,
    BAUD150 = 150
    // ...
}

Original issue reported on code.google.com by k06aaa on 22 Sep 2010 at 6:54

GoogleCodeExporter commented 8 years ago
You are absolutely right! But enums are really really bad. There is no chance 
to check if a special baud rate is supported or not at the moment (no #ifdef 
and no if on enums). There are even differences between the platforms. Should I 
grep for available baud rates in the header file during compile time? That's 
not feasible!

There should be a function "getAvailableBaudRates()" returning a QStringList or 
an array of integers (50, 75, 110, ...). I need such a function because the 
user of my tool should be able to choose a baud rate. I want to replace LabVIEW 
in order to control a Tektronix DMM.

Original comment by s.parsch...@gmx.de on 2 Jun 2011 at 10:44

GoogleCodeExporter commented 8 years ago
Take a look how I have solved that:
http://code.google.com/p/qt-communication-library/source/browse/trunk/QtCommunic
ation/serialport.h

Original comment by tomas.hanak@gmail.com on 24 Jun 2011 at 8:01

GoogleCodeExporter commented 8 years ago
Thanks

Original comment by dbzhang...@gmail.com on 16 Mar 2012 at 8:33