/[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 46 by torben, Sun Feb 4 23:11:02 2007 UTC revision 49 by torben, Mon Feb 5 07:06:43 2007 UTC
# Line 7  Line 7 
7  #pragma once  #pragma once
8    
9  #include <vector>  #include <vector>
10    #include <string>
11    #include <stdexcept>
12  typedef std::vector<unsigned char> UCVector;  typedef std::vector<unsigned char> UCVector;
13    
14  #ifndef _WINDOWS //  #ifndef _MSC_VER //
15  inline void Sleep(int x) { usleep(x*1000);}  inline void Sleep(int x) { usleep(x*1000);}
16  #include <termios.h>  #include <termios.h>
17  #endif  #endif
# Line 17  inline void Sleep(int x) { usleep(x*1000 Line 19  inline void Sleep(int x) { usleep(x*1000
19    
20  class CSerial  class CSerial
21  {  {
22  #ifdef _WINDOWS  #ifdef _MSC_VER
23          HANDLE mComport;          HANDLE mComport;
24          DCB mDcbRestore;          DCB mDcbRestore;
25  #else  #else
# Line 32  class CSerial Line 34  class CSerial
34  public:  public:
35          CSerial();          CSerial();
36          CSerial(char* port, int bitrate);          CSerial(char* port, int bitrate);
37          ~CSerial(void);          virtual ~CSerial(void);
38    
39          void close();          void close();
40          void open(char* port, int bitrate);          void open(char* port, int bitrate);
41    
42          unsigned char readByte();          int readByte();
43          void writeByte(unsigned char out);          void writeByte(unsigned char out);
44    
45  #ifdef _WINDOWS  #ifdef _MSC_VER
46          COMSTAT getComstat() const;          COMSTAT getComstat() const;
47  #endif  #endif
48          int bytesReady() const;          int bytesReady() const;
# Line 55  public: Line 57  public:
57  protected:  protected:
58                    
59          void printByte(char* description, unsigned char byte);          void printByte(char* description, unsigned char byte);
60  #ifdef _WINDOWS  #ifdef _MSC_VER
61          void openWindows();          void openWindows();
62  #else  #else
63          void openLinux();          void openLinux();

Legend:
Removed from v.46  
changed lines
  Added in v.49

  ViewVC Help
Powered by ViewVC 1.1.20