Windows¶
- class serialx.platforms.serial_win32.Win32Serial¶
Bases:
BaseSerialWindows serial port implementation using Win32 API.
- __init__(*args, handle=None, inter_byte_timeout=0.01, read_buffer_size=4096, write_buffer_size=4096, **kwargs)¶
Initialize the Windows serial port.
- Parameters:
args (Any)
handle (int | None)
inter_byte_timeout (float)
read_buffer_size (int)
write_buffer_size (int)
kwargs (Any)
- Return type:
None
- property is_open: bool¶
Check if the serial port is open.
- fileno()¶
Return the file descriptor.
- Return type:
int
- num_unread_bytes()¶
Return the number of bytes waiting to be read.
- Return type:
int
- num_unwritten_bytes()¶
Return the number of bytes waiting to be written.
- Return type:
int
- class serialx.platforms.serial_win32.Win32SerialTransport¶
Bases:
BaseSerialTransportWindows serial transport using ProactorEventLoop.
- __init__(loop, protocol)¶
Initialize the Windows serial transport.
- Parameters:
loop (AbstractEventLoop)
protocol (Protocol)
- Return type:
None
- serial_close()¶
Close the serial port.
- Return type:
None
- serial_shutdown(how)¶
Shutdown the serial connection.
- Parameters:
how (int)
- Return type:
None
- serial_fileno()¶
Return the file descriptor.
- Return type:
int
- protocol_data_received(data)¶
Forward data_received to the protocol.
- Parameters:
data (bytes)
- Return type:
None
- protocol_connection_made(transport)¶
Forward connection_made to the protocol.
- Parameters:
transport (Transport)
- Return type:
None
- protocol_connection_lost(exc)¶
Forward connection_lost to the protocol.
- Parameters:
exc (Exception | None)
- Return type:
None
- protocol_pause_writing()¶
Forward pause_writing to the protocol.
- Return type:
None
- protocol_resume_writing()¶
Forward resume_writing to the protocol.
- Return type:
None
- get_write_buffer_size()¶
Return the current size of the write buffer.
- Return type:
int
- get_write_buffer_limits()¶
Return the write buffer limits.
- Return type:
tuple[int, int]
- set_write_buffer_limits(high=None, low=None)¶
Set the write buffer limits.
- Parameters:
high (int | None)
low (int | None)
- Return type:
None
- write(data)¶
Write data to the transport.
- Parameters:
data (bytes | bytearray | memoryview)
- Return type:
None
- close()¶
Close the transport.
- Return type:
None
- abort()¶
Abort the transport immediately.
- Return type:
None
- pause_reading()¶
Pause reading from the transport.
- Return type:
None
- resume_reading()¶
Resume reading from the transport.
- Return type:
None
- set_protocol(protocol)¶
Set the protocol.
- Parameters:
protocol (Protocol)
- Return type:
None
- async flush()¶
Flush write buffers, waiting until all data is written.
- Return type:
None
- serialx.platforms.serial_win32.win32_list_serial_ports()¶
List available serial ports on Windows.
- Return type:
list[SerialPortInfo]