Communication Manager

This module implements an CommunicationManager class for managing communication.

class CommunicationManager(communication_status_callback, component_status_callback, logger, *devices, shutdown_timeout=5.0)

A class for use in devices that need to establish communication with other devices.

This class manages the communcation status for the desired proxies and provides a callback to notify the device when the overall communication status changes.

__init__(communication_status_callback, component_status_callback, logger, *devices, shutdown_timeout=5.0)

Create a new CommunicationManager instance.

Parameters:
  • communication_status_callback (Callable[[CommunicationStatus], None]) – The callback to notify the device when the overall communication status changes.

  • component_status_callback (Callable[..., None]) – The callback to notify the device that component state has changed when communications are disabled.

  • logger (Logger) – The logger to use for logging.

  • devices (Mapping[str, DeviceComponentManager]) – The devices to manage.

  • shutdown_timeout (float) – Maximum seconds to wait for executor to shut down before warning.

replace_device_pool(*new_devices)

Replace the current device pool with another.

If we are currently communicating with the current devices, we will stop communicating with them and start communicating with the new devices.

Parameters:

new_devices (Mapping[str, DeviceComponentManager]) – The new devices to manage.

Return type:

None

shutdown()

Shut down the CommunicationManager, stop communication and clean up.

Return type:

None

start_communicating()

Start communicating with the devices.

Return type:

None

stop_communicating()

Stop communicating with the devices.

Return type:

None

update_communication_status(device_trl, status)

Update the communication status for a device.

This method should be passed as a callback to the DeviceComponentManager.

Parameters:
Return type:

None