Object Component
This module implements an abstract object component.
- class ObjectComponent
An abstract component that is an object in this process.
The concept of a “component” covers anything that a component manager might manage, including
hardware
software services such as databases or compute servers
groups of Tango devices
software running in its own process or thread
software objects in the current process.
This class defines an interface for the last of these – a component that is simply a python object running in the current process. An example of such a component is a simple simulator or stub that pretends to be a more substantial component.
- property faulty: bool
Return whether this component is faulty.
Detecting component faults is a shared responsibility between component and component manager. In some cases, a component may be able to ability to self-diagnose a fault. In other cases, it will be update to the component manager to diagnose a fault from the component behaviour.
This property is implemented here to return False. Thus, if a subclass does not override this method, it is assumed to have no self-diagnosis capability.
- Returns:
whether this component is faulty; defaulting here to
False
.
- off(task_callback=None)
Turn the component off.
- Parameters:
task_callback (
Optional
[Callable
]) – callback to be called when the status of the command changes- Raises:
NotImplementedError – because this class is abstract.
- Return type:
- on(task_callback=None)
Turn the component on.
- Parameters:
task_callback (
Optional
[Callable
]) – callback to be called when the status of the command changes- Raises:
NotImplementedError – because this class is abstract.
- Return type:
- property power_mode: PowerState
Return the power mode of the component.
Here we implement a default functionality for components that do not manage their own power mode. From their own point of view they are always-on devices, though there may be an upstream power supply device that supplies/denies them power.
- Returns:
the power mode of the component.
- 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- Raises:
NotImplementedError – because this class is abstract.
- Return type:
- set_fault_callback(fault_callback)
Set the fault callback.
Here we implement a default functionality for components that lack the ability to detect and raise a fault. This method calls the callback once with False, and doesn’t register the callback, thus the fault status of the component will be False forevermore.
- set_power_mode_changed_callback(power_mode_changed_callback)
Set the callback to be called when the power mode of the component changes.
Here we implement a default functionality for components that do not manage their own power mode. From their own point of view they are always-on devices, though there may be an upstream power supply device that supplies/denies them power. Thus, this method calls the callback once with PowerState.ON, and doesn’t register the callback, so the power mode of the component will be ON forevermore.
- 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- Raises:
NotImplementedError – because this class is abstract.
- Return type: