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