Go to the documentation of this file.00001
00004 #ifndef BPSASYNCIO_H
00005 #define BPSASYNCIO_H
00006
00007 #include "bpscore_global.h"
00008 #include <QIODevice>
00009 #include <QMap>
00010
00016 class BPSCORE_EXPORT BpsAsyncIO : public QIODevice
00017 {
00018 Q_OBJECT
00019 BPS_PRIVATE(BpsAsyncIO)
00020
00021 public:
00022
00026 enum BitRate {
00027 B110,
00028 B300,
00029 B600,
00030 B1200,
00031 B2400,
00032 B4800,
00033 B9600,
00034 B19200,
00035 B38400,
00036 B57600,
00037 B115200
00038 };
00039
00043 enum DataBits {
00044 D5,
00045 D6,
00046 D7,
00047 D8
00048 };
00049
00053 enum Parity {
00054 NoParity,
00055 Odd,
00056 Even,
00057 Mark,
00058 Space
00059 };
00060
00064 enum StopBits {
00065 S1,
00066 S1_5,
00067 S2
00068 };
00069
00073 enum FlowControl {
00074 NoFlowControl,
00075 Hard,
00076 Soft,
00077 HardAndSoft
00078 };
00079
00083 BpsAsyncIO(QObject* aParent = 0);
00084
00085 virtual ~BpsAsyncIO();
00086
00101 void setup(const QMap<QString,QString>& aConfig);
00102
00106 QString portName() const;
00107
00115 void setPortName(const QString& aPortName);
00116
00120 BitRate bitRate() const;
00121
00128 void setBitRate(BitRate aBitRate);
00129
00133 DataBits dataBits() const;
00134
00141 void setDataBits(DataBits aDataBits);
00142
00146 Parity parity() const;
00147
00154 void setParity(Parity aParity);
00155
00159 StopBits stopBits() const;
00160
00167 void setStopBits(StopBits aStopBits);
00168
00172 FlowControl flowControl() const;
00173
00180 void setFlowControl(FlowControl aFlowControl);
00181
00185 quint32 writeTimeout() const;
00186
00194 void setWriteTimeout(quint32 aMillisecs);
00195
00202 QString error() const;
00203
00207 void unsetError();
00208
00209
00215 static QStringList portNames();
00216
00218 virtual bool isSequential() const;
00219 virtual bool open(OpenMode aMode);
00220 virtual void close();
00222
00223 signals:
00224
00229 void error(const QString& aError);
00230
00231 protected:
00233 virtual qint64 readData(char* aData, qint64 aMaxSize);
00234 virtual qint64 writeData(const char *aData, qint64 aMaxSize);
00236 };
00237
00238 #endif // BPSASYNCIO_H