--- branches/linux-serial/Serial.h 2007/02/04 21:22:44 44 +++ branches/linux-serial/Serial.h 2007/02/05 07:06:43 49 @@ -7,39 +7,42 @@ #pragma once #include +#include +#include typedef std::vector UCVector; -#ifndef _WINDOWS // +#ifndef _MSC_VER // inline void Sleep(int x) { usleep(x*1000);} +#include #endif class CSerial { -#ifdef _WINDOWS +#ifdef _MSC_VER HANDLE mComport; DCB mDcbRestore; #else int mFiledescriptor; + termios mOldtio; #endif char* mPortstr; int mBitrate; bool mIsopen; - //void printByte(char* description, unsigned char byte); public: CSerial(); CSerial(char* port, int bitrate); - ~CSerial(void); + virtual ~CSerial(void); void close(); void open(char* port, int bitrate); - unsigned char readByte(); + int readByte(); void writeByte(unsigned char out); -#ifdef _WINDOWS +#ifdef _MSC_VER COMSTAT getComstat() const; #endif int bytesReady() const; @@ -53,7 +56,8 @@ //UCVector readBytes(int maxcount); protected: -#ifdef _WINDOWS + void printByte(char* description, unsigned char byte); +#ifdef _MSC_VER void openWindows(); #else void openLinux();