using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Peripheral
{
    /// <summary>
    /// 外设接口
    /// </summary>
    public interface IPeripheral
    {
        /// <summary>
        /// 是否已连接
        /// </summary>
        bool IsConnected { get; set; }
        /// <summary>
        /// 是否工作正常
        /// </summary>
        bool IsWork { get; set; }
        /// <summary>
        /// 设备ID
        /// </summary>
        int DeviceId { get; set; }
        /// <summary>
        /// 获取指定状态值
        /// </summary>
        /// <param name="statusName">状态名称</param>
        /// <returns>状态值</returns>
        object? GetStatus(string statusName);
        /// <summary>
        /// 获取所有状态
        /// </summary>
        /// <returns>状态值</returns>
        ConcurrentDictionary<string, object> GetAllStatus();

        /// <summary>
        /// 设备变量数据
        /// </summary>
        ObservableCollection<Variable> variables { get; set; }

        /// <summary>
        /// 通讯参数
        /// </summary>
        CommunicationPar communicationPar { get; set; }

        /// <summary>
        /// 设备数据，key：地址，value：数据
        /// </summary>
        ConcurrentDictionary<string, object> status { get; set; }

        /// <summary>
        /// 初始化
        /// </summary>
        void Init();
        /// <summary>
        /// 驱动开启
        /// </summary>
        void Start();
        /// <summary>
        /// 驱动停止
        /// </summary>
        void Stop();
    }
}
