feat: 实现 sensor_report 主动上报功能
vd960DBN: - 新增 g_report_active 全局标志控制传感器数据主动上报 - handle_report_config: 解析 active_report JSON 字段,设置/清除标志 - tcp_json_push_sensor: 检查 g_report_active 开关,仅在启用时推送 DBNetClient: - tcp_json_client.py: 新增 report_config(active_report) 方法 - main.py: 线圈标签页添加"启用主动上报"复选框 - main.py: 注册 sensor_report push 处理器,实时显示推送数据
This commit is contained in:
@@ -312,6 +312,15 @@ class DBNetClient:
|
||||
{"auto_mode": auto_mode,
|
||||
"channels": channels})
|
||||
|
||||
def report_config(self, active_report: bool = True) -> dict:
|
||||
"""配置主动上报开关
|
||||
|
||||
active_report=True → 设备主动推送传感器数据 (sensor_report)
|
||||
active_report=False → 停止主动上报
|
||||
"""
|
||||
return self._tcp.send_command("report_config",
|
||||
{"active_report": active_report})
|
||||
|
||||
# Push
|
||||
def on_push(self, cmd: str, handler: callable) -> None:
|
||||
self._tcp.on_push(cmd, handler)
|
||||
|
||||
Reference in New Issue
Block a user