feat(cameras): booth camera tiles — latest snapshot at rest, live video while a vehicle is in view
Footer camera chips open/close a tile per camera (bottom right, ~15% wide, stacking leftwards); the open set is a per-user preference (users.open_cameras). A tile shows the camera's newest entry/exit snapshot and switches to live video while that camera pushes vehicle events (per-camera activity, same 30 s TTL as lane status). - devices: RTSP MJPEG client + RFC 2435 RTP/JPEG reassembly; Hikvision openLiveStream() on the sub-stream (x02, must be MJPEG — H.264 is refused with that reason) - server: CameraLiveHub (one shared upstream per camera, latest-frame delivery, fps cap, linger, backoff), CameraActivity, /api/cameras/:id/latest-snapshot, WS /api/cameras/:id/live (shared handshake auth with /api/ws + device:read), PUT /api/auth/open-cameras, migration 0033 (open_cameras + snapshot device/time index) - web: CameraDock, footer toggles, binary frames in the platform socket (Tauri too) - .gitattributes: *.jpg / *.bin binary (byte-exact test fixtures) Verified on park-lab cameras end to end and in headless Firefox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -89,6 +89,13 @@ export interface DeviceStatusEvent {
|
||||
* 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
|
||||
* 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 {
|
||||
readonly entry: boolean; // true = busy (a vehicle is at the entry 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);
|
||||
}
|
||||
|
||||
/** 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
|
||||
* at an entry/exit barrier). Drives the booth barrier light's blink. Advisory only. */
|
||||
emitLanePresence(event: LanePresenceEvent): void {
|
||||
|
||||
Reference in New Issue
Block a user