Module_LcmContro.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #include <sys/time.h>
  2. #include <sys/timeb.h>
  3. #include <sys/types.h>
  4. #include <sys/stat.h>
  5. #include <sys/types.h>
  6. #include <sys/ioctl.h>
  7. #include <sys/socket.h>
  8. #include <sys/ipc.h>
  9. #include <sys/shm.h>
  10. #include <sys/shm.h>
  11. #include <sys/mman.h>
  12. #include <linux/wireless.h>
  13. #include <arpa/inet.h>
  14. #include <netinet/in.h>
  15. #include <unistd.h>
  16. #include <stdarg.h>
  17. #include <stdio.h> /*標準輸入輸出定義*/
  18. #include <stdlib.h> /*標準函數庫定義*/
  19. #include <unistd.h> /*Unix 標準函數定義*/
  20. #include <fcntl.h> /*檔控制定義*/
  21. #include <termios.h> /*PPSIX 終端控制定義*/
  22. #include <errno.h> /*錯誤號定義*/
  23. #include <errno.h>
  24. #include <string.h>
  25. #include <time.h>
  26. #include <ctype.h>
  27. #include <ifaddrs.h>
  28. #include <stdbool.h>
  29. #include "../../define.h"
  30. #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
  31. #define PASS 1
  32. #define FAIL -1
  33. #define YES 1
  34. #define NO 0
  35. typedef unsigned char byte;
  36. struct SysConfigAndInfo *ShmSysConfigAndInfo;
  37. struct StatusCodeData *ShmStatusCodeData;
  38. struct FanModuleData *ShmFanModuleData;
  39. #define CMD_TITLE_1 0x5A
  40. #define CMD_TITLE_2 0xA5
  41. #define CMD_READ 0x80
  42. #define CMD_WRITE 0x81
  43. #define CMD_MULTI_WRITE 0x82
  44. #define CMD_MULTI_READ 0x83
  45. #define CMD_BACKLIGHT 0x01
  46. #define CMD_REGISTER 0x03
  47. #define GUN_COUNT CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY
  48. int _port;
  49. //char* pPortName = "/dev/ttyO2";
  50. char* pPortName = "/dev/ttyS3";
  51. char* moduleName = "DMT80480T070_09WT";
  52. byte _totalCount;
  53. struct ChargingInfoData *_chargingInfoData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
  54. // 當前選擇的槍號
  55. short _currentPage = _LCM_NONE;
  56. byte _gunIndex = 0;
  57. byte _idlePageRotate = 1;
  58. bool _backend_conn_status = false;
  59. bool _wifi_conn_status = false;
  60. // LCM - HW
  61. byte _everyPageRollChange = 0;
  62. short __conn_status = 0x0030;
  63. short __ethernet_status = 0x0036;
  64. short __wifi_status = 0x003C;
  65. short __sel_gun_btn = 0x0040;
  66. short __ret_home_btn = 0x0042;
  67. short __stop_method_btn = 0x0044;
  68. short __qr_code = 0x0050;
  69. short __plug_in_arrow = 0x0060;
  70. short __conn_line = 0x0066;
  71. short __gun_type_index = 0x0070;
  72. short __qr_code_pre = 0x0080;
  73. short __side_top = 0x0090;
  74. short __side_down = 0x0092;
  75. short __conn_line_chag = 0x0096;
  76. short __batt_map = 0x0100;
  77. short __soc_value_charging = 0x0102;
  78. short __remain_time_map = 0x0106;
  79. short __power_map = 0x0108;
  80. short __energy_map = 0x010A;
  81. short __remain_time_tx = 0x0110;
  82. short __output_eng_tx = 0x0120;
  83. short __total_out_eng_tx = 0x0130;
  84. short __conn_line_comp = 0x0140;
  85. // ICON ID
  86. byte _disappear = 0;
  87. byte _disconnect = 1;
  88. byte _connect = 2;
  89. byte _warning = 3;
  90. byte _arrow_dark = 4;
  91. byte _arrow_light = 5;
  92. byte _ethernet_disconnect = 6;
  93. byte _ethernet_connect = 7;
  94. byte _wifi_disconnect = 8;
  95. byte _wifi_connect = 9;
  96. byte _logo = 10;
  97. byte _conn_map1 = 11;
  98. byte _conn_map2 = 12;
  99. byte _sel_gun_btn = 13;
  100. byte _back_home_btn = 14;
  101. byte _stop_charging_btn = 15;
  102. byte _stop_charging_btn_scan = 16;
  103. byte _chademo_dark = 17;
  104. byte _ccs_dark = 18;
  105. byte _actype_dark = 19;
  106. byte _chademo_light = 20;
  107. byte _ccs_light = 21;
  108. byte _actype_light = 22;
  109. byte _side_rfid_1 = 23;
  110. byte _side_qr_1 = 24;
  111. byte _side_app_1 = 25;
  112. byte _side_rfid_2 = 26;
  113. byte _side_qr_2 = 27;
  114. byte _side_app_2 = 28;
  115. byte _charging_map1 = 29;
  116. byte _charging_map2 = 30;
  117. byte _battery_cap_20 = 31;
  118. byte _battery_cap_40 = 32;
  119. byte _battery_cap_60 = 33;
  120. byte _battery_cap_80 = 34;
  121. byte _battery_cap_100 = 35;
  122. byte _battery_map = 36;
  123. byte _power_map = 37;
  124. byte _time_map = 38;
  125. byte _complete_map = 39;
  126. byte _battery_soc_20 = 40;
  127. byte _battery_soc_40 = 41;
  128. byte _battery_soc_60 = 42;
  129. byte _battery_soc_80 = 43;
  130. byte _battery_soc_100 = 44;
  131. byte _battery_eng_map = 45;
  132. byte _money_map = 46;
  133. byte _elapse_time_map = 47;