5705098054
A live QR scan reached the app but rejected: 'reader not on an access-equipped lane' — the dispatcher requires an access device on the reader's lane. Add a no-op stub-access driver (access category, no config) whose pulseOpen only logs and does no device I/O, so the QR->permit->accept flow (incl. the beep) can be tested without the Dingtian relay connected. Not for production; registered in the catalog.
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
import type { AccessControlDevice, DeviceHealth } from "../interfaces.js";
|
|
import type { AccessDriver, DeviceConfig } from "../registry.js";
|
|
import { stubLog } from "./common.js";
|
|
|
|
// Stub access controller — a no-op barrier for BENCH TESTING the entry/exit/permit
|
|
// flows without real relay hardware. `pulseOpen` just logs "intent to open"; it
|
|
// performs no device I/O, so it can stand in on a lane while the real
|
|
// [[dingtian-relay]] isn't connected. NOT for production. See first-run-setup.md.
|
|
|
|
class StubAccess implements AccessControlDevice {
|
|
readonly driverId = "stub-access";
|
|
constructor(_config: DeviceConfig) {}
|
|
async connect(): Promise<void> {}
|
|
async disconnect(): Promise<void> {}
|
|
async healthCheck(): Promise<DeviceHealth> {
|
|
return { status: "ready", detail: "stub (no real barrier)" };
|
|
}
|
|
async pulseOpen(doorId: number): Promise<void> {
|
|
stubLog(this.driverId, `pulseOpen door ${doorId} (stub — no relay fired)`);
|
|
}
|
|
async getDoorStatus(): Promise<"open" | "closed"> {
|
|
return "closed";
|
|
}
|
|
}
|
|
|
|
export const stubAccessDriver: AccessDriver = {
|
|
id: "stub-access",
|
|
category: "access",
|
|
label: "Stub barrier (bench testing — no relay)",
|
|
description:
|
|
"A no-op access controller for testing the flows without hardware. pulseOpen only logs; no relay is fired. Not for production.",
|
|
transports: ["tcp-ip"],
|
|
configFields: [],
|
|
create: (c) => new StubAccess(c),
|
|
};
|