Skip to content

Project Structure

Hyacinthe-primus edited this page Jul 17, 2026 · 1 revision

Project Structure

RFID_Access_Control/
├── RFID_Access_Control.ino     # setup()/loop() only, TWDT subscription
├── Config.h                     # pins, constants, MAX_USERS=70000, lockout + default timezone
├── DatabaseManager.h/.cpp       # PSRAM-backed sorted array, FixedStr<N>, binary DB (users.bin), seek+write saves
├── DisplayManager.h/.cpp        # LCD screen states (incl. renewal + lockout display)
├── RFIDManager.h/.cpp           # PN532 hardware-SPI wrapper
├── SerialProtocol.h/.cpp        # 16KB line buffer, raw binary sub-protocol (import_bin/export_bin), streaming sendUserList
├── NetworkManager.h/.cpp        # Wi-Fi + NTP time sync + persisted runtime timezone (NVS) + import-safe deferral
├── BuzzerManager.h/.cpp         # passive buzzer tone sequences (GPIO 6)
├── SystemController.h/.cpp      # state machine + import/renewal/lockout + batch_add/find/import_bin/export_bin handlers
├── ImportProfiler.h             # device-side import timing instrumentation (not part of stable protocol)
├── partitions.csv               # custom 16MB layout, 12MB LittleFS cap + coredump partition
├── CHANGELOG.md                 # release history
├── python_cli/
│   ├── cli.py                   # argparse entry point (17 subcommands); no subcommand -> interactive shell
│   ├── repl.py                  # interactive shell (prompt_toolkit for input, Rich for all output)
│   ├── commands.py              # one function per subcommand + binary/JSON import + binary/JSON export + backup-before-wipe (json/bin prompt)
│   ├── convert.py               # JSON<->BIN codec, per-record + whole-database CRC32, MAX_NAME_LEN policy
│   ├── serial_manager.py        # port auto-detect + boot-wait (45s) + backlog drain + write_raw/read_raw + write_only/read_only + TransportProfile
│   ├── protocol.py              # JSON encode/decode + batch_add/import_bin/export_bin/find builders
│   ├── database.py              # typed response parsing (incl. parse_find_result, parse_batch_add_result)
│   ├── utils.py                 # pretty-printing (rich or plain)
│   ├── backups/                 # auto-created; timestamped pre-wipe backups (git-ignored)
│   └── requirements.txt
├── tests/
│   ├── test_convert.py             # JSON<->BIN codec, encode/decode, roundtrip
│   ├── test_crc32.py               # canonical db_crc32: content-sensitivity + import-skip-shortcut semantics
│   ├── test_name_length_policy.py  # MAX_NAME_LEN (48 UTF-8 bytes): single source of truth across every entry point
│   ├── test_commands.py            # validation helpers + CSV/JSON import parsing
│   ├── test_protocol.py            # wire protocol encode/decode, all message builders
│   └── test_database.py            # response parsers, User model, expiration
└── README.md

Running Tests

python -m pytest tests/ -v

137 tests covering the Python CLI's codec, protocol, validation, and data parsing layers. No hardware required -- tests run entirely on the host against convert.py, commands.py, protocol.py, and database.py.

RFID Access Control ESP32-S3 · PN532 · Python CLI


🚀 Getting Started

🐍 Using the CLI

🧭 Reference


📦 README 🐛 Issues

Clone this wiki locally