Module_LcmControl.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. #ifndef MODULE_LCM_CTRL_H_
  2. #define MODULE_LCM_CTRL_H_
  3. #include <sys/time.h>
  4. #include <sys/timeb.h>
  5. #include <sys/types.h>
  6. #include <sys/stat.h>
  7. #include <sys/types.h>
  8. #include <sys/ioctl.h>
  9. #include <sys/socket.h>
  10. #include <sys/ipc.h>
  11. #include <sys/shm.h>
  12. #include <sys/mman.h>
  13. #include <linux/wireless.h>
  14. #include <arpa/inet.h>
  15. #include <netinet/in.h>
  16. #include <unistd.h>
  17. #include <stdarg.h>
  18. #include <stdio.h> /*標準輸入輸出定義*/
  19. #include <stdlib.h> /*標準函數庫定義*/
  20. #include <unistd.h> /*Unix 標準函數定義*/
  21. #include <fcntl.h> /*檔控制定義*/
  22. #include <termios.h> /*PPSIX 終端控制定義*/
  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 <dirent.h>
  30. #include "../Define/define.h"
  31. #include "../Config.h"
  32. //------------------------------------------------------------------------------
  33. #define DEFAULT_AC_INDEX (2)
  34. #define TIME_MAX_SEC (2592000) // 一個月,秒數
  35. #define POWER_MAX_KW (5000)
  36. #define ENERGY_MAX_KWH (5000)
  37. #define CMD_TITLE_1 (0x5A)
  38. #define CMD_TITLE_2 (0xA5)
  39. #define CMD_READ (0x80)
  40. #define CMD_WRITE (0x81)
  41. #define CMD_MULTI_WRITE (0x82)
  42. #define CMD_MULTI_READ (0x83)
  43. #define CMD_BACKLIGHT (0x01)
  44. #define CMD_REGISTER (0x03)
  45. //------------------------------------------------------------------------------
  46. enum _BATTERY_LEVEL_FOR_MAP {
  47. _BATTERY_LEVEL_FOR_MAP_EMP = 0x00,
  48. _BATTERY_LEVEL_FOR_MAP_LV1 = 0x01,
  49. _BATTERY_LEVEL_FOR_MAP_LV2 = 0x02,
  50. _BATTERY_LEVEL_FOR_MAP_LV3 = 0x03,
  51. _BATTERY_LEVEL_FOR_MAP_LV4 = 0x04,
  52. _BATTERY_LEVEL_FOR_MAP_LV5 = 0x05,
  53. };
  54. //#define NOODOE_QR_CODE_URL "https://ev-alpha-test.noodoe.com/station?id=" ////For Audi
  55. #define NOODOE_QR_CODE_URL "https://ev.noodoe.com/station?id=" ////For Audi
  56. #define CTEP_VERSION 002
  57. bool needReloadQr = true;
  58. bool _saftydetect = false;
  59. bool _isShow = false; //DS60-120 add
  60. uint8_t _showInformIndex = 0; //DS60-120 add
  61. int _port;
  62. //char* pPortName = "/dev/ttyO2";
  63. char* pPortName = "/dev/ttyS3";
  64. char* moduleName = "DMT80480T070_09WT";
  65. uint8_t _totalCount;
  66. uint8_t acgunCount;
  67. //struct ChargingInfoData *_chargingInfoData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
  68. //struct ChargingInfoData *ac_chargingInfo[AC_QUANTITY];
  69. uint8_t ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV5;
  70. uint8_t isDiffStatus = false;
  71. uint8_t isChangeBattMap = false;
  72. // 當前選擇的槍號
  73. #if defined DD360Audi
  74. short _currentPage = _LCM_SELECT_GUN;
  75. short _oldPage = _LCM_SELECT_GUN;
  76. #else
  77. short _currentPage = _LCM_NONE;
  78. short _oldPage = _LCM_NONE;
  79. #endif //defined DD360Audi
  80. uint8_t _gunIndex = 0;
  81. bool _wifi_conn_status = false;
  82. bool _battery_display_ani = false;
  83. uint8_t _curPage_index = 0;
  84. bool _page_reload = false;
  85. // LCM - HW
  86. uint8_t _everyPageRollChange = 0;
  87. short __logo = 0x0000;
  88. short __conn_status = 0x0030;
  89. short __ethernet_status = 0x0032;
  90. short __3G4G_status = 0x0036;
  91. short __3G4G_status1 = 0x0037;
  92. short __3G4G_move_status = 0x0038;
  93. short __wifi_status = 0x003C;
  94. short __sel_gun_btn = 0x0040;
  95. short __ret_home_btn = 0x0042;
  96. short __stop_method_btn = 0x0044;
  97. short __lcm_version = 0x004A;
  98. short __qr_code = 0x0250;
  99. short __main_rfid = 0x0052;
  100. short __main_qr = 0x0054;
  101. short __main_app = 0x0056;
  102. short __plug_in_arrow = 0x0060;
  103. short __conn_line = 0x0066;
  104. short __gun_type_index = 0x0070;
  105. short __cmp_gun_type_index = 0x0080; ////For Audi
  106. short __batt_map_empty = 0x0090; ////For Audi
  107. short __qr_code_pre = 0x0280;
  108. short __side_top = 0x0090;
  109. short __side_down = 0x0092;
  110. short __side_mid = 0x0094;
  111. short __conn_line_chag = 0x0096;
  112. short __batt_map = 0x0100;
  113. short __soc_value_charging = 0x0102;
  114. short __remain_time_map = 0x0106;
  115. short __power_map = 0x0108;
  116. short __energy_map = 0x010A;
  117. short __remain_time_tx = 0x0110;
  118. short __trp_remain_time_map = 0x0116;
  119. short __trp_power_map = 0x0118;
  120. short __trp_energy_map = 0x011A;
  121. short __output_eng_tx = 0x0120;
  122. short __total_out_eng_tx = 0x0130;
  123. short __conn_line_comp = 0x0140;
  124. short __charging_fee_map = 0x0146;
  125. short __charging_fee_tx = 0x0150;
  126. short __money_by_rate = 0x0200;
  127. short __money_rate = 0x0220;
  128. short __money_rate_map = 0x0230;
  129. //DS60-120 add
  130. short __csu_ver_string = 0x0300;
  131. short __csu_ver_value = 0x0310;
  132. short __fan_speed_string = 0x0390;
  133. short __fan_speed_value = 0x0400;
  134. short __dc1_ver_string = 0x0320;
  135. short __dc1_ver_value = 0x0330;
  136. short __dc2_ver_string = 0x0340;
  137. short __dc2_ver_value = 0x0350;
  138. short __eth0_ip_string = 0x0360;
  139. short __eth0_ip_value = 0x0370;
  140. short __sn_string = 0x0410;
  141. short __sn_value = 0x0420;
  142. //For Audi, for select gun
  143. short __left_gun_map = 0x0260;
  144. short __right_gun_map = 0x0262;
  145. short __add_chk_btn = 0x0264;
  146. //short __station_id = 0x0270;
  147. short __balance = 0x0270;
  148. short __remain_balance = 0x0280;
  149. short __custStationIdL1 = 0x0450;
  150. //short __custStationIdL2 = 0x0470;
  151. short _emergency_map = 0x011C;
  152. short __logo_cmp = 0x014A;
  153. // CTEP
  154. short __remain_time = 0x0110;
  155. short __present_power = 0x0120;
  156. short __present_energy = 0x0130;
  157. short __date_map = 0x0470;
  158. short __time_map = 0x0480;
  159. short __time_am_pm = 0x0489;
  160. short __Prepare_EnergyCost = 0x0500;
  161. short __Prepare_ParkingFee = 0x0510;
  162. short __Charge_EnergyCost = 0x0610;
  163. short __Charge_ParkingFee = 0x0620;
  164. short __Charge_TotalCost = 0x0630;
  165. short __Complete_EnergyCost = 0x0640;
  166. short __Complete_ParkingFee = 0x0650;
  167. short __Complete_TotalCost = 0x0660;
  168. short __Receipt_value = 0x0670;
  169. short __Animation_Price = 0x6010;
  170. short __receipt_backgroud = 0x0700;
  171. // ICON ID
  172. uint8_t _disappear = 0;
  173. uint8_t _disconnect = 1;
  174. uint8_t _connect = 2;
  175. uint8_t _warning = 3;
  176. uint8_t _arrow_dark = 4;
  177. uint8_t _arrow_light = 5;
  178. uint8_t _3G4G_disconnect = 6;
  179. uint8_t __3G4G_connect = 7;
  180. uint8_t _wifi_disconnect = 8;
  181. uint8_t _wifi_connect = 9;
  182. uint8_t _logo = 10;
  183. uint8_t _conn_map1 = 11;
  184. uint8_t _conn_map2 = 12;
  185. uint8_t _sel_gun_btn = 13;
  186. uint8_t _back_home_btn = 14;
  187. uint8_t _stop_charging_btn = 15;
  188. uint8_t _stop_charging_btn_scan = 16;
  189. uint8_t _chademo_dark = 17;
  190. uint8_t _ccs_dark = 18;
  191. uint8_t _gbt_dark = 19;
  192. uint8_t _actype_dark = 20;
  193. uint8_t _chademo_light = 21;
  194. uint8_t _ccs_light = 22;
  195. uint8_t _gbt_light = 23;
  196. uint8_t _actype_light = 24;
  197. uint8_t _main_none_rfid = 25;
  198. uint8_t _main_rfid = 26;
  199. uint8_t _main_none_app = 27;
  200. uint8_t _main_app = 28;
  201. uint8_t _main_none_qr = 29;
  202. uint8_t _main_qr = 30;
  203. uint8_t _charging_map1 = 31;
  204. uint8_t _charging_map2 = 32;
  205. uint8_t _battery_empty = 33;
  206. uint8_t _battery_cap_20 = 34;
  207. uint8_t _battery_cap_40 = 35;
  208. uint8_t _battery_cap_60 = 36;
  209. uint8_t _battery_cap_80 = 37;
  210. uint8_t _battery_cap_100 = 38;
  211. uint8_t _battery_map = 39;
  212. uint8_t _power_map = 40;
  213. uint8_t _time_map = 41;
  214. uint8_t _complete_map = 42;
  215. uint8_t _battery_soc_20 = 43;
  216. uint8_t _battery_soc_40 = 44;
  217. uint8_t _battery_soc_60 = 45;
  218. uint8_t _battery_soc_80 = 46;
  219. uint8_t _battery_soc_100 = 47;
  220. uint8_t _battery_eng_map = 48;
  221. uint8_t _money_map = 49;
  222. uint8_t _elapse_time_map = 50;
  223. uint8_t _charging_money = 51;
  224. //uint8_t _side_none_rfid = 52;
  225. //uint8_t _side_rfid = 53;
  226. //uint8_t _side_none_app = 54;
  227. //uint8_t _side_app = 55;
  228. //uint8_t _side_none_qr = 56;
  229. //uint8_t _side_qr = 57;
  230. uint8_t _eth_disconnect = 52; //58;
  231. uint8_t _eth_connect = 53; //59;
  232. uint8_t _chademo_dark_cmp = 54;
  233. uint8_t _ccs_dark_cmp = 55;
  234. uint8_t _gbt_dark_cmp = 56;
  235. uint8_t _actype_dark_cmp = 57;
  236. uint8_t _chademo_light_cmp = 58;
  237. uint8_t _ccs_light_cmp = 59;
  238. uint8_t _gbt_light_cmp = 60;
  239. uint8_t _actype_light_cmp = 61;
  240. uint8_t _logo_cmp = 62;
  241. uint8_t _battery_eng_trp_map = 63;
  242. uint8_t _money_trp_map = 64;
  243. uint8_t _elapse_time_trp_map = 65;
  244. #if defined DD360Audi
  245. ////For Audi
  246. uint8_t _left_gun_disable_map = 66;
  247. uint8_t _left_gun_enable_map = 67;
  248. uint8_t _right_gun_disable_map = 68;
  249. uint8_t _right_gun_enable_map = 69;
  250. uint8_t _select_gun_btn = 70;
  251. uint8_t _emergency_disable_map = 72;
  252. // For replug
  253. struct timespec showReplugStrTimer;
  254. struct timespec showFullTargetTimer;
  255. short __show_StatusString_value_1 = 0x0460;
  256. short __show_StatusString_value_2 = 0x0462;
  257. uint8_t _showfulltarget_1 = 73;
  258. uint8_t _showfulltarget_2 = 74;
  259. uint8_t _showReplugStr_1 = 75;
  260. uint8_t _showReplugStr_2 = 76;
  261. // Select Gun for Audi
  262. short __show_selectgun_value = 0x0464;
  263. uint8_t _showselectgun_left = 77;
  264. uint8_t _showselectgun_right = 78;
  265. // Wait for gun plugin Audi
  266. short __show_waitgunplug_value = 0x0468;
  267. uint8_t _showwaitgunplug_left = 80;
  268. uint8_t _showwaitgunplug_right = 81;
  269. #else
  270. short __show_handshark_value = 0x0464;
  271. short __show_GFD_value = 0x0466;
  272. short __show_precharge_value = 0x0468;
  273. uint8_t _receipt_bk = 67;
  274. uint8_t _show_handshark_dark = 67;
  275. uint8_t _show_handshark_light = 68;
  276. uint8_t _show_GFD_dark = 69;
  277. uint8_t _show_GFD_light = 70;
  278. uint8_t _show_precharge_dark = 71;
  279. uint8_t _show_precharge_light = 72;
  280. #endif
  281. #endif //MODULE_LCM_CTRL_H_