22 #include <sys/ioctl.h> 24 #include "PassiveTimer.h" 48 ComSpeed19200 = B19200,
49 ComSpeed38400 = B38400,
50 ComSpeed57600 = B57600,
51 ComSpeed115200 = B115200,
52 ComSpeed230400 = B230400,
53 ComSpeed460800 = B460800,
54 ComSpeed500000 = B500000,
55 ComSpeed576000 = B576000,
56 ComSpeed921600 = B921600,
57 ComSpeed1000000 = B1000000,
58 ComSpeed1152000 = B1152000,
59 ComSpeed1500000 = B1500000,
60 ComSpeed2000000 = B2000000,
61 ComSpeed2500000 = B2500000,
62 ComSpeed3000000 = B3000000,
63 ComSpeed3500000 = B3500000,
64 ComSpeed4000000 = B4000000
88 ComPort(
const std::string& comDevice,
bool nocreate =
false );
91 inline std::string getDevice()
96 void setSpeed( Speed s );
97 void setSpeed(
const std::string& speed );
98 Speed getSpeed()
const;
100 static Speed getSpeed(
const std::string& s );
101 static std::string getSpeed( Speed s );
103 void setParity(Parity);
104 void setCharacterSize(CharacterSize);
105 void setStopBits(StopBits sBit);
107 virtual void setTimeout( timeout_t msec );
108 timeout_t getTimeout()
const;
110 void setWaiting(
bool waiting);
112 virtual unsigned char receiveByte();
113 virtual void sendByte(
unsigned char x);
115 virtual size_t receiveBlock(
unsigned char* msg,
size_t len );
116 virtual ssize_t sendBlock(
unsigned char* msg,
size_t len );
118 void setBlocking(
bool blocking);
120 virtual void cleanupChannel();
121 virtual void reopen();
126 static const size_t BufSize = 8192;
127 unsigned char buf[BufSize];
128 ssize_t curSym = { 0 };
129 ssize_t bufLength = { 0 };
131 timeout_t uTimeout = { 0 };
132 bool waiting = {
false };
133 Speed speed = ComSpeed38400;
134 std::string dev = {
"" };
136 virtual unsigned char m_receiveByte(
bool wait );
139 struct termios oldTermios;
Definition: CommonEventLoop.h:14