![]() |
NDEVR
API Documentation
|
Simulated ConnectionBackend that generates fake DeviCounter data for testing without hardware. More...
Public Member Functions | |
| uint04 | bytesAvailable () const final override |
| Returns the number of bytes available to read. | |
| void | close () final override |
| Closes the connection. | |
| bool | isOpen () const final override |
| Checks whether the connection is currently open. | |
| TranslatedString | lastError () const final override |
| Returns the last error message from this backend. | |
| bool | open (const ConnectionInfo &) final override |
| Opens the connection using the provided connection info. | |
| uint04 | peek (char *s, uint04 size=Constant< uint04 >::Max) const final override |
| Reads data from the receive buffer without consuming it. | |
| uint04 | rx (char *s, uint04 size=Constant< uint04 >::Max) final override |
| Reads and consumes data from the receive buffer. | |
| void | tx (const StringView &) final override |
| Transmits a string command over the connection. | |
| bool | waitForReadyRead (const TimeSpan &span) final override |
| Blocks until data is available to read or the timeout expires. | |
| Public Member Functions inherited from ConnectionBackend | |
| ConnectionBackend (LogPtr log) | |
| Constructs a ConnectionBackend with the given log. | |
| void | connectionStateChangedSignal (ConnectionState state) |
| Emitted when the connection state changes. | |
| void | dataAvailableSignal () |
| Emitted when data is available to be read from the connection. | |
| virtual String | threadID () const |
| Returns the thread ID this backend must execute on, if any. | |
Additional Inherited Members | |
| Protected Attributes inherited from ConnectionBackend | |
| LogPtr | m_log |
| Log for diagnostic messages. | |
Simulated ConnectionBackend that generates fake DeviCounter data for testing without hardware.
Definition at line 42 of file DeviCounterSimulator.h.
|
inlinefinaloverridevirtual |
Returns the number of bytes available to read.
Implements ConnectionBackend.
Definition at line 134 of file DeviCounterSimulator.h.
References Time::SystemTime().
|
inlinefinaloverridevirtual |
Checks whether the connection is currently open.
Implements ConnectionBackend.
Definition at line 94 of file DeviCounterSimulator.h.
|
inlinefinaloverridevirtual |
Returns the last error message from this backend.
Implements ConnectionBackend.
Definition at line 130 of file DeviCounterSimulator.h.
|
inlinefinaloverridevirtual |
Opens the connection using the provided connection info.
| [in] | request | The connection parameters. |
Implements ConnectionBackend.
Definition at line 80 of file DeviCounterSimulator.h.
References MakeRandom().
|
inlinefinaloverridevirtual |
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. |
Implements ConnectionBackend.
Definition at line 52 of file DeviCounterSimulator.h.
References getMin(), and Time::SystemTime().
|
inlinefinaloverridevirtual |
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. |
Implements ConnectionBackend.
Definition at line 61 of file DeviCounterSimulator.h.
References getMin(), and Time::SystemTime().
|
inlinefinaloverridevirtual |
Transmits a string command over the connection.
| [in] | command | The data to transmit. |
Implements ConnectionBackend.
Definition at line 75 of file DeviCounterSimulator.h.
|
inlinefinaloverridevirtual |
Blocks until data is available to read or the timeout expires.
| [in] | span | Maximum time to wait. |
Implements ConnectionBackend.
Definition at line 98 of file DeviCounterSimulator.h.
References getMin(), ThreadFunctions::RequestSleep(), and Time::SystemTime().