29 #ifndef __SERIALPORT_H
30 #define __SERIALPORT_H
77 SerialPort (std::map<std::string, std::string> options);
85 ssize_t Read (
void *
const buffer,
size_t count);
87 ssize_t ReadFull (
void *
const buffer,
size_t count);
89 ssize_t BytesAvailable ();
95 ssize_t BytesAvailableWait ();
97 ssize_t Write (
const void *
const buffer,
size_t count);
103 std::string GetStatus ()
const;
105 void SetTimeout (
Timeout timeout);
107 void SetCanRead (
bool canRead);
109 void SetCanWrite (
bool canWrite);
114 void SetBaudRate (
unsigned int baud);
127 unsigned int _dataBits;
128 unsigned int _stopBits;
129 typedef enum {PAR_NONE, PAR_EVEN, PAR_ODD} Parity;
134 void CheckPort (
bool read);
135 bool ProcessOption (
const std::string &option,
const std::string &value);
137 bool IsDataAvailable ();
139 typedef enum {TIMED_OUT, DATA_AVAILABLE, CAN_WRITE} WaitStatus;
140 WaitStatus WaitForDataOrTimeout ();
141 WaitStatus WaitForWritableOrTimeout ();
143 void SetPortSettings ();
144 void SetPortTimeout ();
151 #endif // __SERIALPORT_H
bool IsOpen() const
Check if the port is open.
Serial implementation of the Port class.
unsigned int GetBaudRate() const
Get the current baud rate.
An object used to represent timeouts.