using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FLY.Thick.Base.Common
{
    /// <summary>
    /// 电机类型
    /// </summary>
    public enum MOTORTYPE
    {
        /// <summary>
        /// 没有
        /// </summary>
        NULL = 0,
        /// <summary>
        /// 变频器
        /// </summary>
        VF0 = 1,
        /// <summary>
        /// 伺服电器
        /// </summary>
        SERVO = 2
    }

    /// <summary>
    /// 密码区状态
    /// </summary>
    public enum AREA_STATUS
    {
        /// <summary>
        /// 没有读过密码区
        /// </summary>
        NOTLOAD = 0,
        /// <summary>
        /// 读出错
        /// </summary>
        RDERR = 1,
        /// <summary>
        /// 非有效密码区 没有0xAA55 或 0x5A5A 标志
        /// </summary>
        NOTVALID = 2,
        /// <summary>
        /// 写出错
        /// </summary>
        WRERR = 3,
        /// <summary>
        /// 有效密码区
        /// </summary>
        VALID = 4,
        /// <summary>
        /// 有效密码区，应回写EEPROM
        /// </summary>
        VALID_DIRTY = 5,
        /// <summary>
        /// 有效密码区，但回写EEPROM失败
        /// </summary>
        VALID_WRERR = 6
    }

    /// <summary>
    /// 密码区错误内容
    /// </summary>
    public enum AREA_ERR
    {
        NO_ERR = 0, // 没有错误
        DUP_ACCESS = 1,//  重复使用码 
        ERR_ACCESS = 2//无效使用码
    }

    /// <summary>
    /// 授权码包
    /// </summary>
    public class AccessInfo 
    {
        /// <summary>
        /// 密码区状态
        /// </summary>
        public AREA_STATUS status;

        /// <summary>
        /// 操作结果
        /// </summary>
        public AREA_ERR ret;

        /// <summary>
        /// 序列码
        /// </summary>
        public byte[] code = new byte[7];

        /// <summary>
        /// 剩余时间
        /// </summary>
        public UInt16 surplus;

        /// <summary>
        /// 授权码
        /// </summary>
        public byte[] access = new byte[8];
    }

    /// <summary>
    /// grid 数据包
    /// </summary>
    public class GridInfo
    {
        /// <summary>
        /// 数据方向
        /// </summary>
        public Misc.DIRECTION direction;
        /// <summary>
        /// AD值数据
        /// </summary>
        public int[] data;
        /// <summary>
        /// 厚度值数据
        /// </summary>
        public double[] thick;
    }



}
