终端一体化运控平台
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

58 wiersze
1.4 KiB

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