Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f63a7063c | |||
| dd2dd53d7e | |||
| 980a3e5178 | |||
| 494c11ddbf | |||
| 726dd9803a | |||
| ce10c741fc | |||
| 78b1c99890 | |||
| d3649669ee | |||
| b69faec547 | |||
| ee0e1ff575 | |||
| ef2c9f9f45 | |||
| c9529ec9d7 | |||
| cb43ad78ca | |||
| bccef3875b | |||
| 69ff224fe7 | |||
| 1c1db5c5d0 | |||
| 91ebdb2bbf | |||
| 8d9fbfa0bf | |||
| 52354d194a | |||
| 4fd5bf852e | |||
| 2c3bdb7f34 | |||
| 301aefc186 | |||
| d893f4e991 | |||
| c6087b990c | |||
| 39fb5fb7c2 | |||
| b6f7ea65a4 | |||
| 6978f9e406 | |||
| 8b1f851add | |||
| 13ba593b69 | |||
| f4dd248e16 | |||
| 580412aa50 | |||
| f5f8865309 | |||
| 44e095cb95 | |||
| 73ada89a13 | |||
| 6eb65361a8 | |||
| c08e232339 | |||
| e842f036e2 | |||
| 005447f938 | |||
| 06d9297e9a | |||
| 965937352d | |||
| ec015911e9 | |||
| c94269379e | |||
| d93089a491 | |||
| 7b29331f52 | |||
| 9332802e5d |
@@ -0,0 +1,10 @@
|
|||||||
|
* text=auto eol=lf
|
||||||
|
*.png binary
|
||||||
|
*.ico binary
|
||||||
|
*.pdf binary
|
||||||
|
*.woff2 binary
|
||||||
|
|
||||||
|
# raw sources are kept byte-for-byte as dropped in
|
||||||
|
wiki/raw/** -text
|
||||||
|
*.jpg binary
|
||||||
|
*.bin binary
|
||||||
+8
-2
@@ -24,8 +24,6 @@ dist/
|
|||||||
/dingtian/
|
/dingtian/
|
||||||
/QRCode_sdk*/
|
/QRCode_sdk*/
|
||||||
|
|
||||||
# Graphify knowledge-graph output (dev tool; generated, not committed)
|
|
||||||
graphify-out/
|
|
||||||
parking.sqlite*.bak-*
|
parking.sqlite*.bak-*
|
||||||
questions.txt
|
questions.txt
|
||||||
|
|
||||||
@@ -33,3 +31,11 @@ questions.txt
|
|||||||
task_plan.md
|
task_plan.md
|
||||||
findings.md
|
findings.md
|
||||||
progress.md
|
progress.md
|
||||||
|
|
||||||
|
# local scratch (site snapshots pulled for incident review, never committed)
|
||||||
|
tmp/
|
||||||
|
|
||||||
|
# Firmware PoC (firmware/relay-proxy/README.md): toolchain venv, build output, Wi-Fi secrets
|
||||||
|
firmware/.venv/
|
||||||
|
firmware/**/.pio/
|
||||||
|
firmware/**/include/secrets.h
|
||||||
|
|||||||
@@ -76,7 +76,10 @@ WS_ALLOWED_ORIGINS=http://localhost:5173,tauri://localhost,http://tauri.localhos
|
|||||||
# camera's vehicle detection, admits them through the gated SubscriptionFlow. Opt-in per
|
# camera's vehicle detection, admits them through the gated SubscriptionFlow. Opt-in per
|
||||||
# camera (the camera's config.anpr checkbox in Setup); the camera must be BOUND to a relay.
|
# camera (the camera's config.anpr checkbox in Setup); the camera must be BOUND to a relay.
|
||||||
# VISION_ENTRY_MIN_CONFIDENCE=0.85 # stricter floor for a BARRIER-driving read (near-miss → falls back to card/QR)
|
# VISION_ENTRY_MIN_CONFIDENCE=0.85 # stricter floor for a BARRIER-driving read (near-miss → falls back to card/QR)
|
||||||
# ANPR_DEBOUNCE_MS=12000 # same plate/camera within this window = ONE presentation (camera re-fires ~1Hz)
|
# ANPR_DEBOUNCE_MS=12000 # same PLATE on the same camera within this window = ONE presentation (never per camera)
|
||||||
|
# ANPR_POLL_MS=0 # MIN spacing between frame pulls while a car is in the zone; 0 = back-to-back (~3 fps/camera)
|
||||||
|
# ANPR_POLL_WINDOW_MS=8000 # keep reading this long after the camera's LAST vehicle push (0 = one frame per push)
|
||||||
|
# ANPR_POLL_MAX_MS=30000 # hard cap on one loop from its start, however busy the lane
|
||||||
|
|
||||||
# Venue modules --------------------------------------------------------------
|
# Venue modules --------------------------------------------------------------
|
||||||
# Comma-separated ids of the modules this site is ENTITLED to (a vendor/deployment
|
# Comma-separated ids of the modules this site is ENTITLED to (a vendor/deployment
|
||||||
|
|||||||
@@ -43,9 +43,10 @@ beforeEach(() => {
|
|||||||
normalizedBoxes.mockResolvedValue({ vehicleBox: null, plateBox: null });
|
normalizedBoxes.mockResolvedValue({ vehicleBox: null, plateBox: null });
|
||||||
delete process.env.VISION_ENTRY_MIN_CONFIDENCE;
|
delete process.env.VISION_ENTRY_MIN_CONFIDENCE;
|
||||||
delete process.env.ANPR_DEBOUNCE_MS;
|
delete process.env.ANPR_DEBOUNCE_MS;
|
||||||
// Poll-until-confident loop: keep the window + interval tiny so a below-floor / no-plate
|
// Read-every-frame loop: keep the window tiny so a loop ends in a few ticks instead of the
|
||||||
// case gives up in ~one tick instead of the 8s production window (tests stay fast). Each
|
// 8s production window (tests stay fast); the 1ms floor keeps a mocked loop from spinning
|
||||||
// bridge reads these in its constructor, so set them before `new AnprBridge`.
|
// thousands of frames. Each bridge reads these in its constructor, so set them before
|
||||||
|
// `new AnprBridge`.
|
||||||
process.env.ANPR_POLL_MS = "1";
|
process.env.ANPR_POLL_MS = "1";
|
||||||
process.env.ANPR_POLL_WINDOW_MS = "5";
|
process.env.ANPR_POLL_WINDOW_MS = "5";
|
||||||
});
|
});
|
||||||
@@ -107,19 +108,35 @@ function fakeVision(opts: { enabled?: boolean; plate?: string; confidence?: numb
|
|||||||
|
|
||||||
/** A fake SubscriptionFlow: only `match()` is called by the bridge. */
|
/** A fake SubscriptionFlow: only `match()` is called by the bridge. */
|
||||||
function fakeSubFlow(
|
function fakeSubFlow(
|
||||||
match: SubscriptionMatch | null,
|
// A fixed answer, or a matcher by plate (several subscribers in one loop).
|
||||||
|
match: SubscriptionMatch | null | ((plate: string) => SubscriptionMatch | null),
|
||||||
// openOccurrenceCount: a constant, or a sequence consumed per call (to simulate a
|
// openOccurrenceCount: a constant, or a sequence consumed per call (to simulate a
|
||||||
// credential closing an occurrence mid-poll → count changes).
|
// credential closing an occurrence mid-poll → count changes).
|
||||||
openCounts: number | number[] = 1,
|
openCounts: number | number[] = 1,
|
||||||
): SubscriptionFlow {
|
): SubscriptionFlow {
|
||||||
const seq = Array.isArray(openCounts) ? [...openCounts] : null;
|
const seq = Array.isArray(openCounts) ? [...openCounts] : null;
|
||||||
return {
|
return {
|
||||||
match: vi.fn(() => match),
|
match: vi.fn((e: DeviceReadEvent) => (typeof match === "function" ? match(e.value) : match)),
|
||||||
openOccurrenceCount: vi.fn(() => (seq ? (seq.length > 1 ? seq.shift()! : seq[0]) : (openCounts as number))),
|
openOccurrenceCount: vi.fn(() => (seq ? (seq.length > 1 ? seq.shift()! : seq[0]) : (openCounts as number))),
|
||||||
} as unknown as SubscriptionFlow;
|
} as unknown as SubscriptionFlow;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SUB_MATCH: SubscriptionMatch = { subscriptionId: "sub-1", carKey: "AA111BB", via: "plate" };
|
const SUB_MATCH: SubscriptionMatch = { subscriptionId: "sub-1", carKey: "AA111BB", via: "plate" };
|
||||||
|
const SUB_MATCH_2: SubscriptionMatch = { subscriptionId: "sub-2", carKey: "CC333DD", via: "plate" };
|
||||||
|
|
||||||
|
/** A VisionClient whose analyze() walks a sequence of (plate, confidence) frames, holding the
|
||||||
|
* last one — the way a car's read evolves as it approaches and settles, or as one car gives
|
||||||
|
* way to the next. `vehicle` (optional) rides every frame. */
|
||||||
|
function sequenceVision(frames: { plate: string; confidence: number }[], vehicle: VisionVehicle | null = null): VisionClient {
|
||||||
|
let i = 0;
|
||||||
|
return {
|
||||||
|
enabled: true,
|
||||||
|
analyze: vi.fn(async () => {
|
||||||
|
const f = frames[Math.min(i++, frames.length - 1)]!;
|
||||||
|
return { plate: { text: f.plate, confidence: f.confidence }, plates: [], lowConfidence: false, vehicle, modelVersion: "test", tookMs: 1 };
|
||||||
|
}),
|
||||||
|
} as unknown as VisionClient;
|
||||||
|
}
|
||||||
|
|
||||||
/** Capture read events emitted during `fn` (async). */
|
/** Capture read events emitted during `fn` (async). */
|
||||||
async function captureReads(fn: () => Promise<void>): Promise<DeviceReadEvent[]> {
|
async function captureReads(fn: () => Promise<void>): Promise<DeviceReadEvent[]> {
|
||||||
@@ -165,7 +182,7 @@ describe("AnprBridge pass sample — every detected car, ticket or not", () => {
|
|||||||
expect(row).toMatchObject({ direction: "entry", deviceId: cam, identity: read.identity, contentType: "image/jpeg" });
|
expect(row).toMatchObject({ direction: "entry", deviceId: cam, identity: read.identity, contentType: "image/jpeg" });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("is ONE sample per detection even when the loop polls several frames, and rides along a subscriber emit", async () => {
|
it("is ONE sample per car even when the loop polls several frames, and rides along a subscriber emit", async () => {
|
||||||
normalizedBoxes.mockResolvedValue({ vehicleBox: BOX, plateBox: { x1: 0.3, y1: 0.4, x2: 0.4, y2: 0.45 } });
|
normalizedBoxes.mockResolvedValue({ vehicleBox: BOX, plateBox: { x1: 0.3, y1: 0.4, x2: 0.4, y2: 0.45 } });
|
||||||
const cam = seedCamera({ anpr: true });
|
const cam = seedCamera({ anpr: true });
|
||||||
const bridge = new AnprBridge(db, fakeVision({ plate: "AA111BB", confidence: 0.97, vehicle: VEHICLE }), fakeSubFlow(SUB_MATCH), silentLogger());
|
const bridge = new AnprBridge(db, fakeVision({ plate: "AA111BB", confidence: 0.97, vehicle: VEHICLE }), fakeSubFlow(SUB_MATCH), silentLogger());
|
||||||
@@ -179,6 +196,23 @@ describe("AnprBridge pass sample — every detected car, ticket or not", () => {
|
|||||||
expect(db.select().from(snapshots).all()).toHaveLength(1);
|
expect(db.select().from(snapshots).all()).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("samples EACH plated car of a loop once — two cars back to back → two samples", async () => {
|
||||||
|
normalizedBoxes.mockResolvedValue({ vehicleBox: BOX, plateBox: null });
|
||||||
|
const cam = seedCamera({ anpr: true });
|
||||||
|
// Car A (3 frames) then car B, both framed; a non-subscriber lot (match null) — the
|
||||||
|
// sample is about the reviewer's stream, not about admission.
|
||||||
|
const vision = sequenceVision(
|
||||||
|
[{ plate: "AA111BB", confidence: 0.97 }, { plate: "AA111BB", confidence: 0.98 }, { plate: "AA111BB", confidence: 0.97 }, { plate: "CC333DD", confidence: 0.96 }],
|
||||||
|
VEHICLE,
|
||||||
|
);
|
||||||
|
process.env.ANPR_POLL_WINDOW_MS = "200";
|
||||||
|
const bridge = new AnprBridge(db, vision, fakeSubFlow(null), silentLogger());
|
||||||
|
|
||||||
|
const got = await captureVehicleReads(() => bridge.onVehicleDetected(cam), 2);
|
||||||
|
expect(got).toHaveLength(2);
|
||||||
|
expect(db.select().from(snapshots).all()).toHaveLength(2);
|
||||||
|
});
|
||||||
|
|
||||||
it("records nothing without a vehicle box (nothing to crop) — a bare class is not a sample", async () => {
|
it("records nothing without a vehicle box (nothing to crop) — a bare class is not a sample", async () => {
|
||||||
const cam = seedCamera({ anpr: true });
|
const cam = seedCamera({ anpr: true });
|
||||||
const bridge = new AnprBridge(db, fakeVision({ vehicle: { bodyType: "car", confidence: 0.9 } }), fakeSubFlow(null), silentLogger());
|
const bridge = new AnprBridge(db, fakeVision({ vehicle: { bodyType: "car", confidence: 0.9 } }), fakeSubFlow(null), silentLogger());
|
||||||
@@ -251,9 +285,10 @@ describe("AnprBridge", () => {
|
|||||||
})),
|
})),
|
||||||
} as unknown as VisionClient;
|
} as unknown as VisionClient;
|
||||||
// Generous window so all 3 escalation attempts run deterministically under suite load
|
// Generous window so all 3 escalation attempts run deterministically under suite load
|
||||||
// (the global beforeEach sets a tiny 5ms window for the give-up cases).
|
// (the global beforeEach sets a tiny 5ms window for the give-up cases). The loop keeps
|
||||||
|
// reading until the window ends — the same plate must still be emitted exactly once.
|
||||||
process.env.ANPR_POLL_MS = "1";
|
process.env.ANPR_POLL_MS = "1";
|
||||||
process.env.ANPR_POLL_WINDOW_MS = "2000";
|
process.env.ANPR_POLL_WINDOW_MS = "150";
|
||||||
const bridge = new AnprBridge(db, vision, fakeSubFlow(SUB_MATCH), silentLogger());
|
const bridge = new AnprBridge(db, vision, fakeSubFlow(SUB_MATCH), silentLogger());
|
||||||
|
|
||||||
const reads = await captureReads(() => bridge.onVehicleDetected(cam));
|
const reads = await captureReads(() => bridge.onVehicleDetected(cam));
|
||||||
@@ -299,18 +334,40 @@ describe("AnprBridge", () => {
|
|||||||
expect(reads[0]).toMatchObject({ value: "AA111BB" });
|
expect(reads[0]).toMatchObject({ value: "AA111BB" });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("ABORTS if the subscriber transacts by another credential mid-poll (no double-act)", async () => {
|
it("does NOT emit if the subscriber transacts by another credential mid-poll (no double-act)", async () => {
|
||||||
// The car's plate is read (identity known) but stays below the floor; meanwhile the
|
// The car's plate is read (identity known) while still below the floor; meanwhile the
|
||||||
// subscriber scans their card → openOccurrenceCount drops. The bridge must abort and NOT
|
// subscriber scans their card → openOccurrenceCount drops. When the plate finally reads
|
||||||
// emit (which would exit the NEXT open occurrence — a phantom double-exit, esp. fleet).
|
// confidently the bridge must NOT emit (it would exit the NEXT open occurrence — a
|
||||||
|
// phantom double-exit, esp. fleet).
|
||||||
const cam = seedCamera({ anpr: true });
|
const cam = seedCamera({ anpr: true });
|
||||||
const vision = fakeVision({ plate: "AA111BB", confidence: 0.5 }); // never clears the floor
|
const vision = sequenceVision([{ plate: "AA111BB", confidence: 0.5 }, { plate: "AA111BB", confidence: 0.97 }]);
|
||||||
// openOccurrenceCount: 1 at baseline, then 0 (the card exit closed it) on the next check.
|
// openOccurrenceCount: 1 at first sighting, then 0 (the card exit closed it) at settle time.
|
||||||
const sub = fakeSubFlow(SUB_MATCH, [1, 0]);
|
const sub = fakeSubFlow(SUB_MATCH, [1, 0]);
|
||||||
|
process.env.ANPR_POLL_WINDOW_MS = "200";
|
||||||
const bridge = new AnprBridge(db, vision, sub, silentLogger());
|
const bridge = new AnprBridge(db, vision, sub, silentLogger());
|
||||||
|
|
||||||
const reads = await captureReads(() => bridge.onVehicleDetected(cam));
|
const reads = await captureReads(() => bridge.onVehicleDetected(cam));
|
||||||
expect(reads).toEqual([]); // aborted — the credential already handled it
|
expect(reads).toEqual([]); // declined — the credential already handled it
|
||||||
|
expect(vision.analyze).toHaveBeenCalledTimes; // (the loop itself kept going)
|
||||||
|
});
|
||||||
|
|
||||||
|
it("KEEPS READING after a confident plate: a second car in the same loop is emitted too", async () => {
|
||||||
|
// Car A reads confidently on frames 1-3, then car B pulls into the zone (frames 4+).
|
||||||
|
// Before 2026-10-11 the loop broke on A's first read and the camera-level debounce then
|
||||||
|
// dropped every push for 12s — B was invisible. Now A is settled once and the loop goes
|
||||||
|
// on; B is read by the same loop. Each plate exactly once, however many frames repeat.
|
||||||
|
const cam = seedCamera({ anpr: true });
|
||||||
|
const vision = sequenceVision([
|
||||||
|
{ plate: "AA111BB", confidence: 0.97 }, { plate: "AA111BB", confidence: 0.98 }, { plate: "AA111BB", confidence: 0.97 },
|
||||||
|
{ plate: "CC333DD", confidence: 0.96 },
|
||||||
|
]);
|
||||||
|
const sub = fakeSubFlow((plate) => (plate === "AA111BB" ? SUB_MATCH : plate === "CC333DD" ? SUB_MATCH_2 : null));
|
||||||
|
process.env.ANPR_POLL_WINDOW_MS = "200";
|
||||||
|
const bridge = new AnprBridge(db, vision, sub, silentLogger());
|
||||||
|
|
||||||
|
const reads = await captureReads(() => bridge.onVehicleDetected(cam));
|
||||||
|
expect(reads.map((r) => r.value)).toEqual(["AA111BB", "CC333DD"]);
|
||||||
|
expect(captureSnapshot.mock.calls.length).toBeGreaterThan(4); // it did not stop at A
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does NOT emit for a plate matching no subscription — records an advisory anpr-skip", async () => {
|
it("does NOT emit for a plate matching no subscription — records an advisory anpr-skip", async () => {
|
||||||
@@ -342,17 +399,34 @@ describe("AnprBridge", () => {
|
|||||||
expect(skips).toHaveLength(1);
|
expect(skips).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("debounces: two vehicle events within the window analyze/emit at most once", async () => {
|
it("debounces PER PLATE: the same car re-detected within the window is emitted once", async () => {
|
||||||
const cam = seedCamera({ anpr: true });
|
const cam = seedCamera({ anpr: true });
|
||||||
const vision = fakeVision({ plate: "AA111BB", confidence: 0.97 });
|
const vision = fakeVision({ plate: "AA111BB", confidence: 0.97 });
|
||||||
const bridge = new AnprBridge(db, vision, fakeSubFlow(SUB_MATCH), silentLogger());
|
const bridge = new AnprBridge(db, vision, fakeSubFlow(SUB_MATCH), silentLogger());
|
||||||
|
|
||||||
const reads = await captureReads(async () => {
|
const reads = await captureReads(async () => {
|
||||||
await bridge.onVehicleDetected(cam);
|
await bridge.onVehicleDetected(cam);
|
||||||
await bridge.onVehicleDetected(cam); // within the 12s window → suppressed
|
await bridge.onVehicleDetected(cam); // a second loop — the same plate within 12s → suppressed
|
||||||
});
|
});
|
||||||
expect(reads).toHaveLength(1);
|
expect(reads).toHaveLength(1);
|
||||||
expect(captureSnapshot).toHaveBeenCalledTimes(1); // 2nd was gated before the snapshot
|
expect(captureSnapshot.mock.calls.length).toBeGreaterThanOrEqual(2); // the 2nd loop DID look
|
||||||
|
});
|
||||||
|
|
||||||
|
it("is NOT blind after a read: a different car detected right after is emitted", async () => {
|
||||||
|
// The old camera-level debounce dropped every push for 12s after a success. A car behind
|
||||||
|
// the first, arriving after the first loop ended, must get its own loop and its own read.
|
||||||
|
const cam = seedCamera({ anpr: true });
|
||||||
|
const frames = [{ plate: "AA111BB", confidence: 0.97 }];
|
||||||
|
const vision = sequenceVision(frames);
|
||||||
|
const sub = fakeSubFlow((plate) => (plate === "AA111BB" ? SUB_MATCH : plate === "CC333DD" ? SUB_MATCH_2 : null));
|
||||||
|
const bridge = new AnprBridge(db, vision, sub, silentLogger());
|
||||||
|
|
||||||
|
const reads = await captureReads(async () => {
|
||||||
|
await bridge.onVehicleDetected(cam); // car A
|
||||||
|
frames[0] = { plate: "CC333DD", confidence: 0.96 }; // car B now in the zone
|
||||||
|
await bridge.onVehicleDetected(cam); // its push starts a new loop
|
||||||
|
});
|
||||||
|
expect(reads.map((r) => r.value)).toEqual(["AA111BB", "CC333DD"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("is a no-op (no throw) when vision is disabled or reads nothing", async () => {
|
it("is a no-op (no throw) when vision is disabled or reads nothing", async () => {
|
||||||
|
|||||||
+156
-123
@@ -12,11 +12,20 @@ import type { VisionClient, VisionResult } from "./vision-client.js";
|
|||||||
// the SAME gated SubscriptionFlow a QR/card scan uses. It is the one missing wire between
|
// the SAME gated SubscriptionFlow a QR/card scan uses. It is the one missing wire between
|
||||||
// the camera's vehicle PUSH (hikvision-alarm.ts) and the read bus — NOT a new service.
|
// the camera's vehicle PUSH (hikvision-alarm.ts) and the read bus — NOT a new service.
|
||||||
//
|
//
|
||||||
// On a `vehicle`/`active` event from an OPT-IN camera (config.anpr === true), the bridge:
|
// On a `vehicle`/`active` event from an OPT-IN camera (config.anpr === true), the bridge runs
|
||||||
// pull a fresh snapshot → vision.analyze → entry confidence floor → debounce → MATCH the
|
// ONE poll loop per camera: while the camera keeps pushing (a car is moving in the zone) it
|
||||||
// plate to a subscription → emit a DeviceReadEvent{kind:"plate"} ONLY if it matched.
|
// pulls fresh frames back-to-back → vision.analyze → entry confidence floor → MATCH the plate
|
||||||
// The existing onRead → ReadDispatcher then re-matches and runs the gated SubscriptionFlow
|
// to a subscription → emit a DeviceReadEvent{kind:"plate"} ONLY if it matched — once per
|
||||||
// (active / window / blocklist / car-count), which signs the entry/exit and opens the relay.
|
// plate per loop, and once per plate per ANPR_DEBOUNCE_MS across loops. The existing onRead →
|
||||||
|
// ReadDispatcher then re-matches and runs the gated SubscriptionFlow (active / window /
|
||||||
|
// blocklist / car-count), which signs the entry/exit and opens the relay.
|
||||||
|
//
|
||||||
|
// The loop does NOT stop at the first confident plate (2026-10-11). The camera fires an
|
||||||
|
// independent push on every motion (~1.2 s apart while a car moves — park-2, 2780 pushes, all
|
||||||
|
// activePostCount=1, never `inactive`), so a second car tailgating the first keeps the loop
|
||||||
|
// alive and is read by the same loop. Before, the loop broke on the first read and a 12 s
|
||||||
|
// CAMERA-level debounce then dropped every push — 40 of 57 plate-driven opens at park-2 had
|
||||||
|
// a push land in that blind window. The debounce is per PLATE now.
|
||||||
//
|
//
|
||||||
// INVARIANTS (see wiki/concepts/lane-presence-and-anpr-entry.md §2, append-only-event-chain.md):
|
// INVARIANTS (see wiki/concepts/lane-presence-and-anpr-entry.md §2, append-only-event-chain.md):
|
||||||
// - Advisory, never sole authority: the bridge only emitRead()s — the signed decision +
|
// - Advisory, never sole authority: the bridge only emitRead()s — the signed decision +
|
||||||
@@ -26,7 +35,8 @@ import type { VisionClient, VisionResult } from "./vision-client.js";
|
|||||||
// transient plate-as-ticket exit flow.
|
// transient plate-as-ticket exit flow.
|
||||||
// - Fail-soft + fire-and-forget: any snapshot/vision error degrades to the card/QR path;
|
// - Fail-soft + fire-and-forget: any snapshot/vision error degrades to the card/QR path;
|
||||||
// never throws into the push handler, never awaited on the camera's 200 response.
|
// never throws into the push handler, never awaited on the camera's 200 response.
|
||||||
// - Opt-in per camera, and debounced (the camera re-fires ~1Hz while a car sits).
|
// - Opt-in per camera, and debounced PER PLATE (the same car reads confidently on every
|
||||||
|
// frame once it is framed; one presentation = one read).
|
||||||
|
|
||||||
/** Camera config flag opting it into the ANPR bridge (same flag advisory ANPR uses). */
|
/** Camera config flag opting it into the ANPR bridge (same flag advisory ANPR uses). */
|
||||||
interface CameraConfig {
|
interface CameraConfig {
|
||||||
@@ -46,22 +56,26 @@ function entryMinConfidence(): number {
|
|||||||
return Number.isFinite(raw) && raw > 0 ? raw : 0.85;
|
return Number.isFinite(raw) && raw > 0 ? raw : 0.85;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Same plate/camera within this window = ONE credential presentation. The camera re-fires
|
/** Same plate on the same camera within this window = ONE credential presentation. A framed
|
||||||
* ~1Hz while a car is present; emitting every second would drive repeat entries (a fleet
|
* car reads confidently on every frame, and a car that stops and re-starts in the zone
|
||||||
* sub opens a 2nd occurrence) or exit spam. Required for correctness, not CPU. */
|
* starts a new loop; emitting each time would drive repeat entries (a fleet sub opens a 2nd
|
||||||
|
* occurrence) or exit spam. Keyed by PLATE, never by camera — a camera-level stamp made the
|
||||||
|
* lane blind to the next car for the whole window. Required for correctness, not CPU. */
|
||||||
function debounceMs(): number {
|
function debounceMs(): number {
|
||||||
const raw = Number(process.env.ANPR_DEBOUNCE_MS ?? 12_000);
|
const raw = Number(process.env.ANPR_DEBOUNCE_MS ?? 12_000);
|
||||||
return Number.isFinite(raw) && raw > 0 ? raw : 12_000;
|
return Number.isFinite(raw) && raw > 0 ? raw : 12_000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A single alarm fires the INSTANT motion starts — the car is still approaching, so the
|
/** A single alarm fires the INSTANT motion starts — the car is still approaching, so the
|
||||||
* first frame often has a small/blurry/absent plate (a low-confidence misread). But the car
|
* first frame often has a small/blurry/absent plate (a low-confidence misread). The readable
|
||||||
* then STOPS at the barrier (waiting for it to open) — the same stationary, well-framed
|
* moments (stopped at the barrier; a gap in headlight glare) are short, so the loop pulls
|
||||||
* moment the manual test reads at ~100%. So instead of one shot, we POLL fresh frames and
|
* frames BACK-TO-BACK: a pull is ~0.1 s and an analyze ~0.25 s on the booth (park-2,
|
||||||
* re-run ANPR until one clears the confidence floor, or the window elapses. Poll interval: */
|
* 2026-10-11), i.e. ~3 frames/s per camera, serial, which the camera's single-threaded
|
||||||
|
* picture endpoint takes without a 503. This is the MINIMUM spacing between two pulls
|
||||||
|
* (ms); 0 = as fast as the camera + recognizer go. Raise it to throttle a weak host. */
|
||||||
function pollMs(): number {
|
function pollMs(): number {
|
||||||
const raw = Number(process.env.ANPR_POLL_MS ?? 1000);
|
const raw = Number(process.env.ANPR_POLL_MS ?? 0);
|
||||||
return Number.isFinite(raw) && raw > 0 ? raw : 1000;
|
return Number.isFinite(raw) && raw >= 0 ? raw : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** How long to keep polling AFTER THE LAST vehicle push before giving up. SLIDING: each new
|
/** How long to keep polling AFTER THE LAST vehicle push before giving up. SLIDING: each new
|
||||||
@@ -70,7 +84,7 @@ function pollMs(): number {
|
|||||||
* barrier (the loop tracks "whoever is here now", not the car that started it). */
|
* barrier (the loop tracks "whoever is here now", not the car that started it). */
|
||||||
function pollWindowMs(): number {
|
function pollWindowMs(): number {
|
||||||
const raw = Number(process.env.ANPR_POLL_WINDOW_MS ?? 8000);
|
const raw = Number(process.env.ANPR_POLL_WINDOW_MS ?? 8000);
|
||||||
return Number.isFinite(raw) && raw > 0 ? raw : 8000;
|
return Number.isFinite(raw) && raw >= 0 ? raw : 8000; // 0 = one frame per push
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Hard ceiling on a single loop from its START, so a continuously-busy lane (pushes never
|
/** Hard ceiling on a single loop from its START, so a continuously-busy lane (pushes never
|
||||||
@@ -98,11 +112,12 @@ export class AnprBridge {
|
|||||||
readonly #pollMs: number;
|
readonly #pollMs: number;
|
||||||
readonly #pollWindowMs: number;
|
readonly #pollWindowMs: number;
|
||||||
readonly #pollMaxMs: number;
|
readonly #pollMaxMs: number;
|
||||||
/** Last-fire timestamps, keyed by deviceId (camera-level, pre-snapshot) AND by
|
/** Last emit timestamps keyed by `deviceId:plate`, gated against #debounceMs. Nothing is
|
||||||
* `deviceId:plate` (post-match) — both gated against #debounceMs. */
|
* keyed by camera: the lane must never go blind to the NEXT car. Pruned on stamp. */
|
||||||
readonly #lastFire = new Map<string, number>();
|
readonly #lastFire = new Map<string, number>();
|
||||||
/** Cameras with a poll loop already in flight — a re-fired alarm (the camera pushes ~1Hz
|
/** Cameras with a poll loop already in flight — a re-fired alarm (the camera pushes on
|
||||||
* while the car sits) must NOT start a second concurrent loop on the same camera. */
|
* every motion while a car moves) must NOT start a second concurrent loop on the same
|
||||||
|
* camera: its picture endpoint is single-threaded (a parallel GET gets HTTP 503). */
|
||||||
readonly #polling = new Set<string>();
|
readonly #polling = new Set<string>();
|
||||||
/** Per-camera SLIDING deadline for the running poll loop. A push that joins a running loop
|
/** Per-camera SLIDING deadline for the running poll loop. A push that joins a running loop
|
||||||
* bumps this forward (lastPush + window, capped at start + max), so the loop keeps pulling
|
* bumps this forward (lastPush + window, capped at start + max), so the loop keeps pulling
|
||||||
@@ -144,13 +159,9 @@ export class AnprBridge {
|
|||||||
// car that just entered. Absent ⇒ true (back-compat: existing anpr cameras still trigger).
|
// car that just entered. Absent ⇒ true (back-compat: existing anpr cameras still trigger).
|
||||||
if (cfg.anprAutoTrigger === false) return;
|
if (cfg.anprAutoTrigger === false) return;
|
||||||
|
|
||||||
// Post-success debounce: once we've emitted a read for this camera, ignore the
|
|
||||||
// ~1Hz re-fires for #debounceMs (set on success below). A fresh alarm AFTER the
|
|
||||||
// window is a new presentation and may start a new poll loop.
|
|
||||||
if (this.#debounced(deviceId)) return;
|
|
||||||
// One poll loop per camera. A push that arrives while a loop runs JOINs it — and
|
// One poll loop per camera. A push that arrives while a loop runs JOINs it — and
|
||||||
// SLIDES the deadline forward (a different car arriving mid-loop keeps the loop alive
|
// SLIDES the deadline forward (a different car arriving mid-loop keeps the loop alive
|
||||||
// so it tracks whoever's at the barrier now, instead of giving up on the early car).
|
// so it reads whoever is at the barrier now; the loop never stops on the first plate).
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
if (this.#polling.has(deviceId)) {
|
if (this.#polling.has(deviceId)) {
|
||||||
const cur = this.#pollDeadline.get(deviceId) ?? now;
|
const cur = this.#pollDeadline.get(deviceId) ?? now;
|
||||||
@@ -173,148 +184,170 @@ export class AnprBridge {
|
|||||||
// the gated flow infers the verb from the camera's bound relay direction).
|
// the gated flow infers the verb from the camera's bound relay direction).
|
||||||
const direction: FlowDirection = directionOf(this.#db, row) === "exit" ? "exit" : "entry";
|
const direction: FlowDirection = directionOf(this.#db, row) === "exit" ? "exit" : "entry";
|
||||||
|
|
||||||
// POLL-UNTIL-CONFIDENT. The alarm fires as the car APPROACHES (small/blurry/absent
|
// READ-EVERY-FRAME. The alarm fires as the car APPROACHES (small/blurry/absent plate →
|
||||||
// plate → low-confidence misread, e.g. '111'@0.20). But the car then STOPS at the
|
// low-confidence misread, e.g. '111'@0.20); the readable moments come later and may be
|
||||||
// barrier — the stationary, well-framed moment the manual test reads at ~100%. So we
|
// short (stopped at the barrier; a gap in glare). So we pull FRESH frames back-to-back
|
||||||
// pull a FRESH frame every #pollMs and re-run ANPR until one clears the floor, or the
|
// (#pollMs is only a floor) and re-run ANPR for as long as the camera keeps pushing —
|
||||||
// #pollWindowMs window elapses (car drove off / non-subscriber). NB: a fresh pull each
|
// the sliding deadline — or until the hard cap. Every confident plate is SETTLED once
|
||||||
// tick — NOT captureSnapshotShared, whose TTL would re-serve the same bad frame.
|
// per loop (emitted, skipped, or declined); the loop goes on afterwards so a second car
|
||||||
// While polling, watch whether THIS subscriber transacts by another credential
|
// behind the first is read by the same loop. NB: a fresh pull each tick — NOT
|
||||||
// (card/QR at the reader). If their open-occurrence count drops mid-poll, the
|
// captureSnapshotShared, whose TTL would re-serve the same bad frame.
|
||||||
// subscriber already exited/entered — the bridge must NOT also emit (it would act on
|
//
|
||||||
// the NEXT open occurrence: a phantom double-exit, worst for a fleet sub). We learn the
|
// Credential race: a subscriber may scan their card/QR at the reader while we are still
|
||||||
// subscription as soon as a frame reads the bound plate (identity needs no confidence),
|
// reading them. We learn a subscription as soon as a frame reads its plate (identity
|
||||||
// snapshot the count, then keep polling for a CONFIDENT read; abort if the count moved.
|
// needs no confidence) and remember their open-occurrence count; if it has moved by the
|
||||||
let result: Awaited<ReturnType<VisionClient["analyze"]>> = null;
|
// time the plate reads confidently, they already transacted and we do NOT emit (it would
|
||||||
let watchedSubId: string | null = null;
|
// act on the NEXT open occurrence: a phantom double-exit, worst for a fleet sub).
|
||||||
let baselineOpen = 0;
|
|
||||||
// Hard ceiling for THIS loop (start + max); the sliding deadline (bumped by joining
|
|
||||||
// pushes) is read from #pollDeadline each tick but never allowed past this cap.
|
|
||||||
const hardCap = Date.now() + this.#pollMaxMs;
|
const hardCap = Date.now() + this.#pollMaxMs;
|
||||||
let attempts = 0;
|
let attempts = 0;
|
||||||
// The best-framed vehicle of this loop (highest body-type confidence with a box):
|
/** Plates settled in THIS loop — a framed car reads confidently on every frame. */
|
||||||
// recorded once per detection as a PASS sample, whatever happens to the plate.
|
const handled = new Set<string>();
|
||||||
let best: { shot: Snapshot; r: VisionResult } | null = null;
|
/** Below-floor plate texts already logged at info (repeats go to debug). */
|
||||||
|
const weakLogged = new Set<string>();
|
||||||
|
/** Subscriptions sighted this loop → open-occurrence count at first sighting. */
|
||||||
|
const sighted = new Map<string, number>();
|
||||||
|
let emitted = 0;
|
||||||
|
// The best-framed vehicle PER CONFIDENT PLATE (highest body-type confidence with a
|
||||||
|
// box), plus one "" bucket for frames with no confident plate: PASS samples, one per
|
||||||
|
// car the loop could tell apart, whatever happens to the plate.
|
||||||
|
const best = new Map<string, { shot: Snapshot; r: VisionResult }>();
|
||||||
try {
|
try {
|
||||||
// DO-while: a detection always analyzes AT LEAST ONE frame, however loaded the
|
// DO-while: a detection always analyzes AT LEAST ONE frame, however loaded the
|
||||||
// host — a plain while could zero-iterate if the window elapsed between setting
|
// host — a plain while could zero-iterate if the window elapsed between setting
|
||||||
// the deadline and reaching the loop (seen as a CI flake with the tests' 5ms
|
// the deadline and reaching the loop (seen as a CI flake with the tests' 5ms
|
||||||
// window; on a busy booth it would silently drop a real car's detection). Exit
|
// window; on a busy booth it would silently drop a real car's detection).
|
||||||
// is via the breaks below (confident read, or next tick would pass the deadline).
|
|
||||||
do {
|
do {
|
||||||
attempts++;
|
attempts++;
|
||||||
|
const tick = Date.now();
|
||||||
const shot = await camera.captureSnapshot({ direction });
|
const shot = await camera.captureSnapshot({ direction });
|
||||||
const r = await this.#vision.analyze(shot.bytes, shot.contentType);
|
const r = await this.#vision.analyze(shot.bytes, shot.contentType);
|
||||||
if (r?.vehicle?.bbox && (!best || r.vehicle.confidence > best.r.vehicle!.confidence)) best = { shot, r };
|
const plate = r?.plate?.text.trim().toUpperCase() ?? "";
|
||||||
|
const confident = plate !== "" && r!.plate!.confidence >= this.#entryMinConfidence;
|
||||||
|
|
||||||
// Identify the subscriber from ANY readable plate (even below the barrier floor),
|
if (r?.vehicle?.bbox) {
|
||||||
|
const key = confident ? plate : "";
|
||||||
|
const cur = best.get(key);
|
||||||
|
if (!cur || r.vehicle.confidence > cur.r.vehicle!.confidence) best.set(key, { shot, r });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Identify the subscriber from ANY readable plate (even below the barrier floor)
|
||||||
// and baseline their open count once — so we can detect a credential beating us.
|
// and baseline their open count once — so we can detect a credential beating us.
|
||||||
if (r?.plate?.text) {
|
if (plate) {
|
||||||
const m0 = this.#subscription.match({ ...baseRead(row, deviceId), value: r.plate.text.trim().toUpperCase() });
|
const m0 = this.#subscription.match({ ...baseRead(row, deviceId), value: plate });
|
||||||
if (m0 && watchedSubId == null) {
|
if (m0 && !sighted.has(m0.subscriptionId)) {
|
||||||
watchedSubId = m0.subscriptionId;
|
sighted.set(m0.subscriptionId, this.#subscription.openOccurrenceCount(m0.subscriptionId));
|
||||||
baselineOpen = this.#subscription.openOccurrenceCount(watchedSubId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// A credential (card/QR) closed/opened an occurrence for this subscriber mid-poll →
|
|
||||||
// they already transacted; stop polling and do NOT emit.
|
if (confident && !handled.has(plate)) {
|
||||||
if (watchedSubId && this.#subscription.openOccurrenceCount(watchedSubId) !== baselineOpen) {
|
handled.add(plate);
|
||||||
this.#logger.info(
|
if (this.#settle(row, deviceId, plate, r!.plate!.confidence, sighted)) emitted++;
|
||||||
`anpr-bridge: subscriber ${watchedSubId} transacted by another credential mid-poll — aborting ANPR`,
|
} else if (plate && !confident && !handled.has(plate)) {
|
||||||
);
|
const line =
|
||||||
return;
|
`anpr-bridge: '${plate}' (${r!.plate!.confidence.toFixed(3)}) below floor ` +
|
||||||
|
`${this.#entryMinConfidence} — re-pulling (attempt ${attempts})`;
|
||||||
|
if (weakLogged.has(plate)) this.#logger.debug(line);
|
||||||
|
else {
|
||||||
|
weakLogged.add(plate);
|
||||||
|
this.#logger.info(line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r?.plate && r.plate.confidence >= this.#entryMinConfidence) {
|
// Stop once the (possibly slid) deadline or the cap has passed; else pace to #pollMs.
|
||||||
result = r;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (r?.plate) {
|
|
||||||
this.#logger.info(
|
|
||||||
`anpr-bridge: '${r.plate.text}' (${r.plate.confidence.toFixed(3)}) below floor ` +
|
|
||||||
`${this.#entryMinConfidence} — re-pulling (attempt ${attempts})`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// Stop if the next tick would land past the (possibly slid) deadline or the cap.
|
|
||||||
const effDeadline = Math.min(this.#pollDeadline.get(deviceId) ?? 0, hardCap);
|
const effDeadline = Math.min(this.#pollDeadline.get(deviceId) ?? 0, hardCap);
|
||||||
if (Date.now() + this.#pollMs >= effDeadline) break;
|
const left = effDeadline - Date.now();
|
||||||
await sleep(this.#pollMs);
|
if (left <= 0) break;
|
||||||
|
const wait = this.#pollMs - (Date.now() - tick);
|
||||||
|
if (wait > 0) await sleep(Math.min(wait, left));
|
||||||
} while (true);
|
} while (true);
|
||||||
} finally {
|
} finally {
|
||||||
this.#polling.delete(deviceId);
|
this.#polling.delete(deviceId);
|
||||||
this.#pollDeadline.delete(deviceId);
|
this.#pollDeadline.delete(deviceId);
|
||||||
if (best) void this.#recordPass(deviceId, direction, best);
|
// One pass sample per plated car. The plateless bucket only when NO car got a plate
|
||||||
|
// (otherwise it is mostly the plated cars' approach frames — not another car).
|
||||||
|
for (const [key, b] of best) {
|
||||||
|
if (key !== "" || best.size === 1) void this.#recordPass(deviceId, direction, b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result || !result.plate) {
|
if (handled.size === 0) {
|
||||||
this.#logger.info(
|
this.#logger.info(
|
||||||
`anpr-bridge: no confident plate from ${deviceId} after ${attempts} attempt(s) ` +
|
`anpr-bridge: no confident plate from ${deviceId} after ${attempts} frame(s) ` +
|
||||||
`in ${this.#pollWindowMs}ms — gave up`,
|
`in ${Date.now() - now}ms — gave up`,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.#logger.info(
|
||||||
|
`anpr-bridge: ${deviceId} loop done — ${attempts} frame(s) in ${Date.now() - now}ms, ` +
|
||||||
|
`${handled.size} plate(s), ${emitted} emitted`,
|
||||||
);
|
);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const plate = result.plate.text.trim().toUpperCase();
|
|
||||||
if (!plate) return;
|
|
||||||
|
|
||||||
const e: DeviceReadEvent = {
|
|
||||||
driverId: row.driverId,
|
|
||||||
deviceId,
|
|
||||||
value: plate,
|
|
||||||
kind: "plate",
|
|
||||||
at: new Date().toISOString(),
|
|
||||||
};
|
|
||||||
|
|
||||||
// MATCH BEFORE EMIT — subscriber-only. A non-subscriber plate records advisory
|
|
||||||
// telemetry and stops; it must NEVER reach the transient plate-as-ticket exit flow.
|
|
||||||
const match = this.#subscription.match(e);
|
|
||||||
if (!match) {
|
|
||||||
this.#recordSkip(deviceId, plate, result.plate.confidence);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Final guard against the credential-mid-poll race: if the subscriber transacted between
|
|
||||||
// our baseline and now (e.g. a card scan in the last tick), don't double-act.
|
|
||||||
if (watchedSubId === match.subscriptionId && this.#subscription.openOccurrenceCount(match.subscriptionId) !== baselineOpen) {
|
|
||||||
this.#logger.info(`anpr-bridge: ${match.subscriptionId} already transacted — skipping ANPR emit`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Plate-level debounce — belt-and-suspenders against a gap that slips the
|
|
||||||
// camera-level gate re-emitting the SAME plate.
|
|
||||||
const plateKey = `${deviceId}:${plate}`;
|
|
||||||
if (this.#debounced(plateKey)) return;
|
|
||||||
this.#stamp(plateKey);
|
|
||||||
// Camera-level debounce stamp — now that we've emitted, suppress the camera's ~1Hz
|
|
||||||
// re-fires (and any new poll loop) for #debounceMs.
|
|
||||||
this.#stamp(deviceId);
|
|
||||||
|
|
||||||
this.#logger.info(
|
|
||||||
`anpr-bridge: subscriber plate '${plate}' (${result.plate.confidence.toFixed(3)}) → read bus`,
|
|
||||||
);
|
|
||||||
deviceEvents.emitRead(e); // → onRead → ReadDispatcher → gated SubscriptionFlow
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Fail-soft: an ANPR failure degrades to the subscriber's card/QR, never strands the lane.
|
// Fail-soft: an ANPR failure degrades to the subscriber's card/QR, never strands the lane.
|
||||||
this.#logger.warn(`anpr-bridge failed (${deviceId}): ${(err as Error).message}`);
|
this.#logger.warn(`anpr-bridge failed (${deviceId}): ${(err as Error).message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settle ONE confident plate: match it to a subscriber (MATCH BEFORE EMIT — a non-subscriber
|
||||||
|
* plate records advisory telemetry and stops; it must NEVER reach the transient
|
||||||
|
* plate-as-ticket exit flow), decline if that subscriber already transacted by another
|
||||||
|
* credential during this loop, debounce per plate, then emit. Returns true if emitted.
|
||||||
|
*/
|
||||||
|
#settle(
|
||||||
|
row: { driverId: string },
|
||||||
|
deviceId: string,
|
||||||
|
plate: string,
|
||||||
|
confidence: number,
|
||||||
|
sighted: ReadonlyMap<string, number>,
|
||||||
|
): boolean {
|
||||||
|
const e: DeviceReadEvent = { ...baseRead(row, deviceId), value: plate };
|
||||||
|
const match = this.#subscription.match(e);
|
||||||
|
if (!match) {
|
||||||
|
this.#recordSkip(deviceId, plate, confidence);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const base = sighted.get(match.subscriptionId);
|
||||||
|
if (base != null && this.#subscription.openOccurrenceCount(match.subscriptionId) !== base) {
|
||||||
|
this.#logger.info(
|
||||||
|
`anpr-bridge: subscriber ${match.subscriptionId} transacted by another credential mid-poll — not emitting '${plate}'`,
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Per-PLATE debounce across loops: the same car re-starting in the zone within the window
|
||||||
|
// is still the same presentation. Never per camera — the next car must not be blind.
|
||||||
|
const plateKey = `${deviceId}:${plate}`;
|
||||||
|
if (this.#debounced(plateKey)) {
|
||||||
|
this.#logger.debug(`anpr-bridge: '${plate}' read again within ${this.#debounceMs}ms — debounced`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.#stamp(plateKey);
|
||||||
|
this.#logger.info(`anpr-bridge: subscriber plate '${plate}' (${confidence.toFixed(3)}) → read bus`);
|
||||||
|
deviceEvents.emitRead(e); // → onRead → ReadDispatcher → gated SubscriptionFlow
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#debounced(key: string): boolean {
|
#debounced(key: string): boolean {
|
||||||
const last = this.#lastFire.get(key);
|
const last = this.#lastFire.get(key);
|
||||||
return last != null && Date.now() - last < this.#debounceMs;
|
return last != null && Date.now() - last < this.#debounceMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
#stamp(key: string): void {
|
#stamp(key: string): void {
|
||||||
this.#lastFire.set(key, Date.now());
|
const now = Date.now();
|
||||||
|
this.#lastFire.set(key, now);
|
||||||
|
// One key per plate ever seen would grow forever on a busy lane; drop expired stamps.
|
||||||
|
if (this.#lastFire.size > 256) {
|
||||||
|
for (const [k, t] of this.#lastFire) if (now - t >= this.#debounceMs) this.#lastFire.delete(k);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** EVERY car the camera flagged becomes one stored frame + one vehicle read on the bus —
|
/** EVERY car the camera flagged becomes one stored frame + one vehicle read on the bus —
|
||||||
* plate or no plate, ticket or no ticket. The read is what the Car Wash module samples
|
* plate or no plate, ticket or no ticket. The read is what the Car Wash module samples
|
||||||
* for the reviewer (wiki/concepts/vision-review-outbox.md §entry stream); until this,
|
* for the reviewer (wiki/concepts/vision-review-outbox.md §entry stream); until this,
|
||||||
* only session-tied reads were sampled, so a lot with its barriers up (nobody takes a
|
* only session-tied reads were sampled, so a lot with its barriers up (nobody takes a
|
||||||
* ticket) sent nothing however many cars the camera saw. One sample per poll loop, i.e.
|
* ticket) sent nothing however many cars the camera saw. One sample per car the loop
|
||||||
* per detection, from its best-framed vehicle. Fire-and-forget: never on the ANPR path,
|
* could tell apart (per confident plate; one for a plateless loop), from its best-framed
|
||||||
* a failure is a log line. Identity `pass:<snapshotId>` — no session to tie it to. */
|
* frame. Fire-and-forget: never on the ANPR path, a failure is a log line. Identity
|
||||||
|
* `pass:<snapshotId>` — no session to tie it to. */
|
||||||
async #recordPass(deviceId: string, direction: FlowDirection, best: { shot: Snapshot; r: VisionResult }): Promise<void> {
|
async #recordPass(deviceId: string, direction: FlowDirection, best: { shot: Snapshot; r: VisionResult }): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const vehicle = best.r.vehicle;
|
const vehicle = best.r.vehicle;
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
import type { FastifyBaseLogger } from "fastify";
|
||||||
|
import { CameraActivity } from "./camera-activity.js";
|
||||||
|
import { deviceEvents, type CameraActivityEvent } from "./device-events.js";
|
||||||
|
|
||||||
|
// Per-camera activity drives the booth tiles' snapshot→live switch: one "active" edge
|
||||||
|
// per run of pushes, re-armed by each push, one "idle" edge TTL after the last push.
|
||||||
|
|
||||||
|
const logger = { debug: vi.fn(), info: vi.fn(), warn: vi.fn() } as unknown as FastifyBaseLogger;
|
||||||
|
let seen: CameraActivityEvent[];
|
||||||
|
let off: () => void;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
vi.useFakeTimers();
|
||||||
|
seen = [];
|
||||||
|
off = deviceEvents.onCameraActivity((e) => seen.push(e));
|
||||||
|
});
|
||||||
|
afterEach(() => {
|
||||||
|
off();
|
||||||
|
vi.useRealTimers();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("CameraActivity", () => {
|
||||||
|
it("emits active once, re-arms on each push, idles after the TTL", () => {
|
||||||
|
const a = new CameraActivity(logger, 30_000);
|
||||||
|
a.vehicleDetected("cam1");
|
||||||
|
vi.advanceTimersByTime(20_000);
|
||||||
|
a.vehicleDetected("cam1"); // re-arm
|
||||||
|
expect(seen).toEqual([{ deviceId: "cam1", active: true }]);
|
||||||
|
expect(a.snapshot()).toEqual(["cam1"]);
|
||||||
|
vi.advanceTimersByTime(29_000);
|
||||||
|
expect(seen).toHaveLength(1);
|
||||||
|
vi.advanceTimersByTime(1_000);
|
||||||
|
expect(seen).toEqual([
|
||||||
|
{ deviceId: "cam1", active: true },
|
||||||
|
{ deviceId: "cam1", active: false },
|
||||||
|
]);
|
||||||
|
expect(a.snapshot()).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("tracks cameras independently", () => {
|
||||||
|
const a = new CameraActivity(logger, 1_000);
|
||||||
|
a.vehicleDetected("entry");
|
||||||
|
vi.advanceTimersByTime(600);
|
||||||
|
a.vehicleDetected("exit");
|
||||||
|
vi.advanceTimersByTime(400);
|
||||||
|
expect(a.snapshot()).toEqual(["exit"]);
|
||||||
|
a.stop();
|
||||||
|
vi.advanceTimersByTime(5_000);
|
||||||
|
expect(seen.filter((e) => !e.active)).toEqual([{ deviceId: "entry", active: false }]);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import type { FastifyBaseLogger } from "fastify";
|
||||||
|
import { deviceEvents, type CameraActivityEvent } from "./device-events.js";
|
||||||
|
import { busyTtlMs } from "./lane-status.js";
|
||||||
|
|
||||||
|
// Per-CAMERA "a vehicle is in view" state, for the booth camera tiles: a tile shows the
|
||||||
|
// camera's latest snapshot and switches to live video while its camera is active. Same
|
||||||
|
// signal and TTL as LaneStatus (vehicle `active` pushes, no leave event, 30 s after the
|
||||||
|
// last push) but keyed by camera, not lane: on a shared lane (park-lab: an entry and an
|
||||||
|
// exit camera on one physical lane) only the camera that saw the car goes live.
|
||||||
|
// ADVISORY ONLY — it gates nothing. See wiki/decisions/camera-live-view.md.
|
||||||
|
|
||||||
|
export type { CameraActivityEvent };
|
||||||
|
|
||||||
|
export class CameraActivity {
|
||||||
|
readonly #logger: FastifyBaseLogger;
|
||||||
|
readonly #ttlMs: number;
|
||||||
|
readonly #timers = new Map<string, ReturnType<typeof setTimeout>>();
|
||||||
|
|
||||||
|
constructor(logger: FastifyBaseLogger, ttlMs = busyTtlMs()) {
|
||||||
|
this.#logger = logger;
|
||||||
|
this.#ttlMs = ttlMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Camera ids currently active (for the WS hello). */
|
||||||
|
snapshot(): string[] {
|
||||||
|
return [...this.#timers.keys()];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A vehicle push from `deviceId`: mark it active and (re)arm its clear. */
|
||||||
|
vehicleDetected(deviceId: string): void {
|
||||||
|
const existing = this.#timers.get(deviceId);
|
||||||
|
if (existing) clearTimeout(existing);
|
||||||
|
const timer = setTimeout(() => {
|
||||||
|
this.#timers.delete(deviceId);
|
||||||
|
this.#logger.debug(`camera-activity: ${deviceId} -> idle`);
|
||||||
|
deviceEvents.emitCameraActivity({ deviceId, active: false });
|
||||||
|
}, this.#ttlMs);
|
||||||
|
timer.unref?.();
|
||||||
|
this.#timers.set(deviceId, timer);
|
||||||
|
if (!existing) {
|
||||||
|
this.#logger.debug(`camera-activity: ${deviceId} -> active`);
|
||||||
|
deviceEvents.emitCameraActivity({ deviceId, active: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stop(): void {
|
||||||
|
for (const t of this.#timers.values()) clearTimeout(t);
|
||||||
|
this.#timers.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
import type { FastifyBaseLogger } from "fastify";
|
||||||
|
import type { LiveStreamDevice, LiveVideoSource } from "@parking/devices";
|
||||||
|
import { CameraLiveHub, type LiveStatus, type LiveViewer } from "./camera-live.js";
|
||||||
|
|
||||||
|
// The hub's contract: one upstream per camera however many viewers, latest-frame-only
|
||||||
|
// delivery (a busy viewer misses frames, never queues them), teardown after the last
|
||||||
|
// viewer leaves (with a linger), reconnect with backoff while viewers remain, and a
|
||||||
|
// non-retryable failure (codec) reported as "unavailable".
|
||||||
|
|
||||||
|
const logger = { warn: vi.fn(), info: vi.fn(), debug: vi.fn() } as unknown as FastifyBaseLogger;
|
||||||
|
|
||||||
|
class FakeSource implements LiveVideoSource {
|
||||||
|
frameCbs: Array<(f: Buffer) => void> = [];
|
||||||
|
endCbs: Array<(e?: Error) => void> = [];
|
||||||
|
stopped = false;
|
||||||
|
constructor(private readonly fail?: Error) {}
|
||||||
|
async start() {
|
||||||
|
if (this.fail) {
|
||||||
|
queueMicrotask(() => this.end(this.fail));
|
||||||
|
throw this.fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stop() {
|
||||||
|
this.stopped = true;
|
||||||
|
this.end();
|
||||||
|
}
|
||||||
|
onFrame(cb: (f: Buffer) => void) {
|
||||||
|
this.frameCbs.push(cb);
|
||||||
|
}
|
||||||
|
onEnd(cb: (e?: Error) => void) {
|
||||||
|
this.endCbs.push(cb);
|
||||||
|
}
|
||||||
|
frame(b = Buffer.from([0xff, 0xd8])) {
|
||||||
|
for (const cb of this.frameCbs) cb(b);
|
||||||
|
}
|
||||||
|
end(err?: Error) {
|
||||||
|
for (const cb of this.endCbs.splice(0)) cb(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function viewer(busy = false) {
|
||||||
|
const frames: Buffer[] = [];
|
||||||
|
const statuses: LiveStatus[] = [];
|
||||||
|
const v: LiveViewer & { frames: Buffer[]; statuses: LiveStatus[]; isBusy: boolean } = {
|
||||||
|
frames,
|
||||||
|
statuses,
|
||||||
|
isBusy: busy,
|
||||||
|
sendFrame: (f) => frames.push(f),
|
||||||
|
sendStatus: (s) => statuses.push(s),
|
||||||
|
busy: () => v.isBusy,
|
||||||
|
};
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
let sources: FakeSource[];
|
||||||
|
let nextFail: Error | undefined;
|
||||||
|
const device: LiveStreamDevice = {
|
||||||
|
openLiveStream: () => {
|
||||||
|
const s = new FakeSource(nextFail);
|
||||||
|
sources.push(s);
|
||||||
|
return s;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
vi.useFakeTimers();
|
||||||
|
sources = [];
|
||||||
|
nextFail = undefined;
|
||||||
|
});
|
||||||
|
afterEach(() => vi.useRealTimers());
|
||||||
|
|
||||||
|
describe("CameraLiveHub", () => {
|
||||||
|
it("shares one upstream between viewers and tears it down after the last leaves", async () => {
|
||||||
|
const hub = new CameraLiveHub(() => device, logger, { lingerMs: 1000, maxFps: 1000 });
|
||||||
|
const a = viewer();
|
||||||
|
const b = viewer();
|
||||||
|
const offA = hub.subscribe("cam1", a);
|
||||||
|
const offB = hub.subscribe("cam1", b);
|
||||||
|
expect(sources).toHaveLength(1);
|
||||||
|
sources[0]!.frame();
|
||||||
|
expect(a.frames).toHaveLength(1);
|
||||||
|
expect(b.frames).toHaveLength(1);
|
||||||
|
expect(a.statuses.at(-1)).toEqual({ state: "live" });
|
||||||
|
|
||||||
|
offA();
|
||||||
|
offB();
|
||||||
|
expect(sources[0]!.stopped).toBe(false); // lingering
|
||||||
|
vi.advanceTimersByTime(1000);
|
||||||
|
expect(sources[0]!.stopped).toBe(true);
|
||||||
|
expect(hub.upstreamCount).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("a viewer returning within the linger reuses the session", () => {
|
||||||
|
const hub = new CameraLiveHub(() => device, logger, { lingerMs: 1000 });
|
||||||
|
const off = hub.subscribe("cam1", viewer());
|
||||||
|
off();
|
||||||
|
vi.advanceTimersByTime(500);
|
||||||
|
hub.subscribe("cam1", viewer());
|
||||||
|
vi.advanceTimersByTime(5000);
|
||||||
|
expect(sources).toHaveLength(1);
|
||||||
|
expect(sources[0]!.stopped).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("skips frames for a busy viewer and caps the frame rate", () => {
|
||||||
|
const hub = new CameraLiveHub(() => device, logger, { maxFps: 10 });
|
||||||
|
const slow = viewer(true);
|
||||||
|
const fast = viewer();
|
||||||
|
hub.subscribe("cam1", slow);
|
||||||
|
hub.subscribe("cam1", fast);
|
||||||
|
for (let i = 0; i < 5; i++) sources[0]!.frame(); // same instant: only the first passes the cap
|
||||||
|
expect(fast.frames).toHaveLength(1);
|
||||||
|
expect(slow.frames).toHaveLength(0);
|
||||||
|
vi.advanceTimersByTime(100);
|
||||||
|
slow.isBusy = false;
|
||||||
|
sources[0]!.frame();
|
||||||
|
expect(fast.frames).toHaveLength(2);
|
||||||
|
expect(slow.frames).toHaveLength(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("sends every frame when no cap is set (the default)", () => {
|
||||||
|
const hub = new CameraLiveHub(() => device, logger);
|
||||||
|
const v = viewer();
|
||||||
|
hub.subscribe("cam1", v);
|
||||||
|
for (let i = 0; i < 5; i++) sources[0]!.frame(); // same instant: all pass
|
||||||
|
expect(v.frames).toHaveLength(5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("reconnects with backoff while viewers remain", async () => {
|
||||||
|
const hub = new CameraLiveHub(() => device, logger);
|
||||||
|
const v = viewer();
|
||||||
|
hub.subscribe("cam1", v);
|
||||||
|
sources[0]!.end(new Error("RTSP connection closed"));
|
||||||
|
expect(v.statuses.at(-1)).toEqual({ state: "retrying", reason: "RTSP connection closed" });
|
||||||
|
vi.advanceTimersByTime(1000);
|
||||||
|
expect(sources).toHaveLength(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("reports a non-retryable failure as unavailable", async () => {
|
||||||
|
const hub = new CameraLiveHub(() => device, logger, { unavailableRetryMs: 60_000 });
|
||||||
|
nextFail = Object.assign(new Error("camera stream is H264, not MJPEG"), { retryable: false });
|
||||||
|
const v = viewer();
|
||||||
|
hub.subscribe("cam1", v);
|
||||||
|
await vi.advanceTimersByTimeAsync(0);
|
||||||
|
expect(v.statuses.at(-1)).toEqual({ state: "unavailable", reason: "camera stream is H264, not MJPEG" });
|
||||||
|
vi.advanceTimersByTime(59_000);
|
||||||
|
expect(sources).toHaveLength(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("a camera without live support is unavailable and opens nothing", () => {
|
||||||
|
const hub = new CameraLiveHub(() => "live view not supported by this camera driver", logger);
|
||||||
|
const v = viewer();
|
||||||
|
hub.subscribe("cam1", v);
|
||||||
|
expect(v.statuses.at(-1)).toEqual({ state: "unavailable", reason: "live view not supported by this camera driver" });
|
||||||
|
expect(hub.upstreamCount).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
import type { FastifyBaseLogger } from "fastify";
|
||||||
|
import type { LiveStreamDevice, LiveVideoSource } from "@parking/devices";
|
||||||
|
|
||||||
|
// Live camera video for the booth's camera tiles. ONE upstream session per camera,
|
||||||
|
// shared by every viewer (booth tab, desktop shell) and torn down a few seconds after
|
||||||
|
// the last viewer leaves — never one camera session per tab (a camera has few stream
|
||||||
|
// slots, and the ANPR loop pulls stills from the same unit).
|
||||||
|
//
|
||||||
|
// Frames are complete JPEGs (the driver reassembles RTP/JPEG; nothing is decoded here).
|
||||||
|
// Delivery is LATEST-FRAME-ONLY: a viewer whose socket still holds unsent bytes simply
|
||||||
|
// misses frames, so a slow client can never grow server memory. No frame-rate cap by
|
||||||
|
// default — viewers get the camera's own rate (measured: a cap only dropped frames and
|
||||||
|
// added ~40 ms); CAMERA_LIVE_MAX_FPS sets one if a client ever needs it. Advisory viewing only: nothing here touches
|
||||||
|
// the ledger, a gate or a barrier. See wiki/decisions/camera-live-view.md.
|
||||||
|
|
||||||
|
export type LiveStatus =
|
||||||
|
| { state: "connecting" }
|
||||||
|
| { state: "live" }
|
||||||
|
| { state: "retrying"; reason: string }
|
||||||
|
| { state: "unavailable"; reason: string };
|
||||||
|
|
||||||
|
export interface LiveViewer {
|
||||||
|
sendFrame(jpeg: Buffer): void;
|
||||||
|
sendStatus(status: LiveStatus): void;
|
||||||
|
/** True while this viewer's transport still has unsent bytes: skip the frame. */
|
||||||
|
busy(): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Resolve a camera id to its live-stream capability, or a reason it has none. */
|
||||||
|
export type LiveResolver = (deviceId: string) => LiveStreamDevice | string;
|
||||||
|
|
||||||
|
export interface CameraLiveOptions {
|
||||||
|
/** Keep the upstream this long after the last viewer leaves (re-render churn). */
|
||||||
|
lingerMs?: number;
|
||||||
|
/** Per-viewer frame cap; 0 / unset = none (the camera's own rate, 12.5–20 fps). */
|
||||||
|
maxFps?: number;
|
||||||
|
/** Backoff ceiling for reconnects while viewers are present. */
|
||||||
|
maxRetryMs?: number;
|
||||||
|
/** Retry delay after a non-retryable failure (codec/driver), in case it is fixed. */
|
||||||
|
unavailableRetryMs?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Upstream {
|
||||||
|
readonly deviceId: string;
|
||||||
|
readonly viewers: Map<LiveViewer, { lastSent: number }>;
|
||||||
|
source: LiveVideoSource | null;
|
||||||
|
status: LiveStatus;
|
||||||
|
attempt: number;
|
||||||
|
linger: ReturnType<typeof setTimeout> | null;
|
||||||
|
retry: ReturnType<typeof setTimeout> | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Optional per-viewer cap from CAMERA_LIVE_MAX_FPS; 0 (the default) means no cap. */
|
||||||
|
export function liveMaxFps(): number {
|
||||||
|
const raw = Number(process.env.CAMERA_LIVE_MAX_FPS ?? 0);
|
||||||
|
return Number.isFinite(raw) && raw > 0 ? raw : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CameraLiveHub {
|
||||||
|
readonly #resolve: LiveResolver;
|
||||||
|
readonly #logger: FastifyBaseLogger;
|
||||||
|
readonly #lingerMs: number;
|
||||||
|
readonly #minFrameGapMs: number;
|
||||||
|
readonly #maxRetryMs: number;
|
||||||
|
readonly #unavailableRetryMs: number;
|
||||||
|
readonly #upstreams = new Map<string, Upstream>();
|
||||||
|
|
||||||
|
constructor(resolve: LiveResolver, logger: FastifyBaseLogger, opts: CameraLiveOptions = {}) {
|
||||||
|
this.#resolve = resolve;
|
||||||
|
this.#logger = logger;
|
||||||
|
this.#lingerMs = opts.lingerMs ?? 5000;
|
||||||
|
const fps = opts.maxFps ?? liveMaxFps();
|
||||||
|
this.#minFrameGapMs = fps > 0 ? 1000 / fps : 0;
|
||||||
|
this.#maxRetryMs = opts.maxRetryMs ?? 30_000;
|
||||||
|
this.#unavailableRetryMs = opts.unavailableRetryMs ?? 60_000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Number of open upstream sessions (diagnostic / tests). */
|
||||||
|
get upstreamCount(): number {
|
||||||
|
return [...this.#upstreams.values()].filter((u) => u.source !== null).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
subscribe(deviceId: string, viewer: LiveViewer): () => void {
|
||||||
|
let up = this.#upstreams.get(deviceId);
|
||||||
|
if (!up) {
|
||||||
|
up = { deviceId, viewers: new Map(), source: null, status: { state: "connecting" }, attempt: 0, linger: null, retry: null };
|
||||||
|
this.#upstreams.set(deviceId, up);
|
||||||
|
}
|
||||||
|
if (up.linger) {
|
||||||
|
clearTimeout(up.linger);
|
||||||
|
up.linger = null;
|
||||||
|
}
|
||||||
|
if (!up.source && !up.retry) {
|
||||||
|
up.status = { state: "connecting" };
|
||||||
|
this.#start(up); // may settle the status at once (e.g. "unavailable")
|
||||||
|
}
|
||||||
|
// Added after the start so the newcomer gets the CURRENT status exactly once.
|
||||||
|
up.viewers.set(viewer, { lastSent: 0 });
|
||||||
|
viewer.sendStatus(up.status);
|
||||||
|
|
||||||
|
const u = up;
|
||||||
|
let done = false;
|
||||||
|
return () => {
|
||||||
|
if (done) return;
|
||||||
|
done = true;
|
||||||
|
u.viewers.delete(viewer);
|
||||||
|
if (u.viewers.size === 0 && !u.linger) {
|
||||||
|
u.linger = setTimeout(() => this.#teardown(u), this.#lingerMs);
|
||||||
|
u.linger.unref?.();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
stopAll(): void {
|
||||||
|
for (const up of [...this.#upstreams.values()]) this.#teardown(up);
|
||||||
|
}
|
||||||
|
|
||||||
|
#start(up: Upstream): void {
|
||||||
|
const dev = this.#resolve(up.deviceId);
|
||||||
|
if (typeof dev === "string") {
|
||||||
|
this.#setStatus(up, { state: "unavailable", reason: dev });
|
||||||
|
return; // not a live-capable camera: nothing to retry
|
||||||
|
}
|
||||||
|
let source: LiveVideoSource;
|
||||||
|
try {
|
||||||
|
source = dev.openLiveStream();
|
||||||
|
} catch (err) {
|
||||||
|
// A driver that cannot even build a session (bad config): report it; the next
|
||||||
|
// subscribe tries again.
|
||||||
|
this.#setStatus(up, { state: "unavailable", reason: (err as Error).message });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
up.source = source;
|
||||||
|
let gotFrame = false;
|
||||||
|
source.onFrame((jpeg) => {
|
||||||
|
if (up.source !== source) return;
|
||||||
|
if (!gotFrame) {
|
||||||
|
gotFrame = true;
|
||||||
|
up.attempt = 0;
|
||||||
|
this.#setStatus(up, { state: "live" });
|
||||||
|
}
|
||||||
|
const now = Date.now();
|
||||||
|
for (const [viewer, st] of up.viewers) {
|
||||||
|
if (now - st.lastSent < this.#minFrameGapMs || viewer.busy()) continue;
|
||||||
|
st.lastSent = now;
|
||||||
|
try {
|
||||||
|
viewer.sendFrame(jpeg);
|
||||||
|
} catch {
|
||||||
|
/* a broken viewer is removed by its own close handler */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
source.onEnd((err) => this.#onEnded(up, source, err));
|
||||||
|
source.start().catch(() => undefined); // failures arrive through onEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
#onEnded(up: Upstream, source: LiveVideoSource | null, err?: Error): void {
|
||||||
|
if (source && up.source !== source) return; // a stale session
|
||||||
|
up.source = null;
|
||||||
|
if (up.viewers.size === 0 || !this.#upstreams.has(up.deviceId)) return;
|
||||||
|
const reason = err?.message ?? "stream ended";
|
||||||
|
const retryable = (err as { retryable?: boolean } | undefined)?.retryable !== false;
|
||||||
|
let delay: number;
|
||||||
|
if (retryable) {
|
||||||
|
delay = Math.min(this.#maxRetryMs, 1000 * 2 ** up.attempt);
|
||||||
|
up.attempt++;
|
||||||
|
this.#setStatus(up, { state: "retrying", reason });
|
||||||
|
} else {
|
||||||
|
delay = this.#unavailableRetryMs;
|
||||||
|
this.#setStatus(up, { state: "unavailable", reason });
|
||||||
|
}
|
||||||
|
// Once, not per retry: a camera that is down for hours must not flood the log.
|
||||||
|
if (up.attempt <= 1) this.#logger.warn(`camera-live ${up.deviceId}: ${reason}`);
|
||||||
|
up.retry = setTimeout(() => {
|
||||||
|
up.retry = null;
|
||||||
|
if (up.viewers.size > 0 && !up.source) this.#start(up);
|
||||||
|
}, delay);
|
||||||
|
up.retry.unref?.();
|
||||||
|
}
|
||||||
|
|
||||||
|
#setStatus(up: Upstream, status: LiveStatus): void {
|
||||||
|
up.status = status;
|
||||||
|
for (const viewer of up.viewers.keys()) {
|
||||||
|
try {
|
||||||
|
viewer.sendStatus(status);
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#teardown(up: Upstream): void {
|
||||||
|
if (up.linger) clearTimeout(up.linger);
|
||||||
|
if (up.retry) clearTimeout(up.retry);
|
||||||
|
up.linger = null;
|
||||||
|
up.retry = null;
|
||||||
|
const source = up.source;
|
||||||
|
up.source = null;
|
||||||
|
this.#upstreams.delete(up.deviceId);
|
||||||
|
source?.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -89,6 +89,13 @@ export interface DeviceStatusEvent {
|
|||||||
* gate (it never blocks a ticket or opens a barrier). "busy" is set by a vehicle
|
* gate (it never blocks a ticket or opens a barrier). "busy" is set by a vehicle
|
||||||
* `active` event; it auto-clears to "free" after a timeout (this camera class sends
|
* `active` event; it auto-clears to "free" after a timeout (this camera class sends
|
||||||
* no leave/`inactive` signal — see wiki/entities/lpr-camera.md). */
|
* no leave/`inactive` signal — see wiki/entities/lpr-camera.md). */
|
||||||
|
/** A camera started/stopped seeing a vehicle (per camera, TTL-cleared). Drives the
|
||||||
|
* booth camera tiles' snapshot→live switch. Advisory only. See camera-activity.ts. */
|
||||||
|
export interface CameraActivityEvent {
|
||||||
|
readonly deviceId: string;
|
||||||
|
readonly active: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface LaneStatusEvent {
|
export interface LaneStatusEvent {
|
||||||
readonly entry: boolean; // true = busy (a vehicle is at the entry vicinity)
|
readonly entry: boolean; // true = busy (a vehicle is at the entry vicinity)
|
||||||
readonly exit: boolean; // true = busy (a vehicle is at the exit vicinity)
|
readonly exit: boolean; // true = busy (a vehicle is at the exit vicinity)
|
||||||
@@ -193,6 +200,15 @@ class DeviceEventBus extends EventEmitter {
|
|||||||
return () => this.off("lane-status", cb);
|
return () => this.off("lane-status", cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Emitted when a camera's vehicle activity flips (camera-activity.ts). Advisory. */
|
||||||
|
emitCameraActivity(event: CameraActivityEvent): void {
|
||||||
|
this.emit("camera-activity", event);
|
||||||
|
}
|
||||||
|
onCameraActivity(cb: (event: CameraActivityEvent) => void): () => void {
|
||||||
|
this.on("camera-activity", cb);
|
||||||
|
return () => this.off("camera-activity", cb);
|
||||||
|
}
|
||||||
|
|
||||||
/** Emitted whenever a lane's RADAR presence CHANGES (a presence input shorted/cleared
|
/** Emitted whenever a lane's RADAR presence CHANGES (a presence input shorted/cleared
|
||||||
* at an entry/exit barrier). Drives the booth barrier light's blink. Advisory only. */
|
* at an entry/exit barrier). Drives the booth barrier light's blink. Advisory only. */
|
||||||
emitLanePresence(event: LanePresenceEvent): void {
|
emitLanePresence(event: LanePresenceEvent): void {
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ const POLL_MS = Number(process.env.DEVICE_POLL_MS ?? 8000);
|
|||||||
// Camera clock sync (Hikvision loses its clock on power cuts — reboots at the 1970
|
// Camera clock sync (Hikvision loses its clock on power cuts — reboots at the 1970
|
||||||
// epoch until a human logs into its web UI). The monitor re-syncs from the HOST
|
// epoch until a human logs into its web UI). The monitor re-syncs from the HOST
|
||||||
// clock (the site's offline time authority) at the offline→ready edge — exactly the
|
// clock (the site's offline time authority) at the offline→ready edge — exactly the
|
||||||
// power-restored moment — plus a daily backstop; drift under the threshold is left
|
// power-restored moment — plus a daily backstop, plus the moment the site's UTC offset
|
||||||
// alone. See wiki/entities/lpr-camera.md (clock sync).
|
// changes (a DST switch: the camera's zone is a FIXED offset the host rewrites, see
|
||||||
|
// HikvisionCamera.syncClock); drift under the threshold is left alone. See
|
||||||
|
// wiki/entities/lpr-camera.md (clock sync).
|
||||||
const CLOCK_SYNC_BACKSTOP_MS = 24 * 60 * 60 * 1000;
|
const CLOCK_SYNC_BACKSTOP_MS = 24 * 60 * 60 * 1000;
|
||||||
const CLOCK_MAX_DRIFT_SEC = 60;
|
const CLOCK_MAX_DRIFT_SEC = 60;
|
||||||
|
|
||||||
@@ -201,18 +203,26 @@ export class DeviceMonitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Camera clock re-sync at the power-restored edge (prev offline/unknown →
|
// Camera clock re-sync at the power-restored edge (prev offline/unknown →
|
||||||
// ready) + a daily backstop. Stamped BEFORE the async attempt so a failing
|
// ready) + a daily backstop + the site's UTC-offset edge (DST switch). Stamped
|
||||||
// camera is retried at backstop cadence, never every poll.
|
// BEFORE the async attempt so a failing camera is retried at backstop cadence,
|
||||||
|
// never every poll.
|
||||||
if (row.category === "camera" && next.state === "ready" && device && isClockSyncable(device)) {
|
if (row.category === "camera" && next.state === "ready" && device && isClockSyncable(device)) {
|
||||||
const prev = this.#latest.get(row.id);
|
const prev = this.#latest.get(row.id);
|
||||||
const cameBack = !prev || prev.state === "offline";
|
const cameBack = !prev || prev.state === "offline";
|
||||||
const last = this.#clockSyncedAt.get(row.id) ?? 0;
|
const last = this.#clockSyncedAt.get(row.id) ?? 0;
|
||||||
if (cameBack || Date.now() - last > CLOCK_SYNC_BACKSTOP_MS) {
|
const nowIso = localIsoWithOffset(siteTz(this.#db));
|
||||||
|
const offset = nowIso.slice(-6);
|
||||||
|
const offsetChanged = this.#clockSyncedOffset.get(row.id) !== offset;
|
||||||
|
if (cameBack || offsetChanged || Date.now() - last > CLOCK_SYNC_BACKSTOP_MS) {
|
||||||
this.#clockSyncedAt.set(row.id, Date.now());
|
this.#clockSyncedAt.set(row.id, Date.now());
|
||||||
|
this.#clockSyncedOffset.set(row.id, offset);
|
||||||
const cam = device;
|
const cam = device;
|
||||||
void (async () => {
|
void (async () => {
|
||||||
try {
|
try {
|
||||||
const r = await cam.syncClock(localIsoWithOffset(siteTz(this.#db)), CLOCK_MAX_DRIFT_SEC);
|
const r = await cam.syncClock(nowIso, CLOCK_MAX_DRIFT_SEC);
|
||||||
|
if (r.zoneChanged) {
|
||||||
|
this.#log.warn(`device-monitor: camera ${row.id} time zone set to ${r.timeZone ?? "?"} (site offset ${offset})`);
|
||||||
|
}
|
||||||
if (r.synced) {
|
if (r.synced) {
|
||||||
// A large jump is the 1970 power-cut signature — warn (persisted) so
|
// A large jump is the 1970 power-cut signature — warn (persisted) so
|
||||||
// the reboot stays visible; a small correction is routine info.
|
// the reboot stays visible; a small correction is routine info.
|
||||||
@@ -249,6 +259,8 @@ export class DeviceMonitor {
|
|||||||
|
|
||||||
/** Per-camera timestamp of the last clock-sync ATTEMPT (backstop pacing). */
|
/** Per-camera timestamp of the last clock-sync ATTEMPT (backstop pacing). */
|
||||||
readonly #clockSyncedAt = new Map<string, number>();
|
readonly #clockSyncedAt = new Map<string, number>();
|
||||||
|
/** Per-camera site UTC offset ("+02:00") at the last attempt — a change (DST) re-syncs. */
|
||||||
|
readonly #clockSyncedOffset = new Map<string, string>();
|
||||||
|
|
||||||
/** Cache + emit a status, but only when it CHANGED (state or detail). */
|
/** Cache + emit a status, but only when it CHANGED (state or detail). */
|
||||||
#publish(id: string, next: DeviceStatusEvent): void {
|
#publish(id: string, next: DeviceStatusEvent): void {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
} from "@parking/devices";
|
} from "@parking/devices";
|
||||||
import { DEFAULT_VEHICLE_CATEGORY, reasonPayload } from "@parking/shared";
|
import { DEFAULT_VEHICLE_CATEGORY, reasonPayload } from "@parking/shared";
|
||||||
import type { FastifyBaseLogger } from "fastify";
|
import type { FastifyBaseLogger } from "fastify";
|
||||||
|
import { pulseBarrier } from "./relay-pulse.js";
|
||||||
import type { DeviceInputEvent, LaneStatusEvent } from "./device-events.js";
|
import type { DeviceInputEvent, LaneStatusEvent } from "./device-events.js";
|
||||||
import { getOccupancy } from "./occupancy.js";
|
import { getOccupancy } from "./occupancy.js";
|
||||||
import type { EventLog } from "./event-log.js";
|
import type { EventLog } from "./event-log.js";
|
||||||
@@ -386,7 +387,12 @@ export class EntryFlow {
|
|||||||
const access = this.#buildAccess(resolved.controller);
|
const access = this.#buildAccess(resolved.controller);
|
||||||
let opened = false;
|
let opened = false;
|
||||||
if (access) {
|
if (access) {
|
||||||
await access.pulseOpen(resolved.relay);
|
await pulseBarrier(this.#db, this.#logger, access, resolved, {
|
||||||
|
direction: "entry",
|
||||||
|
identity: ticketId,
|
||||||
|
source: opts.source,
|
||||||
|
...(opts.operator ? { operator: opts.operator } : {}),
|
||||||
|
});
|
||||||
opened = true;
|
opened = true;
|
||||||
} else this.#logger.warn(`entry signed for ${ticketId} but the entry relay won't build`);
|
} else this.#logger.warn(`entry signed for ${ticketId} but the entry relay won't build`);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { randomUUID } from "node:crypto";
|
import { randomUUID } from "node:crypto";
|
||||||
import { desc, eq, ledgerEvents, sessions, tariffVersions, tariffs, type Db, type DeviceRow } from "@parking/db";
|
import { desc, eq, ledgerEvents, sessions, tariffVersions, tariffs, type Db, type DeviceRow } from "@parking/db";
|
||||||
import { registry, type AccessControlDevice } from "@parking/devices";
|
import { registry, type AccessControlDevice } from "@parking/devices";
|
||||||
|
import { pulseBarrier } from "./relay-pulse.js";
|
||||||
import { firstRelayByDirection, type ResolvedRelay } from "./device-resolve.js";
|
import { firstRelayByDirection, type ResolvedRelay } from "./device-resolve.js";
|
||||||
import { plateForIdentity, platesForIdentities } from "./plate-lookup.js";
|
import { plateForIdentity, platesForIdentities } from "./plate-lookup.js";
|
||||||
import { snapshotAsync } from "./snapshot.js";
|
import { snapshotAsync } from "./snapshot.js";
|
||||||
@@ -210,7 +211,12 @@ export class ExitFlow {
|
|||||||
return { ok: true, opened: false, reason: renderReasonEn("exit.open.unavailable") };
|
return { ok: true, opened: false, reason: renderReasonEn("exit.open.unavailable") };
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await access.pulseOpen(resolved.relay);
|
await pulseBarrier(this.#db, this.#logger, access, resolved, {
|
||||||
|
direction: "exit",
|
||||||
|
identity: id,
|
||||||
|
source: "booth",
|
||||||
|
...(opts?.operator ? { operator: opts.operator } : {}),
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
await this.#openFailedAnomaly(id, `pulseOpen failed: ${(err as Error).message}`);
|
await this.#openFailedAnomaly(id, `pulseOpen failed: ${(err as Error).message}`);
|
||||||
return { ok: true, opened: false, reason: renderReasonEn("exit.open.failed") };
|
return { ok: true, opened: false, reason: renderReasonEn("exit.open.failed") };
|
||||||
@@ -300,7 +306,7 @@ export class ExitFlow {
|
|||||||
this.#logger.info(`barrier re-open also closed open session ${id} (human-intervention exit)`);
|
this.#logger.info(`barrier re-open also closed open session ${id} (human-intervention exit)`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const r = await this.#pulseExit(resolved, `barrier re-open for ${id}`);
|
const r = await this.#pulseExit(resolved, id, operator, `barrier re-open for ${id}`);
|
||||||
if (r.opened) {
|
if (r.opened) {
|
||||||
if (forgiven) this.#logger.warn(`FORGIVEN exit barrier open for ${id} by ${operator ?? "?"}: ${forgiven.note}`);
|
if (forgiven) this.#logger.warn(`FORGIVEN exit barrier open for ${id} by ${operator ?? "?"}: ${forgiven.note}`);
|
||||||
else this.#logger.info(`manual barrier open for ${id}${operator ? ` by ${operator}` : ""}`);
|
else this.#logger.info(`manual barrier open for ${id}${operator ? ` by ${operator}` : ""}`);
|
||||||
@@ -337,7 +343,7 @@ export class ExitFlow {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
this.#fireExitSnapshot(ref);
|
this.#fireExitSnapshot(ref);
|
||||||
const r = await this.#pulseExit(resolved, `forgiven open (no session) ${ref}`);
|
const r = await this.#pulseExit(resolved, ref, operator, `forgiven open (no session) ${ref}`);
|
||||||
if (r.opened) this.#logger.warn(`FORGIVEN exit barrier open with no session by ${operator}: ${note}`);
|
if (r.opened) this.#logger.warn(`FORGIVEN exit barrier open with no session by ${operator}: ${note}`);
|
||||||
return r;
|
return r;
|
||||||
} finally {
|
} finally {
|
||||||
@@ -347,7 +353,12 @@ export class ExitFlow {
|
|||||||
|
|
||||||
/** Drive the exit relay for a human-intervention open; the exit/anomaly is already
|
/** Drive the exit relay for a human-intervention open; the exit/anomaly is already
|
||||||
* signed, so every failure is `ok: true, opened: false` + the reason to open by hand. */
|
* signed, so every failure is `ok: true, opened: false` + the reason to open by hand. */
|
||||||
async #pulseExit(resolved: ResolvedRelay | null, label: string): Promise<Extract<BoothReopenResult, { ok: true }>> {
|
async #pulseExit(
|
||||||
|
resolved: ResolvedRelay | null,
|
||||||
|
identity: string,
|
||||||
|
operator: string | undefined,
|
||||||
|
label: string,
|
||||||
|
): Promise<Extract<BoothReopenResult, { ok: true }>> {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
this.#logger.warn(`${label}: no exit relay configured`);
|
this.#logger.warn(`${label}: no exit relay configured`);
|
||||||
return { ok: true, opened: false, reason: renderReasonEn("exit.open.noBarrier") };
|
return { ok: true, opened: false, reason: renderReasonEn("exit.open.noBarrier") };
|
||||||
@@ -358,7 +369,12 @@ export class ExitFlow {
|
|||||||
return { ok: true, opened: false, reason: renderReasonEn("exit.open.unavailable") };
|
return { ok: true, opened: false, reason: renderReasonEn("exit.open.unavailable") };
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await access.pulseOpen(resolved.relay);
|
await pulseBarrier(this.#db, this.#logger, access, resolved, {
|
||||||
|
direction: "exit",
|
||||||
|
identity,
|
||||||
|
source: "booth",
|
||||||
|
...(operator ? { operator } : {}),
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.#logger.error(`${label}: pulseOpen failed: ${(err as Error).message}`);
|
this.#logger.error(`${label}: pulseOpen failed: ${(err as Error).message}`);
|
||||||
return { ok: true, opened: false, reason: renderReasonEn("exit.open.failed") };
|
return { ok: true, opened: false, reason: renderReasonEn("exit.open.failed") };
|
||||||
@@ -473,8 +489,13 @@ export class ExitFlow {
|
|||||||
await this.#signExit(e.value, e.kind === "plate" ? "lpr" : "ticket");
|
await this.#signExit(e.value, e.kind === "plate" ? "lpr" : "ticket");
|
||||||
|
|
||||||
const access = this.#buildAccess(resolved.controller);
|
const access = this.#buildAccess(resolved.controller);
|
||||||
if (access) await access.pulseOpen(resolved.relay);
|
if (access) {
|
||||||
else this.#logger.warn(`exit signed for ${e.value} but the exit relay won't build`);
|
await pulseBarrier(this.#db, this.#logger, access, resolved, {
|
||||||
|
direction: "exit",
|
||||||
|
identity: e.value,
|
||||||
|
source: e.kind === "plate" ? "lpr" : "ticket",
|
||||||
|
});
|
||||||
|
} else this.#logger.warn(`exit signed for ${e.value} but the exit relay won't build`);
|
||||||
|
|
||||||
this.#fireExitSnapshot(e.value);
|
this.#fireExitSnapshot(e.value);
|
||||||
this.#closeSessionCache(e.value);
|
this.#closeSessionCache(e.value);
|
||||||
|
|||||||
@@ -152,4 +152,25 @@ describe("PayStation.activeSessions", () => {
|
|||||||
expect(list.map((s) => s.identity)).toEqual(["NEW", "OLD"]);
|
expect(list.map((s) => s.identity)).toEqual(["NEW", "OLD"]);
|
||||||
expect(list.every((s) => s.open)).toBe(true);
|
expect(list.every((s) => s.open)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// The list prices each open transient from ONE whole-ledger scan (no per-row ledger
|
||||||
|
// reads — those froze park-2's server, 2026-10-24). The amounts must match the
|
||||||
|
// single-session quote() exactly, including after a payment (overstay repricing) and
|
||||||
|
// for a subscription (never quoted).
|
||||||
|
it("prices every row identically to quote() without per-session ledger reads", async () => {
|
||||||
|
seedTariff(db, { pricePerIncrementMinor: 10000, incrementMin: 60, gracePeriodExitMin: 0 });
|
||||||
|
await enter("UNPAID", minutesAgo(150));
|
||||||
|
await enter("PAID", minutesAgo(300));
|
||||||
|
await pay.pay("PAID", "cash"); // grace 0 → paid-but-open ⇒ overstay, re-priced from now
|
||||||
|
await enter("SUB", minutesAgo(10), { permit: true, permitId: "sub-1" });
|
||||||
|
|
||||||
|
const list = pay.activeSessions();
|
||||||
|
const by = new Map(list.map((s) => [s.identity, s]));
|
||||||
|
expect(by.get("UNPAID")!.amountMinor).toBe(pay.quote("UNPAID").amountMinor);
|
||||||
|
expect(by.get("UNPAID")!.currency).toBe(pay.quote("UNPAID").currency);
|
||||||
|
expect(by.get("PAID")!.overstay).toBe(true);
|
||||||
|
expect(by.get("PAID")!.amountMinor).toBe(pay.quote("PAID").amountMinor);
|
||||||
|
expect(by.get("SUB")!.subscription).toBe(true);
|
||||||
|
expect(by.get("SUB")!.amountMinor).toBeNull();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,13 @@ import type { FastifyBaseLogger } from "fastify";
|
|||||||
import type { EventLog } from "./event-log.js";
|
import type { EventLog } from "./event-log.js";
|
||||||
import { plateForIdentity, platesForIdentities } from "./plate-lookup.js";
|
import { plateForIdentity, platesForIdentities } from "./plate-lookup.js";
|
||||||
import { windowOwedBetween } from "./subscription-window.js";
|
import { windowOwedBetween } from "./subscription-window.js";
|
||||||
import { liveValidations } from "./validations.js";
|
import { liveValidationsFromRows } from "./validations.js";
|
||||||
|
|
||||||
|
/** A `ledger_events` row as the pricing fold reads it. */
|
||||||
|
type LedgerRow = typeof ledgerEvents.$inferSelect;
|
||||||
|
/** Resolves the tariff version in force at an instant. Built once per request so a list
|
||||||
|
* view does not re-read the tariff tables for every row. */
|
||||||
|
type TariffResolver = (at: string) => typeof tariffVersions.$inferSelect | null;
|
||||||
|
|
||||||
// The PAY STATION: a customer pays for an open session BEFORE walking back to the
|
// The PAY STATION: a customer pays for an open session BEFORE walking back to the
|
||||||
// car (pay-on-foot — payment is decoupled from exit). Two steps:
|
// car (pay-on-foot — payment is decoupled from exit). Two steps:
|
||||||
@@ -200,12 +206,23 @@ export class PayStation {
|
|||||||
* 0 and a multi-day overstay would exit free (ticket 1245791632490). A new period
|
* 0 and a multi-day overstay would exit free (ticket 1245791632490). A new period
|
||||||
* reflects the reality and re-accrues the fee. No side effect. */
|
* reflects the reality and re-accrues the fee. No side effect. */
|
||||||
quote(identity: string): Quote {
|
quote(identity: string): Quote {
|
||||||
const entry = this.#openEntry(identity);
|
return this.#quoteFromRows(identity, this.#identityRows(identity), this.#tariffResolver());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** `quote` over the identity's ledger rows the caller already holds (oldest first) and
|
||||||
|
* a prebuilt tariff resolver. The single-session `quote()` wraps this with one
|
||||||
|
* identity-scoped read; `activeSessions()` feeds it per-identity groups of ONE whole-
|
||||||
|
* ledger scan. Both paths MUST price identically — pinned by pay-station.test.ts.
|
||||||
|
* Why: the list view used to call `quote()` per open unpaid row, each doing 3–4
|
||||||
|
* ledger scans; with ~660 such rows at park-2 the synchronous handler ran ~2 s and
|
||||||
|
* froze the event loop — relay replies then "timed out" (2026-10-24). */
|
||||||
|
#quoteFromRows(identity: string, rows: readonly LedgerRow[], tariffFor: TariffResolver): Quote {
|
||||||
|
const entry = PayStation.#openEntryFromRows(rows);
|
||||||
if (!entry) throw new NoOpenSessionError(identity);
|
if (!entry) throw new NoOpenSessionError(identity);
|
||||||
|
|
||||||
// The tariff in force is keyed to ENTRY (the version frozen for this session), even
|
// The tariff in force is keyed to ENTRY (the version frozen for this session), even
|
||||||
// for an overstay period — the customer keeps the rate card they entered under.
|
// for an overstay period — the customer keeps the rate card they entered under.
|
||||||
const tv = this.#tariffVersionFor(entry.occurredAt);
|
const tv = tariffFor(entry.occurredAt);
|
||||||
if (!tv) throw new NoTariffError();
|
if (!tv) throw new NoTariffError();
|
||||||
const structure = tv.structure as unknown as TariffStructure;
|
const structure = tv.structure as unknown as TariffStructure;
|
||||||
|
|
||||||
@@ -220,8 +237,8 @@ export class PayStation {
|
|||||||
// Merchant validations: fold the LIVE ones (applied, unvoided, not consumed by a
|
// Merchant validations: fold the LIVE ones (applied, unvoided, not consumed by a
|
||||||
// prior payment) so the quote is NET — the payment then stamps their ids as
|
// prior payment) so the quote is NET — the payment then stamps their ids as
|
||||||
// consumed. See wiki/concepts/validation-discounts.md.
|
// consumed. See wiki/concepts/validation-discounts.md.
|
||||||
const last = this.#lastPayment(identity);
|
const last = PayStation.#lastPaymentFromRows(rows);
|
||||||
const validations = liveValidations(this.#db, identity);
|
const validations = liveValidationsFromRows(rows);
|
||||||
const p = priceSession(
|
const p = priceSession(
|
||||||
entry.occurredAt,
|
entry.occurredAt,
|
||||||
new Date().toISOString(),
|
new Date().toISOString(),
|
||||||
@@ -254,12 +271,17 @@ export class PayStation {
|
|||||||
/** The latest signed `payment` for this session (time + the grace window it granted),
|
/** The latest signed `payment` for this session (time + the grace window it granted),
|
||||||
* or null if never paid. Folds the append-only ledger. */
|
* or null if never paid. Folds the append-only ledger. */
|
||||||
#lastPayment(identity: string): { paidAt: string; graceExitMin: number | null } | null {
|
#lastPayment(identity: string): { paidAt: string; graceExitMin: number | null } | null {
|
||||||
const rows = this.#db
|
return PayStation.#lastPaymentFromRows(this.#identityRows(identity));
|
||||||
.select({ type: ledgerEvents.type, occurredAt: ledgerEvents.occurredAt, payload: ledgerEvents.payload })
|
}
|
||||||
.from(ledgerEvents)
|
|
||||||
.where(eq(ledgerEvents.identity, identity))
|
/** All ledger rows of one identity, oldest first (the fold order every helper expects). */
|
||||||
.orderBy(ledgerEvents.index)
|
#identityRows(identity: string): LedgerRow[] {
|
||||||
.all();
|
return this.#db.select().from(ledgerEvents).where(eq(ledgerEvents.identity, identity)).orderBy(ledgerEvents.index).all();
|
||||||
|
}
|
||||||
|
|
||||||
|
static #lastPaymentFromRows(
|
||||||
|
rows: readonly Pick<LedgerRow, "type" | "occurredAt" | "payload">[],
|
||||||
|
): { paidAt: string; graceExitMin: number | null } | null {
|
||||||
let last: { paidAt: string; graceExitMin: number | null } | null = null;
|
let last: { paidAt: string; graceExitMin: number | null } | null = null;
|
||||||
for (const r of rows) {
|
for (const r of rows) {
|
||||||
if (r.type !== "payment") continue;
|
if (r.type !== "payment") continue;
|
||||||
@@ -541,9 +563,15 @@ export class PayStation {
|
|||||||
subscriptionId?: string | null;
|
subscriptionId?: string | null;
|
||||||
};
|
};
|
||||||
const byId = new Map<string, Acc>();
|
const byId = new Map<string, Acc>();
|
||||||
|
// Every row per identity (oldest first — `rows` is index-ordered), so the quotes
|
||||||
|
// below price from THIS scan instead of re-reading the ledger per session.
|
||||||
|
const rowsById = new Map<string, LedgerRow[]>();
|
||||||
for (const r of rows) {
|
for (const r of rows) {
|
||||||
const id = r.identity;
|
const id = r.identity;
|
||||||
if (!id) continue;
|
if (!id) continue;
|
||||||
|
const group = rowsById.get(id);
|
||||||
|
if (group) group.push(r);
|
||||||
|
else rowsById.set(id, [r]);
|
||||||
if (r.type === "vehicle_entry") {
|
if (r.type === "vehicle_entry") {
|
||||||
const a = byId.get(id) ?? { source: r.source ?? null };
|
const a = byId.get(id) ?? { source: r.source ?? null };
|
||||||
a.enteredAt = r.occurredAt;
|
a.enteredAt = r.occurredAt;
|
||||||
@@ -570,6 +598,8 @@ export class PayStation {
|
|||||||
// Resolve advisory plates for all candidate identities in ONE device_events scan
|
// Resolve advisory plates for all candidate identities in ONE device_events scan
|
||||||
// (cheaper than one lookup per row).
|
// (cheaper than one lookup per row).
|
||||||
const plates = platesForIdentities(this.#db, byId.keys());
|
const plates = platesForIdentities(this.#db, byId.keys());
|
||||||
|
// One tariff read for the whole list (quotes below reuse it).
|
||||||
|
const tariffFor = this.#tariffResolver();
|
||||||
|
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const out: ActiveSession[] = [];
|
const out: ActiveSession[] = [];
|
||||||
@@ -607,7 +637,9 @@ export class PayStation {
|
|||||||
let currency: string | null = null;
|
let currency: string | null = null;
|
||||||
if (open && !isSubscription && (a.paidAt == null || overstay)) {
|
if (open && !isSubscription && (a.paidAt == null || overstay)) {
|
||||||
try {
|
try {
|
||||||
const q = this.quote(identity);
|
// Priced from the rows already in hand — no per-session ledger reads. The
|
||||||
|
// charge providers (car wash) still run one indexed lookup per row.
|
||||||
|
const q = this.#quoteFromRows(identity, rowsById.get(identity) ?? [], tariffFor);
|
||||||
amountMinor = q.amountMinor;
|
amountMinor = q.amountMinor;
|
||||||
currency = q.currency;
|
currency = q.currency;
|
||||||
} catch {
|
} catch {
|
||||||
@@ -710,12 +742,10 @@ export class PayStation {
|
|||||||
|
|
||||||
/** The vehicle_entry of an OPEN session for this identity (no later exit), or null. */
|
/** The vehicle_entry of an OPEN session for this identity (no later exit), or null. */
|
||||||
#openEntry(identity: string) {
|
#openEntry(identity: string) {
|
||||||
const rows = this.#db
|
return PayStation.#openEntryFromRows(this.#identityRows(identity));
|
||||||
.select()
|
}
|
||||||
.from(ledgerEvents)
|
|
||||||
.where(eq(ledgerEvents.identity, identity))
|
static #openEntryFromRows(rows: readonly LedgerRow[]): LedgerRow | null {
|
||||||
.orderBy(ledgerEvents.index)
|
|
||||||
.all();
|
|
||||||
const entry = rows.find((r) => r.type === "vehicle_entry");
|
const entry = rows.find((r) => r.type === "vehicle_entry");
|
||||||
if (!entry) return null;
|
if (!entry) return null;
|
||||||
if (rows.some((r) => r.type === "vehicle_exit")) return null; // already closed
|
if (rows.some((r) => r.type === "vehicle_exit")) return null; // already closed
|
||||||
@@ -725,14 +755,20 @@ export class PayStation {
|
|||||||
/** The tariff version in force at `at` — latest effectiveFrom ≤ at, for the
|
/** The tariff version in force at `at` — latest effectiveFrom ≤ at, for the
|
||||||
* (single, for now) active site tariff. */
|
* (single, for now) active site tariff. */
|
||||||
#tariffVersionFor(at: string) {
|
#tariffVersionFor(at: string) {
|
||||||
|
return this.#tariffResolver()(at);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Read the site tariff + its versions ONCE and return a resolver over them. A list
|
||||||
|
* view builds one resolver per request instead of two tariff reads per row. */
|
||||||
|
#tariffResolver(): TariffResolver {
|
||||||
const tariff = this.#db.select().from(tariffs).where(eq(tariffs.scope, "site")).get();
|
const tariff = this.#db.select().from(tariffs).where(eq(tariffs.scope, "site")).get();
|
||||||
if (!tariff) return null;
|
if (!tariff) return () => null;
|
||||||
const versions = this.#db
|
const versions = this.#db
|
||||||
.select()
|
.select()
|
||||||
.from(tariffVersions)
|
.from(tariffVersions)
|
||||||
.where(eq(tariffVersions.tariffId, tariff.id))
|
.where(eq(tariffVersions.tariffId, tariff.id))
|
||||||
.orderBy(desc(tariffVersions.effectiveFrom))
|
.orderBy(desc(tariffVersions.effectiveFrom))
|
||||||
.all();
|
.all();
|
||||||
return versions.find((v) => v.effectiveFrom <= at) ?? null;
|
return (at) => versions.find((v) => v.effectiveFrom <= at) ?? null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,147 @@
|
|||||||
|
import { beforeEach, describe, expect, it } from "vitest";
|
||||||
|
import { devices, deviceEvents as deviceEventsTable, ledgerEvents, subscriptionCredentials, subscriptions, type Db } from "@parking/db";
|
||||||
|
import { createTestDb } from "@parking/db/testing";
|
||||||
|
import { ReadDispatcher, readDebounceMs, DEFAULT_READ_DEBOUNCE_MS } from "./read-dispatch.js";
|
||||||
|
import { ExitFlow } from "./exit-flow.js";
|
||||||
|
import { SubscriptionFlow } from "./subscription-flow.js";
|
||||||
|
import type { DeviceReadEvent } from "./device-events.js";
|
||||||
|
import { makeLog, silentLogger } from "./test-helpers.js";
|
||||||
|
|
||||||
|
// SAME-CODE DEBOUNCE at the dispatcher (2026-10-11): the same value from the same reader
|
||||||
|
// inside the reader's `debounceMs` window is ONE presentation — the first verdict is
|
||||||
|
// replayed, nothing is signed twice, the repeat lands in device_events as telemetry.
|
||||||
|
// Born at park-2: the DT-008 reported one card twice 560 ms apart; the permit flow opened
|
||||||
|
// two sessions and pulsed the barrier twice. Every lane, every credential kind.
|
||||||
|
|
||||||
|
let db: Db;
|
||||||
|
|
||||||
|
function seed(readerCfg: Record<string, unknown>, direction: "entry" | "exit" = "exit"): ReadDispatcher {
|
||||||
|
({ db } = createTestDb());
|
||||||
|
db.insert(devices).values({
|
||||||
|
id: "ctl",
|
||||||
|
category: "access",
|
||||||
|
driverId: "stub-access",
|
||||||
|
config: { relays: [{ relay: 1, direction }] },
|
||||||
|
enabled: true,
|
||||||
|
}).run();
|
||||||
|
db.insert(devices).values({
|
||||||
|
id: "reader",
|
||||||
|
category: "reader",
|
||||||
|
driverId: "dingtian-qr-reader",
|
||||||
|
config: { serial: "H05MA5B0", controllerId: "ctl", relay: 1, ...readerCfg },
|
||||||
|
enabled: true,
|
||||||
|
}).run();
|
||||||
|
const log = makeLog(db);
|
||||||
|
return new ReadDispatcher(db, new ExitFlow(db, log, silentLogger()), new SubscriptionFlow(db, log, silentLogger()), silentLogger());
|
||||||
|
}
|
||||||
|
|
||||||
|
function read(value: string, opts: { kind?: DeviceReadEvent["kind"]; channel?: DeviceReadEvent["channel"] } = {}): DeviceReadEvent {
|
||||||
|
return {
|
||||||
|
driverId: "dingtian-qr-reader",
|
||||||
|
deviceId: "reader",
|
||||||
|
value,
|
||||||
|
kind: opts.kind ?? "qr",
|
||||||
|
...(opts.channel ? { channel: opts.channel } : {}),
|
||||||
|
at: new Date().toISOString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const ledger = () => db.select().from(ledgerEvents).all();
|
||||||
|
const debounced = () =>
|
||||||
|
db.select().from(deviceEventsTable).all()
|
||||||
|
.map((r) => r.detail as { debounced?: boolean; value?: string; sinceMs?: number; replayedAccepted?: boolean })
|
||||||
|
.filter((d) => d.debounced === true);
|
||||||
|
|
||||||
|
describe("readDebounceMs", () => {
|
||||||
|
it("defaults to 5000 when the reader has no value; honours numbers and form strings; 0 = off", () => {
|
||||||
|
expect(readDebounceMs({})).toBe(DEFAULT_READ_DEBOUNCE_MS);
|
||||||
|
expect(readDebounceMs({ debounceMs: "" })).toBe(5000);
|
||||||
|
expect(readDebounceMs({ debounceMs: 2500 })).toBe(2500);
|
||||||
|
expect(readDebounceMs({ debounceMs: "800" })).toBe(800);
|
||||||
|
expect(readDebounceMs({ debounceMs: 0 })).toBe(0);
|
||||||
|
expect(readDebounceMs({ debounceMs: "nope" })).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("read-dispatch same-code debounce", () => {
|
||||||
|
it("a repeat of the same unknown ticket at exit signs ONE refusal, replays the verdict, logs telemetry", async () => {
|
||||||
|
const d = seed({}); // default window
|
||||||
|
const first = await d.dispatch(read("00000000000")); // Luhn-valid, no session → refused + signed
|
||||||
|
const second = await d.dispatch(read("00000000000"));
|
||||||
|
expect(ledger()).toHaveLength(1); // not a second red row for the same scan
|
||||||
|
expect(second).toEqual(first); // same verdict → same beep
|
||||||
|
expect(debounced()).toHaveLength(1);
|
||||||
|
expect(debounced()[0]).toMatchObject({ value: "00000000000", replayedAccepted: false });
|
||||||
|
});
|
||||||
|
|
||||||
|
it("a double-read SUBSCRIBER card at ENTRY opens ONE occurrence and the repeat is accepted (replayed)", async () => {
|
||||||
|
const d = seed({}, "entry");
|
||||||
|
db.insert(subscriptions).values({ id: "s1", status: "active", quantity: 1, period: "month" }).run();
|
||||||
|
db.insert(subscriptionCredentials).values({ id: "c1", subscriptionId: "s1", kind: "rf", value: "3F3AFC" }).run();
|
||||||
|
const first = await d.dispatch(read("3F3AFC", { kind: "card", channel: "rf" }));
|
||||||
|
const second = await d.dispatch(read("3F3AFC", { kind: "card", channel: "rf" }));
|
||||||
|
expect(first.accepted).toBe(true);
|
||||||
|
expect(second.accepted).toBe(true); // the card WAS read; beep ok, but no second entry
|
||||||
|
expect(ledger().filter((e) => e.type === "vehicle_entry")).toHaveLength(1);
|
||||||
|
expect(debounced()).toHaveLength(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("a DIFFERENT code inside the window is not debounced", async () => {
|
||||||
|
const d = seed({});
|
||||||
|
await d.dispatch(read("00000000000"));
|
||||||
|
await d.dispatch(read("00000000026")); // another Luhn-valid shape
|
||||||
|
expect(ledger()).toHaveLength(2);
|
||||||
|
expect(debounced()).toHaveLength(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("the window comes from the reader's config and expires", async () => {
|
||||||
|
const d = seed({ debounceMs: 30 });
|
||||||
|
await d.dispatch(read("00000000000"));
|
||||||
|
await new Promise((r) => setTimeout(r, 45));
|
||||||
|
await d.dispatch(read("00000000000")); // outside the 30ms window → a fresh decision
|
||||||
|
expect(ledger()).toHaveLength(2);
|
||||||
|
expect(debounced()).toHaveLength(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("debounceMs = 0 turns it off", async () => {
|
||||||
|
const d = seed({ debounceMs: 0 });
|
||||||
|
await d.dispatch(read("00000000000"));
|
||||||
|
await d.dispatch(read("00000000000"));
|
||||||
|
expect(ledger()).toHaveLength(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("a FAILED first decision is not replayed: the repeat decides afresh, no unhandled rejection", async () => {
|
||||||
|
seed({});
|
||||||
|
// Make the exit flow blow up once (e.g. a signer hiccup), then work.
|
||||||
|
const log = makeLog(db);
|
||||||
|
const flaky = new ExitFlow(db, log, silentLogger());
|
||||||
|
let calls = 0;
|
||||||
|
const orig = flaky.handleAt.bind(flaky);
|
||||||
|
flaky.handleAt = async (...args: Parameters<ExitFlow["handleAt"]>) => {
|
||||||
|
calls++;
|
||||||
|
if (calls === 1) throw new Error("signer busy");
|
||||||
|
return orig(...args);
|
||||||
|
};
|
||||||
|
const d2 = new ReadDispatcher(db, flaky, new SubscriptionFlow(db, log, silentLogger()), silentLogger());
|
||||||
|
const rejections: unknown[] = [];
|
||||||
|
const onUnhandled = (r: unknown) => rejections.push(r);
|
||||||
|
process.on("unhandledRejection", onUnhandled);
|
||||||
|
try {
|
||||||
|
await expect(d2.dispatch(read("00000000000"))).rejects.toThrow("signer busy");
|
||||||
|
const second = await d2.dispatch(read("00000000000")); // inside the window, but nothing to replay
|
||||||
|
expect(second.accepted).toBe(false); // a real decision (refused: no session), signed once
|
||||||
|
expect(ledger()).toHaveLength(1);
|
||||||
|
await new Promise((r) => setTimeout(r, 10));
|
||||||
|
expect(rejections).toEqual([]);
|
||||||
|
} finally {
|
||||||
|
process.off("unhandledRejection", onUnhandled);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("a repeat arriving while the first read is still deciding gets the SAME decision", async () => {
|
||||||
|
const d = seed({});
|
||||||
|
const [a, b] = await Promise.all([d.dispatch(read("00000000000")), d.dispatch(read("00000000000"))]);
|
||||||
|
expect(b).toEqual(a);
|
||||||
|
expect(ledger()).toHaveLength(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -5,7 +5,7 @@ import type { DeviceReadEvent, ReadOutcome } from "./device-events.js";
|
|||||||
import type { ExitFlow } from "./exit-flow.js";
|
import type { ExitFlow } from "./exit-flow.js";
|
||||||
import { validateTicketCode } from "./entry-flow.js";
|
import { validateTicketCode } from "./entry-flow.js";
|
||||||
import type { SubscriptionFlow } from "./subscription-flow.js";
|
import type { SubscriptionFlow } from "./subscription-flow.js";
|
||||||
import { relayForDevice } from "./device-resolve.js";
|
import { relayForDevice, type ResolvedRelay } from "./device-resolve.js";
|
||||||
|
|
||||||
// Routes a credential read (ticket scan / plate / card) to the right flow. A read
|
// Routes a credential read (ticket scan / plate / card) to the right flow. A read
|
||||||
// can mean a subscription entry/exit OR a transient exit, so we dispatch by WHAT the
|
// can mean a subscription entry/exit OR a transient exit, so we dispatch by WHAT the
|
||||||
@@ -35,12 +35,49 @@ import { relayForDevice } from "./device-resolve.js";
|
|||||||
// - ANY read on a CONFIRMED RF channel (a physically present card, enrolled or
|
// - ANY read on a CONFIRMED RF channel (a physically present card, enrolled or
|
||||||
// not, is a real event — RF is never sun noise),
|
// not, is a real event — RF is never sun noise),
|
||||||
// - plates (different population; never shape-filtered here).
|
// - plates (different population; never shape-filtered here).
|
||||||
|
//
|
||||||
|
// SAME-CODE DEBOUNCE (2026-10-11, park-2). The DT-008 reported one card TWICE 560 ms
|
||||||
|
// apart; the permit flow opened two sessions on the same permit and pulsed the barrier
|
||||||
|
// twice. Any reader can double-read (a card held a beat too long, a QR re-decoded while
|
||||||
|
// the hand moves), and at exit a second scan of a ticket inside its grace period would
|
||||||
|
// sign a noSession refusal for a car that just left. So the SAME value from the SAME
|
||||||
|
// reader within the reader's `debounceMs` (Setup → reader; default 5000; 0 = off) is one
|
||||||
|
// presentation: the first verdict is REPLAYED (same beep, no second decision, nothing
|
||||||
|
// signed twice) and the repeat is kept as unsigned telemetry. Every lane, every kind
|
||||||
|
// (card / QR / ticket / plate) — the ANPR bridge debounces plates itself, longer.
|
||||||
|
|
||||||
|
/** Default same-code debounce when a reader's config has none (ms). */
|
||||||
|
export const DEFAULT_READ_DEBOUNCE_MS = 5000;
|
||||||
|
/** Recent-reads map housekeeping: prune above the soft cap, never exceed the hard cap, and
|
||||||
|
* treat any entry older than this as expired whatever the reader's configured window. */
|
||||||
|
const RECENT_READS_SOFT_CAP = 512;
|
||||||
|
const RECENT_READS_HARD_CAP = 4096;
|
||||||
|
const RECENT_READS_MAX_AGE_MS = 60_000;
|
||||||
|
|
||||||
|
interface ReaderConfig {
|
||||||
|
readonly debounceMs?: number | string | null;
|
||||||
|
readonly [k: string]: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The reader's debounce window: its config value (the Setup form may store a string),
|
||||||
|
* else the default; 0 (or a negative/garbage value coerced to 0) disables. */
|
||||||
|
export function readDebounceMs(config: unknown): number {
|
||||||
|
const v = (config as ReaderConfig | null)?.debounceMs;
|
||||||
|
if (v == null || v === "") return DEFAULT_READ_DEBOUNCE_MS;
|
||||||
|
const n = Number(v);
|
||||||
|
return Number.isFinite(n) && n > 0 ? n : 0;
|
||||||
|
}
|
||||||
|
|
||||||
export class ReadDispatcher {
|
export class ReadDispatcher {
|
||||||
readonly #db: Db;
|
readonly #db: Db;
|
||||||
readonly #exit: ExitFlow;
|
readonly #exit: ExitFlow;
|
||||||
readonly #subscription: SubscriptionFlow;
|
readonly #subscription: SubscriptionFlow;
|
||||||
readonly #logger: FastifyBaseLogger;
|
readonly #logger: FastifyBaseLogger;
|
||||||
|
/** Recent reads keyed `deviceId:kind:value` → when last seen + the FIRST verdict (a
|
||||||
|
* promise, so a repeat arriving while the first is still deciding gets that same
|
||||||
|
* decision). `at` slides on each repeat: a card held against the reader stays one
|
||||||
|
* presentation for as long as it keeps re-reading. */
|
||||||
|
readonly #recent = new Map<string, { at: number; outcome: Promise<ReadOutcome> }>();
|
||||||
|
|
||||||
constructor(db: Db, exit: ExitFlow, subscription: SubscriptionFlow, logger: FastifyBaseLogger) {
|
constructor(db: Db, exit: ExitFlow, subscription: SubscriptionFlow, logger: FastifyBaseLogger) {
|
||||||
this.#db = db;
|
this.#db = db;
|
||||||
@@ -59,6 +96,50 @@ export class ReadDispatcher {
|
|||||||
return { accepted: false, reason: "reader not bound to a barrier (no relay to open)" };
|
return { accepted: false, reason: "reader not bound to a barrier (no relay to open)" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Same code, same reader, inside the window → replay the first verdict. Checked
|
||||||
|
// BEFORE matching so a repeat never reaches a flow (no second entry, no second exit,
|
||||||
|
// no refusal anomaly for a car that was just admitted).
|
||||||
|
const debounceMs = readDebounceMs(reader.config);
|
||||||
|
const key = `${e.deviceId}:${e.kind}:${e.value}`;
|
||||||
|
const now = Date.now();
|
||||||
|
const prev = this.#recent.get(key);
|
||||||
|
if (debounceMs > 0 && prev && now - prev.at < debounceMs) {
|
||||||
|
const sinceMs = now - prev.at;
|
||||||
|
prev.at = now;
|
||||||
|
this.#logger.info(
|
||||||
|
`read debounced: '${e.value}' (${e.kind}) again on ${e.deviceId} after ${sinceMs}ms (window ${debounceMs}ms) — first verdict replayed`,
|
||||||
|
);
|
||||||
|
prev.outcome.then(
|
||||||
|
(o) => this.#recordDebounced(e, sinceMs, debounceMs, o),
|
||||||
|
() => undefined, // the first decision failed: the caller gets that rejection, not us
|
||||||
|
);
|
||||||
|
return prev.outcome;
|
||||||
|
}
|
||||||
|
const outcome = this.#decide(resolved, e);
|
||||||
|
if (debounceMs > 0) {
|
||||||
|
this.#recent.set(key, { at: now, outcome });
|
||||||
|
// A failed decision is NOT a verdict to replay — forget it so the next read retries.
|
||||||
|
outcome.catch(() => this.#recent.delete(key));
|
||||||
|
this.#pruneRecent(now);
|
||||||
|
}
|
||||||
|
return outcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Keep the recent-reads map small: drop expired entries, and if a flood of distinct
|
||||||
|
* values inside one window still leaves it over the cap, drop the oldest. Bounded
|
||||||
|
* memory whatever a misbehaving (or hostile) reader sends. */
|
||||||
|
#pruneRecent(now: number): void {
|
||||||
|
if (this.#recent.size <= RECENT_READS_SOFT_CAP) return;
|
||||||
|
for (const [k, r] of this.#recent) if (now - r.at >= RECENT_READS_MAX_AGE_MS) this.#recent.delete(k);
|
||||||
|
while (this.#recent.size > RECENT_READS_HARD_CAP) {
|
||||||
|
const oldest = this.#recent.keys().next().value; // insertion order = oldest first
|
||||||
|
if (oldest === undefined) break;
|
||||||
|
this.#recent.delete(oldest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The actual routing of a FRESH read (not a debounced repeat). */
|
||||||
|
async #decide(resolved: ResolvedRelay, e: DeviceReadEvent): Promise<ReadOutcome> {
|
||||||
const sub = this.#subscription.match(e);
|
const sub = this.#subscription.match(e);
|
||||||
if (sub) {
|
if (sub) {
|
||||||
return this.#subscription.run(resolved, e, sub);
|
return this.#subscription.run(resolved, e, sub);
|
||||||
@@ -86,6 +167,34 @@ export class ReadDispatcher {
|
|||||||
return this.#exit.handleAt(resolved, e);
|
return this.#exit.handleAt(resolved, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Unsigned telemetry for a debounced repeat — auditable in device_events (the double
|
||||||
|
* read is still a fact about the hardware), out of the signed feed. */
|
||||||
|
#recordDebounced(e: DeviceReadEvent, sinceMs: number, debounceMs: number, replayed: ReadOutcome): void {
|
||||||
|
try {
|
||||||
|
this.#db
|
||||||
|
.insert(deviceEventsTable)
|
||||||
|
.values({
|
||||||
|
id: randomUUID(),
|
||||||
|
deviceId: e.deviceId,
|
||||||
|
category: "reader",
|
||||||
|
kind: "read",
|
||||||
|
detail: {
|
||||||
|
debounced: true,
|
||||||
|
value: e.value,
|
||||||
|
readKind: e.kind,
|
||||||
|
...(e.channel ? { channel: e.channel } : {}),
|
||||||
|
sinceMs,
|
||||||
|
debounceMs,
|
||||||
|
replayedAccepted: replayed.accepted,
|
||||||
|
},
|
||||||
|
occurredAt: e.at,
|
||||||
|
})
|
||||||
|
.run();
|
||||||
|
} catch (err) {
|
||||||
|
this.#logger.error(`debounced-read telemetry insert failed: ${(err as Error).message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Unsigned telemetry for a filtered read — auditable in device_events, out of the
|
/** Unsigned telemetry for a filtered read — auditable in device_events, out of the
|
||||||
* signed feed. Mirrors the entry flow's suppressed-press pattern. */
|
* signed feed. Mirrors the entry flow's suppressed-press pattern. */
|
||||||
#recordUnrecognized(e: DeviceReadEvent): void {
|
#recordUnrecognized(e: DeviceReadEvent): void {
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
import { createTestDb } from "@parking/db/testing";
|
||||||
|
import { devices, deviceEvents as deviceEventsTable, type Db, type DeviceRow } from "@parking/db";
|
||||||
|
import { pulseBarrier } from "./relay-pulse.js";
|
||||||
|
import type { FastifyBaseLogger } from "fastify";
|
||||||
|
|
||||||
|
const silentLogger = { info() {}, warn() {}, error() {}, debug() {} } as unknown as FastifyBaseLogger;
|
||||||
|
|
||||||
|
// Every barrier pulse — success or failure — must leave an UNSIGNED device_events row
|
||||||
|
// (kind "relay") naming the relay, the direction, the identity and who asked, so a
|
||||||
|
// "did the server open the barrier?" question is answerable from telemetry alone
|
||||||
|
// (park-2, 2026-10-09). A failure is recorded AND re-thrown (each flow keeps its own
|
||||||
|
// anomaly handling).
|
||||||
|
|
||||||
|
let db: Db;
|
||||||
|
let close: () => void;
|
||||||
|
let controller: DeviceRow;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
const t = createTestDb();
|
||||||
|
db = t.db;
|
||||||
|
close = t.close;
|
||||||
|
db.insert(devices)
|
||||||
|
.values({
|
||||||
|
id: "ctl-1",
|
||||||
|
category: "access",
|
||||||
|
driverId: "stub-access",
|
||||||
|
config: { relays: [{ relay: 2, direction: "exit" }] },
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
.run();
|
||||||
|
controller = db.select().from(devices).get()!;
|
||||||
|
});
|
||||||
|
afterEach(() => close());
|
||||||
|
|
||||||
|
function relayRows() {
|
||||||
|
return db
|
||||||
|
.select()
|
||||||
|
.from(deviceEventsTable)
|
||||||
|
.all()
|
||||||
|
.filter((r) => r.kind === "relay")
|
||||||
|
.map((r) => ({ deviceId: r.deviceId, category: r.category, detail: r.detail as Record<string, unknown> }));
|
||||||
|
}
|
||||||
|
|
||||||
|
describe("pulseBarrier", () => {
|
||||||
|
it("pulses the relay and records a successful relay event with the context", async () => {
|
||||||
|
const fired: number[] = [];
|
||||||
|
const access = { pulseOpen: async (door: number) => void fired.push(door) };
|
||||||
|
await pulseBarrier(db, silentLogger, access, { controller, relay: 2 }, {
|
||||||
|
direction: "exit",
|
||||||
|
identity: "forgiven:abc",
|
||||||
|
source: "booth",
|
||||||
|
operator: "admin",
|
||||||
|
});
|
||||||
|
expect(fired).toEqual([2]);
|
||||||
|
const rows = relayRows();
|
||||||
|
expect(rows).toHaveLength(1);
|
||||||
|
expect(rows[0].deviceId).toBe("ctl-1");
|
||||||
|
expect(rows[0].category).toBe("access");
|
||||||
|
expect(rows[0].detail).toMatchObject({
|
||||||
|
driverId: "stub-access",
|
||||||
|
relay: 2,
|
||||||
|
direction: "exit",
|
||||||
|
identity: "forgiven:abc",
|
||||||
|
source: "booth",
|
||||||
|
operator: "admin",
|
||||||
|
ok: true,
|
||||||
|
});
|
||||||
|
expect(typeof rows[0].detail.tookMs).toBe("number");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("records a failed pulse with the error, then re-throws it", async () => {
|
||||||
|
const access = {
|
||||||
|
pulseOpen: async () => {
|
||||||
|
throw new Error("timeout");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await expect(
|
||||||
|
pulseBarrier(db, silentLogger, access, { controller, relay: 2 }, { direction: "exit", identity: "T1", source: "ticket" }),
|
||||||
|
).rejects.toThrow("timeout");
|
||||||
|
const rows = relayRows();
|
||||||
|
expect(rows).toHaveLength(1);
|
||||||
|
expect(rows[0].detail).toMatchObject({ relay: 2, identity: "T1", source: "ticket", ok: false, error: "timeout" });
|
||||||
|
expect(rows[0].detail.operator).toBeUndefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
import { randomUUID } from "node:crypto";
|
||||||
|
import type { FastifyBaseLogger } from "fastify";
|
||||||
|
import { deviceEvents as deviceEventsTable, type Db, type DeviceRow } from "@parking/db";
|
||||||
|
import type { AccessControlDevice } from "@parking/devices";
|
||||||
|
import type { Direction } from "./device-resolve.js";
|
||||||
|
|
||||||
|
// The ONE place a barrier relay is pulsed from business logic. Every pulse is logged at
|
||||||
|
// info (relay, controller, who asked and for which identity) and echoed into the UNSIGNED
|
||||||
|
// device_events stream (kind "relay") whether it succeeded or failed — so "did the server
|
||||||
|
// open the barrier at 15:50?" is answerable from `docker logs` or the telemetry table
|
||||||
|
// without reading the ledger. The signed ledger stays the authority on WHY (the
|
||||||
|
// vehicle_entry/exit/anomaly is appended BEFORE the pulse); this is the device-side echo
|
||||||
|
// (wiki/concepts/device-events.md). Failures are recorded, then re-thrown so each flow keeps
|
||||||
|
// its own anomaly/result handling. park-2 2026-10-09: a "barrier opened by itself" claim
|
||||||
|
// took ledger + snapshots to settle because pulses were only logged when they failed.
|
||||||
|
|
||||||
|
export interface PulseContext {
|
||||||
|
/** The barrier's direction (the relay's configured event). */
|
||||||
|
readonly direction: Direction;
|
||||||
|
/** The session/ticket/card/ref the open is for (matches the signed event's identity). */
|
||||||
|
readonly identity: string;
|
||||||
|
/** Who asked: ticket | manual | booth | lpr | subscription | relay-test … (free-form). */
|
||||||
|
readonly source: string;
|
||||||
|
readonly operator?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function pulseBarrier(
|
||||||
|
db: Db,
|
||||||
|
logger: FastifyBaseLogger,
|
||||||
|
access: Pick<AccessControlDevice, "pulseOpen">,
|
||||||
|
target: { readonly controller: DeviceRow; readonly relay: number },
|
||||||
|
ctx: PulseContext,
|
||||||
|
): Promise<void> {
|
||||||
|
const { controller, relay } = target;
|
||||||
|
const who = ctx.operator ? ` by ${ctx.operator}` : "";
|
||||||
|
logger.info(
|
||||||
|
`relay pulse: ${ctx.direction} relay ${relay} on ${controller.driverId} ${controller.id} ← ${ctx.source} ${ctx.identity}${who}`,
|
||||||
|
);
|
||||||
|
const startedAt = Date.now();
|
||||||
|
const firedAt = new Date(startedAt).toISOString();
|
||||||
|
try {
|
||||||
|
await access.pulseOpen(relay);
|
||||||
|
record(db, logger, controller, relay, ctx, firedAt, { ok: true, tookMs: Date.now() - startedAt });
|
||||||
|
} catch (err) {
|
||||||
|
const error = (err as Error).message;
|
||||||
|
logger.error(`relay pulse FAILED: ${ctx.direction} relay ${relay} on ${controller.id} for ${ctx.identity}: ${error}`);
|
||||||
|
record(db, logger, controller, relay, ctx, firedAt, { ok: false, error, tookMs: Date.now() - startedAt });
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function record(
|
||||||
|
db: Db,
|
||||||
|
logger: FastifyBaseLogger,
|
||||||
|
controller: DeviceRow,
|
||||||
|
relay: number,
|
||||||
|
ctx: PulseContext,
|
||||||
|
firedAt: string,
|
||||||
|
outcome: { ok: boolean; error?: string; tookMs: number },
|
||||||
|
): void {
|
||||||
|
// Telemetry must never block or fail the open — swallow insert errors (logged).
|
||||||
|
try {
|
||||||
|
db.insert(deviceEventsTable)
|
||||||
|
.values({
|
||||||
|
id: randomUUID(),
|
||||||
|
deviceId: controller.id,
|
||||||
|
category: "access",
|
||||||
|
kind: "relay",
|
||||||
|
detail: {
|
||||||
|
driverId: controller.driverId,
|
||||||
|
relay,
|
||||||
|
direction: ctx.direction,
|
||||||
|
identity: ctx.identity,
|
||||||
|
source: ctx.source,
|
||||||
|
...(ctx.operator ? { operator: ctx.operator } : {}),
|
||||||
|
...outcome,
|
||||||
|
},
|
||||||
|
occurredAt: firedAt,
|
||||||
|
})
|
||||||
|
.run();
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(`relay pulse telemetry insert failed: ${(err as Error).message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,6 +37,24 @@ interface FontScaleBody {
|
|||||||
fontScale: number;
|
fontScale: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Booth camera tiles the user left open (camera device ids, in opening order). Bounded:
|
||||||
|
// a booth has a handful of cameras; the cap stops a client from storing junk.
|
||||||
|
const OPEN_CAMERAS_MAX = 8;
|
||||||
|
const DEVICE_ID_MAX = 64;
|
||||||
|
interface OpenCamerasBody {
|
||||||
|
openCameras: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** users.open_cameras (JSON text) → string[]; anything malformed reads as none open. */
|
||||||
|
function parseOpenCameras(raw: string | null | undefined): string[] {
|
||||||
|
try {
|
||||||
|
const v: unknown = JSON.parse(raw ?? "[]");
|
||||||
|
return Array.isArray(v) ? v.filter((x): x is string => typeof x === "string").slice(0, OPEN_CAMERAS_MAX) : [];
|
||||||
|
} catch {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Self-service profile: a signed-in user edits their OWN display name + email. This is
|
// Self-service profile: a signed-in user edits their OWN display name + email. This is
|
||||||
// NOT the admin user-management path (routes/users.ts) — it only ever touches the caller
|
// NOT the admin user-management path (routes/users.ts) — it only ever touches the caller
|
||||||
// (req.user.sub), needs no `user:*` permission, and can't change username, role, or any
|
// (req.user.sub), needs no `user:*` permission, and can't change username, role, or any
|
||||||
@@ -90,6 +108,7 @@ function sessionView(
|
|||||||
language: string;
|
language: string;
|
||||||
theme: string;
|
theme: string;
|
||||||
fontScale: number;
|
fontScale: number;
|
||||||
|
openCameras?: string | null;
|
||||||
fullName?: string | null;
|
fullName?: string | null;
|
||||||
email?: string | null;
|
email?: string | null;
|
||||||
},
|
},
|
||||||
@@ -106,6 +125,7 @@ function sessionView(
|
|||||||
language: user.language,
|
language: user.language,
|
||||||
theme: user.theme,
|
theme: user.theme,
|
||||||
fontScale: user.fontScale,
|
fontScale: user.fontScale,
|
||||||
|
openCameras: parseOpenCameras(user.openCameras),
|
||||||
fullName: user.fullName ?? null,
|
fullName: user.fullName ?? null,
|
||||||
email: user.email ?? null,
|
email: user.email ?? null,
|
||||||
// Effective venue modules (entitled ∩ activated) so the SPA can hide nav/routes
|
// Effective venue modules (entitled ∩ activated) so the SPA can hide nav/routes
|
||||||
@@ -219,6 +239,33 @@ export async function authRoutes(app: FastifyInstance, db: Db): Promise<void> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Which booth camera tiles I left open (any signed-in user; only touches the caller).
|
||||||
|
// Persisted like `theme`, restored on the next login from any booth. Ids are not
|
||||||
|
// checked against `devices`: a removed camera's tile is simply not rendered.
|
||||||
|
app.put<{ Body: OpenCamerasBody }>(
|
||||||
|
"/api/auth/open-cameras",
|
||||||
|
{ preHandler: requireAuth },
|
||||||
|
async (req, reply) => {
|
||||||
|
const raw = req.body?.openCameras;
|
||||||
|
if (
|
||||||
|
!Array.isArray(raw) ||
|
||||||
|
raw.length > OPEN_CAMERAS_MAX ||
|
||||||
|
!raw.every((x) => typeof x === "string" && x.length > 0 && x.length <= DEVICE_ID_MAX)
|
||||||
|
) {
|
||||||
|
return reply
|
||||||
|
.code(400)
|
||||||
|
.send({ error: `openCameras must be up to ${OPEN_CAMERAS_MAX} device ids` });
|
||||||
|
}
|
||||||
|
const openCameras = [...new Set(raw as string[])];
|
||||||
|
await db
|
||||||
|
.update(users)
|
||||||
|
.set({ openCameras: JSON.stringify(openCameras) })
|
||||||
|
.where(eq(users.id, req.user.sub))
|
||||||
|
.run();
|
||||||
|
return { openCameras };
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// Edit MY own display name / email (any signed-in user; no permission needed — it only
|
// Edit MY own display name / email (any signed-in user; no permission needed — it only
|
||||||
// touches the caller). Cannot change username or role — those stay admin-only (users.ts).
|
// touches the caller). Cannot change username or role — those stay admin-only (users.ts).
|
||||||
app.put<{ Body: ProfileBody }>(
|
app.put<{ Body: ProfileBody }>(
|
||||||
|
|||||||
@@ -0,0 +1,186 @@
|
|||||||
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
import { devices, snapshots, type Db } from "@parking/db";
|
||||||
|
import { createTestDb } from "@parking/db/testing";
|
||||||
|
import type { FastifyInstance } from "fastify";
|
||||||
|
import { buildServer } from "../server.js";
|
||||||
|
import { login, seedUser } from "../test-helpers.js";
|
||||||
|
|
||||||
|
// Booth camera tiles: latest-snapshot lookup (session:read), the live socket's auth gate
|
||||||
|
// (same handshake as /api/ws, then device:read), and the per-user open-tiles preference.
|
||||||
|
|
||||||
|
let db: Db;
|
||||||
|
let close: () => void;
|
||||||
|
let app: FastifyInstance;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const t = createTestDb();
|
||||||
|
db = t.db;
|
||||||
|
close = t.close;
|
||||||
|
app = await buildServer({ db });
|
||||||
|
await app.ready();
|
||||||
|
// A Dahua camera: no live-view capability, so the socket answers without any network.
|
||||||
|
db.insert(devices)
|
||||||
|
.values({ id: "cam-dahua", category: "camera", driverId: "dahua", config: { host: "192.0.2.1" } })
|
||||||
|
.run();
|
||||||
|
db.insert(devices).values({ id: "relay-1", category: "access", driverId: "stub-access", config: {} }).run();
|
||||||
|
});
|
||||||
|
afterEach(async () => {
|
||||||
|
await app.close();
|
||||||
|
close();
|
||||||
|
});
|
||||||
|
|
||||||
|
function shot(id: string, deviceId: string, capturedAt: string) {
|
||||||
|
db.insert(snapshots)
|
||||||
|
.values({ id, direction: "entry", deviceId, identity: "x", contentType: "image/jpeg", bytes: Buffer.from([1]), capturedAt })
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
describe("GET /api/cameras/:id/latest-snapshot", () => {
|
||||||
|
it("returns the camera's newest snapshot", async () => {
|
||||||
|
await seedUser(db, { username: "admin", password: "pw" });
|
||||||
|
const auth = await login(app, "admin", "pw");
|
||||||
|
shot("s1", "cam-dahua", "2026-11-17T10:00:00.000Z");
|
||||||
|
shot("s2", "cam-dahua", "2026-11-17T11:00:00.000Z");
|
||||||
|
shot("s3", "other", "2026-11-17T12:00:00.000Z");
|
||||||
|
const res = await app.inject({ url: "/api/cameras/cam-dahua/latest-snapshot", headers: { cookie: auth.cookie } });
|
||||||
|
expect(res.statusCode).toBe(200);
|
||||||
|
expect(res.json()).toMatchObject({ id: "s2", direction: "entry" });
|
||||||
|
});
|
||||||
|
|
||||||
|
it("404s when the camera has none, 403s without session:read", async () => {
|
||||||
|
await seedUser(db, { username: "admin", password: "pw" });
|
||||||
|
const admin = await login(app, "admin", "pw");
|
||||||
|
const none = await app.inject({ url: "/api/cameras/cam-dahua/latest-snapshot", headers: { cookie: admin.cookie } });
|
||||||
|
expect(none.statusCode).toBe(404);
|
||||||
|
|
||||||
|
await seedUser(db, { username: "dev", password: "pw", roleId: "devonly", permissions: ["device:read"] });
|
||||||
|
const dev = await login(app, "dev", "pw");
|
||||||
|
const res = await app.inject({ url: "/api/cameras/cam-dahua/latest-snapshot", headers: { cookie: dev.cookie } });
|
||||||
|
expect(res.statusCode).toBe(403);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("GET /api/cameras/:id/snapshots/:snapshotId/neighbors", () => {
|
||||||
|
const url = (cam: string, id: string) => `/api/cameras/${cam}/snapshots/${id}/neighbors`;
|
||||||
|
|
||||||
|
it("steps through one camera's snapshots by time, ties broken by id", async () => {
|
||||||
|
await seedUser(db, { username: "admin", password: "pw" });
|
||||||
|
const { cookie } = await login(app, "admin", "pw");
|
||||||
|
shot("a", "cam-dahua", "2026-11-17T10:00:00.000Z");
|
||||||
|
shot("b", "cam-dahua", "2026-11-17T11:00:00.000Z");
|
||||||
|
shot("c", "cam-dahua", "2026-11-17T11:00:00.000Z"); // same instant as b
|
||||||
|
shot("d", "cam-dahua", "2026-11-17T12:00:00.000Z");
|
||||||
|
shot("x", "other", "2026-11-17T11:30:00.000Z"); // another camera: never a neighbour
|
||||||
|
const get = async (id: string) => (await app.inject({ url: url("cam-dahua", id), headers: { cookie } })).json();
|
||||||
|
const ids = (r: { older: { id: string } | null; newer: { id: string } | null }) => [r.older?.id ?? null, r.newer?.id ?? null];
|
||||||
|
expect(ids(await get("a"))).toEqual([null, "b"]);
|
||||||
|
expect(ids(await get("b"))).toEqual(["a", "c"]);
|
||||||
|
expect(ids(await get("c"))).toEqual(["b", "d"]);
|
||||||
|
expect(ids(await get("d"))).toEqual(["c", null]);
|
||||||
|
expect(await get("b")).toMatchObject({ older: { id: "a", direction: "entry", capturedAt: "2026-11-17T10:00:00.000Z" } });
|
||||||
|
// latest-snapshot uses the same tie-break, so "newer" is never offered from the latest
|
||||||
|
const latest = await app.inject({ url: "/api/cameras/cam-dahua/latest-snapshot", headers: { cookie } });
|
||||||
|
expect(latest.json().id).toBe("d");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("a tie at the newest end: latest-snapshot is the one with no newer", async () => {
|
||||||
|
await seedUser(db, { username: "admin", password: "pw" });
|
||||||
|
const { cookie } = await login(app, "admin", "pw");
|
||||||
|
shot("p", "cam-dahua", "2026-11-17T10:00:00.000Z");
|
||||||
|
shot("q", "cam-dahua", "2026-11-17T12:00:00.000Z");
|
||||||
|
shot("r", "cam-dahua", "2026-11-17T12:00:00.000Z");
|
||||||
|
const latest = (await app.inject({ url: "/api/cameras/cam-dahua/latest-snapshot", headers: { cookie } })).json();
|
||||||
|
const n = (await app.inject({ url: url("cam-dahua", latest.id), headers: { cookie } })).json();
|
||||||
|
expect(latest.id).toBe("r");
|
||||||
|
expect(n).toMatchObject({ older: { id: "q" }, newer: null });
|
||||||
|
});
|
||||||
|
|
||||||
|
it("404s another camera's snapshot, 403s without session:read", async () => {
|
||||||
|
await seedUser(db, { username: "admin", password: "pw" });
|
||||||
|
const admin = await login(app, "admin", "pw");
|
||||||
|
shot("x", "other", "2026-11-17T11:30:00.000Z");
|
||||||
|
const foreign = await app.inject({ url: url("cam-dahua", "x"), headers: { cookie: admin.cookie } });
|
||||||
|
expect(foreign.statusCode).toBe(404);
|
||||||
|
|
||||||
|
await seedUser(db, { username: "dev", password: "pw", roleId: "devonly", permissions: ["device:read"] });
|
||||||
|
const dev = await login(app, "dev", "pw");
|
||||||
|
const res = await app.inject({ url: url("other", "x"), headers: { cookie: dev.cookie } });
|
||||||
|
expect(res.statusCode).toBe(403);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("WS /api/cameras/:id/live", () => {
|
||||||
|
const origin = "http://booth.local:8080";
|
||||||
|
|
||||||
|
it("rejects a cross-origin handshake", async () => {
|
||||||
|
await seedUser(db, { username: "admin", password: "pw" });
|
||||||
|
const auth = await login(app, "admin", "pw");
|
||||||
|
await expect(
|
||||||
|
app.injectWS("/api/cameras/cam-dahua/live", { headers: { cookie: auth.cookie, origin: "http://evil.example", host: "booth.local:8080" } }),
|
||||||
|
).rejects.toThrow(/403/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects a role without device:read", async () => {
|
||||||
|
await seedUser(db, { username: "cash", password: "pw", roleId: "cashier2", permissions: ["session:read"] });
|
||||||
|
const auth = await login(app, "cash", "pw");
|
||||||
|
await expect(
|
||||||
|
app.injectWS("/api/cameras/cam-dahua/live", { headers: { cookie: auth.cookie, origin, host: "booth.local:8080" } }),
|
||||||
|
).rejects.toThrow(/403/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("404s a device that is not a camera", async () => {
|
||||||
|
await seedUser(db, { username: "admin", password: "pw" });
|
||||||
|
const auth = await login(app, "admin", "pw");
|
||||||
|
await expect(
|
||||||
|
app.injectWS("/api/cameras/relay-1/live", { headers: { cookie: auth.cookie, origin, host: "booth.local:8080" } }),
|
||||||
|
).rejects.toThrow(/404/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("tells the viewer when the camera has no live view", async () => {
|
||||||
|
await seedUser(db, { username: "admin", password: "pw" });
|
||||||
|
const auth = await login(app, "admin", "pw");
|
||||||
|
let resolveMsg!: (m: string) => void;
|
||||||
|
const first = new Promise<string>((r) => (resolveMsg = r));
|
||||||
|
const ws = await app.injectWS(
|
||||||
|
"/api/cameras/cam-dahua/live",
|
||||||
|
{ headers: { cookie: auth.cookie, origin, host: "booth.local:8080" } },
|
||||||
|
{ onInit: (sock) => sock.once("message", (d) => resolveMsg(String(d))) },
|
||||||
|
);
|
||||||
|
const msg = await first;
|
||||||
|
expect(JSON.parse(msg)).toEqual({
|
||||||
|
kind: "status",
|
||||||
|
state: "unavailable",
|
||||||
|
reason: "live view not supported by this camera driver",
|
||||||
|
});
|
||||||
|
ws.terminate();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("PUT /api/auth/open-cameras", () => {
|
||||||
|
it("persists the open tiles and returns them on /me", async () => {
|
||||||
|
await seedUser(db, { username: "admin", password: "pw" });
|
||||||
|
const auth = await login(app, "admin", "pw");
|
||||||
|
const put = await app.inject({
|
||||||
|
method: "PUT",
|
||||||
|
url: "/api/auth/open-cameras",
|
||||||
|
headers: { cookie: auth.cookie, "x-csrf-token": auth.csrf },
|
||||||
|
payload: { openCameras: ["cam-b", "cam-a", "cam-b"] },
|
||||||
|
});
|
||||||
|
expect(put.statusCode).toBe(200);
|
||||||
|
expect(put.json()).toEqual({ openCameras: ["cam-b", "cam-a"] });
|
||||||
|
const me = await app.inject({ url: "/api/auth/me", headers: { cookie: auth.cookie } });
|
||||||
|
expect(me.json().openCameras).toEqual(["cam-b", "cam-a"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects a malformed list", async () => {
|
||||||
|
await seedUser(db, { username: "admin", password: "pw" });
|
||||||
|
const auth = await login(app, "admin", "pw");
|
||||||
|
const res = await app.inject({
|
||||||
|
method: "PUT",
|
||||||
|
url: "/api/auth/open-cameras",
|
||||||
|
headers: { cookie: auth.cookie, "x-csrf-token": auth.csrf },
|
||||||
|
payload: { openCameras: Array.from({ length: 9 }, (_, i) => `c${i}`) },
|
||||||
|
});
|
||||||
|
expect(res.statusCode).toBe(400);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
import type { FastifyInstance } from "fastify";
|
||||||
|
import { and, asc, desc, devices, eq, gt, gte, lt, lte, or, snapshots, type Db } from "@parking/db";
|
||||||
|
import { isLiveStreamDevice } from "@parking/devices";
|
||||||
|
import { requirePermission, roleHasPermissions } from "../auth.js";
|
||||||
|
import { buildCamera } from "../snapshot.js";
|
||||||
|
import type { CameraLiveHub, LiveResolver, LiveStatus } from "../camera-live.js";
|
||||||
|
import { authenticateWsHandshake } from "./ws.js";
|
||||||
|
|
||||||
|
// The booth's camera tiles (wiki/decisions/camera-live-view.md):
|
||||||
|
// - GET /api/cameras/:deviceId/latest-snapshot — the tile's default picture: the newest
|
||||||
|
// entry/exit evidence still this camera captured (metadata; bytes stay at
|
||||||
|
// /api/snapshots/:id). Evidence → `session:read`, like every snapshot read.
|
||||||
|
// - GET /api/cameras/:deviceId/snapshots/:snapshotId/neighbors — the large view's ‹ ›:
|
||||||
|
// this camera's next older and next newer snapshot ({ older, newer }, each meta or
|
||||||
|
// null). Same permission. Order is (capturedAt, id) everywhere so ties are stable.
|
||||||
|
// - WS /api/cameras/:deviceId/live — live video while the camera sees a vehicle.
|
||||||
|
// Same handshake auth as /api/ws (Origin allowlist, then desktop ticket or cookie),
|
||||||
|
// then `device:read` (the footer's permission). Server → client: text JSON
|
||||||
|
// `{kind:"status", ...LiveStatus}` and binary messages, each one complete JPEG.
|
||||||
|
// Advisory viewing only: no route here writes anything.
|
||||||
|
|
||||||
|
/** Bytes a viewer's socket may hold unsent before frames are skipped for it. */
|
||||||
|
const MAX_BUFFERED_BYTES = 256 * 1024;
|
||||||
|
|
||||||
|
/** Resolve a camera id to its live capability, or the reason it has none. */
|
||||||
|
export function liveResolverFor(db: Db): LiveResolver {
|
||||||
|
return (deviceId) => {
|
||||||
|
const row = db.select().from(devices).where(eq(devices.id, deviceId)).get();
|
||||||
|
if (!row || row.category !== "camera") return "unknown camera";
|
||||||
|
if (!row.enabled) return "camera disabled";
|
||||||
|
const camera = buildCamera(row);
|
||||||
|
if (!camera) return "camera driver unavailable";
|
||||||
|
if (!isLiveStreamDevice(camera)) return "live view not supported by this camera driver";
|
||||||
|
return camera;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function cameraRoutes(app: FastifyInstance, db: Db, hub: CameraLiveHub): Promise<void> {
|
||||||
|
app.get<{ Params: { deviceId: string } }>(
|
||||||
|
"/api/cameras/:deviceId/latest-snapshot",
|
||||||
|
{ preHandler: requirePermission("session:read") },
|
||||||
|
async (req, reply) => {
|
||||||
|
// Uses snapshots_device_time_idx (migration 0033): one index seek, not a scan.
|
||||||
|
const row = db
|
||||||
|
.select({ id: snapshots.id, direction: snapshots.direction, capturedAt: snapshots.capturedAt })
|
||||||
|
.from(snapshots)
|
||||||
|
.where(eq(snapshots.deviceId, req.params.deviceId))
|
||||||
|
.orderBy(desc(snapshots.capturedAt), desc(snapshots.id))
|
||||||
|
.limit(1)
|
||||||
|
.get();
|
||||||
|
if (!row) return reply.code(404).send({ error: "no snapshot for this camera yet" });
|
||||||
|
return row;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
app.get<{ Params: { deviceId: string; snapshotId: string } }>(
|
||||||
|
"/api/cameras/:deviceId/snapshots/:snapshotId/neighbors",
|
||||||
|
{ preHandler: requirePermission("session:read") },
|
||||||
|
async (req, reply) => {
|
||||||
|
const { deviceId, snapshotId } = req.params;
|
||||||
|
const at = db
|
||||||
|
.select({ capturedAt: snapshots.capturedAt })
|
||||||
|
.from(snapshots)
|
||||||
|
.where(and(eq(snapshots.id, snapshotId), eq(snapshots.deviceId, deviceId)))
|
||||||
|
.get();
|
||||||
|
if (!at) return reply.code(404).send({ error: "no such snapshot for this camera" });
|
||||||
|
const meta = { id: snapshots.id, direction: snapshots.direction, capturedAt: snapshots.capturedAt };
|
||||||
|
// capturedAt is always toISOString() (UTC, fixed width), so string order = time order.
|
||||||
|
// The plain lte/gte bound next to the OR lets SQLite seek snapshots_device_time_idx
|
||||||
|
// from this snapshot instead of walking the camera's index from one end.
|
||||||
|
const older = db
|
||||||
|
.select(meta)
|
||||||
|
.from(snapshots)
|
||||||
|
.where(
|
||||||
|
and(
|
||||||
|
eq(snapshots.deviceId, deviceId),
|
||||||
|
lte(snapshots.capturedAt, at.capturedAt),
|
||||||
|
or(lt(snapshots.capturedAt, at.capturedAt), and(eq(snapshots.capturedAt, at.capturedAt), lt(snapshots.id, snapshotId))),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.orderBy(desc(snapshots.capturedAt), desc(snapshots.id))
|
||||||
|
.limit(1)
|
||||||
|
.get();
|
||||||
|
const newer = db
|
||||||
|
.select(meta)
|
||||||
|
.from(snapshots)
|
||||||
|
.where(
|
||||||
|
and(
|
||||||
|
eq(snapshots.deviceId, deviceId),
|
||||||
|
gte(snapshots.capturedAt, at.capturedAt),
|
||||||
|
or(gt(snapshots.capturedAt, at.capturedAt), and(eq(snapshots.capturedAt, at.capturedAt), gt(snapshots.id, snapshotId))),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.orderBy(asc(snapshots.capturedAt), asc(snapshots.id))
|
||||||
|
.limit(1)
|
||||||
|
.get();
|
||||||
|
return { older: older ?? null, newer: newer ?? null };
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
app.get<{ Params: { deviceId: string } }>(
|
||||||
|
"/api/cameras/:deviceId/live",
|
||||||
|
{
|
||||||
|
websocket: true,
|
||||||
|
preHandler: async (req) => {
|
||||||
|
const roleId = await authenticateWsHandshake(req);
|
||||||
|
if (!roleHasPermissions(roleId, ["device:read"])) {
|
||||||
|
throw Object.assign(new Error("forbidden"), { statusCode: 403 });
|
||||||
|
}
|
||||||
|
const row = db.select({ category: devices.category }).from(devices).where(eq(devices.id, req.params.deviceId)).get();
|
||||||
|
if (!row || row.category !== "camera") {
|
||||||
|
throw Object.assign(new Error("unknown camera"), { statusCode: 404 });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
(socket, req) => {
|
||||||
|
const open = () => socket.readyState === 1;
|
||||||
|
const unsubscribe = hub.subscribe(req.params.deviceId, {
|
||||||
|
sendFrame: (jpeg) => {
|
||||||
|
if (open()) socket.send(jpeg, { binary: true });
|
||||||
|
},
|
||||||
|
sendStatus: (status: LiveStatus) => {
|
||||||
|
if (open()) socket.send(JSON.stringify({ kind: "status", ...status }));
|
||||||
|
},
|
||||||
|
busy: () => !open() || socket.bufferedAmount > MAX_BUFFERED_BYTES,
|
||||||
|
});
|
||||||
|
socket.on("close", unsubscribe);
|
||||||
|
socket.on("error", unsubscribe);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import type { FastifyInstance } from "fastify";
|
|||||||
import { buildServer } from "../server.js";
|
import { buildServer } from "../server.js";
|
||||||
import { hikvisionAlarmRoutes } from "./hikvision-alarm.js";
|
import { hikvisionAlarmRoutes } from "./hikvision-alarm.js";
|
||||||
import type { AnprBridge } from "../anpr-entry.js";
|
import type { AnprBridge } from "../anpr-entry.js";
|
||||||
|
import type { CameraActivity } from "../camera-activity.js";
|
||||||
import { seedUser, login } from "../test-helpers.js";
|
import { seedUser, login } from "../test-helpers.js";
|
||||||
|
|
||||||
// Hikvision Alarm Server push ingress. Verifies the discovery endpoint: a vehicle-
|
// Hikvision Alarm Server push ingress. Verifies the discovery endpoint: a vehicle-
|
||||||
@@ -235,6 +236,7 @@ describe("Hikvision Alarm Server → ANPR bridge wiring", () => {
|
|||||||
let rawDb: Db;
|
let rawDb: Db;
|
||||||
let rawClose: () => void;
|
let rawClose: () => void;
|
||||||
let onVehicleDetected: ReturnType<typeof vi.fn>;
|
let onVehicleDetected: ReturnType<typeof vi.fn>;
|
||||||
|
let cameraSaw: ReturnType<typeof vi.fn>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const t = createTestDb();
|
const t = createTestDb();
|
||||||
@@ -243,7 +245,9 @@ describe("Hikvision Alarm Server → ANPR bridge wiring", () => {
|
|||||||
onVehicleDetected = vi.fn(async () => {});
|
onVehicleDetected = vi.fn(async () => {});
|
||||||
const bridge = { onVehicleDetected } as unknown as AnprBridge;
|
const bridge = { onVehicleDetected } as unknown as AnprBridge;
|
||||||
rawApp = Fastify();
|
rawApp = Fastify();
|
||||||
await hikvisionAlarmRoutes(rawApp, rawDb, undefined, bridge);
|
cameraSaw = vi.fn();
|
||||||
|
const activity = { vehicleDetected: cameraSaw } as unknown as CameraActivity;
|
||||||
|
await hikvisionAlarmRoutes(rawApp, rawDb, undefined, bridge, activity);
|
||||||
await rawApp.ready();
|
await rawApp.ready();
|
||||||
rawDb.insert(devices).values({
|
rawDb.insert(devices).values({
|
||||||
id: CAM_ID,
|
id: CAM_ID,
|
||||||
@@ -275,10 +279,16 @@ describe("Hikvision Alarm Server → ANPR bridge wiring", () => {
|
|||||||
expect(onVehicleDetected).toHaveBeenCalledWith(CAM_ID);
|
expect(onVehicleDetected).toHaveBeenCalledWith(CAM_ID);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("marks THIS camera active for the booth camera tile", async () => {
|
||||||
|
await post(VEHICLE_XML);
|
||||||
|
expect(cameraSaw).toHaveBeenCalledWith(CAM_ID);
|
||||||
|
});
|
||||||
|
|
||||||
it("does NOT call the bridge for a human target", async () => {
|
it("does NOT call the bridge for a human target", async () => {
|
||||||
const human = VEHICLE_XML.replace("vehicle", "human");
|
const human = VEHICLE_XML.replace("vehicle", "human");
|
||||||
await post(human);
|
await post(human);
|
||||||
expect(onVehicleDetected).not.toHaveBeenCalled();
|
expect(onVehicleDetected).not.toHaveBeenCalled();
|
||||||
|
expect(cameraSaw).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does NOT call the bridge on an `inactive` (leave) vehicle event", async () => {
|
it("does NOT call the bridge on an `inactive` (leave) vehicle event", async () => {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { requirePermission } from "../auth.js";
|
|||||||
import { verifyDigest } from "../digest-auth.js";
|
import { verifyDigest } from "../digest-auth.js";
|
||||||
import type { LaneStatus } from "../lane-status.js";
|
import type { LaneStatus } from "../lane-status.js";
|
||||||
import type { AnprBridge } from "../anpr-entry.js";
|
import type { AnprBridge } from "../anpr-entry.js";
|
||||||
|
import type { CameraActivity } from "../camera-activity.js";
|
||||||
|
|
||||||
// Hikvision "Alarm Server" event PUSH ingress. The newer-firmware cameras (Event →
|
// Hikvision "Alarm Server" event PUSH ingress. The newer-firmware cameras (Event →
|
||||||
// Smart/VCA with "Detection Target: Human/Vehicle", Notify Surveillance Center, Alarm
|
// Smart/VCA with "Detection Target: Human/Vehicle", Notify Surveillance Center, Alarm
|
||||||
@@ -101,6 +102,7 @@ export async function hikvisionAlarmRoutes(
|
|||||||
db: Db,
|
db: Db,
|
||||||
laneStatus?: LaneStatus,
|
laneStatus?: LaneStatus,
|
||||||
anprBridge?: AnprBridge,
|
anprBridge?: AnprBridge,
|
||||||
|
cameraActivity?: CameraActivity,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// Accept ANY content-type as a raw Buffer (the camera may POST application/xml,
|
// Accept ANY content-type as a raw Buffer (the camera may POST application/xml,
|
||||||
// multipart/form-data with a JPEG, or text). Fastify's default JSON parser would 415
|
// multipart/form-data with a JPEG, or text). Fastify's default JSON parser would 415
|
||||||
@@ -213,6 +215,10 @@ export async function hikvisionAlarmRoutes(
|
|||||||
if (laneStatus && isVehicleActive) {
|
if (laneStatus && isVehicleActive) {
|
||||||
laneStatus.vehicleDetected(deviceId);
|
laneStatus.vehicleDetected(deviceId);
|
||||||
}
|
}
|
||||||
|
// The same signal per camera: the booth's tile for THIS camera switches to live video.
|
||||||
|
if (cameraActivity && isVehicleActive) {
|
||||||
|
cameraActivity.vehicleDetected(deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
// ANPR BRIDGE: on a vehicle detection, if this camera opts into ANPR (config.anpr),
|
// ANPR BRIDGE: on a vehicle detection, if this camera opts into ANPR (config.anpr),
|
||||||
// pull a snapshot → read the plate → if it matches a SUBSCRIBER, emit a plate read
|
// pull a snapshot → read the plate → if it matches a SUBSCRIBER, emit a plate read
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
import { devices, eq, type Db } from "@parking/db";
|
||||||
|
import { createTestDb } from "@parking/db/testing";
|
||||||
|
import type { FastifyInstance } from "fastify";
|
||||||
|
import { buildServer } from "../server.js";
|
||||||
|
import { seedUser, login } from "../test-helpers.js";
|
||||||
|
|
||||||
|
// A camera's crossing line (passage confirmation) rides in its config as `crossing`. The
|
||||||
|
// save validates it (the driver never reads it), and since an edit MERGES onto the stored
|
||||||
|
// config, clearing it must be an explicit `null`.
|
||||||
|
|
||||||
|
let db: Db;
|
||||||
|
let close: () => void;
|
||||||
|
let app: FastifyInstance;
|
||||||
|
const CAM = "cam-1";
|
||||||
|
const line = { p1: { x: 0.1, y: 0.6 }, p2: { x: 0.9, y: 0.55 }, direction: "a-to-b" };
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
({ db, close } = createTestDb());
|
||||||
|
db.insert(devices).values({
|
||||||
|
id: CAM,
|
||||||
|
category: "camera",
|
||||||
|
driverId: "dahua",
|
||||||
|
config: { host: "127.0.0.1", port: 80, username: "u", password: "p" },
|
||||||
|
enabled: true,
|
||||||
|
}).run();
|
||||||
|
app = await buildServer({ db });
|
||||||
|
await app.ready();
|
||||||
|
auth = undefined;
|
||||||
|
});
|
||||||
|
afterEach(async () => {
|
||||||
|
await app.close();
|
||||||
|
close();
|
||||||
|
});
|
||||||
|
|
||||||
|
let auth: { cookie: string; csrf: string } | undefined;
|
||||||
|
async function edit(config: Record<string, unknown>) {
|
||||||
|
if (!auth) {
|
||||||
|
await seedUser(db, { username: "admin", password: "pw" });
|
||||||
|
auth = await login(app, "admin", "pw");
|
||||||
|
}
|
||||||
|
return app.inject({
|
||||||
|
method: "PATCH",
|
||||||
|
url: `/api/setup/assign/${CAM}`,
|
||||||
|
headers: { cookie: auth.cookie, "x-csrf-token": auth.csrf },
|
||||||
|
payload: { config: { host: "127.0.0.1", port: 80, username: "u", password: "p", ...config } },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const stored = () => db.select().from(devices).where(eq(devices.id, CAM)).get()!.config as Record<string, unknown>;
|
||||||
|
|
||||||
|
describe("camera crossing line on save", () => {
|
||||||
|
it("stores a valid line", async () => {
|
||||||
|
const res = await edit({ crossing: line });
|
||||||
|
expect(res.statusCode).toBe(200);
|
||||||
|
expect(stored().crossing).toEqual(line);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("keeps the stored line when the edit doesn't mention it, and clears it on null", async () => {
|
||||||
|
await edit({ crossing: line });
|
||||||
|
await edit({});
|
||||||
|
expect(stored().crossing).toEqual(line);
|
||||||
|
const res = await edit({ crossing: null });
|
||||||
|
expect(res.statusCode).toBe(200);
|
||||||
|
expect(stored()).not.toHaveProperty("crossing");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects an invalid line and leaves the stored config alone", async () => {
|
||||||
|
const res = await edit({ crossing: { ...line, p2: { x: 1.4, y: 0.5 } } });
|
||||||
|
expect(res.statusCode).toBe(400);
|
||||||
|
expect(stored()).not.toHaveProperty("crossing");
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { randomBytes, randomUUID } from "node:crypto";
|
import { randomBytes, randomUUID } from "node:crypto";
|
||||||
import type { FastifyInstance } from "fastify";
|
import type { FastifyInstance } from "fastify";
|
||||||
import { eq, devices, setupState, type Db } from "@parking/db";
|
import { eq, devices, setupState, type Db } from "@parking/db";
|
||||||
|
import { pulseBarrier } from "../relay-pulse.js";
|
||||||
import {
|
import {
|
||||||
hasPreconditions,
|
hasPreconditions,
|
||||||
hasPushConfig,
|
hasPushConfig,
|
||||||
@@ -15,7 +16,7 @@ import {
|
|||||||
type DeviceCategory,
|
type DeviceCategory,
|
||||||
type DeviceConfig,
|
type DeviceConfig,
|
||||||
} from "@parking/devices";
|
} from "@parking/devices";
|
||||||
import { reasonPayload } from "@parking/shared";
|
import { parseCrossingLine, reasonPayload } from "@parking/shared";
|
||||||
import { requirePermission } from "../auth.js";
|
import { requirePermission } from "../auth.js";
|
||||||
import type { EventLog } from "../event-log.js";
|
import type { EventLog } from "../event-log.js";
|
||||||
import { backendIpCandidates, backendIpForDevice, backendPort } from "../net.js";
|
import { backendIpCandidates, backendIpForDevice, backendPort } from "../net.js";
|
||||||
@@ -146,6 +147,17 @@ async function configureDevice(
|
|||||||
// webPasswordCurrent is an input-only credential (the OLD password used to
|
// webPasswordCurrent is an input-only credential (the OLD password used to
|
||||||
// authorize the change) — never persist it as typed.
|
// authorize the change) — never persist it as typed.
|
||||||
delete fullConfig.webPasswordCurrent;
|
delete fullConfig.webPasswordCurrent;
|
||||||
|
// Camera crossing line (passage confirmation): validated here, since the driver doesn't
|
||||||
|
// read it. `null` clears it — the merge above would otherwise keep the stored line.
|
||||||
|
if ("crossing" in config) {
|
||||||
|
if (config.crossing === null) {
|
||||||
|
delete fullConfig.crossing;
|
||||||
|
} else {
|
||||||
|
const line = parseCrossingLine(config.crossing);
|
||||||
|
if (!line) return { error: { code: 400, message: "invalid crossing line" } };
|
||||||
|
fullConfig.crossing = { ...line };
|
||||||
|
}
|
||||||
|
}
|
||||||
// Residual-risk warnings from device hardening (shown to the admin; the
|
// Residual-risk warnings from device hardening (shown to the admin; the
|
||||||
// save still succeeds — these are "configured, but note X" advisories).
|
// save still succeeds — these are "configured, but note X" advisories).
|
||||||
const hardenWarnings: string[] = [];
|
const hardenWarnings: string[] = [];
|
||||||
@@ -507,7 +519,7 @@ export async function setupRoutes(
|
|||||||
return reply.code(400).send({ error: `device ${id} is not a controller` });
|
return reply.code(400).send({ error: `device ${id} is not a controller` });
|
||||||
}
|
}
|
||||||
const cfg = (row.config ?? {}) as Record<string, unknown>;
|
const cfg = (row.config ?? {}) as Record<string, unknown>;
|
||||||
const relays = Array.isArray(cfg.relays) ? (cfg.relays as { relay?: number }[]) : [];
|
const relays = Array.isArray(cfg.relays) ? (cfg.relays as { relay?: number; direction?: string }[]) : [];
|
||||||
if (!relays.some((r) => r.relay === relay)) {
|
if (!relays.some((r) => r.relay === relay)) {
|
||||||
return reply.code(400).send({ error: `controller ${id} has no relay ${relay}` });
|
return reply.code(400).send({ error: `controller ${id} has no relay ${relay}` });
|
||||||
}
|
}
|
||||||
@@ -545,8 +557,14 @@ export async function setupRoutes(
|
|||||||
});
|
});
|
||||||
|
|
||||||
const startedAt = Date.now();
|
const startedAt = Date.now();
|
||||||
|
const relayDir = relays.find((r) => r.relay === relay)?.direction;
|
||||||
try {
|
try {
|
||||||
await device.pulseOpen(relay);
|
await pulseBarrier(db, req.log, device, { controller: row, relay }, {
|
||||||
|
direction: relayDir === "entry" || relayDir === "exit" ? relayDir : "both",
|
||||||
|
identity: `relay-test:${id}:${relay}`,
|
||||||
|
source: "relay-test",
|
||||||
|
operator,
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// The failure we're testing for (relay unreachable, wrong password). The open is
|
// The failure we're testing for (relay unreachable, wrong password). The open is
|
||||||
// already signed; report the pulse failure, don't 500.
|
// already signed; report the pulse failure, don't 500.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { randomBytes } from "node:crypto";
|
import { randomBytes } from "node:crypto";
|
||||||
import type { FastifyInstance } from "fastify";
|
import type { FastifyInstance, FastifyRequest } from "fastify";
|
||||||
import type { Db } from "@parking/db";
|
import type { Db } from "@parking/db";
|
||||||
import { feedPermissionFor, watchPermissions, type LedgerEvent, type Permission } from "@parking/shared";
|
import { feedPermissionFor, watchPermissions, type LedgerEvent, type Permission } from "@parking/shared";
|
||||||
import { currentRoleId, requireAuth, roleHasPermissions } from "../auth.js";
|
import { currentRoleId, requireAuth, roleHasPermissions } from "../auth.js";
|
||||||
@@ -9,7 +9,9 @@ import {
|
|||||||
type LaneStatusEvent,
|
type LaneStatusEvent,
|
||||||
type LanePresenceEvent,
|
type LanePresenceEvent,
|
||||||
type PlateRecognizedEvent,
|
type PlateRecognizedEvent,
|
||||||
|
type CameraActivityEvent,
|
||||||
} from "../device-events.js";
|
} from "../device-events.js";
|
||||||
|
import type { CameraActivity } from "../camera-activity.js";
|
||||||
import { enrichEvent } from "../event-enrich.js";
|
import { enrichEvent } from "../event-enrich.js";
|
||||||
import type { DeviceMonitor } from "../device-monitor.js";
|
import type { DeviceMonitor } from "../device-monitor.js";
|
||||||
import type { LaneStatus } from "../lane-status.js";
|
import type { LaneStatus } from "../lane-status.js";
|
||||||
@@ -111,6 +113,32 @@ function isAllowedOrigin(origin: string | undefined, host: string | undefined):
|
|||||||
return allow.includes(origin);
|
return allow.includes(origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Authenticate a WebSocket handshake and return the caller's role id: Origin allowlist
|
||||||
|
* FIRST (anti-CSWSH), then a desktop ticket (x-ws-ticket) or the JWT cookie. Shared by
|
||||||
|
* every socket route (/api/ws, /api/cameras/:id/live) so they cannot drift apart.
|
||||||
|
* Permission checks stay with each route.
|
||||||
|
*/
|
||||||
|
export async function authenticateWsHandshake(req: FastifyRequest): Promise<string> {
|
||||||
|
if (!isAllowedOrigin(req.headers.origin, req.headers.host)) {
|
||||||
|
throw Object.assign(new Error("forbidden origin"), { statusCode: 403 });
|
||||||
|
}
|
||||||
|
const rawTicket = req.headers[WS_TICKET_HEADER];
|
||||||
|
const ticket = Array.isArray(rawTicket) ? rawTicket[0] : rawTicket;
|
||||||
|
if (ticket !== undefined) {
|
||||||
|
const t = consumeWsTicket(ticket);
|
||||||
|
if (!t) {
|
||||||
|
throw Object.assign(new Error("invalid or expired ws ticket"), { statusCode: 401 });
|
||||||
|
}
|
||||||
|
return t.roleId;
|
||||||
|
}
|
||||||
|
await req.jwtVerify(); // reads the HttpOnly cookie (browser path)
|
||||||
|
if (!req.user) {
|
||||||
|
throw Object.assign(new Error("forbidden"), { statusCode: 403 });
|
||||||
|
}
|
||||||
|
return currentRoleId(req.user.sub) ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
type OutMsg =
|
type OutMsg =
|
||||||
| {
|
| {
|
||||||
kind: "hello";
|
kind: "hello";
|
||||||
@@ -118,12 +146,15 @@ type OutMsg =
|
|||||||
devices: unknown;
|
devices: unknown;
|
||||||
lanes: LaneStatusEvent | null;
|
lanes: LaneStatusEvent | null;
|
||||||
radar: LanePresenceEvent | null;
|
radar: LanePresenceEvent | null;
|
||||||
|
/** Camera ids currently seeing a vehicle (camera tiles go live). */
|
||||||
|
cameras: string[] | null;
|
||||||
}
|
}
|
||||||
| { kind: "ledger"; event: unknown; occupancy: ReturnType<typeof getOccupancy> | null }
|
| { kind: "ledger"; event: unknown; occupancy: ReturnType<typeof getOccupancy> | null }
|
||||||
| { kind: "printer-status"; event: unknown }
|
| { kind: "printer-status"; event: unknown }
|
||||||
| { kind: "device-status"; event: unknown }
|
| { kind: "device-status"; event: unknown }
|
||||||
| { kind: "lane-status"; lanes: LaneStatusEvent }
|
| { kind: "lane-status"; lanes: LaneStatusEvent }
|
||||||
| { kind: "lane-presence"; radar: LanePresenceEvent }
|
| { kind: "lane-presence"; radar: LanePresenceEvent }
|
||||||
|
| { kind: "camera-activity"; camera: CameraActivityEvent }
|
||||||
| { kind: "plate-recognized"; plate: PlateRecognizedEvent };
|
| { kind: "plate-recognized"; plate: PlateRecognizedEvent };
|
||||||
|
|
||||||
declare module "fastify" {
|
declare module "fastify" {
|
||||||
@@ -139,6 +170,7 @@ export async function wsRoutes(
|
|||||||
deviceMonitor: DeviceMonitor,
|
deviceMonitor: DeviceMonitor,
|
||||||
laneStatus: LaneStatus,
|
laneStatus: LaneStatus,
|
||||||
lanePresence: LanePresence,
|
lanePresence: LanePresence,
|
||||||
|
cameraActivity: CameraActivity,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// Desktop-only: mint a WS ticket for the signed-in session (see file header).
|
// Desktop-only: mint a WS ticket for the signed-in session (see file header).
|
||||||
// Ordinary cookie + CSRF auth — the desktop client CAN do that over HTTP (via
|
// Ordinary cookie + CSRF auth — the desktop client CAN do that over HTTP (via
|
||||||
@@ -157,25 +189,7 @@ export async function wsRoutes(
|
|||||||
// cross/absent origin before touching either credential, so a hijack
|
// cross/absent origin before touching either credential, so a hijack
|
||||||
// attempt never reaches an authenticated socket.
|
// attempt never reaches an authenticated socket.
|
||||||
preHandler: async (req) => {
|
preHandler: async (req) => {
|
||||||
if (!isAllowedOrigin(req.headers.origin, req.headers.host)) {
|
const roleId = await authenticateWsHandshake(req);
|
||||||
throw Object.assign(new Error("forbidden origin"), { statusCode: 403 });
|
|
||||||
}
|
|
||||||
const rawTicket = req.headers[WS_TICKET_HEADER];
|
|
||||||
const ticket = Array.isArray(rawTicket) ? rawTicket[0] : rawTicket;
|
|
||||||
let roleId: string;
|
|
||||||
if (ticket !== undefined) {
|
|
||||||
const t = consumeWsTicket(ticket);
|
|
||||||
if (!t) {
|
|
||||||
throw Object.assign(new Error("invalid or expired ws ticket"), { statusCode: 401 });
|
|
||||||
}
|
|
||||||
roleId = t.roleId;
|
|
||||||
} else {
|
|
||||||
await req.jwtVerify(); // reads the HttpOnly cookie (browser path)
|
|
||||||
if (!req.user) {
|
|
||||||
throw Object.assign(new Error("forbidden"), { statusCode: 403 });
|
|
||||||
}
|
|
||||||
roleId = currentRoleId(req.user.sub) ?? "";
|
|
||||||
}
|
|
||||||
const may = watchPermissions(effectiveModulesFor(db)).some((p) => roleHasPermissions(roleId, [p]));
|
const may = watchPermissions(effectiveModulesFor(db)).some((p) => roleHasPermissions(roleId, [p]));
|
||||||
if (!may) throw Object.assign(new Error("forbidden"), { statusCode: 403 });
|
if (!may) throw Object.assign(new Error("forbidden"), { statusCode: 403 });
|
||||||
req.wsRoleId = roleId;
|
req.wsRoleId = roleId;
|
||||||
@@ -206,6 +220,7 @@ export async function wsRoutes(
|
|||||||
devices: seesDevices ? deviceMonitor.snapshot() : null,
|
devices: seesDevices ? deviceMonitor.snapshot() : null,
|
||||||
lanes: seesDevices ? laneStatus.snapshot() : null,
|
lanes: seesDevices ? laneStatus.snapshot() : null,
|
||||||
radar: seesDevices ? lanePresence.snapshot() : null,
|
radar: seesDevices ? lanePresence.snapshot() : null,
|
||||||
|
cameras: seesDevices ? cameraActivity.snapshot() : null,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Subscribe to the live buses. Each handler recomputes occupancy from the
|
// Subscribe to the live buses. Each handler recomputes occupancy from the
|
||||||
@@ -233,6 +248,10 @@ export async function wsRoutes(
|
|||||||
const offPresence = deviceEvents.onLanePresence((radar) => {
|
const offPresence = deviceEvents.onLanePresence((radar) => {
|
||||||
if (seesDevices) send({ kind: "lane-presence", radar });
|
if (seesDevices) send({ kind: "lane-presence", radar });
|
||||||
});
|
});
|
||||||
|
// A camera started/stopped seeing a vehicle → its booth tile switches live/snapshot.
|
||||||
|
const offCamera = deviceEvents.onCameraActivity((camera) => {
|
||||||
|
if (seesDevices) send({ kind: "camera-activity", camera });
|
||||||
|
});
|
||||||
// A late async plate recognition → backfill the badge on the matching feed row. Advisory.
|
// A late async plate recognition → backfill the badge on the matching feed row. Advisory.
|
||||||
const offPlate = deviceEvents.onPlateRecognized((plate) => {
|
const offPlate = deviceEvents.onPlateRecognized((plate) => {
|
||||||
if (seesOccupancy) send({ kind: "plate-recognized", plate });
|
if (seesOccupancy) send({ kind: "plate-recognized", plate });
|
||||||
@@ -245,6 +264,7 @@ export async function wsRoutes(
|
|||||||
offLane();
|
offLane();
|
||||||
offPresence();
|
offPresence();
|
||||||
offPlate();
|
offPlate();
|
||||||
|
offCamera();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ import { entryRoutes } from "./routes/entry.js";
|
|||||||
import { siteRoutes } from "./routes/site.js";
|
import { siteRoutes } from "./routes/site.js";
|
||||||
import { registerModules } from "./modules/index.js";
|
import { registerModules } from "./modules/index.js";
|
||||||
import { snapshotRoutes } from "./routes/snapshots.js";
|
import { snapshotRoutes } from "./routes/snapshots.js";
|
||||||
|
import { cameraRoutes, liveResolverFor } from "./routes/cameras.js";
|
||||||
|
import { CameraActivity } from "./camera-activity.js";
|
||||||
|
import { CameraLiveHub } from "./camera-live.js";
|
||||||
import { tariffRoutes } from "./routes/tariffs.js";
|
import { tariffRoutes } from "./routes/tariffs.js";
|
||||||
import { printerRoutes } from "./routes/printers.js";
|
import { printerRoutes } from "./routes/printers.js";
|
||||||
import { setupRoutes } from "./routes/setup.js";
|
import { setupRoutes } from "./routes/setup.js";
|
||||||
@@ -176,6 +179,14 @@ export async function buildServer(opts: BuildOptions = {}): Promise<FastifyInsta
|
|||||||
const laneStatus = new LaneStatus(db, app.log);
|
const laneStatus = new LaneStatus(db, app.log);
|
||||||
app.addHook("onClose", async () => laneStatus.stop());
|
app.addHook("onClose", async () => laneStatus.stop());
|
||||||
|
|
||||||
|
// Per-CAMERA vehicle activity (same pushes, keyed by camera) + the live-video hub for
|
||||||
|
// the booth camera tiles: a tile goes live while its camera sees a vehicle. Advisory
|
||||||
|
// viewing only. See camera-live.ts, wiki/decisions/camera-live-view.md.
|
||||||
|
const cameraActivity = new CameraActivity(app.log);
|
||||||
|
app.addHook("onClose", async () => cameraActivity.stop());
|
||||||
|
const cameraLive = new CameraLiveHub(liveResolverFor(db), app.log);
|
||||||
|
app.addHook("onClose", async () => cameraLive.stopAll());
|
||||||
|
|
||||||
// Per-lane RADAR presence (presence-input edges → barrier-light blink). Mirrors the
|
// Per-lane RADAR presence (presence-input edges → barrier-light blink). Mirrors the
|
||||||
// physical button lamp (relay 3): the SAME presence signal, surfaced to the booth UI.
|
// physical button lamp (relay 3): the SAME presence signal, surfaced to the booth UI.
|
||||||
const lanePresence = new LanePresence(db, app.log);
|
const lanePresence = new LanePresence(db, app.log);
|
||||||
@@ -216,10 +227,11 @@ export async function buildServer(opts: BuildOptions = {}): Promise<FastifyInsta
|
|||||||
|
|
||||||
// Live booth feed: server-pushed ledger + occupancy + printer-status over a
|
// Live booth feed: server-pushed ledger + occupancy + printer-status over a
|
||||||
// single authenticated WebSocket (/api/ws). See routes/ws.ts.
|
// single authenticated WebSocket (/api/ws). See routes/ws.ts.
|
||||||
await wsRoutes(app, db, deviceMonitor, laneStatus, lanePresence);
|
await wsRoutes(app, db, deviceMonitor, laneStatus, lanePresence, cameraActivity);
|
||||||
|
|
||||||
// Entry/exit camera snapshots (BLOB-in-DB), read-only. See snapshot.ts.
|
// Entry/exit camera snapshots (BLOB-in-DB), read-only. See snapshot.ts.
|
||||||
await snapshotRoutes(app, db);
|
await snapshotRoutes(app, db);
|
||||||
|
await cameraRoutes(app, db, cameraLive);
|
||||||
|
|
||||||
// Entry flow: a button press → print ticket → signed vehicle_entry → pulseOpen.
|
// Entry flow: a button press → print ticket → signed vehicle_entry → pulseOpen.
|
||||||
// Subscribes to the SAME input bus as the telemetry writer below; the two are
|
// Subscribes to the SAME input bus as the telemetry writer below; the two are
|
||||||
@@ -270,7 +282,7 @@ export async function buildServer(opts: BuildOptions = {}): Promise<FastifyInsta
|
|||||||
// each detected target (vehicle). Source-IP guarded + optional Digest; records the raw
|
// each detected target (vehicle). Source-IP guarded + optional Digest; records the raw
|
||||||
// payload as a `kind:"alarm"` device_event, drives lane busy/free, AND hands a vehicle
|
// payload as a `kind:"alarm"` device_event, drives lane busy/free, AND hands a vehicle
|
||||||
// detection to the ANPR bridge above. See routes/hikvision-alarm.ts.
|
// detection to the ANPR bridge above. See routes/hikvision-alarm.ts.
|
||||||
await hikvisionAlarmRoutes(app, db, laneStatus, anprBridge);
|
await hikvisionAlarmRoutes(app, db, laneStatus, anprBridge, cameraActivity);
|
||||||
|
|
||||||
// Credential capture ("enroll a card"): lets the operator present an RFID card to a
|
// Credential capture ("enroll a card"): lets the operator present an RFID card to a
|
||||||
// CHOSEN reader to populate a subscription credential, without blocking the other
|
// CHOSEN reader to populate a subscription credential, without blocking the other
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
import { registry, type AccessControlDevice } from "@parking/devices";
|
import { registry, type AccessControlDevice } from "@parking/devices";
|
||||||
import { reasonPayload, type PlanTimeframes, type ReasonCode } from "@parking/shared";
|
import { reasonPayload, type PlanTimeframes, type ReasonCode } from "@parking/shared";
|
||||||
import type { FastifyBaseLogger } from "fastify";
|
import type { FastifyBaseLogger } from "fastify";
|
||||||
|
import { pulseBarrier } from "./relay-pulse.js";
|
||||||
import { printWindowChargeNotice } from "./booth-print.js";
|
import { printWindowChargeNotice } from "./booth-print.js";
|
||||||
import type { DeviceReadEvent, ReadOutcome } from "./device-events.js";
|
import type { DeviceReadEvent, ReadOutcome } from "./device-events.js";
|
||||||
import type { EventLog } from "./event-log.js";
|
import type { EventLog } from "./event-log.js";
|
||||||
@@ -211,8 +212,9 @@ export class SubscriptionFlow {
|
|||||||
// `permitId` carries the subscription id; `via` records which credential left.
|
// `permitId` carries the subscription id; `via` records which credential left.
|
||||||
payload: { sessionRef: occurrenceId, permitId: m.subscriptionId, via: m.via },
|
payload: { sessionRef: occurrenceId, permitId: m.subscriptionId, via: m.via },
|
||||||
});
|
});
|
||||||
await this.#open(resolved, "exit", occurrenceId, "subscription exit");
|
// Cache close before the pulse, for the same reason as the entry-side insert.
|
||||||
this.#closeCache(occurrenceId);
|
this.#closeCache(occurrenceId);
|
||||||
|
await this.#open(resolved, "exit", occurrenceId, "subscription exit");
|
||||||
return { accepted: true, direction: "exit" };
|
return { accepted: true, direction: "exit" };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +270,9 @@ export class SubscriptionFlow {
|
|||||||
`subscription out-of-window entry marked on ${occurrenceId} (charge priced from parked minutes at exit)`,
|
`subscription out-of-window entry marked on ${occurrenceId} (charge priced from parked minutes at exit)`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await this.#open(resolved, "entry", occurrenceId, "subscription entry");
|
// Session cache BEFORE the pulse: the entry is already signed, so the projection must
|
||||||
|
// reflect it even if the relay call throws (otherwise the ledger and the sessions
|
||||||
|
// table disagree about the same read — seen at park-2, 2026-10-24).
|
||||||
try {
|
try {
|
||||||
this.#db
|
this.#db
|
||||||
.insert(sessions)
|
.insert(sessions)
|
||||||
@@ -284,6 +288,7 @@ export class SubscriptionFlow {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.#logger.error(`session-cache insert failed for ${occurrenceId}: ${(err as Error).message}`);
|
this.#logger.error(`session-cache insert failed for ${occurrenceId}: ${(err as Error).message}`);
|
||||||
}
|
}
|
||||||
|
await this.#open(resolved, "entry", occurrenceId, "subscription entry");
|
||||||
// BEST-EFFORT: print the out-of-window TICKET so the subscriber has the paper the
|
// BEST-EFFORT: print the out-of-window TICKET so the subscriber has the paper the
|
||||||
// operator scans to settle at the booth. It carries the occurrence id as a scannable
|
// operator scans to settle at the booth. It carries the occurrence id as a scannable
|
||||||
// code; the amount is computed at settlement from the minutes actually parked
|
// code; the amount is computed at settlement from the minutes actually parked
|
||||||
@@ -409,12 +414,16 @@ export class SubscriptionFlow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async #open(resolved: ResolvedRelay, dir: FlowDirection, carKey: string, what: string): Promise<void> {
|
async #open(resolved: ResolvedRelay, dir: FlowDirection, carKey: string, what: string): Promise<void> {
|
||||||
const access = this.#buildAccess(resolved.controller);
|
// SNAPSHOT FIRST — fire the directional camera(s), never awaited (evidence, not a
|
||||||
if (access) await access.pulseOpen(resolved.relay);
|
// gate). Before the pulse, so a pulse failure (the pulse helper rethrows) still leaves
|
||||||
else this.#logger.warn(`${what} signed for ${carKey} but the ${dir} relay won't build`);
|
// an image for the signed event: at park-2 four signed entries had no snapshot because
|
||||||
|
// the relay timed out and this method unwound before reaching the camera (2026-10-24).
|
||||||
// SNAPSHOT — fire the directional camera(s), never awaited (evidence, not a gate).
|
|
||||||
this.#fireSnapshot(dir, carKey);
|
this.#fireSnapshot(dir, carKey);
|
||||||
|
|
||||||
|
const access = this.#buildAccess(resolved.controller);
|
||||||
|
if (access) {
|
||||||
|
await pulseBarrier(this.#db, this.#logger, access, resolved, { direction: dir, identity: carKey, source: "subscription" });
|
||||||
|
} else this.#logger.warn(`${what} signed for ${carKey} but the ${dir} relay won't build`);
|
||||||
}
|
}
|
||||||
|
|
||||||
#closeCache(carKey: string): void {
|
#closeCache(carKey: string): void {
|
||||||
|
|||||||
@@ -21,6 +21,16 @@ export interface AppliedValidation extends SessionValidation {
|
|||||||
readonly consumedBy: string | null;
|
readonly consumedBy: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The ledger columns the validation fold reads. Any identity-scoped, index-ordered
|
||||||
|
* slice of `ledger_events` satisfies it (a direct query, or the per-identity group of a
|
||||||
|
* whole-ledger scan — see PayStation.activeSessions). */
|
||||||
|
export interface LedgerRowLike {
|
||||||
|
readonly id: string;
|
||||||
|
readonly type: string;
|
||||||
|
readonly occurredAt: string;
|
||||||
|
readonly payload: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
/** All validations ever applied to a session (newest last), with voided/consumed
|
/** All validations ever applied to a session (newest last), with voided/consumed
|
||||||
* state folded from the chain. One identity-scoped ledger scan. */
|
* state folded from the chain. One identity-scoped ledger scan. */
|
||||||
export function sessionValidations(db: Db, identity: string): AppliedValidation[] {
|
export function sessionValidations(db: Db, identity: string): AppliedValidation[] {
|
||||||
@@ -35,7 +45,13 @@ export function sessionValidations(db: Db, identity: string): AppliedValidation[
|
|||||||
.where(eq(ledgerEvents.identity, identity))
|
.where(eq(ledgerEvents.identity, identity))
|
||||||
.orderBy(ledgerEvents.index)
|
.orderBy(ledgerEvents.index)
|
||||||
.all();
|
.all();
|
||||||
|
return sessionValidationsFromRows(rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Same fold over rows the caller already holds (identity-scoped, oldest first). Lets a
|
||||||
|
* list view price hundreds of sessions from ONE ledger scan instead of one per row —
|
||||||
|
* the per-row scans were what froze the booth server (park-2, 2026-10-24). */
|
||||||
|
export function sessionValidationsFromRows(rows: readonly LedgerRowLike[]): AppliedValidation[] {
|
||||||
const voided = new Set<string>();
|
const voided = new Set<string>();
|
||||||
const consumedBy = new Map<string, string>();
|
const consumedBy = new Map<string, string>();
|
||||||
const applies: AppliedValidation[] = [];
|
const applies: AppliedValidation[] = [];
|
||||||
@@ -88,6 +104,11 @@ export function liveValidations(db: Db, identity: string): AppliedValidation[] {
|
|||||||
return sessionValidations(db, identity).filter((v) => !v.voided && v.consumedBy == null);
|
return sessionValidations(db, identity).filter((v) => !v.voided && v.consumedBy == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** `liveValidations` over rows the caller already holds (see sessionValidationsFromRows). */
|
||||||
|
export function liveValidationsFromRows(rows: readonly LedgerRowLike[]): AppliedValidation[] {
|
||||||
|
return sessionValidationsFromRows(rows).filter((v) => !v.voided && v.consumedBy == null);
|
||||||
|
}
|
||||||
|
|
||||||
// --- Apply (shared by the merchant route and the Car Wash module) ----------------
|
// --- Apply (shared by the merchant route and the Car Wash module) ----------------
|
||||||
|
|
||||||
export interface ApplyValidationInput {
|
export interface ApplyValidationInput {
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ import {
|
|||||||
fetchUsbPrinters,
|
fetchUsbPrinters,
|
||||||
} from "./api.js";
|
} from "./api.js";
|
||||||
import { Modal } from "./ui/Modal.js";
|
import { Modal } from "./ui/Modal.js";
|
||||||
|
import { CrossingLineEditor } from "./ui/CrossingLineEditor.js";
|
||||||
|
import { parseCrossingLine, type CrossingLine } from "@parking/shared";
|
||||||
|
|
||||||
// First-run setup wizard. The pool-of-spaces model: a parking lot is one pool with
|
// First-run setup wizard. The pool-of-spaces model: a parking lot is one pool with
|
||||||
// a flexible set of entry/exit points — NO lane. The admin adds CONTROLLERS (each
|
// a flexible set of entry/exit points — NO lane. The admin adds CONTROLLERS (each
|
||||||
@@ -534,6 +536,8 @@ function DeviceForm({
|
|||||||
// back-plate read would otherwise phantom-exit the car that just entered). Defaults ON
|
// back-plate read would otherwise phantom-exit the car that just entered). Defaults ON
|
||||||
// when anpr is on (back-compat). (config.anprAutoTrigger).
|
// when anpr is on (back-compat). (config.anprAutoTrigger).
|
||||||
const [anprAuto, setAnprAuto] = useState<boolean>(editCfg?.anprAutoTrigger !== false);
|
const [anprAuto, setAnprAuto] = useState<boolean>(editCfg?.anprAutoTrigger !== false);
|
||||||
|
// Crossing line drawn over this camera's view (passage confirmation). (config.crossing)
|
||||||
|
const [crossing, setCrossing] = useState<CrossingLine | null>(() => parseCrossingLine(editCfg?.crossing));
|
||||||
|
|
||||||
// Pre-fill scalar config fields from the existing assignment when editing.
|
// Pre-fill scalar config fields from the existing assignment when editing.
|
||||||
// (relays/controllerId/relay are model fields handled by their own state below.)
|
// (relays/controllerId/relay are model fields handled by their own state below.)
|
||||||
@@ -735,6 +739,8 @@ function DeviceForm({
|
|||||||
// park can explicitly DISABLE auto-open on a camera (e.g. the exit cam of a shared lane)
|
// park can explicitly DISABLE auto-open on a camera (e.g. the exit cam of a shared lane)
|
||||||
// while keeping recognition. Absent ⇒ defaults ON (back-compat for existing cameras).
|
// while keeping recognition. Absent ⇒ defaults ON (back-compat for existing cameras).
|
||||||
if (isCamera && anpr) out.anprAutoTrigger = anprAuto;
|
if (isCamera && anpr) out.anprAutoTrigger = anprAuto;
|
||||||
|
// Crossing line: always sent for a camera, `null` to clear (the server merges configs).
|
||||||
|
if (isCamera) out.crossing = crossing ? { p1: { ...crossing.p1 }, p2: { ...crossing.p2 }, direction: crossing.direction } : null;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1085,6 +1091,15 @@ function DeviceForm({
|
|||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* CAMERA: the crossing line (passage confirmation), drawn over the live picture.
|
||||||
|
Needs a saved camera — the live stream is addressed by its device id. */}
|
||||||
|
{isCamera &&
|
||||||
|
(editing?.id ? (
|
||||||
|
<CrossingLineEditor deviceId={editing.id} value={crossing} onChange={setCrossing} />
|
||||||
|
) : (
|
||||||
|
<p className="hint my-2">{t("setup.crossingSaveFirst")}</p>
|
||||||
|
))}
|
||||||
|
|
||||||
{/* CAMERA + Alarm Server push ON: show the camera's Alarm Server settings,
|
{/* CAMERA + Alarm Server push ON: show the camera's Alarm Server settings,
|
||||||
ready to copy, so the operator never has to find the deviceId or memorise the
|
ready to copy, so the operator never has to find the deviceId or memorise the
|
||||||
endpoint. The CAMERA reaches us over the device VLAN, NOT via the browser's
|
endpoint. The CAMERA reaches us over the device VLAN, NOT via the browser's
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ export interface SessionUser {
|
|||||||
theme: Theme;
|
theme: Theme;
|
||||||
/** Preferred UI font scale, percent of base (100 = base; clamped 80–160). */
|
/** Preferred UI font scale, percent of base (100 = base; clamped 80–160). */
|
||||||
fontScale: number;
|
fontScale: number;
|
||||||
|
/** Booth camera tiles left open (camera device ids, opening order). */
|
||||||
|
openCameras: string[];
|
||||||
/** Optional display name (profile metadata); null if unset. */
|
/** Optional display name (profile metadata); null if unset. */
|
||||||
fullName: string | null;
|
fullName: string | null;
|
||||||
/** Optional contact email (profile metadata); null if unset. */
|
/** Optional contact email (profile metadata); null if unset. */
|
||||||
@@ -156,6 +158,45 @@ export function setFontScalePref(fontScale: number): Promise<{ fontScale: number
|
|||||||
return apiFetch("/api/auth/font-scale", { method: "PUT", body: JSON.stringify({ fontScale }) });
|
return apiFetch("/api/auth/font-scale", { method: "PUT", body: JSON.stringify({ fontScale }) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Persist which booth camera tiles are open (restored on next login). */
|
||||||
|
export function setOpenCamerasPref(openCameras: string[]): Promise<{ openCameras: string[] }> {
|
||||||
|
return apiFetch("/api/auth/open-cameras", { method: "PUT", body: JSON.stringify({ openCameras }) });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The newest entry/exit snapshot a camera captured (a camera tile's resting picture). */
|
||||||
|
export interface CameraSnapshotMeta {
|
||||||
|
id: string;
|
||||||
|
direction: "entry" | "exit";
|
||||||
|
capturedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Latest snapshot metadata for a camera, or null when it has none yet. */
|
||||||
|
export async function fetchLatestCameraSnapshot(deviceId: string): Promise<CameraSnapshotMeta | null> {
|
||||||
|
try {
|
||||||
|
return await apiFetch<CameraSnapshotMeta>(`/api/cameras/${encodeURIComponent(deviceId)}/latest-snapshot`);
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof ApiError && err.status === 404) return null;
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The next older / newer snapshot of the same camera (the large view's ‹ ›). */
|
||||||
|
export function fetchCameraSnapshotNeighbors(
|
||||||
|
deviceId: string,
|
||||||
|
snapshotId: string,
|
||||||
|
): Promise<{ older: CameraSnapshotMeta | null; newer: CameraSnapshotMeta | null }> {
|
||||||
|
return apiFetch(`/api/cameras/${encodeURIComponent(deviceId)}/snapshots/${encodeURIComponent(snapshotId)}/neighbors`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Snapshot bytes as an object URL. Fetched (not an <img src>) so it works in the
|
||||||
|
* desktop shell too, whose webview does not carry the session cookie. The caller
|
||||||
|
* revokes the URL. */
|
||||||
|
export async function fetchSnapshotObjectUrl(id: string): Promise<string> {
|
||||||
|
const res = await platformFetch(apiUrl(`/api/snapshots/${encodeURIComponent(id)}`), { credentials: "include" });
|
||||||
|
if (!res.ok) throw new ApiError(`/api/snapshots/${id}: ${res.status}`, res.status);
|
||||||
|
return URL.createObjectURL(await res.blob());
|
||||||
|
}
|
||||||
|
|
||||||
/** Edit MY own profile (display name / email). Returns the refreshed session.
|
/** Edit MY own profile (display name / email). Returns the refreshed session.
|
||||||
* Self-service — touches only the signed-in user; no `user:*` permission needed. */
|
* Self-service — touches only the signed-in user; no `user:*` permission needed. */
|
||||||
export function updateMyProfile(patch: {
|
export function updateMyProfile(patch: {
|
||||||
|
|||||||
@@ -269,6 +269,22 @@ export const en: Catalog = {
|
|||||||
clickForIssues: "Click for details",
|
clickForIssues: "Click for details",
|
||||||
checkedAt: "checked {{time}}",
|
checkedAt: "checked {{time}}",
|
||||||
},
|
},
|
||||||
|
camera: {
|
||||||
|
expand: "Show larger",
|
||||||
|
snapshot: "Snapshot",
|
||||||
|
liveOnDemand: "Live on-demand",
|
||||||
|
live: "Live",
|
||||||
|
showTile: "Show this camera",
|
||||||
|
hideTile: "Hide this camera",
|
||||||
|
noSnapshot: "No snapshot yet",
|
||||||
|
idle: "Live view starts when a vehicle arrives",
|
||||||
|
connecting: "Connecting to live video…",
|
||||||
|
liveUnavailable: "Live video unavailable",
|
||||||
|
vehicleInView: "Vehicle in view",
|
||||||
|
older: "Older snapshot",
|
||||||
|
newer: "Newer snapshot",
|
||||||
|
snapshotUnavailable: "Snapshot unavailable",
|
||||||
|
},
|
||||||
booth: {
|
booth: {
|
||||||
processTicket: "Process ticket",
|
processTicket: "Process ticket",
|
||||||
scanPlaceholder: "Scan or type ticket number…",
|
scanPlaceholder: "Scan or type ticket number…",
|
||||||
@@ -610,6 +626,15 @@ export const en: Catalog = {
|
|||||||
anprHint:
|
anprHint:
|
||||||
"Read plates on this camera: the vision service reads the plate from each snapshot and records it (both entry and exit). Requires the vision service running.",
|
"Read plates on this camera: the vision service reads the plate from each snapshot and records it (both entry and exit). Requires the vision service running.",
|
||||||
anprAuto: "Auto open/close on subscriber plate",
|
anprAuto: "Auto open/close on subscriber plate",
|
||||||
|
crossingTitle: "Crossing line",
|
||||||
|
crossingHint:
|
||||||
|
"Drag across the picture to draw the line a vehicle must cross; drag an end to move it. Choose which crossing counts: A → B, B → A, or either.",
|
||||||
|
crossingDirection: "Direction",
|
||||||
|
crossingSwap: "Swap A/B",
|
||||||
|
crossingClear: "Clear",
|
||||||
|
crossingNone: "No line drawn.",
|
||||||
|
crossingWaiting: "Waiting for the camera…",
|
||||||
|
crossingSaveFirst: "Save the camera first to draw its crossing line.",
|
||||||
anprAutoHint:
|
anprAutoHint:
|
||||||
"Let THIS camera auto-open the barrier when it recognises a subscriber's plate. Turn OFF on a shared entry/exit lane's exit camera, so a car driving IN isn't auto-EXITed by its back plate (recognition still runs — only the auto-trigger is off).",
|
"Let THIS camera auto-open the barrier when it recognises a subscriber's plate. Turn OFF on a shared entry/exit lane's exit camera, so a car driving IN isn't auto-EXITed by its back plate (recognition still runs — only the auto-trigger is off).",
|
||||||
testAnpr: "Test ANPR",
|
testAnpr: "Test ANPR",
|
||||||
|
|||||||
@@ -271,6 +271,22 @@ export const sq = {
|
|||||||
clickForIssues: "Kliko për detajet",
|
clickForIssues: "Kliko për detajet",
|
||||||
checkedAt: "kontrolluar {{time}}",
|
checkedAt: "kontrolluar {{time}}",
|
||||||
},
|
},
|
||||||
|
camera: {
|
||||||
|
expand: "Shfaq më të madhe",
|
||||||
|
snapshot: "Snapshot",
|
||||||
|
liveOnDemand: "Live on-demand",
|
||||||
|
live: "Live",
|
||||||
|
showTile: "Shfaq këtë kamerë",
|
||||||
|
hideTile: "Fshih këtë kamerë",
|
||||||
|
noSnapshot: "Ende pa snapshot",
|
||||||
|
idle: "Videoja live nis kur vjen një automjet",
|
||||||
|
connecting: "Po lidhet videoja live…",
|
||||||
|
liveUnavailable: "Videoja live nuk është e disponueshme",
|
||||||
|
vehicleInView: "Automjet në pamje",
|
||||||
|
older: "Foto më e vjetër",
|
||||||
|
newer: "Foto më e re",
|
||||||
|
snapshotUnavailable: "Fotoja nuk është e disponueshme",
|
||||||
|
},
|
||||||
booth: {
|
booth: {
|
||||||
processTicket: "Proceso biletën",
|
processTicket: "Proceso biletën",
|
||||||
scanPlaceholder: "Skano ose shkruaj numrin e biletës…",
|
scanPlaceholder: "Skano ose shkruaj numrin e biletës…",
|
||||||
@@ -324,7 +340,7 @@ export const sq = {
|
|||||||
forgiveExitOk: "Dalja u hap manualisht, pa pagesë.",
|
forgiveExitOk: "Dalja u hap manualisht, pa pagesë.",
|
||||||
forgiveExitNotOpened: "U regjistrua, por barriera nuk u hap: {{reason}}",
|
forgiveExitNotOpened: "U regjistrua, por barriera nuk u hap: {{reason}}",
|
||||||
forgiveDialogTitle: "Hapje manuale",
|
forgiveDialogTitle: "Hapje manuale",
|
||||||
forgiveDialogBody: "Hap barrierën e DALJES manualisht. Nuk merret asnjë pagesë dhe nuk printohet asgjë; hapja nënshkruhet me emrin tënd bashkë me foton e kamerës së daljes dhe shfaqet në raportin e turnit tënd.",
|
forgiveDialogBody: "Hap barrierën e DALJES manualisht. Nuk merret asnjë pagesë dhe nuk printohet asgjë; hapja nënshkruhet me emrin tënd bashkë me snapshot-in e kamerës së daljes dhe shfaqet në raportin e turnit tënd.",
|
||||||
forgiveDialogReason: "Arsyeja (opsionale)",
|
forgiveDialogReason: "Arsyeja (opsionale)",
|
||||||
forgiveDialogReasonPlaceholder: "p.sh. hyri kur barrierat ishin të hapura…",
|
forgiveDialogReasonPlaceholder: "p.sh. hyri kur barrierat ishin të hapura…",
|
||||||
forgiveDialogConfirm: "Hap daljen — pa pagesë",
|
forgiveDialogConfirm: "Hap daljen — pa pagesë",
|
||||||
@@ -384,7 +400,7 @@ export const sq = {
|
|||||||
edSource: "Burimi",
|
edSource: "Burimi",
|
||||||
edIdentity: "Identiteti",
|
edIdentity: "Identiteti",
|
||||||
edReason: "Arsyeja",
|
edReason: "Arsyeja",
|
||||||
edSnapshots: "Fotot",
|
edSnapshots: "Snapshot-et",
|
||||||
edPayload: "Të dhënat e nënshkruara",
|
edPayload: "Të dhënat e nënshkruara",
|
||||||
edChain: "Zinxhiri",
|
edChain: "Zinxhiri",
|
||||||
edSignature: "Nënshkrimi",
|
edSignature: "Nënshkrimi",
|
||||||
@@ -520,7 +536,7 @@ export const sq = {
|
|||||||
// Category titles + the singular noun used in buttons/modal titles.
|
// Category titles + the singular noun used in buttons/modal titles.
|
||||||
catControllers: "Kontrollerat (barrierat + butoni i hyrjes)",
|
catControllers: "Kontrollerat (barrierat + butoni i hyrjes)",
|
||||||
catReaders: "Lexuesit (QR / RFID)",
|
catReaders: "Lexuesit (QR / RFID)",
|
||||||
catCameras: "Kamerat (foto + targë)",
|
catCameras: "Kamerat (snapshot + targë)",
|
||||||
catPrinters: "Printerat (bileta / vouchera)",
|
catPrinters: "Printerat (bileta / vouchera)",
|
||||||
nounController: "kontroller",
|
nounController: "kontroller",
|
||||||
nounReader: "lexues",
|
nounReader: "lexues",
|
||||||
@@ -620,6 +636,15 @@ export const sq = {
|
|||||||
anprHint:
|
anprHint:
|
||||||
"Lexo targat në këtë aparat: shërbimi i vizionit lexon targën nga çdo pamje dhe e regjistron (hyrje dhe dalje). Kërkon shërbimin e vizionit aktiv.",
|
"Lexo targat në këtë aparat: shërbimi i vizionit lexon targën nga çdo pamje dhe e regjistron (hyrje dhe dalje). Kërkon shërbimin e vizionit aktiv.",
|
||||||
anprAuto: "Hapje/mbyllje automatike me targën e abonentit",
|
anprAuto: "Hapje/mbyllje automatike me targën e abonentit",
|
||||||
|
crossingTitle: "Vija e kalimit",
|
||||||
|
crossingHint:
|
||||||
|
"Tërhiq mbi pamje për të vizatuar vijën që duhet të kalojë mjeti; tërhiq një skaj për ta lëvizur. Zgjidh cili kalim numërohet: A → B, B → A, ose të dyja.",
|
||||||
|
crossingDirection: "Drejtimi",
|
||||||
|
crossingSwap: "Ndërro A/B",
|
||||||
|
crossingClear: "Pastro",
|
||||||
|
crossingNone: "Nuk ka vijë të vizatuar.",
|
||||||
|
crossingWaiting: "Në pritje të kamerës…",
|
||||||
|
crossingSaveFirst: "Ruaje kamerën fillimisht për të vizatuar vijën e kalimit.",
|
||||||
anprAutoHint:
|
anprAutoHint:
|
||||||
"Lejo që KY aparat të hapë vetë barrierën kur njeh targën e një abonenti. ÇAKTIVIZOJE te aparati i daljes në një korsi të përbashkët hyrje/dalje, që një makinë që HYN të mos DALË automatikisht nga targa e pasme (njohja vazhdon — fiket vetëm hapja automatike).",
|
"Lejo që KY aparat të hapë vetë barrierën kur njeh targën e një abonenti. ÇAKTIVIZOJE te aparati i daljes në një korsi të përbashkët hyrje/dalje, që një makinë që HYN të mos DALË automatikisht nga targa e pasme (njohja vazhdon — fiket vetëm hapja automatike).",
|
||||||
testAnpr: "Testo ANPR",
|
testAnpr: "Testo ANPR",
|
||||||
@@ -861,7 +886,7 @@ export const sq = {
|
|||||||
reserveSubs: "Rezervo vendet e abonentëve",
|
reserveSubs: "Rezervo vendet e abonentëve",
|
||||||
reserveSubsHint: "Mban një vend për makinat e çdo abonenti aktiv edhe kur nuk janë të parkuar — kalimtarët e shohin 'plot' më shpejt. Joaktiv: numërohen vetëm makinat brenda (mbingarkesa menaxhohet me parkim manual).",
|
reserveSubsHint: "Mban një vend për makinat e çdo abonenti aktiv edhe kur nuk janë të parkuar — kalimtarët e shohin 'plot' më shpejt. Joaktiv: numërohen vetëm makinat brenda (mbingarkesa menaxhohet me parkim manual).",
|
||||||
anprEntry: "Hapje automatike për targat e abonentëve (ANPR)",
|
anprEntry: "Hapje automatike për targat e abonentëve (ANPR)",
|
||||||
anprEntryHint: "Kur është aktiv, targa e një abonenti e lexuar nga kamera e korsisë hap barrierën përmes portës normale të abonimit. Joaktiv: abonentët duhet të përdorin kartën/QR-në. Fotot e targave regjistrohen gjithsesi.",
|
anprEntryHint: "Kur është aktiv, targa e një abonenti e lexuar nga kamera e korsisë hap barrierën përmes portës normale të abonimit. Joaktiv: abonentët duhet të përdorin kartën/QR-në. Snapshot-et e targave regjistrohen gjithsesi.",
|
||||||
parkDetails: "Të dhënat e parkimit (opsionale — shfaqen në bileta/fatura)",
|
parkDetails: "Të dhënat e parkimit (opsionale — shfaqen në bileta/fatura)",
|
||||||
save: "Ruaj",
|
save: "Ruaj",
|
||||||
saved: "U ruajt.",
|
saved: "U ruajt.",
|
||||||
@@ -1285,8 +1310,8 @@ export const sq = {
|
|||||||
exitForgiven: "Dalje manuale — {{amount}}, barriera u hap.",
|
exitForgiven: "Dalje manuale — {{amount}}, barriera u hap.",
|
||||||
exitForgivenNotOpened: "Dalje manuale — {{amount}}, barriera nuk u hap: {{reason}}",
|
exitForgivenNotOpened: "Dalje manuale — {{amount}}, barriera nuk u hap: {{reason}}",
|
||||||
// snapshots
|
// snapshots
|
||||||
noSnapshots: "asnjë foto",
|
noSnapshots: "asnjë snapshot",
|
||||||
loadingSnapshots: "duke ngarkuar fotot…",
|
loadingSnapshots: "duke ngarkuar snapshot-et…",
|
||||||
snapEntry: "hyrje",
|
snapEntry: "hyrje",
|
||||||
snapExit: "dalje",
|
snapExit: "dalje",
|
||||||
snapFailed: "kamera e paarritshme",
|
snapFailed: "kamera e paarritshme",
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ interface LiveState {
|
|||||||
lanes: LaneStatus | null;
|
lanes: LaneStatus | null;
|
||||||
/** Per-lane radar presence (advisory blink). Null until the first WS hello. */
|
/** Per-lane radar presence (advisory blink). Null until the first WS hello. */
|
||||||
radar: LanePresence | null;
|
radar: LanePresence | null;
|
||||||
|
/** Camera ids currently seeing a vehicle — their booth tiles show live video. */
|
||||||
|
activeCameras: Record<string, true>;
|
||||||
setStatus: (s: WsStatus) => void;
|
setStatus: (s: WsStatus) => void;
|
||||||
setOccupancy: (o: Occupancy) => void;
|
setOccupancy: (o: Occupancy) => void;
|
||||||
pushEvent: (e: LedgerEvent) => void;
|
pushEvent: (e: LedgerEvent) => void;
|
||||||
@@ -52,6 +54,10 @@ interface LiveState {
|
|||||||
setLanes: (l: LaneStatus) => void;
|
setLanes: (l: LaneStatus) => void;
|
||||||
/** Set lane radar presence (WS hello + each lane-presence push). */
|
/** Set lane radar presence (WS hello + each lane-presence push). */
|
||||||
setRadar: (r: LanePresence) => void;
|
setRadar: (r: LanePresence) => void;
|
||||||
|
/** Replace the active-camera set (WS hello). */
|
||||||
|
setActiveCameras: (ids: string[]) => void;
|
||||||
|
/** One camera started/stopped seeing a vehicle (WS camera-activity push). */
|
||||||
|
setCameraActive: (id: string, active: boolean) => void;
|
||||||
/** Backfill the enriched plate on every feed event matching `identity` (a late async
|
/** Backfill the enriched plate on every feed event matching `identity` (a late async
|
||||||
* recognition that landed after the event's own push). No-op if no row matches. */
|
* recognition that landed after the event's own push). No-op if no row matches. */
|
||||||
patchPlate: (identity: string, plate: string) => void;
|
patchPlate: (identity: string, plate: string) => void;
|
||||||
@@ -70,6 +76,7 @@ export const useLiveStore = create<LiveState>((set) => ({
|
|||||||
occupancy: null,
|
occupancy: null,
|
||||||
feed: [],
|
feed: [],
|
||||||
devices: {},
|
devices: {},
|
||||||
|
activeCameras: {},
|
||||||
lanes: null,
|
lanes: null,
|
||||||
radar: null,
|
radar: null,
|
||||||
setStatus: (status) => set({ status }),
|
setStatus: (status) => set({ status }),
|
||||||
@@ -83,10 +90,18 @@ export const useLiveStore = create<LiveState>((set) => ({
|
|||||||
upsertDevice: (d) => set((s) => ({ devices: { ...s.devices, [d.deviceId]: d } })),
|
upsertDevice: (d) => set((s) => ({ devices: { ...s.devices, [d.deviceId]: d } })),
|
||||||
setLanes: (lanes) => set({ lanes }),
|
setLanes: (lanes) => set({ lanes }),
|
||||||
setRadar: (radar) => set({ radar }),
|
setRadar: (radar) => set({ radar }),
|
||||||
|
setActiveCameras: (ids) => set({ activeCameras: Object.fromEntries(ids.map((id) => [id, true as const])) }),
|
||||||
|
setCameraActive: (id, active) =>
|
||||||
|
set((st) => {
|
||||||
|
const next = { ...st.activeCameras };
|
||||||
|
if (active) next[id] = true;
|
||||||
|
else delete next[id];
|
||||||
|
return { activeCameras: next };
|
||||||
|
}),
|
||||||
patchPlate: (identity, plate) =>
|
patchPlate: (identity, plate) =>
|
||||||
set((s) => {
|
set((s) => {
|
||||||
if (!s.feed.some((e) => e.identity === identity && !e.plate)) return s; // nothing to fill
|
if (!s.feed.some((e) => e.identity === identity && !e.plate)) return s; // nothing to fill
|
||||||
return { feed: s.feed.map((e) => (e.identity === identity && !e.plate ? { ...e, plate } : e)) };
|
return { feed: s.feed.map((e) => (e.identity === identity && !e.plate ? { ...e, plate } : e)) };
|
||||||
}),
|
}),
|
||||||
reset: () => set({ status: "connecting", occupancy: null, feed: [], devices: {}, lanes: null, radar: null }),
|
reset: () => set({ status: "connecting", occupancy: null, feed: [], devices: {}, lanes: null, radar: null, activeCameras: {} }),
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -27,9 +27,12 @@ import { inTauri } from "./tauri-env.js";
|
|||||||
const CONNECT_FAIL_LOG_INTERVAL_MS = 60_000;
|
const CONNECT_FAIL_LOG_INTERVAL_MS = 60_000;
|
||||||
let lastConnectFailLogAt = 0;
|
let lastConnectFailLogAt = 0;
|
||||||
|
|
||||||
|
/** A text frame arrives as a string, a binary frame (camera JPEG) as an ArrayBuffer. */
|
||||||
|
export type PlatformMessage = { data: string | ArrayBuffer };
|
||||||
|
|
||||||
export interface PlatformSocket {
|
export interface PlatformSocket {
|
||||||
onopen: (() => void) | null;
|
onopen: (() => void) | null;
|
||||||
onmessage: ((ev: { data: string }) => void) | null;
|
onmessage: ((ev: PlatformMessage) => void) | null;
|
||||||
onclose: (() => void) | null;
|
onclose: (() => void) | null;
|
||||||
onerror: (() => void) | null;
|
onerror: (() => void) | null;
|
||||||
close(): void;
|
close(): void;
|
||||||
@@ -37,15 +40,16 @@ export interface PlatformSocket {
|
|||||||
|
|
||||||
class NativeSocketAdapter implements PlatformSocket {
|
class NativeSocketAdapter implements PlatformSocket {
|
||||||
onopen: (() => void) | null = null;
|
onopen: (() => void) | null = null;
|
||||||
onmessage: ((ev: { data: string }) => void) | null = null;
|
onmessage: ((ev: PlatformMessage) => void) | null = null;
|
||||||
onclose: (() => void) | null = null;
|
onclose: (() => void) | null = null;
|
||||||
onerror: (() => void) | null = null;
|
onerror: (() => void) | null = null;
|
||||||
#sock: WebSocket;
|
#sock: WebSocket;
|
||||||
|
|
||||||
constructor(url: string) {
|
constructor(url: string) {
|
||||||
this.#sock = new WebSocket(url);
|
this.#sock = new WebSocket(url);
|
||||||
|
this.#sock.binaryType = "arraybuffer";
|
||||||
this.#sock.onopen = () => this.onopen?.();
|
this.#sock.onopen = () => this.onopen?.();
|
||||||
this.#sock.onmessage = (ev) => this.onmessage?.({ data: ev.data as string });
|
this.#sock.onmessage = (ev) => this.onmessage?.({ data: ev.data as string | ArrayBuffer });
|
||||||
this.#sock.onclose = () => this.onclose?.();
|
this.#sock.onclose = () => this.onclose?.();
|
||||||
this.#sock.onerror = () => this.onerror?.();
|
this.#sock.onerror = () => this.onerror?.();
|
||||||
}
|
}
|
||||||
@@ -55,22 +59,49 @@ class NativeSocketAdapter implements PlatformSocket {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NativeMsg = { type: string; data: unknown };
|
||||||
|
|
||||||
class TauriSocketAdapter implements PlatformSocket {
|
class TauriSocketAdapter implements PlatformSocket {
|
||||||
onopen: (() => void) | null = null;
|
onopen: (() => void) | null = null;
|
||||||
onmessage: ((ev: { data: string }) => void) | null = null;
|
onmessage: ((ev: PlatformMessage) => void) | null = null;
|
||||||
onclose: (() => void) | null = null;
|
onclose: (() => void) | null = null;
|
||||||
onerror: (() => void) | null = null;
|
onerror: (() => void) | null = null;
|
||||||
#closed = false;
|
#closed = false;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
#id: number | null = null;
|
||||||
#conn: any = null;
|
// Frames that arrive before connect() resolves, delivered right after onopen.
|
||||||
|
#early: NativeMsg[] | null = [];
|
||||||
|
|
||||||
constructor(url: string) {
|
constructor(url: string) {
|
||||||
void this.#connect(url);
|
void this.#connect(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#deliver(msg: NativeMsg): void {
|
||||||
|
if (this.#closed) return;
|
||||||
|
if (this.#early) {
|
||||||
|
this.#early.push(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.type === "Text") {
|
||||||
|
this.onmessage?.({ data: msg.data as string });
|
||||||
|
} else if (msg.type === "Binary") {
|
||||||
|
// Camera live view (routes/cameras.ts): one JPEG per binary message. The
|
||||||
|
// plugin hands bytes over IPC as a number array.
|
||||||
|
this.onmessage?.({ data: new Uint8Array(msg.data as number[]).buffer });
|
||||||
|
} else if (msg.type === "Close") {
|
||||||
|
this.onclose?.();
|
||||||
|
}
|
||||||
|
// Ping/Pong: nothing to do.
|
||||||
|
}
|
||||||
|
|
||||||
async #connect(url: string): Promise<void> {
|
async #connect(url: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const { default: TauriWebSocket } = await import("@tauri-apps/plugin-websocket");
|
// The plugin's own JS wrapper (@tauri-apps/plugin-websocket) only lets a listener
|
||||||
|
// be added AFTER connect() resolves, but the native side starts reading at the
|
||||||
|
// handshake — so a frame the server sends at once (the live feed's `hello`, with
|
||||||
|
// the full device list) could reach an empty listener set and be lost: the desktop
|
||||||
|
// footer then showed only the devices that happened to push later (2026-11-19).
|
||||||
|
// So call the plugin's commands directly, with our channel listening from the start.
|
||||||
|
const { Channel, invoke } = await import("@tauri-apps/api/core");
|
||||||
if (this.#closed) return; // close() called before connect resolved
|
if (this.#closed) return; // close() called before connect resolved
|
||||||
// The native WS plugin is a bare tungstenite client: no page context AND
|
// The native WS plugin is a bare tungstenite client: no page context AND
|
||||||
// no cookie jar. Two consequences, both handled via explicit headers:
|
// no cookie jar. Two consequences, both handled via explicit headers:
|
||||||
@@ -84,24 +115,22 @@ class TauriSocketAdapter implements PlatformSocket {
|
|||||||
// x-ws-ticket header (see routes/ws.ts).
|
// x-ws-ticket header (see routes/ws.ts).
|
||||||
const ticket = await fetchWsTicket();
|
const ticket = await fetchWsTicket();
|
||||||
if (this.#closed) return;
|
if (this.#closed) return;
|
||||||
const conn = await TauriWebSocket.connect(url, {
|
const onMessage = new Channel<NativeMsg>();
|
||||||
headers: { Origin: "tauri://localhost", "x-ws-ticket": ticket },
|
onMessage.onmessage = (msg) => this.#deliver(msg);
|
||||||
|
const id = await invoke<number>("plugin:websocket|connect", {
|
||||||
|
url,
|
||||||
|
onMessage,
|
||||||
|
config: { headers: [["Origin", "tauri://localhost"], ["x-ws-ticket", ticket]] },
|
||||||
});
|
});
|
||||||
|
this.#id = id;
|
||||||
if (this.#closed) {
|
if (this.#closed) {
|
||||||
void conn.disconnect();
|
this.#disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.#conn = conn;
|
|
||||||
conn.addListener((msg: { type: string; data: unknown }) => {
|
|
||||||
if (msg.type === "Text") {
|
|
||||||
this.onmessage?.({ data: msg.data as string });
|
|
||||||
} else if (msg.type === "Close") {
|
|
||||||
this.onclose?.();
|
|
||||||
}
|
|
||||||
// Binary/Ping/Pong: the server protocol here is text-JSON only (see
|
|
||||||
// routes/ws.ts) — nothing else is expected.
|
|
||||||
});
|
|
||||||
this.onopen?.();
|
this.onopen?.();
|
||||||
|
const early = this.#early ?? [];
|
||||||
|
this.#early = null;
|
||||||
|
for (const msg of early) this.#deliver(msg);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// logClient, not console.error: console output only reaches app_logs at
|
// logClient, not console.error: console output only reaches app_logs at
|
||||||
// debug/trace level, which is how the ticket-less 401 stayed invisible
|
// debug/trace level, which is how the ticket-less 401 stayed invisible
|
||||||
@@ -119,9 +148,23 @@ class TauriSocketAdapter implements PlatformSocket {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#disconnect(): void {
|
||||||
|
if (this.#id == null) return;
|
||||||
|
void import("@tauri-apps/api/core")
|
||||||
|
.then(({ invoke }) =>
|
||||||
|
invoke("plugin:websocket|send", {
|
||||||
|
id: this.#id,
|
||||||
|
message: { type: "Close", data: { code: 1000, reason: "Disconnected by client" } },
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.catch(() => {
|
||||||
|
/* already gone */
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
close(): void {
|
close(): void {
|
||||||
this.#closed = true;
|
this.#closed = true;
|
||||||
void this.#conn?.disconnect();
|
this.#disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,13 @@ import { createPlatformSocket, type PlatformSocket } from "./platform-ws.js";
|
|||||||
/** Server → client message shapes (mirror routes/ws.ts OutMsg). */
|
/** Server → client message shapes (mirror routes/ws.ts OutMsg). */
|
||||||
type WsMessage =
|
type WsMessage =
|
||||||
// Parts a role may not see arrive as null (the server filters per role — ws.ts).
|
// Parts a role may not see arrive as null (the server filters per role — ws.ts).
|
||||||
| { kind: "hello"; occupancy: Occupancy | null; devices: DeviceStatus[] | null; lanes: LaneStatus | null; radar: LanePresence | null }
|
| { kind: "hello"; occupancy: Occupancy | null; devices: DeviceStatus[] | null; lanes: LaneStatus | null; radar: LanePresence | null; cameras: string[] | null }
|
||||||
| { kind: "ledger"; event: LedgerEvent; occupancy: Occupancy | null }
|
| { kind: "ledger"; event: LedgerEvent; occupancy: Occupancy | null }
|
||||||
| { kind: "printer-status"; event: unknown }
|
| { kind: "printer-status"; event: unknown }
|
||||||
| { kind: "device-status"; event: DeviceStatus }
|
| { kind: "device-status"; event: DeviceStatus }
|
||||||
| { kind: "lane-status"; lanes: LaneStatus }
|
| { kind: "lane-status"; lanes: LaneStatus }
|
||||||
| { kind: "lane-presence"; radar: LanePresence }
|
| { kind: "lane-presence"; radar: LanePresence }
|
||||||
|
| { kind: "camera-activity"; camera: { deviceId: string; active: boolean } }
|
||||||
| { kind: "plate-recognized"; plate: { identity: string; plate: string; direction: "entry" | "exit" } };
|
| { kind: "plate-recognized"; plate: { identity: string; plate: string; direction: "entry" | "exit" } };
|
||||||
|
|
||||||
|
|
||||||
@@ -34,8 +35,18 @@ type WsMessage =
|
|||||||
*/
|
*/
|
||||||
export function useLiveFeed(enabled: boolean = true): void {
|
export function useLiveFeed(enabled: boolean = true): void {
|
||||||
const qc = useQueryClient();
|
const qc = useQueryClient();
|
||||||
const { setStatus, setOccupancy, pushEvent, setDevices, upsertDevice, setLanes, setRadar, patchPlate } =
|
const {
|
||||||
useLiveStore();
|
setStatus,
|
||||||
|
setOccupancy,
|
||||||
|
pushEvent,
|
||||||
|
setDevices,
|
||||||
|
upsertDevice,
|
||||||
|
setLanes,
|
||||||
|
setRadar,
|
||||||
|
patchPlate,
|
||||||
|
setActiveCameras,
|
||||||
|
setCameraActive,
|
||||||
|
} = useLiveStore();
|
||||||
// Hold the socket + reconnect timer across renders; guard against StrictMode
|
// Hold the socket + reconnect timer across renders; guard against StrictMode
|
||||||
// double-invoke and unmount.
|
// double-invoke and unmount.
|
||||||
const sockRef = useRef<PlatformSocket | null>(null);
|
const sockRef = useRef<PlatformSocket | null>(null);
|
||||||
@@ -73,6 +84,12 @@ export function useLiveFeed(enabled: boolean = true): void {
|
|||||||
if (Array.isArray(msg.devices)) setDevices(msg.devices);
|
if (Array.isArray(msg.devices)) setDevices(msg.devices);
|
||||||
if (msg.lanes) setLanes(msg.lanes);
|
if (msg.lanes) setLanes(msg.lanes);
|
||||||
if (msg.radar) setRadar(msg.radar);
|
if (msg.radar) setRadar(msg.radar);
|
||||||
|
if (Array.isArray(msg.cameras)) setActiveCameras(msg.cameras);
|
||||||
|
} else if (msg.kind === "camera-activity") {
|
||||||
|
setCameraActive(msg.camera.deviceId, msg.camera.active);
|
||||||
|
// Live ended → the tile falls back to the newest snapshot, which this car
|
||||||
|
// may just have produced.
|
||||||
|
if (!msg.camera.active) void qc.invalidateQueries({ queryKey: ["camera-latest", msg.camera.deviceId] });
|
||||||
} else if (msg.kind === "device-status") {
|
} else if (msg.kind === "device-status") {
|
||||||
upsertDevice(msg.event);
|
upsertDevice(msg.event);
|
||||||
} else if (msg.kind === "lane-status") {
|
} else if (msg.kind === "lane-status") {
|
||||||
@@ -93,6 +110,12 @@ export function useLiveFeed(enabled: boolean = true): void {
|
|||||||
void qc.invalidateQueries({ queryKey: qk.events });
|
void qc.invalidateQueries({ queryKey: qk.events });
|
||||||
void qc.invalidateQueries({ queryKey: qk.occupancy });
|
void qc.invalidateQueries({ queryKey: qk.occupancy });
|
||||||
void qc.invalidateQueries({ queryKey: qk.activeSessions });
|
void qc.invalidateQueries({ queryKey: qk.activeSessions });
|
||||||
|
// An entry/exit is followed by a fresh camera snapshot → the camera tiles'
|
||||||
|
// picture. The snapshot is stored AFTER the signed event (entry-flow.ts), so
|
||||||
|
// refetch a moment later; the idle edge (camera-activity) refetches again.
|
||||||
|
if (msg.event.type === "vehicle_entry" || msg.event.type === "vehicle_exit") {
|
||||||
|
window.setTimeout(() => void qc.invalidateQueries({ queryKey: ["camera-latest"] }), 4000);
|
||||||
|
}
|
||||||
// A shift open/close (or a drawer movement) changes the header control
|
// A shift open/close (or a drawer movement) changes the header control
|
||||||
// state and the per-shift log window — refresh the shift status too.
|
// state and the per-shift log window — refresh the shift status too.
|
||||||
if (
|
if (
|
||||||
@@ -113,6 +136,10 @@ export function useLiveFeed(enabled: boolean = true): void {
|
|||||||
const scheduleReconnect = () => {
|
const scheduleReconnect = () => {
|
||||||
if (closedRef.current) return;
|
if (closedRef.current) return;
|
||||||
setStatus("closed");
|
setStatus("closed");
|
||||||
|
// Camera activity is only known while the feed is up: without this a tile would
|
||||||
|
// stay "live" and re-dial its camera for the whole outage. The hello on reconnect
|
||||||
|
// restores the real set.
|
||||||
|
setActiveCameras([]);
|
||||||
// Capped exponential backoff: 0.5s, 1s, 2s, … up to 10s.
|
// Capped exponential backoff: 0.5s, 1s, 2s, … up to 10s.
|
||||||
const delay = Math.min(500 * 2 ** retryRef.current, 10_000);
|
const delay = Math.min(500 * 2 ** retryRef.current, 10_000);
|
||||||
retryRef.current += 1;
|
retryRef.current += 1;
|
||||||
|
|||||||
+19
-1
@@ -17,6 +17,7 @@ import {
|
|||||||
setLanguagePref,
|
setLanguagePref,
|
||||||
setThemePref,
|
setThemePref,
|
||||||
setFontScalePref,
|
setFontScalePref,
|
||||||
|
setOpenCamerasPref,
|
||||||
FONT_SCALE_MIN,
|
FONT_SCALE_MIN,
|
||||||
FONT_SCALE_MAX,
|
FONT_SCALE_MAX,
|
||||||
FONT_SCALE_STEP,
|
FONT_SCALE_STEP,
|
||||||
@@ -384,6 +385,17 @@ function RootLayout() {
|
|||||||
const canWatch = canWatchFeed(user);
|
const canWatch = canWatchFeed(user);
|
||||||
useLiveFeed(canWatch);
|
useLiveFeed(canWatch);
|
||||||
|
|
||||||
|
// Booth camera tiles: a footer camera chip opens/closes its tile. The open set is a
|
||||||
|
// per-user preference (users.open_cameras), restored on login from any booth; saved
|
||||||
|
// optimistically — a failed save only means it is not remembered next time.
|
||||||
|
const toggleCamera = (deviceId: string) => {
|
||||||
|
if (!user) return;
|
||||||
|
const current: string[] = user.openCameras ?? [];
|
||||||
|
const next = current.includes(deviceId) ? current.filter((id) => id !== deviceId) : [...current, deviceId];
|
||||||
|
setUser({ ...user, openCameras: next });
|
||||||
|
void setOpenCamerasPref(next).catch(() => undefined);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-screen flex-col bg-term-bg text-term-text">
|
<div className="flex h-screen flex-col bg-term-bg text-term-text">
|
||||||
<header className="flex items-center gap-4 border-b border-term-border bg-term-panel px-4 py-2">
|
<header className="flex items-center gap-4 border-b border-term-border bg-term-panel px-4 py-2">
|
||||||
@@ -459,7 +471,13 @@ function RootLayout() {
|
|||||||
{/* Fixed device-status footer — relays, readers, cameras, printers. Its REST
|
{/* Fixed device-status footer — relays, readers, cameras, printers. Its REST
|
||||||
seed needs device:read (and its live updates ride the report:read WS), so
|
seed needs device:read (and its live updates ride the report:read WS), so
|
||||||
it's hidden for roles without device visibility (e.g. merchant validators). */}
|
it's hidden for roles without device visibility (e.g. merchant validators). */}
|
||||||
{user && show("device:read") && <DeviceFooter />}
|
{user && show("device:read") && (
|
||||||
|
<DeviceFooter
|
||||||
|
openCameras={user.openCameras ?? []}
|
||||||
|
onToggleCamera={toggleCamera}
|
||||||
|
canSeeSnapshots={show("session:read")}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,489 @@
|
|||||||
|
import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
||||||
|
import { createPortal } from "react-dom";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import {
|
||||||
|
fetchCameraSnapshotNeighbors,
|
||||||
|
fetchLatestCameraSnapshot,
|
||||||
|
fetchSnapshotObjectUrl,
|
||||||
|
type CameraSnapshotMeta,
|
||||||
|
type DeviceStatus,
|
||||||
|
} from "../api.js";
|
||||||
|
import { formatClock, formatRelativeDateTime } from "../lib/format.js";
|
||||||
|
import { useLiveStore } from "../lib/live-store.js";
|
||||||
|
import { wsUrl } from "../lib/origin.js";
|
||||||
|
import { createPlatformSocket } from "../lib/platform-ws.js";
|
||||||
|
|
||||||
|
// Booth camera tiles (wiki/decisions/camera-live-view.md). Opened from the camera
|
||||||
|
// chips in the device footer; docked bottom-right, the first opened rightmost and each
|
||||||
|
// next one to its left. A tile rests on the camera's newest entry/exit snapshot and
|
||||||
|
// switches to live video while that camera is seeing a vehicle (the server's per-camera
|
||||||
|
// activity, pushed over /api/ws). Clicking the picture opens a large view in the
|
||||||
|
// tile's state (live if the tile is live, else the snapshot), with a Live / Snapshot
|
||||||
|
// switch that streams LIVE ON DEMAND, car or no car; closing it returns the tile to
|
||||||
|
// automatic — a stream the user started stops, one the camera started carries on. On
|
||||||
|
// the Snapshot side, ‹ › step through this camera's older / newer snapshots (the tile
|
||||||
|
// itself always rests on the newest; the large view reopens on it). Live frames come over their own socket as JPEG binaries; only the newest frame is
|
||||||
|
// shown, and the tile and the large view share that one socket. Advisory viewing —
|
||||||
|
// nothing here gates anything.
|
||||||
|
|
||||||
|
type LiveState =
|
||||||
|
| { state: "connecting" }
|
||||||
|
| { state: "live" }
|
||||||
|
| { state: "retrying"; reason: string }
|
||||||
|
| { state: "unavailable"; reason: string };
|
||||||
|
|
||||||
|
/** Delay before re-opening a live socket that dropped while the camera is still active. */
|
||||||
|
const RECONNECT_MS = 2000;
|
||||||
|
|
||||||
|
export function CameraDock({
|
||||||
|
openIds,
|
||||||
|
cameras,
|
||||||
|
label,
|
||||||
|
canSeeSnapshots,
|
||||||
|
onClose,
|
||||||
|
}: {
|
||||||
|
openIds: string[];
|
||||||
|
/** Configured cameras (for labels, and to skip a tile whose camera was removed). */
|
||||||
|
cameras: DeviceStatus[];
|
||||||
|
label: (d: DeviceStatus) => string;
|
||||||
|
canSeeSnapshots: boolean;
|
||||||
|
onClose: (deviceId: string) => void;
|
||||||
|
}) {
|
||||||
|
const byId = new Map(cameras.map((c) => [c.deviceId, c]));
|
||||||
|
const shown = openIds.filter((id) => byId.has(id));
|
||||||
|
if (shown.length === 0) return null;
|
||||||
|
return (
|
||||||
|
// Above the footer; first opened rightmost (row-reverse), the next to its left.
|
||||||
|
<div className="pointer-events-none fixed bottom-9 right-2 z-40 flex flex-row-reverse items-end gap-2">
|
||||||
|
{shown.map((id) => (
|
||||||
|
<CameraTile
|
||||||
|
key={id}
|
||||||
|
deviceId={id}
|
||||||
|
title={label(byId.get(id)!)}
|
||||||
|
canSeeSnapshots={canSeeSnapshots}
|
||||||
|
onClose={() => onClose(id)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CameraTile({
|
||||||
|
deviceId,
|
||||||
|
title,
|
||||||
|
canSeeSnapshots,
|
||||||
|
onClose,
|
||||||
|
}: {
|
||||||
|
deviceId: string;
|
||||||
|
title: string;
|
||||||
|
canSeeSnapshots: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
/** The camera is reporting a vehicle (server-side activity, 30 s after its last push). */
|
||||||
|
const active = useLiveStore((s) => s.activeCameras[deviceId] === true);
|
||||||
|
/** Large view open, and what it shows (opens in the tile's state, then the user's pick). */
|
||||||
|
const [expanded, setExpanded] = useState(false);
|
||||||
|
const [modalMode, setModalMode] = useState<"live" | "snapshot">("live");
|
||||||
|
// Modal open → the user's choice rules; closed → automatic (live while a vehicle is in view).
|
||||||
|
const wantLive = expanded ? modalMode === "live" : active;
|
||||||
|
const live = useLiveFrames(deviceId, wantLive);
|
||||||
|
const snapshot = useLatestSnapshot(deviceId, canSeeSnapshots);
|
||||||
|
const showLive = wantLive && live.hasFrame;
|
||||||
|
/** The snapshot the large view shows when the user has stepped away from the newest. */
|
||||||
|
const [browsed, setBrowsed] = useState<CameraSnapshotMeta | null>(null);
|
||||||
|
const browsedPic = useSnapshotPicture(browsed);
|
||||||
|
/** What the ‹ › step from: the snapshot asked for (its picture may still be loading). */
|
||||||
|
const modalShot = browsed ?? snapshot.meta;
|
||||||
|
const browsing = expanded && modalMode === "snapshot" && canSeeSnapshots && modalShot !== null;
|
||||||
|
const neighbors = useQuery({
|
||||||
|
// Under "camera-latest" so a new snapshot's invalidation refreshes "newer" too.
|
||||||
|
queryKey: ["camera-latest", deviceId, "neighbors", modalShot?.id],
|
||||||
|
queryFn: () => fetchCameraSnapshotNeighbors(deviceId, modalShot!.id),
|
||||||
|
enabled: browsing,
|
||||||
|
});
|
||||||
|
const nav = browsing
|
||||||
|
? { older: neighbors.data?.older ?? null, newer: neighbors.data?.newer ?? null, go: setBrowsed }
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const caption = wantLive
|
||||||
|
? showLive
|
||||||
|
? active
|
||||||
|
? t("camera.vehicleInView")
|
||||||
|
: t("camera.liveOnDemand")
|
||||||
|
: live.status.state === "unavailable" || live.status.state === "retrying"
|
||||||
|
? `${t("camera.liveUnavailable")}: ${live.status.reason}`
|
||||||
|
: t("camera.connecting")
|
||||||
|
: snapshot.pic.meta
|
||||||
|
? `${snapshot.pic.meta.direction === "entry" ? t("pay.snapEntry") : t("pay.snapExit")} · ${formatClock(snapshot.pic.meta.capturedAt)}`
|
||||||
|
: "";
|
||||||
|
// The large view's picture: a stepped-to snapshot once its bytes are in, the previous
|
||||||
|
// picture until then. The caption always names the picture SHOWN (these are evidence
|
||||||
|
// stills — a date must never sit under another snapshot's picture).
|
||||||
|
const modalPic = browsed ? (browsedPic.meta ? browsedPic : snapshot.pic) : snapshot.pic;
|
||||||
|
const modalCaption = wantLive
|
||||||
|
? caption
|
||||||
|
: browsed && browsedPic.failed
|
||||||
|
? t("camera.snapshotUnavailable")
|
||||||
|
: modalPic.meta
|
||||||
|
? `${modalPic.meta.direction === "entry" ? t("pay.snapEntry") : t("pay.snapExit")} · ${formatRelativeDateTime(modalPic.meta.capturedAt, t, { seconds: true })}`
|
||||||
|
: caption;
|
||||||
|
const view = (slot: "tile" | "modal") => (
|
||||||
|
<CameraView
|
||||||
|
imgRef={live.imgRefs[slot]}
|
||||||
|
showLive={showLive}
|
||||||
|
snapshotUrl={slot === "modal" ? (browsed && browsedPic.failed ? null : modalPic.url) : snapshot.pic.url}
|
||||||
|
placeholder={
|
||||||
|
slot === "modal" && browsed && browsedPic.failed
|
||||||
|
? t("camera.snapshotUnavailable")
|
||||||
|
: canSeeSnapshots
|
||||||
|
? t("camera.noSnapshot")
|
||||||
|
: t("camera.idle")
|
||||||
|
}
|
||||||
|
caption={slot === "modal" ? modalCaption : caption}
|
||||||
|
large={slot === "modal"}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="pointer-events-auto flex w-[15vw] min-w-[200px] flex-col overflow-hidden rounded-term border border-term-border bg-term-panel shadow-2xl">
|
||||||
|
<div className="flex items-center gap-2 border-b border-term-border bg-term-panel-2 px-2 py-1 text-[0.6875rem]">
|
||||||
|
<span className="min-w-0 flex-1 truncate font-semibold text-term-text">{title}</span>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={onClose}
|
||||||
|
className="shrink-0 text-term-muted hover:text-term-text"
|
||||||
|
aria-label={t("common.close")}
|
||||||
|
title={t("common.close")}
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/* The picture is the expand control: the large view opens showing what the tile
|
||||||
|
shows. Seeded from `active`, not from "a frame has arrived", so a camera-started
|
||||||
|
stream that is still connecting is not torn down by the click. */}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => {
|
||||||
|
setModalMode(active ? "live" : "snapshot");
|
||||||
|
setExpanded(true);
|
||||||
|
}}
|
||||||
|
className="block w-full cursor-zoom-in"
|
||||||
|
title={t("camera.expand")}
|
||||||
|
aria-label={t("camera.expand")}
|
||||||
|
>
|
||||||
|
{view("tile")}
|
||||||
|
</button>
|
||||||
|
{expanded && (
|
||||||
|
<CameraModal
|
||||||
|
title={title}
|
||||||
|
mode={modalMode}
|
||||||
|
onMode={setModalMode}
|
||||||
|
nav={nav}
|
||||||
|
onClose={() => {
|
||||||
|
setExpanded(false);
|
||||||
|
setBrowsed(null);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{view("modal")}
|
||||||
|
</CameraModal>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The picture area shared by the tile and the large view: live frames (painted
|
||||||
|
* straight into the <img>, no re-render per frame) or the resting snapshot. */
|
||||||
|
function CameraView({
|
||||||
|
imgRef,
|
||||||
|
showLive,
|
||||||
|
snapshotUrl,
|
||||||
|
placeholder,
|
||||||
|
caption,
|
||||||
|
large,
|
||||||
|
}: {
|
||||||
|
imgRef: (el: HTMLImageElement | null) => void;
|
||||||
|
showLive: boolean;
|
||||||
|
snapshotUrl: string | null;
|
||||||
|
placeholder: string;
|
||||||
|
caption: string;
|
||||||
|
large: boolean;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div className="relative aspect-video w-full bg-black">
|
||||||
|
<img ref={imgRef} alt="" className={`absolute inset-0 h-full w-full object-contain ${showLive ? "" : "hidden"}`} />
|
||||||
|
{!showLive && snapshotUrl && (
|
||||||
|
<img src={snapshotUrl} alt="" className="absolute inset-0 h-full w-full object-contain" />
|
||||||
|
)}
|
||||||
|
{!showLive && !snapshotUrl && (
|
||||||
|
<div className="absolute inset-0 flex items-center justify-center px-2 text-center text-[0.6875rem] text-term-muted">
|
||||||
|
{placeholder}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{showLive && <LiveBadge large={large} />}
|
||||||
|
{caption && (
|
||||||
|
<div
|
||||||
|
className={`absolute bottom-0 left-0 right-0 truncate bg-black/60 text-left text-term-muted ${
|
||||||
|
large ? "px-3 py-1 text-[0.8125rem]" : "px-1.5 py-0.5 text-[0.625rem]"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{caption}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** "● LIVE" with a pulsing green dot, over the video's top-left corner. */
|
||||||
|
function LiveBadge({ large }: { large: boolean }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={`absolute left-1.5 top-1.5 flex items-center gap-1.5 rounded-full bg-black/70 font-semibold uppercase tracking-wider text-term-green ${
|
||||||
|
large ? "px-2.5 py-1 text-[0.8125rem]" : "px-1.5 py-0.5 text-[0.625rem]"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<span className="relative flex h-2 w-2">
|
||||||
|
<span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-term-green opacity-75" />
|
||||||
|
<span className="relative inline-flex h-2 w-2 rounded-full bg-term-green" />
|
||||||
|
</span>
|
||||||
|
{t("camera.live")}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
type SnapshotNav = {
|
||||||
|
older: CameraSnapshotMeta | null;
|
||||||
|
newer: CameraSnapshotMeta | null;
|
||||||
|
go: (shot: CameraSnapshotMeta) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Large view of one camera with a Live / Snapshot switch and, on the Snapshot side,
|
||||||
|
* ‹ › (also ← →) to step through older / newer snapshots — muted at either end.
|
||||||
|
* Closes on ✕, Escape or a backdrop click. */
|
||||||
|
function CameraModal({
|
||||||
|
title,
|
||||||
|
mode,
|
||||||
|
onMode,
|
||||||
|
nav,
|
||||||
|
onClose,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
title: string;
|
||||||
|
mode: "live" | "snapshot";
|
||||||
|
onMode: (m: "live" | "snapshot") => void;
|
||||||
|
nav: SnapshotNav | null;
|
||||||
|
onClose: () => void;
|
||||||
|
children: ReactNode;
|
||||||
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
useEffect(() => {
|
||||||
|
const onKey = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === "Escape") onClose();
|
||||||
|
else if (e.key === "ArrowLeft" && nav?.older) nav.go(nav.older);
|
||||||
|
else if (e.key === "ArrowRight" && nav?.newer) nav.go(nav.newer);
|
||||||
|
};
|
||||||
|
document.addEventListener("keydown", onKey);
|
||||||
|
return () => document.removeEventListener("keydown", onKey);
|
||||||
|
}, [onClose, nav]);
|
||||||
|
const chevron = (side: "left" | "right") => {
|
||||||
|
const target = side === "left" ? nav?.older : nav?.newer;
|
||||||
|
const label = t(side === "left" ? "camera.older" : "camera.newer");
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={!target}
|
||||||
|
onClick={() => target && nav?.go(target)}
|
||||||
|
aria-label={label}
|
||||||
|
title={label}
|
||||||
|
className={`absolute top-1/2 ${side === "left" ? "left-2" : "right-2"} flex h-12 w-12 -translate-y-1/2 items-center justify-center rounded-full bg-black/60 text-3xl leading-none text-term-text transition-opacity hover:bg-black/80 disabled:cursor-default disabled:opacity-25 disabled:hover:bg-black/60`}
|
||||||
|
>
|
||||||
|
{side === "left" ? "‹" : "›"}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const seg = (m: "live" | "snapshot", label: string) => (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => onMode(m)}
|
||||||
|
aria-pressed={mode === m}
|
||||||
|
className={`px-3 py-0.5 text-[0.75rem] font-semibold uppercase tracking-wider ${
|
||||||
|
mode === m ? "bg-term-amber text-term-bg" : "text-term-muted hover:text-term-text"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
// Portalled to <body>: the dock is a fixed, z-indexed, pointer-events-none layer that
|
||||||
|
// would otherwise trap the modal inside its stacking context.
|
||||||
|
return createPortal(
|
||||||
|
<div
|
||||||
|
className="fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-6"
|
||||||
|
onClick={onClose}
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-label={title}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="flex w-[min(90vw,calc((100vh-7rem)*16/9))] flex-col overflow-hidden rounded-term border border-term-border bg-term-panel shadow-2xl"
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-3 border-b border-term-border bg-term-panel-2 px-3 py-1.5 text-[0.8125rem]">
|
||||||
|
<span className="min-w-0 flex-1 truncate font-semibold text-term-text">{title}</span>
|
||||||
|
<div className="flex shrink-0 overflow-hidden rounded-term border border-term-border" role="group">
|
||||||
|
{seg("live", t("camera.live"))}
|
||||||
|
{seg("snapshot", t("camera.snapshot"))}
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={onClose}
|
||||||
|
className="shrink-0 text-term-muted hover:text-term-text"
|
||||||
|
aria-label={t("common.close")}
|
||||||
|
title={t("common.close")}
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="relative">
|
||||||
|
{children}
|
||||||
|
{nav && chevron("left")}
|
||||||
|
{nav && chevron("right")}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>,
|
||||||
|
document.body,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Newest snapshot for the tile's resting picture: `meta` is the newest known, `pic` what
|
||||||
|
* is on screen (the previous picture until the newest has loaded). */
|
||||||
|
function useLatestSnapshot(deviceId: string, enabled: boolean) {
|
||||||
|
const meta = useQuery({
|
||||||
|
queryKey: ["camera-latest", deviceId],
|
||||||
|
queryFn: () => fetchLatestCameraSnapshot(deviceId),
|
||||||
|
enabled,
|
||||||
|
staleTime: 60_000,
|
||||||
|
});
|
||||||
|
const pic = useSnapshotPicture(meta.data ?? null);
|
||||||
|
return { meta: meta.data ?? null, pic };
|
||||||
|
}
|
||||||
|
|
||||||
|
type SnapshotPicture = { meta: CameraSnapshotMeta | null; url: string | null; failed: boolean };
|
||||||
|
|
||||||
|
/** A snapshot's bytes as an object URL, paired with the meta it belongs to. On a change
|
||||||
|
* the previous picture (and its meta) stays until the next has loaded — no blank flash
|
||||||
|
* while stepping — then is revoked; `failed` when the last request failed (e.g. pruned
|
||||||
|
* by retention). Everything is revoked on unmount. */
|
||||||
|
function useSnapshotPicture(want: CameraSnapshotMeta | null): SnapshotPicture {
|
||||||
|
const [pic, setPic] = useState<SnapshotPicture>({ meta: null, url: null, failed: false });
|
||||||
|
const current = useRef<string | null>(null);
|
||||||
|
const replace = (next: SnapshotPicture) => {
|
||||||
|
if (current.current && current.current !== next.url) URL.revokeObjectURL(current.current);
|
||||||
|
current.current = next.url;
|
||||||
|
setPic(next);
|
||||||
|
};
|
||||||
|
const id = want?.id ?? null;
|
||||||
|
useEffect(() => {
|
||||||
|
if (!want) {
|
||||||
|
replace({ meta: null, url: null, failed: false });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let cancelled = false;
|
||||||
|
setPic((p) => ({ ...p, failed: false }));
|
||||||
|
fetchSnapshotObjectUrl(want.id)
|
||||||
|
.then((u) => (cancelled ? URL.revokeObjectURL(u) : replace({ meta: want, url: u, failed: false })))
|
||||||
|
.catch(() => !cancelled && setPic((p) => ({ ...p, failed: true })));
|
||||||
|
return () => {
|
||||||
|
cancelled = true;
|
||||||
|
};
|
||||||
|
// Keyed by id only: a new `want` object for the same snapshot must not refetch.
|
||||||
|
}, [id]);
|
||||||
|
useEffect(() => () => replace({ meta: null, url: null, failed: false }), []);
|
||||||
|
return pic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* While `active` (wanted: camera activity, or the user's choice in the large view), hold a live socket to the camera and paint each JPEG into `imgRef`.
|
||||||
|
* Closed (and the last frame dropped) as soon as the camera goes idle or the tile
|
||||||
|
* unmounts; reconnects after a drop while still active. The server shares one camera
|
||||||
|
* session between every viewer and skips frames for a slow one.
|
||||||
|
*/
|
||||||
|
export function useLiveFrames(deviceId: string, active: boolean) {
|
||||||
|
// Every <img> showing this camera (the tile, and the large view while open) gets each
|
||||||
|
// frame; a view that mounts between frames is given the newest one at once.
|
||||||
|
const imgs = useRef(new Map<string, HTMLImageElement>());
|
||||||
|
const latest = useRef<string | null>(null);
|
||||||
|
const imgRefs = useMemo(() => {
|
||||||
|
const slot = (name: string) => (el: HTMLImageElement | null) => {
|
||||||
|
if (el) {
|
||||||
|
imgs.current.set(name, el);
|
||||||
|
if (latest.current) el.src = latest.current;
|
||||||
|
} else {
|
||||||
|
imgs.current.delete(name);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return { tile: slot("tile"), modal: slot("modal"), editor: slot("editor") };
|
||||||
|
}, []);
|
||||||
|
const [status, setStatus] = useState<LiveState>({ state: "connecting" });
|
||||||
|
const [hasFrame, setHasFrame] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!active) {
|
||||||
|
setHasFrame(false);
|
||||||
|
setStatus({ state: "connecting" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let closed = false;
|
||||||
|
let currentUrl: string | null = null;
|
||||||
|
let retry: number | undefined;
|
||||||
|
let sock: ReturnType<typeof createPlatformSocket> | null = null;
|
||||||
|
|
||||||
|
const paint = (buf: ArrayBuffer) => {
|
||||||
|
if (closed) return; // a frame landing after cleanup must not resurrect the view
|
||||||
|
const next = URL.createObjectURL(new Blob([buf], { type: "image/jpeg" }));
|
||||||
|
const prev = currentUrl;
|
||||||
|
currentUrl = next;
|
||||||
|
latest.current = next;
|
||||||
|
for (const img of imgs.current.values()) img.src = next;
|
||||||
|
if (prev) URL.revokeObjectURL(prev);
|
||||||
|
setHasFrame(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const connect = () => {
|
||||||
|
if (closed) return;
|
||||||
|
setStatus({ state: "connecting" });
|
||||||
|
sock = createPlatformSocket(wsUrl(`/api/cameras/${encodeURIComponent(deviceId)}/live`));
|
||||||
|
sock.onmessage = (ev) => {
|
||||||
|
if (closed) return;
|
||||||
|
if (typeof ev.data === "string") {
|
||||||
|
try {
|
||||||
|
const msg = JSON.parse(ev.data) as { kind: string } & LiveState;
|
||||||
|
if (msg.kind === "status") setStatus(msg);
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
paint(ev.data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
sock.onclose = () => {
|
||||||
|
if (closed) return;
|
||||||
|
retry = window.setTimeout(connect, RECONNECT_MS);
|
||||||
|
};
|
||||||
|
sock.onerror = () => sock?.close();
|
||||||
|
};
|
||||||
|
connect();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
closed = true;
|
||||||
|
if (retry) window.clearTimeout(retry);
|
||||||
|
sock?.close();
|
||||||
|
if (currentUrl) URL.revokeObjectURL(currentUrl);
|
||||||
|
latest.current = null;
|
||||||
|
for (const img of imgs.current.values()) img.removeAttribute("src");
|
||||||
|
};
|
||||||
|
}, [deviceId, active]);
|
||||||
|
|
||||||
|
return { imgRefs, status, hasFrame };
|
||||||
|
}
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import {
|
||||||
|
CROSSING_MIN_LENGTH,
|
||||||
|
type CrossingDirection,
|
||||||
|
type CrossingLine,
|
||||||
|
type FramePoint,
|
||||||
|
} from "@parking/shared";
|
||||||
|
import { useLiveFrames } from "./CameraDock.js";
|
||||||
|
|
||||||
|
// Draws a camera's crossing line over its live picture — our own version of a Hikvision
|
||||||
|
// Line Crossing rule, for cameras that have none: a segment, sides A and B, and which
|
||||||
|
// crossing counts (A→B, B→A, A↔B). Points are normalised to the frame, so the line holds
|
||||||
|
// at any display size. Side A is the screen-left of p1→p2 (see crossingSide in shared).
|
||||||
|
|
||||||
|
type Drag = { end: "p1" | "p2" } | null;
|
||||||
|
|
||||||
|
const HANDLE_PX = 14; // grab radius around an end point
|
||||||
|
|
||||||
|
export function CrossingLineEditor({
|
||||||
|
deviceId,
|
||||||
|
value,
|
||||||
|
onChange,
|
||||||
|
}: {
|
||||||
|
deviceId: string;
|
||||||
|
value: CrossingLine | null;
|
||||||
|
onChange: (next: CrossingLine | null) => void;
|
||||||
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const live = useLiveFrames(deviceId, true);
|
||||||
|
const surface = useRef<SVGSVGElement | null>(null);
|
||||||
|
const [size, setSize] = useState({ w: 0, h: 0 });
|
||||||
|
const [drag, setDrag] = useState<Drag>(null);
|
||||||
|
// While drawing a new line it lives here, so a click-length line never reaches the form.
|
||||||
|
const [draft, setDraft] = useState<CrossingLine | null>(null);
|
||||||
|
const line = draft ?? value;
|
||||||
|
|
||||||
|
// The overlay sits exactly on the picture (the wrapper is sized by the <img>), so its
|
||||||
|
// rectangle IS the frame: no letterbox offset to correct for.
|
||||||
|
useEffect(() => {
|
||||||
|
const el = surface.current;
|
||||||
|
if (!el) return;
|
||||||
|
const ro = new ResizeObserver(([e]) => e && setSize({ w: e.contentRect.width, h: e.contentRect.height }));
|
||||||
|
ro.observe(el);
|
||||||
|
return () => ro.disconnect();
|
||||||
|
}, [live.hasFrame]);
|
||||||
|
|
||||||
|
const toFrame = (ev: React.PointerEvent): FramePoint => {
|
||||||
|
const r = surface.current!.getBoundingClientRect();
|
||||||
|
const clamp = (v: number) => Math.min(1, Math.max(0, v));
|
||||||
|
return { x: clamp((ev.clientX - r.left) / r.width), y: clamp((ev.clientY - r.top) / r.height) };
|
||||||
|
};
|
||||||
|
const px = (p: FramePoint) => ({ x: p.x * size.w, y: p.y * size.h });
|
||||||
|
|
||||||
|
function onDown(ev: React.PointerEvent<SVGSVGElement>) {
|
||||||
|
if (!live.hasFrame) return;
|
||||||
|
ev.currentTarget.setPointerCapture(ev.pointerId);
|
||||||
|
const at = toFrame(ev);
|
||||||
|
if (value) {
|
||||||
|
for (const end of ["p1", "p2"] as const) {
|
||||||
|
const e = px(value[end]);
|
||||||
|
const a = px(at);
|
||||||
|
if (Math.hypot(e.x - a.x, e.y - a.y) <= HANDLE_PX) {
|
||||||
|
setDrag({ end });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Anywhere else: draw a new line from here, keeping the chosen direction.
|
||||||
|
setDraft({ p1: at, p2: at, direction: value?.direction ?? "a-to-b" });
|
||||||
|
setDrag({ end: "p2" });
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMove(ev: React.PointerEvent<SVGSVGElement>) {
|
||||||
|
if (!drag) return;
|
||||||
|
const at = toFrame(ev);
|
||||||
|
if (draft) setDraft({ ...draft, [drag.end]: at });
|
||||||
|
else if (value) onChange({ ...value, [drag.end]: at });
|
||||||
|
}
|
||||||
|
|
||||||
|
function onUp() {
|
||||||
|
if (draft && Math.hypot(draft.p2.x - draft.p1.x, draft.p2.y - draft.p1.y) >= CROSSING_MIN_LENGTH) {
|
||||||
|
onChange(draft);
|
||||||
|
}
|
||||||
|
setDraft(null);
|
||||||
|
setDrag(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
const directions: [CrossingDirection, string][] = [
|
||||||
|
["a-to-b", "A → B"],
|
||||||
|
["b-to-a", "B → A"],
|
||||||
|
["both", "A ↔ B"],
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="my-2 rounded-term border border-term-border bg-term-bg p-2 text-[0.75rem]">
|
||||||
|
<div className="font-semibold text-term-text">{t("setup.crossingTitle")}</div>
|
||||||
|
<p className="hint mt-0.5">{t("setup.crossingHint")}</p>
|
||||||
|
|
||||||
|
<div className="relative mt-2 inline-block w-full select-none">
|
||||||
|
<img
|
||||||
|
ref={live.imgRefs.editor}
|
||||||
|
alt=""
|
||||||
|
draggable={false}
|
||||||
|
className={live.hasFrame ? "block h-auto w-full" : "hidden"}
|
||||||
|
/>
|
||||||
|
{!live.hasFrame && (
|
||||||
|
<div className="flex aspect-video w-full items-center justify-center rounded bg-term-panel text-term-muted">
|
||||||
|
{live.status.state === "unavailable" || live.status.state === "retrying"
|
||||||
|
? live.status.reason
|
||||||
|
: t("setup.crossingWaiting")}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{live.hasFrame && (
|
||||||
|
<svg
|
||||||
|
ref={surface}
|
||||||
|
className="absolute inset-0 h-full w-full cursor-crosshair touch-none"
|
||||||
|
onPointerDown={onDown}
|
||||||
|
onPointerMove={onMove}
|
||||||
|
onPointerUp={onUp}
|
||||||
|
onPointerCancel={onUp}
|
||||||
|
>
|
||||||
|
{line && size.w > 0 && <LineOverlay line={line} p1={px(line.p1)} p2={px(line.p2)} />}
|
||||||
|
</svg>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mt-2 flex flex-wrap items-center gap-2">
|
||||||
|
<div className="flex gap-1" role="radiogroup" aria-label={t("setup.crossingDirection")}>
|
||||||
|
{directions.map(([d, label]) => (
|
||||||
|
<button
|
||||||
|
key={d}
|
||||||
|
type="button"
|
||||||
|
role="radio"
|
||||||
|
aria-checked={value?.direction === d}
|
||||||
|
disabled={!value}
|
||||||
|
className={`btn btn-sm ${value?.direction === d ? "btn-primary" : ""}`}
|
||||||
|
onClick={() => value && onChange({ ...value, direction: d })}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-sm"
|
||||||
|
disabled={!value}
|
||||||
|
onClick={() => value && onChange({ ...value, p1: value.p2, p2: value.p1 })}
|
||||||
|
>
|
||||||
|
{t("setup.crossingSwap")}
|
||||||
|
</button>
|
||||||
|
<button type="button" className="btn btn-sm" disabled={!value} onClick={() => onChange(null)}>
|
||||||
|
{t("setup.crossingClear")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{!value && <p className="hint mt-1">{t("setup.crossingNone")}</p>}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The segment, its end handles, the A/B labels either side, and an arrow across the
|
||||||
|
* middle pointing the way that counts (double-headed for A↔B). Pixel space. */
|
||||||
|
function LineOverlay({ line, p1, p2 }: { line: CrossingLine; p1: FramePoint; p2: FramePoint }) {
|
||||||
|
const dx = p2.x - p1.x;
|
||||||
|
const dy = p2.y - p1.y;
|
||||||
|
const len = Math.hypot(dx, dy) || 1;
|
||||||
|
// Unit normal toward side A: the screen-left of p1→p2 (y down) is (dy, -dx).
|
||||||
|
const nA = { x: dy / len, y: -dx / len };
|
||||||
|
const mid = { x: (p1.x + p2.x) / 2, y: (p1.y + p2.y) / 2 };
|
||||||
|
const at = (k: number) => ({ x: mid.x + nA.x * k, y: mid.y + nA.y * k });
|
||||||
|
const aSide = at(22);
|
||||||
|
const bSide = at(-22);
|
||||||
|
const labelA = at(40);
|
||||||
|
const labelB = at(-40);
|
||||||
|
// Arrow runs from the side crossings start on to the side they end on.
|
||||||
|
const [from, to] = line.direction === "b-to-a" ? [bSide, aSide] : [aSide, bSide];
|
||||||
|
const both = line.direction === "both";
|
||||||
|
const stroke = "rgb(250 204 21)"; // amber, readable over daylight and night pictures
|
||||||
|
return (
|
||||||
|
<g>
|
||||||
|
<defs>
|
||||||
|
<marker id="crossing-head" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="5" markerHeight="5" orient="auto-start-reverse">
|
||||||
|
<path d="M0,0 L10,5 L0,10 z" fill={stroke} />
|
||||||
|
</marker>
|
||||||
|
</defs>
|
||||||
|
<line x1={p1.x} y1={p1.y} x2={p2.x} y2={p2.y} stroke="black" strokeOpacity={0.5} strokeWidth={5} />
|
||||||
|
<line x1={p1.x} y1={p1.y} x2={p2.x} y2={p2.y} stroke={stroke} strokeWidth={3} />
|
||||||
|
<line
|
||||||
|
x1={from.x}
|
||||||
|
y1={from.y}
|
||||||
|
x2={to.x}
|
||||||
|
y2={to.y}
|
||||||
|
stroke={stroke}
|
||||||
|
strokeWidth={3}
|
||||||
|
markerEnd="url(#crossing-head)"
|
||||||
|
markerStart={both ? "url(#crossing-head)" : undefined}
|
||||||
|
/>
|
||||||
|
{[p1, p2].map((p, i) => (
|
||||||
|
<circle key={i} cx={p.x} cy={p.y} r={6} fill={stroke} stroke="black" strokeWidth={1.5} />
|
||||||
|
))}
|
||||||
|
{(
|
||||||
|
[
|
||||||
|
["A", labelA],
|
||||||
|
["B", labelB],
|
||||||
|
] as const
|
||||||
|
).map(([txt, p]) => (
|
||||||
|
<text
|
||||||
|
key={txt}
|
||||||
|
x={p.x}
|
||||||
|
y={p.y}
|
||||||
|
textAnchor="middle"
|
||||||
|
dominantBaseline="central"
|
||||||
|
fontSize={16}
|
||||||
|
fontWeight={700}
|
||||||
|
fill={stroke}
|
||||||
|
stroke="black"
|
||||||
|
strokeWidth={3}
|
||||||
|
paintOrder="stroke"
|
||||||
|
>
|
||||||
|
{txt}
|
||||||
|
</text>
|
||||||
|
))}
|
||||||
|
</g>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import { fetchDeviceStatus, type DeviceStatus } from "../api.js";
|
|||||||
import { formatClock } from "../lib/format.js";
|
import { formatClock } from "../lib/format.js";
|
||||||
import { qk } from "../lib/query.js";
|
import { qk } from "../lib/query.js";
|
||||||
import { useLiveStore } from "../lib/live-store.js";
|
import { useLiveStore } from "../lib/live-store.js";
|
||||||
|
import { CameraDock } from "./CameraDock.js";
|
||||||
|
|
||||||
// Fixed device-status footer for the booth chrome. One compact chip per configured
|
// Fixed device-status footer for the booth chrome. One compact chip per configured
|
||||||
// device — relays, readers, cameras, printers — labelled by ROLE, never vendor
|
// device — relays, readers, cameras, printers — labelled by ROLE, never vendor
|
||||||
@@ -66,7 +67,18 @@ function sortDevices(list: DeviceStatus[]): DeviceStatus[] {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DeviceFooter() {
|
export function DeviceFooter({
|
||||||
|
openCameras,
|
||||||
|
onToggleCamera,
|
||||||
|
canSeeSnapshots,
|
||||||
|
}: {
|
||||||
|
/** Camera tiles open (device ids, opening order) — the user's saved preference. */
|
||||||
|
openCameras: string[];
|
||||||
|
/** Open/close a camera's tile (a camera chip click). */
|
||||||
|
onToggleCamera: (deviceId: string) => void;
|
||||||
|
/** May the user see evidence snapshots (session:read) — the tiles' resting picture. */
|
||||||
|
canSeeSnapshots: boolean;
|
||||||
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const label = useLabel();
|
const label = useLabel();
|
||||||
// Seed/fallback from REST; the WS keeps the live store authoritative thereafter.
|
// Seed/fallback from REST; the WS keeps the live store authoritative thereafter.
|
||||||
@@ -111,17 +123,33 @@ export function DeviceFooter() {
|
|||||||
) : (
|
) : (
|
||||||
devices.map((d) => {
|
devices.map((d) => {
|
||||||
const isProblem = d.state !== "ready";
|
const isProblem = d.state !== "ready";
|
||||||
|
// A CAMERA chip opens/closes that camera's tile (its issues stay reachable
|
||||||
|
// from the roll-up on the right); any other chip is interactive only when
|
||||||
|
// it has a problem (opens the issues panel).
|
||||||
|
const isCamera = d.category === "camera";
|
||||||
|
const isOpen = isCamera && openCameras.includes(d.deviceId);
|
||||||
|
const onClick = isCamera
|
||||||
|
? () => onToggleCamera(d.deviceId)
|
||||||
|
: isProblem
|
||||||
|
? () => setOpen((v) => !v)
|
||||||
|
: undefined;
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
key={d.deviceId}
|
key={d.deviceId}
|
||||||
type="button"
|
type="button"
|
||||||
// Only a problem chip is interactive (opens the issues panel).
|
onClick={onClick}
|
||||||
onClick={isProblem ? () => setOpen((v) => !v) : undefined}
|
aria-disabled={!onClick}
|
||||||
aria-disabled={!isProblem}
|
aria-pressed={isCamera ? isOpen : undefined}
|
||||||
title={isProblem ? t("devices.clickForIssues") : undefined}
|
title={
|
||||||
className={`flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-term border border-term-border bg-term-panel-2 px-2 py-0.5 ${
|
isCamera
|
||||||
isProblem ? "cursor-pointer hover:border-term-amber" : "cursor-default"
|
? t(isOpen ? "camera.hideTile" : "camera.showTile")
|
||||||
}`}
|
: isProblem
|
||||||
|
? t("devices.clickForIssues")
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
className={`flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-term border bg-term-panel-2 px-2 py-0.5 ${
|
||||||
|
isOpen ? "border-term-amber" : "border-term-border"
|
||||||
|
} ${onClick ? "cursor-pointer hover:border-term-amber" : "cursor-default"}`}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className={`inline-block h-2 w-2 shrink-0 rounded-full ${DOT[d.state]} ${
|
className={`inline-block h-2 w-2 shrink-0 rounded-full ${DOT[d.state]} ${
|
||||||
@@ -153,6 +181,15 @@ export function DeviceFooter() {
|
|||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{/* Camera tiles, docked bottom-right above this footer. */}
|
||||||
|
<CameraDock
|
||||||
|
openIds={openCameras}
|
||||||
|
cameras={devices.filter((d) => d.category === "camera")}
|
||||||
|
label={label}
|
||||||
|
canSeeSnapshots={canSeeSnapshots}
|
||||||
|
onClose={onToggleCamera}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* Issues panel — anchored above the footer, lists only problem devices. */}
|
{/* Issues panel — anchored above the footer, lists only problem devices. */}
|
||||||
{open && problems.length > 0 && (
|
{open && problems.length > 0 && (
|
||||||
<div className="absolute bottom-full right-2 z-50 mb-1 w-[360px] max-w-[95vw] rounded-term border border-term-border bg-term-panel shadow-2xl">
|
<div className="absolute bottom-full right-2 z-50 mb-1 w-[360px] max-w-[95vw] rounded-term border border-term-border bg-term-panel shadow-2xl">
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
# relay-proxy — Dingtian emulator + cloud proxy/watchdog (PoC)
|
||||||
|
|
||||||
|
A NodeMCU v3 (ESP8266) that **is a Dingtian DT-R004 to the booth server** and, on top, a
|
||||||
|
**proxy and watchdog toward a cloud service**. The booth's existing `dingtian` driver talks to
|
||||||
|
it unchanged. It is the seed of the custom firmware for the real Dingtian board (ESP32); the IO
|
||||||
|
layer is the only board-specific file.
|
||||||
|
|
||||||
|
Why: park-2's booth PC died twice unnoticed. The device that already owns the barrier relay and
|
||||||
|
the button inputs becomes the resilient core: it reports to the cloud independently of the PC,
|
||||||
|
can power-cycle the PC, and keeps accepting commands from the cloud when the PC is dead.
|
||||||
|
See `wiki/entities/dingtian-relay.md` and `wiki/decisions/cloud-service-saas.md`.
|
||||||
|
|
||||||
|
## What it emulates (the booth sees a DT-R004)
|
||||||
|
|
||||||
|
| Surface | Behaviour |
|
||||||
|
| --- | --- |
|
||||||
|
| UDP 60000 binary | `FF AA s cmd pwLo pwHi …`: `00` status, `01` write (mask,set), `03` jog. Reply `FF AA s cmd relayByte inputByte`. Wrong `relay_pw` → dropped silently. |
|
||||||
|
| UDP 60001 string | `00`, `1N`, `2N`, `1N*`. Password-less. Enabled at factory; `harden()` turns it off (`udp2.p=255`). |
|
||||||
|
| `GET /api/v2/config.cgi` | The config JSON (relay_connect, input_link_relay, input_link_url). |
|
||||||
|
| `POST /api/v2/config_set.cgi` | Applies + persists (LittleFS). Requires `"command":"setconfig"` like the real device. |
|
||||||
|
| `GET /userset.cgi?u&old&u&new&` | Web-login rotation, `&0&` ok / `&2&` wrong old password. |
|
||||||
|
| Input push | On input change, Digest-authenticated GET to the booth's `on_path`/`off_path`. |
|
||||||
|
| `input_link_relay` | Factory ON (input auto-fires its relay) until the booth's precondition fix clears it. |
|
||||||
|
|
||||||
|
Extra, PoC-only: `GET /` status text, `POST /poc/factory_reset`.
|
||||||
|
|
||||||
|
## Proxy / watchdog (toward `CLOUD_URL`)
|
||||||
|
|
||||||
|
- Heartbeat every 10 s: IP, booth health, relay/input state, config flags.
|
||||||
|
- Every input change is mirrored to the cloud (`/event`) with the booth push result.
|
||||||
|
- Command poll every 2 s: `{"pulse":ch,"ms":500}`, `{"watchdog":false}`, `{"reboot_pc":true}`.
|
||||||
|
- Watchdog: probes `BOOTH_HEALTH_URL` every 5 s; after 6 failures in a row it pulses relay 2
|
||||||
|
for 3 s (meant for an NC contact in series with the PC's mains, with BIOS AC Recovery = On),
|
||||||
|
then backs off 10 min. The cloud can disable it.
|
||||||
|
|
||||||
|
## Pins (NodeMCU v3) — no wiring needed to start
|
||||||
|
|
||||||
|
| Function | Pin |
|
||||||
|
| --- | --- |
|
||||||
|
| Relay 1 (barrier) | D1 / GPIO5, mirrored on the on-board LED |
|
||||||
|
| Relay 2 (PC power) | D2 / GPIO4 |
|
||||||
|
| Relay 3, 4 | D5 / GPIO14, D6 / GPIO12 |
|
||||||
|
| Input 1 (button) | the on-board **FLASH** button (GPIO0), active LOW |
|
||||||
|
| Input 2 | D7 / GPIO13, short to GND |
|
||||||
|
|
||||||
|
## Build / flash
|
||||||
|
|
||||||
|
```
|
||||||
|
cd firmware/relay-proxy
|
||||||
|
copy include\secrets.h.example include\secrets.h # fill in; gitignored
|
||||||
|
..\.venv\Scripts\pio run -t upload
|
||||||
|
..\.venv\Scripts\pio device monitor
|
||||||
|
```
|
||||||
|
|
||||||
|
Cloud stand-in (throwaway): `node poc/cloud-standin.mjs` on a host the device can reach.
|
||||||
|
|
||||||
|
## Register it in the booth
|
||||||
|
|
||||||
|
Devices → add **Dingtian relay controller**: host = the NodeMCU's IP (give it a DHCP
|
||||||
|
reservation or set `STATIC_IP`; the booth only accepts pushes from the registered IP),
|
||||||
|
channels 4, binary port 60000, string port 60001, HTTP port 80. On save the booth runs the
|
||||||
|
normal flow: precondition fix (clears `input_link_relay`), `harden()` (random `relay_pw`,
|
||||||
|
disables udp2, rotates the web login), and `configureInputPush()` (Digest creds + URLs).
|
||||||
|
The serial log shows each step land.
|
||||||
|
|
||||||
|
## Limits of the PoC
|
||||||
|
|
||||||
|
- Wi-Fi only; the real target has Ethernet.
|
||||||
|
- HTTP calls block the loop briefly (~100 ms); fine for a demo, not for production.
|
||||||
|
- The config JSON mirrors the keys the booth driver uses, not the full device schema.
|
||||||
|
- Plain HTTP to the cloud stand-in; the real cloud link needs TLS.
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <ArduinoJson.h>
|
||||||
|
|
||||||
|
// The Dingtian-shaped config served by /api/v2/config.cgi, persisted to LittleFS.
|
||||||
|
// Holds exactly the keys the booth driver reads/writes (relay_connect, input_link_relay,
|
||||||
|
// input_link_url) — a faithful-enough subset, not a byte copy of the real device.
|
||||||
|
class ConfigStore {
|
||||||
|
public:
|
||||||
|
JsonDocument cfg;
|
||||||
|
String webUser, webPass; // web-UI login (userset.cgi), kept out of config.cgi
|
||||||
|
|
||||||
|
void begin();
|
||||||
|
bool save();
|
||||||
|
bool saveWeb();
|
||||||
|
void makeDefaults();
|
||||||
|
|
||||||
|
uint16_t relayPw() const;
|
||||||
|
bool stringProtoEnabled() const; // udp2.p != 255
|
||||||
|
bool linkRelayEnabled() const; // input_link_relay flag (factory: on)
|
||||||
|
};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
// HTTP GET with RFC 2617 Digest (MD5, qop=auth) — what the booth's push route
|
||||||
|
// requires. First GET takes the 401 challenge, second carries the response.
|
||||||
|
// With an empty user it is a plain GET. Returns the final HTTP status (<0 = no connection).
|
||||||
|
int digestGet(const String& host, uint16_t port, const String& path, const String& user, const String& pass);
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
constexpr int CHANNELS = 4;
|
||||||
|
|
||||||
|
// Relay/input IO behind one tiny interface. Business code never touches pins, so
|
||||||
|
// porting to the real Dingtian board (74HC595 relays / 74HC165 inputs) swaps only
|
||||||
|
// the Io implementation file.
|
||||||
|
class Io {
|
||||||
|
public:
|
||||||
|
void begin();
|
||||||
|
void setRelay(int ch, bool on); // 1-based
|
||||||
|
bool relay(int ch) const; // 1-based
|
||||||
|
bool inputHigh(int ch); // raw line level, 1-based
|
||||||
|
uint8_t relayMask() const; // bit0 = relay 1
|
||||||
|
uint8_t inputMask(); // bit0 = input 1, bit set = line HIGH
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool relays_[CHANNELS] = {};
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// Copy to include/secrets.h (gitignored) and fill in.
|
||||||
|
#pragma once
|
||||||
|
#define WIFI_SSID "your-ssid"
|
||||||
|
#define WIFI_PASS "your-password"
|
||||||
|
// Ephemeral cloud stand-in (poc/cloud-standin.mjs), plain HTTP for the PoC.
|
||||||
|
#define CLOUD_URL "http://10.0.10.203:9099"
|
||||||
|
// Booth server health endpoint the watchdog probes.
|
||||||
|
#define BOOTH_HEALTH_URL "http://10.0.10.198/health"
|
||||||
|
// Optional fixed address (the booth only accepts pushes from the registered host IP).
|
||||||
|
// #define STATIC_IP "10.0.10.240"
|
||||||
|
// #define STATIC_GW "10.0.10.1"
|
||||||
|
// #define STATIC_MASK "255.255.255.0"
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
; relay-proxy — Dingtian DT-R004 emulator + cloud proxy/watchdog PoC.
|
||||||
|
; NodeMCU v3 (ESP8266) now; an esp32 env is the port target for the real Dingtian board.
|
||||||
|
[platformio]
|
||||||
|
default_envs = nodemcuv2
|
||||||
|
|
||||||
|
[env:nodemcuv2]
|
||||||
|
platform = espressif8266
|
||||||
|
board = nodemcuv2
|
||||||
|
framework = arduino
|
||||||
|
board_build.filesystem = littlefs
|
||||||
|
monitor_speed = 115200
|
||||||
|
upload_speed = 460800
|
||||||
|
upload_port = COM35
|
||||||
|
monitor_port = COM35
|
||||||
|
lib_deps = bblanchon/ArduinoJson@^7.3.0
|
||||||
|
build_flags = -Wall
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
// EPHEMERAL cloud stand-in for the relay-proxy PoC. Not a product component.
|
||||||
|
// Logs heartbeats/events from the device and lets you queue commands with curl.
|
||||||
|
//
|
||||||
|
// node poc/cloud-standin.mjs (listens on 0.0.0.0:9099)
|
||||||
|
// curl http://localhost:9099/ -> last heartbeat per device
|
||||||
|
// curl -X POST http://localhost:9099/fire/1 -> pulse relay 1 (500 ms)
|
||||||
|
// curl -X POST "http://localhost:9099/fire/1?ms=1000"
|
||||||
|
// curl -X POST http://localhost:9099/watchdog/off -> disable the PC watchdog
|
||||||
|
// curl -X POST http://localhost:9099/reboot-pc -> power-cycle the PC relay
|
||||||
|
import { createServer } from "node:http";
|
||||||
|
|
||||||
|
const PORT = Number(process.env.PORT ?? 9099);
|
||||||
|
const last = new Map(); // dev -> last heartbeat
|
||||||
|
const queue = []; // commands, oldest first (dev field optional)
|
||||||
|
const stamp = () => new Date().toISOString().slice(11, 19);
|
||||||
|
|
||||||
|
function body(req) {
|
||||||
|
return new Promise((res) => {
|
||||||
|
let s = "";
|
||||||
|
req.on("data", (c) => (s += c));
|
||||||
|
req.on("end", () => {
|
||||||
|
try { res(s ? JSON.parse(s) : {}); } catch { res({ raw: s }); }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const json = (res, code, obj) => {
|
||||||
|
res.writeHead(code, { "content-type": "application/json" });
|
||||||
|
res.end(JSON.stringify(obj));
|
||||||
|
};
|
||||||
|
|
||||||
|
createServer(async (req, res) => {
|
||||||
|
const url = new URL(req.url, "http://x");
|
||||||
|
const p = url.pathname;
|
||||||
|
|
||||||
|
if (req.method === "POST" && p === "/heartbeat") {
|
||||||
|
const hb = await body(req);
|
||||||
|
const prev = last.get(hb.dev);
|
||||||
|
last.set(hb.dev, { ...hb, at: new Date().toISOString() });
|
||||||
|
const flip = prev && prev.booth_ok !== hb.booth_ok ? ` <-- booth ${hb.booth_ok ? "RECOVERED" : "DOWN"}` : "";
|
||||||
|
console.log(`${stamp()} hb ${hb.dev} ip=${hb.ip} booth=${hb.booth_ok ? "up" : "DOWN"}(${hb.booth_code}) fails=${hb.booth_fails} wd=${hb.watchdog} resets=${hb.pc_resets} relays=${hb.relays} inputs=${hb.inputs} pw=${hb.relay_pw_set} push=${hb.push_en} link=${hb.link_relay} udp2=${hb.string_proto} heap=${hb.heap}${flip}`);
|
||||||
|
return json(res, 200, { ok: true });
|
||||||
|
}
|
||||||
|
if (req.method === "POST" && p === "/event") {
|
||||||
|
const ev = await body(req);
|
||||||
|
console.log(`${stamp()} EVENT ${ev.dev} ${ev.type} input=${ev.input} active=${ev.active} booth_status=${ev.booth_status}`);
|
||||||
|
return json(res, 200, { ok: true });
|
||||||
|
}
|
||||||
|
if (req.method === "GET" && p === "/command") {
|
||||||
|
const dev = url.searchParams.get("dev");
|
||||||
|
const i = queue.findIndex((c) => !c.dev || c.dev === dev);
|
||||||
|
if (i < 0) return json(res, 200, {});
|
||||||
|
const [cmd] = queue.splice(i, 1);
|
||||||
|
console.log(`${stamp()} -> ${dev} command ${JSON.stringify(cmd)}`);
|
||||||
|
return json(res, 200, cmd);
|
||||||
|
}
|
||||||
|
if (req.method === "POST" && p.startsWith("/fire/")) {
|
||||||
|
const ch = Number(p.split("/")[2]);
|
||||||
|
const ms = Number(url.searchParams.get("ms") ?? 500);
|
||||||
|
queue.push({ pulse: ch, ms });
|
||||||
|
console.log(`${stamp()} queued pulse relay ${ch} ${ms} ms`);
|
||||||
|
return json(res, 200, { queued: true });
|
||||||
|
}
|
||||||
|
if (req.method === "POST" && p.startsWith("/watchdog/")) {
|
||||||
|
const on = p.endsWith("/on");
|
||||||
|
queue.push({ watchdog: on });
|
||||||
|
console.log(`${stamp()} queued watchdog ${on ? "on" : "off"}`);
|
||||||
|
return json(res, 200, { queued: true });
|
||||||
|
}
|
||||||
|
if (req.method === "POST" && p === "/reboot-pc") {
|
||||||
|
queue.push({ reboot_pc: true });
|
||||||
|
console.log(`${stamp()} queued PC power-cycle`);
|
||||||
|
return json(res, 200, { queued: true });
|
||||||
|
}
|
||||||
|
if (req.method === "GET" && p === "/") {
|
||||||
|
return json(res, 200, { devices: Object.fromEntries(last), queued: queue });
|
||||||
|
}
|
||||||
|
json(res, 404, { error: "not found" });
|
||||||
|
}).listen(PORT, "0.0.0.0", () => console.log(`cloud stand-in on :${PORT} (PoC only)`));
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
#include "config_store.h"
|
||||||
|
#include <LittleFS.h>
|
||||||
|
#include "io.h"
|
||||||
|
|
||||||
|
static const char* CFG_PATH = "/config.json";
|
||||||
|
static const char* WEB_PATH = "/web.json";
|
||||||
|
|
||||||
|
void ConfigStore::makeDefaults() {
|
||||||
|
cfg.clear();
|
||||||
|
cfg["status"] = 0;
|
||||||
|
JsonObject rc = cfg["relay_connect"].to<JsonObject>();
|
||||||
|
rc["relay_pw"] = 0;
|
||||||
|
// Factory: udp1 = binary, udp2 = string (password-less!), everything else off.
|
||||||
|
rc["udp1"]["p"] = 1; rc["udp1"]["port"] = 60000;
|
||||||
|
rc["udp2"]["p"] = 0; rc["udp2"]["port"] = 60001;
|
||||||
|
rc["rs485"]["p"] = 255; rc["can"]["p"] = 255;
|
||||||
|
rc["tcpc"]["p"] = 255; rc["tcps"]["p"] = 255;
|
||||||
|
rc["mqtt"]["p"] = 255;
|
||||||
|
// Factory: every input auto-fires its matching relay (the UHPPOTE-style gotcha
|
||||||
|
// the booth's precondition fix turns off).
|
||||||
|
JsonObject ilr = cfg["input_link_relay"].to<JsonObject>();
|
||||||
|
ilr["input_link_relay"] = 1;
|
||||||
|
JsonArray oa = ilr["on_action_on"].to<JsonArray>();
|
||||||
|
for (int i = 0; i < CHANNELS; i++) oa.add<JsonArray>().add(i);
|
||||||
|
JsonObject ilu = cfg["input_link_url"].to<JsonObject>();
|
||||||
|
ilu["cnt"] = CHANNELS;
|
||||||
|
ilu["en"] = 0;
|
||||||
|
const char* intKeys[] = {"active_level", "tls", "auth", "on_method", "off_method"};
|
||||||
|
for (const char* k : intKeys) {
|
||||||
|
JsonArray a = ilu[k].to<JsonArray>();
|
||||||
|
for (int i = 0; i < CHANNELS; i++) a.add(0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
JsonArray a = ilu["port"].to<JsonArray>();
|
||||||
|
for (int i = 0; i < CHANNELS; i++) a.add(80);
|
||||||
|
}
|
||||||
|
const char* strKeys[] = {"server", "user", "pass", "on_path", "off_path", "on_body", "off_body"};
|
||||||
|
for (const char* k : strKeys) {
|
||||||
|
JsonArray a = ilu[k].to<JsonArray>();
|
||||||
|
for (int i = 0; i < CHANNELS; i++) a.add("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigStore::begin() {
|
||||||
|
LittleFS.begin();
|
||||||
|
bool ok = false;
|
||||||
|
File f = LittleFS.open(CFG_PATH, "r");
|
||||||
|
if (f) {
|
||||||
|
ok = deserializeJson(cfg, f) == DeserializationError::Ok;
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
|
if (!ok || !cfg["relay_connect"].is<JsonObject>()) {
|
||||||
|
makeDefaults();
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
webUser = "admin";
|
||||||
|
webPass = "admin";
|
||||||
|
File w = LittleFS.open(WEB_PATH, "r");
|
||||||
|
if (w) {
|
||||||
|
JsonDocument d;
|
||||||
|
if (deserializeJson(d, w) == DeserializationError::Ok) {
|
||||||
|
webUser = d["user"] | "admin";
|
||||||
|
webPass = d["pass"] | "admin";
|
||||||
|
}
|
||||||
|
w.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ConfigStore::save() {
|
||||||
|
File f = LittleFS.open(CFG_PATH, "w");
|
||||||
|
if (!f) return false;
|
||||||
|
serializeJson(cfg, f);
|
||||||
|
f.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ConfigStore::saveWeb() {
|
||||||
|
JsonDocument d;
|
||||||
|
d["user"] = webUser;
|
||||||
|
d["pass"] = webPass;
|
||||||
|
File f = LittleFS.open(WEB_PATH, "w");
|
||||||
|
if (!f) return false;
|
||||||
|
serializeJson(d, f);
|
||||||
|
f.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t ConfigStore::relayPw() const { return cfg["relay_connect"]["relay_pw"] | 0; }
|
||||||
|
bool ConfigStore::stringProtoEnabled() const { return (cfg["relay_connect"]["udp2"]["p"] | 255) != 255; }
|
||||||
|
bool ConfigStore::linkRelayEnabled() const { return (cfg["input_link_relay"]["input_link_relay"] | 0) == 1; }
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
#include "digest.h"
|
||||||
|
#include <ESP8266WiFi.h>
|
||||||
|
#include <ESP8266HTTPClient.h>
|
||||||
|
#include <MD5Builder.h>
|
||||||
|
|
||||||
|
static String md5(const String& s) {
|
||||||
|
MD5Builder m;
|
||||||
|
m.begin();
|
||||||
|
m.add(s);
|
||||||
|
m.calculate();
|
||||||
|
return m.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pull key="value" or key=value out of a challenge header.
|
||||||
|
static String param(const String& h, const char* key) {
|
||||||
|
String k = String(key) + "=";
|
||||||
|
int i = h.indexOf(k);
|
||||||
|
if (i < 0) return "";
|
||||||
|
i += k.length();
|
||||||
|
if (h[i] == '"') {
|
||||||
|
int j = h.indexOf('"', i + 1);
|
||||||
|
return j < 0 ? "" : h.substring(i + 1, j);
|
||||||
|
}
|
||||||
|
int j = h.indexOf(',', i);
|
||||||
|
return j < 0 ? h.substring(i) : h.substring(i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
int digestGet(const String& host, uint16_t port, const String& path, const String& user, const String& pass) {
|
||||||
|
WiFiClient client;
|
||||||
|
HTTPClient http;
|
||||||
|
http.setTimeout(2000);
|
||||||
|
if (!http.begin(client, host, port, path)) return -1;
|
||||||
|
const char* keys[] = {"WWW-Authenticate"};
|
||||||
|
http.collectHeaders(keys, 1);
|
||||||
|
int code = http.GET();
|
||||||
|
if (code != 401 || user.isEmpty()) {
|
||||||
|
http.end();
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
String ch = http.header("WWW-Authenticate");
|
||||||
|
http.end();
|
||||||
|
if (!ch.startsWith("Digest")) return 401;
|
||||||
|
|
||||||
|
String realm = param(ch, "realm"), nonce = param(ch, "nonce"), qop = param(ch, "qop");
|
||||||
|
String nc = "00000001";
|
||||||
|
String cnonce = String(ESP.random(), HEX);
|
||||||
|
String ha1 = md5(user + ":" + realm + ":" + pass);
|
||||||
|
String ha2 = md5("GET:" + path);
|
||||||
|
String resp = qop.length() ? md5(ha1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + ha2)
|
||||||
|
: md5(ha1 + ":" + nonce + ":" + ha2);
|
||||||
|
String auth = "Digest username=\"" + user + "\", realm=\"" + realm + "\", nonce=\"" + nonce +
|
||||||
|
"\", uri=\"" + path + "\", algorithm=MD5, response=\"" + resp + "\"";
|
||||||
|
if (qop.length()) auth += ", qop=" + qop + ", nc=" + nc + ", cnonce=\"" + cnonce + "\"";
|
||||||
|
|
||||||
|
HTTPClient h2;
|
||||||
|
h2.setTimeout(2000);
|
||||||
|
if (!h2.begin(client, host, port, path)) return -1;
|
||||||
|
h2.addHeader("Authorization", auth);
|
||||||
|
code = h2.GET();
|
||||||
|
h2.end();
|
||||||
|
return code;
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
// NodeMCU v3 pin map. Zero external wiring needed for the PoC:
|
||||||
|
// relay 1 -> D1 (GPIO5) + mirrored on the on-board LED (GPIO2, active LOW)
|
||||||
|
// relay 2 -> D2 (GPIO4) (the watchdog's "PC power" relay)
|
||||||
|
// relay 3 -> D5 (GPIO14)
|
||||||
|
// relay 4 -> D6 (GPIO12)
|
||||||
|
// input 1 -> the on-board FLASH button (GPIO0, pulled up, LOW when pressed)
|
||||||
|
// input 2 -> D7 (GPIO13), INPUT_PULLUP: short to GND to "press"
|
||||||
|
// inputs 3-4 are virtual and idle HIGH.
|
||||||
|
#include "io.h"
|
||||||
|
|
||||||
|
static const int8_t RELAY_PIN[CHANNELS] = {5, 4, 14, 12};
|
||||||
|
static const int8_t INPUT_PIN[CHANNELS] = {0, 13, -1, -1};
|
||||||
|
static const uint8_t LED_PIN = 2;
|
||||||
|
|
||||||
|
void Io::begin() {
|
||||||
|
for (int i = 0; i < CHANNELS; i++) {
|
||||||
|
pinMode(RELAY_PIN[i], OUTPUT);
|
||||||
|
digitalWrite(RELAY_PIN[i], LOW);
|
||||||
|
if (INPUT_PIN[i] >= 0) pinMode(INPUT_PIN[i], INPUT_PULLUP);
|
||||||
|
}
|
||||||
|
pinMode(LED_PIN, OUTPUT);
|
||||||
|
digitalWrite(LED_PIN, HIGH); // LED off
|
||||||
|
}
|
||||||
|
|
||||||
|
void Io::setRelay(int ch, bool on) {
|
||||||
|
if (ch < 1 || ch > CHANNELS) return;
|
||||||
|
relays_[ch - 1] = on;
|
||||||
|
digitalWrite(RELAY_PIN[ch - 1], on ? HIGH : LOW);
|
||||||
|
if (ch == 1) digitalWrite(LED_PIN, on ? LOW : HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Io::relay(int ch) const { return ch >= 1 && ch <= CHANNELS && relays_[ch - 1]; }
|
||||||
|
|
||||||
|
bool Io::inputHigh(int ch) {
|
||||||
|
if (ch < 1 || ch > CHANNELS) return true;
|
||||||
|
int8_t pin = INPUT_PIN[ch - 1];
|
||||||
|
return pin < 0 ? true : digitalRead(pin) == HIGH;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Io::relayMask() const {
|
||||||
|
uint8_t m = 0;
|
||||||
|
for (int i = 0; i < CHANNELS; i++) if (relays_[i]) m |= 1 << i;
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Io::inputMask() {
|
||||||
|
uint8_t m = 0;
|
||||||
|
for (int i = 0; i < CHANNELS; i++) if (inputHigh(i + 1)) m |= 1 << i;
|
||||||
|
return m;
|
||||||
|
}
|
||||||
@@ -0,0 +1,469 @@
|
|||||||
|
// relay-proxy — a NodeMCU (ESP8266) that IS a Dingtian DT-R004 to the booth server
|
||||||
|
// (same wire protocol: binary UDP 60000 with relay_pw, string UDP 60001, config CGI,
|
||||||
|
// userset.cgi, Digest input push), plus a proxy/watchdog toward an ephemeral cloud
|
||||||
|
// stand-in. The booth's existing `dingtian` driver needs no change. See README.md.
|
||||||
|
//
|
||||||
|
// SAFETY (barrier-not-a-door): a jog turns a relay ON and releases it after the
|
||||||
|
// requested time — the device never times a *close* against a vehicle. The booth
|
||||||
|
// expresses intent only; physical safety belongs to the barrier operator.
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <ESP8266WiFi.h>
|
||||||
|
#include <ESP8266WebServer.h>
|
||||||
|
#include <ESP8266HTTPClient.h>
|
||||||
|
#include <WiFiUdp.h>
|
||||||
|
#include <ArduinoJson.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include "secrets.h"
|
||||||
|
#include "io.h"
|
||||||
|
#include "config_store.h"
|
||||||
|
#include "digest.h"
|
||||||
|
|
||||||
|
// --- tunables --------------------------------------------------------------
|
||||||
|
static const uint32_t HEARTBEAT_MS = 10000; // cloud heartbeat period
|
||||||
|
static const uint32_t COMMAND_POLL_MS = 2000; // cloud command poll period
|
||||||
|
static const uint32_t WD_PROBE_MS = 5000; // booth /health probe period
|
||||||
|
static const int WD_FAIL_THRESHOLD = 6; // probes failed in a row before acting (~30 s)
|
||||||
|
static const int WD_RELAY = 2; // relay wired to the PC's mains (NC contact)
|
||||||
|
static const uint16_t WD_PULSE_MS = 3000; // mains cut duration (AC Recovery=On reboots the PC)
|
||||||
|
static const uint32_t WD_BACKOFF_MS = 600000; // 10 min between power-cycles
|
||||||
|
static const uint32_t DEBOUNCE_MS = 30;
|
||||||
|
|
||||||
|
// --- state -----------------------------------------------------------------
|
||||||
|
static Io io;
|
||||||
|
static ConfigStore store;
|
||||||
|
static ESP8266WebServer http(80);
|
||||||
|
static WiFiUDP udpBin; // Dingtian binary protocol (udp1), authenticated by relay_pw
|
||||||
|
static WiFiUDP udpStr; // Dingtian string protocol (udp2), password-less — harden() disables it
|
||||||
|
static bool udpStrOpen = false;
|
||||||
|
static String devId; // MAC-derived id reported to the cloud
|
||||||
|
|
||||||
|
static uint32_t jogOff[CHANNELS + 1] = {}; // millis() at which a jogged relay releases (0 = none)
|
||||||
|
|
||||||
|
static bool wdEnabled = true;
|
||||||
|
static int wdFails = 0;
|
||||||
|
static bool boothOk = false;
|
||||||
|
static int boothCode = 0;
|
||||||
|
static uint32_t wdResets = 0;
|
||||||
|
static uint32_t wdNextProbe = 0, wdBackoffUntil = 0;
|
||||||
|
static uint32_t nextHeartbeat = 0, nextCommandPoll = 0;
|
||||||
|
static bool cloudOk = false;
|
||||||
|
|
||||||
|
static uint8_t lastStable = 0xFF, lastRaw = 0xFF;
|
||||||
|
static uint32_t rawSince = 0;
|
||||||
|
|
||||||
|
static void logf(const char* fmt, ...) {
|
||||||
|
char buf[200];
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsnprintf(buf, sizeof buf, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
Serial.printf("[%8lu] %s\n", (unsigned long)millis(), buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool due(uint32_t at) { return (int32_t)(millis() - at) >= 0; }
|
||||||
|
|
||||||
|
// --- relays ----------------------------------------------------------------
|
||||||
|
static void jog(int ch, uint16_t ms) {
|
||||||
|
if (ch < 1 || ch > CHANNELS) return;
|
||||||
|
io.setRelay(ch, true);
|
||||||
|
uint32_t t = millis() + ms;
|
||||||
|
jogOff[ch] = t ? t : 1;
|
||||||
|
logf("relay %d jog %u ms", ch, ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void releaseJogs() {
|
||||||
|
for (int ch = 1; ch <= CHANNELS; ch++) {
|
||||||
|
if (jogOff[ch] && due(jogOff[ch])) {
|
||||||
|
jogOff[ch] = 0;
|
||||||
|
io.setRelay(ch, false);
|
||||||
|
logf("relay %d released", ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- cloud (ephemeral stand-in, plain HTTP) --------------------------------
|
||||||
|
static int cloudPost(const char* path, const String& body) {
|
||||||
|
WiFiClient c;
|
||||||
|
HTTPClient h;
|
||||||
|
h.setTimeout(1500);
|
||||||
|
if (!h.begin(c, String(CLOUD_URL) + path)) return -1;
|
||||||
|
h.addHeader("Content-Type", "application/json");
|
||||||
|
int code = h.POST(body);
|
||||||
|
h.end();
|
||||||
|
cloudOk = code == 200;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cloudEvent(const char* type, int ch, bool active, int boothStatus) {
|
||||||
|
JsonDocument d;
|
||||||
|
d["dev"] = devId;
|
||||||
|
d["type"] = type;
|
||||||
|
d["input"] = ch;
|
||||||
|
d["active"] = active;
|
||||||
|
d["booth_status"] = boothStatus;
|
||||||
|
d["uptime_s"] = millis() / 1000;
|
||||||
|
String body;
|
||||||
|
serializeJson(d, body);
|
||||||
|
int code = cloudPost("/event", body);
|
||||||
|
logf("cloud event %s -> %d", type, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void heartbeat() {
|
||||||
|
JsonDocument d;
|
||||||
|
d["dev"] = devId;
|
||||||
|
d["ip"] = WiFi.localIP().toString();
|
||||||
|
d["rssi"] = WiFi.RSSI();
|
||||||
|
d["uptime_s"] = millis() / 1000;
|
||||||
|
d["heap"] = ESP.getFreeHeap();
|
||||||
|
d["booth_ok"] = boothOk;
|
||||||
|
d["booth_code"] = boothCode;
|
||||||
|
d["booth_fails"] = wdFails;
|
||||||
|
d["watchdog"] = wdEnabled;
|
||||||
|
d["pc_resets"] = wdResets;
|
||||||
|
d["relays"] = io.relayMask();
|
||||||
|
d["inputs"] = io.inputMask();
|
||||||
|
d["relay_pw_set"] = store.relayPw() != 0;
|
||||||
|
d["push_en"] = (store.cfg["input_link_url"]["en"] | 0) == 1;
|
||||||
|
d["link_relay"] = store.linkRelayEnabled();
|
||||||
|
d["string_proto"] = udpStrOpen;
|
||||||
|
String body;
|
||||||
|
serializeJson(d, body);
|
||||||
|
int code = cloudPost("/heartbeat", body);
|
||||||
|
logf("heartbeat -> %d (booth %s, fails %d)", code, boothOk ? "ok" : "DOWN", wdFails);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pollCommand() {
|
||||||
|
WiFiClient c;
|
||||||
|
HTTPClient h;
|
||||||
|
h.setTimeout(1500);
|
||||||
|
if (!h.begin(c, String(CLOUD_URL) + "/command?dev=" + devId)) return;
|
||||||
|
int code = h.GET();
|
||||||
|
if (code != 200) { h.end(); return; }
|
||||||
|
String body = h.getString();
|
||||||
|
h.end();
|
||||||
|
JsonDocument d;
|
||||||
|
if (deserializeJson(d, body) != DeserializationError::Ok) return;
|
||||||
|
if (d["pulse"].is<int>()) {
|
||||||
|
int ch = d["pulse"];
|
||||||
|
uint16_t ms = d["ms"] | 500;
|
||||||
|
logf("CLOUD command: pulse relay %d", ch);
|
||||||
|
jog(ch, ms);
|
||||||
|
}
|
||||||
|
if (d["watchdog"].is<bool>()) {
|
||||||
|
wdEnabled = d["watchdog"];
|
||||||
|
logf("CLOUD command: watchdog %s", wdEnabled ? "enabled" : "disabled");
|
||||||
|
}
|
||||||
|
if (d["reboot_pc"] | false) {
|
||||||
|
logf("CLOUD command: power-cycle PC");
|
||||||
|
jog(WD_RELAY, WD_PULSE_MS);
|
||||||
|
wdResets++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- watchdog --------------------------------------------------------------
|
||||||
|
static void watchdogTick() {
|
||||||
|
if (!due(wdNextProbe)) return;
|
||||||
|
wdNextProbe = millis() + WD_PROBE_MS;
|
||||||
|
WiFiClient c;
|
||||||
|
HTTPClient h;
|
||||||
|
h.setTimeout(1500);
|
||||||
|
int code = -1;
|
||||||
|
if (h.begin(c, BOOTH_HEALTH_URL)) {
|
||||||
|
code = h.GET();
|
||||||
|
h.end();
|
||||||
|
}
|
||||||
|
boothCode = code;
|
||||||
|
bool ok = code == 200;
|
||||||
|
if (ok != boothOk) logf("booth is now %s (HTTP %d)", ok ? "UP" : "DOWN", code);
|
||||||
|
boothOk = ok;
|
||||||
|
wdFails = ok ? 0 : wdFails + 1;
|
||||||
|
if (!ok && wdEnabled && wdFails >= WD_FAIL_THRESHOLD && due(wdBackoffUntil)) {
|
||||||
|
logf("WATCHDOG: booth down for %d probes -> power-cycling via relay %d", wdFails, WD_RELAY);
|
||||||
|
jog(WD_RELAY, WD_PULSE_MS);
|
||||||
|
wdResets++;
|
||||||
|
wdBackoffUntil = millis() + WD_BACKOFF_MS;
|
||||||
|
cloudEvent("pc_reset", 0, false, code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- inputs ----------------------------------------------------------------
|
||||||
|
static bool inputActive(int ch, bool high) {
|
||||||
|
// Dingtian semantics: input_link_url.active_level[i] 0 = active LOW.
|
||||||
|
int level = store.cfg["input_link_url"]["active_level"][ch - 1] | 0;
|
||||||
|
return level == 0 ? !high : high;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the booth HTTP status, or 0 when push is not configured.
|
||||||
|
static int pushInput(int ch, bool active) {
|
||||||
|
JsonObjectConst ilu = store.cfg["input_link_url"].as<JsonObjectConst>();
|
||||||
|
if (ilu.isNull() || (ilu["en"] | 0) != 1) return 0;
|
||||||
|
String host = ilu["server"][ch - 1] | "";
|
||||||
|
if (host.isEmpty()) return 0;
|
||||||
|
uint16_t port = ilu["port"][ch - 1] | 80;
|
||||||
|
String path = active ? (ilu["on_path"][ch - 1] | "") : (ilu["off_path"][ch - 1] | "");
|
||||||
|
if (path.isEmpty()) return 0;
|
||||||
|
int auth = ilu["auth"][ch - 1] | 0;
|
||||||
|
String user = auth ? (ilu["user"][ch - 1] | "") : "";
|
||||||
|
String pass = ilu["pass"][ch - 1] | "";
|
||||||
|
int code = digestGet(host, port, path, user, pass);
|
||||||
|
logf("push input %d %s -> %s:%u%s -> %d", ch, active ? "on" : "off", host.c_str(), port, path.c_str(), code);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void onInputChange(int ch, bool high) {
|
||||||
|
bool active = inputActive(ch, high);
|
||||||
|
logf("input %d %s (%s)", ch, high ? "HIGH" : "LOW", active ? "active" : "idle");
|
||||||
|
// Factory behaviour the booth's precondition fix turns off: input auto-fires its relays.
|
||||||
|
if (store.linkRelayEnabled()) {
|
||||||
|
JsonArrayConst acts = store.cfg["input_link_relay"]["on_action_on"][ch - 1].as<JsonArrayConst>();
|
||||||
|
for (JsonVariantConst v : acts) {
|
||||||
|
int r = v.as<int>() + 1;
|
||||||
|
io.setRelay(r, active);
|
||||||
|
logf("input_link_relay: input %d -> relay %d %s", ch, r, active ? "ON" : "off");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Booth first (the normal path), then the cloud mirror — always, so the cloud
|
||||||
|
// still sees the button when the booth is dead or not yet configured.
|
||||||
|
int boothStatus = pushInput(ch, active);
|
||||||
|
cloudEvent(active ? "input_on" : "input_off", ch, active, boothStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void inputTick() {
|
||||||
|
uint8_t raw = io.inputMask();
|
||||||
|
if (raw != lastRaw) {
|
||||||
|
lastRaw = raw;
|
||||||
|
rawSince = millis();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (millis() - rawSince < DEBOUNCE_MS || raw == lastStable) return;
|
||||||
|
uint8_t changed = raw ^ lastStable;
|
||||||
|
lastStable = raw;
|
||||||
|
for (int ch = 1; ch <= CHANNELS; ch++) {
|
||||||
|
if (changed & (1 << (ch - 1))) onInputChange(ch, raw & (1 << (ch - 1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Dingtian binary protocol (UDP 60000) ----------------------------------
|
||||||
|
// Request: FF AA <session> <cmd> <pwLo> <pwHi> [data...]
|
||||||
|
// Reply: FF AA <session> <cmd> <relayByte> <inputByte> (4ch: one byte each)
|
||||||
|
// cmd 0x00 read status; 0x01 write (mask,set); 0x03 jog (relayByte, units of 100 ms).
|
||||||
|
// Wrong password -> silently dropped, exactly like the hardware.
|
||||||
|
static void handleBinary() {
|
||||||
|
int n = udpBin.parsePacket();
|
||||||
|
if (!n) return;
|
||||||
|
uint8_t b[32];
|
||||||
|
int len = udpBin.read(b, sizeof b);
|
||||||
|
if (len < 6 || b[0] != 0xFF || b[1] != 0xAA) return;
|
||||||
|
uint16_t pw = b[4] | (b[5] << 8);
|
||||||
|
uint16_t want = store.relayPw();
|
||||||
|
if (want != 0 && pw != want) {
|
||||||
|
logf("binary: bad relay_pw %u from %s — dropped", pw, udpBin.remoteIP().toString().c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uint8_t session = b[2], cmd = b[3];
|
||||||
|
switch (cmd) {
|
||||||
|
case 0x00:
|
||||||
|
break;
|
||||||
|
case 0x01:
|
||||||
|
if (len >= 8) {
|
||||||
|
uint8_t mask = b[6], set = b[7];
|
||||||
|
for (int ch = 1; ch <= CHANNELS; ch++) {
|
||||||
|
uint8_t bit = 1 << (ch - 1);
|
||||||
|
if (mask & bit) { jogOff[ch] = 0; io.setRelay(ch, set & bit); }
|
||||||
|
}
|
||||||
|
logf("binary: write mask %02x set %02x", mask, set);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x03:
|
||||||
|
if (len >= 9) {
|
||||||
|
uint8_t rb = b[6];
|
||||||
|
int ch = (rb >> 1) + 1;
|
||||||
|
uint16_t units = b[7] | (b[8] << 8);
|
||||||
|
if (rb & 1) jog(ch, units * 100);
|
||||||
|
else { jogOff[ch] = 0; io.setRelay(ch, false); }
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logf("binary: unsupported cmd %02x", cmd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uint8_t r[6] = {0xFF, 0xAA, session, cmd, io.relayMask(), io.inputMask()};
|
||||||
|
udpBin.beginPacket(udpBin.remoteIP(), udpBin.remotePort());
|
||||||
|
udpBin.write(r, sizeof r);
|
||||||
|
udpBin.endPacket();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Dingtian string protocol (UDP 60001) — the password-less hole ----------
|
||||||
|
// "00" status -> "RRRR:IIII:4"; "1N" relay N on; "2N" off; "1N*" jog 500 ms.
|
||||||
|
static void handleString() {
|
||||||
|
if (!udpStrOpen) return;
|
||||||
|
int n = udpStr.parsePacket();
|
||||||
|
if (!n) return;
|
||||||
|
char b[16];
|
||||||
|
int len = udpStr.read(b, sizeof b - 1);
|
||||||
|
b[len < 0 ? 0 : len] = 0;
|
||||||
|
String cmd(b);
|
||||||
|
cmd.trim();
|
||||||
|
if (cmd == "00") {
|
||||||
|
// status only
|
||||||
|
} else if (cmd.length() >= 2 && (cmd[0] == '1' || cmd[0] == '2') && isDigit(cmd[1])) {
|
||||||
|
int ch = cmd[1] - '0';
|
||||||
|
if (ch < 1 || ch > CHANNELS) return;
|
||||||
|
logf("string: UNAUTHENTICATED '%s' from %s", cmd.c_str(), udpStr.remoteIP().toString().c_str());
|
||||||
|
if (cmd.endsWith("*")) jog(ch, 500);
|
||||||
|
else { jogOff[ch] = 0; io.setRelay(ch, cmd[0] == '1'); }
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String r;
|
||||||
|
for (int ch = 1; ch <= CHANNELS; ch++) r += io.relay(ch) ? '1' : '0';
|
||||||
|
r += ':';
|
||||||
|
for (int ch = 1; ch <= CHANNELS; ch++) r += io.inputHigh(ch) ? '1' : '0';
|
||||||
|
r += ":" + String(CHANNELS);
|
||||||
|
udpStr.beginPacket(udpStr.remoteIP(), udpStr.remotePort());
|
||||||
|
udpStr.print(r);
|
||||||
|
udpStr.endPacket();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void applyProtocolConfig() {
|
||||||
|
bool want = store.stringProtoEnabled();
|
||||||
|
if (want && !udpStrOpen) { udpStr.begin(60001); udpStrOpen = true; logf("string protocol (udp2) ENABLED on 60001"); }
|
||||||
|
if (!want && udpStrOpen) { udpStr.stop(); udpStrOpen = false; logf("string protocol (udp2) disabled"); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Dingtian config CGI (HTTP 80) ------------------------------------------
|
||||||
|
static void onConfigGet() {
|
||||||
|
String out;
|
||||||
|
serializeJson(store.cfg, out);
|
||||||
|
http.send(200, "application/json", out);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void onConfigSet() {
|
||||||
|
String body = http.arg("plain");
|
||||||
|
JsonDocument doc;
|
||||||
|
if (deserializeJson(doc, body) != DeserializationError::Ok) {
|
||||||
|
http.send(400, "application/json", "{\"status\":1}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Faithful to the hardware gotcha: without "command":"setconfig" the device
|
||||||
|
// answers OK and silently does nothing.
|
||||||
|
if (strcmp(doc["command"] | "", "setconfig") != 0) {
|
||||||
|
logf("config_set without command=setconfig — ignored (as the real device does)");
|
||||||
|
http.send(200, "application/json", "{\"status\":0}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
doc.remove("command");
|
||||||
|
store.cfg = doc;
|
||||||
|
store.save();
|
||||||
|
applyProtocolConfig();
|
||||||
|
logf("config applied: relay_pw=%u link_relay=%d push_en=%d udp2=%s", store.relayPw(), store.linkRelayEnabled(),
|
||||||
|
(int)(store.cfg["input_link_url"]["en"] | 0), udpStrOpen ? "on" : "off");
|
||||||
|
http.send(200, "application/json", "{\"status\":0}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET /userset.cgi?<user>&<old>&<user>&<new>& -> "&0&/&" ok, "&2&/&" wrong old cred
|
||||||
|
static void onUserSet() {
|
||||||
|
if (http.args() < 4) { http.send(200, "text/plain", "&1&/&"); return; }
|
||||||
|
String u = http.argName(0), oldP = http.argName(1), newU = http.argName(2), newP = http.argName(3);
|
||||||
|
if (u != store.webUser || oldP != store.webPass) {
|
||||||
|
logf("userset: rejected (wrong current credentials)");
|
||||||
|
http.send(200, "text/plain", "&2&/&");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
store.webUser = newU;
|
||||||
|
store.webPass = newP;
|
||||||
|
store.saveWeb();
|
||||||
|
logf("userset: web login rotated");
|
||||||
|
http.send(200, "text/plain", "&0&/&");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void onRoot() {
|
||||||
|
String s = "relay-proxy (Dingtian DT-R004 emulator)\n";
|
||||||
|
s += "id " + devId + " ip " + WiFi.localIP().toString() + "\n";
|
||||||
|
s += "relays " + String(io.relayMask(), BIN) + " inputs " + String(io.inputMask(), BIN) + "\n";
|
||||||
|
s += "relay_pw " + String(store.relayPw() ? "set" : "none") + " link_relay " + String(store.linkRelayEnabled()) +
|
||||||
|
" push_en " + String((int)(store.cfg["input_link_url"]["en"] | 0)) + " udp2 " + String(udpStrOpen) + "\n";
|
||||||
|
s += "booth " + String(boothOk ? "UP" : "DOWN") + " (HTTP " + String(boothCode) + ", fails " + String(wdFails) + ") watchdog " +
|
||||||
|
String(wdEnabled) + " pc_resets " + String(wdResets) + "\n";
|
||||||
|
s += "cloud " + String(cloudOk ? "ok" : "unreachable") + " heap " + String(ESP.getFreeHeap()) + "\n";
|
||||||
|
http.send(200, "text/plain", s);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PoC-only helper: back to factory state so the booth's assign flow can be re-run.
|
||||||
|
static void onFactoryReset() {
|
||||||
|
store.makeDefaults();
|
||||||
|
store.save();
|
||||||
|
store.webUser = "admin";
|
||||||
|
store.webPass = "admin";
|
||||||
|
store.saveWeb();
|
||||||
|
applyProtocolConfig();
|
||||||
|
logf("FACTORY RESET");
|
||||||
|
http.send(200, "application/json", "{\"status\":0}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- wifi ------------------------------------------------------------------
|
||||||
|
static void connectWifi() {
|
||||||
|
WiFi.mode(WIFI_STA);
|
||||||
|
WiFi.setAutoReconnect(true);
|
||||||
|
WiFi.hostname("relay-proxy");
|
||||||
|
#ifdef STATIC_IP
|
||||||
|
IPAddress ip, gw, mask;
|
||||||
|
ip.fromString(STATIC_IP);
|
||||||
|
gw.fromString(STATIC_GW);
|
||||||
|
mask.fromString(STATIC_MASK);
|
||||||
|
WiFi.config(ip, gw, mask, gw);
|
||||||
|
#endif
|
||||||
|
WiFi.begin(WIFI_SSID, WIFI_PASS);
|
||||||
|
logf("wifi: connecting to %s", WIFI_SSID);
|
||||||
|
uint32_t t0 = millis();
|
||||||
|
while (WiFi.status() != WL_CONNECTED && millis() - t0 < 20000) delay(200);
|
||||||
|
if (WiFi.status() == WL_CONNECTED) logf("wifi: %s rssi %d", WiFi.localIP().toString().c_str(), WiFi.RSSI());
|
||||||
|
else logf("wifi: not connected yet (status %d) — will keep retrying", WiFi.status());
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- setup / loop ----------------------------------------------------------
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
delay(100);
|
||||||
|
Serial.println();
|
||||||
|
io.begin();
|
||||||
|
store.begin();
|
||||||
|
devId = WiFi.macAddress();
|
||||||
|
devId.replace(":", "");
|
||||||
|
devId.toLowerCase();
|
||||||
|
logf("relay-proxy starting, id %s, relay_pw %s, link_relay %d", devId.c_str(), store.relayPw() ? "set" : "none",
|
||||||
|
store.linkRelayEnabled());
|
||||||
|
|
||||||
|
connectWifi();
|
||||||
|
|
||||||
|
udpBin.begin(60000);
|
||||||
|
applyProtocolConfig();
|
||||||
|
|
||||||
|
http.on("/", HTTP_GET, onRoot);
|
||||||
|
http.on("/api/v2/config.cgi", HTTP_GET, onConfigGet);
|
||||||
|
http.on("/api/v2/config_set.cgi", HTTP_POST, onConfigSet);
|
||||||
|
http.on("/userset.cgi", HTTP_GET, onUserSet);
|
||||||
|
http.on("/poc/factory_reset", HTTP_POST, onFactoryReset);
|
||||||
|
http.onNotFound([] { http.send(404, "text/plain", "not found"); });
|
||||||
|
http.begin();
|
||||||
|
|
||||||
|
lastStable = lastRaw = io.inputMask(); // baseline, no boot events
|
||||||
|
rawSince = millis();
|
||||||
|
wdNextProbe = millis() + 2000;
|
||||||
|
nextHeartbeat = millis() + 3000;
|
||||||
|
nextCommandPoll = millis() + 4000;
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
http.handleClient();
|
||||||
|
handleBinary();
|
||||||
|
handleString();
|
||||||
|
releaseJogs();
|
||||||
|
inputTick();
|
||||||
|
if (WiFi.status() == WL_CONNECTED) {
|
||||||
|
watchdogTick();
|
||||||
|
if (due(nextHeartbeat)) { nextHeartbeat = millis() + HEARTBEAT_MS; heartbeat(); }
|
||||||
|
if (due(nextCommandPoll)) { nextCommandPoll = millis() + COMMAND_POLL_MS; pollCommand(); }
|
||||||
|
}
|
||||||
|
delay(2);
|
||||||
|
}
|
||||||
+1
-1
@@ -172,7 +172,7 @@ Keys with an automated note are tagged **⚑ NOTE**.
|
|||||||
## 27. `anprEntryHint`
|
## 27. `anprEntryHint`
|
||||||
|
|
||||||
- **EN** (en.ts:584, 195 ch): When on, a subscriber's plate read by a lane camera opens the barrier through the normal subscription gate. Off: subscribers must use their card/QR. Plate snapshots are still recorded either way.
|
- **EN** (en.ts:584, 195 ch): When on, a subscriber's plate read by a lane camera opens the barrier through the normal subscription gate. Off: subscribers must use their card/QR. Plate snapshots are still recorded either way.
|
||||||
- **SQ** (sq.ts:595, 207 ch): Kur është aktiv, targa e një abonenti e lexuar nga kamera e korsisë hap barrierën përmes portës normale të abonimit. Joaktiv: abonentët duhet të përdorin kartën/QR-në. Fotot e targave regjistrohen gjithsesi.
|
- **SQ** (sq.ts:595, 207 ch): Kur është aktiv, targa e një abonenti e lexuar nga kamera e korsisë hap barrierën përmes portës normale të abonimit. Joaktiv: abonentët duhet të përdorin kartën/QR-në. Snapshot-et e targave regjistrohen gjithsesi.
|
||||||
- **Verdict:**
|
- **Verdict:**
|
||||||
|
|
||||||
## 28. `voucherHint`
|
## 28. `voucherHint`
|
||||||
|
|||||||
+17
-17
@@ -94,7 +94,7 @@ REGISTRY=git.infra.msai.al/mca/parking_solution
|
|||||||
# Staging booth: pinned immutable stage-<sha>. After each promotion (merge dev → stage, CI builds
|
# Staging booth: pinned immutable stage-<sha>. After each promotion (merge dev → stage, CI builds
|
||||||
# :stage-<sha>), bump this to the new sha and re-sync/deploy from Core. The moving `:stage` tag
|
# :stage-<sha>), bump this to the new sha and re-sync/deploy from Core. The moving `:stage` tag
|
||||||
# exists as the pointer; we deploy the sha, not the mover.
|
# exists as the pointer; we deploy the sha, not the mover.
|
||||||
TAG=stage-2ac26b5
|
TAG=stage-73ada89
|
||||||
COOKIE_SECURE=0
|
COOKIE_SECURE=0
|
||||||
# Venue modules this site is ENTITLED to (vendor decision; the site admin activates within
|
# Venue modules this site is ENTITLED to (vendor decision; the site admin activates within
|
||||||
# this set in Setup → Site). Unset = every registered module. See wiki/decisions/venue-modules.md.
|
# this set in Setup → Site). Unset = every registered module. See wiki/decisions/venue-modules.md.
|
||||||
@@ -120,17 +120,22 @@ BACKUP_KEY=[[park_2_backup_key]]
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Stack — the LAB BENCH (not a booth): a spare Linux box with the field printer and
|
# Stack — the LAB BENCH (not a booth): a dedicated OptiPlex 7070 provisioned like a booth
|
||||||
# whatever device is under investigation, so a booth bug can be reproduced on the booth's
|
# (LUKS + TPM, Secure Boot, GRUB edit-lock, Periphery `park-lab`, 2026-10-20) with the
|
||||||
# exact image before touching a real site. Same compose files + pinned TAG as the staging
|
# field printer and whatever device is under investigation, so a booth bug can be
|
||||||
# booths. Review outbox under its OWN id (booth-lab) — never a
|
# reproduced on the booth's exact image before touching a real site. Same compose files +
|
||||||
# booth's identity, so bench crops stay separable on the collector. Its own secrets. See wiki/decisions/fleet-deployment-komodo.md.
|
# pinned TAG as the staging booths; the ONLY member entitled to EVERY module, so each
|
||||||
|
# feature the solution offers can be exercised here. Review outbox under its OWN id
|
||||||
|
# (booth-lab) — never a booth's identity, so bench crops stay separable on the collector.
|
||||||
|
# Its own secrets. (2026-10-08 → 2026-10-20 it ran on the shared art-docker-station with
|
||||||
|
# HTTP_PORT/SERVER_PORT/VISION_HOST_PORT remapped; a dedicated host needs none of that.)
|
||||||
|
# See wiki/decisions/fleet-deployment-komodo.md.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
[[stack]]
|
[[stack]]
|
||||||
name = "park-lab"
|
name = "park-lab"
|
||||||
[stack.config]
|
[stack.config]
|
||||||
server = "art-docker-station"
|
server = "park-lab"
|
||||||
git_provider = "git.infra.msai.al"
|
git_provider = "git.infra.msai.al"
|
||||||
git_account = "komodo"
|
git_account = "komodo"
|
||||||
repo = "mca/parking_solution"
|
repo = "mca/parking_solution"
|
||||||
@@ -145,17 +150,12 @@ environment = """
|
|||||||
REGISTRY=git.infra.msai.al/mca/parking_solution
|
REGISTRY=git.infra.msai.al/mca/parking_solution
|
||||||
# Lab: pinned to the SAME stage-<sha> as the booth whose bug is being reproduced (bump
|
# Lab: pinned to the SAME stage-<sha> as the booth whose bug is being reproduced (bump
|
||||||
# alongside it). A lab may float, but a reproduction must run the booth's exact image.
|
# alongside it). A lab may float, but a reproduction must run the booth's exact image.
|
||||||
TAG=stage-32b4d9e
|
TAG=stage-cb43ad7
|
||||||
# The lab stack runs on art-docker-station (2026-10-08), a SHARED host: :80 is another service's
|
|
||||||
# and :3000 / :8089 may be too. These three move every host binding (Caddy listen, host-net
|
|
||||||
# server, vision loopback publish); the UI is then http://<station>:8080/. Booth stacks leave
|
|
||||||
# them unset and keep :80 → :3000. See docker-compose.prod.yml + Caddyfile.
|
|
||||||
HTTP_PORT=8080
|
|
||||||
SERVER_PORT=3100
|
|
||||||
VISION_HOST_PORT=8189
|
|
||||||
COOKIE_SECURE=0
|
COOKIE_SECURE=0
|
||||||
# Entitled to Car Wash too, so the wash-desk printer role and till can be exercised on the bench.
|
# EVERY registered module (apps/server/src/modules + @parking/shared MODULES): parking,
|
||||||
MODULES_ENTITLED=parking,carwash
|
# validation (the Bar), carwash. The compose default is only parking,validation, so the full
|
||||||
|
# set must be spelled out. The site admin still activates within this set in Setup → Site.
|
||||||
|
MODULES_ENTITLED=parking #,validation,carwash
|
||||||
# Review outbox ON for the bench too, under its OWN pseudonymous id (booth-lab) and its own
|
# Review outbox ON for the bench too, under its OWN pseudonymous id (booth-lab) and its own
|
||||||
# secret — never a real booth's — so lab crops are separable on the collector (per-booth stats,
|
# secret — never a real booth's — so lab crops are separable on the collector (per-booth stats,
|
||||||
# the export's booth column) and the reviewer can label bench junk "unusable".
|
# the export's booth column) and the reviewer can label bench junk "unusable".
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
-- Hot-path indexes (park-2, 2026-10-24). Every per-session read of the ledger was a full
|
||||||
|
-- scan (no index on identity), and the camera/relay telemetry queries scanned
|
||||||
|
-- device_events (no index beyond the PK). Both tables grow with the operator's traffic,
|
||||||
|
-- so request time grew with it: the booth's active-sessions call reached ~2 s and froze
|
||||||
|
-- the event loop, which surfaced as relay "timeouts". The handler was also rewritten to
|
||||||
|
-- avoid per-row reads; these indexes make the remaining identity/telemetry lookups O(log n)
|
||||||
|
-- whatever the data volume. All additive; the previous image ignores them on rollback.
|
||||||
|
CREATE INDEX IF NOT EXISTS `ledger_events_identity_idx` ON `ledger_events` (`identity`,`index`);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE INDEX IF NOT EXISTS `device_events_cat_kind_time_idx` ON `device_events` (`category`,`kind`,`occurred_at`);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE INDEX IF NOT EXISTS `device_events_kind_time_idx` ON `device_events` (`kind`,`occurred_at`);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE INDEX IF NOT EXISTS `snapshots_identity_idx` ON `snapshots` (`identity`);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE INDEX IF NOT EXISTS `sessions_state_idx` ON `sessions` (`state`);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE INDEX IF NOT EXISTS `sessions_subscription_idx` ON `sessions` (`subscription_id`,`state`);
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
-- Booth camera tiles (wiki/decisions/camera-live-view.md). Two additive changes:
|
||||||
|
-- * users.open_cameras: the camera tiles a user left open (JSON array of device ids),
|
||||||
|
-- restored on the next login from any booth, like language/theme/font_scale.
|
||||||
|
-- * an index for "the latest snapshot this camera took" — the tile's default picture.
|
||||||
|
-- Without it the lookup scans every stored image row (the bounded-request-cost rule,
|
||||||
|
-- park-2 2026-10-24). The previous image ignores both on rollback.
|
||||||
|
ALTER TABLE `users` ADD `open_cameras` text DEFAULT '[]' NOT NULL;
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE INDEX IF NOT EXISTS `snapshots_device_time_idx` ON `snapshots` (`device_id`,`captured_at`);
|
||||||
@@ -225,6 +225,20 @@
|
|||||||
"when": 1788710000000,
|
"when": 1788710000000,
|
||||||
"tag": "0031_carwash_review_outbox",
|
"tag": "0031_carwash_review_outbox",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 32,
|
||||||
|
"version": "6",
|
||||||
|
"when": 1788720000000,
|
||||||
|
"tag": "0032_hot_path_indexes",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 33,
|
||||||
|
"version": "6",
|
||||||
|
"when": 1788730000000,
|
||||||
|
"tag": "0033_camera_live_view",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,10 @@ export const users = sqliteTable("users", {
|
|||||||
// avoids float drift; the client clamps to 80–160 in steps of 10. Printed tickets are
|
// avoids float drift; the client clamps to 80–160 in steps of 10. Printed tickets are
|
||||||
// unaffected (server-rendered).
|
// unaffected (server-rendered).
|
||||||
fontScale: integer("font_scale").notNull().default(100),
|
fontScale: integer("font_scale").notNull().default(100),
|
||||||
|
// Camera tiles this user left open on the booth screen (JSON array of camera device
|
||||||
|
// ids, in the order opened). Persisted like `theme`; restored on login from any booth.
|
||||||
|
// See wiki/decisions/camera-live-view.md.
|
||||||
|
openCameras: text("open_cameras").notNull().default("[]"),
|
||||||
// Optional operator profile metadata — display name + contact details. All
|
// Optional operator profile metadata — display name + contact details. All
|
||||||
// nullable; only username/password/role are required to create a user. fullName
|
// nullable; only username/password/role are required to create a user. fullName
|
||||||
// (when set) is the human label for audit/Z-report display.
|
// (when set) is the human label for audit/Z-report display.
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -77,7 +77,13 @@ function binaryUdp(
|
|||||||
sock.close();
|
sock.close();
|
||||||
err ? reject(err) : resolve(val!);
|
err ? reject(err) : resolve(val!);
|
||||||
};
|
};
|
||||||
const timer = setTimeout(() => done(new Error("timeout"), null), timeoutMs);
|
// On expiry, defer the rejection by one loop turn. Node runs expired timers BEFORE
|
||||||
|
// it drains pending socket I/O, so if the event loop was blocked (a long synchronous
|
||||||
|
// handler) while the device's reply sat in the kernel buffer, the timer would win
|
||||||
|
// and report "timeout" for a relay that answered. The setImmediate lands in the
|
||||||
|
// check phase, after the poll phase has delivered that datagram to `message`.
|
||||||
|
// (park-2, 2026-10-24: ~2 s handler stalls produced exactly these phantom timeouts.)
|
||||||
|
const timer = setTimeout(() => setImmediate(() => done(new Error("timeout"), null)), timeoutMs);
|
||||||
sock.on("error", (e) => done(e, null));
|
sock.on("error", (e) => done(e, null));
|
||||||
sock.on("message", (m) => done(null, m));
|
sock.on("message", (m) => done(null, m));
|
||||||
// Bind to a specific local address (the device-facing NIC) on multi-homed
|
// Bind to a specific local address (the device-facing NIC) on multi-homed
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ describe("hikvision syncClock — the 1970 power-cut recovery (ISAPI /System/tim
|
|||||||
const timeXml = (localTime: string) =>
|
const timeXml = (localTime: string) =>
|
||||||
reply(
|
reply(
|
||||||
200,
|
200,
|
||||||
`<?xml version="1.0"?><Time><timeMode>NTP</timeMode><localTime>${localTime}</localTime><timeZone>CST-2:00:00DST01:00:00</timeZone></Time>`,
|
`<?xml version="1.0"?><Time><timeMode>NTP</timeMode><localTime>${localTime}</localTime><timeZone>CST-2:00:00</timeZone></Time>`,
|
||||||
);
|
);
|
||||||
const HOST_NOW = "2026-07-07T12:00:00+02:00";
|
const HOST_NOW = "2026-07-07T12:00:00+02:00";
|
||||||
|
|
||||||
@@ -166,11 +166,11 @@ describe("hikvision syncClock — the 1970 power-cut recovery (ISAPI /System/tim
|
|||||||
it("in-sync camera: reads, does NOT set", async () => {
|
it("in-sync camera: reads, does NOT set", async () => {
|
||||||
digestRequest.mockResolvedValueOnce(timeXml("2026-07-07T12:00:10+02:00"));
|
digestRequest.mockResolvedValueOnce(timeXml("2026-07-07T12:00:10+02:00"));
|
||||||
const r = await cam().syncClock(HOST_NOW, 60);
|
const r = await cam().syncClock(HOST_NOW, 60);
|
||||||
expect(r).toEqual({ driftSeconds: 10, synced: false });
|
expect(r).toEqual({ driftSeconds: 10, synced: false, zoneChanged: false, timeZone: "CST-2:00:00" });
|
||||||
expect(digestRequest).toHaveBeenCalledTimes(1); // GET only
|
expect(digestRequest).toHaveBeenCalledTimes(1); // GET only
|
||||||
});
|
});
|
||||||
|
|
||||||
it("1970 camera: PUTs manual time with the host instant, echoing the camera's timeZone", async () => {
|
it("1970 camera: PUTs manual time with the host instant and the site's fixed-offset zone", async () => {
|
||||||
digestRequest
|
digestRequest
|
||||||
.mockResolvedValueOnce(timeXml("1970-01-01T03:12:44+01:00"))
|
.mockResolvedValueOnce(timeXml("1970-01-01T03:12:44+01:00"))
|
||||||
.mockResolvedValueOnce(reply(200, "<ResponseStatus/>"));
|
.mockResolvedValueOnce(reply(200, "<ResponseStatus/>"));
|
||||||
@@ -182,7 +182,7 @@ describe("hikvision syncClock — the 1970 power-cut recovery (ISAPI /System/tim
|
|||||||
expect(put.path).toBe("/ISAPI/System/time");
|
expect(put.path).toBe("/ISAPI/System/time");
|
||||||
expect(put.body).toContain("<timeMode>manual</timeMode>");
|
expect(put.body).toContain("<timeMode>manual</timeMode>");
|
||||||
expect(put.body).toContain(`<localTime>${HOST_NOW}</localTime>`);
|
expect(put.body).toContain(`<localTime>${HOST_NOW}</localTime>`);
|
||||||
expect(put.body).toContain("<timeZone>CST-2:00:00DST01:00:00</timeZone>"); // echoed, never invented
|
expect(put.body).toContain("<timeZone>CST-2:00:00</timeZone>"); // the host's current offset, never the camera's DST rule
|
||||||
});
|
});
|
||||||
|
|
||||||
it("unparseable camera time = infinite drift → syncs", async () => {
|
it("unparseable camera time = infinite drift → syncs", async () => {
|
||||||
@@ -190,7 +190,7 @@ describe("hikvision syncClock — the 1970 power-cut recovery (ISAPI /System/tim
|
|||||||
.mockResolvedValueOnce(reply(200, "<Time><localTime>garbage</localTime></Time>"))
|
.mockResolvedValueOnce(reply(200, "<Time><localTime>garbage</localTime></Time>"))
|
||||||
.mockResolvedValueOnce(reply(200, "<ResponseStatus/>"));
|
.mockResolvedValueOnce(reply(200, "<ResponseStatus/>"));
|
||||||
const r = await cam().syncClock(HOST_NOW, 60);
|
const r = await cam().syncClock(HOST_NOW, 60);
|
||||||
expect(r).toEqual({ driftSeconds: null, synced: true });
|
expect(r).toMatchObject({ driftSeconds: null, synced: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("a failed set surfaces as an error (monitor logs it, backstop retries)", async () => {
|
it("a failed set surfaces as an error (monitor logs it, backstop retries)", async () => {
|
||||||
@@ -277,7 +277,7 @@ describe("dahua syncClock — global.cgi getCurrentTime/setCurrentTime, naive wa
|
|||||||
.mockResolvedValueOnce(reply(200, "Error\r\nBad Request!"))
|
.mockResolvedValueOnce(reply(200, "Error\r\nBad Request!"))
|
||||||
.mockResolvedValueOnce(reply(200, "OK"));
|
.mockResolvedValueOnce(reply(200, "OK"));
|
||||||
const r = await (await cam()).syncClock(HOST_NOW, 60);
|
const r = await (await cam()).syncClock(HOST_NOW, 60);
|
||||||
expect(r).toEqual({ driftSeconds: null, synced: true });
|
expect(r).toMatchObject({ driftSeconds: null, synced: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("a 200 whose body is not OK is still a failed set (Dahua's 'Error' convention)", async () => {
|
it("a 200 whose body is not OK is still a failed set (Dahua's 'Error' convention)", async () => {
|
||||||
@@ -294,3 +294,73 @@ describe("dahua syncClock — global.cgi getCurrentTime/setCurrentTime, naive wa
|
|||||||
await expect((await cam()).syncClock(HOST_NOW, 60)).rejects.toThrow("clock set failed: HTTP 401");
|
await expect((await cam()).syncClock(HOST_NOW, 60)).rejects.toThrow("clock set failed: HTTP 401");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// --- Hikvision clock sync: the zone is the host's FIXED current offset -------------
|
||||||
|
// park-2 2026-10-09: both cameras sat on the factory CST-8 (Beijing) — instant right,
|
||||||
|
// OSD six hours off — and this firmware ignores the DST rule in a POSIX zone string. So
|
||||||
|
// the sync rewrites the zone to the site's current fixed offset and re-sends the clock
|
||||||
|
// with it; a camera already on the right zone with small drift is left alone.
|
||||||
|
|
||||||
|
const { hikvisionFixedZone } = await import("./camera.js");
|
||||||
|
|
||||||
|
function timeXml(localTime: string, timeZone: string) {
|
||||||
|
return (
|
||||||
|
`<?xml version="1.0" encoding="UTF-8"?><Time version="2.0"><timeMode>manual</timeMode>` +
|
||||||
|
`<localTime>${localTime}</localTime><timeZone>${timeZone}</timeZone></Time>`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function xmlReply(status: number, body: string): DigestGetResult {
|
||||||
|
return { status, contentType: "application/xml", body: Buffer.from(body) };
|
||||||
|
}
|
||||||
|
function putCalls() {
|
||||||
|
return digestRequest.mock.calls
|
||||||
|
.map((c) => c[0] as { method: string; path: string; body?: string })
|
||||||
|
.filter((c) => c.method === "PUT");
|
||||||
|
}
|
||||||
|
|
||||||
|
describe("hikvisionFixedZone", () => {
|
||||||
|
it("inverts the sign the POSIX way and keeps minutes", () => {
|
||||||
|
expect(hikvisionFixedZone("2026-10-09T19:01:08+02:00")).toBe("CST-2:00:00");
|
||||||
|
expect(hikvisionFixedZone("2026-12-09T18:01:08+01:00")).toBe("CST-1:00:00");
|
||||||
|
expect(hikvisionFixedZone("2026-10-09T09:01:08-05:30")).toBe("CST+5:30:00");
|
||||||
|
expect(hikvisionFixedZone("2026-10-09T17:01:08+00:00")).toBe("CST0:00:00");
|
||||||
|
});
|
||||||
|
it("refuses a host time without an offset", () => {
|
||||||
|
expect(() => hikvisionFixedZone("2026-10-09T19:01:08")).toThrow(/utc offset/);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("hikvision syncClock — zone", () => {
|
||||||
|
it("rewrites a factory CST-8 zone even when the instant is right", async () => {
|
||||||
|
const cam = makeCamera() as unknown as { syncClock(iso: string, max: number): Promise<{ synced: boolean; zoneChanged?: boolean; timeZone?: string; driftSeconds: number | null }> };
|
||||||
|
// Same instant as the host (17:01:08Z), shown in Beijing time.
|
||||||
|
digestRequest
|
||||||
|
.mockResolvedValueOnce(xmlReply(200, timeXml("2026-10-10T01:01:08+08:00", "CST-8:00:00")))
|
||||||
|
.mockResolvedValueOnce(xmlReply(200, "<ResponseStatus><statusCode>1</statusCode></ResponseStatus>"));
|
||||||
|
const r = await cam.syncClock("2026-10-09T19:01:08+02:00", 60);
|
||||||
|
expect(r).toMatchObject({ synced: true, zoneChanged: true, timeZone: "CST-2:00:00", driftSeconds: 0 });
|
||||||
|
const puts = putCalls();
|
||||||
|
expect(puts).toHaveLength(1);
|
||||||
|
expect(puts[0].path).toBe("/ISAPI/System/time");
|
||||||
|
expect(puts[0].body).toContain("<timeZone>CST-2:00:00</timeZone>");
|
||||||
|
expect(puts[0].body).toContain("<localTime>2026-10-09T19:01:08+02:00</localTime>");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("leaves a camera on the right zone with small drift alone", async () => {
|
||||||
|
const cam = makeCamera() as unknown as { syncClock(iso: string, max: number): Promise<{ synced: boolean; zoneChanged?: boolean }> };
|
||||||
|
digestRequest.mockResolvedValueOnce(xmlReply(200, timeXml("2026-10-09T19:01:20+02:00", "CST-2:00:00")));
|
||||||
|
const r = await cam.syncClock("2026-10-09T19:01:08+02:00", 60);
|
||||||
|
expect(r).toMatchObject({ synced: false, zoneChanged: false });
|
||||||
|
expect(putCalls()).toHaveLength(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("re-sets the clock (same zone) when drift exceeds the threshold", async () => {
|
||||||
|
const cam = makeCamera() as unknown as { syncClock(iso: string, max: number): Promise<{ synced: boolean; zoneChanged?: boolean }> };
|
||||||
|
digestRequest
|
||||||
|
.mockResolvedValueOnce(xmlReply(200, timeXml("1970-01-01T08:00:00+02:00", "CST-2:00:00")))
|
||||||
|
.mockResolvedValueOnce(xmlReply(200, "<ResponseStatus><statusCode>1</statusCode></ResponseStatus>"));
|
||||||
|
const r = await cam.syncClock("2026-10-09T19:01:08+02:00", 60);
|
||||||
|
expect(r).toMatchObject({ synced: true, zoneChanged: false });
|
||||||
|
expect(putCalls()[0].body).toContain("<timeZone>CST-2:00:00</timeZone>");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import type {
|
import type {
|
||||||
CameraDevice,
|
CameraDevice,
|
||||||
|
LiveStreamDevice,
|
||||||
|
LiveVideoSource,
|
||||||
ClockSyncResult,
|
ClockSyncResult,
|
||||||
DeviceHealth,
|
DeviceHealth,
|
||||||
Snapshot,
|
Snapshot,
|
||||||
@@ -14,6 +16,7 @@ import {
|
|||||||
stubLog,
|
stubLog,
|
||||||
} from "./common.js";
|
} from "./common.js";
|
||||||
import { digestGet, digestRequest } from "./http-digest.js";
|
import { digestGet, digestRequest } from "./http-digest.js";
|
||||||
|
import { RtspMjpegStream } from "./rtsp-mjpeg.js";
|
||||||
|
|
||||||
// Camera drivers — entry/exit snapshot-on-event. The host pulls a still over
|
// Camera drivers — entry/exit snapshot-on-event. The host pulls a still over
|
||||||
// HTTP when an event fires; the bytes are stored and referenced from the signed
|
// HTTP when an event fires; the bytes are stored and referenced from the signed
|
||||||
@@ -74,6 +77,8 @@ class HttpCamera implements CameraDevice {
|
|||||||
// Source outbound from the device-facing NIC on a multi-homed host (the
|
// Source outbound from the device-facing NIC on a multi-homed host (the
|
||||||
// multi-subnet source-address trap — see wiki/concepts/wsl-dev-networking.md).
|
// multi-subnet source-address trap — see wiki/concepts/wsl-dev-networking.md).
|
||||||
readonly #localAddress: string | undefined;
|
readonly #localAddress: string | undefined;
|
||||||
|
/** RTSP port for the live view (not a Setup field: 554 everywhere so far). */
|
||||||
|
readonly #rtspPort: number;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly driverId: string,
|
readonly driverId: string,
|
||||||
@@ -92,6 +97,7 @@ class HttpCamera implements CameraDevice {
|
|||||||
this.#localAddress = config.localAddress
|
this.#localAddress = config.localAddress
|
||||||
? String(config.localAddress)
|
? String(config.localAddress)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
this.#rtspPort = Number(config.rtspPort ?? 554);
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect(): Promise<void> {}
|
async connect(): Promise<void> {}
|
||||||
@@ -165,6 +171,23 @@ class HttpCamera implements CameraDevice {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** An RTSP MJPEG session on `path` with this camera's address + credentials. */
|
||||||
|
protected rtspStream(path: string): LiveVideoSource {
|
||||||
|
return new RtspMjpegStream({
|
||||||
|
host: this.#host,
|
||||||
|
port: this.#rtspPort,
|
||||||
|
path,
|
||||||
|
user: this.#user,
|
||||||
|
password: this.#password,
|
||||||
|
timeoutMs: this.#timeout,
|
||||||
|
...(this.#localAddress ? { localAddress: this.#localAddress } : {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected get channel(): number {
|
||||||
|
return this.#channel;
|
||||||
|
}
|
||||||
|
|
||||||
/** Digest request against an arbitrary device path (ISAPI / CGI config reads+writes). */
|
/** Digest request against an arbitrary device path (ISAPI / CGI config reads+writes). */
|
||||||
protected deviceRequest(method: "GET" | "PUT", path: string, body?: string) {
|
protected deviceRequest(method: "GET" | "PUT", path: string, body?: string) {
|
||||||
return digestRequest({
|
return digestRequest({
|
||||||
@@ -189,15 +212,51 @@ class HttpCamera implements CameraDevice {
|
|||||||
// ANPR pushes. So the host (the site's time authority — offline-first, no NTP
|
// ANPR pushes. So the host (the site's time authority — offline-first, no NTP
|
||||||
// dependency) re-syncs the camera over the same Digest-auth ISAPI used for
|
// dependency) re-syncs the camera over the same Digest-auth ISAPI used for
|
||||||
// snapshots. The device monitor calls this at the offline→ready edge (the
|
// snapshots. The device monitor calls this at the offline→ready edge (the
|
||||||
// power-restored moment) + a daily backstop. See wiki/entities/lpr-camera.md.
|
// power-restored moment), a daily backstop, and whenever the site's UTC offset
|
||||||
|
// changes (DST). See wiki/entities/lpr-camera.md.
|
||||||
|
//
|
||||||
|
// TIME ZONE: the OSD shows the camera's LOCAL time = instant + its `timeZone` setting.
|
||||||
|
// park-2 (2026-10-09) ran both cameras on the factory CST-8 (Beijing): the instant was
|
||||||
|
// right, the burned-in time six hours off, and a correct-instant sync never touched it.
|
||||||
|
// This firmware (DS-2CD1047G3H) also ignores the DST rule in a POSIX-style zone string
|
||||||
|
// ("CET-1:00:00DST01:00:00,M3.5.0/02:00:00,M10.5.0/03:00:00" was accepted, echoed back,
|
||||||
|
// and NOT applied — OSD stayed on +01:00 in October). So the host owns DST too: the zone
|
||||||
|
// is written as a FIXED offset equal to the site's CURRENT offset ("CST-2:00:00" in summer,
|
||||||
|
// "CST-1:00:00" in winter — Hikvision's inverted POSIX sign) and rewritten at the next
|
||||||
|
// sync after the site's offset changes. The abbreviation is cosmetic (the camera renames
|
||||||
|
// whatever we send to "CST").
|
||||||
|
|
||||||
class HikvisionCamera extends HttpCamera {
|
/** The Hikvision `timeZone` string for a FIXED offset equal to `localIso`'s UTC offset:
|
||||||
|
* "+02:00" → "CST-2:00:00", "-05:30" → "CST+5:30:00", "+00:00" → "CST0:00:00". */
|
||||||
|
export function hikvisionFixedZone(localIso: string): string {
|
||||||
|
const m = localIso.match(/([+-])(\d{2}):(\d{2})$/);
|
||||||
|
if (!m) throw new Error(`syncClock: host time has no utc offset: ${localIso}`);
|
||||||
|
const hours = Number(m[2]);
|
||||||
|
const minutes = m[3];
|
||||||
|
if (hours === 0 && minutes === "00") return "CST0:00:00";
|
||||||
|
// POSIX (and Hikvision) sign is inverted: east of UTC is negative.
|
||||||
|
const sign = m[1] === "+" ? "-" : "+";
|
||||||
|
return `CST${sign}${hours}:${minutes}:00`;
|
||||||
|
}
|
||||||
|
|
||||||
|
class HikvisionCamera extends HttpCamera implements LiveStreamDevice {
|
||||||
/**
|
/**
|
||||||
* Read the camera clock; when it drifts more than `maxDriftSec` from `localIso`
|
* Live view for the booth's camera tiles: the channel's SUB-stream (x02) over RTSP,
|
||||||
* (the site's wall-clock now, WITH utc offset), set it via
|
* which must be set to MJPEG on the camera (H.264 is refused with that reason).
|
||||||
* PUT /ISAPI/System/time. The camera's own `timeZone` string is echoed back
|
* The ANPR/evidence stills keep coming from /picture on the configured stream —
|
||||||
* verbatim — we correct the CLOCK, never fight the tz/DST config; `localIso`'s
|
* the codec of the sub-stream does not change them (measured on park-lab
|
||||||
* explicit offset makes the instant unambiguous regardless of that config.
|
* 2026-11-17: no extra 503s with a stream open). See wiki/decisions/camera-live-view.md.
|
||||||
|
*/
|
||||||
|
openLiveStream(): LiveVideoSource {
|
||||||
|
return this.rtspStream(`/Streaming/Channels/${this.channel}02`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the camera clock + zone. Rewrite the zone when it is not the site's current
|
||||||
|
* fixed offset (see above); otherwise set the clock only when it drifts more than
|
||||||
|
* `maxDriftSec` from `localIso` (the site's wall-clock now, WITH utc offset). The PUT
|
||||||
|
* always carries both: `localIso`'s explicit offset makes the instant unambiguous
|
||||||
|
* regardless of the zone the camera applies to it.
|
||||||
*/
|
*/
|
||||||
async syncClock(localIso: string, maxDriftSec: number): Promise<ClockSyncResult> {
|
async syncClock(localIso: string, maxDriftSec: number): Promise<ClockSyncResult> {
|
||||||
const read = await this.deviceRequest("GET", "/ISAPI/System/time");
|
const read = await this.deviceRequest("GET", "/ISAPI/System/time");
|
||||||
@@ -207,6 +266,8 @@ class HikvisionCamera extends HttpCamera {
|
|||||||
const xml = read.body.toString("utf8");
|
const xml = read.body.toString("utf8");
|
||||||
const cameraTime = xml.match(/<localTime>([^<]+)<\/localTime>/)?.[1]?.trim() ?? null;
|
const cameraTime = xml.match(/<localTime>([^<]+)<\/localTime>/)?.[1]?.trim() ?? null;
|
||||||
const timeZone = xml.match(/<timeZone>([^<]+)<\/timeZone>/)?.[1]?.trim() ?? "";
|
const timeZone = xml.match(/<timeZone>([^<]+)<\/timeZone>/)?.[1]?.trim() ?? "";
|
||||||
|
const wantZone = hikvisionFixedZone(localIso);
|
||||||
|
const zoneChanged = timeZone !== wantZone;
|
||||||
|
|
||||||
// Drift: parse both sides as instants. A camera reply without a UTC offset (or
|
// Drift: parse both sides as instants. A camera reply without a UTC offset (or
|
||||||
// otherwise unparseable) can't be trusted → treat as infinite drift and sync.
|
// otherwise unparseable) can't be trusted → treat as infinite drift and sync.
|
||||||
@@ -215,21 +276,24 @@ class HikvisionCamera extends HttpCamera {
|
|||||||
const driftSeconds = Number.isFinite(cameraMs)
|
const driftSeconds = Number.isFinite(cameraMs)
|
||||||
? Math.round(Math.abs(hostMs - cameraMs) / 1000)
|
? Math.round(Math.abs(hostMs - cameraMs) / 1000)
|
||||||
: null;
|
: null;
|
||||||
if (driftSeconds != null && driftSeconds <= maxDriftSec) {
|
if (!zoneChanged && driftSeconds != null && driftSeconds <= maxDriftSec) {
|
||||||
return { driftSeconds, synced: false };
|
return { driftSeconds, synced: false, zoneChanged: false, timeZone };
|
||||||
}
|
}
|
||||||
|
|
||||||
const body =
|
const body =
|
||||||
`<?xml version="1.0" encoding="UTF-8"?>` +
|
`<?xml version="1.0" encoding="UTF-8"?>` +
|
||||||
`<Time><timeMode>manual</timeMode><localTime>${localIso}</localTime>` +
|
`<Time><timeMode>manual</timeMode><localTime>${localIso}</localTime>` +
|
||||||
(timeZone ? `<timeZone>${timeZone}</timeZone>` : "") +
|
`<timeZone>${wantZone}</timeZone>` +
|
||||||
`</Time>`;
|
`</Time>`;
|
||||||
const put = await this.deviceRequest("PUT", "/ISAPI/System/time", body);
|
const put = await this.deviceRequest("PUT", "/ISAPI/System/time", body);
|
||||||
if (put.status !== 200) {
|
if (put.status !== 200) {
|
||||||
throw new Error(`clock set failed: HTTP ${put.status}`);
|
throw new Error(`clock set failed: HTTP ${put.status}`);
|
||||||
}
|
}
|
||||||
stubLog(this.driverId, `clock synced (was ${driftSeconds ?? "unparseable"}s off)`);
|
stubLog(
|
||||||
return { driftSeconds, synced: true };
|
this.driverId,
|
||||||
|
`clock synced (was ${driftSeconds ?? "unparseable"}s off${zoneChanged ? `; zone ${timeZone || "unset"} → ${wantZone}` : ""})`,
|
||||||
|
);
|
||||||
|
return { driftSeconds, synced: true, zoneChanged, timeZone: wantZone };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import type { IncomingMessage } from "node:http";
|
|||||||
const md5 = (s: string) => createHash("md5").update(s).digest("hex");
|
const md5 = (s: string) => createHash("md5").update(s).digest("hex");
|
||||||
|
|
||||||
/** Parse a `WWW-Authenticate: Digest …` header into its k=v fields. */
|
/** Parse a `WWW-Authenticate: Digest …` header into its k=v fields. */
|
||||||
function parseChallenge(header: string): Record<string, string> {
|
export function parseChallenge(header: string): Record<string, string> {
|
||||||
const out: Record<string, string> = {};
|
const out: Record<string, string> = {};
|
||||||
const re = /(\w+)=(?:"([^"]*)"|([^,]*))/g;
|
const re = /(\w+)=(?:"([^"]*)"|([^,]*))/g;
|
||||||
let m: RegExpExecArray | null;
|
let m: RegExpExecArray | null;
|
||||||
@@ -21,7 +21,7 @@ function parseChallenge(header: string): Record<string, string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Build the `Authorization: Digest …` response value for a challenge. */
|
/** Build the `Authorization: Digest …` response value for a challenge. */
|
||||||
function buildAuthHeader(
|
export function buildAuthHeader(
|
||||||
c: Record<string, string>,
|
c: Record<string, string>,
|
||||||
user: string,
|
user: string,
|
||||||
password: string,
|
password: string,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import type {
|
|||||||
ReaderDevice,
|
ReaderDevice,
|
||||||
ReaderEvent,
|
ReaderEvent,
|
||||||
} from "../interfaces.js";
|
} from "../interfaces.js";
|
||||||
import type { DeviceConfig, DiscoverableDriver, DiscoveredDevice, ReaderDriver } from "../registry.js";
|
import type { ConfigField, DeviceConfig, DiscoverableDriver, DiscoveredDevice, ReaderDriver } from "../registry.js";
|
||||||
import { hostField, portField, stubLog } from "./common.js";
|
import { hostField, portField, stubLog } from "./common.js";
|
||||||
import {
|
import {
|
||||||
QR_CARD_INPUT_FORMATS,
|
QR_CARD_INPUT_FORMATS,
|
||||||
@@ -72,6 +72,20 @@ class StubReader implements ReaderDevice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Same-code debounce, applied HOST-SIDE by the read dispatcher (apps/server read-dispatch.ts)
|
||||||
|
* to every reader regardless of lane or credential kind: the same value from the same reader
|
||||||
|
* within this window is ONE presentation — the first verdict is replayed (same beep), nothing
|
||||||
|
* is signed twice. Born 2026-10-11 at park-2: the DT-008 reported one card twice 560 ms apart
|
||||||
|
* and the permit flow opened two sessions and pulsed the barrier twice. 0 disables. */
|
||||||
|
export const debounceField: ConfigField = {
|
||||||
|
key: "debounceMs",
|
||||||
|
label: "Same-code debounce (ms)",
|
||||||
|
type: "number",
|
||||||
|
required: false,
|
||||||
|
default: 5000,
|
||||||
|
help: "A repeat of the same card/QR/ticket on this reader within this window counts as the same presentation (first verdict replayed, no second entry/exit). 0 = off.",
|
||||||
|
};
|
||||||
|
|
||||||
export const wiegandReaderDriver: ReaderDriver = {
|
export const wiegandReaderDriver: ReaderDriver = {
|
||||||
id: "wiegand-reader",
|
id: "wiegand-reader",
|
||||||
category: "reader",
|
category: "reader",
|
||||||
@@ -85,6 +99,7 @@ export const wiegandReaderDriver: ReaderDriver = {
|
|||||||
{ value: "26", label: "Wiegand 26" },
|
{ value: "26", label: "Wiegand 26" },
|
||||||
{ value: "34", label: "Wiegand 34" },
|
{ value: "34", label: "Wiegand 34" },
|
||||||
] },
|
] },
|
||||||
|
debounceField,
|
||||||
],
|
],
|
||||||
create: (c) => new StubReader("wiegand-reader", c),
|
create: (c) => new StubReader("wiegand-reader", c),
|
||||||
};
|
};
|
||||||
@@ -96,7 +111,7 @@ export const tcpipReaderDriver: ReaderDriver = {
|
|||||||
description:
|
description:
|
||||||
"Network RF/optical reader seen only by the host; host decides and commands the relay.",
|
"Network RF/optical reader seen only by the host; host decides and commands the relay.",
|
||||||
transports: ["tcp-ip"],
|
transports: ["tcp-ip"],
|
||||||
configFields: [hostField, portField(9000)],
|
configFields: [hostField, portField(9000), debounceField],
|
||||||
create: (c) => new StubReader("tcpip-reader", c),
|
create: (c) => new StubReader("tcpip-reader", c),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -297,6 +312,7 @@ export const dingtianQrReaderDriver: ReaderDriver & DiscoverableDriver = {
|
|||||||
required: false,
|
required: false,
|
||||||
help: "The reader's IP on the device VLAN. With it, save sets the reader to HTTP mode pointing at this booth and the monitor pings it. Blank = configure the reader manually; no liveness.",
|
help: "The reader's IP on the device VLAN. With it, save sets the reader to HTTP mode pointing at this booth and the monitor pings it. Blank = configure the reader manually; no liveness.",
|
||||||
},
|
},
|
||||||
|
debounceField,
|
||||||
],
|
],
|
||||||
discover: discoverDingtianReaders,
|
discover: discoverDingtianReaders,
|
||||||
create: (c) => new DingtianQrReader("dingtian-qr-reader", c),
|
create: (c) => new DingtianQrReader("dingtian-qr-reader", c),
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
import { readFileSync } from "node:fs";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
import { JpegDepacketizer, MAX_FRAME_BYTES, rtpPayload, tablesForQ } from "./rfc2435.js";
|
||||||
|
|
||||||
|
// Fixture: two frames of RTP/JPEG captured from a park-lab Hikvision DS-2CD1043G2-LIU
|
||||||
|
// (sub-stream 102 set to MJPEG, 640×360, type 1, Q 48, last packet of a frame padded),
|
||||||
|
// stored as [u16 length][packet]... The expected JPEGs were rebuilt independently and
|
||||||
|
// verified to decode with Pillow (2026-11-17).
|
||||||
|
const dir = fileURLToPath(new URL("./__fixtures__/", import.meta.url));
|
||||||
|
const capture = readFileSync(`${dir}rtp-jpeg-2frames.bin`);
|
||||||
|
const expected = [readFileSync(`${dir}rtp-jpeg-frame0.jpg`), readFileSync(`${dir}rtp-jpeg-frame1.jpg`)];
|
||||||
|
|
||||||
|
function packets(buf: Buffer): Buffer[] {
|
||||||
|
const out: Buffer[] = [];
|
||||||
|
for (let i = 0; i < buf.length; ) {
|
||||||
|
const len = buf.readUInt16BE(i);
|
||||||
|
out.push(buf.subarray(i + 2, i + 2 + len));
|
||||||
|
i += 2 + len;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe("JpegDepacketizer", () => {
|
||||||
|
it("rebuilds the camera's frames byte-for-byte", () => {
|
||||||
|
const d = new JpegDepacketizer();
|
||||||
|
const frames = packets(capture)
|
||||||
|
.map((p) => d.push(p))
|
||||||
|
.filter((f): f is Buffer => f !== null);
|
||||||
|
expect(frames).toHaveLength(2);
|
||||||
|
expect(frames[0]!.equals(expected[0]!)).toBe(true);
|
||||||
|
expect(frames[1]!.equals(expected[1]!)).toBe(true);
|
||||||
|
expect(d.dropped).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("drops a frame with a missing packet and recovers on the next one", () => {
|
||||||
|
const d = new JpegDepacketizer();
|
||||||
|
const all = packets(capture);
|
||||||
|
// Remove the 3rd packet of frame 0.
|
||||||
|
const lossy = [...all.slice(0, 2), ...all.slice(3)];
|
||||||
|
const frames = lossy.map((p) => d.push(p)).filter((f): f is Buffer => f !== null);
|
||||||
|
expect(frames).toHaveLength(1);
|
||||||
|
expect(frames[0]!.equals(expected[1]!)).toBe(true);
|
||||||
|
expect(d.dropped).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("ignores packets until a frame start when joining mid-frame", () => {
|
||||||
|
const d = new JpegDepacketizer();
|
||||||
|
const all = packets(capture);
|
||||||
|
const firstEnd = all.findIndex((p) => (p[1]! & 0x80) !== 0);
|
||||||
|
const frames = all
|
||||||
|
.slice(2) // join inside frame 0
|
||||||
|
.map((p) => d.push(p))
|
||||||
|
.filter((f): f is Buffer => f !== null);
|
||||||
|
expect(firstEnd).toBeGreaterThan(2);
|
||||||
|
expect(frames).toHaveLength(1);
|
||||||
|
expect(frames[0]!.equals(expected[1]!)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("bounds a runaway frame", () => {
|
||||||
|
const d = new JpegDepacketizer();
|
||||||
|
const big = 60_000;
|
||||||
|
let seq = 1;
|
||||||
|
let offset = 0;
|
||||||
|
let out: Buffer | null = null;
|
||||||
|
while (offset <= MAX_FRAME_BYTES + big) {
|
||||||
|
const pkt = Buffer.alloc(12 + 8 + big);
|
||||||
|
pkt[0] = 0x80;
|
||||||
|
pkt[1] = 26;
|
||||||
|
pkt.writeUInt16BE(seq++ & 0xffff, 2);
|
||||||
|
pkt.writeUIntBE(offset, 13, 3);
|
||||||
|
pkt[16] = 1; // type
|
||||||
|
pkt[17] = 50; // Q
|
||||||
|
pkt[18] = 80; // 640/8
|
||||||
|
pkt[19] = 45; // 360/8
|
||||||
|
out = d.push(pkt) ?? out;
|
||||||
|
offset += big;
|
||||||
|
}
|
||||||
|
expect(out).toBeNull();
|
||||||
|
expect(d.dropped).toBe(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("rtpPayload", () => {
|
||||||
|
it("strips RTP padding", () => {
|
||||||
|
const pkt = Buffer.from([0xa0, 0x9a, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0xaa, 0xbb, 0, 0, 3]);
|
||||||
|
const r = rtpPayload(pkt)!;
|
||||||
|
expect(r.marker).toBe(true);
|
||||||
|
expect([...r.payload]).toEqual([0xaa, 0xbb]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("tablesForQ", () => {
|
||||||
|
it("Q 50 is the unscaled standard table", () => {
|
||||||
|
const t = tablesForQ(50);
|
||||||
|
expect(t.length).toBe(128);
|
||||||
|
expect(t[0]).toBe(16);
|
||||||
|
expect(t[64]).toBe(17);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
// RTP/JPEG depacketizer (RFC 2435). A camera that streams MJPEG over RTSP sends each
|
||||||
|
// frame as RTP packets carrying the JPEG *scan data* only, plus an 8-byte JPEG header
|
||||||
|
// (type, Q, width/8, height/8) and, for Q >= 128, the quantization tables in-band.
|
||||||
|
// The receiver rebuilds the JFIF headers (SOI, DQT, DRI, SOF0, standard DHT, SOS) in
|
||||||
|
// front of the reassembled scan data. No decode, no re-encode: we only reframe bytes.
|
||||||
|
//
|
||||||
|
// MEASURED on park-lab (2026-11-17, Hikvision DS-2CD1043G2-LIU fw V5.8.10 and
|
||||||
|
// DS-2CD1083G2-LIU fw V5.8.4, sub-stream 102 set to MJPEG 640×360): type 1 (4:2:0),
|
||||||
|
// Q 48 / 63 (tables derived from Q, none in-band), no restart markers, the last packet
|
||||||
|
// of every frame carries RTP padding. Frames rebuilt here decode cleanly.
|
||||||
|
// See wiki/decisions/camera-live-view.md.
|
||||||
|
|
||||||
|
/** Hard cap on one reassembled frame. A 640×360 MJPEG frame is ~15–30 KB; a frame
|
||||||
|
* growing past this is a broken stream, not a big picture — drop it. */
|
||||||
|
export const MAX_FRAME_BYTES = 2 * 1024 * 1024;
|
||||||
|
|
||||||
|
// Standard JPEG luma/chroma quantizers (ITU T.81 Annex K), in ZIGZAG order — which is
|
||||||
|
// the order a DQT segment carries. RFC 2435 Appendix A scales these by Q.
|
||||||
|
const LUMA_Q = [
|
||||||
|
16, 11, 12, 14, 12, 10, 16, 14, 13, 14, 18, 17, 16, 19, 24, 40, 26, 24, 22, 22, 24, 49, 35, 37, 29, 40, 58, 51, 61,
|
||||||
|
60, 57, 51, 56, 55, 64, 72, 92, 78, 64, 68, 87, 69, 55, 56, 80, 109, 81, 87, 95, 98, 103, 104, 103, 62, 77, 113,
|
||||||
|
121, 112, 100, 120, 92, 101, 103, 99,
|
||||||
|
];
|
||||||
|
const CHROMA_Q = [
|
||||||
|
17, 18, 18, 24, 21, 24, 47, 26, 26, 47, 99, 66, 56, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||||
|
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||||
|
99, 99, 99, 99, 99, 99,
|
||||||
|
];
|
||||||
|
|
||||||
|
/** RFC 2435 Appendix A MakeTables: Q 1..99 → luma+chroma tables (128 bytes, zigzag). */
|
||||||
|
export function tablesForQ(q: number): Buffer {
|
||||||
|
const qq = Math.min(99, Math.max(1, q));
|
||||||
|
const factor = qq < 50 ? Math.floor(5000 / qq) : 200 - qq * 2;
|
||||||
|
const scale = (v: number) => Math.min(255, Math.max(1, Math.floor((v * factor + 50) / 100)));
|
||||||
|
return Buffer.from([...LUMA_Q.map(scale), ...CHROMA_Q.map(scale)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Standard Huffman tables (ITU T.81 K.3), the ones RFC 2435 mandates.
|
||||||
|
const DC_LUMA_BITS = [0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0];
|
||||||
|
const DC_CHROMA_BITS = [0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];
|
||||||
|
const DC_VALS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
||||||
|
const AC_LUMA_BITS = [0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d];
|
||||||
|
const AC_LUMA_VALS = Buffer.from(
|
||||||
|
"01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9fa",
|
||||||
|
"hex",
|
||||||
|
);
|
||||||
|
const AC_CHROMA_BITS = [0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77];
|
||||||
|
const AC_CHROMA_VALS = Buffer.from(
|
||||||
|
"000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9fa",
|
||||||
|
"hex",
|
||||||
|
);
|
||||||
|
|
||||||
|
function dht(tableClass: number, id: number, bits: number[], vals: ArrayLike<number>): Buffer {
|
||||||
|
const len = 3 + bits.length + vals.length;
|
||||||
|
return Buffer.from([0xff, 0xc4, len >> 8, len & 0xff, (tableClass << 4) | id, ...bits, ...Array.from(vals)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const HUFFMAN = Buffer.concat([
|
||||||
|
dht(0, 0, DC_LUMA_BITS, DC_VALS),
|
||||||
|
dht(1, 0, AC_LUMA_BITS, AC_LUMA_VALS),
|
||||||
|
dht(0, 1, DC_CHROMA_BITS, DC_VALS),
|
||||||
|
dht(1, 1, AC_CHROMA_BITS, AC_CHROMA_VALS),
|
||||||
|
]);
|
||||||
|
|
||||||
|
/** Build the JFIF headers that precede the scan data (RFC 2435 Appendix B). */
|
||||||
|
export function jpegHeader(type: number, width: number, height: number, qtables: Buffer, dri: number): Buffer {
|
||||||
|
const parts: Buffer[] = [Buffer.from([0xff, 0xd8])];
|
||||||
|
const tableCount = Math.floor(qtables.length / 64);
|
||||||
|
for (let i = 0; i < tableCount; i++) {
|
||||||
|
parts.push(Buffer.from([0xff, 0xdb, 0, 67, i]), qtables.subarray(i * 64, i * 64 + 64));
|
||||||
|
}
|
||||||
|
if (dri) parts.push(Buffer.from([0xff, 0xdd, 0, 4, dri >> 8, dri & 0xff]));
|
||||||
|
// Type 0 = 4:2:2 (luma 2×1), type 1 = 4:2:0 (luma 2×2); types 64/65 = same + restart markers.
|
||||||
|
const lumaSampling = (type & 0x3f) === 0 ? 0x21 : 0x22;
|
||||||
|
const chromaTable = tableCount > 1 ? 1 : 0;
|
||||||
|
parts.push(
|
||||||
|
Buffer.from([
|
||||||
|
0xff, 0xc0, 0, 17, 8, height >> 8, height & 0xff, width >> 8, width & 0xff, 3,
|
||||||
|
1, lumaSampling, 0,
|
||||||
|
2, 0x11, chromaTable,
|
||||||
|
3, 0x11, chromaTable,
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
parts.push(HUFFMAN);
|
||||||
|
parts.push(Buffer.from([0xff, 0xda, 0, 12, 3, 1, 0x00, 2, 0x11, 3, 0x11, 0, 63, 0]));
|
||||||
|
return Buffer.concat(parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The RTP fixed header + CSRCs + optional extension; returns the payload (padding stripped). */
|
||||||
|
export function rtpPayload(packet: Buffer): { payload: Buffer; marker: boolean; seq: number } | null {
|
||||||
|
if (packet.length < 12 || packet[0]! >> 6 !== 2) return null;
|
||||||
|
const csrc = packet[0]! & 0x0f;
|
||||||
|
let offset = 12 + csrc * 4;
|
||||||
|
if (packet[0]! & 0x10) {
|
||||||
|
if (packet.length < offset + 4) return null;
|
||||||
|
offset += 4 + packet.readUInt16BE(offset + 2) * 4;
|
||||||
|
}
|
||||||
|
let end = packet.length;
|
||||||
|
if (packet[0]! & 0x20) end -= packet[packet.length - 1]!;
|
||||||
|
if (end < offset) return null;
|
||||||
|
return { payload: packet.subarray(offset, end), marker: (packet[1]! & 0x80) !== 0, seq: packet.readUInt16BE(2) };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reassembles RTP/JPEG packets into complete JPEG frames. Feed every RTP packet of the
|
||||||
|
* video track to `push`; it returns a finished frame on the packet carrying the marker
|
||||||
|
* bit, else null. A lost packet (sequence gap or fragment offset mismatch) drops the
|
||||||
|
* frame in progress — the next frame starts clean. Memory is bounded by MAX_FRAME_BYTES.
|
||||||
|
*/
|
||||||
|
export class JpegDepacketizer {
|
||||||
|
#chunks: Buffer[] = [];
|
||||||
|
#size = 0;
|
||||||
|
#expectOffset = 0;
|
||||||
|
#lastSeq: number | null = null;
|
||||||
|
#header: Buffer | null = null;
|
||||||
|
/** Q-derived tables are the same every frame; cache the last Q's. */
|
||||||
|
#qCache: { q: number; tables: Buffer } | null = null;
|
||||||
|
/** Frames dropped for loss/overflow (diagnostic). */
|
||||||
|
dropped = 0;
|
||||||
|
|
||||||
|
push(packet: Buffer): Buffer | null {
|
||||||
|
const rtp = rtpPayload(packet);
|
||||||
|
if (!rtp) return null;
|
||||||
|
const { payload, marker, seq } = rtp;
|
||||||
|
|
||||||
|
const gap = this.#lastSeq !== null && ((this.#lastSeq + 1) & 0xffff) !== seq;
|
||||||
|
this.#lastSeq = seq;
|
||||||
|
if (gap) this.#reset(true);
|
||||||
|
|
||||||
|
if (payload.length < 8) return null;
|
||||||
|
const fragOffset = payload.readUIntBE(1, 3);
|
||||||
|
const type = payload[4]!;
|
||||||
|
const q = payload[5]!;
|
||||||
|
const width = payload[6]! * 8;
|
||||||
|
const height = payload[7]! * 8;
|
||||||
|
let pos = 8;
|
||||||
|
let dri = 0;
|
||||||
|
if (type >= 64 && type <= 127) {
|
||||||
|
if (payload.length < pos + 4) return null;
|
||||||
|
dri = payload.readUInt16BE(pos);
|
||||||
|
pos += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fragOffset === 0) {
|
||||||
|
if (this.#chunks.length > 0) this.#reset(true); // previous frame never finished
|
||||||
|
let tables: Buffer;
|
||||||
|
if (q >= 128) {
|
||||||
|
if (payload.length < pos + 4) return null;
|
||||||
|
const len = payload.readUInt16BE(pos + 2);
|
||||||
|
pos += 4;
|
||||||
|
if (len === 0 || payload.length < pos + len) return null; // tables "sent earlier": unsupported
|
||||||
|
tables = Buffer.from(payload.subarray(pos, pos + len));
|
||||||
|
pos += len;
|
||||||
|
} else {
|
||||||
|
if (this.#qCache?.q !== q) this.#qCache = { q, tables: tablesForQ(q) };
|
||||||
|
tables = this.#qCache.tables;
|
||||||
|
}
|
||||||
|
this.#header = jpegHeader(type, width, height, tables, dri);
|
||||||
|
this.#expectOffset = 0;
|
||||||
|
} else if (!this.#header || fragOffset !== this.#expectOffset) {
|
||||||
|
// Joined mid-frame, or a fragment went missing: wait for the next frame start.
|
||||||
|
if (this.#header) this.#reset(true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = payload.subarray(pos);
|
||||||
|
this.#size += data.length;
|
||||||
|
if (this.#size > MAX_FRAME_BYTES) {
|
||||||
|
this.#reset(true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
this.#chunks.push(Buffer.from(data));
|
||||||
|
this.#expectOffset = fragOffset + data.length;
|
||||||
|
|
||||||
|
if (!marker) return null;
|
||||||
|
const body = Buffer.concat(this.#chunks, this.#size);
|
||||||
|
const header = this.#header!;
|
||||||
|
this.#reset(false);
|
||||||
|
const hasEoi = body.length >= 2 && body[body.length - 2] === 0xff && body[body.length - 1] === 0xd9;
|
||||||
|
return Buffer.concat(hasEoi ? [header, body] : [header, body, Buffer.from([0xff, 0xd9])]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#reset(dropped: boolean): void {
|
||||||
|
if (dropped && this.#chunks.length > 0) this.dropped++;
|
||||||
|
this.#chunks = [];
|
||||||
|
this.#size = 0;
|
||||||
|
this.#expectOffset = 0;
|
||||||
|
this.#header = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
import { createHash } from "node:crypto";
|
||||||
|
import { readFileSync } from "node:fs";
|
||||||
|
import { createServer, type Server, type Socket } from "node:net";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { afterEach, describe, expect, it } from "vitest";
|
||||||
|
import { parseSdpVideo, RtspCodecError, RtspMjpegStream } from "./rtsp-mjpeg.js";
|
||||||
|
|
||||||
|
// A fake RTSP camera on localhost: Digest-challenges the first DESCRIBE, answers the
|
||||||
|
// handshake the way the park-lab Hikvision does (absolute control URLs, Session with
|
||||||
|
// timeout=60, an extra audio track on the 1043), then replays the captured RTP/JPEG
|
||||||
|
// fixture interleaved on channel 0.
|
||||||
|
|
||||||
|
const dir = fileURLToPath(new URL("./__fixtures__/", import.meta.url));
|
||||||
|
const capture = readFileSync(`${dir}rtp-jpeg-2frames.bin`);
|
||||||
|
const expected0 = readFileSync(`${dir}rtp-jpeg-frame0.jpg`);
|
||||||
|
|
||||||
|
const USER = "viewer";
|
||||||
|
const PASS = "test-only";
|
||||||
|
const REALM = "IP Camera(TEST)";
|
||||||
|
const NONCE = "abc123";
|
||||||
|
const md5 = (s: string) => createHash("md5").update(s).digest("hex");
|
||||||
|
|
||||||
|
interface FakeOpts {
|
||||||
|
codec?: "JPEG" | "H264";
|
||||||
|
onRequest?: (method: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
let server: Server | null = null;
|
||||||
|
|
||||||
|
function fakeCamera(opts: FakeOpts = {}): Promise<number> {
|
||||||
|
let port = 0;
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
server = createServer((sock: Socket) => {
|
||||||
|
let buf = "";
|
||||||
|
sock.on("data", (chunk) => {
|
||||||
|
buf += chunk.toString("latin1");
|
||||||
|
let end: number;
|
||||||
|
while ((end = buf.indexOf("\r\n\r\n")) >= 0) {
|
||||||
|
const req = buf.slice(0, end);
|
||||||
|
buf = buf.slice(end + 4);
|
||||||
|
const [line, ...hdrs] = req.split("\r\n");
|
||||||
|
const [method, url] = line!.split(" ");
|
||||||
|
opts.onRequest?.(method!);
|
||||||
|
const h = Object.fromEntries(
|
||||||
|
hdrs.map((l) => [l.slice(0, l.indexOf(":")).toLowerCase(), l.slice(l.indexOf(":") + 1).trim()]),
|
||||||
|
);
|
||||||
|
const cseq = h["cseq"];
|
||||||
|
const auth = h["authorization"] ?? "";
|
||||||
|
const resp = /response="([^"]+)"/.exec(auth)?.[1];
|
||||||
|
const good = md5(`${md5(`${USER}:${REALM}:${PASS}`)}:${NONCE}:${md5(`${method}:${url}`)}`);
|
||||||
|
if (resp !== good) {
|
||||||
|
sock.write(
|
||||||
|
`RTSP/1.0 401 Unauthorized\r\nCSeq: ${cseq}\r\nWWW-Authenticate: Digest realm="${REALM}", nonce="${NONCE}", stale="FALSE"\r\n\r\n`,
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const base = `rtsp://127.0.0.1:${port}/Streaming/Channels/102`;
|
||||||
|
if (method === "DESCRIBE") {
|
||||||
|
const pt = opts.codec === "H264" ? "96" : "26";
|
||||||
|
const map = opts.codec === "H264" ? "a=rtpmap:96 H264/90000" : "a=rtpmap:26 JPEG/90000";
|
||||||
|
const sdp = [
|
||||||
|
"v=0",
|
||||||
|
`a=control:${base}/`,
|
||||||
|
`m=video 0 RTP/AVP ${pt}`,
|
||||||
|
`a=control:${base}/trackID=1`,
|
||||||
|
map,
|
||||||
|
"m=audio 0 RTP/AVP 0",
|
||||||
|
`a=control:${base}/trackID=2`,
|
||||||
|
"a=rtpmap:0 PCMU/8000",
|
||||||
|
"",
|
||||||
|
].join("\r\n");
|
||||||
|
sock.write(`RTSP/1.0 200 OK\r\nCSeq: ${cseq}\r\nContent-Type: application/sdp\r\nContent-Length: ${sdp.length}\r\n\r\n${sdp}`);
|
||||||
|
} else if (method === "SETUP") {
|
||||||
|
expect(url).toBe(`${base}/trackID=1`);
|
||||||
|
sock.write(`RTSP/1.0 200 OK\r\nCSeq: ${cseq}\r\nSession: 1234;timeout=60\r\nTransport: RTP/AVP/TCP;unicast;interleaved=0-1\r\n\r\n`);
|
||||||
|
} else if (method === "PLAY") {
|
||||||
|
sock.write(`RTSP/1.0 200 OK\r\nCSeq: ${cseq}\r\nSession: 1234\r\n\r\n`);
|
||||||
|
for (let i = 0; i < capture.length; ) {
|
||||||
|
const len = capture.readUInt16BE(i);
|
||||||
|
const head = Buffer.from([0x24, 0, len >> 8, len & 0xff]);
|
||||||
|
sock.write(Buffer.concat([head, capture.subarray(i + 2, i + 2 + len)]));
|
||||||
|
i += 2 + len;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sock.write(`RTSP/1.0 200 OK\r\nCSeq: ${cseq}\r\n\r\n`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sock.on("error", () => undefined);
|
||||||
|
});
|
||||||
|
server.listen(0, "127.0.0.1", () => {
|
||||||
|
port = (server!.address() as { port: number }).port;
|
||||||
|
resolve(port);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
await new Promise<void>((r) => (server ? server.close(() => r()) : r()));
|
||||||
|
server = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("RtspMjpegStream", () => {
|
||||||
|
it("authenticates, plays the video track and emits whole JPEG frames", async () => {
|
||||||
|
const methods: string[] = [];
|
||||||
|
const port = await fakeCamera({ onRequest: (m) => methods.push(m) });
|
||||||
|
const s = new RtspMjpegStream({ host: "127.0.0.1", port, path: "/Streaming/Channels/102", user: USER, password: PASS });
|
||||||
|
const frames: Buffer[] = [];
|
||||||
|
const got = new Promise<void>((resolve) =>
|
||||||
|
s.onFrame((f) => {
|
||||||
|
frames.push(f);
|
||||||
|
if (frames.length === 2) resolve();
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
await s.start();
|
||||||
|
await got;
|
||||||
|
expect(frames[0]!.equals(expected0)).toBe(true);
|
||||||
|
const ended = new Promise<Error | undefined>((r) => s.onEnd(r));
|
||||||
|
s.stop();
|
||||||
|
expect(await ended).toBeUndefined();
|
||||||
|
expect(methods.slice(0, 4)).toEqual(["DESCRIBE", "DESCRIBE", "SETUP", "PLAY"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("refuses an H.264 stream with a codec error and closes", async () => {
|
||||||
|
const port = await fakeCamera({ codec: "H264" });
|
||||||
|
const s = new RtspMjpegStream({ host: "127.0.0.1", port, path: "/Streaming/Channels/102", user: USER, password: PASS });
|
||||||
|
const ended = new Promise<Error | undefined>((r) => s.onEnd(r));
|
||||||
|
await expect(s.start()).rejects.toBeInstanceOf(RtspCodecError);
|
||||||
|
expect(await ended).toBeInstanceOf(RtspCodecError);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("reports a wrong password without looping", async () => {
|
||||||
|
const methods: string[] = [];
|
||||||
|
const port = await fakeCamera({ onRequest: (m) => methods.push(m) });
|
||||||
|
const s = new RtspMjpegStream({ host: "127.0.0.1", port, path: "/Streaming/Channels/102", user: USER, password: "wrong" });
|
||||||
|
await expect(s.start()).rejects.toThrow(/auth rejected/);
|
||||||
|
expect(methods).toEqual(["DESCRIBE", "DESCRIBE"]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("parseSdpVideo", () => {
|
||||||
|
it("resolves a relative control against the base", () => {
|
||||||
|
const sdp = "v=0\r\nm=video 0 RTP/AVP 26\r\na=control:trackID=1\r\n";
|
||||||
|
expect(parseSdpVideo(sdp, "rtsp://h/s/")).toEqual({ control: "rtsp://h/s/trackID=1", codec: "JPEG" });
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,336 @@
|
|||||||
|
import { connect, type Socket } from "node:net";
|
||||||
|
import { buildAuthHeader, parseChallenge } from "./http-digest.js";
|
||||||
|
import { JpegDepacketizer } from "./rfc2435.js";
|
||||||
|
import type { LiveVideoSource } from "../interfaces.js";
|
||||||
|
|
||||||
|
// Minimal RTSP client for an MJPEG video track: DESCRIBE → SETUP (RTP over the RTSP TCP
|
||||||
|
// connection, "interleaved") → PLAY, then RTP/JPEG packets are reassembled into JPEG
|
||||||
|
// frames (rfc2435.ts). Digest auth, a keepalive at half the session timeout, a stall
|
||||||
|
// watchdog, and bounded buffers. It never decodes video: an H.264/H.265 track is
|
||||||
|
// refused with a clear reason (the operator sets the camera's sub-stream to MJPEG).
|
||||||
|
//
|
||||||
|
// Why RTSP and not the camera's HTTP MJPEG preview: the Hikvision G2 line answers
|
||||||
|
// /ISAPI/Streaming/channels/102/httpPreview with `notSupport` (measured on park-lab,
|
||||||
|
// 2026-11-17). Why MJPEG and not H.264: every MJPEG frame is a whole picture, so a
|
||||||
|
// view is live ~150 ms after PLAY; H.264 waits for a keyframe (every 2.5–4 s on these
|
||||||
|
// cameras), and no H.264 decoder is needed anywhere. See wiki/decisions/camera-live-view.md.
|
||||||
|
|
||||||
|
export interface RtspMjpegOptions {
|
||||||
|
readonly host: string;
|
||||||
|
readonly port?: number;
|
||||||
|
/** Path of the stream, e.g. "/Streaming/Channels/102". */
|
||||||
|
readonly path: string;
|
||||||
|
readonly user: string;
|
||||||
|
readonly password: string;
|
||||||
|
/** Bind outbound to the device-facing NIC on a multi-homed host. */
|
||||||
|
readonly localAddress?: string;
|
||||||
|
/** Per-request timeout for the RTSP handshake. */
|
||||||
|
readonly timeoutMs?: number;
|
||||||
|
/** No frame for this long after PLAY ends the stream with an error. */
|
||||||
|
readonly stallMs?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The stream exists but is not MJPEG (e.g. H.264). Not retryable until reconfigured. */
|
||||||
|
export class RtspCodecError extends Error {
|
||||||
|
readonly retryable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Cap on unparsed bytes held from the socket. One RTP packet is ≤ 64 KB; anything
|
||||||
|
* beyond this means the stream is garbage or we stopped draining it. */
|
||||||
|
const MAX_BUFFER_BYTES = 1024 * 1024;
|
||||||
|
const USER_AGENT = "parking-system";
|
||||||
|
|
||||||
|
interface RtspResponse {
|
||||||
|
status: number;
|
||||||
|
headers: Record<string, string>;
|
||||||
|
body: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Pending {
|
||||||
|
resolve: (r: RtspResponse) => void;
|
||||||
|
reject: (e: Error) => void;
|
||||||
|
timer: ReturnType<typeof setTimeout>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Pick the video track from an SDP: its control URL and whether it is JPEG. */
|
||||||
|
export function parseSdpVideo(sdp: string, baseUrl: string): { control: string; codec: string } | null {
|
||||||
|
const lines = sdp.split(/\r?\n/);
|
||||||
|
let inVideo = false;
|
||||||
|
let payloadTypes: string[] = [];
|
||||||
|
let control: string | null = null;
|
||||||
|
const rtpmap = new Map<string, string>();
|
||||||
|
let found: { control: string | null; pts: string[]; map: Map<string, string> } | null = null;
|
||||||
|
const flush = () => {
|
||||||
|
if (inVideo && !found) found = { control, pts: payloadTypes, map: new Map(rtpmap) };
|
||||||
|
};
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.startsWith("m=")) {
|
||||||
|
flush();
|
||||||
|
inVideo = line.startsWith("m=video");
|
||||||
|
payloadTypes = inVideo ? line.split(" ").slice(3) : [];
|
||||||
|
control = null;
|
||||||
|
rtpmap.clear();
|
||||||
|
} else if (inVideo && line.startsWith("a=control:")) {
|
||||||
|
control = line.slice("a=control:".length).trim();
|
||||||
|
} else if (inVideo && line.startsWith("a=rtpmap:")) {
|
||||||
|
const m = /^a=rtpmap:(\d+)\s+([^/\s]+)/.exec(line);
|
||||||
|
if (m) rtpmap.set(m[1]!, m[2]!.toUpperCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flush();
|
||||||
|
if (!found) return null;
|
||||||
|
const f = found as { control: string | null; pts: string[]; map: Map<string, string> };
|
||||||
|
const pt = f.pts[0] ?? "";
|
||||||
|
// Static payload type 26 is JPEG by definition (RFC 3551), rtpmap or not.
|
||||||
|
const codec = f.map.get(pt) ?? (pt === "26" ? "JPEG" : `PT${pt}`);
|
||||||
|
let url = baseUrl;
|
||||||
|
if (f.control && f.control !== "*") {
|
||||||
|
url = /^rtsp:\/\//i.test(f.control) ? f.control : `${baseUrl.replace(/\/$/, "")}/${f.control}`;
|
||||||
|
}
|
||||||
|
return { control: url, codec };
|
||||||
|
}
|
||||||
|
|
||||||
|
export class RtspMjpegStream implements LiveVideoSource {
|
||||||
|
readonly #o: Required<Omit<RtspMjpegOptions, "localAddress">> & { localAddress?: string };
|
||||||
|
readonly #url: string;
|
||||||
|
#socket: Socket | null = null;
|
||||||
|
#buf: Buffer = Buffer.alloc(0);
|
||||||
|
#cseq = 0;
|
||||||
|
#pending = new Map<number, Pending>();
|
||||||
|
#challenge: Record<string, string> | null = null;
|
||||||
|
#session: string | null = null;
|
||||||
|
#keepalive: ReturnType<typeof setInterval> | null = null;
|
||||||
|
#stallTimer: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
#depack = new JpegDepacketizer();
|
||||||
|
#frameCbs: Array<(jpeg: Buffer) => void> = [];
|
||||||
|
#endCbs: Array<(err?: Error) => void> = [];
|
||||||
|
#ended = false;
|
||||||
|
#playing = false;
|
||||||
|
|
||||||
|
constructor(o: RtspMjpegOptions) {
|
||||||
|
this.#o = { port: 554, timeoutMs: 8000, stallMs: 10_000, ...o };
|
||||||
|
this.#url = `rtsp://${o.host}:${this.#o.port}${o.path}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
onFrame(cb: (jpeg: Buffer) => void): void {
|
||||||
|
this.#frameCbs.push(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
onEnd(cb: (err?: Error) => void): void {
|
||||||
|
this.#endCbs.push(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
async start(): Promise<void> {
|
||||||
|
try {
|
||||||
|
await this.#handshake();
|
||||||
|
} catch (err) {
|
||||||
|
this.#end(err as Error); // never leave a half-open session holding a camera slot
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async #handshake(): Promise<void> {
|
||||||
|
await this.#open();
|
||||||
|
const describe = await this.#request("DESCRIBE", this.#url, { Accept: "application/sdp" });
|
||||||
|
if (describe.status !== 200) throw new Error(`RTSP DESCRIBE ${describe.status}`);
|
||||||
|
const base = describe.headers["content-base"] ?? this.#url;
|
||||||
|
const video = parseSdpVideo(describe.body, base);
|
||||||
|
if (!video) throw new RtspCodecError("RTSP stream has no video track");
|
||||||
|
if (video.codec !== "JPEG") {
|
||||||
|
throw new RtspCodecError(`camera stream is ${video.codec}, not MJPEG (set the sub-stream codec to MJPEG)`);
|
||||||
|
}
|
||||||
|
const setup = await this.#request("SETUP", video.control, {
|
||||||
|
Transport: "RTP/AVP/TCP;unicast;interleaved=0-1",
|
||||||
|
});
|
||||||
|
if (setup.status !== 200) throw new Error(`RTSP SETUP ${setup.status}`);
|
||||||
|
const sessionHeader = setup.headers["session"] ?? "";
|
||||||
|
this.#session = sessionHeader.split(";")[0]!.trim() || null;
|
||||||
|
if (!this.#session) throw new Error("RTSP SETUP returned no session");
|
||||||
|
const timeoutSec = Number(/timeout=(\d+)/i.exec(sessionHeader)?.[1] ?? 60);
|
||||||
|
const play = await this.#request("PLAY", base, { Range: "npt=0.000-" });
|
||||||
|
if (play.status !== 200) throw new Error(`RTSP PLAY ${play.status}`);
|
||||||
|
this.#playing = true;
|
||||||
|
// Keepalive at half the advertised timeout (park-lab cameras: timeout=60 and they
|
||||||
|
// did not drop a 150 s session without one, but other firmware may).
|
||||||
|
const every = Math.max(5, Math.floor(timeoutSec / 2)) * 1000;
|
||||||
|
this.#keepalive = setInterval(() => {
|
||||||
|
this.#request("GET_PARAMETER", base, {}).catch(() => undefined);
|
||||||
|
}, every);
|
||||||
|
this.#keepalive.unref?.();
|
||||||
|
this.#armStall();
|
||||||
|
}
|
||||||
|
|
||||||
|
stop(): void {
|
||||||
|
if (this.#ended) return;
|
||||||
|
if (this.#socket && this.#session && this.#playing) {
|
||||||
|
// Best-effort TEARDOWN so the camera frees its stream slot now, not at timeout.
|
||||||
|
try {
|
||||||
|
this.#socket.write(this.#format("TEARDOWN", this.#url, {}));
|
||||||
|
} catch {
|
||||||
|
/* closing anyway */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.#end();
|
||||||
|
}
|
||||||
|
|
||||||
|
#open(): Promise<void> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const socket = connect({
|
||||||
|
host: this.#o.host,
|
||||||
|
port: this.#o.port,
|
||||||
|
...(this.#o.localAddress ? { localAddress: this.#o.localAddress } : {}),
|
||||||
|
});
|
||||||
|
socket.setNoDelay(true);
|
||||||
|
const timer = setTimeout(() => socket.destroy(new Error("RTSP connect timeout")), this.#o.timeoutMs);
|
||||||
|
socket.once("connect", () => {
|
||||||
|
clearTimeout(timer);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
socket.once("error", (err) => {
|
||||||
|
clearTimeout(timer);
|
||||||
|
reject(err);
|
||||||
|
this.#end(err);
|
||||||
|
});
|
||||||
|
socket.on("data", (chunk: Buffer) => this.#onData(chunk));
|
||||||
|
socket.on("close", () => this.#end(this.#ended ? undefined : new Error("RTSP connection closed")));
|
||||||
|
this.#socket = socket;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#format(method: string, url: string, headers: Record<string, string>): string {
|
||||||
|
const cseq = ++this.#cseq;
|
||||||
|
const lines = [`${method} ${url} RTSP/1.0`, `CSeq: ${cseq}`, `User-Agent: ${USER_AGENT}`];
|
||||||
|
if (this.#session) lines.push(`Session: ${this.#session}`);
|
||||||
|
if (this.#challenge) {
|
||||||
|
lines.push(`Authorization: ${buildAuthHeader(this.#challenge, this.#o.user, this.#o.password, method, url)}`);
|
||||||
|
}
|
||||||
|
for (const [k, v] of Object.entries(headers)) lines.push(`${k}: ${v}`);
|
||||||
|
return lines.join("\r\n") + "\r\n\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
async #request(method: string, url: string, headers: Record<string, string>): Promise<RtspResponse> {
|
||||||
|
let res = await this.#send(method, url, headers);
|
||||||
|
if (res.status === 401 && res.headers["www-authenticate"] && !this.#challengeFresh) {
|
||||||
|
this.#challenge = parseChallenge(res.headers["www-authenticate"]);
|
||||||
|
this.#challengeFresh = true;
|
||||||
|
res = await this.#send(method, url, headers);
|
||||||
|
}
|
||||||
|
if (res.status !== 401) this.#challengeFresh = false;
|
||||||
|
if (res.status === 401) throw new Error("RTSP auth rejected (check username/password)");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** True right after a fresh challenge: a second 401 is a wrong password, not a stale nonce. */
|
||||||
|
#challengeFresh = false;
|
||||||
|
|
||||||
|
#send(method: string, url: string, headers: Record<string, string>): Promise<RtspResponse> {
|
||||||
|
const socket = this.#socket;
|
||||||
|
if (!socket || this.#ended) return Promise.reject(new Error("RTSP connection closed"));
|
||||||
|
const text = this.#format(method, url, headers);
|
||||||
|
const cseq = this.#cseq;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const timer = setTimeout(() => {
|
||||||
|
this.#pending.delete(cseq);
|
||||||
|
reject(new Error(`RTSP ${method} timeout`));
|
||||||
|
}, this.#o.timeoutMs);
|
||||||
|
this.#pending.set(cseq, { resolve, reject, timer });
|
||||||
|
socket.write(text);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#onData(chunk: Buffer): void {
|
||||||
|
this.#buf = this.#buf.length === 0 ? chunk : Buffer.concat([this.#buf, chunk]);
|
||||||
|
if (this.#buf.length > MAX_BUFFER_BYTES) {
|
||||||
|
this.#end(new Error("RTSP receive buffer overflow"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (;;) {
|
||||||
|
if (this.#buf.length === 0) return;
|
||||||
|
if (this.#buf[0] === 0x24) {
|
||||||
|
// Interleaved binary: '$', channel, 16-bit length, packet.
|
||||||
|
if (this.#buf.length < 4) return;
|
||||||
|
const len = this.#buf.readUInt16BE(2);
|
||||||
|
if (this.#buf.length < 4 + len) return;
|
||||||
|
const channel = this.#buf[1];
|
||||||
|
const packet = this.#buf.subarray(4, 4 + len);
|
||||||
|
this.#buf = this.#buf.subarray(4 + len);
|
||||||
|
if (channel === 0) this.#onRtp(packet);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (this.#buf.subarray(0, 5).toString("latin1") === "RTSP/") {
|
||||||
|
const headEnd = this.#buf.indexOf("\r\n\r\n");
|
||||||
|
if (headEnd < 0) return;
|
||||||
|
const head = this.#buf.subarray(0, headEnd).toString("latin1");
|
||||||
|
const headers: Record<string, string> = {};
|
||||||
|
for (const line of head.split("\r\n").slice(1)) {
|
||||||
|
const i = line.indexOf(":");
|
||||||
|
if (i > 0) headers[line.slice(0, i).trim().toLowerCase()] = line.slice(i + 1).trim();
|
||||||
|
}
|
||||||
|
const bodyLen = Number(headers["content-length"] ?? 0);
|
||||||
|
if (this.#buf.length < headEnd + 4 + bodyLen) return;
|
||||||
|
const body = this.#buf.subarray(headEnd + 4, headEnd + 4 + bodyLen).toString("utf8");
|
||||||
|
this.#buf = this.#buf.subarray(headEnd + 4 + bodyLen);
|
||||||
|
const status = Number(/^RTSP\/\d\.\d\s+(\d+)/.exec(head)?.[1] ?? 0);
|
||||||
|
const cseq = Number(headers["cseq"] ?? -1);
|
||||||
|
const p = this.#pending.get(cseq);
|
||||||
|
if (p) {
|
||||||
|
this.#pending.delete(cseq);
|
||||||
|
clearTimeout(p.timer);
|
||||||
|
p.resolve({ status, headers, body });
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Out of sync: skip to the next plausible start ('$' or "RTSP/").
|
||||||
|
let next = -1;
|
||||||
|
for (let i = 1; i < this.#buf.length; i++) {
|
||||||
|
const b = this.#buf[i];
|
||||||
|
if (b === 0x24 || (b === 0x52 && this.#buf.subarray(i, i + 5).toString("latin1") === "RTSP/")) {
|
||||||
|
next = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.#buf = next < 0 ? Buffer.alloc(0) : this.#buf.subarray(next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#onRtp(packet: Buffer): void {
|
||||||
|
const frame = this.#depack.push(packet);
|
||||||
|
if (!frame) return;
|
||||||
|
this.#armStall();
|
||||||
|
for (const cb of this.#frameCbs) {
|
||||||
|
try {
|
||||||
|
cb(frame);
|
||||||
|
} catch {
|
||||||
|
/* a subscriber's failure never stops the stream */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#armStall(): void {
|
||||||
|
if (this.#stallTimer) clearTimeout(this.#stallTimer);
|
||||||
|
this.#stallTimer = setTimeout(() => this.#end(new Error("RTSP stream stalled (no frames)")), this.#o.stallMs);
|
||||||
|
this.#stallTimer.unref?.();
|
||||||
|
}
|
||||||
|
|
||||||
|
#end(err?: Error): void {
|
||||||
|
if (this.#ended) return;
|
||||||
|
this.#ended = true;
|
||||||
|
if (this.#keepalive) clearInterval(this.#keepalive);
|
||||||
|
if (this.#stallTimer) clearTimeout(this.#stallTimer);
|
||||||
|
for (const p of this.#pending.values()) {
|
||||||
|
clearTimeout(p.timer);
|
||||||
|
p.reject(err ?? new Error("RTSP stream stopped"));
|
||||||
|
}
|
||||||
|
this.#pending.clear();
|
||||||
|
this.#buf = Buffer.alloc(0);
|
||||||
|
this.#socket?.destroy();
|
||||||
|
this.#socket = null;
|
||||||
|
for (const cb of this.#endCbs) {
|
||||||
|
try {
|
||||||
|
cb(err);
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,3 +32,6 @@ export {
|
|||||||
NoPrinterAvailableError,
|
NoPrinterAvailableError,
|
||||||
type PrinterInstance,
|
type PrinterInstance,
|
||||||
} from "./printer-routing.js";
|
} from "./printer-routing.js";
|
||||||
|
// Live camera view: RTSP MJPEG client + RTP/JPEG reassembly (wiki/decisions/camera-live-view.md).
|
||||||
|
export { RtspMjpegStream, RtspCodecError, type RtspMjpegOptions } from "./drivers/rtsp-mjpeg.js";
|
||||||
|
export { JpegDepacketizer } from "./drivers/rfc2435.js";
|
||||||
|
|||||||
@@ -198,13 +198,42 @@ export function isCamera(device: Device): device is Device & CameraDevice {
|
|||||||
return typeof (device as Partial<CameraDevice>).captureSnapshot === "function";
|
return typeof (device as Partial<CameraDevice>).captureSnapshot === "function";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** One live video session from a camera, delivered as complete JPEG frames. Advisory
|
||||||
|
* viewing only — nothing in the ledger or the gates depends on it. */
|
||||||
|
export interface LiveVideoSource {
|
||||||
|
/** Open the session; resolves once frames are flowing (or about to). Rejects on a
|
||||||
|
* connect/auth/codec failure, after which the source is ended. */
|
||||||
|
start(): Promise<void>;
|
||||||
|
/** End the session and free the camera's stream slot. Idempotent. */
|
||||||
|
stop(): void;
|
||||||
|
onFrame(cb: (jpeg: Buffer) => void): void;
|
||||||
|
/** Called once when the session ends; `err` absent = stopped on purpose. */
|
||||||
|
onEnd(cb: (err?: Error) => void): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Optional capability: a camera that can stream live video for the booth's camera
|
||||||
|
* tiles. See wiki/decisions/camera-live-view.md. */
|
||||||
|
export interface LiveStreamDevice {
|
||||||
|
openLiveStream(): LiveVideoSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isLiveStreamDevice(device: unknown): device is LiveStreamDevice {
|
||||||
|
return typeof (device as Partial<LiveStreamDevice> | null)?.openLiveStream === "function";
|
||||||
|
}
|
||||||
|
|
||||||
/** Outcome of a camera clock sync attempt (see ClockSyncDevice). */
|
/** Outcome of a camera clock sync attempt (see ClockSyncDevice). */
|
||||||
export interface ClockSyncResult {
|
export interface ClockSyncResult {
|
||||||
/** Camera-vs-host drift in whole seconds at check time; null = the camera's
|
/** Camera-vs-host drift in whole seconds at check time; null = the camera's
|
||||||
* reply was unparseable (treated as infinite drift → sync). */
|
* reply was unparseable (treated as infinite drift → sync). */
|
||||||
readonly driftSeconds: number | null;
|
readonly driftSeconds: number | null;
|
||||||
/** True when the camera clock was actually set (drift exceeded the threshold). */
|
/** True when the camera clock was actually set (drift exceeded the threshold, or the
|
||||||
|
* zone was rewritten — the clock is always re-sent with a zone change). */
|
||||||
readonly synced: boolean;
|
readonly synced: boolean;
|
||||||
|
/** True when the camera's time-ZONE setting was rewritten to the site's current UTC
|
||||||
|
* offset (Hikvision only; see HikvisionCamera.syncClock). */
|
||||||
|
readonly zoneChanged?: boolean;
|
||||||
|
/** The camera's zone string after the call (Hikvision only), for the log line. */
|
||||||
|
readonly timeZone?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Optional capability: a device whose clock the HOST can read + set. Hikvision
|
/** Optional capability: a device whose clock the HOST can read + set. Hikvision
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
import { crossingSide, parseCrossingLine, type CrossingLine } from "./index.js";
|
||||||
|
|
||||||
|
// A horizontal line drawn left→right across the middle of the frame.
|
||||||
|
const line: CrossingLine = { p1: { x: 0.1, y: 0.5 }, p2: { x: 0.9, y: 0.5 }, direction: "a-to-b" };
|
||||||
|
|
||||||
|
describe("crossingSide", () => {
|
||||||
|
it("puts the screen-left of p1→p2 on side A (above a left→right line)", () => {
|
||||||
|
expect(crossingSide(line, { x: 0.5, y: 0.2 })).toBe("a");
|
||||||
|
expect(crossingSide(line, { x: 0.5, y: 0.8 })).toBe("b");
|
||||||
|
});
|
||||||
|
it("swapping the points swaps the sides", () => {
|
||||||
|
const swapped = { ...line, p1: line.p2, p2: line.p1 };
|
||||||
|
expect(crossingSide(swapped, { x: 0.5, y: 0.2 })).toBe("b");
|
||||||
|
});
|
||||||
|
it("is null exactly on the line", () => {
|
||||||
|
expect(crossingSide(line, { x: 0.3, y: 0.5 })).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("parseCrossingLine", () => {
|
||||||
|
it("accepts a valid line", () => {
|
||||||
|
expect(parseCrossingLine(line)).toEqual(line);
|
||||||
|
});
|
||||||
|
it("rejects out-of-frame points, unknown directions and a click-length line", () => {
|
||||||
|
expect(parseCrossingLine({ ...line, p1: { x: -0.1, y: 0.5 } })).toBeNull();
|
||||||
|
expect(parseCrossingLine({ ...line, direction: "up" })).toBeNull();
|
||||||
|
expect(parseCrossingLine({ ...line, p2: { x: 0.11, y: 0.5 } })).toBeNull();
|
||||||
|
expect(parseCrossingLine(null)).toBeNull();
|
||||||
|
expect(parseCrossingLine({ p1: { x: "0.1", y: 0.5 }, p2: line.p2, direction: "both" })).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -2211,3 +2211,57 @@ export function effectiveModules(entitled: readonly ModuleId[], activated: reado
|
|||||||
}
|
}
|
||||||
return MODULE_IDS.filter((id) => on.has(id));
|
return MODULE_IDS.filter((id) => on.has(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Passage confirmation: a crossing line drawn over a camera's view ---------
|
||||||
|
// The fleet cameras have no line-crossing rule of their own, so Setup draws one (like a
|
||||||
|
// Hikvision Line Crossing rule: a segment, sides A and B, and the direction that counts),
|
||||||
|
// and the booth's own tracker judges the crossing. See wiki/concepts/passage-confirmation.md.
|
||||||
|
|
||||||
|
/** Which crossing counts as a passage: A→B, B→A, or either (A↔B). */
|
||||||
|
export const CROSSING_DIRECTIONS = ["a-to-b", "b-to-a", "both"] as const;
|
||||||
|
export type CrossingDirection = (typeof CROSSING_DIRECTIONS)[number];
|
||||||
|
|
||||||
|
/** A point normalised to the camera frame: x right, y down, both 0..1. */
|
||||||
|
export interface FramePoint {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Stored as camera `config.crossing`. Side A is on the LEFT of p1→p2 as seen on screen;
|
||||||
|
* swapping the sides is swapping the two points. */
|
||||||
|
export interface CrossingLine {
|
||||||
|
p1: FramePoint;
|
||||||
|
p2: FramePoint;
|
||||||
|
direction: CrossingDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Shortest line accepted (normalised length) — a click, not a drawn line. */
|
||||||
|
export const CROSSING_MIN_LENGTH = 0.03;
|
||||||
|
|
||||||
|
/** A valid `CrossingLine` from untrusted JSON, or null. */
|
||||||
|
export function parseCrossingLine(v: unknown): CrossingLine | null {
|
||||||
|
if (!v || typeof v !== "object") return null;
|
||||||
|
const o = v as Record<string, unknown>;
|
||||||
|
const pt = (p: unknown): FramePoint | null => {
|
||||||
|
if (!p || typeof p !== "object") return null;
|
||||||
|
const { x, y } = p as Record<string, unknown>;
|
||||||
|
if (typeof x !== "number" || typeof y !== "number") return null;
|
||||||
|
if (!(x >= 0 && x <= 1 && y >= 0 && y <= 1)) return null;
|
||||||
|
return { x, y };
|
||||||
|
};
|
||||||
|
const p1 = pt(o.p1);
|
||||||
|
const p2 = pt(o.p2);
|
||||||
|
const direction = o.direction;
|
||||||
|
if (!p1 || !p2) return null;
|
||||||
|
if (!CROSSING_DIRECTIONS.includes(direction as CrossingDirection)) return null;
|
||||||
|
if (Math.hypot(p2.x - p1.x, p2.y - p1.y) < CROSSING_MIN_LENGTH) return null;
|
||||||
|
return { p1, p2, direction: direction as CrossingDirection };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Which side of the (infinite) line a point lies on, or null exactly on it. Note the
|
||||||
|
* frame's y axis points down: the left of p1→p2 on screen has a negative cross product. */
|
||||||
|
export function crossingSide(line: CrossingLine, pt: FramePoint): "a" | "b" | null {
|
||||||
|
const { p1, p2 } = line;
|
||||||
|
const cross = (p2.x - p1.x) * (pt.y - p1.y) - (p2.y - p1.y) * (pt.x - p1.x);
|
||||||
|
return cross < 0 ? "a" : cross > 0 ? "b" : null;
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
config.json
|
||||||
|
out/
|
||||||
|
pid
|
||||||
|
config-*.json
|
||||||
|
out-*/
|
||||||
|
out.log
|
||||||
|
__pycache__/
|
||||||
|
models/
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Runs on park-lab: each capture mode alone for RUN_S seconds, then restores the two A/B containers.
|
||||||
|
set -u
|
||||||
|
cd ~/zone-anpr
|
||||||
|
RUN_S=${RUN_S:-120}
|
||||||
|
IMG=git.infra.msai.al/mca/parking_solution/parking-vision:stage-ef2c9f9
|
||||||
|
E=$(docker inspect zone-anpr-poc --format '{{range .Config.Env}}{{println .}}{{end}}' | grep -E '^CAM_(USER|PASS)=')
|
||||||
|
python3 - <<'PY'
|
||||||
|
import json
|
||||||
|
c = json.load(open("config.json"))
|
||||||
|
def mk(name, f):
|
||||||
|
d = json.loads(json.dumps(c)); d["http_port"] = 8093; d["out_dir"] = "out-bench"; d["metrics_s"] = 10
|
||||||
|
for cam in d["cameras"]: f(cam)
|
||||||
|
json.dump(d, open(f"config-{name}.json", "w"), indent=2)
|
||||||
|
mk("main", lambda cam: None)
|
||||||
|
mk("sub", lambda cam: cam.update(url=cam["url"].replace("/101", "/102")))
|
||||||
|
mk("mjpeg", lambda cam: cam.update(url=cam["url"].replace("/101", "/102"), mode="mjpeg"))
|
||||||
|
ip = {"entry": "10.0.10.6", "exit": "10.0.10.7"}
|
||||||
|
mk("snapshot", lambda cam: cam.update(mode="snapshot", snapshot_url="http://${CAM_USER}:${CAM_PASS}@" + ip[cam["name"]] + "/ISAPI/Streaming/channels/102/picture"))
|
||||||
|
PY
|
||||||
|
mkdir -p out-bench && chmod 777 out-bench
|
||||||
|
docker stop zone-anpr-poc zone-anpr-poc-sub >/dev/null
|
||||||
|
for m in main sub mjpeg snapshot; do
|
||||||
|
docker rm -f zb >/dev/null 2>&1
|
||||||
|
env $E docker run -d --name zb --network host -v $HOME/zone-anpr:/poc -w /poc -e CAM_USER -e CAM_PASS \
|
||||||
|
--entrypoint /app/.venv/bin/python $IMG -u zone_anpr.py config-$m.json >/dev/null
|
||||||
|
sleep "$RUN_S"
|
||||||
|
echo "== $m"
|
||||||
|
docker logs zb 2>&1 | grep -E "error|stream open|snapshot mode" | head -3
|
||||||
|
docker logs zb 2>&1 | grep metrics | tail -6 | python3 -c '
|
||||||
|
import sys, re, statistics as s
|
||||||
|
L = sys.stdin.read().splitlines()
|
||||||
|
c = [float(re.search(r"proc ([\d.]+) cores", l).group(1)) for l in L]
|
||||||
|
r = [int(re.search(r"rss (\d+) MB", l).group(1)) for l in L]
|
||||||
|
print(f" cores avg {s.mean(c):.2f} (min {min(c)}, max {max(c)}) rss {max(r)} MB")
|
||||||
|
print(" last:", L[-1][9:])'
|
||||||
|
done
|
||||||
|
docker rm -f zb >/dev/null
|
||||||
|
docker start zone-anpr-poc zone-anpr-poc-sub >/dev/null
|
||||||
|
echo restored
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"cameras": [
|
||||||
|
{
|
||||||
|
"name": "entry",
|
||||||
|
"url": "rtsp://${CAM_USER}:${CAM_PASS}@10.0.10.6:554/Streaming/Channels/101",
|
||||||
|
"zone": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "exit",
|
||||||
|
"url": "rtsp://${CAM_USER}:${CAM_PASS}@10.0.10.7:554/Streaming/Channels/101",
|
||||||
|
"zone": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vehicle_model": "models/yolox_tiny.onnx",
|
||||||
|
"detect_fps": 5,
|
||||||
|
"min_plate_conf": 0.9,
|
||||||
|
"visit_gap_s": 3,
|
||||||
|
"threads": 2,
|
||||||
|
"metrics_s": 10,
|
||||||
|
"http_port": 8090,
|
||||||
|
"out_dir": "out"
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
"""Minimal ONVIF client: the vendor-neutral way to ask a camera for its snapshot URL.
|
||||||
|
Only what the PoC needs: GetProfiles + GetSnapshotUri, WS-UsernameToken digest auth."""
|
||||||
|
import base64, hashlib, os, re, urllib.request
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
|
|
||||||
|
def _call(host, user, pw, path, body):
|
||||||
|
nonce = os.urandom(16)
|
||||||
|
created = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
digest = base64.b64encode(hashlib.sha1(nonce + created.encode() + pw.encode()).digest()).decode()
|
||||||
|
env = f"""<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
|
||||||
|
xmlns:trt="http://www.onvif.org/ver10/media/wsdl">
|
||||||
|
<s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
|
||||||
|
<UsernameToken><Username>{user}</Username>
|
||||||
|
<Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">{digest}</Password>
|
||||||
|
<Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">{base64.b64encode(nonce).decode()}</Nonce>
|
||||||
|
<Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">{created}</Created>
|
||||||
|
</UsernameToken></Security></s:Header><s:Body>{body}</s:Body></s:Envelope>"""
|
||||||
|
req = urllib.request.Request(f"http://{host}{path}", env.encode(),
|
||||||
|
{"Content-Type": "application/soap+xml; charset=utf-8"})
|
||||||
|
return urllib.request.urlopen(req, timeout=10).read().decode()
|
||||||
|
|
||||||
|
|
||||||
|
def profiles(host, user, pw):
|
||||||
|
"""[(token, width, height)] in the camera's order (main stream first, as a rule)."""
|
||||||
|
x = _call(host, user, pw, "/onvif/media_service", "<trt:GetProfiles/>")
|
||||||
|
out = []
|
||||||
|
for p in re.findall(r"<trt:Profiles\b(.*?)</trt:Profiles>", x, re.S):
|
||||||
|
tok = re.search(r'token="([^"]+)"', p).group(1)
|
||||||
|
w = re.search(r"<tt:Width>(\d+)", p)
|
||||||
|
h = re.search(r"<tt:Height>(\d+)", p)
|
||||||
|
out.append((tok, int(w.group(1)) if w else 0, int(h.group(1)) if h else 0))
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def snapshot_uri(host, user, pw, token):
|
||||||
|
x = _call(host, user, pw, "/onvif/media_service",
|
||||||
|
f"<trt:GetSnapshotUri><trt:ProfileToken>{token}</trt:ProfileToken></trt:GetSnapshotUri>")
|
||||||
|
return re.search(r"<tt:Uri>([^<]+)</tt:Uri>", x).group(1).replace("&", "&")
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{"n": 1, "t": 1795278856.188, "box": [359.5, 404.1, 1268.1, 714.8]}
|
||||||
|
{"n": 2, "t": 1795278856.67, "box": [271.0, 402.1, 1272.8, 707.7]}
|
||||||
|
{"n": 3, "t": 1795278857.164, "box": [252.0, 400.2, 639.1, 549.4]}
|
||||||
|
{"n": 4, "t": 1795278857.501, "box": [236.7, 399.2, 522.6, 515.8]}
|
||||||
|
{"n": 5, "t": 1795278857.765, "box": [238.1, 400.0, 466.2, 492.5]}
|
||||||
|
{"n": 6, "t": 1795278858.046, "box": [225.0, 400.1, 408.6, 468.6]}
|
||||||
|
{"n": 7, "t": 1795278858.524, "box": [196.0, 399.5, 350.9, 450.6]}
|
||||||
|
{"n": 8, "t": 1795278858.788, "box": [174.9, 399.1, 324.5, 443.1]}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{"n": 1, "t": 1795278912.028, "box": [288.6, 400.8, 803.4, 614.6]}
|
||||||
|
{"n": 2, "t": 1795278912.213, "box": [300.1, 401.2, 834.3, 619.2]}
|
||||||
|
{"n": 3, "t": 1795278915.246, "box": [346.4, 401.2, 1007.4, 694.2]}
|
||||||
|
{"n": 4, "t": 1795278918.289, "box": [346.1, 401.0, 1002.0, 695.5]}
|
||||||
|
{"n": 5, "t": 1795278918.614, "box": [345.1, 400.9, 1006.1, 694.3]}
|
||||||
|
{"n": 6, "t": 1795278921.645, "box": [342.8, 400.9, 996.1, 690.2]}
|
||||||
|
{"n": 7, "t": 1795278922.046, "box": [328.9, 400.7, 962.1, 687.8]}
|
||||||
|
{"n": 8, "t": 1795278927.889, "box": [302.0, 400.0, 588.8, 520.7]}
|
||||||
|
{"n": 9, "t": 1795278928.191, "box": [183.0, 399.7, 396.8, 498.7]}
|
||||||
|
{"n": 10, "t": 1795278928.353, "box": [212.2, 399.5, 384.8, 466.0]}
|
||||||
|
{"n": 11, "t": 1795278928.749, "box": [193.8, 398.9, 387.0, 469.1]}
|
||||||
|
{"n": 12, "t": 1795278928.93, "box": [194.3, 399.0, 389.7, 469.9]}
|
||||||
|
{"n": 13, "t": 1795278929.149, "box": [199.4, 398.8, 388.5, 471.7]}
|
||||||
|
{"n": 14, "t": 1795278929.329, "box": [198.8, 398.8, 389.0, 472.6]}
|
||||||
|
{"n": 15, "t": 1795278929.469, "box": [200.5, 399.1, 388.4, 472.5]}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{"n": 1, "t": 1795278964.525, "box": [255.0, 399.1, 791.4, 630.7]}
|
||||||
|
{"n": 2, "t": 1795278964.775, "box": [271.3, 399.5, 829.0, 638.0]}
|
||||||
|
{"n": 3, "t": 1795278964.99, "box": [277.4, 400.7, 866.5, 676.5]}
|
||||||
|
{"n": 4, "t": 1795278965.322, "box": [284.8, 401.1, 924.2, 697.9]}
|
||||||
|
{"n": 5, "t": 1795278968.26, "box": [296.8, 400.9, 1164.0, 714.7]}
|
||||||
|
{"n": 6, "t": 1795278968.66, "box": [308.3, 403.3, 1256.8, 712.4]}
|
||||||
|
{"n": 7, "t": 1795278969.162, "box": [332.7, 402.2, 1268.4, 713.1]}
|
||||||
|
{"n": 8, "t": 1795278969.471, "box": [370.8, 400.8, 1279.4, 718.5]}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{"n": 1, "t": 1795279001.551, "box": [512.5, 402.3, 1220.2, 710.0]}
|
||||||
|
{"n": 2, "t": 1795279002.049, "box": [381.0, 399.1, 964.3, 646.6]}
|
||||||
|
{"n": 3, "t": 1795279002.373, "box": [424.8, 399.9, 1280.2, 680.1]}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{"n": 1, "t": 1795279020.659, "box": [296.2, 399.7, 870.5, 652.9]}
|
||||||
|
{"n": 2, "t": 1795279020.852, "box": [302.1, 400.8, 898.2, 686.7]}
|
||||||
|
{"n": 3, "t": 1795279021.14, "box": [306.4, 400.1, 953.3, 701.8]}
|
||||||
|
{"n": 4, "t": 1795279021.307, "box": [308.0, 399.9, 975.5, 703.7]}
|
||||||
|
{"n": 5, "t": 1795279024.34, "box": [300.4, 398.0, 1023.6, 712.1]}
|
||||||
|
{"n": 6, "t": 1795279024.685, "box": [309.6, 397.9, 1013.2, 712.9]}
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
{"n": 1, "t": 1795280372.905, "box": [329.2, 401.6, 862.4, 611.7]}
|
||||||
|
{"n": 2, "t": 1795280373.124, "box": [340.6, 399.3, 872.8, 596.5]}
|
||||||
|
{"n": 3, "t": 1795280373.307, "box": [357.8, 399.6, 906.9, 618.2]}
|
||||||
|
{"n": 4, "t": 1795280373.406, "box": [358.5, 399.8, 925.0, 631.2]}
|
||||||
|
{"n": 5, "t": 1795280373.713, "box": [363.0, 398.6, 956.7, 649.0]}
|
||||||
|
{"n": 6, "t": 1795280373.815, "box": [364.2, 398.9, 962.6, 644.5]}
|
||||||
|
{"n": 7, "t": 1795280374.114, "box": [368.3, 399.8, 990.5, 649.9]}
|
||||||
|
{"n": 8, "t": 1795280374.194, "box": [369.6, 399.9, 995.5, 651.3]}
|
||||||
|
{"n": 9, "t": 1795280374.513, "box": [371.0, 399.8, 1013.0, 666.4]}
|
||||||
|
{"n": 10, "t": 1795280374.615, "box": [370.4, 400.0, 1014.8, 666.3]}
|
||||||
|
{"n": 11, "t": 1795280374.914, "box": [371.5, 399.9, 1015.9, 667.5]}
|
||||||
|
{"n": 12, "t": 1795280375.105, "box": [369.8, 400.0, 1021.9, 669.1]}
|
||||||
|
{"n": 13, "t": 1795280375.305, "box": [371.1, 400.3, 1019.3, 668.6]}
|
||||||
|
{"n": 14, "t": 1795280375.489, "box": [370.2, 400.1, 1021.0, 669.2]}
|
||||||
|
{"n": 15, "t": 1795280375.729, "box": [371.3, 400.0, 1019.6, 667.1]}
|
||||||
|
{"n": 16, "t": 1795280375.887, "box": [375.6, 400.8, 1021.3, 671.3]}
|
||||||
|
{"n": 17, "t": 1795280376.108, "box": [377.0, 400.8, 1019.0, 671.3]}
|
||||||
|
{"n": 18, "t": 1795280376.286, "box": [378.5, 400.7, 1020.4, 671.4]}
|
||||||
|
{"n": 19, "t": 1795280376.449, "box": [377.9, 400.7, 1022.4, 673.6]}
|
||||||
|
{"n": 20, "t": 1795280376.666, "box": [371.4, 400.9, 1020.9, 674.0]}
|
||||||
|
{"n": 21, "t": 1795280376.905, "box": [371.2, 401.0, 1028.4, 675.7]}
|
||||||
|
{"n": 22, "t": 1795280377.085, "box": [370.4, 401.2, 1031.4, 673.0]}
|
||||||
|
{"n": 23, "t": 1795280377.336, "box": [370.1, 400.6, 1046.8, 685.5]}
|
||||||
|
{"n": 24, "t": 1795280377.505, "box": [380.8, 400.5, 1056.2, 691.3]}
|
||||||
|
{"n": 25, "t": 1795280377.705, "box": [370.9, 399.7, 1067.7, 697.6]}
|
||||||
|
{"n": 26, "t": 1795280377.884, "box": [378.6, 399.6, 1082.3, 701.0]}
|
||||||
|
{"n": 27, "t": 1795280378.132, "box": [381.0, 400.3, 1111.2, 697.6]}
|
||||||
|
{"n": 28, "t": 1795280378.208, "box": [384.9, 400.1, 1120.9, 701.6]}
|
||||||
|
{"n": 29, "t": 1795280378.446, "box": [383.1, 400.2, 1119.1, 702.3]}
|
||||||
|
{"n": 30, "t": 1795280378.707, "box": [388.5, 400.3, 1113.0, 701.4]}
|
||||||
|
{"n": 31, "t": 1795280378.929, "box": [389.1, 400.2, 1119.3, 703.5]}
|
||||||
|
{"n": 32, "t": 1795280379.088, "box": [383.1, 399.8, 1119.1, 703.6]}
|
||||||
|
{"n": 33, "t": 1795280379.229, "box": [380.8, 399.8, 1113.9, 703.0]}
|
||||||
|
{"n": 34, "t": 1795280379.487, "box": [380.9, 400.0, 1118.3, 702.4]}
|
||||||
|
{"n": 35, "t": 1795280379.728, "box": [378.4, 399.9, 1117.3, 703.4]}
|
||||||
|
{"n": 36, "t": 1795280379.865, "box": [379.4, 399.8, 1129.9, 703.3]}
|
||||||
|
{"n": 37, "t": 1795280380.107, "box": [379.8, 399.6, 1124.4, 704.0]}
|
||||||
|
{"n": 38, "t": 1795280380.285, "box": [378.3, 399.7, 1125.8, 705.3]}
|
||||||
|
{"n": 39, "t": 1795280380.509, "box": [381.0, 399.8, 1131.5, 704.8]}
|
||||||
|
{"n": 40, "t": 1795280380.687, "box": [382.5, 399.8, 1125.7, 704.5]}
|
||||||
|
{"n": 41, "t": 1795280380.926, "box": [380.3, 399.8, 1125.0, 704.5]}
|
||||||
|
{"n": 42, "t": 1795280381.088, "box": [383.6, 399.8, 1122.4, 703.6]}
|
||||||
|
{"n": 43, "t": 1795280381.328, "box": [380.1, 399.6, 1123.3, 704.0]}
|
||||||
|
{"n": 44, "t": 1795280381.406, "box": [382.0, 399.7, 1126.7, 704.5]}
|
||||||
|
{"n": 45, "t": 1795280381.684, "box": [379.1, 399.7, 1126.7, 705.0]}
|
||||||
|
{"n": 46, "t": 1795280381.848, "box": [383.3, 399.9, 1125.1, 704.6]}
|
||||||
|
{"n": 47, "t": 1795280382.129, "box": [381.4, 399.9, 1121.7, 704.0]}
|
||||||
|
{"n": 48, "t": 1795280382.186, "box": [381.0, 399.8, 1122.8, 704.6]}
|
||||||
|
{"n": 49, "t": 1795280382.506, "box": [381.5, 399.8, 1126.2, 705.1]}
|
||||||
|
{"n": 50, "t": 1795280382.607, "box": [382.4, 399.9, 1124.2, 704.6]}
|
||||||
|
{"n": 51, "t": 1795280382.926, "box": [384.9, 399.9, 1122.3, 704.3]}
|
||||||
|
{"n": 52, "t": 1795280383.029, "box": [382.2, 399.8, 1126.8, 704.2]}
|
||||||
|
{"n": 53, "t": 1795280383.327, "box": [379.6, 399.7, 1124.3, 704.4]}
|
||||||
|
{"n": 54, "t": 1795280383.409, "box": [381.1, 399.9, 1122.9, 704.1]}
|
||||||
|
{"n": 55, "t": 1795280383.648, "box": [381.5, 399.7, 1126.1, 704.4]}
|
||||||
|
{"n": 56, "t": 1795280383.825, "box": [379.7, 399.9, 1127.3, 704.9]}
|
||||||
|
{"n": 57, "t": 1795280384.106, "box": [380.5, 399.9, 1123.7, 704.3]}
|
||||||
|
{"n": 58, "t": 1795280384.209, "box": [382.9, 399.8, 1123.2, 703.9]}
|
||||||
|
{"n": 59, "t": 1795280384.453, "box": [383.9, 399.9, 1122.8, 704.9]}
|
||||||
|
{"n": 60, "t": 1795280384.609, "box": [378.8, 399.7, 1126.4, 705.3]}
|
||||||
|
{"n": 61, "t": 1795280384.848, "box": [381.1, 400.0, 1122.8, 704.1]}
|
||||||
|
{"n": 62, "t": 1795280385.015, "box": [383.3, 399.9, 1123.6, 704.3]}
|
||||||
|
{"n": 63, "t": 1795280385.266, "box": [384.7, 399.8, 1119.3, 705.1]}
|
||||||
|
{"n": 64, "t": 1795280385.433, "box": [385.4, 399.9, 1121.4, 704.6]}
|
||||||
|
{"n": 65, "t": 1795280385.73, "box": [382.2, 399.6, 1122.5, 705.2]}
|
||||||
|
{"n": 66, "t": 1795280385.786, "box": [381.7, 400.0, 1126.3, 704.7]}
|
||||||
|
{"n": 67, "t": 1795280386.049, "box": [381.8, 399.9, 1126.4, 705.2]}
|
||||||
|
{"n": 68, "t": 1795280386.23, "box": [379.6, 399.8, 1122.8, 704.5]}
|
||||||
|
{"n": 69, "t": 1795280386.526, "box": [381.6, 399.9, 1123.3, 704.0]}
|
||||||
|
{"n": 70, "t": 1795280386.59, "box": [384.0, 400.0, 1122.9, 704.1]}
|
||||||
|
{"n": 71, "t": 1795280386.927, "box": [380.2, 399.9, 1123.4, 704.0]}
|
||||||
|
{"n": 72, "t": 1795280387.135, "box": [384.5, 400.0, 1121.9, 704.7]}
|
||||||
|
{"n": 73, "t": 1795280387.335, "box": [381.1, 399.8, 1121.4, 704.6]}
|
||||||
|
{"n": 74, "t": 1795280387.398, "box": [380.2, 399.6, 1121.9, 703.7]}
|
||||||
|
{"n": 75, "t": 1795280387.725, "box": [380.4, 400.0, 1119.2, 703.8]}
|
||||||
|
{"n": 76, "t": 1795280387.786, "box": [381.6, 399.8, 1120.4, 704.2]}
|
||||||
|
{"n": 77, "t": 1795280388.127, "box": [383.9, 400.0, 1124.2, 705.0]}
|
||||||
|
{"n": 78, "t": 1795280388.224, "box": [382.7, 399.8, 1121.6, 705.1]}
|
||||||
|
{"n": 79, "t": 1795280388.514, "box": [383.3, 400.0, 1122.1, 704.4]}
|
||||||
|
{"n": 80, "t": 1795280388.695, "box": [384.9, 399.9, 1123.7, 704.6]}
|
||||||
|
{"n": 81, "t": 1795280388.934, "box": [384.0, 399.9, 1122.9, 704.4]}
|
||||||
|
{"n": 82, "t": 1795280389.076, "box": [385.7, 399.9, 1124.5, 704.3]}
|
||||||
|
{"n": 83, "t": 1795280389.254, "box": [384.7, 399.8, 1126.5, 704.6]}
|
||||||
|
{"n": 84, "t": 1795280389.513, "box": [382.6, 399.7, 1121.5, 705.0]}
|
||||||
|
{"n": 85, "t": 1795280389.652, "box": [382.3, 400.0, 1124.0, 704.5]}
|
||||||
|
{"n": 86, "t": 1795280389.887, "box": [381.5, 400.0, 1121.8, 704.4]}
|
||||||
|
{"n": 87, "t": 1795280390.128, "box": [384.0, 399.7, 1122.8, 704.7]}
|
||||||
|
{"n": 88, "t": 1795280390.306, "box": [382.6, 399.8, 1122.9, 705.1]}
|
||||||
|
{"n": 89, "t": 1795280390.529, "box": [381.4, 399.8, 1121.7, 705.7]}
|
||||||
|
{"n": 90, "t": 1795280390.666, "box": [384.2, 399.9, 1123.1, 704.6]}
|
||||||
|
{"n": 91, "t": 1795280390.907, "box": [382.9, 399.8, 1123.2, 704.8]}
|
||||||
|
{"n": 92, "t": 1795280391.093, "box": [384.0, 400.1, 1122.9, 704.2]}
|
||||||
|
{"n": 93, "t": 1795280391.328, "box": [382.6, 399.9, 1122.9, 704.6]}
|
||||||
|
{"n": 94, "t": 1795280391.407, "box": [381.1, 399.7, 1121.4, 704.5]}
|
||||||
|
{"n": 95, "t": 1795280391.685, "box": [383.8, 399.9, 1122.7, 704.1]}
|
||||||
|
{"n": 96, "t": 1795280391.787, "box": [383.9, 399.9, 1122.7, 704.3]}
|
||||||
|
{"n": 97, "t": 1795280392.13, "box": [383.9, 400.0, 1122.8, 704.1]}
|
||||||
|
{"n": 98, "t": 1795280392.188, "box": [382.2, 399.8, 1123.9, 704.8]}
|
||||||
|
{"n": 99, "t": 1795280392.51, "box": [383.3, 400.0, 1122.2, 704.7]}
|
||||||
|
{"n": 100, "t": 1795280392.609, "box": [382.7, 399.7, 1123.0, 704.1]}
|
||||||
|
{"n": 101, "t": 1795280392.928, "box": [384.5, 399.8, 1121.9, 704.8]}
|
||||||
|
{"n": 102, "t": 1795280393.011, "box": [381.9, 400.1, 1123.7, 704.5]}
|
||||||
|
{"n": 103, "t": 1795280393.248, "box": [383.5, 399.8, 1123.8, 705.1]}
|
||||||
|
{"n": 104, "t": 1795280393.402, "box": [382.7, 399.8, 1121.5, 704.8]}
|
||||||
|
{"n": 105, "t": 1795280393.654, "box": [380.6, 400.1, 1122.3, 705.1]}
|
||||||
|
{"n": 106, "t": 1795280393.847, "box": [380.9, 400.1, 1124.1, 704.8]}
|
||||||
|
{"n": 107, "t": 1795280394.129, "box": [380.8, 399.7, 1121.1, 704.1]}
|
||||||
|
{"n": 108, "t": 1795280394.186, "box": [382.7, 399.9, 1120.1, 704.1]}
|
||||||
|
{"n": 109, "t": 1795280394.507, "box": [382.1, 399.9, 1122.4, 704.6]}
|
||||||
|
{"n": 110, "t": 1795280394.747, "box": [382.9, 400.1, 1121.8, 705.1]}
|
||||||
|
{"n": 111, "t": 1795280394.933, "box": [382.0, 399.9, 1119.4, 703.4]}
|
||||||
|
{"n": 112, "t": 1795280395.006, "box": [382.8, 400.0, 1121.6, 703.5]}
|
||||||
|
{"n": 113, "t": 1795280395.346, "box": [378.2, 399.9, 1122.9, 705.2]}
|
||||||
|
{"n": 114, "t": 1795280395.408, "box": [381.4, 400.0, 1121.7, 704.7]}
|
||||||
|
{"n": 115, "t": 1795280395.648, "box": [382.8, 399.9, 1121.7, 704.3]}
|
||||||
|
{"n": 116, "t": 1795280395.819, "box": [379.7, 399.9, 1121.4, 704.9]}
|
||||||
|
{"n": 117, "t": 1795280396.127, "box": [378.7, 399.9, 1124.8, 704.9]}
|
||||||
|
{"n": 118, "t": 1795280396.186, "box": [380.4, 400.2, 1126.5, 704.6]}
|
||||||
|
{"n": 119, "t": 1795280396.534, "box": [382.7, 400.0, 1121.5, 705.0]}
|
||||||
|
{"n": 120, "t": 1795280396.747, "box": [383.2, 400.0, 1124.9, 705.0]}
|
||||||
|
{"n": 121, "t": 1795280396.916, "box": [383.6, 400.1, 1125.3, 704.2]}
|
||||||
|
{"n": 122, "t": 1795280397.017, "box": [382.4, 400.0, 1127.0, 704.2]}
|
||||||
|
{"n": 123, "t": 1795280397.314, "box": [383.2, 400.1, 1120.6, 705.1]}
|
||||||
|
{"n": 124, "t": 1795280397.547, "box": [382.7, 400.0, 1123.0, 704.1]}
|
||||||
|
{"n": 125, "t": 1795280397.654, "box": [382.3, 399.8, 1124.1, 705.1]}
|
||||||
|
{"n": 126, "t": 1795280397.816, "box": [384.3, 399.9, 1123.1, 704.1]}
|
||||||
|
{"n": 127, "t": 1795280398.079, "box": [381.5, 399.9, 1124.7, 704.9]}
|
||||||
|
{"n": 128, "t": 1795280398.217, "box": [382.8, 399.8, 1121.7, 705.1]}
|
||||||
|
{"n": 129, "t": 1795280398.516, "box": [383.6, 399.8, 1119.5, 704.8]}
|
||||||
|
{"n": 130, "t": 1795280398.617, "box": [381.7, 399.7, 1122.0, 704.7]}
|
||||||
|
{"n": 131, "t": 1795280398.916, "box": [384.0, 400.0, 1124.3, 704.7]}
|
||||||
|
{"n": 132, "t": 1795280399.107, "box": [384.4, 399.9, 1123.3, 705.5]}
|
||||||
|
{"n": 133, "t": 1795280399.306, "box": [384.0, 399.9, 1122.8, 704.3]}
|
||||||
|
{"n": 134, "t": 1795280399.55, "box": [384.4, 399.9, 1123.3, 704.6]}
|
||||||
|
{"n": 135, "t": 1795280399.726, "box": [382.6, 400.0, 1124.4, 704.2]}
|
||||||
|
{"n": 136, "t": 1795280399.887, "box": [382.4, 399.7, 1118.4, 705.0]}
|
||||||
|
{"n": 137, "t": 1795280400.147, "box": [380.9, 399.9, 1121.2, 705.5]}
|
||||||
|
{"n": 138, "t": 1795280400.346, "box": [384.2, 399.9, 1121.6, 705.8]}
|
||||||
|
{"n": 139, "t": 1795280400.525, "box": [384.2, 399.8, 1121.6, 705.4]}
|
||||||
|
{"n": 140, "t": 1795280400.691, "box": [381.1, 400.0, 1122.8, 705.6]}
|
||||||
|
{"n": 141, "t": 1795280400.932, "box": [382.8, 399.7, 1126.0, 705.3]}
|
||||||
|
{"n": 142, "t": 1795280401.091, "box": [384.9, 399.8, 1132.5, 706.0]}
|
||||||
|
{"n": 143, "t": 1795280401.334, "box": [383.2, 399.9, 1136.6, 706.4]}
|
||||||
|
{"n": 144, "t": 1795280401.487, "box": [382.9, 399.7, 1142.2, 706.2]}
|
||||||
|
{"n": 145, "t": 1795280401.732, "box": [371.4, 400.0, 1186.1, 709.2]}
|
||||||
|
{"n": 146, "t": 1795280401.865, "box": [378.6, 399.6, 1204.5, 708.5]}
|
||||||
|
{"n": 147, "t": 1795280402.151, "box": [380.8, 400.0, 1229.6, 715.3]}
|
||||||
|
{"n": 148, "t": 1795280402.294, "box": [383.4, 402.2, 1264.3, 709.3]}
|
||||||
|
{"n": 149, "t": 1795280402.528, "box": [438.3, 401.4, 1278.6, 716.7]}
|
||||||
|
{"n": 150, "t": 1795280402.611, "box": [448.6, 401.4, 1260.1, 705.8]}
|
||||||
|
{"n": 151, "t": 1795280402.847, "box": [521.0, 401.9, 1235.8, 711.4]}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{"n": 1, "t": 1795280459.966, "box": [376.2, 401.5, 1283.0, 707.6]}
|
||||||
|
{"n": 2, "t": 1795280460.168, "box": [342.6, 402.2, 1233.6, 708.7]}
|
||||||
|
{"n": 3, "t": 1795280460.365, "box": [314.2, 402.0, 1275.8, 683.7]}
|
||||||
|
{"n": 4, "t": 1795280460.615, "box": [282.6, 399.4, 761.5, 579.1]}
|
||||||
|
{"n": 5, "t": 1795280460.764, "box": [259.8, 400.0, 608.1, 527.5]}
|
||||||
|
{"n": 6, "t": 1795280461.01, "box": [295.1, 399.4, 546.5, 506.4]}
|
||||||
|
{"n": 7, "t": 1795280461.189, "box": [253.3, 400.2, 473.9, 488.3]}
|
||||||
|
{"n": 8, "t": 1795280461.412, "box": [249.6, 399.8, 439.0, 470.9]}
|
||||||
|
{"n": 9, "t": 1795280461.568, "box": [191.7, 399.3, 401.8, 459.9]}
|
||||||
|
{"n": 10, "t": 1795280461.813, "box": [188.6, 399.7, 370.5, 451.0]}
|
||||||
|
{"n": 11, "t": 1795280461.946, "box": [182.5, 399.5, 330.9, 442.7]}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
{"n": 1, "t": 1795280480.424, "box": [295.5, 400.4, 858.7, 651.0]}
|
||||||
|
{"n": 2, "t": 1795280480.548, "box": [294.2, 400.4, 893.7, 669.8]}
|
||||||
|
{"n": 3, "t": 1795280480.763, "box": [303.0, 399.5, 935.0, 700.4]}
|
||||||
|
{"n": 4, "t": 1795280481.015, "box": [305.4, 399.5, 972.9, 705.7]}
|
||||||
|
{"n": 5, "t": 1795280481.088, "box": [304.0, 398.7, 984.6, 704.6]}
|
||||||
|
{"n": 6, "t": 1795280481.403, "box": [309.2, 399.2, 1011.5, 709.6]}
|
||||||
|
{"n": 7, "t": 1795280481.571, "box": [298.6, 398.2, 1011.9, 712.6]}
|
||||||
|
{"n": 8, "t": 1795280481.806, "box": [310.5, 398.9, 1014.1, 708.7]}
|
||||||
|
{"n": 9, "t": 1795280481.946, "box": [311.1, 399.0, 1018.9, 708.8]}
|
||||||
|
{"n": 10, "t": 1795280482.188, "box": [304.8, 398.2, 1018.1, 712.3]}
|
||||||
|
{"n": 11, "t": 1795280482.426, "box": [315.4, 399.0, 1020.5, 710.3]}
|
||||||
|
{"n": 12, "t": 1795280482.617, "box": [315.2, 398.7, 1021.6, 710.0]}
|
||||||
|
{"n": 13, "t": 1795280482.788, "box": [317.1, 398.8, 1019.4, 710.4]}
|
||||||
|
{"n": 14, "t": 1795280482.987, "box": [307.8, 398.3, 1018.3, 713.3]}
|
||||||
|
{"n": 15, "t": 1795280483.166, "box": [303.6, 398.0, 1024.0, 713.0]}
|
||||||
|
{"n": 16, "t": 1795280483.406, "box": [311.4, 399.0, 1033.1, 709.1]}
|
||||||
|
{"n": 17, "t": 1795280483.586, "box": [312.4, 399.8, 1029.9, 709.3]}
|
||||||
|
{"n": 18, "t": 1795280483.786, "box": [306.2, 399.9, 1039.3, 711.0]}
|
||||||
|
{"n": 19, "t": 1795280484.027, "box": [315.8, 399.7, 1046.0, 711.9]}
|
||||||
|
{"n": 20, "t": 1795280484.229, "box": [311.7, 399.5, 1056.3, 712.0]}
|
||||||
|
{"n": 21, "t": 1795280484.366, "box": [317.7, 399.5, 1065.3, 711.1]}
|
||||||
|
{"n": 22, "t": 1795280484.606, "box": [311.6, 399.5, 1073.9, 711.8]}
|
||||||
|
{"n": 23, "t": 1795280484.828, "box": [320.4, 399.6, 1085.7, 712.7]}
|
||||||
|
{"n": 24, "t": 1795280484.988, "box": [322.7, 400.2, 1100.1, 714.0]}
|
||||||
|
{"n": 25, "t": 1795280485.091, "box": [325.4, 400.0, 1099.7, 714.4]}
|
||||||
|
{"n": 26, "t": 1795280485.404, "box": [331.4, 400.1, 1089.2, 713.0]}
|
||||||
|
{"n": 27, "t": 1795280485.605, "box": [333.0, 400.0, 1089.3, 713.8]}
|
||||||
|
{"n": 28, "t": 1795280485.813, "box": [318.1, 399.9, 1092.4, 713.0]}
|
||||||
|
{"n": 29, "t": 1795280485.996, "box": [331.8, 400.2, 1086.7, 713.9]}
|
||||||
|
{"n": 30, "t": 1795280486.189, "box": [333.1, 399.9, 1090.9, 714.0]}
|
||||||
|
{"n": 31, "t": 1795280486.387, "box": [330.8, 400.0, 1097.6, 714.4]}
|
||||||
|
{"n": 32, "t": 1795280486.606, "box": [324.6, 399.9, 1091.4, 714.0]}
|
||||||
|
{"n": 33, "t": 1795280486.768, "box": [324.8, 400.5, 1081.1, 713.7]}
|
||||||
|
{"n": 34, "t": 1795280486.929, "box": [320.7, 400.5, 1086.0, 713.4]}
|
||||||
|
{"n": 35, "t": 1795280487.188, "box": [321.3, 400.1, 1083.6, 713.6]}
|
||||||
|
{"n": 36, "t": 1795280487.407, "box": [327.2, 399.9, 1086.5, 713.7]}
|
||||||
|
{"n": 37, "t": 1795280487.546, "box": [327.2, 399.6, 1083.6, 714.2]}
|
||||||
|
{"n": 38, "t": 1795280487.809, "box": [322.7, 399.7, 1088.0, 714.7]}
|
||||||
|
{"n": 39, "t": 1795280487.967, "box": [323.6, 399.5, 1087.4, 714.1]}
|
||||||
|
{"n": 40, "t": 1795280488.226, "box": [341.5, 399.6, 1080.3, 711.3]}
|
||||||
|
{"n": 41, "t": 1795280488.374, "box": [312.2, 399.0, 1089.5, 711.5]}
|
||||||
|
{"n": 42, "t": 1795280488.611, "box": [323.5, 400.2, 1074.0, 715.2]}
|
||||||
|
{"n": 43, "t": 1795280488.825, "box": [323.7, 399.8, 1078.6, 715.7]}
|
||||||
|
{"n": 44, "t": 1795280488.929, "box": [323.3, 399.7, 1081.2, 715.3]}
|
||||||
|
{"n": 45, "t": 1795280489.167, "box": [324.5, 399.6, 1083.9, 715.9]}
|
||||||
|
{"n": 46, "t": 1795280489.411, "box": [325.3, 399.8, 1087.6, 715.1]}
|
||||||
|
{"n": 47, "t": 1795280489.547, "box": [326.2, 399.8, 1084.1, 714.8]}
|
||||||
|
{"n": 48, "t": 1795280489.79, "box": [326.7, 399.9, 1084.6, 715.5]}
|
||||||
|
{"n": 49, "t": 1795280490.025, "box": [322.8, 399.9, 1085.2, 714.9]}
|
||||||
|
{"n": 50, "t": 1795280490.207, "box": [322.8, 399.6, 1085.2, 715.9]}
|
||||||
|
{"n": 51, "t": 1795280490.433, "box": [324.0, 399.8, 1086.4, 715.4]}
|
||||||
|
{"n": 52, "t": 1795280490.609, "box": [324.0, 400.1, 1080.4, 714.5]}
|
||||||
|
{"n": 53, "t": 1795280490.768, "box": [323.0, 400.1, 1083.8, 714.5]}
|
||||||
|
{"n": 54, "t": 1795280491.007, "box": [323.2, 400.2, 1081.1, 713.3]}
|
||||||
|
{"n": 55, "t": 1795280491.189, "box": [324.0, 399.9, 1074.5, 713.9]}
|
||||||
|
{"n": 56, "t": 1795280491.407, "box": [323.0, 399.4, 1076.4, 711.9]}
|
||||||
|
{"n": 57, "t": 1795280491.588, "box": [315.4, 399.6, 1032.9, 710.9]}
|
||||||
|
{"n": 58, "t": 1795280492.045, "box": [294.5, 402.3, 1277.0, 710.9]}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
{"n": 1, "t": 1795280561.247, "box": [302.1, 399.7, 851.1, 622.0]}
|
||||||
|
{"n": 2, "t": 1795280561.427, "box": [312.8, 399.6, 888.3, 627.6]}
|
||||||
|
{"n": 3, "t": 1795280561.645, "box": [311.3, 400.4, 950.8, 654.7]}
|
||||||
|
{"n": 4, "t": 1795280561.897, "box": [334.8, 400.9, 990.7, 673.8]}
|
||||||
|
{"n": 5, "t": 1795280561.956, "box": [339.6, 400.9, 1016.3, 688.0]}
|
||||||
|
{"n": 6, "t": 1795280562.292, "box": [331.3, 399.8, 1077.4, 706.0]}
|
||||||
|
{"n": 7, "t": 1795280562.5, "box": [333.8, 399.8, 1084.3, 707.8]}
|
||||||
|
{"n": 8, "t": 1795280562.675, "box": [335.9, 399.6, 1090.8, 710.3]}
|
||||||
|
{"n": 9, "t": 1795280562.755, "box": [336.3, 400.0, 1089.8, 709.5]}
|
||||||
|
{"n": 10, "t": 1795280563.076, "box": [341.6, 399.6, 1099.4, 711.9]}
|
||||||
|
{"n": 11, "t": 1795280563.306, "box": [343.3, 399.6, 1088.0, 712.1]}
|
||||||
|
{"n": 12, "t": 1795280563.508, "box": [339.3, 399.8, 1088.3, 711.5]}
|
||||||
|
{"n": 13, "t": 1795280563.652, "box": [340.2, 399.5, 1090.7, 711.5]}
|
||||||
|
{"n": 14, "t": 1795280563.891, "box": [340.7, 399.8, 1088.3, 712.1]}
|
||||||
|
{"n": 15, "t": 1795280564.029, "box": [339.9, 399.6, 1087.4, 712.2]}
|
||||||
|
{"n": 16, "t": 1795280564.299, "box": [338.3, 399.6, 1087.4, 712.4]}
|
||||||
|
{"n": 17, "t": 1795280564.43, "box": [336.3, 399.6, 1089.7, 712.1]}
|
||||||
|
{"n": 18, "t": 1795280564.67, "box": [338.5, 399.4, 1086.0, 712.6]}
|
||||||
|
{"n": 19, "t": 1795280564.906, "box": [338.1, 399.6, 1088.6, 712.8]}
|
||||||
|
{"n": 20, "t": 1795280565.089, "box": [338.8, 399.7, 1086.3, 711.0]}
|
||||||
|
{"n": 21, "t": 1795280565.25, "box": [337.8, 399.7, 1083.9, 711.7]}
|
||||||
|
{"n": 22, "t": 1795280565.505, "box": [338.0, 399.6, 1085.6, 712.5]}
|
||||||
|
{"n": 23, "t": 1795280565.647, "box": [339.2, 399.6, 1085.3, 711.9]}
|
||||||
|
{"n": 24, "t": 1795280565.896, "box": [337.1, 399.9, 1083.2, 712.2]}
|
||||||
|
{"n": 25, "t": 1795280566.039, "box": [339.1, 399.8, 1085.2, 712.6]}
|
||||||
|
{"n": 26, "t": 1795280566.276, "box": [339.2, 399.6, 1085.4, 712.5]}
|
||||||
|
{"n": 27, "t": 1795280566.458, "box": [337.2, 399.4, 1087.7, 712.9]}
|
||||||
|
{"n": 28, "t": 1795280566.69, "box": [338.4, 399.7, 1085.9, 712.2]}
|
||||||
|
{"n": 29, "t": 1795280566.766, "box": [338.3, 399.6, 1082.9, 711.8]}
|
||||||
|
{"n": 30, "t": 1795280567.091, "box": [336.8, 399.4, 1087.3, 712.5]}
|
||||||
|
{"n": 31, "t": 1795280567.292, "box": [337.2, 399.5, 1087.7, 712.6]}
|
||||||
|
{"n": 32, "t": 1795280567.405, "box": [338.4, 399.5, 1088.9, 712.6]}
|
||||||
|
{"n": 33, "t": 1795280567.709, "box": [337.8, 399.6, 1088.3, 713.1]}
|
||||||
|
{"n": 34, "t": 1795280567.889, "box": [337.2, 399.5, 1084.8, 712.7]}
|
||||||
|
{"n": 35, "t": 1795280567.97, "box": [334.7, 399.5, 1085.2, 712.6]}
|
||||||
|
{"n": 36, "t": 1795280568.265, "box": [337.3, 399.5, 1086.3, 712.6]}
|
||||||
|
{"n": 37, "t": 1795280568.372, "box": [335.7, 399.4, 1089.1, 712.3]}
|
||||||
|
{"n": 38, "t": 1795280568.7, "box": [338.3, 399.6, 1087.4, 712.1]}
|
||||||
|
{"n": 39, "t": 1795280568.772, "box": [337.8, 399.8, 1086.8, 711.5]}
|
||||||
|
{"n": 40, "t": 1795280569.067, "box": [338.0, 399.7, 1085.6, 712.0]}
|
||||||
|
{"n": 41, "t": 1795280569.308, "box": [339.7, 399.5, 1087.3, 711.8]}
|
||||||
|
{"n": 42, "t": 1795280569.504, "box": [337.4, 399.6, 1085.0, 712.8]}
|
||||||
|
{"n": 43, "t": 1795280569.691, "box": [336.1, 399.5, 1085.1, 712.4]}
|
||||||
|
{"n": 44, "t": 1795280569.866, "box": [335.8, 399.5, 1090.7, 713.0]}
|
||||||
|
{"n": 45, "t": 1795280569.967, "box": [337.4, 399.5, 1087.9, 713.0]}
|
||||||
|
{"n": 46, "t": 1795280570.266, "box": [336.0, 399.6, 1086.5, 712.8]}
|
||||||
|
{"n": 47, "t": 1795280570.37, "box": [335.7, 399.4, 1086.2, 712.3]}
|
||||||
|
{"n": 48, "t": 1795280570.605, "box": [334.3, 399.6, 1084.8, 713.1]}
|
||||||
|
{"n": 49, "t": 1795280570.905, "box": [333.1, 399.6, 1077.7, 711.5]}
|
||||||
|
{"n": 50, "t": 1795280571.089, "box": [332.9, 400.0, 1073.2, 705.9]}
|
||||||
|
{"n": 51, "t": 1795280571.307, "box": [337.4, 399.9, 1066.3, 707.9]}
|
||||||
|
{"n": 52, "t": 1795280571.487, "box": [342.4, 401.4, 1033.8, 697.0]}
|
||||||
|
{"n": 53, "t": 1795280571.713, "box": [330.7, 399.8, 990.4, 703.6]}
|
||||||
|
{"n": 54, "t": 1795280571.79, "box": [323.8, 399.8, 977.1, 694.0]}
|
||||||
|
{"n": 55, "t": 1795280572.129, "box": [316.9, 400.4, 953.9, 676.5]}
|
||||||
|
{"n": 56, "t": 1795280572.266, "box": [318.5, 400.7, 931.1, 665.2]}
|
||||||
|
{"n": 57, "t": 1795280572.368, "box": [317.4, 399.7, 901.8, 650.1]}
|
||||||
|
{"n": 58, "t": 1795280572.665, "box": [310.8, 400.4, 886.2, 660.0]}
|
||||||
|
{"n": 59, "t": 1795280572.906, "box": [301.3, 400.7, 849.3, 647.5]}
|
||||||
|
{"n": 60, "t": 1795280573.009, "box": [301.4, 399.0, 842.0, 644.6]}
|
||||||
|
{"n": 61, "t": 1795280573.309, "box": [294.4, 400.1, 799.3, 624.3]}
|
||||||
|
{"n": 62, "t": 1795280573.515, "box": [289.9, 399.1, 761.4, 605.5]}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
{"n": 1, "t": 1795280590.535, "box": [286.9, 399.5, 754.7, 614.5]}
|
||||||
|
{"n": 2, "t": 1795280590.736, "box": [292.3, 399.7, 805.1, 623.3]}
|
||||||
|
{"n": 3, "t": 1795280591.102, "box": [303.0, 401.5, 868.4, 658.8]}
|
||||||
|
{"n": 4, "t": 1795280591.338, "box": [307.3, 399.7, 868.3, 640.0]}
|
||||||
|
{"n": 5, "t": 1795280591.474, "box": [311.3, 400.2, 889.0, 656.0]}
|
||||||
|
{"n": 6, "t": 1795280591.728, "box": [313.9, 400.1, 919.3, 680.5]}
|
||||||
|
{"n": 7, "t": 1795280591.893, "box": [318.9, 400.1, 942.3, 695.4]}
|
||||||
|
{"n": 8, "t": 1795280592.103, "box": [321.8, 400.7, 947.6, 694.9]}
|
||||||
|
{"n": 9, "t": 1795280592.287, "box": [317.8, 400.2, 954.7, 699.6]}
|
||||||
|
{"n": 10, "t": 1795280592.524, "box": [318.2, 400.4, 952.6, 699.8]}
|
||||||
|
{"n": 11, "t": 1795280592.69, "box": [317.7, 400.6, 960.9, 699.2]}
|
||||||
|
{"n": 12, "t": 1795280592.929, "box": [317.6, 400.3, 959.5, 699.5]}
|
||||||
|
{"n": 13, "t": 1795280593.067, "box": [316.3, 400.5, 959.5, 698.5]}
|
||||||
|
{"n": 14, "t": 1795280593.304, "box": [317.6, 400.6, 960.7, 700.6]}
|
||||||
|
{"n": 15, "t": 1795280593.488, "box": [317.8, 400.6, 959.7, 701.4]}
|
||||||
|
{"n": 16, "t": 1795280593.73, "box": [317.4, 400.3, 963.2, 702.1]}
|
||||||
|
{"n": 17, "t": 1795280593.891, "box": [319.8, 400.5, 963.0, 700.5]}
|
||||||
|
{"n": 18, "t": 1795280594.133, "box": [319.8, 400.4, 961.7, 700.1]}
|
||||||
|
{"n": 19, "t": 1795280594.274, "box": [318.6, 400.3, 963.0, 700.3]}
|
||||||
|
{"n": 20, "t": 1795280594.513, "box": [319.5, 400.3, 962.7, 698.2]}
|
||||||
|
{"n": 21, "t": 1795280594.694, "box": [318.6, 400.4, 964.3, 699.2]}
|
||||||
|
{"n": 22, "t": 1795280594.933, "box": [319.1, 400.3, 964.8, 700.3]}
|
||||||
|
{"n": 23, "t": 1795280595.141, "box": [319.5, 400.2, 962.7, 698.8]}
|
||||||
|
{"n": 24, "t": 1795280595.317, "box": [319.0, 400.4, 967.2, 700.7]}
|
||||||
|
{"n": 25, "t": 1795280595.496, "box": [320.2, 400.3, 964.6, 700.9]}
|
||||||
|
{"n": 26, "t": 1795280595.634, "box": [319.7, 400.4, 964.2, 699.5]}
|
||||||
|
{"n": 27, "t": 1795280595.876, "box": [318.4, 400.3, 962.8, 698.0]}
|
||||||
|
{"n": 28, "t": 1795280596.14, "box": [319.1, 400.4, 963.5, 699.2]}
|
||||||
|
{"n": 29, "t": 1795280596.298, "box": [318.3, 400.2, 961.5, 698.8]}
|
||||||
|
{"n": 30, "t": 1795280596.515, "box": [320.1, 400.5, 963.3, 699.6]}
|
||||||
|
{"n": 31, "t": 1795280596.695, "box": [319.1, 400.3, 963.5, 700.3]}
|
||||||
|
{"n": 32, "t": 1795280596.855, "box": [320.5, 400.1, 964.9, 699.8]}
|
||||||
|
{"n": 33, "t": 1795280597.074, "box": [317.9, 400.2, 966.1, 699.0]}
|
||||||
|
{"n": 34, "t": 1795280597.315, "box": [320.5, 400.3, 962.5, 698.2]}
|
||||||
|
{"n": 35, "t": 1795280597.476, "box": [319.5, 400.2, 964.0, 698.8]}
|
||||||
|
{"n": 36, "t": 1795280597.717, "box": [318.8, 400.2, 961.9, 700.2]}
|
||||||
|
{"n": 37, "t": 1795280597.894, "box": [319.0, 400.3, 961.0, 698.5]}
|
||||||
|
{"n": 38, "t": 1795280598.136, "box": [318.1, 400.2, 962.5, 698.8]}
|
||||||
|
{"n": 39, "t": 1795280598.281, "box": [319.2, 400.3, 962.4, 699.2]}
|
||||||
|
{"n": 40, "t": 1795280598.534, "box": [319.2, 400.5, 966.1, 699.1]}
|
||||||
|
{"n": 41, "t": 1795280598.673, "box": [318.4, 400.4, 964.1, 699.0]}
|
||||||
|
{"n": 42, "t": 1795280598.854, "box": [318.1, 400.5, 966.3, 700.2]}
|
||||||
|
{"n": 43, "t": 1795280599.114, "box": [319.7, 400.3, 965.4, 699.5]}
|
||||||
|
{"n": 44, "t": 1795280599.334, "box": [319.6, 400.3, 962.8, 697.7]}
|
||||||
|
{"n": 45, "t": 1795280599.473, "box": [319.0, 400.2, 959.7, 696.1]}
|
||||||
|
{"n": 46, "t": 1795280599.714, "box": [317.7, 400.6, 959.6, 699.2]}
|
||||||
|
{"n": 47, "t": 1795280599.894, "box": [324.0, 400.7, 953.5, 701.6]}
|
||||||
|
{"n": 48, "t": 1795280600.115, "box": [314.6, 401.0, 941.7, 702.4]}
|
||||||
|
{"n": 49, "t": 1795280600.295, "box": [314.8, 401.2, 903.8, 683.8]}
|
||||||
|
{"n": 50, "t": 1795280600.513, "box": [309.2, 399.6, 1228.7, 708.2]}
|
||||||
|
{"n": 51, "t": 1795280600.674, "box": [311.2, 399.7, 962.0, 689.6]}
|
||||||
|
{"n": 52, "t": 1795280600.916, "box": [299.1, 399.9, 860.1, 672.5]}
|
||||||
|
{"n": 53, "t": 1795280601.103, "box": [297.0, 400.2, 809.8, 645.8]}
|
||||||
|
{"n": 54, "t": 1795280601.244, "box": [294.3, 400.0, 792.3, 636.4]}
|
||||||
|
{"n": 55, "t": 1795280601.486, "box": [288.8, 399.4, 739.6, 608.0]}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{"n": 1, "t": 1795280671.554, "box": [314.4, 399.7, 834.3, 627.7]}
|
||||||
|
{"n": 2, "t": 1795280671.794, "box": [334.1, 400.1, 918.5, 641.9]}
|
||||||
|
{"n": 3, "t": 1795280671.955, "box": [337.1, 401.2, 1123.6, 689.4]}
|
||||||
|
{"n": 4, "t": 1795280672.195, "box": [350.5, 400.9, 977.6, 666.4]}
|
||||||
|
{"n": 5, "t": 1795280672.373, "box": [356.9, 400.0, 1042.9, 690.5]}
|
||||||
|
{"n": 6, "t": 1795280672.614, "box": [347.9, 399.5, 1075.3, 702.2]}
|
||||||
|
{"n": 7, "t": 1795280672.756, "box": [358.6, 399.7, 1091.7, 707.1]}
|
||||||
|
{"n": 8, "t": 1795280672.996, "box": [351.0, 399.3, 1116.3, 709.1]}
|
||||||
|
{"n": 9, "t": 1795280673.175, "box": [355.7, 399.5, 1104.7, 709.4]}
|
||||||
|
{"n": 10, "t": 1795280673.314, "box": [355.1, 399.8, 1105.6, 709.4]}
|
||||||
|
{"n": 11, "t": 1795280673.554, "box": [352.7, 399.7, 1104.6, 711.0]}
|
||||||
|
{"n": 12, "t": 1795280673.797, "box": [356.1, 400.0, 1103.6, 708.9]}
|
||||||
|
{"n": 13, "t": 1795280673.991, "box": [347.1, 399.9, 1085.9, 710.6]}
|
||||||
|
{"n": 14, "t": 1795280674.13, "box": [345.4, 399.9, 1077.1, 707.9]}
|
||||||
|
{"n": 15, "t": 1795280674.37, "box": [350.5, 400.0, 1061.1, 704.7]}
|
||||||
|
{"n": 16, "t": 1795280674.614, "box": [351.9, 400.9, 1044.7, 697.7]}
|
||||||
|
{"n": 17, "t": 1795280674.666, "box": [343.4, 399.3, 1026.8, 701.0]}
|
||||||
|
{"n": 18, "t": 1795280675.185, "box": [331.9, 399.4, 910.7, 667.5]}
|
||||||
|
{"n": 19, "t": 1795280675.409, "box": [309.7, 401.0, 802.9, 620.2]}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
{"n": 1, "t": 1795280728.447, "box": [348.0, 399.6, 899.2, 595.6]}
|
||||||
|
{"n": 2, "t": 1795280728.673, "box": [351.4, 399.3, 931.3, 617.3]}
|
||||||
|
{"n": 3, "t": 1795280728.863, "box": [356.3, 398.8, 955.8, 635.9]}
|
||||||
|
{"n": 4, "t": 1795280728.931, "box": [356.8, 399.3, 955.1, 639.1]}
|
||||||
|
{"n": 5, "t": 1795280729.245, "box": [360.0, 399.6, 981.0, 653.4]}
|
||||||
|
{"n": 6, "t": 1795280729.468, "box": [358.9, 399.4, 986.0, 651.3]}
|
||||||
|
{"n": 7, "t": 1795280729.667, "box": [361.8, 400.0, 992.6, 651.9]}
|
||||||
|
{"n": 8, "t": 1795280729.789, "box": [362.2, 399.8, 992.9, 654.1]}
|
||||||
|
{"n": 9, "t": 1795280729.966, "box": [361.2, 399.9, 995.7, 656.0]}
|
||||||
|
{"n": 10, "t": 1795280730.277, "box": [361.2, 399.6, 994.4, 655.5]}
|
||||||
|
{"n": 11, "t": 1795280730.354, "box": [359.9, 399.8, 994.4, 655.4]}
|
||||||
|
{"n": 12, "t": 1795280730.675, "box": [360.8, 399.6, 997.7, 655.7]}
|
||||||
|
{"n": 13, "t": 1795280730.775, "box": [361.1, 400.0, 999.3, 656.8]}
|
||||||
|
{"n": 14, "t": 1795280730.996, "box": [360.4, 399.9, 996.1, 656.7]}
|
||||||
|
{"n": 15, "t": 1795280731.248, "box": [361.8, 399.8, 996.3, 658.2]}
|
||||||
|
{"n": 16, "t": 1795280731.409, "box": [360.5, 399.6, 995.0, 657.0]}
|
||||||
|
{"n": 17, "t": 1795280731.634, "box": [360.4, 399.8, 999.9, 656.6]}
|
||||||
|
{"n": 18, "t": 1795280731.877, "box": [361.8, 399.6, 1001.2, 659.0]}
|
||||||
|
{"n": 19, "t": 1795280732.055, "box": [362.7, 400.0, 1002.2, 659.9]}
|
||||||
|
{"n": 20, "t": 1795280732.117, "box": [361.7, 399.6, 999.9, 661.2]}
|
||||||
|
{"n": 21, "t": 1795280732.437, "box": [362.7, 399.7, 1000.9, 660.4]}
|
||||||
|
{"n": 22, "t": 1795280732.635, "box": [362.1, 399.9, 999.0, 662.1]}
|
||||||
|
{"n": 23, "t": 1795280732.857, "box": [362.6, 399.8, 999.6, 660.7]}
|
||||||
|
{"n": 24, "t": 1795280733.016, "box": [362.9, 399.7, 999.9, 659.6]}
|
||||||
|
{"n": 25, "t": 1795280733.254, "box": [362.8, 400.0, 1002.2, 659.7]}
|
||||||
|
{"n": 26, "t": 1795280733.428, "box": [361.9, 399.6, 1003.8, 658.5]}
|
||||||
|
{"n": 27, "t": 1795280733.629, "box": [361.8, 399.9, 1001.3, 660.0]}
|
||||||
|
{"n": 28, "t": 1795280733.867, "box": [363.5, 399.8, 1001.6, 658.9]}
|
||||||
|
{"n": 29, "t": 1795280734.047, "box": [362.8, 400.0, 999.8, 658.9]}
|
||||||
|
{"n": 30, "t": 1795280734.208, "box": [363.3, 400.1, 1000.2, 660.0]}
|
||||||
|
{"n": 31, "t": 1795280734.464, "box": [362.9, 399.9, 1002.3, 658.8]}
|
||||||
|
{"n": 32, "t": 1795280734.665, "box": [362.1, 400.0, 1002.8, 661.6]}
|
||||||
|
{"n": 33, "t": 1795280734.855, "box": [362.6, 399.8, 1002.0, 659.5]}
|
||||||
|
{"n": 34, "t": 1795280734.995, "box": [363.8, 399.9, 1004.5, 661.1]}
|
||||||
|
{"n": 35, "t": 1795280735.237, "box": [362.9, 399.7, 999.9, 657.5]}
|
||||||
|
{"n": 36, "t": 1795280735.414, "box": [364.4, 399.7, 1002.6, 659.3]}
|
||||||
|
{"n": 37, "t": 1795280735.654, "box": [363.7, 400.1, 1008.1, 661.3]}
|
||||||
|
{"n": 38, "t": 1795280735.814, "box": [362.9, 399.9, 1004.8, 661.5]}
|
||||||
|
{"n": 39, "t": 1795280736.037, "box": [362.4, 399.7, 1004.3, 659.0]}
|
||||||
|
{"n": 40, "t": 1795280736.277, "box": [363.4, 399.8, 1005.3, 660.7]}
|
||||||
|
{"n": 41, "t": 1795280736.458, "box": [362.9, 399.8, 1001.1, 662.2]}
|
||||||
|
{"n": 42, "t": 1795280736.628, "box": [362.1, 399.8, 1001.5, 660.7]}
|
||||||
|
{"n": 43, "t": 1795280736.835, "box": [361.8, 400.1, 1000.0, 660.7]}
|
||||||
|
{"n": 44, "t": 1795280737.075, "box": [362.1, 399.9, 1001.6, 659.2]}
|
||||||
|
{"n": 45, "t": 1795280737.238, "box": [362.2, 399.9, 1000.4, 658.0]}
|
||||||
|
{"n": 46, "t": 1795280737.461, "box": [360.3, 399.9, 1003.5, 658.8]}
|
||||||
|
{"n": 47, "t": 1795280737.556, "box": [361.2, 399.8, 1006.9, 658.7]}
|
||||||
|
{"n": 48, "t": 1795280737.816, "box": [360.9, 400.0, 1001.6, 657.8]}
|
||||||
|
{"n": 49, "t": 1795280738.038, "box": [361.9, 400.1, 1001.3, 660.5]}
|
||||||
|
{"n": 50, "t": 1795280738.216, "box": [360.6, 400.0, 1005.0, 663.5]}
|
||||||
|
{"n": 51, "t": 1795280738.438, "box": [362.4, 399.8, 1003.0, 660.1]}
|
||||||
|
{"n": 52, "t": 1795280738.615, "box": [362.5, 399.5, 1001.9, 657.9]}
|
||||||
|
{"n": 53, "t": 1795280738.836, "box": [360.2, 399.8, 1002.1, 659.5]}
|
||||||
|
{"n": 54, "t": 1795280739.077, "box": [359.5, 399.9, 1002.7, 659.2]}
|
||||||
|
{"n": 55, "t": 1795280739.257, "box": [361.7, 400.0, 1001.1, 660.1]}
|
||||||
|
{"n": 56, "t": 1795280739.474, "box": [361.4, 400.0, 1003.3, 661.2]}
|
||||||
|
{"n": 57, "t": 1795280739.657, "box": [363.1, 399.8, 1001.3, 660.9]}
|
||||||
|
{"n": 58, "t": 1795280739.794, "box": [360.6, 399.8, 1002.5, 662.2]}
|
||||||
|
{"n": 59, "t": 1795280740.056, "box": [362.9, 399.8, 1003.6, 660.9]}
|
||||||
|
{"n": 60, "t": 1795280740.195, "box": [362.4, 399.8, 1004.3, 661.2]}
|
||||||
|
{"n": 61, "t": 1795280740.438, "box": [361.5, 399.8, 1003.4, 662.2]}
|
||||||
|
{"n": 62, "t": 1795280740.677, "box": [361.4, 399.8, 1005.8, 662.8]}
|
||||||
|
{"n": 63, "t": 1795280740.856, "box": [362.0, 400.2, 1002.7, 659.5]}
|
||||||
|
{"n": 64, "t": 1795280741.065, "box": [360.4, 399.9, 1003.6, 661.1]}
|
||||||
|
{"n": 65, "t": 1795280741.249, "box": [360.8, 399.8, 1004.0, 660.7]}
|
||||||
|
{"n": 66, "t": 1795280741.409, "box": [361.4, 399.7, 1003.3, 658.6]}
|
||||||
|
{"n": 67, "t": 1795280741.63, "box": [361.5, 400.0, 1000.9, 661.2]}
|
||||||
|
{"n": 68, "t": 1795280741.867, "box": [360.9, 400.1, 1006.6, 660.5]}
|
||||||
|
{"n": 69, "t": 1795280741.968, "box": [361.5, 400.0, 1003.5, 659.9]}
|
||||||
|
{"n": 70, "t": 1795280742.267, "box": [362.0, 400.0, 1001.4, 660.4]}
|
||||||
|
{"n": 71, "t": 1795280742.454, "box": [361.1, 400.1, 1003.1, 657.7]}
|
||||||
|
{"n": 72, "t": 1795280742.61, "box": [360.2, 399.9, 1007.2, 659.2]}
|
||||||
|
{"n": 73, "t": 1795280742.852, "box": [359.7, 400.1, 1009.2, 656.5]}
|
||||||
|
{"n": 74, "t": 1795280742.989, "box": [357.2, 400.6, 1006.7, 654.2]}
|
||||||
|
{"n": 75, "t": 1795280743.264, "box": [357.5, 400.7, 1014.6, 652.1]}
|
||||||
|
{"n": 76, "t": 1795280743.467, "box": [358.2, 400.8, 1005.2, 644.9]}
|
||||||
|
{"n": 77, "t": 1795280743.645, "box": [362.0, 400.7, 1001.4, 648.9]}
|
||||||
|
{"n": 78, "t": 1795280743.81, "box": [363.0, 400.5, 985.2, 645.8]}
|
||||||
|
{"n": 79, "t": 1795280744.047, "box": [368.1, 400.7, 969.9, 648.4]}
|
||||||
|
{"n": 80, "t": 1795280744.268, "box": [364.3, 401.1, 993.8, 657.2]}
|
||||||
|
{"n": 81, "t": 1795280744.447, "box": [380.1, 400.6, 983.1, 652.5]}
|
||||||
|
{"n": 82, "t": 1795280744.608, "box": [378.8, 400.9, 986.6, 651.8]}
|
||||||
|
{"n": 83, "t": 1795280744.847, "box": [358.1, 400.5, 1002.5, 660.6]}
|
||||||
|
{"n": 84, "t": 1795280745.088, "box": [360.3, 400.1, 941.4, 636.3]}
|
||||||
|
{"n": 85, "t": 1795280745.229, "box": [361.9, 399.8, 944.2, 636.9]}
|
||||||
|
{"n": 86, "t": 1795280745.488, "box": [362.4, 400.4, 940.1, 638.0]}
|
||||||
|
{"n": 87, "t": 1795280745.628, "box": [360.9, 400.5, 957.0, 640.4]}
|
||||||
|
{"n": 88, "t": 1795280745.868, "box": [360.4, 400.5, 959.9, 640.4]}
|
||||||
|
{"n": 89, "t": 1795280746.054, "box": [357.1, 400.4, 974.4, 644.1]}
|
||||||
|
{"n": 90, "t": 1795280746.207, "box": [361.1, 400.3, 963.0, 640.4]}
|
||||||
|
{"n": 91, "t": 1795280746.465, "box": [359.7, 400.5, 951.1, 637.5]}
|
||||||
|
{"n": 92, "t": 1795280746.665, "box": [362.4, 400.7, 964.3, 643.9]}
|
||||||
|
{"n": 93, "t": 1795280746.847, "box": [361.6, 400.8, 969.4, 644.5]}
|
||||||
|
{"n": 94, "t": 1795280747.087, "box": [362.6, 400.2, 955.1, 640.3]}
|
||||||
|
{"n": 95, "t": 1795280747.248, "box": [363.1, 399.9, 952.2, 640.8]}
|
||||||
|
{"n": 96, "t": 1795280747.41, "box": [361.0, 400.2, 950.0, 639.1]}
|
||||||
|
{"n": 97, "t": 1795280747.648, "box": [364.7, 400.4, 950.4, 638.4]}
|
||||||
|
{"n": 98, "t": 1795280747.807, "box": [363.7, 400.1, 950.4, 639.3]}
|
||||||
|
{"n": 99, "t": 1795280748.045, "box": [363.0, 400.4, 952.1, 638.9]}
|
||||||
|
{"n": 100, "t": 1795280748.285, "box": [362.0, 400.2, 956.9, 641.0]}
|
||||||
|
{"n": 101, "t": 1795280748.447, "box": [361.9, 400.5, 959.1, 643.7]}
|
||||||
|
{"n": 102, "t": 1795280748.676, "box": [363.2, 400.7, 963.9, 643.9]}
|
||||||
|
{"n": 103, "t": 1795280748.854, "box": [361.9, 400.1, 950.9, 639.5]}
|
||||||
|
{"n": 104, "t": 1795280748.995, "box": [362.3, 400.2, 956.0, 642.4]}
|
||||||
|
{"n": 105, "t": 1795280749.236, "box": [363.1, 400.6, 959.1, 642.6]}
|
||||||
|
{"n": 106, "t": 1795280749.474, "box": [360.8, 400.4, 960.3, 642.4]}
|
||||||
|
{"n": 107, "t": 1795280749.573, "box": [360.3, 400.7, 961.0, 644.6]}
|
||||||
|
{"n": 108, "t": 1795280749.794, "box": [361.3, 400.2, 951.6, 636.8]}
|
||||||
|
{"n": 109, "t": 1795280750.036, "box": [359.5, 400.5, 957.8, 639.0]}
|
||||||
|
{"n": 110, "t": 1795280750.275, "box": [362.4, 400.9, 967.8, 645.3]}
|
||||||
|
{"n": 111, "t": 1795280750.455, "box": [363.3, 400.4, 959.3, 641.4]}
|
||||||
|
{"n": 112, "t": 1795280750.674, "box": [363.9, 400.4, 957.6, 640.7]}
|
||||||
|
{"n": 113, "t": 1795280750.854, "box": [362.7, 400.6, 962.2, 640.0]}
|
||||||
|
{"n": 114, "t": 1795280751.093, "box": [361.4, 400.5, 969.2, 642.7]}
|
||||||
|
{"n": 115, "t": 1795280751.235, "box": [363.3, 400.6, 965.1, 642.4]}
|
||||||
|
{"n": 116, "t": 1795280751.477, "box": [361.1, 400.8, 964.1, 641.1]}
|
||||||
|
{"n": 117, "t": 1795280751.656, "box": [360.5, 400.4, 962.4, 640.5]}
|
||||||
|
{"n": 118, "t": 1795280751.795, "box": [361.2, 400.3, 959.6, 640.1]}
|
||||||
|
{"n": 119, "t": 1795280752.054, "box": [364.2, 400.6, 966.0, 643.0]}
|
||||||
|
{"n": 120, "t": 1795280752.287, "box": [363.6, 400.7, 966.6, 642.5]}
|
||||||
|
{"n": 121, "t": 1795280752.454, "box": [361.6, 400.9, 962.3, 642.7]}
|
||||||
|
{"n": 122, "t": 1795280752.674, "box": [364.7, 400.5, 956.1, 638.3]}
|
||||||
|
{"n": 123, "t": 1795280752.855, "box": [363.7, 400.6, 964.4, 641.9]}
|
||||||
|
{"n": 124, "t": 1795280753.096, "box": [364.2, 400.3, 955.5, 640.2]}
|
||||||
|
{"n": 125, "t": 1795280753.248, "box": [364.1, 400.7, 963.6, 643.1]}
|
||||||
|
{"n": 126, "t": 1795280753.489, "box": [362.8, 400.4, 961.1, 641.2]}
|
||||||
|
{"n": 127, "t": 1795280753.628, "box": [362.0, 400.9, 967.4, 643.4]}
|
||||||
|
{"n": 128, "t": 1795280753.869, "box": [362.7, 400.7, 961.1, 641.0]}
|
||||||
|
{"n": 129, "t": 1795280753.974, "box": [363.8, 400.6, 960.9, 642.6]}
|
||||||
|
{"n": 130, "t": 1795280754.287, "box": [365.4, 401.0, 973.1, 646.1]}
|
||||||
|
{"n": 131, "t": 1795280754.449, "box": [364.3, 400.9, 965.0, 645.0]}
|
||||||
|
{"n": 132, "t": 1795280754.687, "box": [362.5, 400.9, 967.9, 644.8]}
|
||||||
|
{"n": 133, "t": 1795280754.829, "box": [363.2, 401.0, 960.4, 641.1]}
|
||||||
|
{"n": 134, "t": 1795280755.07, "box": [358.9, 400.7, 963.1, 643.6]}
|
||||||
|
{"n": 135, "t": 1795280755.267, "box": [357.8, 400.2, 956.1, 637.5]}
|
||||||
|
{"n": 136, "t": 1795280755.468, "box": [356.6, 399.9, 954.9, 638.6]}
|
||||||
|
{"n": 137, "t": 1795280755.649, "box": [360.8, 400.3, 968.6, 642.1]}
|
||||||
|
{"n": 138, "t": 1795280755.889, "box": [362.2, 400.0, 977.2, 652.8]}
|
||||||
|
{"n": 139, "t": 1795280756.047, "box": [364.4, 400.2, 985.4, 660.8]}
|
||||||
|
{"n": 140, "t": 1795280756.268, "box": [359.4, 400.8, 997.6, 666.3]}
|
||||||
|
{"n": 141, "t": 1795280756.447, "box": [360.9, 400.7, 1023.2, 669.1]}
|
||||||
|
{"n": 142, "t": 1795280756.688, "box": [367.0, 401.3, 1033.2, 679.6]}
|
||||||
|
{"n": 143, "t": 1795280756.829, "box": [368.6, 401.4, 1054.6, 682.7]}
|
||||||
|
{"n": 144, "t": 1795280757.069, "box": [377.2, 401.0, 1067.3, 686.2]}
|
||||||
|
{"n": 145, "t": 1795280757.246, "box": [380.4, 400.7, 1067.8, 689.7]}
|
||||||
|
{"n": 146, "t": 1795280757.487, "box": [383.5, 400.8, 1066.8, 690.4]}
|
||||||
|
{"n": 147, "t": 1795280757.628, "box": [382.6, 400.9, 1068.6, 690.8]}
|
||||||
|
{"n": 148, "t": 1795280757.87, "box": [378.7, 400.8, 1070.1, 690.7]}
|
||||||
|
{"n": 149, "t": 1795280758.069, "box": [380.9, 401.0, 1068.3, 690.0]}
|
||||||
|
{"n": 150, "t": 1795280758.285, "box": [379.6, 400.8, 1070.9, 691.0]}
|
||||||
|
{"n": 151, "t": 1795280758.486, "box": [380.6, 400.8, 1073.3, 691.9]}
|
||||||
|
{"n": 152, "t": 1795280758.669, "box": [381.0, 400.8, 1073.8, 691.0]}
|
||||||
|
{"n": 153, "t": 1795280758.868, "box": [380.7, 400.7, 1070.7, 690.1]}
|
||||||
|
{"n": 154, "t": 1795280759.092, "box": [379.2, 400.7, 1070.6, 689.8]}
|
||||||
|
{"n": 155, "t": 1795280759.251, "box": [380.8, 400.8, 1069.5, 687.9]}
|
||||||
|
{"n": 156, "t": 1795280759.386, "box": [380.7, 400.8, 1074.8, 689.0]}
|
||||||
|
{"n": 157, "t": 1795280759.637, "box": [379.9, 400.9, 1071.3, 690.8]}
|
||||||
|
{"n": 158, "t": 1795280759.895, "box": [377.9, 401.0, 1077.4, 690.3]}
|
||||||
|
{"n": 159, "t": 1795280760.036, "box": [377.6, 400.7, 1077.2, 690.9]}
|
||||||
|
{"n": 160, "t": 1795280760.28, "box": [378.8, 400.8, 1070.1, 689.3]}
|
||||||
|
{"n": 161, "t": 1795280760.456, "box": [374.4, 400.9, 1071.2, 687.2]}
|
||||||
|
{"n": 162, "t": 1795280760.697, "box": [368.9, 401.5, 1049.5, 675.5]}
|
||||||
|
{"n": 163, "t": 1795280760.855, "box": [362.4, 401.0, 1035.2, 667.9]}
|
||||||
|
{"n": 164, "t": 1795280761.096, "box": [358.5, 400.3, 1008.0, 660.2]}
|
||||||
|
{"n": 165, "t": 1795280761.235, "box": [360.5, 399.8, 992.5, 658.2]}
|
||||||
|
{"n": 166, "t": 1795280761.498, "box": [352.7, 400.1, 994.7, 665.6]}
|
||||||
|
{"n": 167, "t": 1795280761.635, "box": [354.3, 399.4, 986.3, 665.5]}
|
||||||
|
{"n": 168, "t": 1795280761.885, "box": [331.0, 400.4, 885.4, 630.6]}
|
||||||
|
{"n": 169, "t": 1795280762.054, "box": [318.8, 400.0, 836.6, 609.6]}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
{"n": 1, "t": 1795282075.987, "box": [297.0, 399.5, 781.6, 618.3]}
|
||||||
|
{"n": 2, "t": 1795282076.371, "box": [308.5, 399.6, 847.0, 638.8]}
|
||||||
|
{"n": 3, "t": 1795282076.631, "box": [318.0, 400.2, 886.8, 645.7]}
|
||||||
|
{"n": 4, "t": 1795282076.828, "box": [316.0, 400.3, 907.4, 674.2]}
|
||||||
|
{"n": 5, "t": 1795282077.034, "box": [315.0, 400.5, 924.0, 685.1]}
|
||||||
|
{"n": 6, "t": 1795282077.176, "box": [319.3, 400.8, 940.2, 690.7]}
|
||||||
|
{"n": 7, "t": 1795282077.433, "box": [321.8, 401.0, 951.3, 691.7]}
|
||||||
|
{"n": 8, "t": 1795282077.494, "box": [321.6, 400.9, 954.8, 693.7]}
|
||||||
|
{"n": 9, "t": 1795282077.788, "box": [322.6, 400.7, 962.0, 698.3]}
|
||||||
|
{"n": 10, "t": 1795282078.02, "box": [323.5, 400.4, 967.9, 701.3]}
|
||||||
|
{"n": 11, "t": 1795282078.217, "box": [322.6, 400.6, 968.3, 699.2]}
|
||||||
|
{"n": 12, "t": 1795282078.439, "box": [322.7, 400.8, 965.9, 699.9]}
|
||||||
|
{"n": 13, "t": 1795282078.601, "box": [321.8, 400.4, 961.3, 697.5]}
|
||||||
|
{"n": 14, "t": 1795282078.776, "box": [322.1, 400.6, 967.9, 700.6]}
|
||||||
|
{"n": 15, "t": 1795282078.997, "box": [320.7, 400.6, 966.4, 697.7]}
|
||||||
|
{"n": 16, "t": 1795282079.099, "box": [321.3, 400.4, 963.2, 700.7]}
|
||||||
|
{"n": 17, "t": 1795282079.415, "box": [322.3, 400.5, 969.3, 697.6]}
|
||||||
|
{"n": 18, "t": 1795282079.61, "box": [321.4, 400.5, 962.1, 694.4]}
|
||||||
|
{"n": 19, "t": 1795282079.817, "box": [322.9, 400.5, 963.6, 696.2]}
|
||||||
|
{"n": 20, "t": 1795282080.037, "box": [322.9, 400.4, 962.4, 695.7]}
|
||||||
|
{"n": 21, "t": 1795282080.137, "box": [321.9, 400.7, 968.9, 698.6]}
|
||||||
|
{"n": 22, "t": 1795282080.36, "box": [321.9, 400.5, 961.3, 693.3]}
|
||||||
|
{"n": 23, "t": 1795282080.598, "box": [323.4, 400.4, 969.1, 699.5]}
|
||||||
|
{"n": 24, "t": 1795282080.777, "box": [324.0, 400.5, 960.9, 694.9]}
|
||||||
|
{"n": 25, "t": 1795282081.019, "box": [323.9, 400.7, 976.0, 702.4]}
|
||||||
|
{"n": 26, "t": 1795282081.157, "box": [322.6, 400.5, 965.8, 695.8]}
|
||||||
|
{"n": 27, "t": 1795282081.427, "box": [321.8, 400.3, 961.2, 694.5]}
|
||||||
|
{"n": 28, "t": 1795282081.628, "box": [322.1, 400.4, 964.0, 697.8]}
|
||||||
|
{"n": 29, "t": 1795282081.767, "box": [323.2, 400.5, 962.6, 697.6]}
|
||||||
|
{"n": 30, "t": 1795282081.953, "box": [323.0, 400.5, 964.9, 695.8]}
|
||||||
|
{"n": 31, "t": 1795282082.188, "box": [323.3, 400.5, 965.2, 696.8]}
|
||||||
|
{"n": 32, "t": 1795282082.29, "box": [323.0, 400.5, 967.4, 697.3]}
|
||||||
|
{"n": 33, "t": 1795282082.599, "box": [324.1, 400.8, 972.3, 697.6]}
|
||||||
|
{"n": 34, "t": 1795282082.777, "box": [323.6, 400.5, 969.3, 700.2]}
|
||||||
|
{"n": 35, "t": 1795282082.997, "box": [322.1, 400.5, 964.0, 695.0]}
|
||||||
|
{"n": 36, "t": 1795282083.24, "box": [323.4, 401.1, 951.7, 692.2]}
|
||||||
|
{"n": 37, "t": 1795282083.418, "box": [323.2, 400.6, 965.2, 696.2]}
|
||||||
|
{"n": 38, "t": 1795282083.588, "box": [323.9, 400.7, 964.6, 698.9]}
|
||||||
|
{"n": 39, "t": 1795282083.813, "box": [323.6, 400.5, 965.5, 695.0]}
|
||||||
|
{"n": 40, "t": 1795282083.972, "box": [323.1, 400.5, 963.8, 697.3]}
|
||||||
|
{"n": 41, "t": 1795282084.19, "box": [322.0, 400.4, 965.2, 697.8]}
|
||||||
|
{"n": 42, "t": 1795282084.43, "box": [323.7, 401.0, 952.0, 692.3]}
|
||||||
|
{"n": 43, "t": 1795282084.629, "box": [324.0, 400.4, 968.5, 698.4]}
|
||||||
|
{"n": 44, "t": 1795282084.828, "box": [323.6, 400.4, 969.3, 700.1]}
|
||||||
|
{"n": 45, "t": 1795282085.012, "box": [324.5, 400.4, 966.4, 697.2]}
|
||||||
|
{"n": 46, "t": 1795282085.174, "box": [322.9, 400.5, 967.3, 698.7]}
|
||||||
|
{"n": 47, "t": 1795282085.413, "box": [324.1, 400.5, 967.3, 698.7]}
|
||||||
|
{"n": 48, "t": 1795282085.551, "box": [324.6, 400.4, 969.1, 699.2]}
|
||||||
|
{"n": 49, "t": 1795282085.789, "box": [322.4, 400.5, 969.4, 699.1]}
|
||||||
|
{"n": 50, "t": 1795282086.029, "box": [323.1, 400.6, 971.3, 701.2]}
|
||||||
|
{"n": 51, "t": 1795282086.216, "box": [323.2, 400.4, 966.4, 695.2]}
|
||||||
|
{"n": 52, "t": 1795282086.351, "box": [321.7, 400.6, 967.4, 697.4]}
|
||||||
|
{"n": 53, "t": 1795282086.598, "box": [322.8, 400.7, 967.3, 697.8]}
|
||||||
|
{"n": 54, "t": 1795282086.839, "box": [324.0, 400.6, 970.9, 699.2]}
|
||||||
|
{"n": 55, "t": 1795282087.02, "box": [323.3, 400.7, 972.8, 700.4]}
|
||||||
|
{"n": 56, "t": 1795282087.157, "box": [323.0, 400.6, 972.5, 698.5]}
|
||||||
|
{"n": 57, "t": 1795282087.401, "box": [323.7, 400.5, 965.6, 699.6]}
|
||||||
|
{"n": 58, "t": 1795282087.576, "box": [323.9, 400.5, 972.1, 700.8]}
|
||||||
|
{"n": 59, "t": 1795282087.797, "box": [322.9, 400.7, 966.1, 699.3]}
|
||||||
|
{"n": 60, "t": 1795282088.038, "box": [324.5, 400.4, 968.9, 697.8]}
|
||||||
|
{"n": 61, "t": 1795282088.217, "box": [323.4, 400.3, 972.9, 698.5]}
|
||||||
|
{"n": 62, "t": 1795282088.357, "box": [325.7, 400.6, 972.7, 701.2]}
|
||||||
|
{"n": 63, "t": 1795282088.617, "box": [323.3, 400.7, 974.0, 701.8]}
|
||||||
|
{"n": 64, "t": 1795282088.778, "box": [323.6, 400.7, 974.4, 701.2]}
|
||||||
|
{"n": 65, "t": 1795282088.937, "box": [322.8, 400.5, 969.7, 702.0]}
|
||||||
|
{"n": 66, "t": 1795282089.171, "box": [322.3, 400.6, 966.7, 700.6]}
|
||||||
|
{"n": 67, "t": 1795282089.414, "box": [322.3, 400.6, 969.3, 702.6]}
|
||||||
|
{"n": 68, "t": 1795282089.551, "box": [321.8, 400.6, 972.5, 699.4]}
|
||||||
|
{"n": 69, "t": 1795282089.728, "box": [322.5, 400.5, 970.7, 699.6]}
|
||||||
|
{"n": 70, "t": 1795282089.968, "box": [323.8, 400.4, 968.3, 700.7]}
|
||||||
|
{"n": 71, "t": 1795282090.212, "box": [323.5, 400.6, 967.9, 698.8]}
|
||||||
|
{"n": 72, "t": 1795282090.353, "box": [323.1, 400.5, 967.5, 699.3]}
|
||||||
|
{"n": 73, "t": 1795282090.612, "box": [323.2, 400.3, 961.4, 696.2]}
|
||||||
|
{"n": 74, "t": 1795282090.771, "box": [323.2, 400.5, 960.1, 696.7]}
|
||||||
|
{"n": 75, "t": 1795282091.011, "box": [322.6, 400.7, 967.1, 701.3]}
|
||||||
|
{"n": 76, "t": 1795282091.09, "box": [323.7, 400.7, 965.7, 699.5]}
|
||||||
|
{"n": 77, "t": 1795282091.412, "box": [323.1, 400.5, 963.8, 696.8]}
|
||||||
|
{"n": 78, "t": 1795282091.577, "box": [324.7, 400.5, 964.1, 699.6]}
|
||||||
|
{"n": 79, "t": 1795282091.817, "box": [323.7, 400.5, 970.6, 701.0]}
|
||||||
|
{"n": 80, "t": 1795282091.959, "box": [322.7, 400.4, 964.6, 697.8]}
|
||||||
|
{"n": 81, "t": 1795282092.118, "box": [323.3, 400.5, 960.2, 697.6]}
|
||||||
|
{"n": 82, "t": 1795282092.37, "box": [324.1, 400.5, 963.6, 700.8]}
|
||||||
|
{"n": 83, "t": 1795282092.62, "box": [323.5, 400.5, 966.7, 699.1]}
|
||||||
|
{"n": 84, "t": 1795282092.839, "box": [324.4, 400.7, 961.4, 698.9]}
|
||||||
|
{"n": 85, "t": 1795282093.018, "box": [322.6, 400.6, 962.1, 698.8]}
|
||||||
|
{"n": 86, "t": 1795282093.159, "box": [323.0, 400.3, 965.0, 698.0]}
|
||||||
|
{"n": 87, "t": 1795282093.418, "box": [322.9, 400.6, 972.4, 698.6]}
|
||||||
|
{"n": 88, "t": 1795282093.557, "box": [323.2, 400.4, 968.9, 697.5]}
|
||||||
|
{"n": 89, "t": 1795282093.8, "box": [322.9, 400.5, 967.3, 696.8]}
|
||||||
|
{"n": 90, "t": 1795282094.04, "box": [321.2, 400.4, 969.4, 697.8]}
|
||||||
|
{"n": 91, "t": 1795282094.218, "box": [320.8, 400.6, 970.3, 698.0]}
|
||||||
|
{"n": 92, "t": 1795282094.428, "box": [322.3, 400.6, 970.6, 698.3]}
|
||||||
|
{"n": 93, "t": 1795282094.615, "box": [322.5, 400.7, 966.9, 698.9]}
|
||||||
|
{"n": 94, "t": 1795282094.755, "box": [322.9, 400.8, 975.0, 702.3]}
|
||||||
|
{"n": 95, "t": 1795282094.988, "box": [323.4, 400.6, 967.8, 699.4]}
|
||||||
|
{"n": 96, "t": 1795282095.229, "box": [321.9, 400.4, 965.1, 696.9]}
|
||||||
|
{"n": 97, "t": 1795282095.416, "box": [322.0, 400.5, 967.7, 696.4]}
|
||||||
|
{"n": 98, "t": 1795282095.651, "box": [322.4, 400.7, 961.8, 696.9]}
|
||||||
|
{"n": 99, "t": 1795282095.83, "box": [322.1, 400.7, 967.8, 699.5]}
|
||||||
|
{"n": 100, "t": 1795282095.952, "box": [322.3, 400.5, 965.4, 694.9]}
|
||||||
|
{"n": 101, "t": 1795282096.192, "box": [324.0, 400.6, 974.8, 699.2]}
|
||||||
|
{"n": 102, "t": 1795282096.388, "box": [323.8, 400.7, 973.3, 698.7]}
|
||||||
|
{"n": 103, "t": 1795282096.628, "box": [323.2, 400.5, 967.6, 697.6]}
|
||||||
|
{"n": 104, "t": 1795282096.832, "box": [323.0, 400.6, 964.9, 697.4]}
|
||||||
|
{"n": 105, "t": 1795282097.028, "box": [323.1, 400.5, 970.1, 699.9]}
|
||||||
|
{"n": 106, "t": 1795282097.252, "box": [323.8, 400.6, 974.6, 701.1]}
|
||||||
|
{"n": 107, "t": 1795282097.412, "box": [323.7, 400.6, 977.0, 698.8]}
|
||||||
|
{"n": 108, "t": 1795282097.57, "box": [322.7, 400.4, 973.5, 700.1]}
|
||||||
|
{"n": 109, "t": 1795282097.733, "box": [322.7, 400.6, 968.4, 699.2]}
|
||||||
|
{"n": 110, "t": 1795282098.04, "box": [322.2, 400.6, 974.3, 700.3]}
|
||||||
|
{"n": 111, "t": 1795282098.199, "box": [322.1, 400.5, 972.8, 700.8]}
|
||||||
|
{"n": 112, "t": 1795282098.442, "box": [323.1, 400.5, 968.8, 700.2]}
|
||||||
|
{"n": 113, "t": 1795282098.619, "box": [322.6, 400.9, 968.3, 700.8]}
|
||||||
|
{"n": 114, "t": 1795282098.838, "box": [325.3, 400.7, 967.2, 702.4]}
|
||||||
|
{"n": 115, "t": 1795282099.019, "box": [323.3, 400.7, 975.3, 701.2]}
|
||||||
|
{"n": 116, "t": 1795282099.157, "box": [322.6, 400.7, 973.4, 701.8]}
|
||||||
|
{"n": 117, "t": 1795282099.398, "box": [323.4, 400.7, 965.3, 700.7]}
|
||||||
|
{"n": 118, "t": 1795282099.638, "box": [322.2, 400.7, 971.7, 700.7]}
|
||||||
|
{"n": 119, "t": 1795282099.801, "box": [323.9, 400.8, 967.1, 699.0]}
|
||||||
|
{"n": 120, "t": 1795282100.051, "box": [323.9, 400.6, 967.1, 699.7]}
|
||||||
|
{"n": 121, "t": 1795282100.229, "box": [323.3, 400.8, 975.4, 699.9]}
|
||||||
|
{"n": 122, "t": 1795282100.393, "box": [323.4, 400.8, 967.9, 700.5]}
|
||||||
|
{"n": 123, "t": 1795282100.611, "box": [323.4, 400.6, 974.1, 703.0]}
|
||||||
|
{"n": 124, "t": 1795282100.853, "box": [324.6, 400.5, 977.9, 702.5]}
|
||||||
|
{"n": 125, "t": 1795282100.938, "box": [324.0, 400.3, 967.2, 701.1]}
|
||||||
|
{"n": 126, "t": 1795282101.23, "box": [323.6, 401.2, 959.3, 695.9]}
|
||||||
|
{"n": 127, "t": 1795282101.41, "box": [322.5, 401.0, 953.2, 692.1]}
|
||||||
|
{"n": 128, "t": 1795282101.652, "box": [324.3, 401.4, 960.0, 694.2]}
|
||||||
|
{"n": 129, "t": 1795282101.814, "box": [326.3, 400.8, 958.3, 702.8]}
|
||||||
|
{"n": 130, "t": 1795282101.956, "box": [323.9, 400.0, 973.4, 700.3]}
|
||||||
|
{"n": 131, "t": 1795282102.214, "box": [333.7, 400.1, 998.6, 704.8]}
|
||||||
|
{"n": 132, "t": 1795282102.455, "box": [330.2, 399.2, 1005.6, 705.7]}
|
||||||
|
{"n": 133, "t": 1795282102.594, "box": [341.8, 399.6, 1119.1, 713.1]}
|
||||||
|
{"n": 134, "t": 1795282102.829, "box": [352.1, 400.5, 1204.2, 716.5]}
|
||||||
|
{"n": 135, "t": 1795282103.011, "box": [346.3, 400.9, 1253.1, 714.3]}
|
||||||
|
{"n": 136, "t": 1795282103.251, "box": [365.1, 401.2, 1270.2, 715.2]}
|
||||||
|
{"n": 137, "t": 1795282103.414, "box": [377.9, 402.2, 1274.2, 712.6]}
|
||||||
|
{"n": 138, "t": 1795282103.653, "box": [408.8, 400.4, 1279.2, 715.7]}
|
||||||
@@ -0,0 +1,578 @@
|
|||||||
|
{"n": 1, "t": 1795282430.589, "box": [287.7, 277.4, 857.7, 649.1]}
|
||||||
|
{"n": 2, "t": 1795282430.834, "box": [294.4, 274.8, 888.4, 666.6]}
|
||||||
|
{"n": 3, "t": 1795282431.009, "box": [290.6, 267.7, 948.0, 693.8]}
|
||||||
|
{"n": 4, "t": 1795282431.072, "box": [294.0, 266.6, 956.6, 698.5]}
|
||||||
|
{"n": 5, "t": 1795282431.391, "box": [297.2, 260.2, 976.8, 697.3]}
|
||||||
|
{"n": 6, "t": 1795282431.637, "box": [294.5, 262.5, 991.6, 697.8]}
|
||||||
|
{"n": 7, "t": 1795282431.814, "box": [296.7, 261.5, 988.4, 696.8]}
|
||||||
|
{"n": 8, "t": 1795282431.892, "box": [298.0, 261.3, 988.3, 696.6]}
|
||||||
|
{"n": 9, "t": 1795282432.132, "box": [291.4, 259.1, 988.5, 696.2]}
|
||||||
|
{"n": 10, "t": 1795282432.432, "box": [295.3, 259.1, 985.6, 697.1]}
|
||||||
|
{"n": 11, "t": 1795282432.609, "box": [297.4, 260.4, 985.0, 696.7]}
|
||||||
|
{"n": 12, "t": 1795282432.778, "box": [292.7, 260.0, 988.5, 697.1]}
|
||||||
|
{"n": 13, "t": 1795282433.011, "box": [295.7, 260.6, 991.4, 697.7]}
|
||||||
|
{"n": 14, "t": 1795282433.15, "box": [299.7, 261.4, 987.3, 697.6]}
|
||||||
|
{"n": 15, "t": 1795282433.432, "box": [295.9, 259.3, 991.6, 698.0]}
|
||||||
|
{"n": 16, "t": 1795282433.632, "box": [297.6, 263.5, 986.6, 698.0]}
|
||||||
|
{"n": 17, "t": 1795282433.81, "box": [295.1, 262.1, 990.8, 698.3]}
|
||||||
|
{"n": 18, "t": 1795282433.994, "box": [297.6, 262.8, 987.9, 699.0]}
|
||||||
|
{"n": 19, "t": 1795282434.189, "box": [297.1, 261.3, 991.5, 698.3]}
|
||||||
|
{"n": 20, "t": 1795282434.434, "box": [298.5, 261.2, 991.5, 698.3]}
|
||||||
|
{"n": 21, "t": 1795282434.618, "box": [297.1, 263.8, 990.1, 697.5]}
|
||||||
|
{"n": 22, "t": 1795282434.778, "box": [295.6, 263.2, 992.7, 697.7]}
|
||||||
|
{"n": 23, "t": 1795282435.02, "box": [295.5, 261.8, 992.6, 698.0]}
|
||||||
|
{"n": 24, "t": 1795282435.161, "box": [295.6, 264.1, 994.0, 697.8]}
|
||||||
|
{"n": 25, "t": 1795282435.399, "box": [295.8, 263.6, 991.5, 697.2]}
|
||||||
|
{"n": 26, "t": 1795282435.589, "box": [296.0, 262.8, 994.4, 699.0]}
|
||||||
|
{"n": 27, "t": 1795282435.79, "box": [295.9, 264.0, 988.9, 698.5]}
|
||||||
|
{"n": 28, "t": 1795282436.033, "box": [296.4, 263.2, 990.8, 698.6]}
|
||||||
|
{"n": 29, "t": 1795282436.209, "box": [295.5, 263.3, 992.6, 699.5]}
|
||||||
|
{"n": 30, "t": 1795282436.376, "box": [296.2, 262.5, 991.9, 699.6]}
|
||||||
|
{"n": 31, "t": 1795282436.633, "box": [294.4, 262.5, 987.4, 698.7]}
|
||||||
|
{"n": 32, "t": 1795282436.833, "box": [297.8, 264.0, 986.8, 698.5]}
|
||||||
|
{"n": 33, "t": 1795282437.011, "box": [294.2, 262.3, 992.7, 698.5]}
|
||||||
|
{"n": 34, "t": 1795282437.175, "box": [295.1, 262.7, 992.2, 698.9]}
|
||||||
|
{"n": 35, "t": 1795282437.411, "box": [295.5, 263.2, 988.5, 698.6]}
|
||||||
|
{"n": 36, "t": 1795282437.55, "box": [296.9, 263.3, 989.9, 697.8]}
|
||||||
|
{"n": 37, "t": 1795282437.789, "box": [297.6, 262.5, 990.6, 699.5]}
|
||||||
|
{"n": 38, "t": 1795282438.032, "box": [295.9, 263.7, 979.5, 697.4]}
|
||||||
|
{"n": 39, "t": 1795282438.213, "box": [297.2, 264.1, 959.7, 694.4]}
|
||||||
|
{"n": 40, "t": 1795282438.374, "box": [294.4, 262.0, 954.4, 694.0]}
|
||||||
|
{"n": 41, "t": 1795282438.619, "box": [295.1, 261.8, 947.4, 698.0]}
|
||||||
|
{"n": 42, "t": 1795282438.763, "box": [294.8, 267.1, 938.3, 699.1]}
|
||||||
|
{"n": 43, "t": 1795282438.997, "box": [296.9, 270.6, 896.6, 688.5]}
|
||||||
|
{"n": 44, "t": 1795282439.241, "box": [289.9, 278.8, 916.0, 693.5]}
|
||||||
|
{"n": 45, "t": 1795282439.417, "box": [291.5, 284.6, 844.0, 661.4]}
|
||||||
|
{"n": 46, "t": 1795282439.638, "box": [278.8, 286.9, 785.9, 639.8]}
|
||||||
|
{"n": 47, "t": 1795282439.799, "box": [278.8, 288.9, 760.8, 624.3]}
|
||||||
|
{"n": 48, "t": 1795282439.979, "box": [268.0, 290.9, 672.2, 593.4]}
|
||||||
|
{"n": 49, "t": 1795282440.197, "box": [259.4, 294.0, 611.0, 575.7]}
|
||||||
|
{"n": 50, "t": 1795282440.44, "box": [253.4, 299.8, 569.7, 532.3]}
|
||||||
|
{"n": 51, "t": 1795282440.624, "box": [251.1, 306.1, 542.0, 519.2]}
|
||||||
|
{"n": 52, "t": 1795282440.759, "box": [242.8, 313.3, 484.7, 512.3]}
|
||||||
|
{"n": 53, "t": 1795282440.998, "box": [245.6, 316.4, 462.4, 499.4]}
|
||||||
|
{"n": 54, "t": 1795282441.24, "box": [237.7, 322.3, 470.2, 486.3]}
|
||||||
|
{"n": 55, "t": 1795282441.419, "box": [241.2, 322.3, 431.0, 476.8]}
|
||||||
|
{"n": 56, "t": 1795282441.559, "box": [234.6, 325.0, 407.8, 465.6]}
|
||||||
|
{"n": 57, "t": 1795282441.801, "box": [236.6, 328.3, 409.8, 459.5]}
|
||||||
|
{"n": 58, "t": 1795282441.996, "box": [233.6, 331.0, 400.2, 453.4]}
|
||||||
|
{"n": 59, "t": 1795282442.219, "box": [221.4, 322.7, 382.3, 451.2]}
|
||||||
|
{"n": 60, "t": 1795282442.358, "box": [221.1, 324.4, 381.6, 446.9]}
|
||||||
|
{"n": 61, "t": 1795282442.598, "box": [220.9, 327.9, 380.2, 443.2]}
|
||||||
|
{"n": 62, "t": 1795282442.838, "box": [233.6, 334.1, 372.8, 439.7]}
|
||||||
|
{"n": 63, "t": 1795282443.018, "box": [207.3, 332.0, 371.6, 437.3]}
|
||||||
|
{"n": 64, "t": 1795282443.158, "box": [200.8, 329.3, 341.3, 428.9]}
|
||||||
|
{"n": 65, "t": 1795282443.401, "box": [222.3, 331.4, 360.8, 435.4]}
|
||||||
|
{"n": 66, "t": 1795282443.577, "box": [205.8, 328.6, 341.4, 429.0]}
|
||||||
|
{"n": 67, "t": 1795282443.798, "box": [217.0, 327.9, 342.3, 428.3]}
|
||||||
|
{"n": 68, "t": 1795282444.038, "box": [219.1, 329.3, 340.2, 426.4]}
|
||||||
|
{"n": 69, "t": 1795282444.218, "box": [219.1, 329.4, 339.9, 423.7]}
|
||||||
|
{"n": 70, "t": 1795282444.457, "box": [242.4, 371.0, 351.4, 431.2]}
|
||||||
|
{"n": 71, "t": 1795282444.6, "box": [235.4, 367.4, 353.8, 428.6]}
|
||||||
|
{"n": 72, "t": 1795282444.839, "box": [240.2, 369.3, 350.9, 430.6]}
|
||||||
|
{"n": 73, "t": 1795282445.018, "box": [237.3, 371.1, 350.1, 430.5]}
|
||||||
|
{"n": 74, "t": 1795282445.257, "box": [235.5, 368.8, 351.9, 428.7]}
|
||||||
|
{"n": 75, "t": 1795282445.4, "box": [234.8, 368.4, 352.6, 428.8]}
|
||||||
|
{"n": 76, "t": 1795282445.639, "box": [230.4, 366.8, 352.0, 428.3]}
|
||||||
|
{"n": 77, "t": 1795282445.817, "box": [229.8, 367.2, 352.5, 428.8]}
|
||||||
|
{"n": 78, "t": 1795282446.039, "box": [230.9, 365.6, 352.5, 428.6]}
|
||||||
|
{"n": 79, "t": 1795282446.199, "box": [233.0, 368.1, 351.4, 429.4]}
|
||||||
|
{"n": 80, "t": 1795282446.439, "box": [229.2, 359.3, 352.8, 428.1]}
|
||||||
|
{"n": 81, "t": 1795282446.62, "box": [231.2, 364.0, 352.8, 428.9]}
|
||||||
|
{"n": 82, "t": 1795282446.859, "box": [237.3, 370.4, 351.1, 428.6]}
|
||||||
|
{"n": 83, "t": 1795282446.997, "box": [237.5, 367.9, 352.7, 428.7]}
|
||||||
|
{"n": 84, "t": 1795282447.239, "box": [235.5, 368.9, 353.0, 428.6]}
|
||||||
|
{"n": 85, "t": 1795282447.399, "box": [233.8, 365.8, 352.6, 428.5]}
|
||||||
|
{"n": 86, "t": 1795282447.659, "box": [234.2, 364.2, 353.1, 427.8]}
|
||||||
|
{"n": 87, "t": 1795282447.797, "box": [236.2, 368.4, 352.5, 428.5]}
|
||||||
|
{"n": 88, "t": 1795282448.041, "box": [236.3, 368.7, 352.8, 428.8]}
|
||||||
|
{"n": 89, "t": 1795282448.199, "box": [235.2, 367.0, 352.8, 428.8]}
|
||||||
|
{"n": 90, "t": 1795282448.439, "box": [238.0, 367.7, 352.6, 428.9]}
|
||||||
|
{"n": 91, "t": 1795282448.617, "box": [236.6, 368.6, 352.4, 429.0]}
|
||||||
|
{"n": 92, "t": 1795282448.84, "box": [235.5, 365.7, 353.0, 428.7]}
|
||||||
|
{"n": 93, "t": 1795282449.02, "box": [237.2, 368.9, 351.8, 428.9]}
|
||||||
|
{"n": 94, "t": 1795282449.257, "box": [235.5, 368.6, 351.9, 429.0]}
|
||||||
|
{"n": 95, "t": 1795282449.399, "box": [233.4, 367.8, 352.6, 428.5]}
|
||||||
|
{"n": 96, "t": 1795282449.639, "box": [234.4, 365.0, 352.7, 428.1]}
|
||||||
|
{"n": 97, "t": 1795282449.818, "box": [235.3, 365.1, 353.2, 428.5]}
|
||||||
|
{"n": 98, "t": 1795282450.041, "box": [234.2, 367.5, 352.8, 428.9]}
|
||||||
|
{"n": 99, "t": 1795282450.218, "box": [234.5, 366.9, 352.5, 429.0]}
|
||||||
|
{"n": 100, "t": 1795282450.458, "box": [234.0, 365.9, 352.6, 428.7]}
|
||||||
|
{"n": 101, "t": 1795282450.6, "box": [233.1, 366.3, 352.3, 429.1]}
|
||||||
|
{"n": 102, "t": 1795282450.838, "box": [233.8, 365.4, 353.8, 428.4]}
|
||||||
|
{"n": 103, "t": 1795282450.999, "box": [236.1, 366.3, 353.7, 428.8]}
|
||||||
|
{"n": 104, "t": 1795282451.239, "box": [234.9, 367.0, 352.4, 428.3]}
|
||||||
|
{"n": 105, "t": 1795282451.417, "box": [233.9, 370.3, 352.4, 428.7]}
|
||||||
|
{"n": 106, "t": 1795282451.637, "box": [234.5, 369.8, 351.5, 428.7]}
|
||||||
|
{"n": 107, "t": 1795282451.8, "box": [234.1, 370.1, 351.0, 429.0]}
|
||||||
|
{"n": 108, "t": 1795282452.058, "box": [234.9, 370.1, 352.3, 429.0]}
|
||||||
|
{"n": 109, "t": 1795282452.197, "box": [234.5, 364.5, 353.2, 429.0]}
|
||||||
|
{"n": 110, "t": 1795282452.439, "box": [241.3, 365.6, 354.5, 429.6]}
|
||||||
|
{"n": 111, "t": 1795282452.617, "box": [237.1, 370.5, 352.1, 429.2]}
|
||||||
|
{"n": 112, "t": 1795282452.839, "box": [235.3, 369.4, 351.6, 429.2]}
|
||||||
|
{"n": 113, "t": 1795282452.999, "box": [234.1, 370.8, 351.2, 429.0]}
|
||||||
|
{"n": 114, "t": 1795282453.239, "box": [235.6, 369.7, 351.8, 428.9]}
|
||||||
|
{"n": 115, "t": 1795282453.419, "box": [236.6, 370.5, 352.6, 428.9]}
|
||||||
|
{"n": 116, "t": 1795282453.658, "box": [237.1, 370.2, 351.8, 428.7]}
|
||||||
|
{"n": 117, "t": 1795282453.799, "box": [236.9, 369.4, 351.5, 429.3]}
|
||||||
|
{"n": 118, "t": 1795282454.037, "box": [236.6, 371.3, 352.8, 428.6]}
|
||||||
|
{"n": 119, "t": 1795282454.2, "box": [232.3, 369.1, 352.7, 428.5]}
|
||||||
|
{"n": 120, "t": 1795282454.439, "box": [236.4, 369.3, 352.3, 428.7]}
|
||||||
|
{"n": 121, "t": 1795282454.617, "box": [235.0, 367.8, 353.5, 429.2]}
|
||||||
|
{"n": 122, "t": 1795282454.839, "box": [235.9, 366.8, 354.2, 428.3]}
|
||||||
|
{"n": 123, "t": 1795282454.999, "box": [235.4, 366.5, 352.6, 428.4]}
|
||||||
|
{"n": 124, "t": 1795282455.238, "box": [235.9, 369.1, 352.7, 428.8]}
|
||||||
|
{"n": 125, "t": 1795282455.418, "box": [239.6, 368.1, 353.1, 429.3]}
|
||||||
|
{"n": 126, "t": 1795282455.659, "box": [234.4, 370.9, 351.7, 428.8]}
|
||||||
|
{"n": 127, "t": 1795282455.802, "box": [236.3, 370.1, 351.3, 429.0]}
|
||||||
|
{"n": 128, "t": 1795282456.038, "box": [236.4, 369.5, 352.2, 428.3]}
|
||||||
|
{"n": 129, "t": 1795282456.2, "box": [236.3, 368.5, 353.0, 428.4]}
|
||||||
|
{"n": 130, "t": 1795282456.439, "box": [235.4, 366.7, 353.7, 428.4]}
|
||||||
|
{"n": 131, "t": 1795282456.618, "box": [235.1, 368.8, 353.1, 428.5]}
|
||||||
|
{"n": 132, "t": 1795282456.858, "box": [234.4, 369.2, 352.3, 428.8]}
|
||||||
|
{"n": 133, "t": 1795282456.998, "box": [234.4, 366.8, 354.0, 428.2]}
|
||||||
|
{"n": 134, "t": 1795282457.24, "box": [232.0, 368.4, 352.6, 428.7]}
|
||||||
|
{"n": 135, "t": 1795282457.399, "box": [234.2, 365.0, 353.6, 428.7]}
|
||||||
|
{"n": 136, "t": 1795282457.639, "box": [235.9, 367.5, 352.9, 428.8]}
|
||||||
|
{"n": 137, "t": 1795282457.818, "box": [236.5, 367.4, 352.4, 428.9]}
|
||||||
|
{"n": 138, "t": 1795282458.057, "box": [238.0, 370.8, 353.0, 429.0]}
|
||||||
|
{"n": 139, "t": 1795282458.198, "box": [241.1, 369.0, 352.5, 429.2]}
|
||||||
|
{"n": 140, "t": 1795282458.457, "box": [239.5, 368.6, 352.2, 429.1]}
|
||||||
|
{"n": 141, "t": 1795282458.599, "box": [240.3, 369.4, 352.4, 429.1]}
|
||||||
|
{"n": 142, "t": 1795282458.839, "box": [238.1, 369.0, 352.6, 428.8]}
|
||||||
|
{"n": 143, "t": 1795282459.018, "box": [233.7, 361.9, 354.8, 428.3]}
|
||||||
|
{"n": 144, "t": 1795282459.258, "box": [235.8, 366.9, 353.0, 429.3]}
|
||||||
|
{"n": 145, "t": 1795282459.4, "box": [234.4, 369.0, 353.1, 428.5]}
|
||||||
|
{"n": 146, "t": 1795282459.64, "box": [234.0, 366.1, 353.1, 428.6]}
|
||||||
|
{"n": 147, "t": 1795282459.799, "box": [236.9, 371.9, 351.9, 428.6]}
|
||||||
|
{"n": 148, "t": 1795282460.039, "box": [238.9, 370.2, 352.5, 428.9]}
|
||||||
|
{"n": 149, "t": 1795282460.22, "box": [237.6, 372.8, 351.0, 428.9]}
|
||||||
|
{"n": 150, "t": 1795282460.458, "box": [235.2, 370.5, 351.5, 429.2]}
|
||||||
|
{"n": 151, "t": 1795282460.599, "box": [238.1, 370.8, 351.5, 428.6]}
|
||||||
|
{"n": 152, "t": 1795282460.839, "box": [234.0, 367.2, 353.1, 428.5]}
|
||||||
|
{"n": 153, "t": 1795282460.999, "box": [234.4, 369.2, 353.2, 428.5]}
|
||||||
|
{"n": 154, "t": 1795282461.242, "box": [234.5, 368.1, 353.9, 428.5]}
|
||||||
|
{"n": 155, "t": 1795282461.417, "box": [234.7, 365.1, 353.5, 428.7]}
|
||||||
|
{"n": 156, "t": 1795282461.639, "box": [235.7, 367.4, 353.5, 429.1]}
|
||||||
|
{"n": 157, "t": 1795282461.818, "box": [234.1, 367.9, 352.1, 428.9]}
|
||||||
|
{"n": 158, "t": 1795282462.059, "box": [234.8, 369.9, 351.1, 428.7]}
|
||||||
|
{"n": 159, "t": 1795282462.198, "box": [234.9, 365.8, 353.2, 428.4]}
|
||||||
|
{"n": 160, "t": 1795282462.438, "box": [234.4, 365.1, 354.1, 428.9]}
|
||||||
|
{"n": 161, "t": 1795282462.599, "box": [231.8, 368.2, 352.2, 429.0]}
|
||||||
|
{"n": 162, "t": 1795282462.842, "box": [233.5, 365.2, 354.0, 428.1]}
|
||||||
|
{"n": 163, "t": 1795282463.019, "box": [239.4, 365.3, 354.7, 429.3]}
|
||||||
|
{"n": 164, "t": 1795282463.259, "box": [234.8, 367.3, 352.3, 429.2]}
|
||||||
|
{"n": 165, "t": 1795282463.399, "box": [234.0, 367.1, 351.9, 428.9]}
|
||||||
|
{"n": 166, "t": 1795282463.637, "box": [233.8, 367.8, 352.7, 428.5]}
|
||||||
|
{"n": 167, "t": 1795282463.8, "box": [236.9, 369.7, 351.3, 428.7]}
|
||||||
|
{"n": 168, "t": 1795282464.039, "box": [234.8, 366.2, 353.0, 428.8]}
|
||||||
|
{"n": 169, "t": 1795282464.218, "box": [235.2, 368.9, 351.6, 429.1]}
|
||||||
|
{"n": 170, "t": 1795282464.459, "box": [235.6, 367.8, 353.1, 428.6]}
|
||||||
|
{"n": 171, "t": 1795282464.598, "box": [232.5, 367.1, 353.2, 428.4]}
|
||||||
|
{"n": 172, "t": 1795282464.838, "box": [237.1, 367.8, 352.6, 428.7]}
|
||||||
|
{"n": 173, "t": 1795282464.999, "box": [237.3, 367.2, 352.2, 428.9]}
|
||||||
|
{"n": 174, "t": 1795282465.239, "box": [234.3, 366.0, 352.8, 429.3]}
|
||||||
|
{"n": 175, "t": 1795282465.418, "box": [236.2, 369.7, 351.9, 428.8]}
|
||||||
|
{"n": 176, "t": 1795282465.658, "box": [235.4, 367.6, 352.0, 429.3]}
|
||||||
|
{"n": 177, "t": 1795282465.798, "box": [233.9, 367.6, 352.5, 428.9]}
|
||||||
|
{"n": 178, "t": 1795282466.04, "box": [235.2, 364.2, 352.7, 428.7]}
|
||||||
|
{"n": 179, "t": 1795282466.219, "box": [236.9, 368.8, 352.0, 428.7]}
|
||||||
|
{"n": 180, "t": 1795282466.357, "box": [235.5, 369.1, 351.9, 428.7]}
|
||||||
|
{"n": 181, "t": 1795282466.638, "box": [234.2, 367.2, 352.7, 428.9]}
|
||||||
|
{"n": 182, "t": 1795282466.858, "box": [234.3, 367.9, 352.4, 428.4]}
|
||||||
|
{"n": 183, "t": 1795282466.998, "box": [236.1, 367.1, 352.6, 428.5]}
|
||||||
|
{"n": 184, "t": 1795282467.238, "box": [235.1, 365.5, 353.4, 428.9]}
|
||||||
|
{"n": 185, "t": 1795282467.4, "box": [235.0, 365.3, 353.5, 428.6]}
|
||||||
|
{"n": 186, "t": 1795282467.64, "box": [237.7, 364.9, 353.4, 428.8]}
|
||||||
|
{"n": 187, "t": 1795282467.82, "box": [233.8, 364.1, 353.8, 428.5]}
|
||||||
|
{"n": 188, "t": 1795282468.039, "box": [234.4, 366.0, 353.3, 428.7]}
|
||||||
|
{"n": 189, "t": 1795282468.217, "box": [238.4, 365.4, 353.3, 428.4]}
|
||||||
|
{"n": 190, "t": 1795282468.46, "box": [233.7, 365.4, 353.3, 428.5]}
|
||||||
|
{"n": 191, "t": 1795282468.6, "box": [237.1, 366.3, 353.6, 429.3]}
|
||||||
|
{"n": 192, "t": 1795282468.839, "box": [236.4, 366.0, 353.2, 429.2]}
|
||||||
|
{"n": 193, "t": 1795282469.018, "box": [234.1, 366.1, 352.6, 428.5]}
|
||||||
|
{"n": 194, "t": 1795282469.258, "box": [235.3, 368.2, 353.3, 429.3]}
|
||||||
|
{"n": 195, "t": 1795282469.4, "box": [238.6, 367.1, 353.3, 428.7]}
|
||||||
|
{"n": 196, "t": 1795282469.638, "box": [239.5, 368.4, 352.4, 428.7]}
|
||||||
|
{"n": 197, "t": 1795282469.8, "box": [237.4, 368.2, 352.5, 428.9]}
|
||||||
|
{"n": 198, "t": 1795282470.058, "box": [235.8, 368.8, 352.2, 428.6]}
|
||||||
|
{"n": 199, "t": 1795282470.198, "box": [234.6, 367.4, 353.0, 428.8]}
|
||||||
|
{"n": 200, "t": 1795282470.44, "box": [238.5, 369.3, 352.8, 429.1]}
|
||||||
|
{"n": 201, "t": 1795282470.618, "box": [237.9, 370.0, 351.8, 429.1]}
|
||||||
|
{"n": 202, "t": 1795282470.838, "box": [234.9, 370.3, 351.6, 428.6]}
|
||||||
|
{"n": 203, "t": 1795282471.001, "box": [234.3, 369.7, 351.9, 429.0]}
|
||||||
|
{"n": 204, "t": 1795282471.239, "box": [237.3, 370.4, 351.5, 428.9]}
|
||||||
|
{"n": 205, "t": 1795282471.418, "box": [237.8, 369.1, 352.8, 428.7]}
|
||||||
|
{"n": 206, "t": 1795282471.659, "box": [236.3, 369.3, 352.8, 428.4]}
|
||||||
|
{"n": 207, "t": 1795282471.798, "box": [237.5, 369.6, 353.1, 429.1]}
|
||||||
|
{"n": 208, "t": 1795282472.038, "box": [236.3, 372.3, 351.8, 428.7]}
|
||||||
|
{"n": 209, "t": 1795282472.217, "box": [236.1, 366.8, 352.7, 428.7]}
|
||||||
|
{"n": 210, "t": 1795282472.38, "box": [233.6, 366.7, 353.7, 428.5]}
|
||||||
|
{"n": 211, "t": 1795282472.598, "box": [235.0, 367.1, 353.6, 429.1]}
|
||||||
|
{"n": 212, "t": 1795282472.837, "box": [232.8, 368.1, 353.5, 428.6]}
|
||||||
|
{"n": 213, "t": 1795282473.078, "box": [232.0, 368.6, 351.9, 428.4]}
|
||||||
|
{"n": 214, "t": 1795282473.24, "box": [236.7, 369.7, 352.6, 428.8]}
|
||||||
|
{"n": 215, "t": 1795282473.418, "box": [234.8, 369.8, 352.9, 429.1]}
|
||||||
|
{"n": 216, "t": 1795282473.638, "box": [237.3, 369.4, 353.3, 428.9]}
|
||||||
|
{"n": 217, "t": 1795282473.802, "box": [234.8, 367.4, 352.9, 429.1]}
|
||||||
|
{"n": 218, "t": 1795282474.038, "box": [236.1, 372.1, 352.1, 429.3]}
|
||||||
|
{"n": 219, "t": 1795282474.278, "box": [238.4, 369.4, 352.7, 428.4]}
|
||||||
|
{"n": 220, "t": 1795282474.44, "box": [239.2, 371.5, 351.6, 428.9]}
|
||||||
|
{"n": 221, "t": 1795282474.68, "box": [238.6, 369.9, 353.6, 429.3]}
|
||||||
|
{"n": 222, "t": 1795282474.859, "box": [235.0, 369.6, 352.7, 429.1]}
|
||||||
|
{"n": 223, "t": 1795282474.998, "box": [234.6, 368.6, 352.7, 429.0]}
|
||||||
|
{"n": 224, "t": 1795282475.239, "box": [239.5, 368.9, 353.2, 428.8]}
|
||||||
|
{"n": 225, "t": 1795282475.48, "box": [235.6, 371.1, 352.1, 428.8]}
|
||||||
|
{"n": 226, "t": 1795282475.659, "box": [236.4, 372.9, 351.6, 428.8]}
|
||||||
|
{"n": 227, "t": 1795282475.801, "box": [234.9, 368.3, 353.5, 428.4]}
|
||||||
|
{"n": 228, "t": 1795282476.038, "box": [235.7, 368.7, 353.1, 428.8]}
|
||||||
|
{"n": 229, "t": 1795282476.278, "box": [231.7, 367.4, 353.2, 429.0]}
|
||||||
|
{"n": 230, "t": 1795282476.439, "box": [231.7, 364.4, 354.4, 428.3]}
|
||||||
|
{"n": 231, "t": 1795282476.68, "box": [240.4, 366.6, 354.9, 429.7]}
|
||||||
|
{"n": 232, "t": 1795282476.858, "box": [237.3, 368.2, 354.1, 428.9]}
|
||||||
|
{"n": 233, "t": 1795282476.998, "box": [242.1, 367.7, 354.2, 429.2]}
|
||||||
|
{"n": 234, "t": 1795282477.237, "box": [235.3, 367.3, 353.1, 429.3]}
|
||||||
|
{"n": 235, "t": 1795282477.481, "box": [237.0, 366.5, 353.6, 428.6]}
|
||||||
|
{"n": 236, "t": 1795282477.64, "box": [236.1, 367.1, 353.4, 429.1]}
|
||||||
|
{"n": 237, "t": 1795282477.88, "box": [237.7, 371.4, 352.5, 429.2]}
|
||||||
|
{"n": 238, "t": 1795282478.059, "box": [235.0, 371.5, 352.7, 429.1]}
|
||||||
|
{"n": 239, "t": 1795282478.198, "box": [234.3, 371.3, 352.4, 428.9]}
|
||||||
|
{"n": 240, "t": 1795282478.44, "box": [235.6, 369.4, 352.8, 429.2]}
|
||||||
|
{"n": 241, "t": 1795282478.679, "box": [233.5, 369.8, 352.7, 428.8]}
|
||||||
|
{"n": 242, "t": 1795282478.839, "box": [236.6, 367.6, 352.5, 428.7]}
|
||||||
|
{"n": 243, "t": 1795282479.081, "box": [238.8, 369.1, 352.4, 428.8]}
|
||||||
|
{"n": 244, "t": 1795282479.259, "box": [237.9, 367.8, 352.7, 428.9]}
|
||||||
|
{"n": 245, "t": 1795282479.399, "box": [236.2, 368.0, 353.0, 428.9]}
|
||||||
|
{"n": 246, "t": 1795282479.638, "box": [232.8, 366.4, 352.9, 428.5]}
|
||||||
|
{"n": 247, "t": 1795282479.878, "box": [235.9, 367.5, 353.4, 428.3]}
|
||||||
|
{"n": 248, "t": 1795282480.04, "box": [237.6, 372.0, 351.1, 428.8]}
|
||||||
|
{"n": 249, "t": 1795282480.279, "box": [237.4, 369.3, 352.3, 428.9]}
|
||||||
|
{"n": 250, "t": 1795282480.458, "box": [235.5, 369.1, 352.7, 428.7]}
|
||||||
|
{"n": 251, "t": 1795282480.598, "box": [235.6, 368.6, 352.6, 428.6]}
|
||||||
|
{"n": 252, "t": 1795282480.838, "box": [234.4, 370.6, 351.2, 428.3]}
|
||||||
|
{"n": 253, "t": 1795282481.078, "box": [234.4, 370.1, 351.8, 429.0]}
|
||||||
|
{"n": 254, "t": 1795282481.239, "box": [235.4, 371.0, 351.6, 428.8]}
|
||||||
|
{"n": 255, "t": 1795282481.479, "box": [237.9, 371.0, 352.7, 428.7]}
|
||||||
|
{"n": 256, "t": 1795282481.659, "box": [237.6, 370.9, 352.3, 428.8]}
|
||||||
|
{"n": 257, "t": 1795282481.799, "box": [236.5, 371.8, 350.8, 429.0]}
|
||||||
|
{"n": 258, "t": 1795282482.058, "box": [237.5, 370.8, 352.4, 428.2]}
|
||||||
|
{"n": 259, "t": 1795282482.198, "box": [239.4, 371.5, 352.2, 428.9]}
|
||||||
|
{"n": 260, "t": 1795282482.439, "box": [238.5, 370.5, 351.9, 428.8]}
|
||||||
|
{"n": 261, "t": 1795282482.68, "box": [238.6, 368.6, 352.5, 429.1]}
|
||||||
|
{"n": 262, "t": 1795282482.858, "box": [234.8, 369.3, 351.6, 428.7]}
|
||||||
|
{"n": 263, "t": 1795282482.998, "box": [234.7, 370.4, 351.4, 428.6]}
|
||||||
|
{"n": 264, "t": 1795282483.278, "box": [236.5, 369.6, 352.4, 429.1]}
|
||||||
|
{"n": 265, "t": 1795282483.398, "box": [236.9, 369.1, 352.5, 428.9]}
|
||||||
|
{"n": 266, "t": 1795282483.637, "box": [236.2, 369.6, 352.6, 428.9]}
|
||||||
|
{"n": 267, "t": 1795282483.878, "box": [236.2, 368.0, 352.7, 428.5]}
|
||||||
|
{"n": 268, "t": 1795282484.039, "box": [236.6, 368.2, 353.6, 428.7]}
|
||||||
|
{"n": 269, "t": 1795282484.279, "box": [233.3, 368.8, 353.7, 428.7]}
|
||||||
|
{"n": 270, "t": 1795282484.458, "box": [234.8, 366.5, 353.8, 429.1]}
|
||||||
|
{"n": 271, "t": 1795282484.6, "box": [235.9, 369.9, 352.9, 428.6]}
|
||||||
|
{"n": 272, "t": 1795282484.837, "box": [235.7, 370.2, 352.5, 429.2]}
|
||||||
|
{"n": 273, "t": 1795282485.078, "box": [236.7, 369.8, 351.7, 429.0]}
|
||||||
|
{"n": 274, "t": 1795282485.258, "box": [235.2, 368.8, 352.4, 429.4]}
|
||||||
|
{"n": 275, "t": 1795282485.398, "box": [236.8, 370.4, 351.9, 429.1]}
|
||||||
|
{"n": 276, "t": 1795282485.638, "box": [236.8, 367.7, 352.0, 429.2]}
|
||||||
|
{"n": 277, "t": 1795282485.878, "box": [240.6, 367.7, 353.5, 429.6]}
|
||||||
|
{"n": 278, "t": 1795282486.058, "box": [236.9, 369.2, 352.3, 429.1]}
|
||||||
|
{"n": 279, "t": 1795282486.198, "box": [234.6, 365.8, 353.4, 428.5]}
|
||||||
|
{"n": 280, "t": 1795282486.44, "box": [237.8, 369.5, 351.9, 429.2]}
|
||||||
|
{"n": 281, "t": 1795282486.617, "box": [235.4, 367.6, 353.0, 428.9]}
|
||||||
|
{"n": 282, "t": 1795282486.837, "box": [238.1, 368.7, 352.6, 428.8]}
|
||||||
|
{"n": 283, "t": 1795282487.081, "box": [236.9, 368.4, 352.1, 429.2]}
|
||||||
|
{"n": 284, "t": 1795282487.24, "box": [238.0, 368.3, 352.2, 429.1]}
|
||||||
|
{"n": 285, "t": 1795282487.419, "box": [238.3, 369.9, 352.7, 428.7]}
|
||||||
|
{"n": 286, "t": 1795282487.639, "box": [239.7, 370.0, 351.6, 428.8]}
|
||||||
|
{"n": 287, "t": 1795282487.88, "box": [234.9, 367.6, 351.9, 429.1]}
|
||||||
|
{"n": 288, "t": 1795282488.057, "box": [233.0, 367.5, 352.8, 428.5]}
|
||||||
|
{"n": 289, "t": 1795282488.198, "box": [234.8, 368.9, 352.6, 428.7]}
|
||||||
|
{"n": 290, "t": 1795282488.479, "box": [234.5, 371.0, 352.3, 429.0]}
|
||||||
|
{"n": 291, "t": 1795282488.598, "box": [236.1, 368.2, 352.7, 429.0]}
|
||||||
|
{"n": 292, "t": 1795282488.837, "box": [235.4, 368.9, 352.6, 429.0]}
|
||||||
|
{"n": 293, "t": 1795282489.078, "box": [234.3, 368.9, 352.2, 429.1]}
|
||||||
|
{"n": 294, "t": 1795282489.241, "box": [233.8, 372.4, 350.8, 428.9]}
|
||||||
|
{"n": 295, "t": 1795282489.479, "box": [236.1, 369.1, 352.2, 429.0]}
|
||||||
|
{"n": 296, "t": 1795282489.659, "box": [234.9, 369.3, 352.0, 429.0]}
|
||||||
|
{"n": 297, "t": 1795282489.798, "box": [237.3, 368.8, 352.4, 429.1]}
|
||||||
|
{"n": 298, "t": 1795282490.038, "box": [234.6, 368.5, 352.8, 429.0]}
|
||||||
|
{"n": 299, "t": 1795282490.278, "box": [234.6, 369.6, 352.3, 429.1]}
|
||||||
|
{"n": 300, "t": 1795282490.439, "box": [237.2, 369.0, 351.3, 429.0]}
|
||||||
|
{"n": 301, "t": 1795282490.68, "box": [237.6, 369.5, 351.9, 428.6]}
|
||||||
|
{"n": 302, "t": 1795282490.858, "box": [238.7, 370.1, 351.9, 428.5]}
|
||||||
|
{"n": 303, "t": 1795282491.097, "box": [239.4, 371.5, 351.0, 428.6]}
|
||||||
|
{"n": 304, "t": 1795282491.239, "box": [239.9, 369.6, 351.0, 428.7]}
|
||||||
|
{"n": 305, "t": 1795282491.479, "box": [235.2, 369.8, 351.5, 429.9]}
|
||||||
|
{"n": 306, "t": 1795282491.657, "box": [234.6, 369.1, 352.1, 429.1]}
|
||||||
|
{"n": 307, "t": 1795282491.9, "box": [236.3, 368.8, 352.9, 428.8]}
|
||||||
|
{"n": 308, "t": 1795282492.038, "box": [236.6, 369.5, 352.6, 429.2]}
|
||||||
|
{"n": 309, "t": 1795282492.281, "box": [236.7, 369.6, 352.7, 428.9]}
|
||||||
|
{"n": 310, "t": 1795282492.458, "box": [238.2, 371.1, 351.6, 428.9]}
|
||||||
|
{"n": 311, "t": 1795282492.698, "box": [240.3, 373.5, 351.1, 429.2]}
|
||||||
|
{"n": 312, "t": 1795282492.838, "box": [235.1, 370.0, 352.4, 428.4]}
|
||||||
|
{"n": 313, "t": 1795282493.079, "box": [237.3, 369.3, 352.9, 428.9]}
|
||||||
|
{"n": 314, "t": 1795282493.239, "box": [238.2, 372.0, 352.1, 428.5]}
|
||||||
|
{"n": 315, "t": 1795282493.477, "box": [238.8, 370.6, 352.1, 428.4]}
|
||||||
|
{"n": 316, "t": 1795282493.639, "box": [238.8, 372.4, 350.8, 428.5]}
|
||||||
|
{"n": 317, "t": 1795282493.879, "box": [240.3, 369.2, 352.1, 428.9]}
|
||||||
|
{"n": 318, "t": 1795282494.058, "box": [234.6, 369.0, 351.7, 428.9]}
|
||||||
|
{"n": 319, "t": 1795282494.298, "box": [238.0, 367.9, 352.5, 428.9]}
|
||||||
|
{"n": 320, "t": 1795282494.44, "box": [236.5, 368.4, 352.2, 429.2]}
|
||||||
|
{"n": 321, "t": 1795282494.678, "box": [234.5, 368.3, 352.7, 428.6]}
|
||||||
|
{"n": 322, "t": 1795282494.841, "box": [242.9, 366.8, 353.7, 429.3]}
|
||||||
|
{"n": 323, "t": 1795282495.082, "box": [235.6, 366.6, 353.8, 428.6]}
|
||||||
|
{"n": 324, "t": 1795282495.257, "box": [235.0, 370.0, 352.6, 429.1]}
|
||||||
|
{"n": 325, "t": 1795282495.477, "box": [234.7, 369.4, 352.7, 428.7]}
|
||||||
|
{"n": 326, "t": 1795282495.661, "box": [236.1, 371.2, 351.9, 428.4]}
|
||||||
|
{"n": 327, "t": 1795282495.898, "box": [236.6, 369.7, 352.3, 428.6]}
|
||||||
|
{"n": 328, "t": 1795282496.038, "box": [233.7, 369.2, 351.8, 428.0]}
|
||||||
|
{"n": 329, "t": 1795282496.279, "box": [235.4, 367.7, 352.3, 428.4]}
|
||||||
|
{"n": 330, "t": 1795282496.46, "box": [235.2, 370.5, 351.4, 428.9]}
|
||||||
|
{"n": 331, "t": 1795282496.698, "box": [234.4, 368.8, 352.4, 429.0]}
|
||||||
|
{"n": 332, "t": 1795282496.838, "box": [238.2, 368.7, 351.6, 429.7]}
|
||||||
|
{"n": 333, "t": 1795282497.078, "box": [237.0, 367.8, 351.8, 428.9]}
|
||||||
|
{"n": 334, "t": 1795282497.239, "box": [234.7, 367.7, 352.9, 429.0]}
|
||||||
|
{"n": 335, "t": 1795282497.479, "box": [237.9, 368.0, 352.7, 429.2]}
|
||||||
|
{"n": 336, "t": 1795282497.658, "box": [235.4, 367.9, 351.7, 429.6]}
|
||||||
|
{"n": 337, "t": 1795282497.801, "box": [237.8, 365.7, 353.3, 429.7]}
|
||||||
|
{"n": 338, "t": 1795282498.081, "box": [235.1, 370.2, 351.9, 429.3]}
|
||||||
|
{"n": 339, "t": 1795282498.198, "box": [234.8, 369.8, 352.3, 429.3]}
|
||||||
|
{"n": 340, "t": 1795282498.478, "box": [236.6, 370.6, 351.9, 429.2]}
|
||||||
|
{"n": 341, "t": 1795282498.699, "box": [234.7, 368.8, 352.8, 428.6]}
|
||||||
|
{"n": 342, "t": 1795282498.837, "box": [237.1, 368.4, 353.5, 428.8]}
|
||||||
|
{"n": 343, "t": 1795282499.078, "box": [235.5, 369.0, 352.9, 429.2]}
|
||||||
|
{"n": 344, "t": 1795282499.24, "box": [235.6, 372.8, 351.1, 429.1]}
|
||||||
|
{"n": 345, "t": 1795282499.498, "box": [236.6, 369.9, 352.7, 429.1]}
|
||||||
|
{"n": 346, "t": 1795282499.638, "box": [234.7, 369.1, 352.6, 428.9]}
|
||||||
|
{"n": 347, "t": 1795282499.878, "box": [235.6, 368.1, 352.7, 429.2]}
|
||||||
|
{"n": 348, "t": 1795282500.06, "box": [234.8, 368.1, 352.8, 429.2]}
|
||||||
|
{"n": 349, "t": 1795282500.278, "box": [235.5, 369.0, 352.8, 428.9]}
|
||||||
|
{"n": 350, "t": 1795282500.44, "box": [244.0, 366.6, 354.7, 429.5]}
|
||||||
|
{"n": 351, "t": 1795282500.679, "box": [236.2, 368.5, 352.4, 428.9]}
|
||||||
|
{"n": 352, "t": 1795282500.859, "box": [235.5, 370.2, 352.0, 428.7]}
|
||||||
|
{"n": 353, "t": 1795282501.098, "box": [235.9, 368.3, 353.5, 428.6]}
|
||||||
|
{"n": 354, "t": 1795282501.238, "box": [239.2, 369.7, 352.7, 428.6]}
|
||||||
|
{"n": 355, "t": 1795282501.478, "box": [235.9, 366.8, 352.7, 428.8]}
|
||||||
|
{"n": 356, "t": 1795282501.639, "box": [234.4, 367.1, 353.0, 429.3]}
|
||||||
|
{"n": 357, "t": 1795282501.879, "box": [235.4, 368.5, 352.7, 429.3]}
|
||||||
|
{"n": 358, "t": 1795282502.058, "box": [234.4, 369.5, 352.0, 429.0]}
|
||||||
|
{"n": 359, "t": 1795282502.297, "box": [239.3, 368.7, 352.5, 429.2]}
|
||||||
|
{"n": 360, "t": 1795282502.439, "box": [241.0, 367.7, 353.3, 429.0]}
|
||||||
|
{"n": 361, "t": 1795282502.698, "box": [238.3, 371.3, 352.0, 428.8]}
|
||||||
|
{"n": 362, "t": 1795282502.838, "box": [236.4, 368.9, 352.9, 428.9]}
|
||||||
|
{"n": 363, "t": 1795282503.079, "box": [241.7, 366.7, 354.6, 429.4]}
|
||||||
|
{"n": 364, "t": 1795282503.239, "box": [234.9, 365.8, 353.7, 429.0]}
|
||||||
|
{"n": 365, "t": 1795282503.497, "box": [234.3, 366.7, 352.3, 428.5]}
|
||||||
|
{"n": 366, "t": 1795282503.637, "box": [232.6, 367.3, 352.5, 428.7]}
|
||||||
|
{"n": 367, "t": 1795282503.878, "box": [237.0, 369.2, 351.9, 428.7]}
|
||||||
|
{"n": 368, "t": 1795282504.059, "box": [233.7, 369.4, 351.9, 429.0]}
|
||||||
|
{"n": 369, "t": 1795282504.298, "box": [232.7, 367.9, 352.6, 428.7]}
|
||||||
|
{"n": 370, "t": 1795282504.438, "box": [233.5, 365.7, 354.2, 428.4]}
|
||||||
|
{"n": 371, "t": 1795282504.678, "box": [233.0, 367.5, 353.5, 428.7]}
|
||||||
|
{"n": 372, "t": 1795282504.84, "box": [234.5, 368.8, 352.4, 428.6]}
|
||||||
|
{"n": 373, "t": 1795282505.079, "box": [234.5, 367.9, 353.3, 428.9]}
|
||||||
|
{"n": 374, "t": 1795282505.259, "box": [237.2, 367.4, 353.3, 429.0]}
|
||||||
|
{"n": 375, "t": 1795282505.499, "box": [234.5, 366.6, 353.4, 429.2]}
|
||||||
|
{"n": 376, "t": 1795282505.638, "box": [235.2, 369.9, 352.2, 428.9]}
|
||||||
|
{"n": 377, "t": 1795282505.799, "box": [238.8, 366.6, 353.7, 428.9]}
|
||||||
|
{"n": 378, "t": 1795282506.058, "box": [232.7, 364.7, 353.3, 428.6]}
|
||||||
|
{"n": 379, "t": 1795282506.198, "box": [235.6, 364.6, 353.5, 428.2]}
|
||||||
|
{"n": 380, "t": 1795282506.457, "box": [234.4, 367.4, 352.9, 428.5]}
|
||||||
|
{"n": 381, "t": 1795282506.678, "box": [233.8, 368.6, 353.6, 429.4]}
|
||||||
|
{"n": 382, "t": 1795282506.858, "box": [235.4, 366.9, 353.4, 428.6]}
|
||||||
|
{"n": 383, "t": 1795282507.097, "box": [234.1, 369.3, 351.9, 428.6]}
|
||||||
|
{"n": 384, "t": 1795282507.239, "box": [240.9, 365.7, 352.9, 429.1]}
|
||||||
|
{"n": 385, "t": 1795282507.479, "box": [237.9, 365.8, 352.9, 429.1]}
|
||||||
|
{"n": 386, "t": 1795282507.659, "box": [238.4, 364.3, 353.9, 429.6]}
|
||||||
|
{"n": 387, "t": 1795282507.9, "box": [236.5, 364.7, 353.5, 428.8]}
|
||||||
|
{"n": 388, "t": 1795282508.038, "box": [236.7, 364.7, 352.3, 428.8]}
|
||||||
|
{"n": 389, "t": 1795282508.281, "box": [234.8, 367.2, 352.6, 429.2]}
|
||||||
|
{"n": 390, "t": 1795282508.439, "box": [235.1, 365.8, 353.0, 429.1]}
|
||||||
|
{"n": 391, "t": 1795282508.697, "box": [234.5, 365.7, 352.8, 429.0]}
|
||||||
|
{"n": 392, "t": 1795282508.838, "box": [235.8, 369.0, 352.9, 428.8]}
|
||||||
|
{"n": 393, "t": 1795282509.097, "box": [235.5, 362.1, 354.1, 427.7]}
|
||||||
|
{"n": 394, "t": 1795282509.24, "box": [235.0, 365.0, 353.2, 428.6]}
|
||||||
|
{"n": 395, "t": 1795282509.48, "box": [233.7, 363.8, 353.2, 428.4]}
|
||||||
|
{"n": 396, "t": 1795282509.658, "box": [235.9, 367.0, 353.2, 428.1]}
|
||||||
|
{"n": 397, "t": 1795282509.898, "box": [235.7, 364.6, 353.8, 428.2]}
|
||||||
|
{"n": 398, "t": 1795282510.04, "box": [237.5, 368.3, 352.2, 429.1]}
|
||||||
|
{"n": 399, "t": 1795282510.281, "box": [234.1, 367.3, 351.9, 428.7]}
|
||||||
|
{"n": 400, "t": 1795282510.517, "box": [240.1, 363.1, 354.8, 428.7]}
|
||||||
|
{"n": 401, "t": 1795282510.697, "box": [234.8, 364.7, 353.5, 428.4]}
|
||||||
|
{"n": 402, "t": 1795282510.838, "box": [233.4, 369.0, 352.4, 428.1]}
|
||||||
|
{"n": 403, "t": 1795282511.079, "box": [233.6, 369.0, 351.9, 428.7]}
|
||||||
|
{"n": 404, "t": 1795282511.319, "box": [233.8, 358.1, 353.4, 428.2]}
|
||||||
|
{"n": 405, "t": 1795282511.498, "box": [233.3, 366.5, 351.8, 428.2]}
|
||||||
|
{"n": 406, "t": 1795282511.638, "box": [234.6, 368.0, 353.3, 428.4]}
|
||||||
|
{"n": 407, "t": 1795282511.879, "box": [236.8, 367.0, 352.6, 428.4]}
|
||||||
|
{"n": 408, "t": 1795282512.118, "box": [236.9, 371.1, 351.3, 428.4]}
|
||||||
|
{"n": 409, "t": 1795282512.281, "box": [234.1, 368.3, 353.5, 428.4]}
|
||||||
|
{"n": 410, "t": 1795282512.519, "box": [237.6, 368.2, 352.6, 428.4]}
|
||||||
|
{"n": 411, "t": 1795282512.698, "box": [235.8, 369.3, 351.9, 428.2]}
|
||||||
|
{"n": 412, "t": 1795282512.838, "box": [238.4, 370.1, 351.9, 428.7]}
|
||||||
|
{"n": 413, "t": 1795282513.098, "box": [237.4, 369.3, 352.5, 428.7]}
|
||||||
|
{"n": 414, "t": 1795282513.319, "box": [234.9, 369.3, 351.7, 429.3]}
|
||||||
|
{"n": 415, "t": 1795282513.501, "box": [238.2, 370.8, 351.8, 429.0]}
|
||||||
|
{"n": 416, "t": 1795282513.719, "box": [239.8, 368.4, 352.6, 428.8]}
|
||||||
|
{"n": 417, "t": 1795282513.798, "box": [238.4, 369.3, 352.6, 428.9]}
|
||||||
|
{"n": 418, "t": 1795282514.04, "box": [236.9, 369.0, 352.6, 428.5]}
|
||||||
|
{"n": 419, "t": 1795282514.297, "box": [236.7, 369.4, 351.9, 429.9]}
|
||||||
|
{"n": 420, "t": 1795282514.52, "box": [234.0, 368.7, 352.3, 429.3]}
|
||||||
|
{"n": 421, "t": 1795282514.68, "box": [233.7, 366.4, 353.9, 429.2]}
|
||||||
|
{"n": 422, "t": 1795282514.922, "box": [236.1, 367.2, 352.8, 429.3]}
|
||||||
|
{"n": 423, "t": 1795282515.098, "box": [236.5, 369.2, 352.7, 429.0]}
|
||||||
|
{"n": 424, "t": 1795282515.238, "box": [235.0, 370.2, 351.4, 428.9]}
|
||||||
|
{"n": 425, "t": 1795282515.477, "box": [239.3, 368.5, 352.7, 428.9]}
|
||||||
|
{"n": 426, "t": 1795282515.718, "box": [235.1, 369.9, 352.7, 428.7]}
|
||||||
|
{"n": 427, "t": 1795282515.898, "box": [236.7, 369.0, 353.2, 429.1]}
|
||||||
|
{"n": 428, "t": 1795282516.119, "box": [235.8, 371.5, 352.7, 428.6]}
|
||||||
|
{"n": 429, "t": 1795282516.279, "box": [237.0, 370.0, 352.7, 428.9]}
|
||||||
|
{"n": 430, "t": 1795282516.459, "box": [237.3, 369.3, 352.1, 429.2]}
|
||||||
|
{"n": 431, "t": 1795282516.678, "box": [241.8, 371.3, 351.7, 428.8]}
|
||||||
|
{"n": 432, "t": 1795282516.918, "box": [240.4, 368.5, 352.7, 428.5]}
|
||||||
|
{"n": 433, "t": 1795282517.08, "box": [243.2, 369.5, 352.1, 428.6]}
|
||||||
|
{"n": 434, "t": 1795282517.321, "box": [238.2, 370.1, 351.7, 429.3]}
|
||||||
|
{"n": 435, "t": 1795282517.498, "box": [235.0, 370.9, 350.8, 428.8]}
|
||||||
|
{"n": 436, "t": 1795282517.638, "box": [234.7, 364.9, 353.9, 429.1]}
|
||||||
|
{"n": 437, "t": 1795282517.878, "box": [234.8, 366.4, 353.1, 429.0]}
|
||||||
|
{"n": 438, "t": 1795282518.118, "box": [235.7, 369.3, 352.5, 429.4]}
|
||||||
|
{"n": 439, "t": 1795282518.28, "box": [238.1, 369.8, 351.7, 429.1]}
|
||||||
|
{"n": 440, "t": 1795282518.458, "box": [238.2, 368.2, 352.3, 429.5]}
|
||||||
|
{"n": 441, "t": 1795282518.679, "box": [235.8, 369.9, 351.9, 429.0]}
|
||||||
|
{"n": 442, "t": 1795282518.859, "box": [237.2, 368.7, 353.1, 428.7]}
|
||||||
|
{"n": 443, "t": 1795282519.078, "box": [236.6, 368.6, 352.0, 428.8]}
|
||||||
|
{"n": 444, "t": 1795282519.32, "box": [235.1, 368.6, 352.0, 429.0]}
|
||||||
|
{"n": 445, "t": 1795282519.479, "box": [234.2, 367.7, 352.4, 428.7]}
|
||||||
|
{"n": 446, "t": 1795282519.721, "box": [232.5, 367.8, 352.2, 429.0]}
|
||||||
|
{"n": 447, "t": 1795282519.9, "box": [236.6, 369.6, 352.7, 428.6]}
|
||||||
|
{"n": 448, "t": 1795282520.038, "box": [236.1, 371.7, 352.0, 428.5]}
|
||||||
|
{"n": 449, "t": 1795282520.32, "box": [234.6, 371.7, 352.0, 428.7]}
|
||||||
|
{"n": 450, "t": 1795282520.44, "box": [235.4, 371.4, 351.2, 428.3]}
|
||||||
|
{"n": 451, "t": 1795282520.679, "box": [234.5, 367.8, 353.2, 429.1]}
|
||||||
|
{"n": 452, "t": 1795282520.92, "box": [236.9, 368.1, 353.1, 429.0]}
|
||||||
|
{"n": 453, "t": 1795282521.08, "box": [237.4, 372.1, 351.2, 429.0]}
|
||||||
|
{"n": 454, "t": 1795282521.321, "box": [236.7, 369.5, 352.7, 428.8]}
|
||||||
|
{"n": 455, "t": 1795282521.498, "box": [237.2, 371.2, 352.2, 429.0]}
|
||||||
|
{"n": 456, "t": 1795282521.639, "box": [238.1, 367.2, 352.7, 428.6]}
|
||||||
|
{"n": 457, "t": 1795282521.799, "box": [237.6, 369.9, 352.0, 429.0]}
|
||||||
|
{"n": 458, "t": 1795282522.121, "box": [240.7, 367.0, 354.5, 430.0]}
|
||||||
|
{"n": 459, "t": 1795282522.297, "box": [231.7, 339.4, 357.4, 428.2]}
|
||||||
|
{"n": 460, "t": 1795282522.458, "box": [233.5, 365.0, 354.0, 428.2]}
|
||||||
|
{"n": 461, "t": 1795282522.679, "box": [232.6, 368.5, 353.6, 428.9]}
|
||||||
|
{"n": 462, "t": 1795282522.92, "box": [233.9, 364.9, 354.5, 428.9]}
|
||||||
|
{"n": 463, "t": 1795282523.097, "box": [235.2, 368.2, 352.7, 429.0]}
|
||||||
|
{"n": 464, "t": 1795282523.317, "box": [233.6, 369.3, 354.1, 428.4]}
|
||||||
|
{"n": 465, "t": 1795282523.48, "box": [232.5, 370.5, 352.8, 428.7]}
|
||||||
|
{"n": 466, "t": 1795282523.658, "box": [237.5, 367.3, 354.0, 430.2]}
|
||||||
|
{"n": 467, "t": 1795282523.9, "box": [236.9, 366.4, 353.3, 428.3]}
|
||||||
|
{"n": 468, "t": 1795282524.039, "box": [234.2, 367.5, 352.5, 428.5]}
|
||||||
|
{"n": 469, "t": 1795282524.28, "box": [233.6, 367.5, 352.8, 428.6]}
|
||||||
|
{"n": 470, "t": 1795282524.457, "box": [236.6, 373.1, 351.9, 429.0]}
|
||||||
|
{"n": 471, "t": 1795282524.678, "box": [235.4, 372.2, 353.0, 428.4]}
|
||||||
|
{"n": 472, "t": 1795282524.919, "box": [232.8, 360.5, 354.7, 428.0]}
|
||||||
|
{"n": 473, "t": 1795282525.097, "box": [234.3, 371.5, 352.9, 428.8]}
|
||||||
|
{"n": 474, "t": 1795282525.318, "box": [234.7, 369.8, 353.5, 428.5]}
|
||||||
|
{"n": 475, "t": 1795282525.479, "box": [233.6, 368.9, 352.5, 428.7]}
|
||||||
|
{"n": 476, "t": 1795282525.719, "box": [233.8, 371.8, 351.8, 428.8]}
|
||||||
|
{"n": 477, "t": 1795282525.897, "box": [238.1, 372.5, 350.5, 429.5]}
|
||||||
|
{"n": 478, "t": 1795282526.038, "box": [241.7, 371.9, 351.0, 429.6]}
|
||||||
|
{"n": 479, "t": 1795282526.278, "box": [232.9, 369.3, 352.6, 428.6]}
|
||||||
|
{"n": 480, "t": 1795282526.518, "box": [235.0, 368.3, 352.8, 428.7]}
|
||||||
|
{"n": 481, "t": 1795282526.679, "box": [238.3, 371.4, 351.4, 428.5]}
|
||||||
|
{"n": 482, "t": 1795282526.919, "box": [234.0, 370.9, 351.9, 428.1]}
|
||||||
|
{"n": 483, "t": 1795282527.099, "box": [234.1, 367.2, 352.6, 428.8]}
|
||||||
|
{"n": 484, "t": 1795282527.239, "box": [236.1, 370.4, 352.6, 428.6]}
|
||||||
|
{"n": 485, "t": 1795282527.478, "box": [236.9, 369.7, 353.7, 428.6]}
|
||||||
|
{"n": 486, "t": 1795282527.719, "box": [232.9, 368.1, 352.6, 428.9]}
|
||||||
|
{"n": 487, "t": 1795282527.898, "box": [236.4, 373.2, 351.6, 428.4]}
|
||||||
|
{"n": 488, "t": 1795282528.039, "box": [233.4, 368.3, 353.7, 429.1]}
|
||||||
|
{"n": 489, "t": 1795282528.279, "box": [232.7, 368.7, 355.0, 428.6]}
|
||||||
|
{"n": 490, "t": 1795282528.518, "box": [233.3, 374.1, 352.0, 428.2]}
|
||||||
|
{"n": 491, "t": 1795282528.68, "box": [233.7, 370.1, 353.8, 428.1]}
|
||||||
|
{"n": 492, "t": 1795282528.92, "box": [234.1, 372.7, 352.2, 428.8]}
|
||||||
|
{"n": 493, "t": 1795282529.099, "box": [234.3, 370.3, 353.3, 428.7]}
|
||||||
|
{"n": 494, "t": 1795282529.239, "box": [232.9, 372.8, 352.1, 429.0]}
|
||||||
|
{"n": 495, "t": 1795282529.478, "box": [237.6, 371.0, 352.3, 428.9]}
|
||||||
|
{"n": 496, "t": 1795282529.718, "box": [233.2, 374.2, 351.4, 428.4]}
|
||||||
|
{"n": 497, "t": 1795282529.819, "box": [235.4, 372.6, 350.6, 428.7]}
|
||||||
|
{"n": 498, "t": 1795282530.118, "box": [237.4, 369.5, 352.4, 429.2]}
|
||||||
|
{"n": 499, "t": 1795282530.279, "box": [233.9, 372.2, 353.8, 428.0]}
|
||||||
|
{"n": 500, "t": 1795282530.458, "box": [235.2, 371.3, 351.6, 428.8]}
|
||||||
|
{"n": 501, "t": 1795282530.678, "box": [234.9, 368.2, 354.6, 428.3]}
|
||||||
|
{"n": 502, "t": 1795282530.919, "box": [235.6, 370.7, 352.5, 428.3]}
|
||||||
|
{"n": 503, "t": 1795282531.099, "box": [235.3, 370.8, 351.9, 428.1]}
|
||||||
|
{"n": 504, "t": 1795282531.239, "box": [235.7, 372.5, 351.9, 428.1]}
|
||||||
|
{"n": 505, "t": 1795282531.479, "box": [234.8, 373.7, 352.8, 428.2]}
|
||||||
|
{"n": 506, "t": 1795282531.717, "box": [239.5, 373.4, 352.1, 428.2]}
|
||||||
|
{"n": 507, "t": 1795282531.881, "box": [237.3, 370.1, 353.1, 428.5]}
|
||||||
|
{"n": 508, "t": 1795282532.12, "box": [235.4, 372.6, 352.8, 428.2]}
|
||||||
|
{"n": 509, "t": 1795282532.297, "box": [236.2, 373.5, 353.1, 428.4]}
|
||||||
|
{"n": 510, "t": 1795282532.519, "box": [235.3, 367.1, 354.9, 428.4]}
|
||||||
|
{"n": 511, "t": 1795282532.679, "box": [234.6, 369.9, 353.4, 428.7]}
|
||||||
|
{"n": 512, "t": 1795282532.92, "box": [234.5, 367.8, 354.2, 428.7]}
|
||||||
|
{"n": 513, "t": 1795282533.098, "box": [234.5, 368.8, 354.0, 428.7]}
|
||||||
|
{"n": 514, "t": 1795282533.239, "box": [235.0, 373.9, 351.8, 428.5]}
|
||||||
|
{"n": 515, "t": 1795282533.479, "box": [234.2, 373.8, 352.6, 428.0]}
|
||||||
|
{"n": 516, "t": 1795282533.72, "box": [232.3, 371.2, 353.4, 428.8]}
|
||||||
|
{"n": 517, "t": 1795282533.898, "box": [238.1, 367.9, 354.2, 430.1]}
|
||||||
|
{"n": 518, "t": 1795282534.122, "box": [231.7, 371.0, 352.9, 428.8]}
|
||||||
|
{"n": 519, "t": 1795282534.28, "box": [231.6, 370.5, 353.1, 428.7]}
|
||||||
|
{"n": 520, "t": 1795282534.458, "box": [233.5, 367.3, 354.4, 428.5]}
|
||||||
|
{"n": 521, "t": 1795282534.68, "box": [234.3, 369.1, 353.9, 428.4]}
|
||||||
|
{"n": 522, "t": 1795282534.859, "box": [236.0, 371.0, 351.7, 427.9]}
|
||||||
|
{"n": 523, "t": 1795282535.078, "box": [235.4, 372.0, 352.8, 428.1]}
|
||||||
|
{"n": 524, "t": 1795282535.317, "box": [237.1, 364.7, 354.4, 428.2]}
|
||||||
|
{"n": 525, "t": 1795282535.479, "box": [236.4, 366.9, 353.0, 428.2]}
|
||||||
|
{"n": 526, "t": 1795282535.72, "box": [239.1, 368.2, 353.2, 428.0]}
|
||||||
|
{"n": 527, "t": 1795282535.898, "box": [238.7, 371.1, 353.2, 427.6]}
|
||||||
|
{"n": 528, "t": 1795282536.038, "box": [233.9, 369.5, 353.3, 427.9]}
|
||||||
|
{"n": 529, "t": 1795282536.298, "box": [235.7, 370.3, 353.6, 428.3]}
|
||||||
|
{"n": 530, "t": 1795282536.519, "box": [235.8, 373.9, 351.6, 428.2]}
|
||||||
|
{"n": 531, "t": 1795282536.698, "box": [235.4, 370.2, 353.0, 428.8]}
|
||||||
|
{"n": 532, "t": 1795282536.939, "box": [235.1, 372.2, 352.0, 428.3]}
|
||||||
|
{"n": 533, "t": 1795282537.079, "box": [233.1, 366.1, 354.1, 428.3]}
|
||||||
|
{"n": 534, "t": 1795282537.318, "box": [237.8, 370.3, 353.4, 428.3]}
|
||||||
|
{"n": 535, "t": 1795282537.479, "box": [235.4, 368.5, 353.9, 428.4]}
|
||||||
|
{"n": 536, "t": 1795282537.719, "box": [234.9, 370.6, 352.3, 428.4]}
|
||||||
|
{"n": 537, "t": 1795282537.798, "box": [233.3, 369.9, 353.6, 428.3]}
|
||||||
|
{"n": 538, "t": 1795282538.117, "box": [233.4, 372.3, 351.9, 428.4]}
|
||||||
|
{"n": 539, "t": 1795282538.28, "box": [230.8, 371.2, 354.5, 428.1]}
|
||||||
|
{"n": 540, "t": 1795282538.537, "box": [233.8, 371.7, 353.4, 428.4]}
|
||||||
|
{"n": 541, "t": 1795282538.678, "box": [233.5, 370.9, 353.6, 428.7]}
|
||||||
|
{"n": 542, "t": 1795282538.919, "box": [232.8, 369.7, 352.5, 428.6]}
|
||||||
|
{"n": 543, "t": 1795282539.08, "box": [234.9, 368.2, 354.1, 428.1]}
|
||||||
|
{"n": 544, "t": 1795282539.32, "box": [236.0, 369.3, 352.4, 428.3]}
|
||||||
|
{"n": 545, "t": 1795282539.501, "box": [234.7, 372.1, 353.9, 428.0]}
|
||||||
|
{"n": 546, "t": 1795282539.739, "box": [230.4, 366.2, 355.1, 427.9]}
|
||||||
|
{"n": 547, "t": 1795282539.88, "box": [232.2, 367.8, 353.6, 428.3]}
|
||||||
|
{"n": 548, "t": 1795282540.139, "box": [232.5, 369.6, 352.6, 428.3]}
|
||||||
|
{"n": 549, "t": 1795282540.28, "box": [232.6, 340.4, 356.7, 428.0]}
|
||||||
|
{"n": 550, "t": 1795282540.538, "box": [240.7, 369.0, 352.3, 429.4]}
|
||||||
|
{"n": 551, "t": 1795282540.68, "box": [229.3, 332.6, 359.0, 426.9]}
|
||||||
|
{"n": 552, "t": 1795282540.923, "box": [231.4, 369.7, 354.1, 428.4]}
|
||||||
|
{"n": 553, "t": 1795282541.097, "box": [238.8, 367.7, 354.0, 429.6]}
|
||||||
|
{"n": 554, "t": 1795282541.32, "box": [232.8, 332.9, 359.1, 427.2]}
|
||||||
|
{"n": 555, "t": 1795282541.48, "box": [233.4, 363.2, 355.8, 427.8]}
|
||||||
|
{"n": 556, "t": 1795282541.72, "box": [236.5, 370.6, 353.7, 428.3]}
|
||||||
|
{"n": 557, "t": 1795282541.899, "box": [237.8, 372.8, 352.2, 428.1]}
|
||||||
|
{"n": 558, "t": 1795282542.138, "box": [236.0, 371.2, 353.4, 428.4]}
|
||||||
|
{"n": 559, "t": 1795282542.281, "box": [232.9, 368.3, 353.9, 428.3]}
|
||||||
|
{"n": 560, "t": 1795282542.52, "box": [233.9, 368.6, 352.7, 428.8]}
|
||||||
|
{"n": 561, "t": 1795282542.697, "box": [235.2, 370.5, 352.7, 428.5]}
|
||||||
|
{"n": 562, "t": 1795282542.937, "box": [235.3, 368.6, 353.2, 428.5]}
|
||||||
|
{"n": 563, "t": 1795282543.079, "box": [234.8, 372.8, 351.3, 428.4]}
|
||||||
|
{"n": 564, "t": 1795282543.32, "box": [236.5, 372.2, 352.3, 428.5]}
|
||||||
|
{"n": 565, "t": 1795282543.498, "box": [233.5, 371.2, 353.4, 428.2]}
|
||||||
|
{"n": 566, "t": 1795282543.738, "box": [232.0, 368.8, 354.2, 428.3]}
|
||||||
|
{"n": 567, "t": 1795282543.878, "box": [239.1, 366.9, 354.7, 430.1]}
|
||||||
|
{"n": 568, "t": 1795282544.119, "box": [231.2, 366.0, 354.9, 428.5]}
|
||||||
|
{"n": 569, "t": 1795282544.279, "box": [234.5, 367.8, 354.9, 428.1]}
|
||||||
|
{"n": 570, "t": 1795282544.521, "box": [232.5, 373.4, 352.4, 428.7]}
|
||||||
|
{"n": 571, "t": 1795282544.698, "box": [235.3, 375.6, 351.4, 428.6]}
|
||||||
|
{"n": 572, "t": 1795282544.938, "box": [233.7, 373.7, 352.5, 428.9]}
|
||||||
|
{"n": 573, "t": 1795282545.079, "box": [232.5, 370.2, 352.6, 428.6]}
|
||||||
|
{"n": 574, "t": 1795282545.317, "box": [234.9, 366.2, 352.9, 428.1]}
|
||||||
|
{"n": 575, "t": 1795282545.479, "box": [236.7, 367.3, 353.2, 428.6]}
|
||||||
|
{"n": 576, "t": 1795282545.719, "box": [233.1, 373.6, 351.1, 428.7]}
|
||||||
|
{"n": 577, "t": 1795282545.797, "box": [233.5, 369.4, 352.7, 428.7]}
|
||||||
|
{"n": 578, "t": 1795282546.119, "box": [235.7, 374.7, 350.0, 428.3]}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
{"n": 1, "t": 1795282598.289, "box": [306.0, 283.2, 904.6, 656.3]}
|
||||||
|
{"n": 2, "t": 1795282598.516, "box": [312.1, 280.1, 893.4, 636.9]}
|
||||||
|
{"n": 3, "t": 1795282598.711, "box": [306.0, 278.2, 915.2, 641.7]}
|
||||||
|
{"n": 4, "t": 1795282598.773, "box": [309.7, 276.8, 941.9, 654.3]}
|
||||||
|
{"n": 5, "t": 1795282599.012, "box": [320.0, 273.7, 972.3, 689.2]}
|
||||||
|
{"n": 6, "t": 1795282599.31, "box": [328.4, 271.0, 1000.1, 690.5]}
|
||||||
|
{"n": 7, "t": 1795282599.494, "box": [332.8, 268.9, 1001.9, 690.1]}
|
||||||
|
{"n": 8, "t": 1795282599.713, "box": [332.2, 270.2, 1002.5, 690.5]}
|
||||||
|
{"n": 9, "t": 1795282599.891, "box": [330.4, 271.3, 1006.0, 693.3]}
|
||||||
|
{"n": 10, "t": 1795282599.971, "box": [331.3, 272.1, 1004.3, 692.4]}
|
||||||
|
{"n": 11, "t": 1795282600.28, "box": [333.4, 273.0, 1005.1, 693.3]}
|
||||||
|
{"n": 12, "t": 1795282600.53, "box": [335.0, 270.5, 1002.7, 692.5]}
|
||||||
|
{"n": 13, "t": 1795282600.685, "box": [335.0, 271.0, 1004.1, 693.0]}
|
||||||
|
{"n": 14, "t": 1795282600.925, "box": [336.9, 271.8, 1006.0, 693.0]}
|
||||||
|
{"n": 15, "t": 1795282601.099, "box": [337.4, 270.6, 1006.5, 692.6]}
|
||||||
|
{"n": 16, "t": 1795282601.324, "box": [337.6, 270.7, 1008.0, 693.5]}
|
||||||
|
{"n": 17, "t": 1795282601.48, "box": [335.6, 270.9, 1006.0, 693.7]}
|
||||||
|
{"n": 18, "t": 1795282601.724, "box": [335.5, 270.4, 1007.2, 692.3]}
|
||||||
|
{"n": 19, "t": 1795282601.899, "box": [335.2, 270.8, 1006.9, 692.8]}
|
||||||
|
{"n": 20, "t": 1795282602.123, "box": [337.5, 272.1, 1006.6, 694.1]}
|
||||||
|
{"n": 21, "t": 1795282602.31, "box": [337.0, 271.7, 1008.7, 693.7]}
|
||||||
|
{"n": 22, "t": 1795282602.509, "box": [335.8, 271.4, 1007.5, 693.3]}
|
||||||
|
{"n": 23, "t": 1795282602.694, "box": [336.1, 271.3, 1009.1, 694.1]}
|
||||||
|
{"n": 24, "t": 1795282602.852, "box": [336.3, 270.5, 1008.0, 694.9]}
|
||||||
|
{"n": 25, "t": 1795282603.098, "box": [337.0, 270.5, 1006.1, 695.0]}
|
||||||
|
{"n": 26, "t": 1795282603.24, "box": [336.5, 271.4, 1006.9, 694.2]}
|
||||||
|
{"n": 27, "t": 1795282603.492, "box": [335.0, 270.1, 1009.3, 694.6]}
|
||||||
|
{"n": 28, "t": 1795282603.732, "box": [335.9, 269.6, 1007.6, 694.9]}
|
||||||
|
{"n": 29, "t": 1795282603.871, "box": [335.0, 270.9, 1009.3, 694.5]}
|
||||||
|
{"n": 30, "t": 1795282604.125, "box": [334.9, 271.5, 1009.2, 694.3]}
|
||||||
|
{"n": 31, "t": 1795282604.298, "box": [336.8, 271.7, 1008.5, 694.5]}
|
||||||
|
{"n": 32, "t": 1795282604.525, "box": [335.9, 271.2, 1009.0, 694.8]}
|
||||||
|
{"n": 33, "t": 1795282604.7, "box": [333.8, 271.3, 1008.1, 694.1]}
|
||||||
|
{"n": 34, "t": 1795282604.939, "box": [335.8, 271.0, 1004.8, 693.9]}
|
||||||
|
{"n": 35, "t": 1795282605.081, "box": [334.3, 272.5, 1006.0, 694.5]}
|
||||||
|
{"n": 36, "t": 1795282605.261, "box": [334.2, 271.4, 1008.5, 694.2]}
|
||||||
|
{"n": 37, "t": 1795282605.404, "box": [334.5, 271.8, 1008.8, 693.8]}
|
||||||
|
{"n": 38, "t": 1795282605.73, "box": [335.3, 271.7, 1008.3, 694.5]}
|
||||||
|
{"n": 39, "t": 1795282605.908, "box": [334.6, 272.9, 1008.9, 694.8]}
|
||||||
|
{"n": 40, "t": 1795282606.049, "box": [332.0, 270.6, 1003.7, 695.1]}
|
||||||
|
{"n": 41, "t": 1795282606.293, "box": [321.2, 262.3, 992.9, 704.5]}
|
||||||
|
{"n": 42, "t": 1795282606.429, "box": [318.6, 270.4, 970.9, 692.4]}
|
||||||
|
{"n": 43, "t": 1795282606.698, "box": [310.5, 272.2, 939.0, 670.1]}
|
||||||
|
{"n": 44, "t": 1795282606.939, "box": [304.9, 278.4, 1144.1, 694.6]}
|
||||||
|
{"n": 45, "t": 1795282607.08, "box": [309.6, 284.6, 917.6, 656.3]}
|
||||||
|
{"n": 46, "t": 1795282607.322, "box": [305.3, 288.7, 831.5, 634.1]}
|
||||||
|
{"n": 47, "t": 1795282607.5, "box": [293.5, 290.6, 776.4, 615.1]}
|
||||||
|
{"n": 48, "t": 1795282607.739, "box": [278.8, 296.8, 715.9, 569.5]}
|
||||||
|
{"n": 49, "t": 1795282607.878, "box": [275.0, 299.7, 614.1, 531.8]}
|
||||||
|
{"n": 50, "t": 1795282608.124, "box": [266.2, 307.1, 593.3, 515.4]}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
{"n": 1, "t": 1795283518.116, "box": [316.9, 280.4, 1030.5, 670.6]}
|
||||||
|
{"n": 2, "t": 1795283518.292, "box": [317.8, 284.8, 910.6, 646.5]}
|
||||||
|
{"n": 3, "t": 1795283518.537, "box": [316.4, 274.7, 973.8, 655.2]}
|
||||||
|
{"n": 4, "t": 1795283518.673, "box": [329.1, 271.9, 960.1, 681.7]}
|
||||||
|
{"n": 5, "t": 1795283518.931, "box": [334.0, 269.2, 1000.4, 694.5]}
|
||||||
|
{"n": 6, "t": 1795283519.12, "box": [338.0, 264.5, 1009.7, 694.8]}
|
||||||
|
{"n": 7, "t": 1795283519.32, "box": [340.6, 268.9, 1024.2, 693.3]}
|
||||||
|
{"n": 8, "t": 1795283519.52, "box": [340.9, 270.4, 1025.8, 697.4]}
|
||||||
|
{"n": 9, "t": 1795283519.722, "box": [340.4, 269.8, 1029.3, 695.9]}
|
||||||
|
{"n": 10, "t": 1795283519.9, "box": [338.7, 269.2, 1029.1, 697.0]}
|
||||||
|
{"n": 11, "t": 1795283520.188, "box": [337.7, 271.0, 1028.0, 697.1]}
|
||||||
|
{"n": 12, "t": 1795283520.301, "box": [339.6, 270.7, 1025.8, 696.0]}
|
||||||
|
{"n": 13, "t": 1795283520.593, "box": [338.8, 270.6, 1027.8, 696.7]}
|
||||||
|
{"n": 14, "t": 1795283520.698, "box": [339.3, 271.0, 1025.6, 696.3]}
|
||||||
|
{"n": 15, "t": 1795283520.992, "box": [340.0, 270.3, 1027.6, 697.3]}
|
||||||
|
{"n": 16, "t": 1795283521.097, "box": [338.7, 270.1, 1026.3, 697.9]}
|
||||||
|
{"n": 17, "t": 1795283521.415, "box": [337.2, 270.6, 1024.9, 696.7]}
|
||||||
|
{"n": 18, "t": 1795283521.552, "box": [339.5, 270.5, 1027.1, 696.6]}
|
||||||
|
{"n": 19, "t": 1795283521.792, "box": [337.8, 270.5, 1025.4, 697.4]}
|
||||||
|
{"n": 20, "t": 1795283521.98, "box": [339.3, 271.8, 1025.6, 696.2]}
|
||||||
|
{"n": 21, "t": 1795283522.141, "box": [338.3, 272.4, 1027.2, 697.7]}
|
||||||
|
{"n": 22, "t": 1795283522.301, "box": [338.5, 272.0, 1027.4, 698.1]}
|
||||||
|
{"n": 23, "t": 1795283522.603, "box": [338.6, 271.1, 1024.9, 697.2]}
|
||||||
|
{"n": 24, "t": 1795283522.781, "box": [341.0, 272.7, 1026.0, 698.0]}
|
||||||
|
{"n": 25, "t": 1795283522.921, "box": [340.6, 272.3, 1028.2, 698.4]}
|
||||||
|
{"n": 26, "t": 1795283523.162, "box": [341.1, 273.9, 1027.4, 696.7]}
|
||||||
|
{"n": 27, "t": 1795283523.415, "box": [343.0, 273.7, 1025.2, 698.1]}
|
||||||
|
{"n": 28, "t": 1795283523.575, "box": [341.3, 272.8, 1026.3, 696.4]}
|
||||||
|
{"n": 29, "t": 1795283523.816, "box": [339.7, 273.1, 1027.3, 696.8]}
|
||||||
|
{"n": 30, "t": 1795283523.974, "box": [341.2, 272.3, 1028.8, 696.8]}
|
||||||
|
{"n": 31, "t": 1795283524.217, "box": [342.5, 272.8, 1024.8, 696.4]}
|
||||||
|
{"n": 32, "t": 1795283524.297, "box": [341.6, 273.0, 1026.5, 696.6]}
|
||||||
|
{"n": 33, "t": 1795283524.615, "box": [341.1, 272.1, 1027.4, 697.4]}
|
||||||
|
{"n": 34, "t": 1795283524.776, "box": [341.0, 271.6, 1025.9, 697.7]}
|
||||||
|
{"n": 35, "t": 1795283524.939, "box": [342.7, 272.3, 1023.6, 697.6]}
|
||||||
|
{"n": 36, "t": 1795283525.176, "box": [340.9, 272.6, 1027.2, 697.0]}
|
||||||
|
{"n": 37, "t": 1795283525.416, "box": [340.7, 271.9, 1023.0, 697.1]}
|
||||||
|
{"n": 38, "t": 1795283525.591, "box": [340.5, 272.4, 1025.5, 696.0]}
|
||||||
|
{"n": 39, "t": 1795283525.82, "box": [342.9, 272.3, 1026.5, 697.6]}
|
||||||
|
{"n": 40, "t": 1795283525.981, "box": [342.1, 273.7, 1027.1, 697.4]}
|
||||||
|
{"n": 41, "t": 1795283526.122, "box": [341.7, 272.6, 1026.7, 697.0]}
|
||||||
|
{"n": 42, "t": 1795283526.361, "box": [342.2, 273.2, 1027.2, 696.9]}
|
||||||
|
{"n": 43, "t": 1795283526.615, "box": [342.1, 272.8, 1025.7, 697.2]}
|
||||||
|
{"n": 44, "t": 1795283526.774, "box": [342.5, 273.3, 1024.8, 696.9]}
|
||||||
|
{"n": 45, "t": 1795283527.015, "box": [342.2, 273.5, 1027.1, 697.1]}
|
||||||
|
{"n": 46, "t": 1795283527.174, "box": [340.9, 273.9, 1027.2, 697.5]}
|
||||||
|
{"n": 47, "t": 1795283527.415, "box": [339.1, 273.0, 1026.8, 697.4]}
|
||||||
|
{"n": 48, "t": 1795283527.557, "box": [341.3, 272.8, 1026.2, 698.1]}
|
||||||
|
{"n": 49, "t": 1795283527.792, "box": [340.4, 272.4, 1028.0, 696.8]}
|
||||||
|
{"n": 50, "t": 1795283527.975, "box": [341.5, 272.0, 1025.1, 697.3]}
|
||||||
|
{"n": 51, "t": 1795283528.174, "box": [341.9, 273.1, 1025.5, 696.7]}
|
||||||
|
{"n": 52, "t": 1795283528.378, "box": [340.8, 273.3, 1028.4, 697.8]}
|
||||||
|
{"n": 53, "t": 1795283528.615, "box": [341.2, 272.7, 1027.5, 697.2]}
|
||||||
|
{"n": 54, "t": 1795283528.753, "box": [342.5, 272.3, 1027.5, 697.5]}
|
||||||
|
{"n": 55, "t": 1795283528.992, "box": [341.1, 272.8, 1027.4, 697.3]}
|
||||||
|
{"n": 56, "t": 1795283529.174, "box": [342.4, 272.4, 1027.3, 697.6]}
|
||||||
|
{"n": 57, "t": 1795283529.419, "box": [341.2, 272.0, 1026.2, 697.3]}
|
||||||
|
{"n": 58, "t": 1795283529.574, "box": [341.3, 272.5, 1027.6, 697.8]}
|
||||||
|
{"n": 59, "t": 1795283529.815, "box": [342.7, 272.5, 1029.0, 697.8]}
|
||||||
|
{"n": 60, "t": 1795283529.983, "box": [342.7, 272.6, 1027.6, 697.9]}
|
||||||
|
{"n": 61, "t": 1795283530.116, "box": [341.4, 272.2, 1027.7, 697.5]}
|
||||||
|
{"n": 62, "t": 1795283530.374, "box": [341.5, 272.6, 1026.5, 697.9]}
|
||||||
|
{"n": 63, "t": 1795283530.616, "box": [342.6, 271.7, 1028.9, 698.6]}
|
||||||
|
{"n": 64, "t": 1795283530.775, "box": [342.0, 271.7, 1026.9, 697.8]}
|
||||||
|
{"n": 65, "t": 1795283530.951, "box": [343.5, 271.7, 1027.1, 697.8]}
|
||||||
|
{"n": 66, "t": 1795283531.174, "box": [341.2, 272.5, 1026.1, 697.8]}
|
||||||
|
{"n": 67, "t": 1795283531.416, "box": [339.5, 273.2, 1025.8, 696.8]}
|
||||||
|
{"n": 68, "t": 1795283531.578, "box": [342.0, 272.5, 1025.6, 697.0]}
|
||||||
|
{"n": 69, "t": 1795283531.815, "box": [341.5, 271.7, 1026.5, 697.0]}
|
||||||
|
{"n": 70, "t": 1795283531.953, "box": [341.5, 271.6, 1026.5, 697.7]}
|
||||||
|
{"n": 71, "t": 1795283532.217, "box": [340.3, 272.2, 1026.6, 696.7]}
|
||||||
|
{"n": 72, "t": 1795283532.357, "box": [340.1, 270.9, 1027.7, 697.0]}
|
||||||
|
{"n": 73, "t": 1795283532.594, "box": [339.2, 271.2, 1026.9, 696.5]}
|
||||||
|
{"n": 74, "t": 1795283532.776, "box": [341.0, 271.5, 1028.7, 697.6]}
|
||||||
|
{"n": 75, "t": 1795283533.015, "box": [342.8, 271.7, 1027.8, 697.8]}
|
||||||
|
{"n": 76, "t": 1795283533.074, "box": [342.4, 270.8, 1027.3, 696.9]}
|
||||||
|
{"n": 77, "t": 1795283533.416, "box": [340.0, 271.2, 1025.0, 697.3]}
|
||||||
|
{"n": 78, "t": 1795283533.574, "box": [340.1, 270.6, 1027.7, 697.5]}
|
||||||
|
{"n": 79, "t": 1795283533.815, "box": [341.5, 270.8, 1029.1, 697.8]}
|
||||||
|
{"n": 80, "t": 1795283533.953, "box": [341.6, 271.9, 1029.2, 698.1]}
|
||||||
|
{"n": 81, "t": 1795283534.139, "box": [341.4, 271.6, 1026.4, 696.9]}
|
||||||
|
{"n": 82, "t": 1795283534.353, "box": [342.0, 272.9, 1026.9, 697.4]}
|
||||||
|
{"n": 83, "t": 1795283534.594, "box": [341.0, 272.9, 1026.0, 697.3]}
|
||||||
|
{"n": 84, "t": 1795283534.78, "box": [339.6, 273.2, 1027.2, 697.7]}
|
||||||
|
{"n": 85, "t": 1795283535.022, "box": [342.2, 271.9, 1027.1, 698.1]}
|
||||||
|
{"n": 86, "t": 1795283535.161, "box": [343.0, 271.5, 1026.6, 698.5]}
|
||||||
|
{"n": 87, "t": 1795283535.419, "box": [342.1, 273.3, 1027.1, 697.7]}
|
||||||
|
{"n": 88, "t": 1795283535.575, "box": [342.1, 271.5, 1028.4, 698.5]}
|
||||||
|
{"n": 89, "t": 1795283535.821, "box": [341.4, 271.7, 1027.7, 698.6]}
|
||||||
|
{"n": 90, "t": 1795283535.978, "box": [341.8, 271.8, 1026.7, 698.0]}
|
||||||
|
{"n": 91, "t": 1795283536.196, "box": [344.0, 271.1, 1024.9, 698.9]}
|
||||||
|
{"n": 92, "t": 1795283536.294, "box": [343.3, 271.9, 1025.6, 698.9]}
|
||||||
|
{"n": 93, "t": 1795283536.615, "box": [341.2, 271.7, 1023.5, 697.8]}
|
||||||
|
{"n": 94, "t": 1795283536.778, "box": [342.7, 271.9, 1027.7, 698.1]}
|
||||||
|
{"n": 95, "t": 1795283536.992, "box": [340.9, 271.6, 1028.5, 697.7]}
|
||||||
|
{"n": 96, "t": 1795283537.174, "box": [340.0, 272.2, 1027.6, 697.5]}
|
||||||
|
{"n": 97, "t": 1795283537.415, "box": [340.7, 271.9, 1028.3, 698.1]}
|
||||||
|
{"n": 98, "t": 1795283537.632, "box": [342.2, 272.1, 1029.8, 697.4]}
|
||||||
|
{"n": 99, "t": 1795283537.815, "box": [343.1, 271.3, 1029.3, 697.4]}
|
||||||
|
{"n": 100, "t": 1795283537.981, "box": [342.0, 271.4, 1029.6, 697.5]}
|
||||||
|
{"n": 101, "t": 1795283538.123, "box": [340.9, 272.1, 1025.9, 696.6]}
|
||||||
|
{"n": 102, "t": 1795283538.367, "box": [341.3, 271.4, 1026.2, 696.7]}
|
||||||
|
{"n": 103, "t": 1795283538.631, "box": [339.7, 272.0, 1027.4, 697.3]}
|
||||||
|
{"n": 104, "t": 1795283538.832, "box": [340.9, 273.5, 1025.8, 697.1]}
|
||||||
|
{"n": 105, "t": 1795283539.017, "box": [339.0, 274.2, 1026.6, 697.0]}
|
||||||
|
{"n": 106, "t": 1795283539.174, "box": [342.5, 273.4, 1026.1, 697.0]}
|
||||||
|
{"n": 107, "t": 1795283539.417, "box": [341.8, 273.5, 1024.0, 696.3]}
|
||||||
|
{"n": 108, "t": 1795283539.553, "box": [340.3, 272.0, 1025.3, 697.3]}
|
||||||
|
{"n": 109, "t": 1795283539.794, "box": [339.9, 271.9, 1026.2, 697.2]}
|
||||||
|
{"n": 110, "t": 1795283539.974, "box": [340.5, 272.3, 1025.4, 697.6]}
|
||||||
|
{"n": 111, "t": 1795283540.214, "box": [340.2, 273.5, 1025.2, 696.3]}
|
||||||
|
{"n": 112, "t": 1795283540.377, "box": [342.6, 272.8, 1024.9, 697.3]}
|
||||||
|
{"n": 113, "t": 1795283540.615, "box": [340.5, 271.9, 1026.7, 698.1]}
|
||||||
|
{"n": 114, "t": 1795283540.752, "box": [342.0, 272.0, 1027.0, 698.1]}
|
||||||
|
{"n": 115, "t": 1795283541.001, "box": [340.8, 271.2, 1029.8, 697.3]}
|
||||||
|
{"n": 116, "t": 1795283541.181, "box": [339.5, 270.6, 1029.8, 698.4]}
|
||||||
|
{"n": 117, "t": 1795283541.422, "box": [341.0, 271.8, 1027.3, 697.9]}
|
||||||
|
{"n": 118, "t": 1795283541.563, "box": [341.0, 272.9, 1025.9, 698.2]}
|
||||||
|
{"n": 119, "t": 1795283541.801, "box": [340.8, 272.9, 1027.1, 698.2]}
|
||||||
|
{"n": 120, "t": 1795283541.991, "box": [340.9, 272.9, 1027.2, 697.3]}
|
||||||
|
{"n": 121, "t": 1795283542.192, "box": [342.2, 272.2, 1027.1, 697.5]}
|
||||||
|
{"n": 122, "t": 1795283542.433, "box": [342.0, 271.6, 1025.6, 697.7]}
|
||||||
|
{"n": 123, "t": 1795283542.616, "box": [340.9, 271.8, 1027.2, 697.1]}
|
||||||
|
{"n": 124, "t": 1795283542.775, "box": [340.6, 273.9, 1026.9, 697.5]}
|
||||||
|
{"n": 125, "t": 1795283542.915, "box": [340.5, 273.2, 1028.1, 697.6]}
|
||||||
|
{"n": 126, "t": 1795283543.174, "box": [340.5, 273.7, 1026.8, 697.3]}
|
||||||
|
{"n": 127, "t": 1795283543.415, "box": [340.6, 273.9, 1025.5, 697.5]}
|
||||||
|
{"n": 128, "t": 1795283543.553, "box": [339.8, 272.5, 1026.1, 697.8]}
|
||||||
|
{"n": 129, "t": 1795283543.793, "box": [341.5, 273.6, 1026.4, 697.2]}
|
||||||
|
{"n": 130, "t": 1795283543.974, "box": [340.3, 273.4, 1026.6, 697.9]}
|
||||||
|
{"n": 131, "t": 1795283544.215, "box": [341.7, 273.5, 1027.9, 698.0]}
|
||||||
|
{"n": 132, "t": 1795283544.352, "box": [340.8, 273.5, 1029.8, 698.0]}
|
||||||
|
{"n": 133, "t": 1795283544.616, "box": [343.7, 275.1, 1034.1, 698.7]}
|
||||||
|
{"n": 134, "t": 1795283544.778, "box": [342.5, 274.8, 1030.2, 699.3]}
|
||||||
|
{"n": 135, "t": 1795283545.018, "box": [343.1, 273.4, 1036.1, 698.7]}
|
||||||
|
{"n": 136, "t": 1795283545.232, "box": [342.4, 271.5, 1042.2, 697.6]}
|
||||||
|
{"n": 137, "t": 1795283545.419, "box": [341.9, 260.4, 1061.1, 700.9]}
|
||||||
|
{"n": 138, "t": 1795283545.577, "box": [340.7, 265.0, 1082.8, 708.1]}
|
||||||
|
{"n": 139, "t": 1795283545.815, "box": [354.3, 254.3, 1164.5, 712.4]}
|
||||||
|
{"n": 140, "t": 1795283545.977, "box": [359.0, 246.4, 1172.4, 709.9]}
|
||||||
|
{"n": 141, "t": 1795283546.132, "box": [365.9, 242.9, 1233.5, 722.0]}
|
||||||
|
{"n": 142, "t": 1795283546.355, "box": [367.7, 226.0, 1264.5, 722.3]}
|
||||||
|
{"n": 143, "t": 1795283546.615, "box": [363.2, 228.7, 1288.5, 715.3]}
|
||||||
|
{"n": 144, "t": 1795283546.777, "box": [382.2, 230.3, 1279.0, 715.1]}
|
||||||
|
{"n": 145, "t": 1795283546.994, "box": [463.2, 200.9, 1243.9, 720.9]}
|
||||||
|
{"n": 146, "t": 1795283547.233, "box": [517.2, 200.4, 1275.3, 719.4]}
|
||||||
|
{"n": 147, "t": 1795283547.416, "box": [380.6, 193.7, 1277.3, 712.1]}
|
||||||
|
{"n": 148, "t": 1795283547.578, "box": [788.2, 200.8, 1274.9, 710.8]}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{"n": 1, "t": 1795283669.481, "box": [605.8, 396.8, 1246.7, 714.1]}
|
||||||
|
{"n": 2, "t": 1795283669.73, "box": [434.8, 196.9, 1283.9, 709.9]}
|
||||||
|
{"n": 3, "t": 1795283669.9, "box": [404.9, 204.4, 1272.4, 711.4]}
|
||||||
|
{"n": 4, "t": 1795283670.16, "box": [336.4, 236.2, 1165.8, 672.4]}
|
||||||
|
{"n": 5, "t": 1795283670.283, "box": [317.5, 246.2, 933.9, 587.2]}
|
||||||
|
{"n": 6, "t": 1795283670.552, "box": [291.6, 273.5, 754.2, 557.3]}
|
||||||
|
{"n": 7, "t": 1795283670.713, "box": [272.9, 285.1, 637.4, 529.3]}
|
||||||
|
{"n": 8, "t": 1795283670.943, "box": [246.6, 296.4, 557.1, 494.6]}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
{"n": 1, "t": 1795283708.356, "box": [294.5, 286.6, 851.3, 648.6]}
|
||||||
|
{"n": 2, "t": 1795283708.49, "box": [297.7, 284.8, 846.0, 638.4]}
|
||||||
|
{"n": 3, "t": 1795283708.755, "box": [295.0, 273.2, 939.7, 690.2]}
|
||||||
|
{"n": 4, "t": 1795283709.002, "box": [298.9, 269.9, 957.6, 693.5]}
|
||||||
|
{"n": 5, "t": 1795283709.102, "box": [304.2, 261.7, 998.6, 698.8]}
|
||||||
|
{"n": 6, "t": 1795283709.404, "box": [310.2, 265.9, 1025.2, 706.5]}
|
||||||
|
{"n": 7, "t": 1795283709.561, "box": [317.9, 263.4, 1035.8, 705.6]}
|
||||||
|
{"n": 8, "t": 1795283709.802, "box": [318.0, 260.9, 1035.8, 707.4]}
|
||||||
|
{"n": 9, "t": 1795283709.961, "box": [316.7, 261.8, 1037.3, 705.8]}
|
||||||
|
{"n": 10, "t": 1795283710.185, "box": [316.6, 263.7, 1037.3, 705.9]}
|
||||||
|
{"n": 11, "t": 1795283710.381, "box": [317.4, 264.8, 1036.6, 707.0]}
|
||||||
|
{"n": 12, "t": 1795283710.442, "box": [316.8, 264.7, 1037.4, 706.9]}
|
||||||
|
{"n": 13, "t": 1795283710.762, "box": [316.9, 264.0, 1037.6, 706.2]}
|
||||||
|
{"n": 14, "t": 1795283710.987, "box": [317.7, 265.1, 1035.5, 706.5]}
|
||||||
|
{"n": 15, "t": 1795283711.161, "box": [319.1, 264.8, 1038.3, 707.0]}
|
||||||
|
{"n": 16, "t": 1795283711.402, "box": [318.0, 265.4, 1035.8, 707.7]}
|
||||||
|
{"n": 17, "t": 1795283711.561, "box": [318.1, 263.1, 1037.3, 707.1]}
|
||||||
|
{"n": 18, "t": 1795283711.803, "box": [315.7, 261.7, 1039.1, 707.4]}
|
||||||
|
{"n": 19, "t": 1795283711.963, "box": [317.7, 262.1, 1038.3, 706.9]}
|
||||||
|
{"n": 20, "t": 1795283712.202, "box": [316.5, 262.9, 1035.8, 707.8]}
|
||||||
|
{"n": 21, "t": 1795283712.281, "box": [317.4, 265.3, 1039.4, 707.5]}
|
||||||
|
{"n": 22, "t": 1795283712.534, "box": [316.3, 262.2, 1036.9, 707.1]}
|
||||||
|
{"n": 23, "t": 1795283712.774, "box": [316.0, 263.0, 1038.1, 707.0]}
|
||||||
|
{"n": 24, "t": 1795283712.915, "box": [318.0, 264.0, 1037.2, 707.1]}
|
||||||
|
{"n": 25, "t": 1795283713.156, "box": [317.6, 265.3, 1041.0, 707.5]}
|
||||||
|
{"n": 26, "t": 1795283713.393, "box": [318.0, 264.4, 1038.6, 708.4]}
|
||||||
|
{"n": 27, "t": 1795283713.58, "box": [318.3, 264.7, 1037.5, 707.7]}
|
||||||
|
{"n": 28, "t": 1795283713.715, "box": [316.7, 263.6, 1037.4, 707.6]}
|
||||||
|
{"n": 29, "t": 1795283713.977, "box": [315.9, 264.1, 1036.6, 708.9]}
|
||||||
|
{"n": 30, "t": 1795283714.137, "box": [317.1, 264.1, 1036.3, 708.0]}
|
||||||
|
{"n": 31, "t": 1795283714.378, "box": [319.8, 265.8, 1034.8, 708.9]}
|
||||||
|
{"n": 32, "t": 1795283714.433, "box": [316.8, 263.0, 1037.4, 709.6]}
|
||||||
|
{"n": 33, "t": 1795283714.773, "box": [315.4, 263.4, 1038.8, 708.2]}
|
||||||
|
{"n": 34, "t": 1795283714.934, "box": [315.6, 264.5, 1036.2, 708.4]}
|
||||||
|
{"n": 35, "t": 1795283715.174, "box": [314.2, 262.6, 1039.0, 708.3]}
|
||||||
|
{"n": 36, "t": 1795283715.315, "box": [316.4, 262.4, 1037.0, 707.3]}
|
||||||
|
{"n": 37, "t": 1795283715.556, "box": [313.3, 262.0, 1017.3, 701.6]}
|
||||||
|
{"n": 38, "t": 1795283715.792, "box": [305.6, 263.0, 989.2, 698.4]}
|
||||||
|
{"n": 39, "t": 1795283715.973, "box": [300.6, 263.4, 960.6, 695.4]}
|
||||||
|
{"n": 40, "t": 1795283716.135, "box": [300.4, 273.2, 947.6, 695.2]}
|
||||||
|
{"n": 41, "t": 1795283716.373, "box": [293.4, 282.3, 917.1, 676.4]}
|
||||||
|
{"n": 42, "t": 1795283716.515, "box": [291.6, 287.7, 846.2, 666.0]}
|
||||||
|
{"n": 43, "t": 1795283716.794, "box": [282.5, 290.2, 782.6, 623.7]}
|
||||||
|
{"n": 44, "t": 1795283716.991, "box": [271.5, 293.5, 617.6, 563.3]}
|
||||||
|
{"n": 45, "t": 1795283717.177, "box": [270.2, 302.7, 578.0, 532.6]}
|
||||||
|
{"n": 46, "t": 1795283717.315, "box": [258.9, 305.9, 544.4, 521.6]}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
{"n": 1, "t": 1795283781.818, "box": [359.0, 282.7, 943.8, 625.1]}
|
||||||
|
{"n": 2, "t": 1795283782.038, "box": [357.5, 286.3, 952.6, 631.7]}
|
||||||
|
{"n": 3, "t": 1795283782.192, "box": [366.9, 277.4, 988.2, 644.0]}
|
||||||
|
{"n": 4, "t": 1795283782.373, "box": [371.9, 276.0, 1014.1, 655.0]}
|
||||||
|
{"n": 5, "t": 1795283782.615, "box": [380.6, 277.4, 1047.1, 666.2]}
|
||||||
|
{"n": 6, "t": 1795283782.862, "box": [389.6, 268.1, 1090.8, 675.5]}
|
||||||
|
{"n": 7, "t": 1795283782.992, "box": [397.1, 267.7, 1109.3, 693.0]}
|
||||||
|
{"n": 8, "t": 1795283783.237, "box": [393.7, 271.4, 1151.8, 695.0]}
|
||||||
|
{"n": 9, "t": 1795283783.403, "box": [434.1, 268.8, 1157.6, 705.1]}
|
||||||
|
{"n": 10, "t": 1795283783.648, "box": [440.4, 267.0, 1195.6, 717.0]}
|
||||||
|
{"n": 11, "t": 1795283783.804, "box": [449.0, 266.3, 1217.6, 719.0]}
|
||||||
|
{"n": 12, "t": 1795283784.049, "box": [413.4, 265.9, 1252.7, 707.2]}
|
||||||
|
{"n": 13, "t": 1795283784.142, "box": [415.9, 264.2, 1258.4, 709.9]}
|
||||||
|
{"n": 14, "t": 1795283784.465, "box": [421.8, 251.6, 1282.6, 715.0]}
|
||||||
|
{"n": 15, "t": 1795283784.604, "box": [424.8, 237.4, 1282.2, 710.9]}
|
||||||
|
{"n": 16, "t": 1795283784.866, "box": [428.8, 238.4, 1271.3, 704.6]}
|
||||||
|
{"n": 17, "t": 1795283785.024, "box": [446.7, 237.7, 1260.1, 715.8]}
|
||||||
|
{"n": 18, "t": 1795283785.265, "box": [453.9, 240.4, 1260.9, 712.1]}
|
||||||
|
{"n": 19, "t": 1795283785.342, "box": [455.6, 236.6, 1275.3, 709.2]}
|
||||||
|
{"n": 20, "t": 1795283785.654, "box": [457.6, 232.9, 1285.4, 715.7]}
|
||||||
|
{"n": 21, "t": 1795283785.804, "box": [459.0, 231.3, 1278.8, 718.9]}
|
||||||
|
{"n": 22, "t": 1795283786.027, "box": [459.6, 230.6, 1266.7, 727.8]}
|
||||||
|
{"n": 23, "t": 1795283786.125, "box": [459.6, 229.7, 1266.6, 726.9]}
|
||||||
|
{"n": 24, "t": 1795283786.46, "box": [457.2, 232.5, 1270.5, 729.8]}
|
||||||
|
{"n": 25, "t": 1795283786.644, "box": [458.0, 235.0, 1268.2, 729.3]}
|
||||||
|
{"n": 26, "t": 1795283786.863, "box": [459.0, 233.4, 1266.1, 729.7]}
|
||||||
|
{"n": 27, "t": 1795283787.033, "box": [458.2, 231.7, 1268.4, 731.8]}
|
||||||
|
{"n": 28, "t": 1795283787.099, "box": [459.5, 232.0, 1266.5, 732.2]}
|
||||||
|
{"n": 29, "t": 1795283787.465, "box": [460.6, 231.6, 1266.1, 731.7]}
|
||||||
|
{"n": 30, "t": 1795283787.662, "box": [467.2, 238.8, 1266.4, 718.9]}
|
||||||
|
{"n": 31, "t": 1795283787.745, "box": [466.0, 238.6, 1266.8, 718.6]}
|
||||||
|
{"n": 32, "t": 1795283788.043, "box": [466.0, 228.6, 1260.6, 731.6]}
|
||||||
|
{"n": 33, "t": 1795283788.144, "box": [467.8, 239.3, 1265.5, 718.4]}
|
||||||
|
{"n": 34, "t": 1795283788.443, "box": [459.8, 229.6, 1263.7, 731.7]}
|
||||||
|
{"n": 35, "t": 1795283788.627, "box": [467.3, 238.1, 1264.9, 716.3]}
|
||||||
|
{"n": 36, "t": 1795283788.859, "box": [464.6, 234.2, 1271.6, 719.0]}
|
||||||
|
{"n": 37, "t": 1795283788.999, "box": [463.6, 229.2, 1264.4, 727.4]}
|
||||||
|
{"n": 38, "t": 1795283789.258, "box": [462.1, 227.4, 1277.1, 717.9]}
|
||||||
|
{"n": 39, "t": 1795283789.415, "box": [454.6, 227.7, 1269.5, 709.6]}
|
||||||
|
{"n": 40, "t": 1795283789.577, "box": [448.7, 230.6, 1265.3, 714.4]}
|
||||||
|
{"n": 41, "t": 1795283789.797, "box": [427.0, 228.5, 1262.9, 717.0]}
|
||||||
|
{"n": 42, "t": 1795283790.034, "box": [408.4, 242.6, 1274.2, 713.4]}
|
||||||
|
{"n": 43, "t": 1795283790.215, "box": [415.8, 249.9, 1245.2, 706.2]}
|
||||||
|
{"n": 44, "t": 1795283790.458, "box": [446.3, 246.7, 1188.4, 715.6]}
|
||||||
|
{"n": 45, "t": 1795283790.616, "box": [381.6, 216.5, 1204.6, 695.6]}
|
||||||
|
{"n": 46, "t": 1795283790.858, "box": [371.7, 271.6, 1102.2, 677.4]}
|
||||||
|
{"n": 47, "t": 1795283790.997, "box": [357.9, 277.6, 1070.1, 675.6]}
|
||||||
|
{"n": 48, "t": 1795283791.272, "box": [349.1, 287.6, 888.9, 599.7]}
|
||||||
|
{"n": 49, "t": 1795283791.419, "box": [329.7, 295.4, 853.8, 591.1]}
|
||||||
|
{"n": 50, "t": 1795283791.658, "box": [316.1, 295.1, 800.8, 558.9]}
|
||||||
|
{"n": 51, "t": 1795283791.836, "box": [307.7, 303.5, 738.0, 538.4]}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
{"n": 1, "t": 1795283886.541, "box": [337.3, 283.4, 947.6, 631.2]}
|
||||||
|
{"n": 2, "t": 1795283886.75, "box": [344.2, 281.7, 939.3, 631.6]}
|
||||||
|
{"n": 3, "t": 1795283886.923, "box": [344.1, 279.2, 985.0, 647.2]}
|
||||||
|
{"n": 4, "t": 1795283887.001, "box": [349.4, 277.1, 1003.0, 656.9]}
|
||||||
|
{"n": 5, "t": 1795283887.343, "box": [359.7, 268.5, 1048.7, 682.3]}
|
||||||
|
{"n": 6, "t": 1795283887.402, "box": [360.9, 270.5, 1058.0, 689.2]}
|
||||||
|
{"n": 7, "t": 1795283887.742, "box": [371.4, 267.5, 1063.1, 688.7]}
|
||||||
|
{"n": 8, "t": 1795283887.956, "box": [372.1, 266.5, 1062.4, 689.3]}
|
||||||
|
{"n": 9, "t": 1795283888.134, "box": [372.8, 267.7, 1061.7, 688.8]}
|
||||||
|
{"n": 10, "t": 1795283888.316, "box": [371.3, 269.4, 1061.6, 688.9]}
|
||||||
|
{"n": 11, "t": 1795283888.513, "box": [375.1, 268.2, 1060.0, 688.5]}
|
||||||
|
{"n": 12, "t": 1795283888.758, "box": [372.7, 268.3, 1061.6, 688.7]}
|
||||||
|
{"n": 13, "t": 1795283888.935, "box": [372.4, 269.5, 1060.0, 688.2]}
|
||||||
|
{"n": 14, "t": 1795283889.099, "box": [372.3, 269.7, 1065.3, 688.4]}
|
||||||
|
{"n": 15, "t": 1795283889.234, "box": [371.4, 268.5, 1064.4, 688.8]}
|
||||||
|
{"n": 16, "t": 1795283889.499, "box": [373.4, 269.9, 1063.8, 688.6]}
|
||||||
|
{"n": 17, "t": 1795283889.739, "box": [373.2, 268.7, 1060.8, 689.0]}
|
||||||
|
{"n": 18, "t": 1795283889.873, "box": [371.1, 269.9, 1060.1, 688.6]}
|
||||||
|
{"n": 19, "t": 1795283890.118, "box": [371.9, 269.1, 1059.5, 688.6]}
|
||||||
|
{"n": 20, "t": 1795283890.298, "box": [371.2, 268.0, 1060.2, 690.0]}
|
||||||
|
{"n": 21, "t": 1795283890.542, "box": [371.1, 269.3, 1058.7, 688.8]}
|
||||||
|
{"n": 22, "t": 1795283890.682, "box": [370.4, 269.5, 1060.7, 689.0]}
|
||||||
|
{"n": 23, "t": 1795283890.942, "box": [371.6, 268.2, 1060.6, 690.2]}
|
||||||
|
{"n": 24, "t": 1795283891.085, "box": [374.1, 267.7, 1059.0, 689.7]}
|
||||||
|
{"n": 25, "t": 1795283891.265, "box": [371.6, 268.1, 1060.6, 689.2]}
|
||||||
|
{"n": 26, "t": 1795283891.422, "box": [371.8, 268.3, 1062.1, 689.5]}
|
||||||
|
{"n": 27, "t": 1795283891.722, "box": [373.0, 268.0, 1060.7, 690.0]}
|
||||||
|
{"n": 28, "t": 1795283891.962, "box": [373.4, 267.9, 1061.0, 689.1]}
|
||||||
|
{"n": 29, "t": 1795283892.124, "box": [372.8, 268.8, 1061.8, 688.3]}
|
||||||
|
{"n": 30, "t": 1795283892.306, "box": [372.8, 268.6, 1059.1, 688.1]}
|
||||||
|
{"n": 31, "t": 1795283892.543, "box": [372.9, 268.3, 1059.2, 688.6]}
|
||||||
|
{"n": 32, "t": 1795283892.682, "box": [372.2, 267.3, 1059.8, 689.3]}
|
||||||
|
{"n": 33, "t": 1795283892.922, "box": [373.2, 269.1, 1060.8, 689.4]}
|
||||||
|
{"n": 34, "t": 1795283893.162, "box": [371.5, 268.2, 1061.8, 688.5]}
|
||||||
|
{"n": 35, "t": 1795283893.323, "box": [372.4, 266.7, 1060.1, 689.5]}
|
||||||
|
{"n": 36, "t": 1795283893.502, "box": [373.3, 268.7, 1058.3, 689.0]}
|
||||||
|
{"n": 37, "t": 1795283893.732, "box": [372.2, 267.1, 1059.8, 689.9]}
|
||||||
|
{"n": 38, "t": 1795283893.883, "box": [372.5, 268.6, 1058.8, 688.9]}
|
||||||
|
{"n": 39, "t": 1795283894.122, "box": [372.2, 267.3, 1059.8, 689.3]}
|
||||||
|
{"n": 40, "t": 1795283894.362, "box": [372.2, 267.1, 1061.2, 689.1]}
|
||||||
|
{"n": 41, "t": 1795283894.542, "box": [372.2, 267.1, 1061.1, 689.1]}
|
||||||
|
{"n": 42, "t": 1795283894.764, "box": [371.9, 269.6, 1062.2, 689.1]}
|
||||||
|
{"n": 43, "t": 1795283894.943, "box": [372.5, 269.1, 1061.5, 688.6]}
|
||||||
|
{"n": 44, "t": 1795283895.083, "box": [371.5, 267.7, 1061.8, 688.9]}
|
||||||
|
{"n": 45, "t": 1795283895.322, "box": [371.7, 267.9, 1060.7, 689.9]}
|
||||||
|
{"n": 46, "t": 1795283895.563, "box": [369.9, 268.7, 1060.3, 689.9]}
|
||||||
|
{"n": 47, "t": 1795283895.724, "box": [373.0, 268.7, 1059.2, 689.1]}
|
||||||
|
{"n": 48, "t": 1795283895.964, "box": [371.3, 268.6, 1060.2, 688.9]}
|
||||||
|
{"n": 49, "t": 1795283896.123, "box": [371.9, 268.2, 1060.9, 689.4]}
|
||||||
|
{"n": 50, "t": 1795283896.362, "box": [371.0, 269.2, 1061.4, 689.5]}
|
||||||
|
{"n": 51, "t": 1795283896.562, "box": [371.7, 268.4, 1060.6, 688.8]}
|
||||||
|
{"n": 52, "t": 1795283896.683, "box": [372.6, 267.9, 1060.2, 689.1]}
|
||||||
|
{"n": 53, "t": 1795283896.924, "box": [373.2, 267.9, 1058.1, 689.9]}
|
||||||
|
{"n": 54, "t": 1795283897.112, "box": [372.7, 267.3, 1059.0, 690.9]}
|
||||||
|
{"n": 55, "t": 1795283897.314, "box": [372.6, 267.8, 1057.5, 690.6]}
|
||||||
|
{"n": 56, "t": 1795283897.557, "box": [370.7, 268.7, 1061.0, 689.9]}
|
||||||
|
{"n": 57, "t": 1795283897.734, "box": [371.2, 270.0, 1064.2, 690.4]}
|
||||||
|
{"n": 58, "t": 1795283897.898, "box": [370.6, 268.3, 1062.2, 690.3]}
|
||||||
|
{"n": 59, "t": 1795283898.156, "box": [371.5, 268.8, 1060.4, 689.1]}
|
||||||
|
{"n": 60, "t": 1795283898.216, "box": [370.4, 267.1, 1059.4, 689.9]}
|
||||||
|
{"n": 61, "t": 1795283898.514, "box": [371.5, 268.1, 1060.5, 688.4]}
|
||||||
|
{"n": 62, "t": 1795283898.699, "box": [371.8, 268.0, 1059.4, 689.1]}
|
||||||
|
{"n": 63, "t": 1795283898.94, "box": [371.0, 266.2, 1061.3, 689.8]}
|
||||||
|
{"n": 64, "t": 1795283899.078, "box": [372.3, 266.4, 1057.2, 690.0]}
|
||||||
|
{"n": 65, "t": 1795283899.339, "box": [370.3, 268.4, 1060.6, 688.7]}
|
||||||
|
{"n": 66, "t": 1795283899.473, "box": [370.4, 267.7, 1060.7, 689.7]}
|
||||||
|
{"n": 67, "t": 1795283899.717, "box": [372.4, 267.9, 1062.7, 689.9]}
|
||||||
|
{"n": 68, "t": 1795283899.957, "box": [372.1, 268.0, 1059.7, 689.1]}
|
||||||
|
{"n": 69, "t": 1795283900.137, "box": [371.1, 268.3, 1062.8, 690.3]}
|
||||||
|
{"n": 70, "t": 1795283900.312, "box": [372.0, 268.6, 1060.9, 690.5]}
|
||||||
|
{"n": 71, "t": 1795283900.513, "box": [370.6, 267.5, 1060.9, 690.3]}
|
||||||
|
{"n": 72, "t": 1795283900.712, "box": [371.3, 267.9, 1058.9, 689.9]}
|
||||||
|
{"n": 73, "t": 1795283900.937, "box": [372.2, 268.2, 1058.5, 689.4]}
|
||||||
|
{"n": 74, "t": 1795283901.174, "box": [373.8, 268.4, 1057.4, 689.6]}
|
||||||
|
{"n": 75, "t": 1795283901.234, "box": [371.1, 268.2, 1061.4, 688.5]}
|
||||||
|
{"n": 76, "t": 1795283901.573, "box": [372.1, 267.6, 1059.7, 690.4]}
|
||||||
|
{"n": 77, "t": 1795283901.735, "box": [372.7, 267.4, 1057.6, 689.4]}
|
||||||
|
{"n": 78, "t": 1795283901.874, "box": [372.3, 265.9, 1059.9, 689.5]}
|
||||||
|
{"n": 79, "t": 1795283902.114, "box": [372.4, 266.4, 1058.7, 690.1]}
|
||||||
|
{"n": 80, "t": 1795283902.296, "box": [371.3, 267.7, 1059.0, 689.7]}
|
||||||
|
{"n": 81, "t": 1795283902.539, "box": [371.8, 269.4, 1059.4, 689.7]}
|
||||||
|
{"n": 82, "t": 1795283902.674, "box": [371.9, 268.4, 1058.2, 688.7]}
|
||||||
|
{"n": 83, "t": 1795283902.935, "box": [371.9, 269.1, 1059.5, 689.4]}
|
||||||
|
{"n": 84, "t": 1795283903.099, "box": [372.1, 265.7, 1057.1, 689.4]}
|
||||||
|
{"n": 85, "t": 1795283903.335, "box": [372.0, 267.7, 1058.3, 688.9]}
|
||||||
|
{"n": 86, "t": 1795283903.564, "box": [373.1, 265.7, 1060.7, 689.3]}
|
||||||
|
{"n": 87, "t": 1795283903.733, "box": [371.7, 270.1, 1060.7, 688.8]}
|
||||||
|
{"n": 88, "t": 1795283903.957, "box": [372.9, 268.1, 1059.1, 689.3]}
|
||||||
|
{"n": 89, "t": 1795283904.136, "box": [371.9, 266.5, 1058.1, 689.3]}
|
||||||
|
{"n": 90, "t": 1795283904.298, "box": [372.4, 267.4, 1058.7, 689.4]}
|
||||||
|
{"n": 91, "t": 1795283904.462, "box": [373.4, 267.0, 1059.7, 689.8]}
|
||||||
|
{"n": 92, "t": 1795283904.775, "box": [372.5, 268.5, 1060.1, 689.6]}
|
||||||
|
{"n": 93, "t": 1795283904.935, "box": [371.5, 268.9, 1059.1, 690.0]}
|
||||||
|
{"n": 94, "t": 1795283905.175, "box": [372.0, 268.4, 1057.0, 688.8]}
|
||||||
|
{"n": 95, "t": 1795283905.314, "box": [371.3, 270.0, 1058.9, 688.7]}
|
||||||
|
{"n": 96, "t": 1795283905.576, "box": [370.9, 269.7, 1058.5, 689.3]}
|
||||||
|
{"n": 97, "t": 1795283905.738, "box": [371.6, 268.0, 1059.2, 689.1]}
|
||||||
|
{"n": 98, "t": 1795283905.979, "box": [372.4, 267.5, 1058.7, 689.5]}
|
||||||
|
{"n": 99, "t": 1795283906.136, "box": [373.0, 267.5, 1060.6, 690.3]}
|
||||||
|
{"n": 100, "t": 1795283906.336, "box": [372.8, 267.8, 1060.4, 690.6]}
|
||||||
|
{"n": 101, "t": 1795283906.513, "box": [371.6, 267.5, 1060.5, 689.5]}
|
||||||
|
{"n": 102, "t": 1795283906.758, "box": [371.4, 267.7, 1059.0, 688.8]}
|
||||||
|
{"n": 103, "t": 1795283906.937, "box": [372.4, 267.9, 1058.7, 689.0]}
|
||||||
|
{"n": 104, "t": 1795283907.173, "box": [373.1, 268.5, 1060.7, 689.7]}
|
||||||
|
{"n": 105, "t": 1795283907.335, "box": [372.2, 266.4, 1062.5, 690.9]}
|
||||||
|
{"n": 106, "t": 1795283907.578, "box": [371.5, 268.6, 1063.2, 690.6]}
|
||||||
|
{"n": 107, "t": 1795283907.734, "box": [374.0, 269.2, 1060.3, 689.5]}
|
||||||
|
{"n": 108, "t": 1795283907.975, "box": [373.5, 267.9, 1058.5, 689.9]}
|
||||||
|
{"n": 109, "t": 1795283908.135, "box": [372.7, 267.3, 1058.9, 689.3]}
|
||||||
|
{"n": 110, "t": 1795283908.299, "box": [374.0, 267.7, 1059.0, 690.5]}
|
||||||
|
{"n": 111, "t": 1795283908.538, "box": [372.9, 270.1, 1059.1, 689.7]}
|
||||||
|
{"n": 112, "t": 1795283908.776, "box": [371.8, 267.0, 1059.4, 689.8]}
|
||||||
|
{"n": 113, "t": 1795283908.939, "box": [370.9, 266.7, 1059.8, 690.3]}
|
||||||
|
{"n": 114, "t": 1795283909.164, "box": [371.0, 268.3, 1061.3, 691.1]}
|
||||||
|
{"n": 115, "t": 1795283909.343, "box": [369.7, 267.3, 1060.0, 689.2]}
|
||||||
|
{"n": 116, "t": 1795283909.583, "box": [370.0, 266.8, 1060.3, 688.8]}
|
||||||
|
{"n": 117, "t": 1795283909.722, "box": [370.8, 268.3, 1061.1, 689.5]}
|
||||||
|
{"n": 118, "t": 1795283909.964, "box": [373.2, 266.1, 1058.1, 690.5]}
|
||||||
|
{"n": 119, "t": 1795283910.155, "box": [370.6, 267.0, 1058.2, 690.6]}
|
||||||
|
{"n": 120, "t": 1795283910.357, "box": [371.9, 268.2, 1059.6, 690.1]}
|
||||||
|
{"n": 121, "t": 1795283910.533, "box": [370.7, 267.4, 1059.6, 689.4]}
|
||||||
|
{"n": 122, "t": 1795283910.775, "box": [371.6, 265.9, 1060.6, 689.5]}
|
||||||
|
{"n": 123, "t": 1795283910.935, "box": [370.9, 266.8, 1061.2, 689.6]}
|
||||||
|
{"n": 124, "t": 1795283911.112, "box": [371.8, 268.3, 1058.1, 690.3]}
|
||||||
|
{"n": 125, "t": 1795283911.335, "box": [370.5, 267.3, 1058.2, 690.1]}
|
||||||
|
{"n": 126, "t": 1795283911.576, "box": [371.9, 268.2, 1056.8, 690.2]}
|
||||||
|
{"n": 127, "t": 1795283911.714, "box": [372.3, 268.2, 1057.3, 691.0]}
|
||||||
|
{"n": 128, "t": 1795283911.956, "box": [372.8, 268.5, 1059.1, 690.5]}
|
||||||
|
{"n": 129, "t": 1795283912.138, "box": [372.1, 267.7, 1057.1, 689.7]}
|
||||||
|
{"n": 130, "t": 1795283912.379, "box": [371.2, 268.7, 1061.5, 689.1]}
|
||||||
|
{"n": 131, "t": 1795283912.517, "box": [371.5, 267.0, 1060.5, 690.7]}
|
||||||
|
{"n": 132, "t": 1795283912.757, "box": [372.0, 267.6, 1061.0, 688.7]}
|
||||||
|
{"n": 133, "t": 1795283912.936, "box": [372.4, 267.2, 1060.1, 689.2]}
|
||||||
|
{"n": 134, "t": 1795283913.175, "box": [372.5, 268.0, 1060.1, 690.8]}
|
||||||
|
{"n": 135, "t": 1795283913.313, "box": [371.6, 269.3, 1061.9, 690.4]}
|
||||||
|
{"n": 136, "t": 1795283913.557, "box": [371.6, 270.6, 1062.0, 689.3]}
|
||||||
|
{"n": 137, "t": 1795283913.734, "box": [372.0, 267.3, 1059.6, 690.1]}
|
||||||
|
{"n": 138, "t": 1795283913.977, "box": [371.3, 269.3, 1061.6, 690.5]}
|
||||||
|
{"n": 139, "t": 1795283914.135, "box": [373.1, 267.9, 1056.7, 689.1]}
|
||||||
|
{"n": 140, "t": 1795283914.379, "box": [371.3, 267.5, 1057.6, 690.3]}
|
||||||
|
{"n": 141, "t": 1795283914.513, "box": [371.9, 268.1, 1058.1, 690.9]}
|
||||||
|
{"n": 142, "t": 1795283914.773, "box": [373.6, 268.4, 1058.6, 689.6]}
|
||||||
|
{"n": 143, "t": 1795283914.939, "box": [371.7, 266.1, 1059.4, 690.5]}
|
||||||
|
{"n": 144, "t": 1795283915.175, "box": [369.7, 268.8, 1060.1, 690.0]}
|
||||||
|
{"n": 145, "t": 1795283915.314, "box": [369.6, 268.0, 1057.2, 690.8]}
|
||||||
|
{"n": 146, "t": 1795283915.557, "box": [371.3, 269.8, 1057.5, 690.2]}
|
||||||
|
{"n": 147, "t": 1795283915.734, "box": [372.4, 269.5, 1058.7, 689.8]}
|
||||||
|
{"n": 148, "t": 1795283915.979, "box": [372.9, 268.8, 1057.9, 689.1]}
|
||||||
|
{"n": 149, "t": 1795283916.136, "box": [372.8, 269.4, 1057.7, 689.7]}
|
||||||
|
{"n": 150, "t": 1795283916.375, "box": [373.6, 268.3, 1058.5, 690.3]}
|
||||||
|
{"n": 151, "t": 1795283916.514, "box": [371.7, 267.7, 1059.4, 688.9]}
|
||||||
|
{"n": 152, "t": 1795283916.757, "box": [370.7, 269.3, 1061.0, 689.7]}
|
||||||
|
{"n": 153, "t": 1795283916.937, "box": [370.4, 267.5, 1059.3, 689.5]}
|
||||||
|
{"n": 154, "t": 1795283917.174, "box": [371.8, 267.1, 1063.5, 689.1]}
|
||||||
|
{"n": 155, "t": 1795283917.335, "box": [371.6, 269.0, 1060.5, 690.1]}
|
||||||
|
{"n": 156, "t": 1795283917.575, "box": [371.0, 268.2, 1059.9, 691.0]}
|
||||||
|
{"n": 157, "t": 1795283917.714, "box": [372.2, 268.3, 1059.8, 690.2]}
|
||||||
|
{"n": 158, "t": 1795283917.957, "box": [371.9, 266.8, 1059.6, 689.6]}
|
||||||
|
{"n": 159, "t": 1795283918.141, "box": [373.4, 267.0, 1059.7, 689.8]}
|
||||||
|
{"n": 160, "t": 1795283918.373, "box": [372.8, 267.2, 1060.5, 689.2]}
|
||||||
|
{"n": 161, "t": 1795283918.539, "box": [371.5, 267.3, 1061.8, 690.1]}
|
||||||
|
{"n": 162, "t": 1795283918.779, "box": [373.9, 267.3, 1060.1, 690.1]}
|
||||||
|
{"n": 163, "t": 1795283918.918, "box": [371.5, 266.1, 1061.8, 689.7]}
|
||||||
|
{"n": 164, "t": 1795283919.157, "box": [370.9, 268.1, 1061.2, 689.3]}
|
||||||
|
{"n": 165, "t": 1795283919.333, "box": [372.1, 268.8, 1058.4, 689.9]}
|
||||||
|
{"n": 166, "t": 1795283919.573, "box": [373.3, 268.3, 1058.2, 689.5]}
|
||||||
|
{"n": 167, "t": 1795283919.735, "box": [372.9, 267.0, 1060.6, 688.9]}
|
||||||
|
{"n": 168, "t": 1795283919.978, "box": [371.5, 266.8, 1060.5, 690.5]}
|
||||||
@@ -0,0 +1,234 @@
|
|||||||
|
{"n": 1, "t": 1795283922.706, "box": [371.1, 268.4, 1057.3, 688.8]}
|
||||||
|
{"n": 2, "t": 1795283922.739, "box": [370.8, 267.1, 1061.1, 689.9]}
|
||||||
|
{"n": 3, "t": 1795283922.802, "box": [372.7, 269.9, 1060.3, 689.4]}
|
||||||
|
{"n": 4, "t": 1795283923.083, "box": [370.5, 269.5, 1060.9, 689.8]}
|
||||||
|
{"n": 5, "t": 1795283923.331, "box": [371.8, 269.3, 1059.4, 691.3]}
|
||||||
|
{"n": 6, "t": 1795283923.504, "box": [370.0, 268.7, 1060.3, 689.8]}
|
||||||
|
{"n": 7, "t": 1795283923.731, "box": [369.5, 268.2, 1058.5, 690.2]}
|
||||||
|
{"n": 8, "t": 1795283923.903, "box": [369.5, 267.8, 1057.2, 689.8]}
|
||||||
|
{"n": 9, "t": 1795283924.128, "box": [371.0, 268.0, 1061.3, 690.0]}
|
||||||
|
{"n": 10, "t": 1795283924.323, "box": [370.5, 268.4, 1059.4, 690.4]}
|
||||||
|
{"n": 11, "t": 1795283924.528, "box": [371.1, 269.0, 1061.5, 689.3]}
|
||||||
|
{"n": 12, "t": 1795283924.683, "box": [371.6, 268.6, 1062.0, 690.6]}
|
||||||
|
{"n": 13, "t": 1795283924.763, "box": [371.6, 269.0, 1061.9, 690.1]}
|
||||||
|
{"n": 14, "t": 1795283925.083, "box": [370.1, 268.8, 1060.4, 690.8]}
|
||||||
|
{"n": 15, "t": 1795283925.307, "box": [370.2, 266.9, 1060.5, 690.5]}
|
||||||
|
{"n": 16, "t": 1795283925.483, "box": [371.1, 266.6, 1058.7, 691.1]}
|
||||||
|
{"n": 17, "t": 1795283925.729, "box": [370.9, 266.0, 1061.3, 690.5]}
|
||||||
|
{"n": 18, "t": 1795283925.903, "box": [372.4, 267.1, 1057.3, 689.9]}
|
||||||
|
{"n": 19, "t": 1795283926.111, "box": [374.7, 266.9, 1058.3, 690.5]}
|
||||||
|
{"n": 20, "t": 1795283926.283, "box": [372.4, 267.8, 1060.1, 689.7]}
|
||||||
|
{"n": 21, "t": 1795283926.506, "box": [372.4, 267.5, 1060.0, 690.3]}
|
||||||
|
{"n": 22, "t": 1795283926.683, "box": [370.7, 265.6, 1061.0, 690.0]}
|
||||||
|
{"n": 23, "t": 1795283926.782, "box": [371.8, 266.4, 1059.5, 690.9]}
|
||||||
|
{"n": 24, "t": 1795283927.084, "box": [372.0, 264.7, 1059.6, 690.8]}
|
||||||
|
{"n": 25, "t": 1795283927.306, "box": [372.6, 266.5, 1058.9, 690.2]}
|
||||||
|
{"n": 26, "t": 1795283927.504, "box": [371.2, 266.5, 1060.2, 690.1]}
|
||||||
|
{"n": 27, "t": 1795283927.737, "box": [370.4, 266.4, 1060.7, 690.0]}
|
||||||
|
{"n": 28, "t": 1795283927.902, "box": [371.6, 267.8, 1060.5, 689.0]}
|
||||||
|
{"n": 29, "t": 1795283927.964, "box": [371.2, 267.2, 1061.5, 690.0]}
|
||||||
|
{"n": 30, "t": 1795283928.283, "box": [371.8, 268.3, 1059.4, 689.5]}
|
||||||
|
{"n": 31, "t": 1795283928.383, "box": [371.4, 267.9, 1060.3, 689.8]}
|
||||||
|
{"n": 32, "t": 1795283928.703, "box": [373.5, 268.5, 1059.8, 689.7]}
|
||||||
|
{"n": 33, "t": 1795283928.923, "box": [372.6, 268.4, 1060.2, 689.6]}
|
||||||
|
{"n": 34, "t": 1795283929.083, "box": [372.7, 268.1, 1060.3, 689.2]}
|
||||||
|
{"n": 35, "t": 1795283929.326, "box": [372.2, 270.2, 1061.1, 689.7]}
|
||||||
|
{"n": 36, "t": 1795283929.504, "box": [371.6, 268.9, 1061.9, 689.2]}
|
||||||
|
{"n": 37, "t": 1795283929.706, "box": [371.6, 268.3, 1059.2, 689.4]}
|
||||||
|
{"n": 38, "t": 1795283929.883, "box": [372.4, 265.9, 1060.0, 689.5]}
|
||||||
|
{"n": 39, "t": 1795283930.123, "box": [371.2, 267.0, 1058.9, 689.8]}
|
||||||
|
{"n": 40, "t": 1795283930.208, "box": [372.2, 266.9, 1059.8, 688.9]}
|
||||||
|
{"n": 41, "t": 1795283930.509, "box": [372.2, 267.2, 1062.5, 689.2]}
|
||||||
|
{"n": 42, "t": 1795283930.685, "box": [372.5, 268.4, 1058.8, 689.5]}
|
||||||
|
{"n": 43, "t": 1795283930.763, "box": [372.9, 269.9, 1060.5, 689.4]}
|
||||||
|
{"n": 44, "t": 1795283931.083, "box": [371.3, 267.6, 1060.3, 689.6]}
|
||||||
|
{"n": 45, "t": 1795283931.329, "box": [371.8, 267.9, 1060.7, 689.9]}
|
||||||
|
{"n": 46, "t": 1795283931.504, "box": [372.2, 268.6, 1059.8, 689.7]}
|
||||||
|
{"n": 47, "t": 1795283931.734, "box": [371.2, 267.0, 1058.8, 689.8]}
|
||||||
|
{"n": 48, "t": 1795283931.902, "box": [371.9, 266.7, 1059.5, 690.3]}
|
||||||
|
{"n": 49, "t": 1795283931.964, "box": [371.6, 267.1, 1059.2, 689.9]}
|
||||||
|
{"n": 50, "t": 1795283932.284, "box": [371.3, 267.1, 1060.2, 689.9]}
|
||||||
|
{"n": 51, "t": 1795283932.506, "box": [371.6, 267.2, 1059.2, 690.0]}
|
||||||
|
{"n": 52, "t": 1795283932.704, "box": [372.2, 265.6, 1059.8, 690.1]}
|
||||||
|
{"n": 53, "t": 1795283932.933, "box": [372.2, 267.0, 1059.8, 689.8]}
|
||||||
|
{"n": 54, "t": 1795283933.104, "box": [373.8, 268.1, 1062.8, 697.5]}
|
||||||
|
{"n": 55, "t": 1795283933.346, "box": [372.0, 268.0, 1059.6, 690.8]}
|
||||||
|
{"n": 56, "t": 1795283933.504, "box": [372.7, 267.3, 1059.0, 691.0]}
|
||||||
|
{"n": 57, "t": 1795283933.736, "box": [371.1, 267.1, 1061.5, 689.9]}
|
||||||
|
{"n": 58, "t": 1795283933.902, "box": [370.9, 265.5, 1061.2, 690.0]}
|
||||||
|
{"n": 59, "t": 1795283933.965, "box": [371.5, 265.5, 1061.8, 690.0]}
|
||||||
|
{"n": 60, "t": 1795283934.283, "box": [371.9, 269.9, 1059.5, 688.6]}
|
||||||
|
{"n": 61, "t": 1795283934.534, "box": [370.9, 266.9, 1058.5, 690.5]}
|
||||||
|
{"n": 62, "t": 1795283934.702, "box": [369.1, 268.7, 1060.8, 689.8]}
|
||||||
|
{"n": 63, "t": 1795283934.764, "box": [370.6, 267.2, 1059.5, 690.0]}
|
||||||
|
{"n": 64, "t": 1795283935.083, "box": [370.7, 267.8, 1061.0, 689.7]}
|
||||||
|
{"n": 65, "t": 1795283935.305, "box": [371.0, 268.5, 1062.7, 689.7]}
|
||||||
|
{"n": 66, "t": 1795283935.504, "box": [370.2, 266.6, 1060.5, 689.4]}
|
||||||
|
{"n": 67, "t": 1795283935.734, "box": [371.1, 267.0, 1060.1, 690.6]}
|
||||||
|
{"n": 68, "t": 1795283935.902, "box": [371.3, 267.4, 1060.3, 690.2]}
|
||||||
|
{"n": 69, "t": 1795283936.146, "box": [369.1, 266.3, 1060.7, 689.9]}
|
||||||
|
{"n": 70, "t": 1795283936.283, "box": [369.5, 268.2, 1063.8, 689.4]}
|
||||||
|
{"n": 71, "t": 1795283936.51, "box": [370.7, 267.6, 1058.3, 690.4]}
|
||||||
|
{"n": 72, "t": 1795283936.702, "box": [372.6, 267.7, 1057.5, 690.5]}
|
||||||
|
{"n": 73, "t": 1795283936.933, "box": [371.2, 268.0, 1061.5, 690.0]}
|
||||||
|
{"n": 74, "t": 1795283937.083, "box": [371.2, 269.1, 1058.9, 690.2]}
|
||||||
|
{"n": 75, "t": 1795283937.346, "box": [372.2, 268.9, 1058.5, 689.3]}
|
||||||
|
{"n": 76, "t": 1795283937.483, "box": [371.1, 269.4, 1061.4, 689.8]}
|
||||||
|
{"n": 77, "t": 1795283937.726, "box": [371.0, 269.0, 1060.0, 689.3]}
|
||||||
|
{"n": 78, "t": 1795283937.903, "box": [371.6, 268.3, 1060.6, 690.3]}
|
||||||
|
{"n": 79, "t": 1795283938.146, "box": [370.4, 267.5, 1059.4, 689.5]}
|
||||||
|
{"n": 80, "t": 1795283938.346, "box": [371.9, 268.0, 1058.2, 690.0]}
|
||||||
|
{"n": 81, "t": 1795283938.506, "box": [372.1, 268.8, 1058.3, 690.0]}
|
||||||
|
{"n": 82, "t": 1795283938.684, "box": [371.6, 268.0, 1059.2, 689.1]}
|
||||||
|
{"n": 83, "t": 1795283938.947, "box": [372.6, 268.1, 1058.9, 689.2]}
|
||||||
|
{"n": 84, "t": 1795283939.083, "box": [371.1, 267.3, 1058.7, 689.3]}
|
||||||
|
{"n": 85, "t": 1795283939.346, "box": [371.8, 266.0, 1058.1, 690.5]}
|
||||||
|
{"n": 86, "t": 1795283939.504, "box": [372.8, 265.8, 1057.8, 690.2]}
|
||||||
|
{"n": 87, "t": 1795283939.73, "box": [372.0, 266.0, 1060.9, 688.9]}
|
||||||
|
{"n": 88, "t": 1795283939.902, "box": [370.7, 269.3, 1061.0, 689.6]}
|
||||||
|
{"n": 89, "t": 1795283940.149, "box": [372.9, 266.6, 1060.5, 689.4]}
|
||||||
|
{"n": 90, "t": 1795283940.282, "box": [371.0, 267.5, 1060.0, 689.5]}
|
||||||
|
{"n": 91, "t": 1795283940.506, "box": [370.8, 266.7, 1061.1, 689.5]}
|
||||||
|
{"n": 92, "t": 1795283940.702, "box": [372.0, 267.9, 1061.0, 689.8]}
|
||||||
|
{"n": 93, "t": 1795283940.947, "box": [371.5, 269.1, 1060.5, 689.4]}
|
||||||
|
{"n": 94, "t": 1795283941.082, "box": [371.4, 269.6, 1059.0, 689.1]}
|
||||||
|
{"n": 95, "t": 1795283941.347, "box": [371.8, 268.1, 1056.8, 689.3]}
|
||||||
|
{"n": 96, "t": 1795283941.504, "box": [370.0, 266.7, 1060.3, 690.4]}
|
||||||
|
{"n": 97, "t": 1795283941.737, "box": [370.4, 268.1, 1060.7, 690.9]}
|
||||||
|
{"n": 98, "t": 1795283941.902, "box": [371.3, 268.8, 1058.9, 690.0]}
|
||||||
|
{"n": 99, "t": 1795283942.107, "box": [370.8, 267.4, 1061.1, 689.3]}
|
||||||
|
{"n": 100, "t": 1795283942.285, "box": [371.6, 267.6, 1059.2, 688.8]}
|
||||||
|
{"n": 101, "t": 1795283942.547, "box": [371.1, 270.0, 1062.8, 689.5]}
|
||||||
|
{"n": 102, "t": 1795283942.704, "box": [371.8, 269.6, 1059.4, 690.0]}
|
||||||
|
{"n": 103, "t": 1795283942.945, "box": [372.7, 267.7, 1060.3, 690.5]}
|
||||||
|
{"n": 104, "t": 1795283943.082, "box": [372.5, 268.3, 1058.8, 690.2]}
|
||||||
|
{"n": 105, "t": 1795283943.348, "box": [372.5, 268.1, 1058.7, 690.1]}
|
||||||
|
{"n": 106, "t": 1795283943.504, "box": [372.0, 268.4, 1058.3, 689.5]}
|
||||||
|
{"n": 107, "t": 1795283943.737, "box": [371.9, 268.7, 1058.2, 689.9]}
|
||||||
|
{"n": 108, "t": 1795283943.902, "box": [372.1, 268.8, 1058.4, 689.1]}
|
||||||
|
{"n": 109, "t": 1795283944.146, "box": [372.1, 269.4, 1059.7, 689.7]}
|
||||||
|
{"n": 110, "t": 1795283944.283, "box": [371.7, 269.0, 1059.3, 690.1]}
|
||||||
|
{"n": 111, "t": 1795283944.547, "box": [371.2, 268.2, 1058.9, 690.2]}
|
||||||
|
{"n": 112, "t": 1795283944.704, "box": [371.1, 270.0, 1060.1, 690.3]}
|
||||||
|
{"n": 113, "t": 1795283944.949, "box": [372.3, 270.8, 1057.3, 690.3]}
|
||||||
|
{"n": 114, "t": 1795283945.084, "box": [371.8, 269.5, 1059.4, 689.9]}
|
||||||
|
{"n": 115, "t": 1795283945.351, "box": [370.8, 269.6, 1061.1, 690.7]}
|
||||||
|
{"n": 116, "t": 1795283945.484, "box": [370.6, 270.5, 1060.9, 690.0]}
|
||||||
|
{"n": 117, "t": 1795283945.737, "box": [372.6, 268.9, 1060.2, 690.0]}
|
||||||
|
{"n": 118, "t": 1795283945.902, "box": [371.9, 267.9, 1060.9, 689.9]}
|
||||||
|
{"n": 119, "t": 1795283946.147, "box": [372.0, 269.1, 1062.3, 690.3]}
|
||||||
|
{"n": 120, "t": 1795283946.349, "box": [372.5, 270.0, 1060.1, 690.3]}
|
||||||
|
{"n": 121, "t": 1795283946.547, "box": [372.9, 270.1, 1061.9, 689.7]}
|
||||||
|
{"n": 122, "t": 1795283946.703, "box": [372.1, 271.0, 1062.4, 689.7]}
|
||||||
|
{"n": 123, "t": 1795283946.951, "box": [373.0, 270.1, 1060.6, 689.6]}
|
||||||
|
{"n": 124, "t": 1795283947.083, "box": [372.0, 268.4, 1059.6, 689.5]}
|
||||||
|
{"n": 125, "t": 1795283947.346, "box": [371.9, 268.3, 1060.9, 690.3]}
|
||||||
|
{"n": 126, "t": 1795283947.482, "box": [372.1, 269.3, 1057.1, 690.5]}
|
||||||
|
{"n": 127, "t": 1795283947.743, "box": [372.7, 267.8, 1057.6, 689.8]}
|
||||||
|
{"n": 128, "t": 1795283947.902, "box": [371.8, 266.4, 1058.1, 690.0]}
|
||||||
|
{"n": 129, "t": 1795283948.149, "box": [372.2, 268.7, 1059.9, 689.8]}
|
||||||
|
{"n": 130, "t": 1795283948.304, "box": [372.5, 269.2, 1060.1, 690.4]}
|
||||||
|
{"n": 131, "t": 1795283948.507, "box": [371.4, 268.2, 1060.4, 689.4]}
|
||||||
|
{"n": 132, "t": 1795283948.683, "box": [371.7, 267.6, 1059.4, 689.6]}
|
||||||
|
{"n": 133, "t": 1795283948.947, "box": [370.8, 267.2, 1058.4, 690.9]}
|
||||||
|
{"n": 134, "t": 1795283949.083, "box": [372.7, 266.8, 1056.3, 690.4]}
|
||||||
|
{"n": 135, "t": 1795283949.348, "box": [370.0, 268.3, 1057.6, 689.5]}
|
||||||
|
{"n": 136, "t": 1795283949.504, "box": [371.4, 269.7, 1057.7, 690.0]}
|
||||||
|
{"n": 137, "t": 1795283949.737, "box": [372.9, 267.5, 1059.1, 690.3]}
|
||||||
|
{"n": 138, "t": 1795283949.902, "box": [373.3, 269.3, 1058.3, 689.6]}
|
||||||
|
{"n": 139, "t": 1795283950.151, "box": [371.8, 267.1, 1059.4, 689.1]}
|
||||||
|
{"n": 140, "t": 1795283950.283, "box": [371.9, 267.8, 1056.8, 689.7]}
|
||||||
|
{"n": 141, "t": 1795283950.536, "box": [372.4, 270.0, 1058.6, 691.1]}
|
||||||
|
{"n": 142, "t": 1795283950.702, "box": [372.4, 267.9, 1061.4, 690.7]}
|
||||||
|
{"n": 143, "t": 1795283950.949, "box": [372.0, 268.3, 1059.6, 689.4]}
|
||||||
|
{"n": 144, "t": 1795283951.083, "box": [370.8, 268.0, 1061.1, 689.1]}
|
||||||
|
{"n": 145, "t": 1795283951.349, "box": [372.1, 266.6, 1059.7, 689.4]}
|
||||||
|
{"n": 146, "t": 1795283951.504, "box": [373.0, 267.3, 1063.3, 690.1]}
|
||||||
|
{"n": 147, "t": 1795283951.726, "box": [370.6, 268.1, 1063.6, 690.1]}
|
||||||
|
{"n": 148, "t": 1795283951.903, "box": [372.4, 270.0, 1060.0, 690.4]}
|
||||||
|
{"n": 149, "t": 1795283952.151, "box": [372.3, 268.4, 1059.9, 690.4]}
|
||||||
|
{"n": 150, "t": 1795283952.303, "box": [372.1, 269.3, 1058.3, 690.4]}
|
||||||
|
{"n": 151, "t": 1795283952.505, "box": [371.5, 268.3, 1060.4, 689.4]}
|
||||||
|
{"n": 152, "t": 1795283952.683, "box": [372.3, 269.9, 1060.0, 690.2]}
|
||||||
|
{"n": 153, "t": 1795283952.949, "box": [372.0, 269.3, 1059.6, 689.6]}
|
||||||
|
{"n": 154, "t": 1795283953.082, "box": [372.2, 267.9, 1057.2, 689.8]}
|
||||||
|
{"n": 155, "t": 1795283953.347, "box": [372.7, 267.6, 1059.0, 690.4]}
|
||||||
|
{"n": 156, "t": 1795283953.504, "box": [370.6, 268.9, 1060.9, 688.5]}
|
||||||
|
{"n": 157, "t": 1795283953.743, "box": [372.2, 268.9, 1059.8, 689.3]}
|
||||||
|
{"n": 158, "t": 1795283953.902, "box": [371.7, 268.7, 1060.6, 689.8]}
|
||||||
|
{"n": 159, "t": 1795283954.153, "box": [371.8, 267.9, 1059.4, 689.9]}
|
||||||
|
{"n": 160, "t": 1795283954.242, "box": [372.8, 268.9, 1059.1, 689.3]}
|
||||||
|
{"n": 161, "t": 1795283954.525, "box": [371.5, 268.3, 1059.1, 690.3]}
|
||||||
|
{"n": 162, "t": 1795283954.684, "box": [371.3, 268.5, 1063.0, 689.6]}
|
||||||
|
{"n": 163, "t": 1795283954.955, "box": [372.4, 268.5, 1060.0, 690.5]}
|
||||||
|
{"n": 164, "t": 1795283955.083, "box": [373.1, 267.4, 1058.0, 690.2]}
|
||||||
|
{"n": 165, "t": 1795283955.346, "box": [373.0, 268.3, 1058.0, 691.1]}
|
||||||
|
{"n": 166, "t": 1795283955.504, "box": [372.4, 267.4, 1058.7, 690.2]}
|
||||||
|
{"n": 167, "t": 1795283955.736, "box": [371.7, 267.9, 1057.9, 689.8]}
|
||||||
|
{"n": 168, "t": 1795283955.902, "box": [370.4, 267.9, 1060.8, 689.0]}
|
||||||
|
{"n": 169, "t": 1795283956.139, "box": [371.5, 268.0, 1061.8, 690.0]}
|
||||||
|
{"n": 170, "t": 1795283956.304, "box": [372.7, 268.2, 1060.3, 689.4]}
|
||||||
|
{"n": 171, "t": 1795283956.546, "box": [371.8, 268.4, 1060.8, 690.4]}
|
||||||
|
{"n": 172, "t": 1795283956.722, "box": [372.3, 269.5, 1059.9, 689.9]}
|
||||||
|
{"n": 173, "t": 1795283956.945, "box": [372.2, 269.9, 1061.1, 690.2]}
|
||||||
|
{"n": 174, "t": 1795283957.083, "box": [372.7, 267.9, 1063.0, 689.8]}
|
||||||
|
{"n": 175, "t": 1795283957.349, "box": [373.1, 268.4, 1060.7, 690.4]}
|
||||||
|
{"n": 176, "t": 1795283957.504, "box": [372.3, 268.6, 1058.5, 689.7]}
|
||||||
|
{"n": 177, "t": 1795283957.736, "box": [371.9, 268.6, 1059.6, 690.6]}
|
||||||
|
{"n": 178, "t": 1795283957.902, "box": [372.1, 266.7, 1059.7, 689.5]}
|
||||||
|
{"n": 179, "t": 1795283958.151, "box": [372.3, 267.5, 1062.7, 690.3]}
|
||||||
|
{"n": 180, "t": 1795283958.283, "box": [372.8, 267.7, 1060.4, 690.5]}
|
||||||
|
{"n": 181, "t": 1795283958.506, "box": [372.1, 268.2, 1062.4, 691.0]}
|
||||||
|
{"n": 182, "t": 1795283958.702, "box": [372.0, 268.7, 1060.9, 690.7]}
|
||||||
|
{"n": 183, "t": 1795283958.945, "box": [370.9, 268.0, 1061.2, 690.0]}
|
||||||
|
{"n": 184, "t": 1795283959.082, "box": [372.2, 268.5, 1061.2, 690.5]}
|
||||||
|
{"n": 185, "t": 1795283959.345, "box": [372.4, 267.3, 1061.3, 690.2]}
|
||||||
|
{"n": 186, "t": 1795283959.482, "box": [370.6, 268.2, 1062.3, 690.2]}
|
||||||
|
{"n": 187, "t": 1795283959.643, "box": [371.5, 268.0, 1061.8, 690.0]}
|
||||||
|
{"n": 188, "t": 1795283959.885, "box": [372.1, 266.5, 1061.1, 690.1]}
|
||||||
|
{"n": 189, "t": 1795283960.154, "box": [372.4, 266.9, 1060.0, 690.6]}
|
||||||
|
{"n": 190, "t": 1795283960.284, "box": [372.2, 268.6, 1058.5, 690.6]}
|
||||||
|
{"n": 191, "t": 1795283960.462, "box": [372.5, 269.4, 1061.4, 689.7]}
|
||||||
|
{"n": 192, "t": 1795283960.684, "box": [373.6, 267.3, 1061.3, 691.0]}
|
||||||
|
{"n": 193, "t": 1795283960.949, "box": [372.8, 268.4, 1059.1, 689.5]}
|
||||||
|
{"n": 194, "t": 1795283961.082, "box": [371.9, 267.2, 1058.2, 690.0]}
|
||||||
|
{"n": 195, "t": 1795283961.348, "box": [371.6, 266.6, 1059.2, 691.0]}
|
||||||
|
{"n": 196, "t": 1795283961.504, "box": [371.5, 266.5, 1059.1, 689.3]}
|
||||||
|
{"n": 197, "t": 1795283961.736, "box": [371.3, 270.1, 1058.9, 688.8]}
|
||||||
|
{"n": 198, "t": 1795283961.902, "box": [371.7, 269.4, 1059.3, 688.9]}
|
||||||
|
{"n": 199, "t": 1795283962.149, "box": [371.5, 269.1, 1060.5, 688.7]}
|
||||||
|
{"n": 200, "t": 1795283962.243, "box": [371.6, 270.3, 1061.9, 689.8]}
|
||||||
|
{"n": 201, "t": 1795283962.444, "box": [371.7, 268.8, 1059.3, 690.0]}
|
||||||
|
{"n": 202, "t": 1795283962.703, "box": [372.4, 270.1, 1061.4, 690.4]}
|
||||||
|
{"n": 203, "t": 1795283962.943, "box": [370.9, 270.2, 1061.3, 690.6]}
|
||||||
|
{"n": 204, "t": 1795283963.082, "box": [370.2, 270.3, 1063.2, 689.8]}
|
||||||
|
{"n": 205, "t": 1795283963.346, "box": [373.6, 270.0, 1061.3, 691.1]}
|
||||||
|
{"n": 206, "t": 1795283963.483, "box": [370.4, 269.9, 1063.4, 690.2]}
|
||||||
|
{"n": 207, "t": 1795283963.747, "box": [369.5, 269.8, 1062.5, 688.5]}
|
||||||
|
{"n": 208, "t": 1795283963.948, "box": [372.3, 268.6, 1059.9, 689.7]}
|
||||||
|
{"n": 209, "t": 1795283964.124, "box": [371.1, 270.2, 1061.5, 688.9]}
|
||||||
|
{"n": 210, "t": 1795283964.345, "box": [373.0, 270.7, 1060.6, 689.4]}
|
||||||
|
{"n": 211, "t": 1795283964.544, "box": [372.5, 268.9, 1061.5, 690.1]}
|
||||||
|
{"n": 212, "t": 1795283964.643, "box": [370.9, 268.9, 1061.2, 689.2]}
|
||||||
|
{"n": 213, "t": 1795283964.924, "box": [370.6, 268.2, 1059.6, 688.6]}
|
||||||
|
{"n": 214, "t": 1795283965.145, "box": [370.9, 267.8, 1058.5, 689.8]}
|
||||||
|
{"n": 215, "t": 1795283965.344, "box": [370.3, 268.5, 1063.3, 688.9]}
|
||||||
|
{"n": 216, "t": 1795283965.443, "box": [371.6, 268.1, 1060.6, 689.3]}
|
||||||
|
{"n": 217, "t": 1795283965.743, "box": [370.7, 268.8, 1061.0, 689.2]}
|
||||||
|
{"n": 218, "t": 1795283965.843, "box": [371.2, 267.8, 1058.9, 689.7]}
|
||||||
|
{"n": 219, "t": 1795283966.123, "box": [369.9, 266.3, 1061.5, 689.1]}
|
||||||
|
{"n": 220, "t": 1795283966.347, "box": [371.9, 267.1, 1062.2, 689.9]}
|
||||||
|
{"n": 221, "t": 1795283966.544, "box": [371.6, 269.8, 1060.5, 689.3]}
|
||||||
|
{"n": 222, "t": 1795283966.643, "box": [369.9, 271.0, 1062.9, 689.7]}
|
||||||
|
{"n": 223, "t": 1795283966.882, "box": [370.2, 271.6, 1067.3, 690.3]}
|
||||||
|
{"n": 224, "t": 1795283967.023, "box": [375.7, 262.7, 1081.0, 694.7]}
|
||||||
|
{"n": 225, "t": 1795283967.322, "box": [382.9, 257.8, 1100.7, 702.6]}
|
||||||
|
{"n": 226, "t": 1795283967.424, "box": [382.5, 254.2, 1107.3, 705.2]}
|
||||||
|
{"n": 227, "t": 1795283967.722, "box": [388.8, 251.2, 1169.5, 711.9]}
|
||||||
|
{"n": 228, "t": 1795283967.825, "box": [390.1, 246.9, 1181.5, 714.0]}
|
||||||
|
{"n": 229, "t": 1795283968.122, "box": [393.5, 239.2, 1272.9, 711.8]}
|
||||||
|
{"n": 230, "t": 1795283968.346, "box": [387.8, 228.0, 1286.4, 713.7]}
|
||||||
|
{"n": 231, "t": 1795283968.543, "box": [448.3, 227.8, 1279.4, 712.6]}
|
||||||
|
{"n": 232, "t": 1795283968.752, "box": [507.3, 212.5, 1258.1, 705.8]}
|
||||||
|
{"n": 233, "t": 1795283968.924, "box": [441.7, 197.5, 1266.3, 719.6]}
|
||||||
|
{"n": 234, "t": 1795283969.004, "box": [405.5, 199.1, 1278.0, 715.0]}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{"n": 1, "t": 1795341765.376, "box": [320.6, 277.4, 904.1, 634.1]}
|
||||||
|
{"n": 2, "t": 1795341765.476, "box": [323.1, 277.9, 922.8, 643.8]}
|
||||||
|
{"n": 3, "t": 1795341765.776, "box": [331.4, 274.2, 967.3, 662.2]}
|
||||||
|
{"n": 4, "t": 1795341765.993, "box": [335.8, 275.1, 986.9, 665.4]}
|
||||||
|
{"n": 5, "t": 1795341766.194, "box": [330.5, 275.6, 993.1, 668.9]}
|
||||||
|
{"n": 6, "t": 1795341766.275, "box": [329.7, 273.5, 994.8, 669.1]}
|
||||||
|
{"n": 7, "t": 1795341766.594, "box": [332.6, 275.9, 1003.0, 675.4]}
|
||||||
|
{"n": 8, "t": 1795341766.732, "box": [336.1, 274.5, 1002.6, 676.4]}
|
||||||
|
{"n": 9, "t": 1795341766.975, "box": [339.6, 275.7, 995.7, 676.7]}
|
||||||
|
{"n": 10, "t": 1795341767.075, "box": [335.8, 275.3, 1002.3, 678.0]}
|
||||||
|
{"n": 11, "t": 1795341767.384, "box": [339.1, 276.0, 999.1, 678.7]}
|
||||||
|
{"n": 12, "t": 1795341767.545, "box": [337.8, 274.4, 1001.7, 678.6]}
|
||||||
|
{"n": 13, "t": 1795341767.785, "box": [338.2, 273.9, 1002.1, 679.0]}
|
||||||
|
{"n": 14, "t": 1795341767.923, "box": [336.9, 274.1, 1002.1, 679.1]}
|
||||||
|
{"n": 15, "t": 1795341768.11, "box": [336.8, 275.6, 999.4, 680.6]}
|
||||||
|
{"n": 16, "t": 1795341768.343, "box": [337.1, 276.5, 998.4, 678.3]}
|
||||||
|
{"n": 17, "t": 1795341768.584, "box": [341.5, 273.5, 1002.8, 678.5]}
|
||||||
|
{"n": 18, "t": 1795341768.723, "box": [343.9, 271.9, 1005.1, 680.1]}
|
||||||
|
{"n": 19, "t": 1795341768.974, "box": [336.3, 270.0, 1034.7, 688.7]}
|
||||||
|
{"n": 20, "t": 1795341769.215, "box": [344.6, 264.7, 1056.8, 696.7]}
|
||||||
|
{"n": 21, "t": 1795341769.392, "box": [352.7, 270.7, 1099.1, 701.0]}
|
||||||
|
{"n": 22, "t": 1795341769.532, "box": [373.5, 264.3, 1128.7, 715.3]}
|
||||||
|
{"n": 23, "t": 1795341769.774, "box": [391.1, 261.4, 1187.2, 712.3]}
|
||||||
|
{"n": 24, "t": 1795341770.016, "box": [397.0, 254.1, 1259.4, 707.7]}
|
||||||
|
{"n": 25, "t": 1795341770.192, "box": [408.0, 240.8, 1252.1, 711.5]}
|
||||||
|
{"n": 26, "t": 1795341770.417, "box": [417.7, 239.3, 1240.7, 714.7]}
|
||||||
|
{"n": 27, "t": 1795341770.591, "box": [451.6, 232.1, 1261.8, 715.9]}
|
||||||
|
{"n": 28, "t": 1795341770.733, "box": [484.8, 217.8, 1270.1, 713.1]}
|
||||||
|
{"n": 29, "t": 1795341770.974, "box": [558.5, 197.2, 1279.1, 723.4]}
|
||||||
|
{"n": 30, "t": 1795341771.216, "box": [677.7, 197.3, 1282.2, 711.3]}
|
||||||
|
{"n": 31, "t": 1795341771.374, "box": [811.3, 198.3, 1283.9, 720.4]}
|
||||||
|
{"n": 32, "t": 1795341771.562, "box": [973.7, 225.7, 1277.9, 720.0]}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user