--- branches/linux-serial/Serial.h 2007/02/05 07:06:43 49 +++ branches/linux-serial/Serial.h 2007/02/05 10:10:18 54 @@ -19,6 +19,22 @@ class CSerial { + +public: //public enumerations + enum Baudrate + { + Baud300, + Baud600, + Baud1200, + Baud2400, + Baud4800, + Baud9600, + Baud19200, + Baud38400, + Baud57600, + Baud115200 + }; +private: // member vars #ifdef _MSC_VER HANDLE mComport; DCB mDcbRestore; @@ -28,16 +44,16 @@ #endif char* mPortstr; - int mBitrate; + Baudrate mBitrate; bool mIsopen; -public: +public: //public methods CSerial(); - CSerial(char* port, int bitrate); + CSerial(char* port, Baudrate bitrate); virtual ~CSerial(void); void close(); - void open(char* port, int bitrate); + void open(char* port, Baudrate bitrate); int readByte(); void writeByte(unsigned char out); @@ -48,7 +64,7 @@ int bytesReady() const; int outQueueSize() const; char* getPort() const {return mPortstr;} - int getBitrate() const {return mBitrate;} + Baudrate getBitrate() const {return mBitrate;} bool isOpen() { return mIsopen; } @@ -57,6 +73,7 @@ protected: void printByte(char* description, unsigned char byte); + int convertBaudrate(Baudrate rate); #ifdef _MSC_VER void openWindows(); #else