using SlnMesnac.Model.dto;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* 版权所有 (c) 2024 WenJY 保留所有权利。
* CLR版本：4.0.30319.42000
* 机器名称：LAPTOP-E0N2L34V
* 命名空间：SlnMesnac.Rfid
* 唯一标识：496f8d2b-70e3-4a05-ae18-a9b0fcd06b82
*
* 创建者：WenJY
* 电子邮箱：wenjy@mesnac.com
* 创建时间：2024-03-27 21:58:35
* 版本：V1.0.0
* 描述：
*
*--------------------------------------------------------------------
* 修改人：
* 时间：
* 修改说明：
*
* 版本：V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.Rfid
{
    /// <summary>
    /// RFID抽象工厂
    /// </summary>
    public abstract class RfidAbsractFactory
    {
        public string FilterData;
        public string ip;
        public int port;
        public string deviceid;
        public string ConfigKey { get; set; }

        public Action<string> _RefreshLogMessageAction;

        public Action<string, List<TagInfo>> _Action;
        /// <summary>
        /// 异步建立连接
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        /// <returns></returns>
        public abstract Task<bool> ConnectAsync(string ip, int port,string deviceid);
        /// <summary>
        /// 建立连接
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        /// <returns></returns>
        public abstract bool Connect(string ip, int port);
        /// <summary>
        /// 获取设备在线状态
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        /// <returns></returns>
        public abstract bool GetOnlineStatus();

        public abstract Task<bool> SendHeartPack();

        /// <summary>
        /// 关闭连接
        /// </summary>
        public abstract void Close();

        /// <summary>
        /// 使用--异步按时间段盘点
        /// </summary>
        /// <param name="timeout"></param>
        /// <returns></returns>
        /// <exception cref="InvalidOperationException"></exception>
        public abstract Task<List<TagInfo>> GetRFIDAsync(int timeout = 1500);

        /// <summary>
        /// 设置GPIO
        /// </summary>
        /// <param name="port"></param>
        /// <param name="Timedout"></param>
        /// <returns></returns>
        public abstract Task<bool> WriteAlarmLight(int port, UInt16 Timedout);
        /// <summary>
        /// 设置功率
        /// </summary>
        /// <param name="iDbi">功率</param>
        /// <returns></returns>
        public abstract Task<bool> Set_Rf(int iDbi);
        /// <summary>
        /// 获取功率
        /// </summary>
        /// <returns></returns>
        public abstract Task<string> Get_Rf();
        /// <summary>
        /// 设置过滤数据
        /// 清除过滤数据Filter写0
        /// </summary>
        /// <param name="Filter">过滤数据</param>
        /// <returns></returns>
        public abstract Task<bool> Set_FilterData(string Filter);
        /// <summary>
        /// 获取过滤数据
        /// </summary>
        /// <returns></returns>
        public abstract Task<string> Get_FilterData();

        /// <summary>
        /// 设置频段
        /// </summary>
        /// <param name="Frequencyband"></param>
        /// <returns></returns>
        public abstract Task<bool> Set_Frequencyband(string Frequencyband);

        /// <summary>
        /// 获取频段
        /// </summary>
        /// <returns></returns>
        public abstract Task<string> Get_Frequencyband();

        /// <summary>
        /// 开启连续盘点
        /// </summary>
        /// <returns></returns>
        public abstract Task<bool> Set_BeginIdentify();

        /// <summary>
        /// 停止连续盘点
        /// </summary>
        /// <returns></returns>
        public abstract Task<bool> Set_StopIdentify();

        /// <summary>
        /// 心跳指令发送
        /// </summary>
        /// <returns></returns>
        public abstract Task<bool> Set_HeartBeat(byte second);

        /// <summary>
        /// 写入指令
        /// </summary>
        /// <param name="pSelectData"></param>
        /// <param name="pWriteData"></param>
        /// <returns></returns>
        public abstract Task<bool> Set_Write(byte[] pSelectData,string pWriteData);




    }
}