From 23ae9ac77cc8d359e5237437e40584049e9f6a25 Mon Sep 17 00:00:00 2001 From: Ondrej Mikle Date: Sun, 20 Jul 2014 01:43:54 +0200 Subject: [PATCH] Make the UID read into infinite cycle --- brmdoor_nfc_daemon.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/brmdoor_nfc_daemon.py b/brmdoor_nfc_daemon.py index 7f25c57..48544d8 100644 --- a/brmdoor_nfc_daemon.py +++ b/brmdoor_nfc_daemon.py @@ -27,14 +27,15 @@ class NfcThread(threading.Thread): stores it into uidQueue for later authentication check. """ self.nfc = NFCDevice() - try: - uid_hex = hexlify(self.nfc.scanUID()) - print uid_hex - logging.info("Got UID %s" % uid_hex) - self.uidQueue.put(uid_hex) - except NFCError, e: - logging.warn("Failed to wait for RFID card", e) - + while True: + try: + uid_hex = hexlify(self.nfc.scanUID()) + print uid_hex + logging.info("Got UID %s" % uid_hex) + self.uidQueue.put(uid_hex) + except NFCError, e: + logging.warn("Failed to wait for RFID card", e) + class UnlockThread(threading.Thread): """Thread checking UIDs whether they are authorized"""