diff --git a/csaxs_bec/devices/omny/galil/galil_rio.py b/csaxs_bec/devices/omny/galil/galil_rio.py index 7788a27..8a53c62 100644 --- a/csaxs_bec/devices/omny/galil/galil_rio.py +++ b/csaxs_bec/devices/omny/galil/galil_rio.py @@ -98,6 +98,8 @@ class GalilRIOSignalRO(GalilSignalRO): class GalilRIO(PSIDeviceBase): """Base integration for the Galil RIO card in BEC.""" + SUB_CONNECTION_CHANGE = "connection_change" + an_ch1 = Cpt(GalilRIOSignalRO, signal_name="an_ch1", channel=1, doc="Analog input channel 1") an_ch2 = Cpt(GalilRIOSignalRO, signal_name="an_ch2", channel=2, doc="Analog input channel 2") an_ch3 = Cpt(GalilRIOSignalRO, signal_name="an_ch3", channel=3, doc="Analog input channel 3") @@ -123,16 +125,17 @@ class GalilRIO(PSIDeviceBase): socket_cls=socket_cls, socket_host=host, socket_port=port, device_manager=device_manager ) super().__init__(name=name, device_manager=device_manager, scan_info=scan_info, **kwargs) + self.controller.subscribe( + self._update_connection_state, event_type=self.SUB_CONNECTION_CHANGE + ) def wait_for_connection(self, timeout: float = 30.0, **kwargs) -> None: """Wait for the RIO controller to be connected within timeout period.""" self.controller.on(timeout=timeout) - self._update_connection_state() def destroy(self) -> None: """Make sure to turn off the controller socket on destroy.""" self.controller.off() - self._update_connection_state() return super().destroy() def _update_connection_state(self, **kwargs):