using Mesnac.DeviceAdapter;
using System;

namespace Mesnac.DeviceAdapterNet
{
    public class DeviceInfo
    {
        public UInt16 m_iDeviceId = 0;              //设备ID
        public string m_strConnectStr = null;       //连接字符串
        public byte m_iConnectMode = 0;             //连接方式   
        public string m_strDeviceType = "";         //设备类型
        public IDeviceAdapter m_IDeviceAdapter = null;
        public byte m_ConnectState = 0;    //连接状态，初始化0,1已连接,0未连接
    }

    public class SensorInfo
    {
        public UInt32 m_iSensorId = 0;          //传感器ID
        public UInt32 m_iCombineId = 0;         //合并编号
        public byte m_iSensorSer = 0;           //传感器序号   
        public UInt16 m_iSensorType = 0;        //传感器类型
        public UInt16 m_iDeviceId = 0;          //所属设备ID
        public UInt32 m_iReadInterval = 0;      //读取时间间隔
        public byte m_iMulData = 0;             //是否允许多组数据上传
        public UInt32 m_iTimedOut = 0;          //超时时间
        public byte m_iReturnImm = 0;           //是否立即返回
        public System.Threading.Timer m_Timer = null;   //根据读取时间间隔设置的定时器
    }
    public class CombineData
    {
        public int m_iCombineId = 0;         //合并编号
        public bool IsReading = false;
        public byte[] m_returnData = null;
        public byte m_iSensorSer = 0;           //传感器序号  
    }


    public class AntListInfo
    {
        public static AntInfo[] AntList
        {
            get
            {
                if (_AntList == null)
                {
                    _AntList = new AntInfo[8];
                    for (int i = 0; i < 8; i++)
                    {
                        AntInfo a = new AntInfo();
                        _AntList[i] = a;
                    }
                }
                return _AntList;
            }
            set
            {
                _AntList = value;
            }
        }

        public static AntInfo[] _AntList;
    }

    public class AntInfo
    {
        public int m_iCombineId;
        /// <summary>
        /// 是否超高频读头
        /// </summary>
        public bool UHFAntenna { get; set; }
        /// <summary>
        /// 当前读取数据
        /// </summary>
        public byte[] ReadData { get; set; }
        /// <summary>
        /// 当前是否正在读取
        /// </summary>
        public bool IsReading;

        private int _readType = -1;
        /// <summary>
        /// 读取状态，0为当前没有读取，1当前为自动读取，2当前为MES主动读取
        /// </summary>
        public int readType
        {
            get
            {
                return _readType;
            }
            set
            {
                lock (string.Empty)
                {
                    _readType = value;
                }
            }
        }
        public System.Threading.Timer m_Timer = null;   //根据读取时间间隔设置的定时器

    }
}
