Skip to content
Snippets Groups Projects
Commit b7286f1a authored by Jan David Mol's avatar Jan David Mol
Browse files

Merge branch 'L2SS-435-move-version_R' into 'master'

L2SS-435: Move version_R to hardware_device to avoid code duplication.

Closes L2SS-435

See merge request !148
parents 920b1db4 91f0c17c
Branches
No related tags found
1 merge request!148L2SS-435: Move version_R to hardware_device to avoid code duplication.
......@@ -31,7 +31,6 @@ from clients.docker_client import DockerClient
from clients.attribute_wrapper import attribute_wrapper
from devices.hardware_device import hardware_device
from common.lofar_logging import device_logging_to_python, log_exceptions
from common.lofar_git import get_version
__all__ = ["Docker", "main"]
......@@ -50,7 +49,6 @@ class Docker(hardware_device):
# ----------
# Attributes
# ----------
version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version())
archiver_maria_db_R = attribute_wrapper(comms_annotation={"container": "archiver-maria-db"}, datatype=numpy.bool_)
archiver_maria_db_RW = attribute_wrapper(comms_annotation={"container": "archiver-maria-db"}, datatype=numpy.bool_, access=AttrWriteType.READ_WRITE)
databaseds_R = attribute_wrapper(comms_annotation={"container": "databaseds"}, datatype=numpy.bool_)
......
......@@ -15,11 +15,12 @@ from abc import ABCMeta, abstractmethod
# PyTango imports
from tango.server import Device, command, DeviceMeta, attribute
from tango import DevState, DebugIt, Attribute, DeviceProxy
from tango import DevState, DebugIt, Attribute, DeviceProxy, AttrWriteType
# Additional import
from clients.attribute_wrapper import attribute_wrapper
from common.lofar_logging import log_exceptions
from common.lofar_git import get_version
from devices.abstract_device import AbstractDeviceMetas
from devices.device_decorators import only_in_states, fault_on_error
......@@ -56,6 +57,8 @@ class hardware_device(Device, metaclass=AbstractDeviceMetas):
The user triggers their transitions by the commands reflecting the target state (Initialise(), On(), Fault()).
"""
version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version())
# list of property names too be set first by set_defaults
first_default_settings = []
......
......@@ -29,7 +29,6 @@ from devices.device_decorators import *
from clients.opcua_client import OPCUAConnection
from devices.hardware_device import hardware_device
from common.lofar_logging import device_logging_to_python, log_exceptions
from common.lofar_git import get_version
__all__ = ["opcua_device", "main"]
......
......@@ -30,7 +30,6 @@ from device_decorators import *
from clients.attribute_wrapper import attribute_wrapper
from devices.opcua_device import opcua_device
from common.lofar_logging import device_logging_to_python, log_exceptions
from common.lofar_git import get_version
__all__ = ["RECV", "main"]
......@@ -61,7 +60,6 @@ class RECV(opcua_device):
# ----------
# Attributes
# ----------
version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version())
Ant_mask_RW = attribute_wrapper(comms_annotation=["2:PCC", "2:Ant_mask_RW"], datatype=numpy.bool_, dims=(3, 32), access=AttrWriteType.READ_WRITE)
CLK_Enable_PWR_R = attribute_wrapper(comms_annotation=["2:PCC", "2:CLK_Enable_PWR_R"], datatype=numpy.bool_)
CLK_I2C_STATUS_R = attribute_wrapper(comms_annotation=["2:PCC", "2:CLK_I2C_STATUS_R"], datatype=numpy.int64)
......
......@@ -28,7 +28,6 @@ from clients.attribute_wrapper import attribute_wrapper
from devices.opcua_device import opcua_device
from common.lofar_logging import device_logging_to_python, log_exceptions
from common.lofar_git import get_version
import numpy
......@@ -78,8 +77,6 @@ class SDP(opcua_device):
# Attributes
# ----------
version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version())
FPGA_beamlet_output_enable_R = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_enable_R"], datatype=numpy.bool_, dims=(16,))
FPGA_beamlet_output_enable_RW = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_enable_RW"], datatype=numpy.bool_, dims=(16,), access=AttrWriteType.READ_WRITE)
FPGA_beamlet_output_hdr_eth_destination_mac_R = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_hdr_eth_destination_mac_R"], datatype=numpy.str, dims=(16,))
......
......@@ -31,7 +31,6 @@ from clients.attribute_wrapper import attribute_wrapper
from devices.opcua_device import opcua_device
from common.lofar_git import get_version
from common.lofar_logging import device_logging_to_python, log_exceptions
import logging
......@@ -67,8 +66,6 @@ class Statistics(opcua_device, metaclass=ABCMeta):
# Attributes
# ----------
version_R = attribute(dtype = str, access = AttrWriteType.READ, fget = lambda self: get_version())
# number of UDP packets and bytes that were received
nof_packets_received_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "udp", "parameter": "nof_packets_received"}, datatype=numpy.uint64)
nof_bytes_received_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "udp", "parameter": "nof_bytes_received"}, datatype=numpy.uint64)
......
......@@ -27,7 +27,6 @@ from clients.attribute_wrapper import attribute_wrapper
from devices.opcua_device import opcua_device
from common.lofar_logging import device_logging_to_python, log_exceptions
from common.lofar_git import get_version
import numpy
......@@ -43,8 +42,6 @@ class UNB2(opcua_device):
# Attributes
# ----------
version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version())
N_unb = 2
N_fpga = 4
N_ddr = 2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment