Device Component Manager

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

class DeviceComponentManager(name, logger, max_workers, communication_state_callback, component_state_callback)

An abstract component manager for a Tango device component.

__init__(name, logger, max_workers, communication_state_callback, component_state_callback)

Initialise a new instance.

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

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

  • max_workers (int) – Nos of worker threads for async commands.

  • 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

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, max_workers, communication_state_callback, component_state_callback)

An abstract component manager for a Tango observation device component.

__init__(fqdn, logger, max_workers, communication_state_callback, component_state_callback)

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.

  • max_workers (int) – Maximum number of workers in thread pool.