Module_LcmContro.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. #define EQUAL 0
  36. typedef unsigned char byte;
  37. struct SysConfigAndInfo *ShmSysConfigAndInfo;
  38. struct StatusCodeData *ShmStatusCodeData;
  39. struct FanModuleData *ShmFanModuleData;
  40. #define NO_DEFINE 255
  41. #define DEFAULT_AC_INDEX 2
  42. #define TIME_MAX_SEC 2592000 // 一個月,秒數
  43. #define POWER_MAX_KW 5000
  44. #define ENERGY_MAX_KWH 5000
  45. #define CMD_TITLE_1 0x5A
  46. #define CMD_TITLE_2 0xA5
  47. #define CMD_READ 0x80
  48. #define CMD_WRITE 0x81
  49. #define CMD_MULTI_WRITE 0x82
  50. #define CMD_MULTI_READ 0x83
  51. #define CMD_BACKLIGHT 0x01
  52. #define CMD_REGISTER 0x03
  53. enum _BATTERY_LEVEL_FOR_MAP
  54. {
  55. _BATTERY_LEVEL_FOR_MAP_EMP = 0x00,
  56. _BATTERY_LEVEL_FOR_MAP_LV1 = 0x01,
  57. _BATTERY_LEVEL_FOR_MAP_LV2 = 0x02,
  58. _BATTERY_LEVEL_FOR_MAP_LV3 = 0x03,
  59. _BATTERY_LEVEL_FOR_MAP_LV4 = 0x04,
  60. _BATTERY_LEVEL_FOR_MAP_LV5 = 0x05,
  61. };
  62. int _port;
  63. //char* pPortName = "/dev/ttyO2";
  64. char* pPortName = "/dev/ttyS3";
  65. char* moduleName = "DMT80480T070_09WT";
  66. byte _totalCount;
  67. byte acgunCount;
  68. struct ChargingInfoData *_chargingInfoData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
  69. struct ChargingInfoData *ac_chargingInfo[AC_QUANTITY];
  70. byte ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV5;
  71. byte isDiffStatus = false;
  72. byte isChangeBattMap = false;
  73. // 當前選擇的槍號
  74. short _currentPage = _LCM_NONE;
  75. short _oldPage = _LCM_NONE;
  76. byte _gunIndex = 0;
  77. bool _battery_display_ani = false;
  78. byte _curPage_index = 0;
  79. bool _page_reload = false;
  80. // LCM - HW
  81. byte _everyPageRollChange = 0;
  82. short __conn_status = 0x0030;
  83. short __ethernet_status = 0x0032;
  84. short __3G4G_status = 0x0036;
  85. short __3G4G_move_status = 0x0038;
  86. short __wifi_status = 0x003C;
  87. short __sel_gun_btn = 0x0040;
  88. short __ret_home_btn = 0x0042;
  89. short __stop_method_btn = 0x0044;
  90. short __qr_code = 0x0250;
  91. short __main_rfid = 0x0052;
  92. short __main_qr = 0x0054;
  93. short __main_app = 0x0056;
  94. short __plug_in_arrow = 0x0060;
  95. short __conn_line = 0x0066;
  96. short __gun_type_index = 0x0070;
  97. short __cmp_gun_type_index = 0x0080;
  98. short __qr_code_pre = 0x0280;
  99. short __batt_map_empty = 0x0090;
  100. short __conn_line_chag = 0x0096;
  101. short __batt_map = 0x0100;
  102. short __soc_value_charging = 0x0102;
  103. short __remain_time_map = 0x0106;
  104. short __power_map = 0x0108;
  105. short __energy_map = 0x010A;
  106. short __remain_time_tx = 0x0110;
  107. short __trp_remain_time_map = 0x0116;
  108. short __trp_power_map = 0x0118;
  109. short __trp_energy_map = 0x011A;
  110. short __output_eng_tx = 0x0120;
  111. short __total_out_eng_tx = 0x0130;
  112. short __conn_line_comp = 0x0140;
  113. short __charging_fee_map = 0x0146;
  114. short __charging_fee_tx = 0x0150;
  115. short __money_by_rate = 0x0200;
  116. short __money_rate = 0x0220;
  117. short __money_rate_map = 0x0230;
  118. short __csu_ver_string = 0x0300;
  119. short __csu_ver_value = 0x0310;
  120. short __fan_speed_string = 0x0390;
  121. short __fan_speed_value = 0x0400;
  122. short __dc1_ver_string = 0x0320;
  123. short __dc1_ver_value = 0x0330;
  124. short __dc2_ver_string = 0x0340;
  125. short __dc2_ver_value = 0x0350;
  126. short __eth0_ip_string = 0x0360;
  127. short __eth0_ip_value = 0x0370;
  128. short __sn_string = 0x0410;
  129. short __sn_value = 0x0420;
  130. // ICON ID
  131. byte _disappear = 0;
  132. byte _disconnect = 1;
  133. byte _connect = 2;
  134. byte _warning = 3;
  135. byte _arrow_dark = 4;
  136. byte _arrow_light = 5;
  137. byte _3G4G_disconnect = 6;
  138. byte _3G4G_connect = 7;
  139. byte _wifi_disconnect = 8;
  140. byte _wifi_connect = 9;
  141. byte _logo = 10;
  142. byte _conn_map1 = 11;
  143. byte _conn_map2 = 12;
  144. byte _sel_gun_btn = 13;
  145. byte _back_home_btn = 14;
  146. byte _stop_charging_btn = 15;
  147. byte _stop_charging_btn_scan = 16;
  148. byte _chademo_dark = 17;
  149. byte _ccs_dark = 18;
  150. byte _gbt_dark = 19;
  151. byte _actype_dark = 20;
  152. byte _chademo_light = 21;
  153. byte _ccs_light = 22;
  154. byte _gbt_light = 23;
  155. byte _actype_light = 24;
  156. byte _main_none_rfid = 25;
  157. byte _main_rfid = 26;
  158. byte _main_none_app = 27;
  159. byte _main_app = 28;
  160. byte _main_none_qr = 29;
  161. byte _main_qr = 30;
  162. byte _charging_map1 = 31;
  163. byte _charging_map2 = 32;
  164. byte _battery_empty = 33;
  165. byte _battery_cap_20 = 34;
  166. byte _battery_cap_40 = 35;
  167. byte _battery_cap_60 = 36;
  168. byte _battery_cap_80 = 37;
  169. byte _battery_cap_100 = 38;
  170. byte _battery_map = 39;
  171. byte _power_map = 40;
  172. byte _time_map = 41;
  173. byte _complete_map = 42;
  174. byte _battery_soc_20 = 43;
  175. byte _battery_soc_40 = 44;
  176. byte _battery_soc_60 = 45;
  177. byte _battery_soc_80 = 46;
  178. byte _battery_soc_100 = 47;
  179. byte _battery_eng_map = 48;
  180. byte _money_map = 49;
  181. byte _elapse_time_map = 50;
  182. byte _charging_money = 51;
  183. byte _ethernet_disconnect = 52;
  184. byte _ethernet_connect = 53;
  185. byte _chademo_dark_cmp = 54;
  186. byte _ccs_dark_cmp = 55;
  187. byte _gbt_dark_cmp = 56;
  188. byte _actype_dark_cmp = 57;
  189. byte _chademo_light_cmp = 58;
  190. byte _ccs_light_cmp = 59;
  191. byte _gbt_light_cmp = 60;
  192. byte _actype_light_cmp = 61;
  193. byte _logo_cmp = 62;
  194. byte _battery_eng_trp_map = 63;
  195. byte _money_trp_map = 64;
  196. byte _elapse_time_trp_map = 65;