using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BPASmartClient.Peripheral { /// /// 外设基类 /// public abstract class BasePeripheral : IPeripheral { /// /// 是否已连接 /// public bool IsConnected { get; protected set; } /// /// 是否工作正常 /// public bool IsWork { get; protected set; } /// /// 归属设备Id /// public int DeviceId { get; set; } /// /// 外设状态集合 /// protected Dictionary status = new Dictionary(); /// /// 初始化外设状态 /// protected abstract void InitStatus(); public object? GetStatus(string statusName) { if (status.ContainsKey(statusName)) return status[statusName]; return null; } public abstract void Start(); public abstract void Stop(); public abstract void Init(); } }