SignalInitTableCheck.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # -*- coding: UTF-8 -*-
  2. """
  3. @Project :Matrix_Check
  4. @File :SignalInitTableCheck.py
  5. @Author :haojiang
  6. @Date :2022/9/28 18:15
  7. """
  8. import csv
  9. from enum import Enum
  10. class TableColumnHeaderType(Enum):
  11. Signal = 0
  12. Type = 1
  13. Bit = 2
  14. App = 3
  15. AppValue = 4
  16. Raw = 5
  17. RawValue = 6
  18. Controller = 7
  19. Frame = 8
  20. PDU = 9
  21. class SignalInitValueTableCheck:
  22. Column_Need_Check = [TableColumnHeaderType.Signal.value,
  23. TableColumnHeaderType.Type.value,
  24. TableColumnHeaderType.Bit.value,
  25. TableColumnHeaderType.RawValue.value]
  26. Type_Mapping = {
  27. 'Boolean': bool,
  28. 'UInt': ,
  29. 'SInt': ,
  30. 'Composite':,
  31. 'Bytes':
  32. }
  33. def __init__(self, project_path: str):
  34. pass
  35. def check_row(self, row: list):
  36. pass
  37. def get_signal_init_value_table(self) -> list:
  38. pass
  39. def get_rx_tx_csv_file_name(self) -> tuple:
  40. pass
  41. def get_csv_data(self, file_name: str) -> list:
  42. with open(file_name, 'r') as csvfile:
  43. spamreader = csv.reader(csvfile, delimiter=',')
  44. is_header_readed = False
  45. table_data = list()
  46. for row in spamreader:
  47. if not is_header_readed:
  48. is_header_readed = True
  49. continue
  50. table_data.append([row[column] for column in SignalInitValueTableCheck.Column_Need_Check])
  51. return table_data
  52. if __name__ == '__main__':
  53. matrix_path = r'D:\01_Work\02_WP\EP39_EREV\branch\src\MatrixAssistant_V2.0\EP39_EREV_SIMU+_GW\20220729-qy1-EP39EREV_SIMU+_GW_Rx_初值表.csv'
  54. sc = SignalInitValueTableCheck()
  55. sc.get_csv_data(matrix_path)