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

namespace Mesnac.DeviceAdapter.Fuchs
{
    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
    {
        /// <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;
                }
            }
        }
        /// <summary>
        /// 当前任务是否完成信号量
        /// </summary>
        public Semaphore m_Waiting = new Semaphore(0, 100000);
        /// <summary>
        /// 数据返回信号量
        /// </summary>
        public Semaphore m_WaitResult = new Semaphore(0, 100000);
        /// <summary>
        /// 连续识别停止返回信号量
        /// </summary>
        public Semaphore m_StopResult = new Semaphore(0, 100000);
        /// <summary>
        /// 高频读头连续识别停止返回信号量
        /// </summary>
        public Semaphore s_BeginEvent = new Semaphore(0, 100000);
        /// <summary>
        /// 超高频读头连续识别停止返回信号量
        /// </summary>
        public Semaphore s_UHFBeginEvent = new Semaphore(0, 100000);
    }
}
