Files
identity-micropython-tag/node_access_control.py

30 lines
1.0 KiB
Python

# ============================================================+
# Identity IoT — Node: Access Control
# (c) Copyright : ae Aeonian Engineering Limited - Hong Kong
# (c) Copyright : WIDE di D. Papa - Naples - Italy
# ============================================================+
# Reads NTAG424 badge via PN532, performs challenge/verify
# against identity_tag backend.
# ============================================================+
import utime
def run_access_control(cfg, caps):
"""Main loop for access_control node type. Called from boot_manager."""
print('[access_control] starting — NFC:', caps.get('has_nfc'))
if not caps.get('has_nfc'):
print('[access_control] ERROR: no NFC hardware detected')
return
# TODO: init PN532
# TODO: wait for badge tap
# TODO: read UID from NTAG424
# TODO: challenge/verify against cfg['base_url']
# TODO: trigger relay on success if has_relay
while True:
print('[access_control] waiting for badge...')
utime.sleep(2)