Skip to content
Snippets Groups Projects
Commit e2c91f20 authored by Taya Snijder's avatar Taya Snijder
Browse files

some work

parent 311fedb9
Branches
No related tags found
1 merge request!322Resolve L2SS-697 "Notice temperature alarm across devices"
...@@ -15,7 +15,8 @@ from tangostationcontrol.common.lofar_logging import device_logging_to_python, l ...@@ -15,7 +15,8 @@ from tangostationcontrol.common.lofar_logging import device_logging_to_python, l
from tango._tango import DevState from tango._tango import DevState
from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy 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 import logging
...@@ -30,12 +31,25 @@ class temp_attr: ...@@ -30,12 +31,25 @@ class temp_attr:
self.dev = dev self.dev = dev
self.attr = attr 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() @device_logging_to_python()
class temperature_manager(lofar_device): class temperature_manager(lofar_device):
# ----------------- # -----------------
# Device Properties # Device Properties
# ----------------- # -----------------
temperatureManager_polling_speed_ms = device_property(
dtype='DevLong64',
mandatory=False,
default_value=10000
)
# ---------- # ----------
# Attributes # Attributes
# ---------- # ----------
...@@ -71,11 +85,13 @@ class temperature_manager(lofar_device): ...@@ -71,11 +85,13 @@ class temperature_manager(lofar_device):
for dev in dev_list: for dev in dev_list:
dev.set_source(DevSource.DEV) 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 # make a list of all temperature attributes
for attr in attribute_list: 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)) self.temp_attr_list.append(temp_attr(dev, attr))
super().configure_for_initialise() super().configure_for_initialise()
...@@ -88,10 +104,27 @@ class temperature_manager(lofar_device): ...@@ -88,10 +104,27 @@ class temperature_manager(lofar_device):
def configure_for_off(self): def configure_for_off(self):
super().configure_for_off() 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): def polling_loop(self):
for i in self.temp_attr_list: for i in self.temp_attr_list:
i.read self.read_alarm_state(i)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment