Serial-TCP/IPbridge
1.0
|
Serial connection (via a serial port). More...
#include <serial_connection.h>
Public Member Functions | |
SerialConnection (const SerialConfig &config) | |
Constructor. More... | |
virtual | ~SerialConnection () |
Destructor. More... | |
virtual void | close () |
Closes an established TCP connection. More... | |
Public Member Functions inherited from Connection | |
Connection (const Config &config, time_t timeout) | |
Constructor. More... | |
virtual | ~Connection () |
Destructor. More... | |
std::string | tryReceiveMessage () |
Tries to receive a message from a client. More... | |
size_t | trySendMessage (const std::string &message) |
Tries to send a message to the client. More... | |
Private Member Functions | |
virtual std::string | doReceiveMessage (Config::LengthFieldMessageLength messageLength) |
Receives a message. More... | |
virtual size_t | doSendMessage (const std::string &message) |
Sends the selected message. More... | |
SerialConnection (const SerialConnection &) | |
SerialConnection & | operator= (const SerialConnection &) |
Private Attributes | |
int | _serialFd |
File descriptor to the serial port. More... | |
Serial connection (via a serial port).
It provides reference semantics (objects copying and comparison is NOT allowed).
SerialConnection::SerialConnection | ( | const SerialConfig & | config | ) |
Constructor.
config | Connection configuration. |
|
virtual |
Destructor.
|
private |
|
virtual |
Closes an established TCP connection.
If the connection is not established, nothing will happen.
Implements Connection.
|
privatevirtual |
Receives a message.
messageLength | Length of the message. |
This operation should be nonblocking.
If there is some error, ConnectionError will be thrown. If the connection is closed, ConnectionClosed will be thrown.
Implements Connection.
|
privatevirtual |
Sends the selected message.
message | Message to be sent. |
This operation should be nonblocking.
If there is some error, ConnectionError will be thrown. If the connection is closed, ConnectionClosed will be thrown.
Implements Connection.
|
private |
|
private |
File descriptor to the serial port.