コード例 #1
0
ファイル: LampCallback.py プロジェクト: ydc92546169/ACS
 def exceptionMethod(self):
     '''
     Python implementation of IDL method.
     void exceptionMethod() raises (LampUnavailable);
     '''
     raise demo.LampUnavailable()
     return
コード例 #2
0
ファイル: LampCallback.py プロジェクト: ydc92546169/ACS
 def monitorLampBrightness(self):
     '''
     Python implementation of IDL method.
     double monitorLampBrightness() raises (LampUnavailable);
     '''
     if self.brightness == None:  #method failed or hasn't been called before
         try:
             lamp = self.getComponent("LAMP1")
             self.brightness = lamp._get_brightness()
             self.cb = CBdouble(name="brightness", archive=1)
             self.monitor = None
         except Exception, e:
             raise demo.LampUnavailable()
コード例 #3
0
ファイル: LampCallback.py プロジェクト: ydc92546169/ACS
    def stopMonitor(self):
        '''
        Python implementation of IDL method.
        void stopMonitor() raises (LampUnavailable);
        '''
        print "brightness monitor values were:", self.cb.values

        if self.monitor != None:
            self.monitor.destroy()  #destroy the CORBA monitor
            self.monitor = None  #reset
            self.cb.values = []  #reset
        else:
            raise demo.LampUnavailable()
        
        return
コード例 #4
0
    def getLampBrightness(self):
        '''
        Python implementation of IDL method.
        double getLampBrightness() raises (LampUnavailable);
        '''
        self.getLogger().logInfo("called...")

        #raise the CORBA exception is the lamp doesn't exist
        if not self.brightness:
            raise demo.LampUnavailable()

        #get the brightness value along with the completion
        (realValue, completion) = self.brightness.get_sync()

        #return what the developer is interested in
        return realValue
コード例 #5
0
    def setLampBrightness(self, brightness):
        '''
        Python implementation of IDL method.
        void setLampBrightness(in double brightness) raises (LampUnavailable);
        '''
        self.getLogger().logInfo("called...")

        #raise the CORBA exception if the lamp doesn't exist
        if self.brightness == None:
            raise demo.LampUnavailable()

        #set the brightness
        #first create a CBvoid class to be used with the set asynchronous command
        joe = CBvoid()
        self.brightness.set_async(
            float(brightness),  #double value for the property
            self.activateOffShoot(
                joe),  #create the CORBA servant for callback instance
            ACS.CBDescIn(0L, 0L, 0L))  #just cut and paste this code=)

        #Nothing to return
        return