Ver Fonte

feat(camera): 添加智能拍摄器自动对焦功能

- 实现了smart_shooter_auto_focus消息类型的处理逻辑
- 集成了相机配置获取和自动对焦功能
- 添加了相机键值提取和错误处理机制
- 实现了对焦失败时的消息返回和错误提示功能
- 支持通过data参数传递点位名称进行对焦操作
- 完善了相机属性获取的相关配置信息处理
rambo há 1 dia atrás
pai
commit
7c10d11d22
1 ficheiros alterados com 26 adições e 0 exclusões
  1. 26 0
      python/sockets/message_handler.py

+ 26 - 0
python/sockets/message_handler.py

@@ -475,6 +475,32 @@ async def handlerSend(
                 ),
                 name=msg_type,
             )
+        case "smart_shooter_auto_focus":
+            """
+            启动相机或关闭实时预览
+            """
+            if data is None:
+                PointName = "A"
+            else:
+                PointName = data.get("point_name", "A")
+            camera_configs = settings.getSysConfigs(
+                "camera_configs",
+                "iso_config",
+                None,
+            )
+            msg_type = "smart_shooter_auto_focus"
+            temp_A_point = camera_configs.get(PointName, None)
+            CameraKey = temp_A_point.get("CameraKey", None) if temp_A_point else None
+            status,msg = await  smart_shooter.CameraAutofocus(
+                    CameraKey=CameraKey,
+                )
+            if not status:
+                data = manager.jsonMessage(
+                    code=1,
+                    msg=msg,
+                    msg_type=msg_type,
+                )
+                await manager.send_personal_message(data, websocket)
         case "smart_shooter_get_camera_property":
             """
             启动相机或关闭实时预览