--- branches/linux-serial/Serial.h 2007/02/04 20:11:41 43 +++ branches/linux-serial/Serial.h 2007/02/04 21:22:44 44 @@ -7,19 +7,27 @@ #pragma once #include - typedef std::vector UCVector; +#ifndef _WINDOWS // +inline void Sleep(int x) { usleep(x*1000);} +#endif + + class CSerial { +#ifdef _WINDOWS HANDLE mComport; DCB mDcbRestore; - CString mPortstr; +#else + int mFiledescriptor; +#endif + + char* mPortstr; int mBitrate; bool mIsopen; -protected: - void printByte(char* description, unsigned char byte); + //void printByte(char* description, unsigned char byte); public: CSerial(); CSerial(char* port, int bitrate); @@ -31,11 +39,12 @@ unsigned char readByte(); void writeByte(unsigned char out); - +#ifdef _WINDOWS COMSTAT getComstat() const; +#endif int bytesReady() const; int outQueueSize() const; - CString getPort() const {return mPortstr;} + char* getPort() const {return mPortstr;} int getBitrate() const {return mBitrate;} bool isOpen() { return mIsopen; } @@ -43,5 +52,10 @@ //void writeBytes(UCVector out); //UCVector readBytes(int maxcount); protected: - void open(); + +#ifdef _WINDOWS + void openWindows(); +#else + void openLinux(); +#endif };