psychos.triggers.DummyPort#
- class psychos.triggers.DummyPort(log: bool = True)[source]#
Bases:
BasePortDummy port implementation for testing and debugging.
This class simulates a port without requiring actual hardware. It logs all values that are sent, reset actions, and close operations.
Examples
>>> dummy = DummyPort(address='dummy') >>> dummy.send(128) # Logs the sending of integer 128. >>> dummy.send(b'') # Logs the sending of the byte b''. >>> dummy.reset() # Logs the reset action. >>> dummy.close() # Logs the close action.
- __init__(log: bool = True)[source]#
Initialize the DummyPort instance.
- Parameters:
address (str) – A dummy address identifier.
**kwargs – Additional keyword arguments (ignored).
Methods
__init__([log])Initialize the DummyPort instance.
close()Log the action of closing the port.
encode(value)Encode a value to send through the port.
reset()Log the action of resetting the port.
send(value)Log the value that would be sent over the port.
- close()[source]#
Log the action of closing the port.
This method simulates closing the port connection.
- reset()[source]#
Log the action of resetting the port.
This method simulates resetting the port to a known, idle state.