qr-reader: gee-qr-reader driver — assign in wizard, resolve lane by serial

The QR reader is a push device and the setup wizard assigns random-UUID ids, so
'id = serial' can't be set via the UI. Add a dedicated gee-qr-reader driver
(reader category) with a single 'serial' config field; the admin assigns it
normally and enters the device's serial (its cjihao).

The QR endpoint now resolves the lane by matching lane_devices.config.serial to
the scan's cjihao (instead of row id == cjihao), so no DB hand-editing. An
unassigned serial resolves to no lane -> status:0, gracefully.

Verified via inject through the real /api/setup/assign: assign {serial:
H05M2AFA} -> .jsp scan with a matching permit QR -> status:1 (accept) + open;
re-scan -> permit exit; unknown card -> status:0; unassigned serial -> status:0.
This commit is contained in:
2026-06-16 12:36:58 +02:00
parent 04135b27cf
commit 68d61f2d99
7 changed files with 85 additions and 14 deletions
+3 -1
View File
@@ -5,7 +5,7 @@ import { registry } from "../registry.js";
import { dingtianDriver } from "./access-dingtian.js";
import { dahuaDriver, hikvisionDriver } from "./camera.js";
import { rongtaDriver } from "./printer-rongta.js";
import { tcpipReaderDriver, wiegandReaderDriver } from "./reader.js";
import { geeQrReaderDriver, tcpipReaderDriver, wiegandReaderDriver } from "./reader.js";
let registered = false;
@@ -16,6 +16,7 @@ export function registerBuiltinDrivers(): void {
registry.register(dingtianDriver);
registry.register(wiegandReaderDriver);
registry.register(tcpipReaderDriver);
registry.register(geeQrReaderDriver);
registry.register(hikvisionDriver);
registry.register(dahuaDriver);
registry.register(rongtaDriver);
@@ -25,6 +26,7 @@ export {
dingtianDriver,
wiegandReaderDriver,
tcpipReaderDriver,
geeQrReaderDriver,
hikvisionDriver,
dahuaDriver,
rongtaDriver,
+25
View File
@@ -58,3 +58,28 @@ export const tcpipReaderDriver: ReaderDriver = {
configFields: [hostField, portField(9000)],
create: (c) => new StubReader("tcpip-reader", c),
};
// GEE/Fondvision QR access reader (e.g. GEE-QR-ER80). A PUSH device: on each scan
// it HTTP-GETs our backend (/qa/mcardsea.<ext>) carrying its serial (cjihao); the
// backend resolves the lane by matching that serial to this device's `serial`
// config, decides, and replies the verdict (drives the beep). No host-side
// connection — the adapter is a stub; the real integration is the HTTP endpoint
// (apps/server routes/qr-reader.ts). See wiki/entities/gee-qr-er80.md.
export const geeQrReaderDriver: ReaderDriver = {
id: "gee-qr-reader",
category: "reader",
label: "GEE/Fondvision QR reader (HTTP push)",
description:
"QR/barcode access reader that HTTP-pushes each scan to the backend. Set its server IP/port to this host in the vendor tool; enter its serial here so scans resolve to this lane.",
transports: ["tcp-ip"],
configFields: [
{
key: "serial",
label: "Device serial (cjihao)",
type: "string",
required: true,
help: "The reader's serial as it reports in each scan (the `cjihao` field). Used to map scans to this lane.",
},
],
create: (c) => new StubReader("gee-qr-reader", c),
};
+1
View File
@@ -13,6 +13,7 @@ export {
dingtianDriver,
wiegandReaderDriver,
tcpipReaderDriver,
geeQrReaderDriver,
hikvisionDriver,
dahuaDriver,
rongtaDriver,