diff --git a/src/test/rfid.py b/src/test/rfid.py index b7afc48..14caac2 100644 --- a/src/test/rfid.py +++ b/src/test/rfid.py @@ -41,53 +41,54 @@ else: while True: try: if not connected: - logging.info("Attempting to connect to NFC reader...") clf = nfc.ContactlessFrontend() for dev in dev_list: connected = clf.open(dev) if connected: - logging.info(f"CONNECTED TO {dev}") + print(f"CONNECTED TO {dev}") break else: - logging.error(f"UNABLE TO CONNECT TO {dev}") + print(f"UNABLE TO CONNECT TO {dev}") if connected: target = clf.sense(RemoteTarget('106A'), RemoteTarget('106B'), RemoteTarget('212F')) if target is not None: tag = nfc.tag.activate(clf, target) if tag is not None: - logging.info(f"Tag detected: {tag}") + print(tag) if tag.ndef is not None: if not len(tag.ndef.records): - logging.info("EMPTY TAG - WRITING...") + print("EMPTY TAG - WRITING...") if not tag.ndef.is_writeable: - logging.warning("This Tag is not writeable.") + print("This Tag is not writeable.") break else: tag.format() - record = ndef.TextRecord("Errecinque,fixture,5812345678") + #tag.ndef.records = [ndef.TextRecord("Errecinque"),ndef.TextRecord("5812345678")] + record=ndef.TextRecord("Errecinque,fixture,5812345678") tag.ndef.records = [record] if tag.ndef.has_changed: - logging.error("WRITE ERROR") + print("WRITE ERROR") else: - logging.info("WRITE OK") + print("WRITE OK") + for record in tag.ndef.records: - logging.info(f"Record: {record}") + print(record) else: - logging.error("ERROR NOT NDEF") + print("ERROR NOT NDEF") else: - logging.info("NO TARGET") + print("NO TARGET") else: - logging.info("NOT CONNECTED") + print("NOT CONNECTED") except IOError as io_err: - logging.error(f"IOError: {io_err}") + print(f"IOError: {io_err}") traceback.print_exc() connected = False except Exception as e: - logging.error(f"General Exception: {e}") + print(f"General Exception: {e}") traceback.print_exc() connected = False time.sleep(1) -logging.info("EXITING") +print("EXITING") clf.close()