Files
parking_solution/wiki/concepts/entry-exit-readers.md
T
julian 1efa77bf56 devices: pool-of-spaces model — drop lane, per-relay direction
A parking lot is one pool of spaces with a flexible set of entry/exit
points — no "lane". Direction is a property of each RELAY inside an access
controller; readers/cameras bind to a controller relay and inherit it.

Schema:
- drop `lane` from ledger_events, device_events, sessions
- rename lane_devices -> devices (no lane/direction columns)
- access config.relays=[{relay,direction,button?}]; reader/camera
  config.controllerId+relay binding
- fresh 0000_baseline migration (history reset; dev data was throwaway)

Signed ledger:
- remove `lane` from canonicalize(); bump signer keyId sw-hmac-v1 -> v2
  (v1 events won't verify under v2 — intentional, gated per-event by keyId)

Server:
- new device-resolve.ts (replaces lane-map.ts): relayForButton,
  relayForDevice, firstRelayByDirection, devicesByDirection
- entry-flow: button terminal -> its relay; exit/permit: reader's bound
  relay; dispatcher resolves the bound relay + inherited direction
- camera snapshots fire by direction site-wide, async, never block open
- DeviceConfig widened to nested JSON for relays[]

Web:
- wizard: no lane selector; add controllers (relay map + entry-button
  terminal) first, then bind readers/cameras/printers to a controller relay

Wiki: new entry-exit-points.md (replaces lane-direction); reworked
entry-exit-readers, parking-session, first-run-setup, device-registry,
append-only-event-chain, device-events; removed stale lane/LaneMap mentions.
2026-06-16 20:29:38 +02:00

51 lines
2.7 KiB
Markdown

---
type: concept
tags: [parking, architecture, readers]
sources: [parking-system-architecture]
updated: 2026-06-14
---
# Entry / Exit Readers
There are **two populations** of users, and they map to **two integration paths**. (See
[[parking-system-architecture]] §8.)
- **Permit holders / subscribers** — want hands-free/quick entry. Best served by reads reaching
the **controller directly** ([[wiegand]]) so it can decide autonomously (works if host is down).
- **Casual / transient** — printed ticket, pay-on-exit, or plate recognition. Inherently
**host-side** identity sources ([[lpr-camera]], QR/ticket scanner).
## How reads reach the system
| Reader type | Who sees the read | Decision by | Offline autonomy |
| --- | --- | --- | --- |
| [[wiegand]] reader → UHPPOTE port | The controller | Controller (onboard card list) | **Yes** — works if host down |
| Pure TCP/IP reader | Host only | Host, then UDP `open` to relay | No — host on critical path |
| [[lpr-camera|LPR]] / QR scanner | Host only | Host | No |
| **[[gee-qr-er80]] QR reader (serial)** | Host only | Host (reads serial → `read` bus) | No |
> Concrete host-side reader on hand: the **[[gee-qr-er80]]** (QR over RS-232/RS-485). Note autonomy
> is moot here anyway — the current relay ([[dingtian-relay]]) has **no onboard card list**, so even
> a Wiegand reader would be host-decided. So we take the serial/QR path straight to the host's
> `read` bus.
## Key points
- **Pure network readers are invisible to the [[uhppote-controller]]** — it only generates events
for its own terminals. For a pure-TCP reader, only the host can listen/decide/command; the
controller is demoted to a commanded relay (onboard card DB + offline autonomy bypassed).
- **Check for a Wiegand output first** — many "network" readers have both; wiring Wiegand in
keeps autonomy + native event log.
- **Both models can share one relay** (valid Wiegand read **or** host `open` in "controlled"
mode), so one lane serves permit + casual.
- **Each reader BINDS to a controller relay** (`config.controllerId` + `relay`) — the barrier it
sits at — and inherits that relay's direction (entry/exit/both). An exit read opens exactly that
relay; an entry read the entry relay. This is how separate in/out readers are disambiguated, with
no "lane". See [[entry-exit-points]].
- **Host-in-the-loop is good for fraud detection** — two independent records (host's signed
[[append-only-event-chain]] entry + the UHPPOTE remote-open event) should reconcile 1:1; any
mismatch is an anomaly.
Autonomy caveat: with remote-host control enabled, the controller expects host comms every ~30 s
or reverts to local control (Wiegand-on-board lanes only).