From 86e5a13b04b3383878775636a433ff3d9d0d0af5 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Fri, 4 Dec 2020 10:12:25 +0100 Subject: [PATCH] Removed PROTECTED REGION markers, as we're abandoning pogo --- RCUSCC/RCUSCC/RCUSCC.py | 57 +++-------------------------------------- 1 file changed, 3 insertions(+), 54 deletions(-) diff --git a/RCUSCC/RCUSCC/RCUSCC.py b/RCUSCC/RCUSCC/RCUSCC.py index cee1c437e..c9e9f8c6d 100644 --- a/RCUSCC/RCUSCC/RCUSCC.py +++ b/RCUSCC/RCUSCC/RCUSCC.py @@ -21,7 +21,6 @@ from tango.server import device_property from tango import AttrQuality, DispLevel, DevState from tango import AttrWriteType, PipeWriteType # Additional import -# PROTECTED REGION ID(RCUSCC.additionnal_import) ENABLED START # import sys import opcua import traceback @@ -32,6 +31,8 @@ from threading import Thread from functools import wraps import socket +__all__ = ["RCUSCC", "main"] + def only_when_on(func): """ Wrapper to return None when the device isn't in ON state. @@ -65,9 +66,6 @@ def fault_on_opcua_error(func): return None return opcua_error_wrapper -# PROTECTED REGION END # // RCUSCC.additionnal_import - -__all__ = ["RCUSCC", "main"] class OPCUAConnection(Thread): """ @@ -156,11 +154,9 @@ class RCUSCC(Device): OPC_Time_Out - Type:'DevDouble' """ - # PROTECTED REGION ID(RCUSCC.class_variable) ENABLED START # client = 0 name_space_index = 0 obj = 0 - # PROTECTED REGION END # // RCUSCC.class_variable # ----------------- # Device Properties @@ -315,7 +311,6 @@ class RCUSCC(Device): """Initialises the attributes and properties of the RCUSCC.""" Device.init_device(self) - # PROTECTED REGION ID(RCUSCC.init_device) ENABLED START # self.set_state(DevState.INIT) # Init the dict that contains attribute to OPC-UA MP/CP mappings. @@ -375,12 +370,10 @@ class RCUSCC(Device): # Everything went ok -- go online self.On() - # PROTECTED REGION END # // RCUSCC.init_device def always_executed_hook(self): """Method always executed before any TANGO command is executed.""" - # PROTECTED REGION ID(RCUSCC.always_executed_hook) ENABLED START # - # PROTECTED REGION END # // RCUSCC.always_executed_hook + pass def delete_device(self): """Hook to delete resources allocated in init_device. @@ -389,12 +382,10 @@ class RCUSCC(Device): init_device method to be released. This method is called by the device destructor and by the device Init command. """ - # PROTECTED REGION ID(RCUSCC.delete_device) ENABLED START # self.debug_stream("Shutting down...") self.Off() self.debug_stream("Shut down. Good bye.") - # PROTECTED REGION END # // RCUSCC.delete_device # ------------------ # Attributes methods # ------------------ @@ -402,142 +393,112 @@ class RCUSCC(Device): @only_when_on @fault_on_opcua_error def read_Attenuator_R(self): - # PROTECTED REGION ID(RCUSCC.Attenuator_R_read) ENABLED START # """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()]) return self._Attenuator_R - # PROTECTED REGION END # // RCUSCC.Attenuator_R_read @only_when_on @fault_on_opcua_error def read_Attenuator_RW(self): - # PROTECTED REGION ID(RCUSCC.Attenuator_RW_read) ENABLED START # """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()]) return self._Attenuator_RW - # PROTECTED REGION END # // RCUSCC.Attenuator_RW_read @only_when_on @fault_on_opcua_error def write_Attenuator_RW(self, value): - # PROTECTED REGION ID(RCUSCC.Attenuator_RW_write) ENABLED START # """Set the Attenuator_RW attribute.""" 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"][2].set_value(value[2]) self._Attenuator_RW = value - # PROTECTED REGION END # // RCUSCC.Attenuator_RW_write @only_when_on @fault_on_opcua_error def read_Band_R(self): - # PROTECTED REGION ID(RCUSCC.Band_R_read) ENABLED START # """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()]) return self._Band_R - # PROTECTED REGION END # // RCUSCC.Band_R_read @only_when_on @fault_on_opcua_error def read_Band_RW(self): - # PROTECTED REGION ID(RCUSCC.Band_RW_read) ENABLED START # """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()]) return self._Band_RW - # PROTECTED REGION END # // RCUSCC.Band_RW_read @only_when_on @fault_on_opcua_error def write_Band_RW(self, value): - # PROTECTED REGION ID(RCUSCC.Band_RW_write) ENABLED START # """Set the Band_RW attribute.""" 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"][2].set_value(value[2]) self._Band_RW = value - # PROTECTED REGION END # // RCUSCC.Band_RW_write @only_when_on @fault_on_opcua_error def read_Dither_Frequency_R(self): - # PROTECTED REGION ID(RCUSCC.Dither_Frequency_R_read) ENABLED START # """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()]) return self._Dither_Frequency_R - # PROTECTED REGION END # // RCUSCC.Dither_Frequency_R_read @only_when_on @fault_on_opcua_error def read_Dither_Frequency_RW(self): - # PROTECTED REGION ID(RCUSCC.Dither_Frequency_RW_read) ENABLED START # """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()]) return self._Dither_Frequency_RW - # PROTECTED REGION END # // RCUSCC.Dither_Frequency_RW_read @only_when_on @fault_on_opcua_error def write_Dither_Frequency_RW(self, value): - # PROTECTED REGION ID(RCUSCC.Dither_Frequency_RW_write) ENABLED START # """Set the Dither_Frequency_RW attribute.""" self.attribute_mapping["Dither_Frequency_RW"][0].set_value(value[0]) self.attribute_mapping["Dither_Frequency_RW"][1].set_value(value[1]) self._Dither_Frequency_RW = value - # PROTECTED REGION END # // RCUSCC.Dither_Frequency_RW_write @only_when_on @fault_on_opcua_error def read_LED_R(self): - # PROTECTED REGION ID(RCUSCC.LED_R_read) ENABLED START # """Return the LED_R attribute.""" self._LED_R = self.attribute_mapping["LED_R"].get_value() return self._LED_R - # PROTECTED REGION END # // RCUSCC.LED_R_read @only_when_on @fault_on_opcua_error def read_LED_RW(self): - # PROTECTED REGION ID(RCUSCC.LED_RW_read) ENABLED START # """Return the LED_RW attribute.""" self._LED_RW = self.attribute_mapping["LED_RW"].get_value() return self._LED_RW - # PROTECTED REGION END # // RCUSCC.LED_RW_read @only_when_on @fault_on_opcua_error def write_LED_RW(self, value): - # PROTECTED REGION ID(RCUSCC.LED_RW_write) ENABLED START # """Set the LED_RW attribute.""" self.attribute_mapping["LED_RW"].set_value(value) self._LED_RW = value - # PROTECTED REGION END # // RCUSCC.LED_RW_write @only_when_on @fault_on_opcua_error def read_Pwr_dig_R(self): - # PROTECTED REGION ID(RCUSCC.Pwr_dig_R_read) ENABLED START # """Return the Pwr_dig_R attribute.""" self._Pwr_dig_R = self.attribute_mapping["Pwr_dig_R"].get_value() return self._Pwr_dig_R - # PROTECTED REGION END # // RCUSCC.Pwr_dig_R_read @only_when_on @fault_on_opcua_error def read_Temperature_R(self): - # PROTECTED REGION ID(RCUSCC.Temperature_R_read) ENABLED START # """Return the Temperature_R attribute.""" self._Temperature_R = self.attribute_mapping["Temperature_R"].get_value() return self._Temperature_R - # PROTECTED REGION END # // RCUSCC.Temperature_R_read @only_when_on @fault_on_opcua_error 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.""" self._CLK_PLL_locked_R = self.attribute_mapping["CLK_PLL_locked_R"].get_value() return self._CLK_PLL_locked_R - # PROTECTED REGION END # // RCUSCC.CLK_PLL_locked_R_read # -------- @@ -548,19 +509,16 @@ class RCUSCC(Device): ) @DebugIt() def On(self): - # PROTECTED REGION ID(RCUSCC.On) ENABLED START # """ :return:None """ self.set_state(DevState.ON) - # PROTECTED REGION END # // RCUSCC..On @command( ) @DebugIt() def Off(self): - # PROTECTED REGION ID(RCUSCC.Off) ENABLED START # """ :return:None @@ -574,13 +532,11 @@ class RCUSCC(Device): # Turn off again, in case of race conditions through reconnecting self.set_state(DevState.OFF) - # PROTECTED REGION END # // RCUSCC.Off @command( ) @DebugIt() 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. @@ -589,31 +545,26 @@ class RCUSCC(Device): :return:None """ self.set_state(DevState.FAULT) - # PROTECTED REGION END # // RCUSCC..On @command( ) @DebugIt() def RCU_off(self): - # PROTECTED REGION ID(RCUSCC.RCU_off) ENABLED START # """ :return:None """ # self.attribute_mapping["RCU_off"]() - # PROTECTED REGION END # // RCUSCC.RCU_off @command( ) @DebugIt() def RCU_on(self): - # PROTECTED REGION ID(RCUSCC.RCU_on) ENABLED START # """ :return:None """ # self.attribute_mapping["RCU_on"]() - # PROTECTED REGION END # // RCUSCC.RCU_on # ---------- @@ -623,9 +574,7 @@ class RCUSCC(Device): def main(args=None, **kwargs): """Main function of the RCUSCC module.""" - # PROTECTED REGION ID(RCUSCC.main) ENABLED START # return run((RCUSCC,), args=args, **kwargs) - # PROTECTED REGION END # // RCUSCC.main if __name__ == '__main__': -- GitLab