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.
This commit is contained in:
@@ -61,10 +61,10 @@ class HttpCamera implements CameraDevice {
|
||||
const res = await this.#get();
|
||||
if (res.status !== 200) {
|
||||
throw new Error(
|
||||
`${this.driverId} snapshot failed (lane=${ctx.lane} ${ctx.direction}): HTTP ${res.status}`,
|
||||
`${this.driverId} snapshot failed (${ctx.direction}): HTTP ${res.status}`,
|
||||
);
|
||||
}
|
||||
stubLog(this.driverId, `captureSnapshot lane=${ctx.lane} ${ctx.direction} (${res.body.length} bytes)`);
|
||||
stubLog(this.driverId, `captureSnapshot ${ctx.direction} (${res.body.length} bytes)`);
|
||||
return {
|
||||
bytes: res.body,
|
||||
contentType: res.contentType || "image/jpeg",
|
||||
|
||||
@@ -71,8 +71,6 @@ function renderTicket(data: TicketData): Buffer {
|
||||
DOUBLE_OFF,
|
||||
BOLD_OFF,
|
||||
line(),
|
||||
line(`Lane ${data.lane}`),
|
||||
line(),
|
||||
BOLD_ON,
|
||||
line(data.ticketId),
|
||||
BOLD_OFF,
|
||||
@@ -217,7 +215,7 @@ class RongtaPrinter implements PrinterDevice, MonitorableDevice {
|
||||
|
||||
async printTicket(data: TicketData): Promise<void> {
|
||||
await sendRaw(this.#host, this.#port, renderTicket(data), this.#timeout);
|
||||
stubLog(this.driverId, `printed ticket ${data.ticketId} (lane ${data.lane})`);
|
||||
stubLog(this.driverId, `printed ticket ${data.ticketId}`);
|
||||
}
|
||||
|
||||
async printReport(report: PrintReport): Promise<void> {
|
||||
|
||||
@@ -174,7 +174,6 @@ export interface CameraDevice extends Device {
|
||||
}
|
||||
|
||||
export interface SnapshotContext {
|
||||
readonly lane: number;
|
||||
readonly direction: "entry" | "exit";
|
||||
}
|
||||
|
||||
@@ -193,7 +192,6 @@ export interface Snapshot {
|
||||
// --- Printers (ticket dispenser / booth printer) -------------------------
|
||||
export interface TicketData {
|
||||
readonly ticketId: string;
|
||||
readonly lane: number;
|
||||
readonly issuedAt: string; // ISO-8601
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,19 @@ export interface ConfigField {
|
||||
readonly help?: string;
|
||||
}
|
||||
|
||||
/** A JSON-serializable config value. Mostly flat scalars (host, port, credentials),
|
||||
* but some configs carry nested structure — e.g. an access controller's
|
||||
* `relays: [{ relay, direction, button? }]` map. See entry-exit-points.md. */
|
||||
export type ConfigValue =
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null
|
||||
| ConfigValue[]
|
||||
| { [k: string]: ConfigValue };
|
||||
|
||||
/** Opaque per-instance config the admin fills in (host, port, credentials…). */
|
||||
export type DeviceConfig = Record<string, string | number | boolean>;
|
||||
export type DeviceConfig = Record<string, ConfigValue>;
|
||||
|
||||
/**
|
||||
* A driver: metadata describing a supported device model/family, the config
|
||||
|
||||
Reference in New Issue
Block a user