msl.equipment.connection_serial module
Base class for equipment that is connected through a serial port.
- class msl.equipment.connection_serial.ConnectionSerial(record)[source]
Bases:
ConnectionMessageBased
Base class for equipment that is connected through a serial port.
The
properties
for a serial connection supports the following key-value pairs in the Connections Database (see alsoserial.Serial
for more details about each parameter):'baud_rate': int, the baud rate [default: 9600] 'data_bits': int, the number of data bits, e.g. 5, 6, 7, 8 [default: 8] 'dsr_dtr': bool, enable hardware (DSR/DTR) flow control [default: False] 'encoding': str, the encoding to use [default: 'utf-8'] 'encoding_errors': str, encoding error handling scheme, e.g. 'strict', 'ignore' [default: 'strict'] 'inter_byte_timeout': float or None, the inter-character timeout [default: None] 'max_read_size': int, the maximum number of bytes that can be read [default: 1 MB] 'parity': str or None, parity checking, e.g. 'even', 'odd' [default: None] 'read_termination': str or None, read until this termination sequence is found [default: '\n'] 'rstrip': bool, whether to remove trailing whitespace from "read" messages [default: False] 'rts_cts': bool, enable hardware (RTS/CTS) flow control [default: False] 'stop_bits': int or float, the number of stop bits, e.g. 1, 1.5, 2 [default: 1] 'termination': shortcut for setting both 'read_termination' and 'write_termination' to this value 'timeout': float or None, the timeout (in seconds) for read and write operations [default: None] 'write_termination': str or None, termination sequence appended to write messages [default: '\r\n'] 'xon_xoff': bool, enable software flow control [default: False]
The
backend
value must be equal toMSL
to use this class for the communication system. This is achieved by setting the value in the Backend field for a connection record in the Connections Database to beMSL
.Do not instantiate this class directly. Use the
connect()
method to connect to the equipment.- Parameters:
record (
EquipmentRecord
) – A record from an Equipment-Register Database.- Raises:
MSLConnectionError – If the serial port cannot be opened.
- property serial
The reference to the serial object.
- Type: