![]() |
NDEVR
API Documentation
|
Provides the unseen backend logic for setting up, tearing down, and sending data over a specific type of connection. More...
Public Member Functions | |
| ConnectionBackend (LogPtr log) | |
| Constructs a ConnectionBackend with the given log. | |
| virtual uint04 | bytesAvailable () const =0 |
| Returns the number of bytes available to read. | |
| virtual void | close ()=0 |
| Closes the connection. | |
| void | connectionStateChangedSignal (ConnectionState state) |
| Emitted when the connection state changes. | |
| void | dataAvailableSignal () |
| Emitted when data is available to be read from the connection. | |
| virtual bool | isOpen () const =0 |
| Checks whether the connection is currently open. | |
| virtual TranslatedString | lastError () const =0 |
| Returns the last error message from this backend. | |
| virtual bool | open (const ConnectionInfo &request)=0 |
| Opens the connection using the provided connection info. | |
| virtual uint04 | peek (char *s, uint04 size=Constant< uint04 >::Max) const =0 |
| Reads data from the receive buffer without consuming it. | |
| virtual uint04 | rx (char *s, uint04 max_size=Constant< uint04 >::Max)=0 |
| Reads and consumes data from the receive buffer. | |
| virtual String | threadID () const |
| Returns the thread ID this backend must execute on, if any. | |
| virtual void | tx (const StringView &command)=0 |
| Transmits a string command over the connection. | |
| virtual bool | waitForReadyRead (const TimeSpan &span)=0 |
| Blocks until data is available to read or the timeout expires. | |
Protected Attributes | |
| LogPtr | m_log |
| Log for diagnostic messages. | |
Provides the unseen backend logic for setting up, tearing down, and sending data over a specific type of connection.
Definition at line 168 of file Connection.h.
| ConnectionBackend::ConnectionBackend | ( | LogPtr | log | ) |
Constructs a ConnectionBackend with the given log.
| [in] | log | The log for diagnostic messages. |
|
pure virtual |
Returns the number of bytes available to read.
Implemented in BluetoothConnection, DeviCounterSimulatorIO, SerialPortConnection, and SocketConnection.
| void ConnectionBackend::connectionStateChangedSignal | ( | ConnectionState | state | ) |
Emitted when the connection state changes.
| [in] | state | The new connection state. |
|
pure virtual |
Checks whether the connection is currently open.
Implemented in BluetoothConnection, DeviCounterSimulatorIO, SerialPortConnection, and SocketConnection.
|
pure virtual |
Returns the last error message from this backend.
Implemented in BluetoothConnection, DeviCounterSimulatorIO, SerialPortConnection, and SocketConnection.
|
pure virtual |
Opens the connection using the provided connection info.
| [in] | request | The connection parameters. |
Implemented in BluetoothConnection, DeviCounterSimulatorIO, SerialPortConnection, and SocketConnection.
|
pure virtual |
Reads data from the receive buffer without consuming it.
| [in] | s | The buffer to write peeked data into. |
| [in] | size | Maximum number of bytes to peek. |
Implemented in BluetoothConnection, DeviCounterSimulatorIO, SerialPortConnection, and SocketConnection.
|
pure virtual |
Reads and consumes data from the receive buffer.
| [in] | s | The buffer to write received data into. |
| [in] | max_size | Maximum number of bytes to read. |
Implemented in BluetoothConnection, DeviCounterSimulatorIO, SerialPortConnection, and SocketConnection.
|
inlinevirtual |
Returns the thread ID this backend must execute on, if any.
Reimplemented in SerialPortConnection.
Definition at line 231 of file Connection.h.
|
pure virtual |
Transmits a string command over the connection.
| [in] | command | The data to transmit. |
Implemented in BluetoothConnection, DeviCounterSimulatorIO, SerialPortConnection, and SocketConnection.
|
pure virtual |
Blocks until data is available to read or the timeout expires.
| [in] | span | Maximum time to wait. |
Implemented in BluetoothConnection, DeviCounterSimulatorIO, SerialPortConnection, and SocketConnection.