64 TCPPort (std::map<std::string, std::string> options);
76 ssize_t
Read (
void *
const buffer,
size_t count);
78 ssize_t
ReadFull (
void *
const buffer,
size_t count);
84 ssize_t
Write (
const void *
const buffer,
size_t count);
98 bool IsOpen ()
const {
return _open; }
109 void CheckPort (
bool read);
111 bool ProcessOption (
const std::string &option,
const std::string &value);
114 void WaitForConnection ();
115 typedef enum {TIMED_OUT, DATA_AVAILABLE, CAN_WRITE} WaitStatus;
116 WaitStatus WaitForDataOrTimeout ();
117 bool IsDataAvailable ();
118 WaitStatus WaitForWritableOrTimeout ();
119 void SetSocketBlockingFlag ();
TCP implementation of the Port class.
ssize_t Read(void *const buffer, size_t count)
Read from the port.
TCPPort(std::map< std::string, std::string > options)
void SetCanWrite(bool canWrite)
Set the write permissions of the port.
void Close()
Close the port.
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 ReadFull(void *const buffer, size_t count)
Read the requested quantity of data from the port.
void Drain()
Drain the port's input and output buffers.
ssize_t BytesAvailable()
Get the number of bytes waiting to be read at the port. Returns immediatly.
void SetTimeout(Timeout timeout)
Set the timeout value in milliseconds.
std::string GetStatus() const
Get the status of the port (type, device, etc).
ssize_t BytesAvailableWait()
Get the number of bytes waiting after blocking for the timeout.
void Open()
Open the port.
ssize_t Write(const void *const buffer, size_t count)
Write data to the port.
bool IsOpen() const
Check if the port is open.
An object used to represent timeouts.