Component Manager
This module implements a functionality for component managers in SAT.LMC.
- class SatComponentManager(logger, communication_status_callback=None, component_state_callback=None, **kwargs)
A component manager for Sat LMC.
Therefore this class accepts two callback arguments: one for when communication with the component changes and one for when the component state changes. In the last case, callback hooks are provided so that the component can indicate the change to this component manager.
- __init__(logger, communication_status_callback=None, component_state_callback=None, **kwargs)
Initialise a new instance.
- Parameters:
logger (
Logger
) – a logger for this object to usecommunication_status_callback (
Optional
[Callable
[[CommunicationStatus
],None
]]) – callback to be called when the state of communications between the component manager and its component changes.component_state_callback (
Optional
[Callable
[[bool
],None
]]) – callback to be called when the state of the component changes.kwargs (
Any
) – other keyword args
- abort_commands(task_callback=None)
Abort all tasks queued & running.
- property communication_status: CommunicationStatus
Return the communication status of this component manager.
This is implemented as a replacement for the
is_communicating
property, which should be deprecated.- Returns:
status of the communication channel with the component.
- component_state_changed(fault)
Handle notification that the component’s fault status has changed.
This is a callback hook, to be passed to the managed component.
- property fault: bool | None
Return whether this component manager is currently experiencing a fault.
- Returns:
whether this component manager is currently experiencing a fault.
- property is_communicating: bool
Return communication with the component is established.
SatLmc uses the more expressive
communication_status
for this, but this is still needed as a base classes hook.- Returns:
whether communication with the component is established.
- off(task_callback=None)
Turn the component off.
- on(task_callback=None)
Turn the component on.
- reset(task_callback=None)
Reset the component (from fault state).
- standby(task_callback=None)
Put the component into low-power standby mode.
- update_communication_status(communication_status)
Handle a change in communication state.
This is a helper method for use by subclasses.
- Parameters:
communication_status (
CommunicationStatus
) – the new communication status of the component manager.- Return type:
- update_component_state(fault)
Update the component fault status, calling callbacks as required.
This is a helper method for use by subclasses.