CARMA C++
SerialClient.h
Go to the documentation of this file.
1 #ifndef SZA_UTIL_SERIALCLIENT_H
2 #define SZA_UTIL_SERIALCLIENT_H
3 
11 #include "carma/szautil/Port.h"
12 
13 #include <termios.h>
14 
15 namespace sza {
16  namespace util {
17 
18  class SerialClient : public Port {
19  public:
20 
24  SerialClient(std::string port="/dev/ttyS0", int baudRate=9600,
25  bool canonical=false, bool sevenBit=false);
26 
30  virtual ~SerialClient();
31 
35  virtual void setPort(std::string port);
36 
40  void setBaudRate(int baudRate);
41 
45  virtual int connect();
46  int connectWx();
47 
51  void disconnect();
52 
53  std::string portName();
54 
55  void setFd(int fd);
56 
57  private:
58 
59  //------------------------------------------------------------
60  // Static arrays
61  //------------------------------------------------------------
62 
63  bool ownFd_;
64 
68  struct BaudRate {
69  speed_t speed;
70  int baudRate;
71  };
72 
76  static BaudRate baudRates_[];
77 
81  static unsigned nBaudRates_;
82 
83  protected:
87  std::string portName_;
88 
89  private:
93  BaudRate* baudRate_;
94 
98  bool canonical_;
99 
103  bool sevenBit_;
104 
105  }; // End class SerialClient
106 
107  } // End namespace util
108 } // End namespace sza
109 
110 
111 
112 #endif // End #ifndef SZA_UTIL_SERIALCLIENT_H
Tagged: Mon May 10 16:41:20 PDT 2004.