Abstract interface for communicating with a scanner.
More...
#include <ICommInterface.hpp>
|
| virtual | ~ICommInterface ()=default |
| |
| virtual std::string | sendCommand (const std::string &command)=0 |
| | Send a command and return the response (thread-safe).
|
| |
| virtual std::string | sendCommandUnlocked (const std::string &command)=0 |
| | Send a command and return the response without locking.
|
| |
| virtual std::string | describe () const =0 |
| | Return a human-readable description of this interface.
|
| |
| void | setCommFormat (CommFormat format) |
| | Set the communication framing format.
|
| |
| CommFormat | getCommFormat () |
| | Get the current communication framing format.
|
| |
|
| std::mutex | commMutex |
| | Mutex to ensure thread-safe access to the communixcation interface.
|
| |
|
| std::string | stripEcho (const std::string &response, const std::string &command) |
| | Strip a command echo from the start of a response.
|
| |
| std::string | addHeaderAndTerminator (const std::string &command) |
| | Wrap a command string with the appropriate header and terminator.
|
| |
Abstract interface for communicating with a scanner.
Provides send/receive primitives and framing configuration. Concrete implementations include SerialInterface, SocketInterface, and test mocks.
◆ ~ICommInterface()
| virtual OpenSRX::ICommInterface::~ICommInterface |
( |
| ) |
|
|
virtualdefault |
◆ addHeaderAndTerminator()
| std::string OpenSRX::ICommInterface::addHeaderAndTerminator |
( |
const std::string & | command | ) |
|
|
private |
Wrap a command string with the appropriate header and terminator.
- Parameters
-
| command | The bare command string. |
- Returns
- The framed command ready to send on the wire.
◆ describe()
| virtual std::string OpenSRX::ICommInterface::describe |
( |
| ) |
const |
|
pure virtual |
◆ getCommFormat()
| CommFormat OpenSRX::ICommInterface::getCommFormat |
( |
| ) |
|
|
inline |
Get the current communication framing format.
- Returns
- The active CommFormat.
◆ sendCommand()
| virtual std::string OpenSRX::ICommInterface::sendCommand |
( |
const std::string & | command | ) |
|
|
pure virtual |
◆ sendCommandUnlocked()
| virtual std::string OpenSRX::ICommInterface::sendCommandUnlocked |
( |
const std::string & | command | ) |
|
|
pure virtual |
◆ setCommFormat()
| void OpenSRX::ICommInterface::setCommFormat |
( |
CommFormat | format | ) |
|
Set the communication framing format.
- Parameters
-
◆ stripEcho()
| std::string OpenSRX::ICommInterface::stripEcho |
( |
const std::string & | response, |
|
|
const std::string & | command ) |
|
private |
Strip a command echo from the start of a response.
- Parameters
-
| response | The raw response string. |
| command | The command that was sent. |
- Returns
- The response with any leading echo removed.
◆ AsioInterface
template<typename StreamT>
◆ MockCommInterface
| friend class MockCommInterface |
|
friend |
◆ commFormat
◆ commMutex
| std::mutex OpenSRX::ICommInterface::commMutex |
|
protected |
Mutex to ensure thread-safe access to the communixcation interface.
◆ inTermStr
| std::string OpenSRX::ICommInterface::inTermStr = "\r" |
|
private |
Expected response terminator string.
The documentation for this class was generated from the following file: