diff --git a/tangostationcontrol/tangostationcontrol/devices/temperature_manager.py b/tangostationcontrol/tangostationcontrol/devices/temperature_manager.py index a047eb6166040d4e717415110149e14d7c86fb01..68fc910f3f9d0b07809b2f3556fabdf594ed651c 100644 --- a/tangostationcontrol/tangostationcontrol/devices/temperature_manager.py +++ b/tangostationcontrol/tangostationcontrol/devices/temperature_manager.py @@ -15,7 +15,8 @@ from tangostationcontrol.common.lofar_logging import device_logging_to_python, l from tango._tango import DevState from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy -from tango import Util, DeviceProxy, DevSource +from tango import Util, DeviceProxy, DevSource, DeviceAttribute, AttributeInfo, AttrDataFormat, attr_config +from tango.server import attribute, device_property import logging @@ -30,12 +31,25 @@ class temp_attr: self.dev = dev self.attr = attr + + # fetch attribute configuration + attr_config = self.dev.get_attribute_config(attr.name) + self.is_scalar = attr_config.data_format == AttrDataFormat.SCALAR + + + @device_logging_to_python() class temperature_manager(lofar_device): # ----------------- # Device Properties # ----------------- + temperatureManager_polling_speed_ms = device_property( + dtype='DevLong64', + mandatory=False, + default_value=10000 + ) + # ---------- # Attributes # ---------- @@ -71,11 +85,13 @@ class temperature_manager(lofar_device): for dev in dev_list: dev.set_source(DevSource.DEV) - attribute_list = dev.get_attribute_list() + + # get a list of AttributeInfo objects + attribute_list = dev.attribute_list_query() # make a list of all temperature attributes for attr in attribute_list: - if "_temp_error_r" in attr.lowercase(): + if "_temp_error_r" in attr.name.lowercase(): self.temp_attr_list.append(temp_attr(dev, attr)) super().configure_for_initialise() @@ -88,10 +104,27 @@ class temperature_manager(lofar_device): def configure_for_off(self): super().configure_for_off() + def read_alarm_state(self, devAttr): + val = devAttr.dev.read_attribute(devAttr.attr.name) + + if devAttr.is_scalar: + if val.value: + # there is an alarm state + else: + if any(val.value): + # there is something in the alarm state + pass + def polling_loop(self): for i in self.temp_attr_list: - i.read + self.read_alarm_state(i) + + + + + +