FNDH component manager

This module implements the component management for fndh.

class FndhComponentManager(logger, communication_state_callback, component_state_callback, attribute_change_callback, update_port_power_states, pasd_fqdn, ports_with_smartbox, event_serialiser=None, _pasd_bus_proxy=None)

A component manager for an fndh.

This communicates via a proxy to a MccsPasdBus that talks to a simulator or the real hardware.

__init__(logger, communication_state_callback, component_state_callback, attribute_change_callback, update_port_power_states, pasd_fqdn, ports_with_smartbox, event_serialiser=None, _pasd_bus_proxy=None)

Initialise a new instance.

Parameters:
  • logger (Logger) – a logger for this object to use

  • 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

  • attribute_change_callback (Callable[..., None]) – callback to be called when a attribute changes

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

  • pasd_fqdn (str) – the fqdn of the pasdbus to connect to.

  • ports_with_smartbox (list[int]) – the list of ports with smartboxes.

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

  • _pasd_bus_proxy (Optional[MccsDeviceProxy]) – a optional injected device proxy for testing purposes only. defaults to None

abort(task_callback=None)

Abort in-flight tasks and propagate to the PaSD bus.

Calls the base class abort to signal the task abort event, then calls Abort on the PaSD bus device to clear any pending port power changes.

Parameters:

task_callback (Optional[Callable]) – notified of task progress.

Return type:

tuple[TaskStatus, str]

Returns:

tuple of TaskStatus and message.

cleanup()

Delete and clean up any remaining processes.

Return type:

None

do_on(task_callback=None, task_abort_event=None)

Turn the Fndh on.

Parameters:
Return type:

None

do_standby(task_callback=None, task_abort_event=None)

Turn the Fndh to standby.

Parameters:
Return type:

None

power_off_port(port_number, task_callback=None, task_abort_event=None)

Turn a port off.

This port may or may not have a smartbox attached.

Parameters:
  • port_number (int) – port we want to power off.

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

  • task_abort_event (Optional[Event]) – event indicating an abort

Return type:

tuple[ResultCode, str]

Returns:

the task status and a human-readable status message

power_on_port(port_number, task_callback=None, task_abort_event=None)

Turn a port on.

This port may or may not have a smartbox attached.

Parameters:
  • port_number (int) – port we want to power on.

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

  • task_abort_event (Optional[Event]) – event indicating an abort

Return type:

tuple[ResultCode, str]

Returns:

the task status and a human-readable status message

set_port_powers(json_argument, task_callback=None, task_abort_event=None)

Set port powers.

Parameters:
  • json_argument (str) – desired port powers of unmasked ports with smartboxes attached in json form.

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

  • task_abort_event (Optional[Event]) – event indicating an abort

Return type:

tuple[ResultCode, str]

Returns:

the task status and a human-readable status message

start_communicating()

Establish communication with the pasdBus via a proxy.

Return type:

None

stop_communicating()

Break off communication with the pasdBus.

Return type:

None

write_attribute(attribute_name, value)

Request to write an attribute via the proxy.

Parameters:
  • attribute_name (str) – the name of the Tango attribute.

  • value (Any) – the value to write.

Return type:

None