RFC2217

class serialx.platforms.serial_rfc2217.RFC2217Serial

Bases: SocketSerial

RFC 2217 serial port implementation (Synchronous).

__init__(*args, receive_buffer_size=4096, connect_timeout=5.0, **kwargs)

Initialize the RFC 2217 serial port.

Parameters:
  • args (Any)

  • receive_buffer_size (int)

  • connect_timeout (float)

  • kwargs (Any)

Return type:

None

num_unread_bytes()

Return the number of buffered serial data bytes waiting to be read.

Return type:

int

class serialx.platforms.serial_rfc2217.RFC2217SerialTransport

Bases: BaseSerialTransport

Async RFC 2217 serial transport over TCP.

__init__(loop, protocol)

Initialize the RFC 2217 serial transport.

Parameters:
  • loop (AbstractEventLoop)

  • protocol (Protocol)

Return type:

None

write(data)

Write data to the serial port, escaping IAC bytes.

Parameters:

data (bytes | bytearray | memoryview)

Return type:

None

async get_modem_pins()

Return modem pin state from the last NOTIFY-MODEMSTATE.

Return type:

ModemPins

pause_reading()

Pause reading from the TCP transport.

Return type:

None

resume_reading()

Resume reading from the TCP transport.

Return type:

None

close()

Close the transport.

Return type:

None

abort()

Abort the transport immediately.

Return type:

None

async flush()

Flush write buffers (no-op, TCP transport handles buffering).

Return type:

None

get_write_buffer_size()

Get the number of bytes currently in the write buffer.

Return type:

int

get_write_buffer_limits()

Get the write buffer low and high water marks.

Return type:

tuple[int, int]

set_write_buffer_limits(high=None, low=None)

Set the write buffer low and high water marks.

Parameters:
  • high (int | None)

  • low (int | None)

Return type:

None

can_write_eof()

Return whether the underlying TCP transport supports EOF.

Return type:

bool