globalvar.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. '''
  4. @文件 :globalvar.py
  5. @时间 :2022/01/22 10:11:23
  6. @作者 :None
  7. @版本 :1.0
  8. @说明 :全局变量
  9. '''
  10. from utils.can import MessageDeal
  11. from utils.com import ComMaster
  12. class SD:
  13. # 一二级BMS Can开关,Can开关开启后开始接收数据
  14. CAN_ON_OFF = False
  15. # 加载CAN连接驱动
  16. CAN_CONTROL = MessageDeal()
  17. # 加载串口连接驱动
  18. COM_CONTROL = ComMaster()
  19. EMV_ID = 1
  20. HIGH_DPI = 0
  21. class EmvState:
  22. def __init__(self):
  23. self.__emv_total = 0
  24. self.__emv_1 = 0
  25. self.__emv_2 = 0
  26. self.__emv_3 = 0
  27. self.__emv_4 = 0
  28. self.__emv_5 = 0
  29. self.__emv_6 = 0
  30. self.__emv_7 = 0
  31. self.__emv_8 = 0
  32. self.__emv_9 = 0
  33. @property
  34. def emv_total_state(self):
  35. return self.__emv_total
  36. @emv_total_state.setter
  37. def emv_total_state(self, value):
  38. self.__emv_total = value
  39. @property
  40. def emv_1_state(self):
  41. return self.__emv_1
  42. @emv_1_state.setter
  43. def emv_1_state(self, value):
  44. if isinstance(value, int):
  45. self.__emv_1 = value
  46. else:
  47. raise ValueError("'int' type need")
  48. @property
  49. def emv_2_state(self):
  50. return self.__emv_2
  51. @emv_2_state.setter
  52. def emv_2_state(self, value):
  53. if isinstance(value, int):
  54. self.__emv_2 = value
  55. else:
  56. raise ValueError("'int' type need")
  57. @property
  58. def emv_3_state(self):
  59. return self.__emv_3
  60. @emv_3_state.setter
  61. def emv_3_state(self, value):
  62. if isinstance(value, int):
  63. self.__emv_3 = value
  64. else:
  65. raise ValueError("'int' type need")
  66. @property
  67. def emv_4_state(self):
  68. return self.__emv_4
  69. @emv_4_state.setter
  70. def emv_4_state(self, value):
  71. if isinstance(value, int):
  72. self.__emv_4 = value
  73. else:
  74. raise ValueError("'int' type need")
  75. @property
  76. def emv_5_state(self):
  77. return self.__emv_5
  78. @emv_5_state.setter
  79. def emv_5_state(self, value):
  80. if isinstance(value, int):
  81. self.__emv_5 = value
  82. else:
  83. raise ValueError("'int' type need")
  84. @ property
  85. def emv_6_state(self):
  86. return self.__emv_6
  87. @emv_6_state.setter
  88. def emv_6_state(self, value):
  89. if isinstance(value, int):
  90. self.__emv_6 = value
  91. else:
  92. raise ValueError("'int' type need")
  93. @ property
  94. def emv_7_state(self):
  95. return self.__emv_7
  96. @emv_7_state.setter
  97. def emv_7_state(self, value):
  98. if isinstance(value, int):
  99. self.__emv_7 = value
  100. else:
  101. raise ValueError("'int' type need")
  102. @ property
  103. def emv_8_state(self):
  104. return self.__emv_8
  105. @emv_8_state.setter
  106. def emv_8_state(self, value):
  107. if isinstance(value, int):
  108. self.__emv_8 = value
  109. else:
  110. raise ValueError("'int' type need")
  111. @ property
  112. def emv_9_state(self):
  113. return self.__emv_9
  114. @emv_9_state.setter
  115. def emv_9_state(self, value):
  116. if isinstance(value, int):
  117. self.__emv_9 = value
  118. else:
  119. raise ValueError("'int' type need")