KpdData.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #! /usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. class KpdData:
  4. _row = -1
  5. _col = -1
  6. _row_ext = -1
  7. _col_ext = -1
  8. _gpioNum = -1
  9. _util = ''
  10. _homeKey = ''
  11. _keyType = ''
  12. _pressTime = -1
  13. _dinHigh = False
  14. _matrix = []
  15. _matrix_ext = []
  16. _useEint = False
  17. _downloadKeys = []
  18. _keyValueMap = {}
  19. _usedKeys = []
  20. _modeKeys = {'META':None, 'RECOVERY':None, 'FACTORY':None}
  21. def __init__(self):
  22. self.__varNames = []
  23. @staticmethod
  24. def set_row(row):
  25. KpdData._row = row
  26. @staticmethod
  27. def get_row():
  28. return KpdData._row
  29. @staticmethod
  30. def set_col(col):
  31. KpdData._col = col
  32. @staticmethod
  33. def get_col():
  34. return KpdData._col
  35. @staticmethod
  36. def set_row_ext(row):
  37. KpdData._row_ext = row
  38. @staticmethod
  39. def get_row_ext():
  40. return KpdData._row_ext
  41. @staticmethod
  42. def set_col_ext(col):
  43. KpdData._col_ext = col
  44. @staticmethod
  45. def get_col_ext():
  46. return KpdData._col_ext
  47. @staticmethod
  48. def set_matrix(matrix):
  49. KpdData._matrix = matrix
  50. @staticmethod
  51. def set_matrix_ext(matrix):
  52. KpdData._matrix_ext = matrix
  53. @staticmethod
  54. def get_matrix_ext():
  55. return KpdData._matrix_ext
  56. @staticmethod
  57. def get_matrix():
  58. return KpdData._matrix
  59. @staticmethod
  60. def set_downloadKeys(keys):
  61. KpdData._downloadKeys = keys
  62. @staticmethod
  63. def get_downloadKeys():
  64. return KpdData._downloadKeys
  65. @staticmethod
  66. def get_modeKeys():
  67. return KpdData._modeKeys
  68. @staticmethod
  69. def set_gpioNum(num):
  70. KpdData._gpioNum = num
  71. @staticmethod
  72. def get_gpioNum():
  73. return KpdData._gpioNum
  74. @staticmethod
  75. def set_utility(util):
  76. KpdData._util = util
  77. @staticmethod
  78. def get_utility():
  79. return KpdData._util
  80. @staticmethod
  81. def set_homeKey(home):
  82. KpdData._homeKey = home
  83. @staticmethod
  84. def get_homeKey():
  85. return KpdData._homeKey
  86. @staticmethod
  87. def set_useEint(flag):
  88. KpdData._useEint = flag
  89. @staticmethod
  90. def getUseEint():
  91. return KpdData._useEint
  92. @staticmethod
  93. def set_gpioDinHigh(flag):
  94. KpdData._dinHigh = flag
  95. @staticmethod
  96. def get_gpioDinHigh():
  97. return KpdData._dinHigh
  98. @staticmethod
  99. def set_pressTime(time):
  100. KpdData._pressTime = time
  101. @staticmethod
  102. def get_pressTime():
  103. return KpdData._pressTime
  104. @staticmethod
  105. def set_keyType(keyType):
  106. KpdData._keyType = keyType
  107. @staticmethod
  108. def get_keyType():
  109. return KpdData._keyType
  110. @staticmethod
  111. def get_keyVal(key):
  112. if key in KpdData._keyValueMap.keys():
  113. return KpdData._keyValueMap[key]
  114. return 0