|
OpenSRX 0.1.0
C++ library for interfacing with Keyence SR series barcode readers
|
Communication interface using an RS-232 serial port. More...
#include <SerialInterface.hpp>
Public Member Functions | |
| SerialInterface (std::string port="/dev/ttyUSB0", int baudRate=115200, DataBits dataBits=DataBits::EIGHT, Parity parity=Parity::EVEN, StopBits stopBits=StopBits::ONE, FlowControl flowControl=FlowControl::NONE) | |
| Open a serial port connection. | |
| ~SerialInterface () override | |
| std::string | describe () const override |
| Return a human-readable description of this interface. | |
Public Member Functions inherited from OpenSRX::AsioInterface< asio::serial_port > | |
| ~AsioInterface () override=default | |
| std::string | sendCommand (const std::string &command) override |
| Sends a command over the Asio stream and reads the response. | |
| std::string | sendCommandUnlocked (const std::string &command) override |
| Sends a command without acquiring the communication mutex. | |
Public Member Functions inherited from OpenSRX::ICommInterface | |
| virtual | ~ICommInterface ()=default |
| void | setCommFormat (CommFormat format) |
| Set the communication framing format. | |
| CommFormat | getCommFormat () |
| Get the current communication framing format. | |
Private Attributes | |
| std::string | port |
| Serial device path. | |
Additional Inherited Members | |
Protected Member Functions inherited from OpenSRX::AsioInterface< asio::serial_port > | |
| AsioInterface (Args &&... args) | |
| Construct an AsioInterface, forwarding arguments to the stream. | |
Protected Attributes inherited from OpenSRX::AsioInterface< asio::serial_port > | |
| asio::io_context | ioContext |
| asio::serial_port | stream |
Protected Attributes inherited from OpenSRX::ICommInterface | |
| std::mutex | commMutex |
| Mutex to ensure thread-safe access to the communixcation interface. | |
Communication interface using an RS-232 serial port.
Wraps an Asio serial_port with configurable baud rate, data bits, parity, stop bits, and flow control.
| OpenSRX::SerialInterface::SerialInterface | ( | std::string | port = "/dev/ttyUSB0", |
| int | baudRate = 115200, | ||
| DataBits | dataBits = DataBits::EIGHT, | ||
| Parity | parity = Parity::EVEN, | ||
| StopBits | stopBits = StopBits::ONE, | ||
| FlowControl | flowControl = FlowControl::NONE ) |
Open a serial port connection.
| port | Serial device path (e.g. "/dev/ttyUSB0"). |
| baudRate | Baud rate (e.g. 115200). |
| dataBits | Number of data bits per character. |
| parity | Parity checking mode. |
| stopBits | Number of stop bits. |
| flowControl | Flow control mode. |
|
override |
|
inlineoverridevirtual |
Return a human-readable description of this interface.
Implements OpenSRX::ICommInterface.
|
private |
Serial device path.