ria-toolkit-oss/src/ria_toolkit_oss/agent/hardware.py

23 lines
669 B
Python
Raw Normal View History

"""Hardware detection and heartbeat payload construction for the streamer."""
from __future__ import annotations
from ria_toolkit_oss.sdr import detect_available
def available_devices() -> list[str]:
"""Return a sorted list of device names whose driver modules import cleanly."""
return sorted(detect_available().keys())
def heartbeat_payload(status: str = "idle", app_id: str | None = None) -> dict:
"""Build the JSON body of a periodic heartbeat frame."""
payload: dict = {
"type": "heartbeat",
"hardware": available_devices(),
"status": status,
}
if app_id:
payload["app_id"] = app_id
return payload