终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

52 行
1.2 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace BPASmartClient.Peripheral
  7. {
  8. /// <summary>
  9. /// 外设基类
  10. /// </summary>
  11. public abstract class BasePeripheral : IPeripheral
  12. {
  13. /// <summary>
  14. /// 是否已连接
  15. /// </summary>
  16. public bool IsConnected { get; protected set; }
  17. /// <summary>
  18. /// 是否工作正常
  19. /// </summary>
  20. public bool IsWork { get; protected set; }
  21. /// <summary>
  22. /// 归属设备Id
  23. /// </summary>
  24. public int DeviceId { get; set; }
  25. /// <summary>
  26. /// 外设状态集合
  27. /// </summary>
  28. protected Dictionary<string, object> status = new Dictionary<string, object>();
  29. /// <summary>
  30. /// 初始化外设状态
  31. /// </summary>
  32. protected abstract void InitStatus();
  33. public object? GetStatus(string statusName)
  34. {
  35. if (status.ContainsKey(statusName))
  36. return status[statusName];
  37. return null;
  38. }
  39. public abstract void Start();
  40. public abstract void Stop();
  41. public abstract void Init();
  42. }
  43. }