|
| void | Open () |
| | Open the port. More...
|
| |
|
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.
|
| |
| virtual ssize_t | ReadString (std::string &buffer) |
| | Read a string. More...
|
| |
| virtual ssize_t | ReadUntil (void *const buffer, size_t count, uint8_t terminator) |
| | Read data until a specified termination byte is received. More...
|
| |
| virtual ssize_t | ReadStringUntil (std::string &buffer, char terminator) |
| | Read a string until the specified termination character is received. More...
|
| |
| virtual ssize_t | ReadLine (char *const buffer, size_t count) |
| | Read a new-line terminated string of data. More...
|
| |
| virtual ssize_t | ReadLine (std::string &buffer) |
| | Read a new-line terminated string of data. More...
|
| |
| virtual ssize_t | Skip (size_t count) |
| | Dump data until the specified number of bytes have been read. More...
|
| |
| virtual ssize_t | SkipUntil (uint8_t terminator, unsigned int count) |
| | Read and dump data until the specified termination character has been seen count times. More...
|
| |
| virtual ssize_t | WriteFull (const void *const buffer, size_t count) |
| | Write all the data to the port. More...
|
| |
| virtual ssize_t | WriteString (const char *const buffer) |
| | Write a string to the port. More...
|
| |
|
std::string | GetPortType () const |
| | Get the port type.
|
| |
|
void | SetDebug (int debug) |
| | Set the debug level.
|
| |
|
int | GetDebug () const |
| | Get the debug level.
|
| |
|
virtual Timeout | GetTimeout () const |
| | Get the timeout.
|
| |
|
virtual bool | IsBlocking () const |
| | Get the blocking property of the port. If the timeout is non-zero, the port will block.
|
| |
|
virtual bool | CanRead () const |
| | Get the read permissions of the port.
|
| |
|
virtual bool | CanWrite () const |
| | Get the write permissions of the port.
|
| |
TCP implementation of the Port class.
See the Port class documentation for how to use the common API.
- Options
- ip <string>
- IP address to connect to. If listen is true, set to "*" to listen on any interface.
- Default: 127.0.0.1
- port <integer>
- TCP port to connect to/listen on.
- Default: 20000
- listen
- Listen on the specified port rather than connecting to it. Other network applications can connect and send data, which will become available as normal.
- Default: off