Flexiport 2.0.0
|
Serial implementation of the Port class. More...
#include <flexiport/serialport.h>
Public Member Functions | |
SerialPort (std::map< std::string, std::string > options) | |
~SerialPort () | |
void | Open () |
Open the port. | |
void | Close () |
Close the port. | |
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. | |
ssize_t | BytesAvailable () |
Get the number of bytes waiting to be read at the port. Returns immediatly. | |
ssize_t | BytesAvailableWait () |
Get the number of bytes waiting after blocking for the timeout. | |
ssize_t | Write (const void *const buffer, size_t count) |
Write data to the port. | |
void | Flush () |
Flush the port's input and output buffers, discarding all data. | |
void | Drain () |
Drain the port's input and output buffers. | |
std::string | GetStatus () const |
Get the status of the port (type, device, etc). | |
void | SetTimeout (Timeout timeout) |
Set the timeout value in milliseconds. | |
void | SetCanRead (bool canRead) |
Set the read permissions of the port. | |
void | SetCanWrite (bool canWrite) |
Set the write permissions of the port. | |
bool | IsOpen () const |
Check if the port is open. | |
void | SetBaudRate (unsigned int baud) |
Change the baud rate. | |
unsigned int | GetBaudRate () const |
Get the current baud rate. |
Serial implementation of the Port class.
See the Port class documentation for how to use the common API.
Definition at line 74 of file serialport.h.
flexiport::SerialPort::SerialPort | ( | std::map< std::string, std::string > | options | ) |
flexiport::SerialPort::~SerialPort | ( | ) |
ssize_t flexiport::SerialPort::BytesAvailable | ( | ) | [virtual] |
Get the number of bytes waiting to be read at the port. Returns immediatly.
Implements flexiport::Port.
ssize_t flexiport::SerialPort::BytesAvailableWait | ( | ) | [virtual] |
Get the number of bytes waiting after blocking for the timeout.
Implements flexiport::Port.
void flexiport::SerialPort::Close | ( | ) | [virtual] |
Close the port.
Implements flexiport::Port.
void flexiport::SerialPort::Drain | ( | ) | [virtual] |
Drain the port's input and output buffers.
Implements flexiport::Port.
void flexiport::SerialPort::Flush | ( | ) | [virtual] |
Flush the port's input and output buffers, discarding all data.
Implements flexiport::Port.
unsigned int flexiport::SerialPort::GetBaudRate | ( | ) | const [inline] |
Get the current baud rate.
Definition at line 116 of file serialport.h.
std::string flexiport::SerialPort::GetStatus | ( | ) | const [virtual] |
Get the status of the port (type, device, etc).
Reimplemented from flexiport::Port.
bool flexiport::SerialPort::IsOpen | ( | ) | const [inline, virtual] |
void flexiport::SerialPort::Open | ( | ) | [virtual] |
Open the port.
Implements flexiport::Port.
ssize_t flexiport::SerialPort::Read | ( | void *const | buffer, |
size_t | count | ||
) | [virtual] |
Read from the port.
Implements flexiport::Port.
ssize_t flexiport::SerialPort::ReadFull | ( | void *const | buffer, |
size_t | count | ||
) | [virtual] |
Read the requested quantity of data from the port.
Implements flexiport::Port.
void flexiport::SerialPort::SetBaudRate | ( | unsigned int | baud | ) |
Change the baud rate.
void flexiport::SerialPort::SetCanRead | ( | bool | canRead | ) | [virtual] |
Set the read permissions of the port.
Implements flexiport::Port.
void flexiport::SerialPort::SetCanWrite | ( | bool | canWrite | ) | [virtual] |
Set the write permissions of the port.
Implements flexiport::Port.
void flexiport::SerialPort::SetTimeout | ( | Timeout | timeout | ) | [virtual] |
Set the timeout value in milliseconds.
Implements flexiport::Port.
ssize_t flexiport::SerialPort::Write | ( | const void *const | buffer, |
size_t | count | ||
) | [virtual] |
Write data to the port.
Implements flexiport::Port.