Ejemplo n.º 1
0
    def Run(self):
        with self.protocol.lockCmd:
            if not self.Authorized():
                self.SendUnauthorizedResp()
                return
            if self.protocol.role == BaseCommand.PV_ROLE_HUMAN:
                return
            CBaseCommand.Run(self)
            with self.protocol.cond_dictControlling:
                request = self.protocol.dictControlling.pop(
                    self.command_seq, None)
                if request is not None:
                    logging.debug(
                        "call self.protocol.cond_dictControlling.notify() due to CControlDeviceResp in protocol %d",
                        id(self.protocol.transport))
                    if request.timer != None:
                        request.timer.cancel()
                        request.timer = None
                    self.protocol.cond_dictControlling.notify()
                else:
                    logging.debug(
                        "fail to self.protocol.dictControlling.pop(%d) due to CControlDeviceResp in protocol %d",
                        self.command_seq, id(self.protocol.transport))
                #if request is not None: self.protocol.cond_dictControlling.notify()

            relayer_id = None
            if self.protocol.role == BaseCommand.PV_ROLE_INTERNAL:
                with self.protocol.lock_dictWaitResp:
                    # request=self.protocol.dictWaitResp.pop((self.internalMessage.fromId<<32)+self.command_seq,None)
                    request = self.protocol.dictWaitResp.pop(
                        (self.internalMessage.destSock << 32) +
                        self.command_seq, None)
                relayer_id = self.internalMessage.fromId
            elif self.protocol.role == BaseCommand.PV_ROLE_RELAYER:
                with self.protocol.lock_dictWaitResp:
                    request = self.protocol.dictWaitResp.pop(
                        self.command_seq, None)
                relayer_id = self.protocol.relayer_id

            print("run ControlDeviceREsp", request)
            if request is None:
                return  # this request has been feedbacked or timeout
            requireCommand = request.requireCommand
            requireCommand.FinishOne(relayer_id, request, self)
            request.requireCommand = None
Ejemplo n.º 2
0
 def __init__(self, data=None, protocol=None):
     '''
     Constructor
     '''
     CBaseCommand.__init__(self, data, protocol)
Ejemplo n.º 3
0
 def __init__(self,data=None,protocol=None):
     '''
     Constructor
     '''
     CBaseCommand.__init__(self, data, protocol)
Ejemplo n.º 4
0
 def Run(self):
     #if not self.Authorized(): return
     CBaseCommand.Run(self)
     self.SendResp()
Ejemplo n.º 5
0
 def __init__(self, data=None, protocol=None):
     """
     Constructor
     """
     CBaseCommand.__init__(self, data, protocol)