Commit 226bd3d4 authored by Luca Vidotto's avatar Luca Vidotto
Browse files

Change boards number and remote and local ip to properties

parent 7a2dd179
......@@ -38,7 +38,26 @@ def str_to_bool_list(data: str) -> List[bool]:
class WaterSensorClass(PyTango.DeviceClass):
class_property_list = {}
device_property_list = {}
device_property_list = {
'arduino_ip':
[
PyTango.DevString,
'IP adress of the arduino to connect to',
['192.168.208.61']
],
'boards_number':
[
PyTango.DevShort,
'Number of boards connected to the arduino',
[12]
],
'local_port':
[
PyTango.DevLong,
'Local TCP port to use for the connection to the arduino',
[8888]
]
}
cmd_list = {}
attr_list = {
'log':
......@@ -51,19 +70,7 @@ class WaterSensorClass(PyTango.DeviceClass):
[[
PyTango.DevLong,
PyTango.SCALAR,
PyTango.READ_WRITE
]],
'tcp_port':
[[
PyTango.DevLong,
PyTango.SCALAR,
PyTango.READ_WRITE
]],
'numero_schede':
[[
PyTango.DevShort,
PyTango.SCALAR,
PyTango.READ_WRITE
PyTango.READ
]],
'scheda_0':
[[
......@@ -184,23 +191,6 @@ class WaterSensor (PyTango.Device_4Impl):
self.debug_stream("In read_alarm_state()")
attr.set_value(self.attr_alarm_state_read)
def read_tcp_port(self, attr):
self.debug_stream("In read_tcp_port()")
attr.set_value(self.attr_tcp_port_read)
def write_tcp_port(self, attr):
self.debug_stream("In write_tcp_port()")
data = attr.get_write_value()
self.attr_tcp_port_read = data
def read_numero_schede(self, attr):
self.debug_stream("In read_numero_schede()")
attr.set_value(self.attr_numero_schede_read)
def write_numero_schede(self, attr):
self.debug_stream("In write_numero_schede()")
data = attr.get_write_value()
def read_scheda_0(self, attr):
self.debug_stream("In read_scheda_0()")
attr.set_value(self.attr_scheda_0_read)
......@@ -255,7 +245,6 @@ class WaterSensor (PyTango.Device_4Impl):
class DataAcquisition(threading.Thread):
wait_time = 60
remote_ip = '192.168.208.61'
packets = ''
problems: List[str] = []
fault = False
......@@ -267,9 +256,10 @@ class DataAcquisition(threading.Thread):
def __init__(self, device: WaterSensor) -> None:
threading.Thread.__init__(self)
self.device = device
self.remote_port = device.attr_tcp_port_read
self.cards_number = device.attr_numero_schede_read
self.local_port = device.attr_tcp_port_read
self.remote_port = 8888
self.remote_ip = device.arduino_ip
self.cards_number = device.boards_number
self.local_port = device.local_port
self.cards_status = [[False] * 8] * self.cards_number
def run(self) -> None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment