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