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 use

  • communication_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.

Parameters:

task_callback (Optional[Callable]) – callback to be called whenever the status of the task changes.

Return type:

tuple[TaskStatus, str]

Returns:

the completed status and no implemented message

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.

Parameters:

fault (bool) – whether the component has faulted. If False, then this is a notification that the component has recovered from a fault.

Return type:

None

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.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the completed status and not implemented message

on(task_callback=None)

Turn the component on.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the completed status and not implemented message

reset(task_callback=None)

Reset the component (from fault state).

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the completed status and not implemented message

standby(task_callback=None)

Put the component into low-power standby mode.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the completed status and not implemented message

start_communicating()

Start communicating with the component.

Return type:

None

stop_communicating()

Break off communicating with the component.

Return type:

None

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:

None

update_component_state(fault)

Update the component fault status, calling callbacks as required.

This is a helper method for use by subclasses.

Parameters:

fault (Optional[bool]) – whether the component has faulted. If False, then this is a notification that the component has recovered from a fault.

Return type:

None