def tick(self):
        with self.lock:
            inject = INJECT_READY
            evt, apdu = self.receiveCommandApdu()
            if evt == EVT_RESET:
                self.resetCards()
                return
            if not apdu:
                if (not self.inject or
                        self.rapduInject):  # Wait until rapduInject is consumed
                    return
                else:
                    inject = self.inject
                    apdu = self.apduInjectedData
                    self.apduInjectedData = None
            if not apdu:
                raise Exception("APDU is empty")
            self.lastUpdate = time.time()
            cardsData = self.getHandlers(apdu, inject)
            responseApdu = None
            for cardData in cardsData:
                if cardData == cardsData[0]:
                    apduHex = hextools.bytes2hex(apdu)
                    self.loggingApdu.info("")
                    self.loggingApdu.info("C-APDU%d: %s" %(self.getSimId(cardData[0]), apduHex))
                responseApduTemp = self.handleApdu(cardData, apdu)
                if cardData[1]:
                    if cardData[0] != self.getMainCard(0):
                        self.loggingApdu.info("*R-APDU%d" %self.getSimId(cardData[0]))
                    responseApdu = responseApduTemp
                self.updateHandler(cardData, apdu, responseApduTemp)
            if not responseApdu and not inject:
                raise Exception("No response received")
            if inject:
                self.rapduInject = responseApduTemp