feat(fleet): add board observation center with live sources and maps

Add adaptive per-vehicle layouts, full-panel dragging, source controls and automatic preview recovery for RealSense, Insta360 X4 and XGRIDS K1 observation views. Integrate cached Cesium map layers through the private NAS gateway link, retain bounded sensor command receipts, and document validation and operational handoff.
This commit is contained in:
DCCONSTRUCTIONS
2026-09-10 22:12:05 +03:00
parent 5f75afb720
commit be58d589e2
48 changed files with 1575 additions and 83 deletions
+24 -1
View File
@@ -33,6 +33,8 @@ ACTIONS = {
}
MAX_INVENTORY_ITEMS = 500
MAX_SENSOR_STATE_BYTES = 3 * 1024 * 1024
MAX_PENDING_COMMANDS = 32
MAX_COMMAND_RECEIPTS = 128
def validate_inventory(value, node_id):
@@ -94,8 +96,29 @@ def submit(fleet, vehicle_id, value):
row["sensor_commands"] = {
k: v for k, v in row["sensor_commands"].items() if time.time() - v["updated_at"] < 600
}
if len(row["sensor_commands"]) >= 32:
now = datetime.now(UTC)
# Completed viewing operations are receipts, not occupied execution
# slots. Keep them for idempotency without blocking a later Stop.
active = sum(
entry["state"] in ("queued", "running")
and datetime.fromisoformat(entry["command"]["deadline_at"]) > now
for entry in row["sensor_commands"].values()
)
if active >= MAX_PENDING_COMMANDS:
raise PairingError("Слишком много запросов к устройству. Повторите позже.")
if len(row["sensor_commands"]) >= MAX_COMMAND_RECEIPTS:
expired = sorted(
(k for k, entry in row["sensor_commands"].items()
if entry["state"] not in ("queued", "running")
and datetime.fromisoformat(entry["command"]["deadline_at"]) < now),
key=lambda k: row["sensor_commands"][k]["updated_at"],
)
for key in expired:
del row["sensor_commands"][key]
if len(row["sensor_commands"]) < MAX_COMMAND_RECEIPTS:
break
if len(row["sensor_commands"]) >= MAX_COMMAND_RECEIPTS:
raise PairingError("Слишком много запросов к устройству. Повторите позже.")
operation = {"command": value, "state": "queued", "updated_at": time.time()}
row["sensor_commands"][command.operation_id] = operation
fleet.save(row)