43 [[nodiscard]]
bool is_open() const noexcept;
51 std::span<
std::
byte> buffer,
53 std::
size_t& out_size) noexcept;
62 std::intptr_t fd_ = -1;
Minimal blocking host-side serial-port wrapper used by the CLI tools.
Status write_all(std::span< const std::byte > bytes) noexcept
Writes the entire byte range before returning.
PosixSerialPort & operator=(const PosixSerialPort &)=delete
Status drain_tx() noexcept
Waits until queued TX data has physically drained.
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.
bool is_open() const noexcept
Returns whether the serial port is currently open.
PosixSerialPort(const PosixSerialPort &)=delete
Status open(const PosixSerialConfig &config) noexcept
Opens and configures the serial port.
Status set_rts(bool enabled) noexcept
Sets the RTS line when the underlying driver supports it.
void close() noexcept
Closes the serial port if it is open.
PosixSerialPort()=default
Status flush_rx() noexcept
Drops unread RX data that is already buffered by the driver.
std::intptr_t native_handle() const noexcept
Returns the native handle value, or -1 when closed.
Host-side serial-port configuration used by PosixSerialPort.
std::string_view device_path
Result object returned by most public APIs.