diff options
Diffstat (limited to 'test/test_ctrl')
-rw-r--r-- | test/test_ctrl/ElecMeter.py | 98 | ||||
-rw-r--r-- | test/test_ctrl/ElecMeter_init.py | 105 | ||||
-rw-r--r-- | test/test_ctrl/ElecMeter_syn.py | 98 | ||||
-rw-r--r-- | test/test_ctrl/FirePapCtrl.py | 130 | ||||
-rw-r--r-- | test/test_ctrl/Vct6Ctrl.py | 146 | ||||
-rw-r--r-- | test/test_ctrl/Vct6Ctrl_init.py | 97 | ||||
-rw-r--r-- | test/test_ctrl/Vct6Ctrl_syn.py | 84 | ||||
-rw-r--r-- | test/test_ctrl/WaterPapCtrl.py | 162 | ||||
-rw-r--r-- | test/test_ctrl/WaterPapCtrl_init.py | 148 | ||||
-rw-r--r-- | test/test_ctrl/WaterPapCtrl_mis.py | 134 | ||||
-rw-r--r-- | test/test_ctrl/WaterPapCtrl_mis_extra.py | 144 | ||||
-rw-r--r-- | test/test_ctrl/WaterPapCtrl_mis_feat.py | 147 | ||||
-rw-r--r-- | test/test_ctrl/WaterPapCtrl_prop.py | 86 | ||||
-rw-r--r-- | test/test_ctrl/WaterPapCtrl_stat1.py | 142 | ||||
-rw-r--r-- | test/test_ctrl/WaterPapCtrl_stat2.py | 142 | ||||
-rw-r--r-- | test/test_ctrl/WaterPapCtrl_syn.py | 139 |
16 files changed, 0 insertions, 2002 deletions
diff --git a/test/test_ctrl/ElecMeter.py b/test/test_ctrl/ElecMeter.py deleted file mode 100644 index 20835ee7..00000000 --- a/test/test_ctrl/ElecMeter.py +++ /dev/null @@ -1,98 +0,0 @@ -import PyTango -import ZeroDController -import time - -class ElecMeterController(ZeroDController.ZeroDController): - "This class is the Tango Sardana Zero D controller for an Electrometer" - - ctrl_extra_attributes = {'Py0D_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}, - 'Py0D_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}, - 'Py0D_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}} - -# class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}} - - MaxDevice = 1 - - def __init__(self,inst,props): - ZeroDController.ZeroDController.__init__(self,inst,props) - print "PYTHON -> ZeroDController ctor for instance",inst -# raise NameError,"Ouuups" - - self.ct_name = "ZeroDController/" + self.inst_name -# self.simu_ctrl = None -# self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName) -# self.started = False - -# try: -# self.simu_ctrl.ping() -# except: -# self.simu_ctrl = None -# raise - - - def AddDevice(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In AddDevice method for index",ind -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In DeleteDevice method for index",ind - - def StateOne(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In StateOne method for index",ind -# if self.simu_ctrl != None: -# if self.started == True: -# now = time.time() -# delta_t = now - self.start_time -# print "delta_t =",delta_t -# if delta_t > 2.0: -# self.simu_ctrl.command_inout("Stop",self.wantedCT[0]) -# self.started = False -# sta = self.simu_ctrl.command_inout("GetCounterState",ind) -# print "State in controller =",sta -# tup = (sta,"Status error string from controller") -# else: -# raise RuntimeError,"Ctrl Tango's proxy null!!!" - tup = (PyTango.DevState.ON,"Status error string from controller") - return tup - - def PreReadAll(self): - print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadOne method for index",ind - - def ReadAll(self): - print "PYTHON -> ZeroDController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In ReadOne method for index",ind -# if self.simu_ctrl != None: -# return self.simu_ctrl.command_inout("GetCounterValue",ind) -# else: -# raise RuntimeError,"Ctrl Tango's proxy null!!!" - return 1.234 - - def GetExtraAttributePar(self,ind,name): - print "PYTHON -> ZeroDController/",self.inst_name,": In GetExtraFeaturePar method for index",ind," name=",name - if name == "Py0D_extra_1": - return 88.99 - - if name == "Py0D_extra_2": - return 33 - return 2233 - - def SetExtraAttributePar(self,ind,name,value): - print "PYTHON -> ZeroDController/",self.inst_name,": In SetExtraFeaturePar method for index",ind," name=",name," value=",value - - def SendToCtrl(self,in_data): - print "Received value =",in_data - return "Adios" - - def __del__(self): - print "PYTHON -> ZeroDController/",self.inst_name,": Aarrrrrg, I am dying" - - -if __name__ == "__main__": - obj = ZeroDController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/ElecMeter_init.py b/test/test_ctrl/ElecMeter_init.py deleted file mode 100644 index a990a38f..00000000 --- a/test/test_ctrl/ElecMeter_init.py +++ /dev/null @@ -1,105 +0,0 @@ -import PyTango -import ZeroDController -import time - -nb_call = 0 - -class ElecMeterController(ZeroDController.ZeroDController): - "This class is the Tango Sardana Zero D controller for an Electrometer" - - ctrl_extra_attributes = {'Py0D_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}, - 'Py0D_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}, - 'Py0D_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}} - -# class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}} - - MaxDevice = 1 - - def __init__(self,inst,props): - ZeroDController.ZeroDController.__init__(self,inst,props) - print "PYTHON -> ZeroDController ctor for instance",inst - - global nb_call - - if nb_call <= 1: - nb_call = nb_call + 1 - raise NameError,"Aille Aille Aille" - - self.ct_name = "ZeroDController/" + self.inst_name -# self.simu_ctrl = None -# self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName) -# self.started = False - -# try: -# self.simu_ctrl.ping() -# except: -# self.simu_ctrl = None -# raise - - - def AddDevice(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In AddDevice method for index",ind -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In DeleteDevice method for index",ind - - def StateOne(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In StateOne method for index",ind -# if self.simu_ctrl != None: -# if self.started == True: -# now = time.time() -# delta_t = now - self.start_time -# print "delta_t =",delta_t -# if delta_t > 2.0: -# self.simu_ctrl.command_inout("Stop",self.wantedCT[0]) -# self.started = False -# sta = self.simu_ctrl.command_inout("GetCounterState",ind) -# print "State in controller =",sta -# tup = (sta,"Status error string from controller") -# else: -# raise RuntimeError,"Ctrl Tango's proxy null!!!" - tup = (PyTango.DevState.ON,"Status error string from controller") - return tup - - def PreReadAll(self): - print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadOne method for index",ind - - def ReadAll(self): - print "PYTHON -> ZeroDController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In ReadOne method for index",ind -# if self.simu_ctrl != None: -# return self.simu_ctrl.command_inout("GetCounterValue",ind) -# else: -# raise RuntimeError,"Ctrl Tango's proxy null!!!" - return 1.234 - - def GetExtraAttributePar(self,ind,name): - print "PYTHON -> ZeroDController/",self.inst_name,": In GetExtraFeaturePar method for index",ind," name=",name - if name == "Py0D_extra_1": - return 88.99 - - if name == "Py0D_extra_2": - return 33 - return 2233 - - def SetExtraAttributePar(self,ind,name,value): - print "PYTHON -> ZeroDController/",self.inst_name,": In SetExtraFeaturePar method for index",ind," name=",name," value=",value - - def SendToCtrl(self,in_data): - print "Received value =",in_data - return "Adios" - - def __del__(self): - print "PYTHON -> ZeroDController/",self.inst_name,": Aarrrrrg, I am dying" - - -if __name__ == "__main__": - obj = ZeroDController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/ElecMeter_syn.py b/test/test_ctrl/ElecMeter_syn.py deleted file mode 100644 index ad0dc963..00000000 --- a/test/test_ctrl/ElecMeter_syn.py +++ /dev/null @@ -1,98 +0,0 @@ -import PyTango -import ZeroDController -import time - -class ElecMeterController(ZeroDController.ZeroDController): - "This class is the Tango Sardana Zero D controller for an Electrometer" - - ctrl_extra_attributes = {'Py0D_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}, - 'Py0D_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}, - 'Py0D_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}} - -# class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}} - - MaxDevice = 1 - - def __init__(self,inst,props): - ZeroDController.ZeroDController.__init__(self,inst,props) - print "PYTHON -> ZeroDController ctor for instance",inst -# raise NameError,"Ouuups" - - self.ct_name = "ZeroDController/" + self.inst_name -# self.simu_ctrl = None -# self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName) -# self.started = False - -# try: -# self.simu_ctrl.ping() -# except: -# self.simu_ctrl = None -# raise - - - def AddDevice(self,ind) - print "PYTHON -> ZeroDController/",self.inst_name,": In AddDevice method for index",ind -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In DeleteDevice method for index",ind - - def StateOne(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In StateOne method for index",ind -# if self.simu_ctrl != None: -# if self.started == True: -# now = time.time() -# delta_t = now - self.start_time -# print "delta_t =",delta_t -# if delta_t > 2.0: -# self.simu_ctrl.command_inout("Stop",self.wantedCT[0]) -# self.started = False -# sta = self.simu_ctrl.command_inout("GetCounterState",ind) -# print "State in controller =",sta -# tup = (sta,"Status error string from controller") -# else: -# raise RuntimeError,"Ctrl Tango's proxy null!!!" - tup = (PyTango.DevState.ON,"Status error string from controller") - return tup - - def PreReadAll(self): - print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadOne method for index",ind - - def ReadAll(self): - print "PYTHON -> ZeroDController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,ind): - print "PYTHON -> ZeroDController/",self.inst_name,": In ReadOne method for index",ind -# if self.simu_ctrl != None: -# return self.simu_ctrl.command_inout("GetCounterValue",ind) -# else: -# raise RuntimeError,"Ctrl Tango's proxy null!!!" - return 1.234 - - def GetExtraAttributePar(self,ind,name): - print "PYTHON -> ZeroDController/",self.inst_name,": In GetExtraFeaturePar method for index",ind," name=",name - if name == "Py0D_extra_1": - return 88.99 - - if name == "Py0D_extra_2": - return 33 - return 2233 - - def SetExtraAttributePar(self,ind,name,value): - print "PYTHON -> ZeroDController/",self.inst_name,": In SetExtraFeaturePar method for index",ind," name=",name," value=",value - - def SendToCtrl(self,in_data): - print "Received value =",in_data - return "Adios" - - def __del__(self): - print "PYTHON -> ZeroDController/",self.inst_name,": Aarrrrrg, I am dying" - - -if __name__ == "__main__": - obj = ZeroDController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/FirePapCtrl.py b/test/test_ctrl/FirePapCtrl.py deleted file mode 100644 index d3585a8f..00000000 --- a/test/test_ctrl/FirePapCtrl.py +++ /dev/null @@ -1,130 +0,0 @@ -import PyTango -import socket -import MotorController - -class FirePapController(MotorController.MotorController): - def __init__(self,inst,props): - print "PYTHON -> FirePapController ctor for instance",inst - MotorController.MotorController.__init__(self,inst,props) - - self.nb_call = 0; - self.socket_connected = False; - self.db = PyTango.Database() - self.ct_name = "FirePapController/" + self.inst_name - -# -# Get controller properties -# - - prop_list = ['host','port','timeout'] - prop = self.db.get_property(self.ct_name,prop_list) - - if len(prop["host"]) != 0: - self.host = prop["host"][0] - else: - print "Property host not defined for controller",self.ct_name - self.host = "nada" - - if len(prop["port"]) != 0: - self.port = int(prop["port"][0]) - else: - print "Property port not defined for controller",self.ct_name - self.port = 0 - - if len(prop["timeout"]) != 0: - self.timeout = int(prop["timeout"][0]) - else: - print "Property timeout not defined for controller",self.ct_name - self.timeout = 3 - - # - # Connect to the icepap - # - - print "PYTHON -> FirePap on",self.host," and port",self.port," with timeout = ",self.timeout - -# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -# self.sock.settimeout(self.timeout) -# self.sock.connect(("icepap", self.port)) -# self.socket_connected = True - - print "PYTHON -> Connected to", self.host, " on port", self.port - -# -# Check that the Icepap is OK -# - -# ans = self.IceWriteRead("?ID") - - - def AddDevice(self,axis): - print "PYTHON -> FirePapController/",self.inst_name,": In AddDevice method for axis",axis -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,axis): - print "PYTHON -> FirePapController/",self.inst_name,": In DeleteDevice method for axis",axis - - def StateOne(self,axis): - print "PYTHON -> FirePapController/",self.inst_name,": In StateOne method for axis",axis - tup = (PyTango.DevState.ON,0) - return tup - - def PreReadAll(self): - print "PYTHON -> FirePapController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,axis): - print "PYTHON -> FirePapController/",self.inst_name,": In PreReadOne method for axis",axis - - def ReadAll(self): - print "PYTHON -> FirePapController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,axis): - print "PYTHON -> FirePapController/",self.inst_name,": In ReadOne method for axis",axis - return 123 - - def PreStartAll(self): - print "PYTHON -> FirePapController/",self.inst_name,": In PreStartAll method" - - def PreStartOne(self,axis,pos): - print "PYTHON -> FirePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos - return True - - def StartOne(self,axis,pos): - print "PYTHON -> FirePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos - - def StartAll(self): - print "PYTHON -> FirePapController/",self.inst_name,": In StartAll method" - - def SetPar(self,axis,name,value): - print "PYTHON -> FirePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value - - def GetPar(self,axis,name): - print "PYTHON -> FirePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name - return 12.34 - - def IceWrite(self,data): - data = data + "\n" - byteSent = self.sock.send(data) - print "PYTHON -> Sent", byteSent, "bytes to icepap" - - def IceWriteRead(self,data): - self.IceWrite(data) - byteReceived = self.sock.recv(1024) - print "PYTHON -> Firepap answered:",byteReceived - return byteReceived - - def IceResetFifo(self): - self.IceWrite("fiforst") - - def IceCheckError(self,ice_answer): - if (ice_answer.find("ERROR") != -1): - new_ans = self.IceWriteRead("?ERR 1") - print "Error from FirePap =",new_ans - - def __del__(self): - print "PYTHON -> FirePapController/",self.inst_name,": Aarrrrrg, I am dying" - -if __name__ == "__main__": - obj = IcePapController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/Vct6Ctrl.py b/test/test_ctrl/Vct6Ctrl.py deleted file mode 100644 index 4d17fe9a..00000000 --- a/test/test_ctrl/Vct6Ctrl.py +++ /dev/null @@ -1,146 +0,0 @@ -import PyTango -import CounterTimerController -import time - -class Vct6Controller(CounterTimerController.CounterTimerController): - "This class is the Tango Sardana CounterTimer controller for the VCT6" - - ctrl_extra_attributes = {'PyCT_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}, - 'PyCT_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}, - 'PyCT_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}} - - class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}} - - MaxDevice = 6 - - def __init__(self,inst,props): - CounterTimerController.CounterTimerController.__init__(self,inst,props) - print "PYTHON -> Vct6Controller ctor for instance",inst -# raise NameError,"Ouuups" - - self.ct_name = "Vct6Controller/" + self.inst_name - self.simu_ctrl = None - self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName) - self.started = False - - self.dft_PyCT_extra_1 = 88.99 - self.dft_PyCT_extra_2 = 33 - self.dft_PyCT_extra_3 = True - - self.PyCT_extra_1 = [] - self.PyCT_extra_2 = [] - self.PyCT_extra_3 = [] - - try: - self.simu_ctrl.ping() - except: - self.simu_ctrl = None - raise - - - def AddDevice(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In AddDevice method for index",ind - self.PyCT_extra_1.append(self.dft_PyCT_extra_1) - self.PyCT_extra_2.append(self.dft_PyCT_extra_2) - self.PyCT_extra_3.append(self.dft_PyCT_extra_3) -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In DeleteDevice method for index",ind - - def StateOne(self,ind): - #print "PYTHON -> Vct6Controller/",self.inst_name,": In StateOne method for index",ind - if self.simu_ctrl != None: - if self.started == True: - now = time.time() - delta_t = now - self.start_time - print "delta_t =",delta_t - if delta_t > 2.0: - for index in self.wantedCT: - self.simu_ctrl.command_inout("Stop",index) - self.started = False - sta = self.simu_ctrl.command_inout("GetCounterState",ind) - #print "State in controller =",sta - tup = (sta,"Status error string from controller") - else: - raise RuntimeError,"Ctrl Tango's proxy null!!!" - return tup - - def PreReadAll(self): - #print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadAll method" - pass - - - def PreReadOne(self,ind): - #print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadOne method for index",ind - pass - - def ReadAll(self): - #print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadAll method" - pass - - def ReadOne(self,ind): - #print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadOne method for index",ind - pass - if self.simu_ctrl != None: - return self.simu_ctrl.command_inout("GetCounterValue",ind) - else: - raise RuntimeError,"Ctrl Tango's proxy null!!!" - - def AbortOne(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In AbortOne method for index",ind - if self.simu_ctrl != None: - self.simu_ctrl.command_inout("Stop",ind) - self.started = False - else: - raise RuntimeError,"Ctrl Tango's proxy null!!!" - - def PreStartAllCT(self): - #print "PYTHON -> Vct6Controller/",self.inst_name,": In PreStartAllCT method" - self.wantedCT = [] - - def StartOneCT(self,ind): - #print "PYTHON -> Vct6Controller/",self.inst_name,": In StartOneCT method for index",ind - self.wantedCT.append(ind) - - def StartAllCT(self): - #print "PYTHON -> Vct6Controller/",self.inst_name,": In StartAllCT method" - for index in self.wantedCT: - self.simu_ctrl.command_inout("Start",index) - self.started = True - self.start_time = time.time() - - def LoadOne(self,ind,value): - #print "PYTHON -> Vct6Controller/",self.inst_name,": In LoadOne method for index",ind," with value",value - if self.simu_ctrl != None: - self.simu_ctrl.command_inout("Clear",ind) - else: - raise RuntimeError,"Ctrl Tango's proxy null!!!" - - def GetExtraAttributePar(self,ind,name): - if name == "PyCT_extra_1": - return self.PyCT_extra_1[ind] - if name == "PyCT_extra_2": - return self.PyCT_extra_2[ind] - return self.PyCT_extra_3[ind] - - def SetExtraAttributePar(self,ind,name,value): - if name == "PyCT_extra_1": - self.PyCT_extra_1[ind] = value - elif name == "PyCT_extra_2": - self.PyCT_extra_2[ind] = value - else: - self.PyCT_extra_3[ind] = value - - def SendToCtrl(self,in_data): - print "Received value =",in_data - return "Adios" - - def __del__(self): - print "PYTHON -> Vct6Controller/",self.inst_name,": Aarrrrrg, I am dying" - - -if __name__ == "__main__": - obj = Vct6Controller('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/Vct6Ctrl_init.py b/test/test_ctrl/Vct6Ctrl_init.py deleted file mode 100644 index 45dee8b2..00000000 --- a/test/test_ctrl/Vct6Ctrl_init.py +++ /dev/null @@ -1,97 +0,0 @@ -import PyTango -import CounterTimerController - -nb_call = 0 - -class Vct6Controller(CounterTimerController.CounterTimerController): - "This class is the Tango Sardana CounterTimer controller for the VCT6" - - ctrl_extra_attributes = {'PyCT_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}, - 'PyCT_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}, - 'PyCT_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}} - - class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}} - - MaxDevice = 6 - - def __init__(self,inst,props): - CounterTimerController.CounterTimerController.__init__(self,inst,props) - print "PYTHON -> Vct6Controller ctor for instance",inst - - global nb_call - - if nb_call <= 1: - nb_call = nb_call + 1 - raise NameError,"Ouuups" - - self.ct_name = "Vct6Controller/" + self.inst_name - self.simu_ctrl = None - self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName) - - try: - self.simu_ctrl.ping() - except: - self.simu_ctrl = None - raise - - - def AddDevice(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In AddDevice method for index",ind -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In DeleteDevice method for index",ind - - def StateOne(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In StateOne method for index",ind - if self.simu_ctrl != None: - sta = self.simu_ctrl.command_inout("GetCounterState",ind) - print "State in controller =",sta - tup = (sta,"Status error string from controller") - else: - raise RuntimeError,"Ctrl Tango's proxy null!!!" - return tup - - def PreReadAll(self): - print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadOne method for index",ind - - def ReadAll(self): - print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadAll method" - - def ReadOne(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadOne method for index",ind - return 123 - - def GetExtraAttributePar(self,ind,name): - print "PYTHON -> Vct6Controller/",self.inst_name,": In GetExtraFeaturePar method for index",ind," name=",name - if name == "PyCT_extra_1": - return 88.99 - - if name == "PyCT_extra_2": - return 33 - return 2233 - - def SetExtraAttributePar(self,ind,name,value): - print "PYTHON -> Vct6Controller/",self.inst_name,": In SetExtraFeaturePar method for index",ind," name=",name," value=",value - - def SendToCtrl(self,in_data): - print "Received value =",in_data - return "Adios" - - def StartOneCT(self,ind): - print "In StartOneCT" - - def LoadAll(): - print "In LoadAll" - - def __del__(self): - print "PYTHON -> Vct6Controller/",self.inst_name,": Aarrrrrg, I am dying" - - -if __name__ == "__main__": - obj = Vct6Controller('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/Vct6Ctrl_syn.py b/test/test_ctrl/Vct6Ctrl_syn.py deleted file mode 100644 index 87069717..00000000 --- a/test/test_ctrl/Vct6Ctrl_syn.py +++ /dev/null @@ -1,84 +0,0 @@ -import PyTango -import CounterTimerController - -class Vct6Controller(CounterTimerController.CounterTimerController): - "This class is the Tango Sardana CounterTimer controller for the VCT6" - - ctrl_extra_attributes = {'PyCT_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}, - 'PyCT_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}, - 'PyCT_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}} - - class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}} - - MaxDevice = 6 - - def __init__(self,inst,props): - CounterTimerController.CounterTimerController.__init__(self,inst,props) - print "PYTHON -> Vct6Controller ctor for instance",inst -# raise NameError,"Ouuups" - - self.ct_name = "Vct6Controller/" + self.inst_name - self.simu_ctrl = None - self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName) - - try - self.simu_ctrl.ping() - except: - self.simu_ctrl = None - raise - - - def AddDevice(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In AddDevice method for index",ind -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In DeleteDevice method for index",ind - - def StateOne(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In StateOne method for index",ind - if self.simu_ctrl != None: - sta = self.simu_ctrl.command_inout("GetCounterState",ind) - print "State in controller =",sta - tup = (sta,"Status error string from controller") - else: - raise RuntimeError,"Ctrl Tango's proxy null!!!" - return tup - - def PreReadAll(self): - print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadOne method for index",ind - - def ReadAll(self): - print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadAll method" - - def ReadOne(self,ind): - print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadOne method for index",ind - return 123 - - def GetExtraAttributePar(self,ind,name): - print "PYTHON -> Vct6Controller/",self.inst_name,": In GetExtraFeaturePar method for index",ind," name=",name - if name == "PyCT_extra_1": - return 88.99 - - if name == "PyCT_extra_2": - return 33 - return 2233 - - def SetExtraAttributePar(self,ind,name,value): - print "PYTHON -> Vct6Controller/",self.inst_name,": In SetExtraFeaturePar method for index",ind," name=",name," value=",value - - def SendToCtrl(self,in_data): - print "Received value =",in_data - return "Adios" - - def __del__(self): - print "PYTHON -> Vct6Controller/",self.inst_name,": Aarrrrrg, I am dying" - - -if __name__ == "__main__": - obj = Vct6Controller('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/WaterPapCtrl.py b/test/test_ctrl/WaterPapCtrl.py deleted file mode 100644 index ffc95303..00000000 --- a/test/test_ctrl/WaterPapCtrl.py +++ /dev/null @@ -1,162 +0,0 @@ -import PyTango -import socket -import MotorController - -class IcePapController(MotorController.MotorController): - "This class is the Tango Sardana motor controller for the ICEPAP" - - ctrl_extra_attributes = {'First_extra':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}, - 'Second_extra':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}} -# 'Aaa':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}} - - ctrl_features = ['Encoder','Home_speed','Home_acceleration'] - - MaxDevice = 10 - - def __init__(self,inst,props): - MotorController.MotorController.__init__(self,inst,props) - print "PYTHON -> IcePapController ctor for instance",inst - - self.home_speed = 0.0 - self.nb_call = 0; - self.socket_connected = False; - self.db = PyTango.Database() - self.ct_name = "IcePapController/" + self.inst_name - -# -# Get controller properties -# - - prop_list = ['host','port','timeout'] - prop = self.db.get_property(self.ct_name,prop_list) - - if len(prop["host"]) != 0: - self.host = prop["host"][0] - else: - print "Property host not defined for controller",self.ct_name - self.host = "nada" - - if len(prop["port"]) != 0: - self.port = int(prop["port"][0]) - else: - print "Property port not defined for controller",self.ct_name - self.port = 0 - - if len(prop["timeout"]) != 0: - self.timeout = int(prop["timeout"][0]) - else: - print "Property timeout not defined for controller",self.ct_name - self.timeout = 3 - - # - # Connect to the icepap - # - - print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout - -# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -# self.sock.settimeout(self.timeout) -# self.sock.connect(("icepap", self.port)) -# self.socket_connected = True - - print "PYTHON -> Connected to", self.host, " on port", self.port - -# -# Check that the Icepap is OK -# - -# ans = self.IceWriteRead("?ID") - - - def AddDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis - - def StateOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis - tup = (PyTango.DevState.ON,0) - return tup - - def PreReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis - - def ReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis - return 123 - - def PreStartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method" - - def PreStartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos - return True - - def StartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos - - def StartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method" - - def SetPar(self,axis,name,value): - print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value - - def GetPar(self,axis,name): - print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name - return 12.34 - - def GetExtraAttributePar(self,axis,name): - print "PYTHON -> IcePapController/",self.inst_name,": In GetExtraFeaturePar method for axis",axis," name=",name - return 2233 - - def SetExtraAttributePar(self,axis,name,value): - print "PYTHON -> IcePapController/",self.inst_name,": In SetExtraFeaturePar method for axis",axis," name=",name," value=",value - - def IceWrite(self,data): - data = data + "\n" - byteSent = self.sock.send(data) - print "PYTHON -> Sent", byteSent, "bytes to icepap" - - def IceWriteRead(self,data): - self.IceWrite(data) - byteReceived = self.sock.recv(1024) - print "PYTHON -> Icepap answered:",byteReceived - return byteReceived - - def IceResetFifo(self): - self.IceWrite("fiforst") - - def IceCheckError(self,ice_answer): - if (ice_answer.find("ERROR") != -1): - new_ans = self.IceWriteRead("?ERR 1") - print "Error from IcePap =",new_ans - - def SendToCtrl(self,in_data): - print "Received value =",in_data - return "Adios" - - def __del__(self): - print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying" - -# -# Reset IcePap FIFO -# - - if (self.socket_connected == True): - print "PYTHON -> Closing connection" - self.IceResetFifo() - self.sock.close() - - -if __name__ == "__main__": - obj = IcePapController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/WaterPapCtrl_init.py b/test/test_ctrl/WaterPapCtrl_init.py deleted file mode 100644 index 176d7c5e..00000000 --- a/test/test_ctrl/WaterPapCtrl_init.py +++ /dev/null @@ -1,148 +0,0 @@ -import PyTango -import socket -import MotorController - -nb_call = 0 - -class IcePapController(MotorController.MotorController): - - MaxDevice = 4 - - def __init__(self,inst,props): - print "PYTHON -> IcePapController ctor for instance",inst - MotorController.MotorController.__init__(self,inst,props) - self.nb_call = 0; - self.socket_connected = False; - self.db = PyTango.Database() - self.ct_name = "IcePapController/" + self.inst_name - -# -# Get controller properties -# - - prop_list = ['host','port','timeout'] - prop = self.db.get_property(self.ct_name,prop_list) - - if len(prop["host"]) != 0: - self.host = prop["host"][0] - else: - print "Property host not defined for controller",self.ct_name - self.host = "nada" - - if len(prop["port"]) != 0: - self.port = int(prop["port"][0]) - else: - print "Property port not defined for controller",self.ct_name - self.port = 0 - - if len(prop["timeout"]) != 0: - self.timeout = int(prop["timeout"][0]) - else: - print "Property timeout not defined for controller",self.ct_name - self.timeout = 3 - - # - # Connect to the icepap - # - - print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout - - global nb_call - - if nb_call <= 1: - nb_call = nb_call + 1 - self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.sock.settimeout(self.timeout) - self.sock.connect((self.host, self.port)) - self.socket_connected = True - - print "PYTHON -> Connected to", self.host, " on port", self.port - -# -# Check that the Icepap is OK -# - -# ans = self.IceWriteRead("?ID") - - - def AddDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis - - def StateOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis - tup = (PyTango.DevState.ON,0) - return tup - - def PreReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis - - def ReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis - return 123 - - def PreStartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method" - - def PreStartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos - return True - - def StartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos - - def StartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method" - - def SetPar(self,axis,name,value): - print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value - - def GetPar(self,axis,name): - print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name - return 12.34 - - def IceWrite(self,data): - data = data + "\n" - byteSent = self.sock.send(data) - print "PYTHON -> Sent", byteSent, "bytes to icepap" - - def IceWriteRead(self,data): - self.IceWrite(data) - byteReceived = self.sock.recv(1024) - print "PYTHON -> Icepap answered:",byteReceived - return byteReceived - - def IceResetFifo(self): - self.IceWrite("fiforst") - - def IceCheckError(self,ice_answer): - if (ice_answer.find("ERROR") != -1): - new_ans = self.IceWriteRead("?ERR 1") - print "Error from IcePap =",new_ans - - def __del__(self): - print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying" - -# -# Reset IcePap FIFO -# - - if (self.socket_connected == True): - print "PYTHON -> Closing connection" - self.IceResetFifo() - self.sock.close() - - -if __name__ == "__main__": - obj = IcePapController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/WaterPapCtrl_mis.py b/test/test_ctrl/WaterPapCtrl_mis.py deleted file mode 100644 index a0323eb1..00000000 --- a/test/test_ctrl/WaterPapCtrl_mis.py +++ /dev/null @@ -1,134 +0,0 @@ -import PyTango -import socket -import MotorController - -class IcePapController(MotorController.MotorController): - def __init__(self,inst,props): - print "PYTHON -> IcePapController ctor for instance",inst - MotorController.MotorController.__init__(self,inst,props) - self.nb_call = 0; - self.socket_connected = False; - self.db = PyTango.Database() - self.ct_name = "IcePapController/" + self.inst_name - -# -# Get controller properties -# - - prop_list = ['host','port','timeout'] - prop = self.db.get_property(self.ct_name,prop_list) - - if len(prop["host"]) != 0: - self.host = prop["host"][0] - else: - print "Property host not defined for controller",self.ct_name - self.host = "nada" - - if len(prop["port"]) != 0: - self.port = int(prop["port"][0]) - else: - print "Property port not defined for controller",self.ct_name - self.port = 0 - - if len(prop["timeout"]) != 0: - self.timeout = int(prop["timeout"][0]) - else: - print "Property timeout not defined for controller",self.ct_name - self.timeout = 3 - - # - # Connect to the icepap - # - - print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout - -# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -# self.sock.settimeout(self.timeout) -# self.sock.connect(("icepap", self.port)) -# self.socket_connected = True - - print "PYTHON -> Connected to", self.host, " on port", self.port - -# -# Check that the Icepap is OK -# - -# ans = self.IceWriteRead("?ID") - - - def AddDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis - - def PreReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis - - def ReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis - return 123 - - def PreStartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method" - - def PreStartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos - return True - - def StartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos - - def StartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method" - - def SetPar(self,axis,name,value): - print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value - - def GetPar(self,axis,name): - print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name - return 12.34 - - def IceWrite(self,data): - data = data + "\n" - byteSent = self.sock.send(data) - print "PYTHON -> Sent", byteSent, "bytes to icepap" - - def IceWriteRead(self,data): - self.IceWrite(data) - byteReceived = self.sock.recv(1024) - print "PYTHON -> Icepap answered:",byteReceived - return byteReceived - - def IceResetFifo(self): - self.IceWrite("fiforst") - - def IceCheckError(self,ice_answer): - if (ice_answer.find("ERROR") != -1): - new_ans = self.IceWriteRead("?ERR 1") - print "Error from IcePap =",new_ans - - def __del__(self): - print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying" - -# -# Reset IcePap FIFO -# - - if (self.socket_connected == True): - print "PYTHON -> Closing connection" - self.IceResetFifo() - self.sock.close() - - -if __name__ == "__main__": - obj = IcePapController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/WaterPapCtrl_mis_extra.py b/test/test_ctrl/WaterPapCtrl_mis_extra.py deleted file mode 100644 index ad9f9b9b..00000000 --- a/test/test_ctrl/WaterPapCtrl_mis_extra.py +++ /dev/null @@ -1,144 +0,0 @@ -import PyTango -import socket -import MotorController - -class IcePapController(MotorController.MotorController): - - ctrl_extra_attributes = {'First_extra':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}, - 'Second_extra':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}} - MaxDevice = 12 - - def __init__(self,inst,props): - print "PYTHON -> IcePapController ctor for instance",inst - MotorController.MotorController.__init__(self,inst,props) - self.nb_call = 0; - self.socket_connected = False; - self.db = PyTango.Database() - self.ct_name = "IcePapController/" + self.inst_name - -# -# Get controller properties -# - - prop_list = ['host','port','timeout'] - prop = self.db.get_property(self.ct_name,prop_list) - - if len(prop["host"]) != 0: - self.host = prop["host"][0] - else: - print "Property host not defined for controller",self.ct_name - self.host = "nada" - - if len(prop["port"]) != 0: - self.port = int(prop["port"][0]) - else: - print "Property port not defined for controller",self.ct_name - self.port = 0 - - if len(prop["timeout"]) != 0: - self.timeout = int(prop["timeout"][0]) - else: - print "Property timeout not defined for controller",self.ct_name - self.timeout = 3 - - # - # Connect to the icepap - # - - print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout - -# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -# self.sock.settimeout(self.timeout) -# self.sock.connect(("icepap", self.port)) -# self.socket_connected = True - - print "PYTHON -> Connected to", self.host, " on port", self.port - -# -# Check that the Icepap is OK -# - -# ans = self.IceWriteRead("?ID") - - - def AddDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis - - def StateOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis - tup = (PyTango.DevState.ON,0) - return tup - - def PreReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis - - def ReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis - return 123 - - def PreStartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method" - - def PreStartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos - return True - - def StartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos - - def StartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method" - - def SetPar(self,axis,name,value): - print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value - - def GetPar(self,axis,name): - print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name - return 12.34 - - def IceWrite(self,data): - data = data + "\n" - byteSent = self.sock.send(data) - print "PYTHON -> Sent", byteSent, "bytes to icepap" - - def IceWriteRead(self,data): - self.IceWrite(data) - byteReceived = self.sock.recv(1024) - print "PYTHON -> Icepap answered:",byteReceived - return byteReceived - - def IceResetFifo(self): - self.IceWrite("fiforst") - - def IceCheckError(self,ice_answer): - if (ice_answer.find("ERROR") != -1): - new_ans = self.IceWriteRead("?ERR 1") - print "Error from IcePap =",new_ans - - def __del__(self): - print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying" - -# -# Reset IcePap FIFO -# - - if (self.socket_connected == True): - print "PYTHON -> Closing connection" - self.IceResetFifo() - self.sock.close() - - -if __name__ == "__main__": - obj = IcePapController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/WaterPapCtrl_mis_feat.py b/test/test_ctrl/WaterPapCtrl_mis_feat.py deleted file mode 100644 index 284166f9..00000000 --- a/test/test_ctrl/WaterPapCtrl_mis_feat.py +++ /dev/null @@ -1,147 +0,0 @@ -import PyTango -import socket -import MotorController - -class IcePapController(MotorController.MotorController): - - ctrl_features = ['Encoder','CanDoBacklash'] - - ctrl_extra_attributes = {'First_extra':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}, - 'Second_extra':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}} - - MaxDevice = 11 - - def __init__(self,inst,props): - print "PYTHON -> IcePapController ctor for instance",inst - MotorController.MotorController.__init__(self,inst,props) - self.nb_call = 0; - self.socket_connected = False; - self.db = PyTango.Database() - self.ct_name = "IcePapController/" + self.inst_name - -# -# Get controller properties -# - - prop_list = ['host','port','timeout'] - prop = self.db.get_property(self.ct_name,prop_list) - - if len(prop["host"]) != 0: - self.host = prop["host"][0] - else: - print "Property host not defined for controller",self.ct_name - self.host = "nada" - - if len(prop["port"]) != 0: - self.port = int(prop["port"][0]) - else: - print "Property port not defined for controller",self.ct_name - self.port = 0 - - if len(prop["timeout"]) != 0: - self.timeout = int(prop["timeout"][0]) - else: - print "Property timeout not defined for controller",self.ct_name - self.timeout = 3 - - # - # Connect to the icepap - # - - print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout - -# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -# self.sock.settimeout(self.timeout) -# self.sock.connect(("icepap", self.port)) -# self.socket_connected = True - - print "PYTHON -> Connected to", self.host, " on port", self.port - -# -# Check that the Icepap is OK -# - -# ans = self.IceWriteRead("?ID") - - - def AddDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis - - def StateOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis - tup = (PyTango.DevState.ON,0) - return tup - - def PreReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis - - def ReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis - return 123 - - def PreStartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method" - - def PreStartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos - return True - - def StartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos - - def StartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method" - - def SetPar(self,axis,name,value): - print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value - - def GetPar(self,axis,name): - print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name - return 12.34 - - def IceWrite(self,data): - data = data + "\n" - byteSent = self.sock.send(data) - print "PYTHON -> Sent", byteSent, "bytes to icepap" - - def IceWriteRead(self,data): - self.IceWrite(data) - byteReceived = self.sock.recv(1024) - print "PYTHON -> Icepap answered:",byteReceived - return byteReceived - - def IceResetFifo(self): - self.IceWrite("fiforst") - - def IceCheckError(self,ice_answer): - if (ice_answer.find("ERROR") != -1): - new_ans = self.IceWriteRead("?ERR 1") - print "Error from IcePap =",new_ans - - def __del__(self): - print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying" - -# -# Reset IcePap FIFO -# - - if (self.socket_connected == True): - print "PYTHON -> Closing connection" - self.IceResetFifo() - self.sock.close() - - -if __name__ == "__main__": - obj = IcePapController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/WaterPapCtrl_prop.py b/test/test_ctrl/WaterPapCtrl_prop.py deleted file mode 100644 index 1cbee513..00000000 --- a/test/test_ctrl/WaterPapCtrl_prop.py +++ /dev/null @@ -1,86 +0,0 @@ -import PyTango -import socket -import MotorController - -class IcePapController(MotorController.MotorController): - "This class is the Tango Sardana motor controller for the ICEPAP with properties" - - ctrl_features = ['Encoder','Home_speed','Home_acceleration'] - - class_prop = {'A_Class_Prop':{'Type':'PyTango.DevLong','Description':'A class property','DefaultValue':20}, - 'Another_Class_Prop':{'Type':'PyTango.DevDouble','Description':'Bla bla bla','DefaultValue':2.345}, - 'Host':{'Type':'PyTango.DevString','Description':'The host name'}, - 'Port':{'Type':'PyTango.DevLong','Description':'The port number'}} - - ctrl_extra_attributes = {'First_extra':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}, - 'Second_extra':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}} - MaxDevice = 22 - - def __init__(self,inst,props): - MotorController.MotorController.__init__(self,inst,props) - print "PYTHON -> IcePapController ctor for instance",inst - - self.home_speed = 0.0 - self.nb_call = 0; - self.timeout = 3 - - print "PYTHON -> IcePap on",self.Host," and port",self.Port," with timeout = ",self.timeout - print "PYTHON -> Connected to", self.Host, " on port", self.Port - - - def AddDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis - - def DeleteDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis - - def StateOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis - tup = (PyTango.DevState.ON,0) - return tup - - def PreReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis - - def ReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis - return 123 - - def PreStartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method" - - def PreStartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos - return True - - def StartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos - - def StartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method" - - def SetPar(self,axis,name,value): - print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value - - def GetPar(self,axis,name): - print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name - return 12.34 - - def GetExtraAttributePar(self,axis,name): - print "PYTHON -> IcePapController/",self.inst_name,": In GetExtraAttributePar method for axis",axis," name=",name - return 2233 - - def SetExtraAttributePar(self,axis,name,value): - print "PYTHON -> IcePapController/",self.inst_name,": In SetExtraAttributePar method for axis",axis," name=",name," value=",value - - def __del__(self): - print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying" - -if __name__ == "__main__": - obj = IcePapController('test') diff --git a/test/test_ctrl/WaterPapCtrl_stat1.py b/test/test_ctrl/WaterPapCtrl_stat1.py deleted file mode 100644 index 352c6ca4..00000000 --- a/test/test_ctrl/WaterPapCtrl_stat1.py +++ /dev/null @@ -1,142 +0,0 @@ -import PyTango -import socket -import MotorController - -class IcePapController(MotorController.MotorController): - - MaxDevice = 6 - - def __init__(self,inst,props): - print "PYTHON -> IcePapController ctor for instance",inst - MotorController.MotorController.__init__(self,inst,props) - self.nb_call = 0; - self.socket_connected = False; - self.db = PyTango.Database() - self.ct_name = "IcePapController/" + self.inst_name - -# -# Get controller properties -# - - prop_list = ['host','port','timeout'] - prop = self.db.get_property(self.ct_name,prop_list) - - if len(prop["host"]) != 0: - self.host = prop["host"][0] - else: - print "Property host not defined for controller",self.ct_name - self.host = "nada" - - if len(prop["port"]) != 0: - self.port = int(prop["port"][0]) - else: - print "Property port not defined for controller",self.ct_name - self.port = 0 - - if len(prop["timeout"]) != 0: - self.timeout = int(prop["timeout"][0]) - else: - print "Property timeout not defined for controller",self.ct_name - self.timeout = 3 - - # - # Connect to the icepap - # - - print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout - -# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -# self.sock.settimeout(self.timeout) -# self.sock.connect(("icepap", self.port)) -# self.socket_connected = True - - print "PYTHON -> Connected to", self.host, " on port", self.port - -# -# Check that the Icepap is OK -# - -# ans = self.IceWriteRead("?ID") - - - def AddDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis - - def StateOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis - tup = (PyTango.DevState.FAULT,0,"Hola tio") - return tup - - def PreReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis - - def ReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis - return 123 - - def PreStartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method" - - def PreStartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos - return True - - def StartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos - - def StartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method" - - def SetPar(self,axis,name,value): - print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value - - def GetPar(self,axis,name): - print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name - return 12.34 - - def IceWrite(self,data): - data = data + "\n" - byteSent = self.sock.send(data) - print "PYTHON -> Sent", byteSent, "bytes to icepap" - - def IceWriteRead(self,data): - self.IceWrite(data) - byteReceived = self.sock.recv(1024) - print "PYTHON -> Icepap answered:",byteReceived - return byteReceived - - def IceResetFifo(self): - self.IceWrite("fiforst") - - def IceCheckError(self,ice_answer): - if (ice_answer.find("ERROR") != -1): - new_ans = self.IceWriteRead("?ERR 1") - print "Error from IcePap =",new_ans - - def __del__(self): - print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying" - -# -# Reset IcePap FIFO -# - - if (self.socket_connected == True): - print "PYTHON -> Closing connection" - self.IceResetFifo() - self.sock.close() - - -if __name__ == "__main__": - obj = IcePapController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/WaterPapCtrl_stat2.py b/test/test_ctrl/WaterPapCtrl_stat2.py deleted file mode 100644 index 5c3ef17e..00000000 --- a/test/test_ctrl/WaterPapCtrl_stat2.py +++ /dev/null @@ -1,142 +0,0 @@ -import PyTango -import socket -import MotorController - -class IcePapController(MotorController.MotorController): - - MaxDevice = 7 - - def __init__(self,inst,props): - print "PYTHON -> IcePapController ctor for instance",inst - MotorController.MotorController.__init__(self,inst,props) - self.nb_call = 0; - self.socket_connected = False; - self.db = PyTango.Database() - self.ct_name = "IcePapController/" + self.inst_name - -# -# Get controller properties -# - - prop_list = ['host','port','timeout'] - prop = self.db.get_property(self.ct_name,prop_list) - - if len(prop["host"]) != 0: - self.host = prop["host"][0] - else: - print "Property host not defined for controller",self.ct_name - self.host = "nada" - - if len(prop["port"]) != 0: - self.port = int(prop["port"][0]) - else: - print "Property port not defined for controller",self.ct_name - self.port = 0 - - if len(prop["timeout"]) != 0: - self.timeout = int(prop["timeout"][0]) - else: - print "Property timeout not defined for controller",self.ct_name - self.timeout = 3 - - # - # Connect to the icepap - # - - print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout - -# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -# self.sock.settimeout(self.timeout) -# self.sock.connect(("icepap", self.port)) -# self.socket_connected = True - - print "PYTHON -> Connected to", self.host, " on port", self.port - -# -# Check that the Icepap is OK -# - -# ans = self.IceWriteRead("?ID") - - - def AddDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis - - def StateOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis - tup = (PyTango.DevState.FAULT,0,"Hola mujeres de Barcelona") - return tup - - def PreReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis - - def ReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis - return 123 - - def PreStartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method" - - def PreStartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos - return True - - def StartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos - - def StartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method" - - def SetPar(self,axis,name,value): - print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value - - def GetPar(self,axis,name): - print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name - return 12.34 - - def IceWrite(self,data): - data = data + "\n" - byteSent = self.sock.send(data) - print "PYTHON -> Sent", byteSent, "bytes to icepap" - - def IceWriteRead(self,data): - self.IceWrite(data) - byteReceived = self.sock.recv(1024) - print "PYTHON -> Icepap answered:",byteReceived - return byteReceived - - def IceResetFifo(self): - self.IceWrite("fiforst") - - def IceCheckError(self,ice_answer): - if (ice_answer.find("ERROR") != -1): - new_ans = self.IceWriteRead("?ERR 1") - print "Error from IcePap =",new_ans - - def __del__(self): - print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying" - -# -# Reset IcePap FIFO -# - - if (self.socket_connected == True): - print "PYTHON -> Closing connection" - self.IceResetFifo() - self.sock.close() - - -if __name__ == "__main__": - obj = IcePapController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) diff --git a/test/test_ctrl/WaterPapCtrl_syn.py b/test/test_ctrl/WaterPapCtrl_syn.py deleted file mode 100644 index 45a2351d..00000000 --- a/test/test_ctrl/WaterPapCtrl_syn.py +++ /dev/null @@ -1,139 +0,0 @@ -import PyTango -import socket -import MotorController - -class IcePapController(MotorController.MotorController): - def __init__(self,inst,props): - print "PYTHON -> IcePapController ctor for instance",inst - MotorController.MotorController.__init__(self,inst,props) - self.nb_call = 0; - self.socket_connected = False; - self.db = PyTango.Database() - self.ct_name = "IcePapController/" + self.inst_name - -# -# Get controller properties -# - - prop_list = ['host','port','timeout'] - prop = self.db.get_property(self.ct_name,prop_list) - - if len(prop["host"]) != 0 - self.host = prop["host"][0] - else: - print "Property host not defined for controller",self.ct_name - self.host = "nada" - - if len(prop["port"]) != 0: - self.port = int(prop["port"][0]) - else: - print "Property port not defined for controller",self.ct_name - self.port = 0 - - if len(prop["timeout"]) != 0: - self.timeout = int(prop["timeout"][0]) - else: - print "Property timeout not defined for controller",self.ct_name - self.timeout = 3 - - # - # Connect to the icepap - # - - print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout - -# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -# self.sock.settimeout(self.timeout) -# self.sock.connect(("icepap", self.port)) -# self.socket_connected = True - - print "PYTHON -> Connected to", self.host, " on port", self.port - -# -# Check that the Icepap is OK -# - -# ans = self.IceWriteRead("?ID") - - - def AddDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis -# raise RuntimeError,"Hola la la" - - def DeleteDevice(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis - - def StateOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis - tup = (PyTango.DevState.ON,0) - return tup - - def PreReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method" - - def PreReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis - - def ReadAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method" - - def ReadOne(self,axis): - print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis - return 123 - - def PreStartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method" - - def PreStartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos - return True - - def StartOne(self,axis,pos): - print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos - - def StartAll(self): - print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method" - - def SetPar(self,axis,name,value): - print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value - - def GetPar(self,axis,name): - print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name - return 12.34 - - def IceWrite(self,data): - data = data + "\n" - byteSent = self.sock.send(data) - print "PYTHON -> Sent", byteSent, "bytes to icepap" - - def IceWriteRead(self,data): - self.IceWrite(data) - byteReceived = self.sock.recv(1024) - print "PYTHON -> Icepap answered:",byteReceived - return byteReceived - - def IceResetFifo(self): - self.IceWrite("fiforst") - - def IceCheckError(self,ice_answer): - if (ice_answer.find("ERROR") != -1): - new_ans = self.IceWriteRead("?ERR 1") - print "Error from IcePap =",new_ans - - def __del__(self): - print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying" - -# -# Reset IcePap FIFO -# - - if (self.socket_connected == True): - print "PYTHON -> Closing connection" - self.IceResetFifo() - self.sock.close() - - -if __name__ == "__main__": - obj = IcePapController('test') -# obj.AddDevice(2) -# obj.DeleteDevice(2) |