예제 #1
0
 def init_device(self):
     self.debug_stream("In init_device()")
     
     self.get_device_properties(self.get_device_class())
     self.get_DynDS_properties() 
     
     self.attr_ACQState_read = False
     self.attr_ClockSource_read = ''
     self.attr_DCMStatus_read = ''
     self.attr_GainLevel_read = [0]
     
     try:
         self.lyrtech = Lyrtech(self.PyLyrtechDS, self.BoardId, self.FWFilename)
         
         # Check if Lyrtech device is not in RUN state, otherwhise reload software
         if self.lyrtech.getACQState() == False:
             self.lyrtech.recongifureFPGA()
             time.sleep(10)
             msg ="Lyrtech communication stablish, but NOT running"
             self.debug_stream(msg)
             self.set_status('ON: %s'%msg)
             self.set_state(PyTango.DevState.ON)
     except Exception, e:
         print e
         msg = "No Lyrtech board found. Check boardId is properly initialized"
         self.set_status('FAULT: %s'%msg)
         self.error_stream(msg)
         self.set_state(PyTango.DevState.FAULT)
예제 #2
0
class PyLyrtechFacade (fandango.DynamicDS):

    def __init__(self,cl, name):
        #PyTango.Device_4Impl.__init__(self,cl,name)
        fandango.DynamicDS.__init__(self,cl,name,_locals={
                                                            'math': math,
                                                            'avg': lambda value: fandango.avg(value),
                                                            'ReadDiags':lambda _addr: self.ReadDiags(_addr),
                                                            'ReadSetting':lambda _addr: self.ReadSetting(_addr),
                                                            'WriteSetting':lambda _addr,val: self.WriteSetting([_addr,val]),
                                                         })        
        self.debug_stream("In __init__()")
        PyLyrtechFacade.init_device(self)
        
    def delete_device(self):
        self.debug_stream("In delete_device()")

    def init_device(self):
        self.debug_stream("In init_device()")
        
        self.get_device_properties(self.get_device_class())
        self.get_DynDS_properties() 
        
        self.attr_ACQState_read = False
        self.attr_ClockSource_read = ''
        self.attr_DCMStatus_read = ''
        self.attr_GainLevel_read = [0]
        
        try:
            self.lyrtech = Lyrtech(self.PyLyrtechDS, self.BoardId, self.FWFilename)
            
            # Check if Lyrtech device is not in RUN state, otherwhise reload software
            if self.lyrtech.getACQState() == False:
                self.lyrtech.recongifureFPGA()
                time.sleep(10)
                msg ="Lyrtech communication stablish, but NOT running"
                self.debug_stream(msg)
                self.set_status('ON: %s'%msg)
                self.set_state(PyTango.DevState.ON)
        except Exception, e:
            print e
            msg = "No Lyrtech board found. Check boardId is properly initialized"
            self.set_status('FAULT: %s'%msg)
            self.error_stream(msg)
            self.set_state(PyTango.DevState.FAULT)