msl.equipment.connection_zeromq module
Base class for equipment that use the ZeroMQ communication protocol.
- class msl.equipment.connection_zeromq.ConnectionZeroMQ(record)[source]
Bases:
ConnectionMessageBased
Base class for equipment that use the ZeroMQ communication protocol.
The
properties
for a ZeroMQ connection supports the following key-value pairs in the Connections Database:'encoding': str, the encoding to use [default: 'utf-8'] 'encoding_errors': str, encoding error handling scheme, e.g. 'strict', 'ignore' [default: 'strict'] 'max_read_size': int, the maximum number of bytes that can be read [default: 1 MB] 'protocol': str, the ZeroMQ protocol [default: 'tcp'] 'rstrip': bool, whether to remove trailing whitespace from "read" messages [default: False] 'socket_type': str, the ZeroMQ socket type [default: 'REQ'] 'timeout': float or None, the timeout (in seconds) for read and write operations [default: None]
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 socket cannot be opened.
- static parse_address(address)[source]
Parse the address for valid ZeroMQ fields.
- Parameters:
address (
str
) – The address of aConnectionRecord
.- Returns:
dict
orNone
– The host and port number of the device orNone
if address is not valid for a ZeroMQ connection.