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

Removed PROTECTED REGION markers, as we're abandoning pogo

parent 5388fc9d
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,6 @@ from tango.server import device_property ...@@ -21,7 +21,6 @@ from tango.server import device_property
from tango import AttrQuality, DispLevel, DevState from tango import AttrQuality, DispLevel, DevState
from tango import AttrWriteType, PipeWriteType from tango import AttrWriteType, PipeWriteType
# Additional import # Additional import
# PROTECTED REGION ID(RCUSCC.additionnal_import) ENABLED START #
import sys import sys
import opcua import opcua
import traceback import traceback
...@@ -32,6 +31,8 @@ from threading import Thread ...@@ -32,6 +31,8 @@ from threading import Thread
from functools import wraps from functools import wraps
import socket import socket
__all__ = ["RCUSCC", "main"]
def only_when_on(func): def only_when_on(func):
""" """
Wrapper to return None when the device isn't in ON state. Wrapper to return None when the device isn't in ON state.
...@@ -65,9 +66,6 @@ def fault_on_opcua_error(func): ...@@ -65,9 +66,6 @@ def fault_on_opcua_error(func):
return None return None
return opcua_error_wrapper return opcua_error_wrapper
# PROTECTED REGION END # // RCUSCC.additionnal_import
__all__ = ["RCUSCC", "main"]
class OPCUAConnection(Thread): class OPCUAConnection(Thread):
""" """
...@@ -156,11 +154,9 @@ class RCUSCC(Device): ...@@ -156,11 +154,9 @@ class RCUSCC(Device):
OPC_Time_Out OPC_Time_Out
- Type:'DevDouble' - Type:'DevDouble'
""" """
# PROTECTED REGION ID(RCUSCC.class_variable) ENABLED START #
client = 0 client = 0
name_space_index = 0 name_space_index = 0
obj = 0 obj = 0
# PROTECTED REGION END # // RCUSCC.class_variable
# ----------------- # -----------------
# Device Properties # Device Properties
...@@ -315,7 +311,6 @@ class RCUSCC(Device): ...@@ -315,7 +311,6 @@ class RCUSCC(Device):
"""Initialises the attributes and properties of the RCUSCC.""" """Initialises the attributes and properties of the RCUSCC."""
Device.init_device(self) Device.init_device(self)
# PROTECTED REGION ID(RCUSCC.init_device) ENABLED START #
self.set_state(DevState.INIT) self.set_state(DevState.INIT)
# Init the dict that contains attribute to OPC-UA MP/CP mappings. # Init the dict that contains attribute to OPC-UA MP/CP mappings.
...@@ -375,12 +370,10 @@ class RCUSCC(Device): ...@@ -375,12 +370,10 @@ class RCUSCC(Device):
# Everything went ok -- go online # Everything went ok -- go online
self.On() self.On()
# PROTECTED REGION END # // RCUSCC.init_device
def always_executed_hook(self): def always_executed_hook(self):
"""Method always executed before any TANGO command is executed.""" """Method always executed before any TANGO command is executed."""
# PROTECTED REGION ID(RCUSCC.always_executed_hook) ENABLED START # pass
# PROTECTED REGION END # // RCUSCC.always_executed_hook
def delete_device(self): def delete_device(self):
"""Hook to delete resources allocated in init_device. """Hook to delete resources allocated in init_device.
...@@ -389,12 +382,10 @@ class RCUSCC(Device): ...@@ -389,12 +382,10 @@ class RCUSCC(Device):
init_device method to be released. This method is called by the device init_device method to be released. This method is called by the device
destructor and by the device Init command. destructor and by the device Init command.
""" """
# PROTECTED REGION ID(RCUSCC.delete_device) ENABLED START #
self.debug_stream("Shutting down...") self.debug_stream("Shutting down...")
self.Off() self.Off()
self.debug_stream("Shut down. Good bye.") self.debug_stream("Shut down. Good bye.")
# PROTECTED REGION END # // RCUSCC.delete_device
# ------------------ # ------------------
# Attributes methods # Attributes methods
# ------------------ # ------------------
...@@ -402,142 +393,112 @@ class RCUSCC(Device): ...@@ -402,142 +393,112 @@ class RCUSCC(Device):
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def read_Attenuator_R(self): def read_Attenuator_R(self):
# PROTECTED REGION ID(RCUSCC.Attenuator_R_read) ENABLED START #
"""Return the Attenuator_R attribute.""" """Return the Attenuator_R attribute."""
self._Attenuator_R = numpy.array([self.attribute_mapping["Attenuator_R"][0].get_value(), self.attribute_mapping["Attenuator_R"][1].get_value(), self.attribute_mapping["Attenuator_R"][2].get_value()]) self._Attenuator_R = numpy.array([self.attribute_mapping["Attenuator_R"][0].get_value(), self.attribute_mapping["Attenuator_R"][1].get_value(), self.attribute_mapping["Attenuator_R"][2].get_value()])
return self._Attenuator_R return self._Attenuator_R
# PROTECTED REGION END # // RCUSCC.Attenuator_R_read
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def read_Attenuator_RW(self): def read_Attenuator_RW(self):
# PROTECTED REGION ID(RCUSCC.Attenuator_RW_read) ENABLED START #
"""Return the Attenuator_R attribute.""" """Return the Attenuator_R attribute."""
self._Attenuator_RW = numpy.array([self.attribute_mapping["Attenuator_RW"][0].get_value(), self.attribute_mapping["Attenuator_RW"][1].get_value(), self.attribute_mapping["Attenuator_RW"][2].get_value()]) self._Attenuator_RW = numpy.array([self.attribute_mapping["Attenuator_RW"][0].get_value(), self.attribute_mapping["Attenuator_RW"][1].get_value(), self.attribute_mapping["Attenuator_RW"][2].get_value()])
return self._Attenuator_RW return self._Attenuator_RW
# PROTECTED REGION END # // RCUSCC.Attenuator_RW_read
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def write_Attenuator_RW(self, value): def write_Attenuator_RW(self, value):
# PROTECTED REGION ID(RCUSCC.Attenuator_RW_write) ENABLED START #
"""Set the Attenuator_RW attribute.""" """Set the Attenuator_RW attribute."""
self.attribute_mapping["Attenuator_RW"][0].set_value(value[0]) self.attribute_mapping["Attenuator_RW"][0].set_value(value[0])
self.attribute_mapping["Attenuator_RW"][1].set_value(value[1]) self.attribute_mapping["Attenuator_RW"][1].set_value(value[1])
self.attribute_mapping["Attenuator_RW"][2].set_value(value[2]) self.attribute_mapping["Attenuator_RW"][2].set_value(value[2])
self._Attenuator_RW = value self._Attenuator_RW = value
# PROTECTED REGION END # // RCUSCC.Attenuator_RW_write
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def read_Band_R(self): def read_Band_R(self):
# PROTECTED REGION ID(RCUSCC.Band_R_read) ENABLED START #
"""Return the Band_R attribute.""" """Return the Band_R attribute."""
self._Band_R = numpy.array([self.attribute_mapping["Band_R"][0].get_value(), self.attribute_mapping["Band_R"][1].get_value(), self.attribute_mapping["Band_R"][2].get_value()]) self._Band_R = numpy.array([self.attribute_mapping["Band_R"][0].get_value(), self.attribute_mapping["Band_R"][1].get_value(), self.attribute_mapping["Band_R"][2].get_value()])
return self._Band_R return self._Band_R
# PROTECTED REGION END # // RCUSCC.Band_R_read
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def read_Band_RW(self): def read_Band_RW(self):
# PROTECTED REGION ID(RCUSCC.Band_RW_read) ENABLED START #
"""Return the Band_R attribute.""" """Return the Band_R attribute."""
self._Band_RW = numpy.array([self.attribute_mapping["Band_RW"][0].get_value(), self.attribute_mapping["Band_RW"][1].get_value(), self.attribute_mapping["Band_RW"][2].get_value()]) self._Band_RW = numpy.array([self.attribute_mapping["Band_RW"][0].get_value(), self.attribute_mapping["Band_RW"][1].get_value(), self.attribute_mapping["Band_RW"][2].get_value()])
return self._Band_RW return self._Band_RW
# PROTECTED REGION END # // RCUSCC.Band_RW_read
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def write_Band_RW(self, value): def write_Band_RW(self, value):
# PROTECTED REGION ID(RCUSCC.Band_RW_write) ENABLED START #
"""Set the Band_RW attribute.""" """Set the Band_RW attribute."""
self.attribute_mapping["Band_RW"][0].set_value(value[0]) self.attribute_mapping["Band_RW"][0].set_value(value[0])
self.attribute_mapping["Band_RW"][1].set_value(value[1]) self.attribute_mapping["Band_RW"][1].set_value(value[1])
self.attribute_mapping["Band_RW"][2].set_value(value[2]) self.attribute_mapping["Band_RW"][2].set_value(value[2])
self._Band_RW = value self._Band_RW = value
# PROTECTED REGION END # // RCUSCC.Band_RW_write
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def read_Dither_Frequency_R(self): def read_Dither_Frequency_R(self):
# PROTECTED REGION ID(RCUSCC.Dither_Frequency_R_read) ENABLED START #
"""Return the Dither_Frequency_R attribute.""" """Return the Dither_Frequency_R attribute."""
self._Dither_Frequency_R = numpy.array([self.attribute_mapping["Dither_Frequency_R"][0].get_value(), self.attribute_mapping["Dither_Frequency_R"][1].get_value()]) self._Dither_Frequency_R = numpy.array([self.attribute_mapping["Dither_Frequency_R"][0].get_value(), self.attribute_mapping["Dither_Frequency_R"][1].get_value()])
return self._Dither_Frequency_R return self._Dither_Frequency_R
# PROTECTED REGION END # // RCUSCC.Dither_Frequency_R_read
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def read_Dither_Frequency_RW(self): def read_Dither_Frequency_RW(self):
# PROTECTED REGION ID(RCUSCC.Dither_Frequency_RW_read) ENABLED START #
"""Return the Dither_Frequency_R attribute.""" """Return the Dither_Frequency_R attribute."""
self._Dither_Frequency_RW = numpy.array([self.attribute_mapping["Dither_Frequency_RW"][0].get_value(), self.attribute_mapping["Dither_Frequency_RW"][1].get_value()]) self._Dither_Frequency_RW = numpy.array([self.attribute_mapping["Dither_Frequency_RW"][0].get_value(), self.attribute_mapping["Dither_Frequency_RW"][1].get_value()])
return self._Dither_Frequency_RW return self._Dither_Frequency_RW
# PROTECTED REGION END # // RCUSCC.Dither_Frequency_RW_read
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def write_Dither_Frequency_RW(self, value): def write_Dither_Frequency_RW(self, value):
# PROTECTED REGION ID(RCUSCC.Dither_Frequency_RW_write) ENABLED START #
"""Set the Dither_Frequency_RW attribute.""" """Set the Dither_Frequency_RW attribute."""
self.attribute_mapping["Dither_Frequency_RW"][0].set_value(value[0]) self.attribute_mapping["Dither_Frequency_RW"][0].set_value(value[0])
self.attribute_mapping["Dither_Frequency_RW"][1].set_value(value[1]) self.attribute_mapping["Dither_Frequency_RW"][1].set_value(value[1])
self._Dither_Frequency_RW = value self._Dither_Frequency_RW = value
# PROTECTED REGION END # // RCUSCC.Dither_Frequency_RW_write
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def read_LED_R(self): def read_LED_R(self):
# PROTECTED REGION ID(RCUSCC.LED_R_read) ENABLED START #
"""Return the LED_R attribute.""" """Return the LED_R attribute."""
self._LED_R = self.attribute_mapping["LED_R"].get_value() self._LED_R = self.attribute_mapping["LED_R"].get_value()
return self._LED_R return self._LED_R
# PROTECTED REGION END # // RCUSCC.LED_R_read
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def read_LED_RW(self): def read_LED_RW(self):
# PROTECTED REGION ID(RCUSCC.LED_RW_read) ENABLED START #
"""Return the LED_RW attribute.""" """Return the LED_RW attribute."""
self._LED_RW = self.attribute_mapping["LED_RW"].get_value() self._LED_RW = self.attribute_mapping["LED_RW"].get_value()
return self._LED_RW return self._LED_RW
# PROTECTED REGION END # // RCUSCC.LED_RW_read
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def write_LED_RW(self, value): def write_LED_RW(self, value):
# PROTECTED REGION ID(RCUSCC.LED_RW_write) ENABLED START #
"""Set the LED_RW attribute.""" """Set the LED_RW attribute."""
self.attribute_mapping["LED_RW"].set_value(value) self.attribute_mapping["LED_RW"].set_value(value)
self._LED_RW = value self._LED_RW = value
# PROTECTED REGION END # // RCUSCC.LED_RW_write
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def read_Pwr_dig_R(self): def read_Pwr_dig_R(self):
# PROTECTED REGION ID(RCUSCC.Pwr_dig_R_read) ENABLED START #
"""Return the Pwr_dig_R attribute.""" """Return the Pwr_dig_R attribute."""
self._Pwr_dig_R = self.attribute_mapping["Pwr_dig_R"].get_value() self._Pwr_dig_R = self.attribute_mapping["Pwr_dig_R"].get_value()
return self._Pwr_dig_R return self._Pwr_dig_R
# PROTECTED REGION END # // RCUSCC.Pwr_dig_R_read
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def read_Temperature_R(self): def read_Temperature_R(self):
# PROTECTED REGION ID(RCUSCC.Temperature_R_read) ENABLED START #
"""Return the Temperature_R attribute.""" """Return the Temperature_R attribute."""
self._Temperature_R = self.attribute_mapping["Temperature_R"].get_value() self._Temperature_R = self.attribute_mapping["Temperature_R"].get_value()
return self._Temperature_R return self._Temperature_R
# PROTECTED REGION END # // RCUSCC.Temperature_R_read
@only_when_on @only_when_on
@fault_on_opcua_error @fault_on_opcua_error
def read_CLK_PLL_locked_R(self): def read_CLK_PLL_locked_R(self):
# PROTECTED REGION ID(RCUSCC.CLK_PLL_locked_R_read) ENABLED START #
"""Return the CLK_PLL_locked_R attribute.""" """Return the CLK_PLL_locked_R attribute."""
self._CLK_PLL_locked_R = self.attribute_mapping["CLK_PLL_locked_R"].get_value() self._CLK_PLL_locked_R = self.attribute_mapping["CLK_PLL_locked_R"].get_value()
return self._CLK_PLL_locked_R return self._CLK_PLL_locked_R
# PROTECTED REGION END # // RCUSCC.CLK_PLL_locked_R_read
# -------- # --------
...@@ -548,19 +509,16 @@ class RCUSCC(Device): ...@@ -548,19 +509,16 @@ class RCUSCC(Device):
) )
@DebugIt() @DebugIt()
def On(self): def On(self):
# PROTECTED REGION ID(RCUSCC.On) ENABLED START #
""" """
:return:None :return:None
""" """
self.set_state(DevState.ON) self.set_state(DevState.ON)
# PROTECTED REGION END # // RCUSCC..On
@command( @command(
) )
@DebugIt() @DebugIt()
def Off(self): def Off(self):
# PROTECTED REGION ID(RCUSCC.Off) ENABLED START #
""" """
:return:None :return:None
...@@ -574,13 +532,11 @@ class RCUSCC(Device): ...@@ -574,13 +532,11 @@ class RCUSCC(Device):
# Turn off again, in case of race conditions through reconnecting # Turn off again, in case of race conditions through reconnecting
self.set_state(DevState.OFF) self.set_state(DevState.OFF)
# PROTECTED REGION END # // RCUSCC.Off
@command( @command(
) )
@DebugIt() @DebugIt()
def Fault(self): def Fault(self):
# PROTECTED REGION ID(RCUSCC.On) ENABLED START #
""" """
FAULT state is used to indicate our connection with the OPC-UA server is down. FAULT state is used to indicate our connection with the OPC-UA server is down.
...@@ -589,31 +545,26 @@ class RCUSCC(Device): ...@@ -589,31 +545,26 @@ class RCUSCC(Device):
:return:None :return:None
""" """
self.set_state(DevState.FAULT) self.set_state(DevState.FAULT)
# PROTECTED REGION END # // RCUSCC..On
@command( @command(
) )
@DebugIt() @DebugIt()
def RCU_off(self): def RCU_off(self):
# PROTECTED REGION ID(RCUSCC.RCU_off) ENABLED START #
""" """
:return:None :return:None
""" """
# self.attribute_mapping["RCU_off"]() # self.attribute_mapping["RCU_off"]()
# PROTECTED REGION END # // RCUSCC.RCU_off
@command( @command(
) )
@DebugIt() @DebugIt()
def RCU_on(self): def RCU_on(self):
# PROTECTED REGION ID(RCUSCC.RCU_on) ENABLED START #
""" """
:return:None :return:None
""" """
# self.attribute_mapping["RCU_on"]() # self.attribute_mapping["RCU_on"]()
# PROTECTED REGION END # // RCUSCC.RCU_on
# ---------- # ----------
...@@ -623,9 +574,7 @@ class RCUSCC(Device): ...@@ -623,9 +574,7 @@ class RCUSCC(Device):
def main(args=None, **kwargs): def main(args=None, **kwargs):
"""Main function of the RCUSCC module.""" """Main function of the RCUSCC module."""
# PROTECTED REGION ID(RCUSCC.main) ENABLED START #
return run((RCUSCC,), args=args, **kwargs) return run((RCUSCC,), args=args, **kwargs)
# PROTECTED REGION END # // RCUSCC.main
if __name__ == '__main__': if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment