/// <summary>
/// 控制卡所有操作的接口
/// </summary>
public interface ICardExecuter : IAxisOperate, IIOOperate
{
/// <summary>
/// 品牌
/// </summary>
CardBrand Brand { get; }
/// <summary>
/// 验证返回的结果
/// </summary>
Result GetResult(int rc);
Result GetLibVer(short cardNum, out int varNum, out int motionVer, out int firmWareVer);
/// <summary>
/// 打开运动卡
/// </summary>
/// <param name="cardNum">当前控制卡卡号</param>
Result Open(short cardNum = 0);
/// <summary>
/// 加载必要的ini配置文件
/// </summary>
Result LoadConfig(short cardNum);
Result WriteEtherCAT(short cardNum, int axis, int index, int subIndex, byte[] data);
//Result ReadEtherCAT(short cardNum,int axis,int index,int subIn
Result WriteEtherCAT(short cardNum, int axis, int index, int subIndex, byte data, int length);
Result ReadEtherCAT(short cardNum, int axis, int index, int subIndex, ref byte[] data);
/// <summary>
/// 关闭运动卡
/// </summary>
/// <param name="cardNum">当前控制卡卡号</param>
Result Close(short cardNum = 0);
/// <summary>
/// 按组设置编码器的计数方向
/// </summary>
/// <param name="cardNum">当前控制卡卡号</param>
/// <param name="sense">按组设置编码器的方向,0-正逻辑,1-负逻辑</param>
Result SetEncSns(ushort sense, short cardNum = 0);
/// <summary>
/// 复位运动控制器
/// </summary>
/// <param name="cardNum">当前控制卡卡号</param>
Result Reset(short cardNum = 0);
/// <summary>
/// 读取规划速度,众为兴为最大速度值
/// </summary>
Result GetPrfVel(short profile, out double pValue, short cardNum = 0);
/// <summary>
/// 执行XY直线插补
/// </summary>
Result LnXY(short crd, short xCode, short yCode, double xPos, double yPos, double synVel, double synAcc, short cardNum);
Result LnXYZ(short crd, short xCode, short yCode, short zCode, double xPos, double yPos, double zPos, double synVel, double synAcc, short cardNum);
Result StartLnXY(int[] axisCode, PointD[] posArray,
double[] vel, double acc, double startVel, int smoothTime, short cardNum);
int GetLnXYIndex(short cardNum);
int GetLnZIndex(short cardNum);
void WaitLnXYEnd(short cardNum);
Result StartLnZ(short axisCode, double[] posArray, double[] vel,
double acc, double startVel, int smoothTime, short cardNum);
void WaitLnZEnd(short cardNum);
/// <summary>
/// 获得插补执行状态
/// </summary>
Result GetCrdState(short crd, out bool isRun, short cardNum);
/// <summary>
/// 设置轴跟随驱动模式(龙门双驱)
/// </summary>
Result SetFollowAxis(short master, short slave, short cardNum = 0);
/// <summary>
/// 获取位置比较长度
/// </summary>
/// <param name="cmp">比较器索引 0:OUT16 1:OUT17 2:OUT18 3:OUT19</param>
/// <param name="length">位置比较器余量</param>
/// <returns></returns>
Result GetXDLen(int cmp, out int length, short cardNum = 0);
/// <summary>
/// 获取位置比较状态
/// </summary>
/// <param name="cmp">比较器索引 0:OUT16 1:OUT17 2:OUT18 3:OUT19</param>
/// <param name="couSucess">位置比较器已完成比较点数</param>
/// <returns></returns>
Result GetXDSts(int cmp, out int couSucess, short cardNum = 0);
/// <summary>
/// 设置位置比较误差范围
/// </summary>
/// <param name="cmp">比较器索引 0:OUT16 1:OUT17 2:OUT18 3:OUT19</param>
/// <param name="area">位置比较器位置比较矩形区域</param>
/// <returns></returns>
Result SetXDArea(int cmp, int[] area, short cardNum = 0);
/// <summary>
/// 设置位置比较触发模式
/// </summary>
/// <param name="cmp">比较器索引 0:OUT16 1:OUT17 2:OUT18 3:OUT19</param>
/// <param name="axis">位置比较触发轴号</param>
/// <param name="source">位置比较源 0:逻辑位置 1:编码器位置</param>
/// <param name="mode">比较器触发 IO 输出模式 0:反转 1:脉冲输出</param>
/// <param name="level">输出端口常态,即触发前输出端口状态 0:低电平 1:高电平</param>
/// <returns></returns>
Result SetXDMode(int cmp, int xd, int[] axis, int source, int mode, int level, int cardNum = 0);
/// <summary>
/// 获取位置比较触发模式
/// </summary>
/// <param name="cmp">比较器索引 0:OUT16 1:OUT17 2:OUT18 3:OUT19</param>
/// <param name="axis">位置比较触发轴号</param>
/// <param name="enable">是否启用位置比较 0:不启用 1:启用</param>
/// <param name="xd">位置比较维数</param>
/// <param name="source">位置比较源 0:逻辑位置 1:编码器位置</param>
/// <param name="mode">比较器触发 IO 输出模式 0:反转 1:脉冲输出</param>
/// <param name="level">输出端口常态,即触发前输出端口状态 0:低电平 1:高电平</param>
/// <returns></returns>
Result GetXDMode(int cmp, int[] axis, out int enable, out int xd, out int source,
out int mode, out int level, int cardNum = 0);
/// <summary>
/// 清除位置比较点位
/// </summary>
/// <param name="cmp">比较器索引 0:OUT16 1:OUT17 2:OUT18 3:OUT19</param>
/// <returns></returns>
Result ClearXDCmp(int cmp, short cardNum = 0);
/// <summary>
/// 添加位置比较点
/// </summary>
/// <param name="cmp">比较器索引 0:OUT16 1:OUT17 2:OUT18 3:OUT19</param>
/// <param name="pos">位置点</param>
/// <param name="time_h">位置比较输出打开时间</param>
/// <param name="time_l">位置比较输出关闭时间</param>
/// <returns></returns>
Result AddXDCmp(int cmp, int[] pos, double time_h, double time_l, short cardNum = 0);
/// <summary>
/// 重置位置比较
/// </summary>
/// <param name="cmp">比较器索引 0:OUT16 1:OUT17 2:OUT18 3:OUT19</param>
/// <returns></returns>
Result ResetXDCmp(int cmp, short cardNum = 0);
}
/// <summary>
/// 控制卡品牌的枚举
/// </summary>
public enum CardBrand
{
/// <summary>
/// 众为兴
/// </summary>
ADT_6320E = 0,
/// <summary>
/// 众为兴
/// </summary>
ADT_6320E_C = 1,
/// <summary>
/// 雷赛
/// </summary>
DMC_E3032 = 2,
}
/// <summary>
/// 运动单位
/// </summary>
public enum MotionUnit
{
/// <summary>
/// 毫米
/// </summary>
MM,
/// <summary>
/// 脉冲
/// </summary>
Pulse,
}