Example #1
0
 def run(self):
     
     try:
         # wait for transmit() to be called
         self.startLock.acquire()
         
         # log
         log.debug('start FSM')
         
         while self.fsmGoOn:
             # wait for the FSM to be kicked
             self.fsmSem.acquire()
             
             # log
             log.debug('fsm state iteration: {0}'.format(self.getState()))
             
             # call the appropriate action
             self.fsmAction[self.getState()]()
             
             # is interaction done?
             with self.dataLock:
                 if self.coapError or self.coapResponse:
                     self.endLock.release()
                     self.fsmGoOn=False
     except Exception as err:
         log.critical(u.formatCrashMessage(
                 threadName = self.name,
                 error      = err
             )
         )
Example #2
0
    def run(self):

        try:
            # wait for transmit() to be called
            self.startLock.acquire()

            # log
            log.debug('start FSM')

            while self.fsmGoOn:
                # wait for the FSM to be kicked
                self.fsmSem.acquire()

                # log
                log.debug('fsm state iteration: {0}'.format(self.getState()))

                # call the appropriate action
                self.fsmAction[self.getState()]()

                # is interaction done?
                with self.dataLock:
                    if self.coapError or self.coapResponse:
                        self.endLock.release()
                        self.fsmGoOn = False
        except Exception as err:
            log.critical(u.formatCrashMessage(threadName=self.name, error=err))