| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using TeamAAS.Robot;
- using TeamAAS.FlowEditor.Models;
- using TeamAAS.FlowEditor.Execution;
- using TeamAAS.Communication;
- using TeamAAS.Camera;
- using TeamAAS.Feeder;
- namespace TeamAAS.Core
- {
- /// <summary>
- /// 统一管理各子项目核心服务实例(现为 SDK ServiceRegistry 的门面:get/set 委托到注册表,单一真相源)。
- /// 静态工具类直接调用:DialogHelper、PluginLoader、CameraFactory、RobotFactory、ResultRegistry
- /// </summary>
- public static class CoreManager
- {
- /// <summary>
- /// 获取所有设备的连接状态(名称, 类别, 是否连接)
- /// </summary>
- public static System.Collections.Generic.List<(string Name, string Category, bool IsConnected)> GetAllDeviceStatuses()
- {
- var list = new System.Collections.Generic.List<(string, string, bool)>();
- foreach (var cam in Camera.Devices)
- list.Add((cam.Name ?? "相机", "相机", cam.IsConnected));
- foreach (var robot in Robot.Devices)
- list.Add((robot.Name ?? $"机器人{robot.RobotNo}", "机器人", robot.IsConnected));
- foreach (var comm in Communication.Devices)
- list.Add((comm.Name, "通讯", comm.IsConnected));
- return list;
- }
- /// <summary>
- /// 相机服务(单例)
- /// </summary>
- public static CameraManager Camera
- {
- get => TeamAAS.Global.ServiceRegistry.Default.GetService<CameraManager>();
- set => TeamAAS.Global.ServiceRegistry.Default.Register(value);
- }
- /// <summary>
- /// 机器人服务(单例)
- /// </summary>
- public static RobotManager Robot
- {
- get => TeamAAS.Global.ServiceRegistry.Default.GetService<RobotManager>();
- set => TeamAAS.Global.ServiceRegistry.Default.Register(value);
- }
- public static CommunicationManager Communication
- {
- get => TeamAAS.Global.ServiceRegistry.Default.GetService<CommunicationManager>();
- set => TeamAAS.Global.ServiceRegistry.Default.Register(value);
- }
- /// <summary>
- /// 供料器服务(单例)
- /// </summary>
- public static FeederManager Feeder
- {
- get => TeamAAS.Global.ServiceRegistry.Default.GetService<FeederManager>();
- set => TeamAAS.Global.ServiceRegistry.Default.Register(value);
- }
- /// <summary>
- /// 运动控制服务(设备内核·新增;仿真/雷赛/固高/IMC60G/GR20T 统一入口)
- /// </summary>
- public static TeamAAS.Motion.MotionManager Motion
- {
- get => TeamAAS.Global.ServiceRegistry.Default.GetService<TeamAAS.Motion.MotionManager>();
- set => TeamAAS.Global.ServiceRegistry.Default.Register(value);
- }
- /// <summary>
- /// 创建流程执行器
- /// </summary>
- //public static FlowExecutor CreateFlowExecutor(FlowGraph graph) => new FlowExecutor(graph);
- }
- }
|