Object Component Manager
This module implements an abstract component manager for simple object components.
- class ObjectComponentManager(component, logger, communication_state_callback, component_state_callback)
An abstract component manager for a component that is an object in this process.
The base component manager is a very general class that allows for management of remote components to which communication may need to be established and maintained. In cases where the component is simply an object running in the same process as its component manager (for example, a simple simulator), such complexity is not needed. This class eliminates that complexity, providing a basic framework for these simple component managers.
- __init__(component, logger, communication_state_callback, component_state_callback)
Initialise a new instance.
- Parameters:
component (
ObjectComponent
) – the component managed by this component managerlogger (
Logger
) – a logger for this object to usecommunication_state_callback (
Callable
[[CommunicationStatus
],None
]) – callback to be called when the status of the communications channel between the component manager and its component changescomponent_state_callback (
Callable
[...
,None
]) – callback to be called when the component state changes.
- off(task_callback=None)
Turn the component off.
- on(task_callback=None)
Turn the component on.
- reset(task_callback=None)
Reset the component.
- simulate_communication_failure(fail_communicate)
Simulate (or stop simulating) a failure to communicate with the component.
- standby(task_callback=None)
Put the component into low-power standby mode.
- start_communicating()
Establish communication with the component, then start monitoring.
- Raises:
ConnectionError – if the attempt to establish communication with the channel fails.
- Return type: