- try:
- mifare_uid = self.mifare.get_card_uid()
- except ValueError:
- mifare_uid = None
- if mifare_uid != None:
- logging.info('Got MIFARE uid %s'%(str(mifare_uid)))
- self.events.append((MIFARE, mifare_uid))
- timeout = 0
+ if self.mifare:
+ now = time()
+ if now > self.mifare_timeout:
+ self.mifare_timeout = now + 0.5
+ mifare_uid = self.mifare.get_card_id()
+ if mifare_uid != None:
+ logging.info('Got MIFARE card id %s'%(repr(mifare_uid)))
+ self.events.append((MIFARE, mifare_uid))
+ timeout = 0
+ if timeout == 0:
+ break