Go to the documentation of this file.
29 #ifndef __SERIALPORT_H
30 #define __SERIALPORT_H
85 ssize_t
Read (
void *
const buffer,
size_t count);
87 ssize_t
ReadFull (
void *
const buffer,
size_t count);
97 ssize_t
Write (
const void *
const buffer,
size_t count);
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
ssize_t Write(const void *const buffer, size_t count)
Write data to the port.
ssize_t Read(void *const buffer, size_t count)
Read from the port.
std::string GetStatus() const
Get the status of the port (type, device, etc).
void Open()
Open the port.
ssize_t ReadFull(void *const buffer, size_t count)
Read the requested quantity of data from the port.
void Flush()
Flush the port's input and output buffers, discarding all data.
bool IsOpen() const
Check if the port is open.
Serial implementation of the Port class.
void Close()
Close the port.
ssize_t BytesAvailableWait()
Get the number of bytes waiting after blocking for the timeout.
void Drain()
Drain the port's input and output buffers.
void SetTimeout(Timeout timeout)
Set the timeout value in milliseconds.
void SetCanWrite(bool canWrite)
Set the write permissions of the port.
void SetBaudRate(unsigned int baud)
Change the baud rate.
void SetCanRead(bool canRead)
Set the read permissions of the port.
unsigned int GetBaudRate() const
Get the current baud rate.
SerialPort(std::map< std::string, std::string > options)
ssize_t BytesAvailable()
Get the number of bytes waiting to be read at the port. Returns immediatly.
An object used to represent timeouts.