added remote k209 setup
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
"""Factory for single-radar Python acquisition services."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Protocol
|
||||
|
||||
from python_app.hardware_full.librevna_driver.models import SweepResult
|
||||
from python_app.hardware_full.librevna_service import LibreVnaService
|
||||
from python_app.hardware_full.remote_compact_m_k209_service import RemoteCompactMK209Service
|
||||
from python_app.models.run_config_model import RadarSweepModel, RunConfigModel
|
||||
|
||||
|
||||
class SingleRadarService(Protocol):
|
||||
"""Common API used by single-radar workflows."""
|
||||
|
||||
def open(self) -> None:
|
||||
"""Open radar connection."""
|
||||
|
||||
def close(self) -> None:
|
||||
"""Close radar connection."""
|
||||
|
||||
def configure(self, sweep: RadarSweepModel) -> None:
|
||||
"""Apply sweep settings."""
|
||||
|
||||
def read_device_limits(self) -> dict[str, float | int]:
|
||||
"""Read device capability limits."""
|
||||
|
||||
def acquire(self) -> SweepResult:
|
||||
"""Acquire one sweep."""
|
||||
|
||||
|
||||
def create_single_radar_service(config: RunConfigModel) -> SingleRadarService:
|
||||
"""Create the Python service for a non-multi-device radar config."""
|
||||
if config.is_multi_device:
|
||||
raise RuntimeError("single-radar service factory does not support librevna_multi")
|
||||
|
||||
model = config.radar.model or RunConfigModel.LIBREVNA_MODEL
|
||||
if model == RunConfigModel.LIBREVNA_MODEL:
|
||||
return LibreVnaService(serial=config.radar.serial or None)
|
||||
|
||||
if model == RunConfigModel.COMPACT_M_K209_MODEL:
|
||||
if config.radar.driver_mode != "native":
|
||||
raise RuntimeError("Compact-M K209 requires radar.driver_mode='native'")
|
||||
return RemoteCompactMK209Service(
|
||||
host=config.radar.remote_host,
|
||||
port=config.radar.remote_port,
|
||||
)
|
||||
|
||||
raise RuntimeError(f"Unsupported single-radar model: {model}")
|
||||
Reference in New Issue
Block a user