123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- #include <sys/time.h>
- #include <sys/timeb.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <sys/ioctl.h>
- #include <sys/socket.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #include <sys/mman.h>
- #include <linux/wireless.h>
- #include <arpa/inet.h>
- #include <netinet/in.h>
- #include <unistd.h>
- #include <stdarg.h>
- #include <stdio.h> /*標準輸入輸出定義*/
- #include <stdlib.h> /*標準函數庫定義*/
- #include <unistd.h> /*Unix 標準函數定義*/
- #include <fcntl.h> /*檔控制定義*/
- #include <termios.h> /*PPSIX 終端控制定義*/
- #include <errno.h> /*錯誤號定義*/
- #include <string.h>
- #include <time.h>
- #include <ctype.h>
- #include <ifaddrs.h>
- #include <stdbool.h>
- #include <dirent.h>
- #include "lcmComm_dgus.h"
- #include "cbmp.h"
- #include "../../define.h"
- #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
- #define PASS 1
- #define FAIL -1
- #define YES 1
- #define NO 0
- #define EQUAL 0
- typedef unsigned char byte;
- struct SysConfigAndInfo *ShmSysConfigAndInfo;
- struct StatusCodeData *ShmStatusCodeData;
- struct FanModuleData *ShmFanModuleData;
- struct DcCommonInformation *ShmDcCommonData;
- #define NO_DEFINE 255
- #define DEFAULT_AC_INDEX 2
- #define TIME_MAX_SEC 2592000 // 一個月,秒數
- #define POWER_MAX_KW 5000
- #define ENERGY_MAX_KWH 5000
- #define CMD_BACKLIGHT 0x01
- #define CMD_REGISTER 0x03
- //=======================================
- // Register Control type
- //=======================================
- #define REG_TYPE_CONTROL 0x00
- #define REG_TYPE_RAM 0x01
- #define REG_TYPE_SPECIAL_CONTROL 0x02
- enum _BATTERY_LEVEL_FOR_MAP
- {
- _BATTERY_LEVEL_FOR_MAP_EMP = 0x00,
- _BATTERY_LEVEL_FOR_MAP_LV1 = 0x01,
- _BATTERY_LEVEL_FOR_MAP_LV2 = 0x02,
- _BATTERY_LEVEL_FOR_MAP_LV3 = 0x03,
- _BATTERY_LEVEL_FOR_MAP_LV4 = 0x04,
- _BATTERY_LEVEL_FOR_MAP_LV5 = 0x05,
- };
- int Uart1Fd;
- //char* pPortName = "/dev/ttyO2";
- char* pPortName = "/dev/ttyS3";
- char* moduleName = "DMT80480T070_09WT";
- byte _totalCount;
- byte acgunCount;
- struct ChargingInfoData *_chargingInfoData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
- struct ChargingInfoData *ac_chargingInfo[AC_QUANTITY];
- byte ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV5;
- byte isDiffStatus = false;
- byte isChangeBattMap = false;
- byte _lcmGunSelect;
- byte _lcmGunStatus;
- // 當前選擇的槍號
- short _currentPage = _LCM_NONE;
- short _oldPage = _LCM_NONE;
- byte _gunIndex = 0;
- bool _battery_display_ani = false;
- byte _curPage_index = 0;
- bool _page_reload = false;
- byte QRCodeBuf[128];
- // LCM - HW
- byte _everyPageRollChange = 0;
- short __logo = 0x0000;
- short __conn_status = 0x0030;
- short __ethernet_status = 0x0032;
- short __3G4G_status = 0x0036;
- short __3G4G_move_status = 0x0038;
- short __wifi_status = 0x003C;
- short __sel_gun_btn = 0x0040;
- short __ret_home_btn = 0x0042;
- short __stop_method_btn = 0x0044;
- short __phihong_string = 0x0046;
- short __lcm_version = 0x004A;
- short __qr_code = 0x0250;
- short __main_rfid = 0x0052;
- short __main_qr = 0x0054;
- short __main_app = 0x0056;
- short __plug_in_arrow = 0x0060;
- short __conn_line = 0x0066;
- short __gun_type_index = 0x0070;
- short __gun_type_index_jp = 0x0076;
- short __cmp_gun_type_index = 0x0080;
- short __cmp_gun_type_index_jp = 0x0086;
- short __qr_code_pre = 0x0280;
- short __batt_map_empty = 0x0090;
- //LW_tpc plug detect
- short __tpc_detect_map = 0x0092;
- short __conn_line_chag = 0x0096;
- short __conn1_cabinet_charging = 0x0098;
- short __conn1_cabinet_complete = 0x009A;
- short __batt_map = 0x0100;
- short __soc_value_charging = 0x0102;
- short __remain_time_map = 0x0106;
- short __power_map = 0x0108;
- short __energy_map = 0x010A;
- short __remain_time_tx = 0x0110;
- short __trp_remain_time_map = 0x0116;
- short __trp_power_map = 0x0118;
- short __trp_energy_map = 0x011A;
- short __output_eng_tx = 0x0120;
- short __total_out_eng_tx = 0x0130;
- short __conn_line_comp = 0x0140;
- short __charging_fee_map = 0x0146;
- short __logo_cmp = 0x014A;
- short __charging_fee_tx = 0x0150;
- short __money_by_rate = 0x0200;
- short __money_rate = 0x0220;
- short __money_rate_map = 0x0230;
- short __csu_ver_string = 0x0300;
- short __csu_ver_value = 0x0310;
- short __fan_speed_string = 0x0390;
- short __fan_speed_value = 0x0400;
- short __dc1_ver_string = 0x0320;
- short __dc1_ver_value = 0x0330;
- short __dc2_ver_string = 0x0340;
- short __dc2_ver_value = 0x0350;
- short __eth0_ip_string = 0x0360;
- short __eth0_ip_value = 0x0370;
- short __sn_string = 0x0410;
- short __sn_value = 0x0420;
- short __sys_date_value = 0x0470;
- short __sys_time_value = 0x0480;
- short __sys_period_value = 0x0489;
- short __Energy_Cost_complete = 0x0500;
- short __Parking_Fee_complete = 0x0510;
- short __Total_Cost_complete = 0x0520;
- short __ctep_time_string = 0x0530;
- short __ctep_energy_string = 0x0540;
- short __ctep_energy_mon_string = 0x0550;
- short __ctep_packing_mon_string = 0x0560;
- short __ctep_total_mon_string = 0x0570;
- short __Energy_Cost_charging = 0x0610;
- short __Parking_Fee_charging = 0x0620;
- short __Total_Cost_charging = 0x0630;
- short __Energy_Cost_comp = 0x0640;
- short __Parking_Fee_comp = 0x0650;
- short __Total_Cost_comp = 0x0660;
- short __receipt_qrcode = 0x0670;
- short __receipt_qrcode_bg = 0x0700;
- short _ctep_energy_mon_comm = 0x0702;
- short _ctep_packing_mon_comm = 0x0704;
- short _ctep_total_mon_comm = 0x0706;
- short _ctep_energy_mon_chg = 0x0708;
- short _ctep_packing_mon_chg = 0x070A;
- short _ctep_total_mon_chg = 0x070C;
- short _ctep_energy_mon_comp = 0x070E;
- short _ctep_packing_mon_comp = 0x0710;
- short _ctep_total_mon_comp = 0x0712;
- short __scroll_display_value = 0x6010;
- // ICON ID
- byte _disappear = 0;
- byte _disconnect = 1;
- byte _connect = 2;
- byte _warning = 3;
- byte _arrow_dark = 4;
- byte _arrow_light = 5;
- byte _3G4G_disconnect = 6;
- byte _3G4G_connect = 7;
- byte _wifi_disconnect = 8;
- byte _wifi_connect = 9;
- byte _logo = 10;
- byte _conn_map1 = 11;
- byte _conn_map2 = 12;
- byte _sel_gun_btn = 13;
- byte _back_home_btn = 14;
- byte _stop_charging_btn = 15;
- byte _stop_charging_btn_scan = 16;
- byte _chademo_dark = 17;
- byte _ccs_dark = 18;
- byte _gbt_dark = 19;
- byte _actype_dark = 20;
- byte _chademo_light = 21;
- byte _ccs_light = 22;
- byte _gbt_light = 23;
- byte _actype_light = 24;
- byte _main_none_rfid = 25;
- byte _main_rfid = 26;
- byte _main_none_app = 27;
- byte _main_app = 28;
- byte _main_none_qr = 29;
- byte _main_qr = 30;
- byte _charging_map1 = 31;
- byte _charging_map2 = 32;
- byte _battery_empty = 33;
- byte _battery_cap_20 = 34;
- byte _battery_cap_40 = 35;
- byte _battery_cap_60 = 36;
- byte _battery_cap_80 = 37;
- byte _battery_cap_100 = 38;
- byte _battery_map = 39;
- byte _power_map = 40;
- byte _time_map = 41;
- byte _complete_map = 42;
- byte _battery_soc_20 = 43;
- byte _battery_soc_40 = 44;
- byte _battery_soc_60 = 45;
- byte _battery_soc_80 = 46;
- byte _battery_soc_100 = 47;
- byte _battery_eng_map = 48;
- byte _money_map = 49;
- byte _elapse_time_map = 50;
- byte _charging_money = 51;
- byte _ethernet_disconnect = 52;
- byte _ethernet_connect = 53;
- byte _chademo_dark_cmp = 54;
- byte _ccs_dark_cmp = 55;
- byte _gbt_dark_cmp = 56;
- byte _actype_dark_cmp = 57;
- byte _chademo_light_cmp = 58;
- byte _ccs_light_cmp = 59;
- byte _gbt_light_cmp = 60;
- byte _actype_light_cmp = 61;
- byte _logo_cmp = 62;
- byte _battery_eng_trp_map = 63;
- byte _money_trp_map = 64;
- byte _elapse_time_trp_map = 65;
- byte _phihong_string_map = 66;
- byte _ctep_qr_background = 67;
- byte _ctep_packing_mon_comm_map = 68;
- byte _ctep_energy_mon_comm_map = 69;
- byte _ctep_total_mon_comm_map = 70;
- byte _ctep_packing_mon_comp_map = 71;
- byte _ctep_energy_mon_comp_map = 72;
- byte _ctep_total_mon_comp_map = 73;
- byte _ctep_packing_mon_chg_map= 74;
- byte _ctep_energy_mon_chg_map = 75;
- byte _ctep_total_mon_chg_map = 76;
- //LW_tpc plug detect
- byte _tpc_start_detect_btn = 77;
- byte _tpc_wait_plugin_btn= 78;
- byte _n1_jp_cha_dark = 96;
- byte _n2_jp_cha_dark = 97;
- byte _n1_jp_cha_light = 98;
- byte _n2_jp_cha_light = 99;
- byte _n1_jp_cha_dark_cmp = 100;
- byte _n2_jp_cha_dark_cmp = 101;
- byte _n1_jp_cha_light_cmp = 102;
- byte _n2_jp_cha_light_cmp = 103;
- byte _conn1_cabinet_double_chg_map = 104;
- byte _conn2_cabinet_single_chg_map = 105;
- byte _conn1_cabinet_double_cop_map = 106;
- byte _conn2_cabinet_single_cop_map = 107;
|