|
MC Protocol Serial C++ 0.2.3
MC protocol serial library for MCU-oriented environments
|
Minimal blocking host-side serial-port wrapper used by the CLI tools. More...
#include <posix_serial.hpp>
Public Member Functions | |
| PosixSerialPort ()=default | |
| ~PosixSerialPort () | |
| PosixSerialPort (const PosixSerialPort &)=delete | |
| PosixSerialPort & | operator= (const PosixSerialPort &)=delete |
| Status | open (const PosixSerialConfig &config) noexcept |
| Opens and configures the serial port. | |
| void | close () noexcept |
| Closes the serial port if it is open. | |
| bool | is_open () const noexcept |
| Returns whether the serial port is currently open. | |
| std::intptr_t | native_handle () const noexcept |
Returns the native handle value, or -1 when closed. | |
| Status | write_all (std::span< const std::byte > bytes) noexcept |
| Writes the entire byte range before returning. | |
| Status | read_some (std::span< std::byte > buffer, int timeout_ms, std::size_t &out_size) noexcept |
Reads up to buffer.size() bytes with a timeout. | |
| Status | flush_rx () noexcept |
| Drops unread RX data that is already buffered by the driver. | |
| Status | drain_tx () noexcept |
| Waits until queued TX data has physically drained. | |
| Status | set_rts (bool enabled) noexcept |
| Sets the RTS line when the underlying driver supports it. | |
Minimal blocking host-side serial-port wrapper used by the CLI tools.
This class is not required on MCU targets. It exists so the same request/response codec and client logic can be exercised from host-side validation tools.
Definition at line 29 of file posix_serial.hpp.
|
default |
| mcprotocol::serial::PosixSerialPort::~PosixSerialPort | ( | ) |
|
delete |
|
noexcept |
Closes the serial port if it is open.
|
noexcept |
Waits until queued TX data has physically drained.
|
noexcept |
Drops unread RX data that is already buffered by the driver.
|
noexcept |
Returns whether the serial port is currently open.
|
noexcept |
Returns the native handle value, or -1 when closed.
|
noexcept |
Opens and configures the serial port.
|
delete |
|
noexcept |
Reads up to buffer.size() bytes with a timeout.
|
noexcept |
Sets the RTS line when the underlying driver supports it.
|
noexcept |
Writes the entire byte range before returning.