using System;
using System.Collections.Generic;
namespace TeamAAS.Global.Devices
{
/// 轴状态快照(流程/状态栏批量读取用)。
public sealed class AxisStatus
{
public int Index { get; set; }
public string Name { get; set; }
public double Position { get; set; }
public double Velocity { get; set; }
public bool IsMoving { get; set; }
public bool IsHomed { get; set; }
public bool IsEnabled { get; set; }
public bool PositiveLimit { get; set; }
public bool NegativeLimit { get; set; }
public bool Alarm { get; set; }
}
///
/// 运动控制卡统一契约:索引式 API(流程层)+ 轴对象(调试层)+ 插补/IO。
/// 品牌适配器(仿真/雷赛/汇川 IMC60G 等)实现本接口后注册进 MotionManager。
///
public interface IMotionCard : IConnectableDevice
{
int AxisCount { get; }
// --- 流程层:索引 API ---
bool SetEnable(int axis, bool enable);
bool Home(int axis, int mode = 0);
bool IsHomed(int axis);
bool MoveAbsolute(int axis, double position, double velocity);
bool MoveRelative(int axis, double distance, double velocity);
bool JogStart(int axis, int direction, double velocity);
bool JogStop(int axis);
/// 平滑停止(axis=-1 表示全部轴)。
bool Stop(int axis = -1);
AxisStatus GetAxisStatus(int axis);
List GetAllAxisStatus();
// --- 调试层:轴对象 ---
IAxis GetAxis(int axisNo);
IList GetAxes();
// --- 多轴协同 ---
bool MoveLinear(double[] targetPositions, double velocity);
bool MoveArc(double[] centerPoint, double[] targetPositions, double velocity);
/// 急停全部轴。
bool EmergencyStop();
// --- 板载 IO ---
bool ReadDI(int portIndex);
bool WriteDO(int portIndex, bool value);
event EventHandler ConnectionStateChanged;
event EventHandler ErrorOccurred;
}
///
/// IO 卡(如 GR20T-ECT-1616ETN)统一契约。
///
public interface IIOCard : IConnectableDevice
{
int InputCount { get; }
int OutputCount { get; }
bool[] ReadAllInputs();
bool[] ReadAllOutputs();
bool WriteOutput(int index, bool value);
bool WriteOutputs(bool[] values);
}
}