|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.Peripheral
- {
- /// <summary>
- /// 外设基类
- /// </summary>
- public abstract class BasePeripheral : IPeripheral
- {
- /// <summary>
- /// 是否已连接
- /// </summary>
- public bool IsConnected { get; protected set; }
- /// <summary>
- /// 是否工作正常
- /// </summary>
- public bool IsWork { get; protected set; }
- /// <summary>
- /// 归属设备Id
- /// </summary>
- public int DeviceId { get; set; }
-
- /// <summary>
- /// 外设状态集合
- /// </summary>
- protected Dictionary<string, object> status = new Dictionary<string, object>();
-
- /// <summary>
- /// 初始化外设状态
- /// </summary>
- 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();
- }
- }
|