msl.equipment.connection_demo module
Simulate a connection to the equipment.
- class msl.equipment.connection_demo.ConnectionDemo(record, cls)[source]
Bases:
Connection
Simulate 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.DEMO
logging level is set to be betweenlogging.INFO
andlogging.WARNING
.The returned data type is determined from the docstring of the called method. For example, if
:rtype: int
then anint
is returned or if:rtype: int, float
then anint
and afloat
are 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_MODE
to beTrue
in the Configuration File to open all connections in demo mode.- Parameters:
record (
EquipmentRecord
) – A record from an Equipment-Register Database.cls (
Connection
) – AConnection
subclass (that has NOT been instantiated).