重构UCD模块

This commit is contained in:
xinzhu.yin
2026-06-11 15:53:41 +08:00
parent 38222ff002
commit cc7218411c
11 changed files with 395 additions and 188 deletions

View File

@@ -65,7 +65,7 @@ class ConnectionController:
def list_ucd_devices(self) -> list[str]:
"""返回 SDK 给出的设备显示字符串列表。"""
try:
return self._device.raw_controller.search_device() or []
return self._device.search_devices()
except Exception as exc: # noqa: BLE001
self._log(f"枚举 UCD 设备失败: {exc}", level="error")
return []
@@ -103,11 +103,6 @@ class ConnectionController:
self._device.close()
except Exception: # noqa: BLE001
pass
# 旧 controller.status 也要清零,兼容仍读取它的代码
try:
self._app.ucd.status = False
except Exception: # noqa: BLE001
pass
self._log("UCD连接已断开", level="info")
# -- CA 连接 -------------------------------------------------
@@ -347,7 +342,7 @@ def update_connection_indicator(self: "PQAutomationApp", indicator, connected):
def refresh_connection_indicators(self: "PQAutomationApp"):
"""根据当前设备状态重画 UCD / CA 指示灯。"""
if hasattr(self, "ucd_status_indicator"):
ucd_connected = bool(getattr(self.ucd, "status", False))
ucd_connected = self.signal_service.is_connected
_draw_connection_indicator(
self.ucd_status_indicator,
"green" if ucd_connected else "gray",