def MoveMotors(self):
        """ 
        :rtype: PyTango.DevBoolean
        """
        self.debug_stream("In MoveMotors()")
        argout = False
        #----- PROTECTED REGION ID(ManageServer.MoveMotors) ENABLED START -----#
        g = PyTango.Group("my_group")
        g.add("simulation/huiling/1")
        g.add("bottom/hhl/1")

        # execute a command with the same parameter value for all devices in the group
        data = PyTango.DeviceData()
        data.insert(PyTango.DevDouble, 30.000)
        #g.command_inout("SetPosition", data)

        # execute a command with different parameter values, one for each device in the group
        data_list = PyTango.DeviceDataList()
        data1 = PyTango.DeviceData()
        data1.insert(PyTango.DevDouble, 30.000)
        data2 = PyTango.DeviceData()
        data2.insert(PyTango.DevDouble, -30.000)
        data_list.append(data1)
        data_list.append(data2)
        g.command_inout("SetPosition", data_list)
        argout=True
        #----- PROTECTED REGION END -----#	//	ManageServer.MoveMotors
        return argout
示例#2
0
 def send(self, exchange):
     attribute_values = self.encoder.encode(exchange)
     param = None
     if attribute_values:
         param_type = PyTango.DevVarStringArray
         param = PyTango.DeviceData()
         param.insert(param_type, attribute_values)
     for des in exchange.destination:
         device_proxy = self.communication.get_device_proxy(
             self.communication.comp_device[des])
         call = getattr(device_proxy, exchange.value)
         call(param)
    def SerialLine(self):
        """ 
        :rtype: PyTango.DevString
        """
        self.debug_stream("In SerialLine()")
        argout = ""
        #----- PROTECTED REGION ID(ManageServer.SerialLine) ENABLED START -----#
        dev1 = PyTango.DeviceProxy("simulation/huiling/1")
        dev2 = PyTango.DeviceProxy("bottom/hhl/1")
        dev1.set_green_mode(GreenMode.Gevent) 
        dev2.set_green_mode(GreenMode.Gevent)
        dev1.set_timeout_millis(20000)
        dev2.set_timeout_millis(20000)
     
        try:
            dev1.command_inout('SetPosition', 40.000)
            gevent.sleep(3)
            position = dev1.read_attribute('Position', wait=True, timeout=None)
            dev1_position = position.value            
            if dev1_position == 40.0:           
                data = PyTango.DeviceData()
                data.insert(PyTango.DevDouble, -40.000)
                dev2.command_inout("SetPosition", data)
                gevent.sleep(3)
                position2 = dev2.read_attribute('Position',wait=True, timeout=None)   
                dev2_position = position2.value
                if dev2_position == -40.0:
                    return 'SerialLine works'
                else:                    
                    return 'Device:bottom/hhl/1 Error'   
            else:
                    return 'Device:simulation/Huiling/1 Error'
          
        except PyTango.DevFailed as e:
            print ('-------> Received a DevFailed exception:', e)
        except Exception as e:
            print ('-------> An unforeseen exception occured....', e)

       
        #----- PROTECTED REGION END -----#	//	ManageServer.SerialLine
        return argout