stoner_measurement.instruments.transport.serial_transport.EchoSerialTransport

class stoner_measurement.instruments.transport.serial_transport.EchoSerialTransport(port: str, *, response_suffixes: tuple[bytes, ...] = (), baud_rate: int = 9600, data_bits: int = 8, stop_bits: float = 1, parity: str = 'N', xonxoff: bool = False, rtscts: bool = False, timeout: float = 2.0)[source]

Bases: SerialTransport

Serial transport with character-at-a-time return-echo handshaking.

Some instruments require each transmitted byte to be echoed before the host sends the next byte. Optional response suffixes support protocols where a normal terminator is followed by a fixed-length prompt or status token. All configured suffixes must have the same length.

read(num_bytes: int | None = None) → bytes[source]

Read a normal frame plus one configured trailing response suffix.

write(data: bytes, slow: int | None = None) → int[source]

Write one byte at a time and verify each returned echo.