Device Component Manager

This module implements an abstract component manager for simple object components.

class DeviceComponentManager(name, logger, communication_state_callback, component_state_callback, event_serialiser=None)

An abstract component manager for a Tango device component.

__init__(name, logger, communication_state_callback, component_state_callback, event_serialiser=None)

Initialise a new instance.

Parameters:
  • name (str) – the name of the device

  • logger (Logger) – the logger to be used by this object.

  • communication_state_callback (Callable[[CommunicationStatus], None]) – callback to be called when the status of the communications channel between the component manager and its component changes

  • component_state_callback (Callable[..., None]) – callback to be called when the component state changes

  • event_serialiser (Optional[EventSerialiser]) – an event serialiser to be used by this object

cleanup()

Clean up the component manager.

Return type:

None

get_change_event_callbacks()

Return a dictionary for each attribute and callback pair.

Return type:

dict[str, Callable]

Returns:

a dictionary for each attribute and callback pair.

property health: HealthState | None

Return the evaluated health state of the device.

This will be either the health state that the device reports, or None if the device is in an admin mode that indicates that its health should not be rolled up.

Returns:

the evaluated health state of the device.

off(task_callback=None)

Turn the device off.

Parameters:

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

Return type:

tuple[TaskStatus, str]

Returns:

a result code & message

on(task_callback=None)

Turn the device on.

Parameters:

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

Return type:

tuple[TaskStatus, str]

Returns:

a result code and message

property power_state: PowerState | None

Return the current power state of the device.

Returns:

the current power state of the device.

reset(task_callback=None)

Reset the device.

Parameters:

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

Return type:

tuple[TaskStatus, str]

Returns:

a result code, or None if there was nothing to do.

standby(task_callback=None)

Turn the device to standby.

Parameters:

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

Return type:

tuple[TaskStatus, str]

Returns:

a result code, or None if there was nothing to do.

start_communicating()

Establish communication with the component, then start monitoring.

This is a public method that enqueues the work to be done.

Return type:

None

stop_communicating()

Cease monitoring the component, and break off all communication with it.

Return type:

None

class ObsDeviceComponentManager(fqdn, logger, communication_state_callback, component_state_callback, event_serialiser=None)

An abstract component manager for a Tango observation device component.

__init__(fqdn, logger, communication_state_callback, component_state_callback, event_serialiser=None)

Initialise a new instance.

Parameters:
  • fqdn (str) – the FQDN of the device.

  • logger (Logger) – the logger to be used by this object.

  • communication_state_callback (Callable[[CommunicationStatus], None]) – callback to be called when the status of the communications channel between the component manager and its component changes.

  • component_state_callback (Callable[..., None]) – callback to be called when the component’s state changes.

  • event_serialiser (Optional[EventSerialiser]) – an event serialiser to be used by this object

get_change_event_callbacks()

Add obsState to change event subscriptions.

Return type:

dict[str, Callable]

Returns:

a dictionary for each attribute and callback pair.