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

misc fixes

parent 8439d8d8
No related branches found
No related tags found
1 merge request!18Resolve #2021 "04 16 branched from master state bug fix"
...@@ -11,10 +11,11 @@ ...@@ -11,10 +11,11 @@
# PyTango imports # PyTango imports
from tango.server import run from tango.server import run
from tango import AttrWriteType
# Additional import # Additional import
from src.attribute_wrapper import * from src.attribute_wrapper import attribute_wrapper
from src.hardware_device import * from src.hardware_device import hardware_device
__all__ = ["HW_dev"] __all__ = ["HW_dev"]
......
...@@ -15,11 +15,12 @@ ...@@ -15,11 +15,12 @@
from tango import DebugIt from tango import DebugIt
from tango.server import run, command from tango.server import run, command
from tango.server import device_property from tango.server import device_property
from tango import AttrWriteType
# Additional import # Additional import
from clients.opcua_connection import OPCUAConnection from clients.opcua_connection import OPCUAConnection
from src.attribute_wrapper import * from src.attribute_wrapper import attribute_wrapper
from src.hardware_device import * from src.hardware_device import hardware_device
from src.lofar_logging import device_logging_to_python from src.lofar_logging import device_logging_to_python
__all__ = ["PCC", "main"] __all__ = ["PCC", "main"]
......
...@@ -14,14 +14,16 @@ ...@@ -14,14 +14,16 @@
# PyTango imports # PyTango imports
from tango.server import run from tango.server import run
from tango.server import device_property from tango.server import device_property
from tango import AttrWriteType
# Additional import # Additional import
from clients.opcua_connection import OPCUAConnection from clients.opcua_connection import OPCUAConnection
from src.attribute_wrapper import * from src.attribute_wrapper import attribute_wrapper
from src.hardware_device import * from src.hardware_device import hardware_device
from src.lofar_logging import device_logging_to_python from src.lofar_logging import device_logging_to_python
import numpy
__all__ = ["SDP", "main"] __all__ = ["SDP", "main"]
......
from src.comms_client import * from src.comms_client import CommClient
import numpy import numpy
import os import os
# <class 'numpy.bool_'> # <class 'numpy.bool_'>
class example_client(CommClient): class test_client(CommClient):
""" """
this class provides an example implementation of a comms_client. this class provides an example implementation of a comms_client.
Durirng initialisation it creates a correctly shaped zero filled value. on read that value is returned and on write its modified. Durirng initialisation it creates a correctly shaped zero filled value. on read that value is returned and on write its modified.
...@@ -47,7 +47,9 @@ class example_client(CommClient): ...@@ -47,7 +47,9 @@ class example_client(CommClient):
the annotation can be in whatever format may be required. it is up to the user to handle its content the annotation can be in whatever format may be required. it is up to the user to handle its content
example annotation may include: example annotation may include:
- a file path and file line/location - a file path and file line/location
- COM object path - server address
- IDs
- data structures
""" """
# as this is an example, just print the annotation # as this is an example, just print the annotation
......
...@@ -84,7 +84,6 @@ class attribute_wrapper(attribute): ...@@ -84,7 +84,6 @@ class attribute_wrapper(attribute):
self.write_function(value) self.write_function(value)
device.value_dict[self] = value device.value_dict[self] = value
self.fget = read_RW self.fget = read_RW
self.fset = write_RW self.fset = write_RW
...@@ -139,7 +138,7 @@ class attribute_wrapper(attribute): ...@@ -139,7 +138,7 @@ class attribute_wrapper(attribute):
def pass_func(value=None): def pass_func(value=None):
pass pass
logger.error("Exception while setting %s read/write functions. using pass function instead.", self.comms_annotation) logger.error("Exception while setting %s attribute with annotation: '%s' read/write functions. using pass function instead to to keep running", client.__class__.__name__, self.comms_annotation)
self.read_function = pass_func self.read_function = pass_func
self.write_function = pass_func self.write_function = pass_func
......
...@@ -44,7 +44,6 @@ class CommClient(Thread): ...@@ -44,7 +44,6 @@ class CommClient(Thread):
# keep trying to connect # keep trying to connect
if not self.connected: if not self.connected:
if self.connect(): if self.connect():
# self.standby_func()
pass pass
else: else:
# we retry only once, to catch exotic network issues. if the infra or hardware is down, # we retry only once, to catch exotic network issues. if the infra or hardware is down,
......
...@@ -16,7 +16,7 @@ from tango.server import Device, command ...@@ -16,7 +16,7 @@ from tango.server import Device, command
from tango import DevState, DebugIt from tango import DevState, DebugIt
# Additional import # Additional import
from src.attribute_wrapper import * from src.attribute_wrapper import attribute_wrapper
from src.lofar_logging import log_exceptions from src.lofar_logging import log_exceptions
__all__ = ["hardware_device"] __all__ = ["hardware_device"]
......
...@@ -16,7 +16,7 @@ from tango.server import device_property ...@@ -16,7 +16,7 @@ from tango.server import device_property
from tango import DevState from tango import DevState
# Additional import # Additional import
from clients.test_client import example_client from clients.test_client import test_client
from src.attribute_wrapper import * from src.attribute_wrapper import *
from src.hardware_device import * from src.hardware_device import *
...@@ -71,13 +71,13 @@ class test_device(hardware_device): ...@@ -71,13 +71,13 @@ class test_device(hardware_device):
self.set_state(DevState.INIT) self.set_state(DevState.INIT)
# set up the test client # set up the test client
self.example_client = example_client(self.Fault, self) self.test_client = test_client(self.Fault, self)
# map an access helper class # map an access helper class
for i in self.attr_list(): for i in self.attr_list():
i.set_comm_client(self.example_client) i.set_comm_client(self.test_client)
self.example_client.start() self.test_client.start()
# ---------- # ----------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment