diff --git a/RandomDataDev/RandomData.py b/RandomDataDev/RandomData.py index ddf3a5a9ed89e8ead45f0b0b0efbab027e7f3d37..3dba07db2ae3d26b09472c4cc7e259f0bf718dd8 100644 --- a/RandomDataDev/RandomData.py +++ b/RandomDataDev/RandomData.py @@ -12,13 +12,13 @@ """ # PyTango imports -import PyTango -from PyTango import DebugIt -from PyTango.server import run -from PyTango.server import Device, DeviceMeta -from PyTango.server import attribute, command -from PyTango import AttrQuality, DispLevel, DevState -from PyTango import AttrWriteType, PipeWriteType +import tango +from tango import DebugIt +from tango.server import run +from tango.server import Device +from tango.server import attribute, command +from tango import AttrQuality, DispLevel, DevState +from tango import AttrWriteType, PipeWriteType # Additional import # PROTECTED REGION ID(RandomData.additionnal_import) ENABLED START # from numpy import random @@ -30,7 +30,6 @@ __all__ = ["RandomData", "main"] class RandomData(Device): """ """ - __metaclass__ = DeviceMeta # PROTECTED REGION ID(RandomData.class_variable) ENABLED START # # PROTECTED REGION END # // RandomData.class_variable @@ -39,7 +38,14 @@ class RandomData(Device): # ---------- rnd1 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -51,7 +57,14 @@ class RandomData(Device): ) rnd2 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -63,7 +76,14 @@ class RandomData(Device): ) rnd3 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -75,7 +95,14 @@ class RandomData(Device): ) rnd4 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -87,7 +114,14 @@ class RandomData(Device): ) rnd5 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -99,7 +133,14 @@ class RandomData(Device): ) rnd6 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -111,7 +152,14 @@ class RandomData(Device): ) rnd7 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -123,7 +171,14 @@ class RandomData(Device): ) rnd8 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -135,7 +190,14 @@ class RandomData(Device): ) rnd9 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -147,7 +209,14 @@ class RandomData(Device): ) rnd10 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -159,7 +228,14 @@ class RandomData(Device): ) rnd11 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -171,7 +247,14 @@ class RandomData(Device): ) rnd12 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -183,7 +266,14 @@ class RandomData(Device): ) rnd13 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -195,7 +285,14 @@ class RandomData(Device): ) rnd14 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -207,7 +304,14 @@ class RandomData(Device): ) rnd15 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -219,7 +323,14 @@ class RandomData(Device): ) rnd16 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -231,7 +342,14 @@ class RandomData(Device): ) rnd17 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -243,7 +361,14 @@ class RandomData(Device): ) rnd18 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -255,7 +380,14 @@ class RandomData(Device): ) rnd19 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -267,7 +399,14 @@ class RandomData(Device): ) rnd20 = attribute( - dtype='double', + dtype='DevDouble', + polling_period=100, + period=1000, + rel_change=1, + abs_change=0.01, + archive_period=1000, + archive_rel_change=1, + archive_abs_change=0.01, max_value=1.0, min_value=0.0, max_alarm=1.0, @@ -283,6 +422,7 @@ class RandomData(Device): # --------------- def init_device(self): + """Initialises the attributes and properties of the RandomData.""" Device.init_device(self) self.rnd1.set_data_ready_event(True) self.set_change_event("rnd1", True, True) @@ -348,15 +488,21 @@ class RandomData(Device): # PROTECTED REGION END # // RandomData.init_device def always_executed_hook(self): + """Method always executed before any TANGO command is executed.""" # PROTECTED REGION ID(RandomData.always_executed_hook) ENABLED START # pass # PROTECTED REGION END # // RandomData.always_executed_hook def delete_device(self): + """Hook to delete resources allocated in init_device. + + This method allows for any memory or other resources allocated in the + init_device method to be released. This method is called by the device + destructor and by the device Init command. + """ # PROTECTED REGION ID(RandomData.delete_device) ENABLED START # pass # PROTECTED REGION END # // RandomData.delete_device - # ------------------ # Attributes methods # ------------------ @@ -461,7 +607,6 @@ class RandomData(Device): return random.random() # PROTECTED REGION END # // RandomData.rnd20_read - # -------- # Commands # -------- @@ -472,9 +617,11 @@ class RandomData(Device): def main(args=None, **kwargs): + """Main function of the RandomData module.""" # PROTECTED REGION ID(RandomData.main) ENABLED START # return run((RandomData,), args=args, **kwargs) # PROTECTED REGION END # // RandomData.main + if __name__ == '__main__': main() diff --git a/crossechoTangoDev/Crossecho.py b/crossechoTangoDev/Crossecho.py index 72d2cf3ffe61c86500c0acc87953d643cf33937f..95138eba305134a012f100912efc4344b9251784 100644 --- a/crossechoTangoDev/Crossecho.py +++ b/crossechoTangoDev/Crossecho.py @@ -13,14 +13,14 @@ Implementation of a Tango device on top of an existing OPC-UA server in Python3. """ # PyTango imports -import PyTango -from PyTango import DebugIt -from PyTango.server import run -from PyTango.server import Device, DeviceMeta -from PyTango.server import attribute, command, pipe -from PyTango.server import device_property -from PyTango import AttrQuality, DispLevel, DevState -from PyTango import AttrWriteType, PipeWriteType +import tango +from tango import DebugIt +from tango.server import run +from tango.server import Device +from tango.server import attribute, command, pipe +from tango.server import device_property +from tango import AttrQuality, DispLevel, DevState +from tango import AttrWriteType, PipeWriteType # Additional import # PROTECTED REGION ID(Crossecho.additionnal_import) ENABLED START # from opcua import Client @@ -34,8 +34,17 @@ __all__ = ["Crossecho", "main"] class Crossecho(Device): """ Implementation of a Tango device on top of an existing OPC-UA server in Python3. + + **Properties:** + + - Device Property + OPC_Server_Name + - Type:'DevString' + OPC_Server_Port + - Type:'DevString' + OPC_time_out + - Type:'DevULong' """ - __metaclass__ = DeviceMeta # PROTECTED REGION ID(Crossecho.class_variable) ENABLED START # # PROTECTED REGION END # // Crossecho.class_variable @@ -44,15 +53,18 @@ class Crossecho(Device): # ----------------- OPC_Server_Name = device_property( - dtype='str', default_value="localhost" + dtype='DevString', + default_value="localhost" ) OPC_Server_Port = device_property( - dtype='str', default_value="55555" + dtype='DevString', + default_value="55555" ) OPC_time_out = device_property( - dtype='uint', default_value=1000 + dtype='DevULong', + default_value=1000 ) # ---------- @@ -60,12 +72,12 @@ class Crossecho(Device): # ---------- RCU_modes = attribute( - dtype=('str',), + dtype=('DevString',), max_dim_x=1024, ) crosslet_stat = attribute( - dtype=('double',), + dtype=('DevDouble',), max_dim_x=10240, ) @@ -82,6 +94,7 @@ class Crossecho(Device): # --------------- def init_device(self): + """Initialises the attributes and properties of the Crossecho.""" Device.init_device(self) # PROTECTED REGION ID(Crossecho.init_device) ENABLED START # try: @@ -103,17 +116,23 @@ class Crossecho(Device): # PROTECTED REGION END # // Crossecho.init_device def always_executed_hook(self): + """Method always executed before any TANGO command is executed.""" # PROTECTED REGION ID(Crossecho.always_executed_hook) ENABLED START # pass # PROTECTED REGION EloggND # // Crossecho.always_executed_hook def delete_device(self): + """Hook to delete resources allocated in init_device. + + This method allows for any memory or other resources allocated in the + init_device method to be released. This method is called by the device + destructor and by the device Init command. + """ # PROTECTED REGION ID(Crossecho.delete_device) ENABLED START # if self.client is not Null: self.client.close_session() self.client.close_secure_channel() - # PROTECTED REGION END # // Crossecho.delete_device∑ - + # PROTECTED REGION END # // Crossecho.delete_device # ------------------ # Attributes methods # ------------------ @@ -128,7 +147,6 @@ class Crossecho(Device): return crosslet_stat # PROTECTED REGION END # // Crossecho.crosslet_stat_read - # ------------- # Pipes methods # ------------- @@ -166,9 +184,11 @@ class Crossecho(Device): def main(args=None, **kwargs): + """Main function of the Crossecho module.""" # PROTECTED REGION ID(Crossecho.main) ENABLED START # return run((Crossecho,), args=args, **kwargs) # PROTECTED REGION END # // Crossecho.main + if __name__ == '__main__': main()