msl.equipment.connection_demo module
Simulate a connection to the equipment.
- class msl.equipment.connection_demo.ConnectionDemo(record, cls)[source]
Bases:
ConnectionSimulate a connection to the equipment.
Establishing a connection in demo mode is useful when developing a program and the equipment is not physically connected to a computer.
A custom logging level is used for logging messages with a connection in demo mode. The
logging.DEMOlogging level is set to be betweenlogging.INFOandlogging.WARNING.The returned data type is determined from the docstring of the called method. For example, if
:rtype: intthen anintis returned or if:rtype: int, floatthen anintand afloatare returned. Although the expected data type is returned the value(s) of the returned object is randomly generated. The docstring must be in either the reStructuredText or NumPy format.Do not instantiate this class directly. Use the
record.connect(demo=True)method to connect to the equipment in demo mode or setDEMO_MODEto beTruein the Configuration File to open all connections in demo mode.- Parameters:
record (
EquipmentRecord) – A record from an Equipment-Register Database.cls (
Connection) – AConnectionsubclass (that has NOT been instantiated).