/[H7]/branches/linux-serial/Serial.h
ViewVC logotype

Diff of /branches/linux-serial/Serial.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 43 by torben, Sun Feb 4 20:11:41 2007 UTC revision 44 by torben, Sun Feb 4 21:22:44 2007 UTC
# Line 7  Line 7 
7  #pragma once  #pragma once
8    
9  #include <vector>  #include <vector>
   
10  typedef std::vector<unsigned char> UCVector;  typedef std::vector<unsigned char> UCVector;
11    
12    #ifndef _WINDOWS //
13    inline void Sleep(int x) { usleep(x*1000);}
14    #endif
15    
16    
17  class CSerial  class CSerial
18  {  {
19    #ifdef _WINDOWS
20          HANDLE mComport;          HANDLE mComport;
21          DCB mDcbRestore;          DCB mDcbRestore;
22          CString mPortstr;  #else
23            int mFiledescriptor;
24    #endif
25            
26            char* mPortstr;
27          int mBitrate;          int mBitrate;
28          bool mIsopen;          bool mIsopen;
29    
30  protected:          //void printByte(char* description, unsigned char byte);
         void printByte(char* description, unsigned char byte);  
31  public:  public:
32          CSerial();          CSerial();
33          CSerial(char* port, int bitrate);          CSerial(char* port, int bitrate);
# Line 31  public: Line 39  public:
39          unsigned char readByte();          unsigned char readByte();
40          void writeByte(unsigned char out);          void writeByte(unsigned char out);
41    
42    #ifdef _WINDOWS
43          COMSTAT getComstat() const;          COMSTAT getComstat() const;
44    #endif
45          int bytesReady() const;          int bytesReady() const;
46          int outQueueSize() const;          int outQueueSize() const;
47          CString getPort() const {return mPortstr;}          char* getPort() const {return mPortstr;}
48          int getBitrate() const {return mBitrate;}          int getBitrate() const {return mBitrate;}
49    
50          bool isOpen() { return mIsopen; }          bool isOpen() { return mIsopen; }
# Line 43  public: Line 52  public:
52          //void writeBytes(UCVector out);          //void writeBytes(UCVector out);
53          //UCVector readBytes(int maxcount);          //UCVector readBytes(int maxcount);
54  protected:  protected:
55          void open();          
56    #ifdef _WINDOWS
57            void openWindows();
58    #else
59            void openLinux();
60    #endif
61  };  };

Legend:
Removed from v.43  
changed lines
  Added in v.44

  ViewVC Help
Powered by ViewVC 1.1.20