فهرست منبع

[Improve][DD360Audi Project]
2020.12.10 / Jerry Wang

Actions:
1. Improve DD360Audi Project
2. add unselected guns can remote start.
3. add gun inoperative LED lights up red.

Files:
1. As follow commit history

Image version : V1.00.00.0000.00
Image checksum: XXXXXXXX

Jerry_Wang 4 سال پیش
والد
کامیت
19d94d0f38
48فایلهای تغییر یافته به همراه10444 افزوده شده و 8861 حذف شده
  1. 78 0
      EVSE/Projects/DD360Audi/Apps/AudiCust.h
  2. 149 162
      EVSE/Projects/DD360Audi/Apps/Config.h
  3. BIN
      EVSE/Projects/DD360Audi/Apps/DoComm
  4. BIN
      EVSE/Projects/DD360Audi/Apps/FactoryConfig
  5. 105 63
      EVSE/Projects/DD360Audi/Apps/Makefile
  6. BIN
      EVSE/Projects/DD360Audi/Apps/Module_EvComm
  7. 2779 3397
      EVSE/Projects/DD360Audi/Apps/Module_EvComm.c
  8. BIN
      EVSE/Projects/DD360Audi/Apps/Module_EventLogging
  9. BIN
      EVSE/Projects/DD360Audi/Apps/Module_InternalComm
  10. 671 744
      EVSE/Projects/DD360Audi/Apps/Module_InternalComm.c
  11. 213 181
      EVSE/Projects/DD360Audi/Apps/Module_LcmContro.h
  12. BIN
      EVSE/Projects/DD360Audi/Apps/Module_LcmControl
  13. 1267 1182
      EVSE/Projects/DD360Audi/Apps/Module_LcmControl.c
  14. BIN
      EVSE/Projects/DD360Audi/Apps/Module_PrimaryComm
  15. 396 448
      EVSE/Projects/DD360Audi/Apps/Module_PrimaryComm.c
  16. 1826 0
      EVSE/Projects/DD360Audi/Apps/ReDoComm.c
  17. 203 0
      EVSE/Projects/DD360Audi/Apps/ReDoComm.h
  18. BIN
      EVSE/Projects/DD360Audi/Apps/ReadCmdline
  19. 475 590
      EVSE/Projects/DD360Audi/Apps/ReadCmdline.c
  20. BIN
      EVSE/Projects/DD360Audi/Apps/UnsafetyOutputTask
  21. 1 1
      EVSE/Projects/DD360Audi/Apps/init.sh
  22. 1060 1114
      EVSE/Projects/DD360Audi/Apps/internalComm.c
  23. 24 0
      EVSE/Projects/DD360Audi/Apps/kill.sh
  24. BIN
      EVSE/Projects/DD360Audi/Apps/main
  25. 597 462
      EVSE/Projects/DD360Audi/Apps/main.c
  26. 37 37
      EVSE/Projects/DD360Audi/Apps/timeout.h
  27. BIN
      EVSE/Projects/DD360Audi/AudiUI/DWIN_SET.7z
  28. BIN
      EVSE/Projects/DD360Audi/Images/MLO
  29. BIN
      EVSE/Projects/DD360Audi/Images/am335x-evm.dtb
  30. BIN
      EVSE/Projects/DD360Audi/Images/ramdisk.gz
  31. BIN
      EVSE/Projects/DD360Audi/Images/u-boot-spl.bin
  32. BIN
      EVSE/Projects/DD360Audi/Images/u-boot.img
  33. BIN
      EVSE/Projects/DD360Audi/Images/zImage
  34. BIN
      EVSE/Projects/DD360Audi/output/DoComm
  35. BIN
      EVSE/Projects/DD360Audi/output/FactoryConfig
  36. BIN
      EVSE/Projects/DD360Audi/output/Module_EvComm
  37. BIN
      EVSE/Projects/DD360Audi/output/Module_EventLogging
  38. BIN
      EVSE/Projects/DD360Audi/output/Module_InternalComm
  39. BIN
      EVSE/Projects/DD360Audi/output/Module_LcmControl
  40. BIN
      EVSE/Projects/DD360Audi/output/Module_PrimaryComm
  41. BIN
      EVSE/Projects/DD360Audi/output/ReadCmdline
  42. BIN
      EVSE/Projects/DD360Audi/output/UnsafetyOutputTask
  43. 11 0
      EVSE/Projects/DD360Audi/output/init.sh
  44. 37 0
      EVSE/Projects/DD360Audi/output/kill.sh
  45. BIN
      EVSE/Projects/DD360Audi/output/main
  46. 45 0
      EVSE/Projects/DD360Audi/output/sftp-config.json
  47. 1 0
      EVSE/Projects/DD360Audi/output/web.sh
  48. 469 480
      EVSE/Projects/define.h

+ 78 - 0
EVSE/Projects/DD360Audi/Apps/AudiCust.h

@@ -0,0 +1,78 @@
+#ifndef _AUDI_CUSTOM_H_
+#define _AUDI_CUSTOM_H_
+
+#include <stdint.h>
+
+//------------------------------------------------------------------------------
+//--- //For Audi for Audi customization ---
+//------------------------------------------------------------------------------
+#define ShmAudiCustInfoKey                      1014
+
+#define SEL_GUN_RELEASE                         0x00
+#define SEL_GUN_CONFIRM                         0x01
+#define SEL_GUN_ATHOR                           0x02
+#define SEL_GUN_PLUG_IT                         0x03
+//#define SEL_GUN_CHARGING                        0x04
+//#define SEL_GUN_CHARGING_COMP                   0x05
+
+#define LEFT_GUN_NUM                            0
+#define RIGHT_GUN_NUM                           1
+
+#define SEL_GUN_TIMEOUT                         120
+
+#define DESTROY_ALL_SEL                         0x03
+
+#define FAIL_BALANCE_PRICES                     -65535.00
+
+//------------------------------------------------------------------------------
+//--- remote control ---
+//------------------------------------------------------------------------------
+//#define RT_NON_ACTION                           0x00
+//#define RT_HARDWARE_REBOOT                      0x01
+//#define RT_SOFTWARE_RESTART                     0x02
+
+//------------------------------------------------------------------------------
+typedef struct StSelGunInfo {
+    uint8_t LeftGun;
+    uint8_t RightGun;
+    uint8_t Reserved[2];
+} SelGunInfo;
+
+typedef struct StPricesInfo {
+    //uint8_t Currency;
+    float UserPrices;           //unit = 0.01 dollar, value / 100
+    //float TotalCost;            //unit = 0.01 dollar, value / 100
+    float Balance;              //unit = 0.01 dollar, value / 100
+    //float DefaultPrices;        //unit = 0.01 dollar, value / 100
+    uint8_t Reserved[4];
+} PricesInfo;
+
+//typedef struct StOperativeInfo {
+//    uint8_t ChangeReq;
+//    uint8_t ConnectorID;
+//    uint8_t AvailabilityReq;
+//    uint8_t Reserved;
+//} OperativeInfo;
+
+//typedef struct StStartCharge {
+//    uint8_t ConnectorID;
+//    uint8_t Status;
+//    uint8_t Reserved[2];
+//} StartCharge;
+
+typedef struct StRemoteSetup {
+    //uint8_t Execution;
+    uint16_t ConnectionTimeout;
+    //float DefaultPrices;
+    //OperativeInfo Operative;
+    //StartCharge StartCharge;
+    uint8_t Reserved[2];
+} RemoteSetup;
+
+typedef struct StAudiCustInfo {
+    SelGunInfo SelGunInfo;
+    PricesInfo PricesInfo[2];
+    RemoteSetup RemoteSetup;
+} AudiCustInfo;
+
+#endif /* _AUDI_CUSTOM_H_ */

+ 149 - 162
EVSE/Projects/DD360Audi/Apps/Config.h

@@ -7,203 +7,190 @@
 #ifndef CONFIG_H_
 #define CONFIG_H_
 
-typedef unsigned char			byte;
-
-#define TOTAL_QUANTITY_GUN			4				//Max Count
-
-#define MODE_BOOT					0
-#define MODE_IDLE					1
-#define MODE_AUTHORIZING			2
-#define MODE_REASSIGN_CHECK			3
-#define MODE_REASSIGN				4
-#define MODE_PRECHARGE				5
-#define MODE_PREPARE_FOR_EV			6
-#define MODE_PREPARE_FOR_EVSE		7
-#define MODE_CHARGING				8
-#define MODE_TERMINATING			9
-#define MODE_COMPLETE				10
-#define MODE_ALARM					11
-#define MODE_FAULT					12
-#define MODE_RESERVATION			13
-#define MODE_BOOKING				14
-#define MODE_MAINTAIN				15
-#define MODE_DEBUG					16
-#define MODE_CCS_PRECHARGE_STEP0	17 	// ready for ccs precharge processing, For D+ relay to precharge relay
-#define MODE_CCS_PRECHARGE_STEP1	18	// waitting for ev board inform to enter to charging, For precharge relay to D+ relay
-#define MODE_UPDATE					19
-
-#define GFD_WAIT			0
-#define GFD_PASS			1
-#define GFD_FAIL			2
-#define GFD_WARNING			3
-
-#define PRECHARGE_WAIT				0
-#define PRECHARGE_READY				1
-#define PRECHARGE_PRERELAY_PASS		2
-#define PRECHARGE_CHARELAY_PASS		3
-
-#define BOOTTING			0
-#define BOOT_COMPLETE		1
-
-enum _SYSTEM_STATUS
-{
-	S_BOOTING = 						0,
+typedef unsigned char byte;
+
+#define TOTAL_QUANTITY_GUN                      4               //Max Count
+
+#define MODE_BOOT                               0
+#define MODE_IDLE                               1
+#define MODE_AUTHORIZING                        2
+#define MODE_REASSIGN_CHECK                     3
+#define MODE_REASSIGN                           4
+#define MODE_PRECHARGE                          5
+#define MODE_PREPARE_FOR_EV                     6
+#define MODE_PREPARE_FOR_EVSE                   7
+#define MODE_CHARGING                           8
+#define MODE_TERMINATING                        9
+#define MODE_COMPLETE                           10
+#define MODE_ALARM                              11
+#define MODE_FAULT                              12
+#define MODE_RESERVATION                        13
+#define MODE_BOOKING                            14
+#define MODE_MAINTAIN                           15
+#define MODE_DEBUG                              16
+#define MODE_CCS_PRECHARGE_STEP0                17  // ready for ccs precharge processing, For D+ relay to precharge relay
+#define MODE_CCS_PRECHARGE_STEP1                18  // waitting for ev board inform to enter to charging, For precharge relay to D+ relay
+#define MODE_UPDATE                             19
+
+#define GFD_WAIT                                0
+#define GFD_PASS                                1
+#define GFD_FAIL                                2
+#define GFD_WARNING                             3
+
+#define PRECHARGE_WAIT                          0
+#define PRECHARGE_READY                         1
+#define PRECHARGE_PRERELAY_PASS                 2
+#define PRECHARGE_CHARELAY_PASS                 3
+
+#define BOOTTING                                0
+#define BOOT_COMPLETE                           1
+
+enum _SYSTEM_STATUS {
+    S_BOOTING = 0,
     S_IDLE,
-	S_AUTHORIZING,
-	S_REASSIGN_CHECK,
-	S_REASSIGN,
-	S_PREPARNING,
-	S_PREPARING_FOR_EV,
-	S_PREPARING_FOR_EVSE,
+    S_AUTHORIZING,
+    S_REASSIGN_CHECK,
+    S_REASSIGN,
+    S_PREPARNING,
+    S_PREPARING_FOR_EV,
+    S_PREPARING_FOR_EVSE,
     S_CHARGING,
-	S_TERMINATING,
-	S_COMPLETE,
-	S_ALARM,
-	S_FAULT,
-	S_RESERVATION,
-	S_BOOKING,
-	S_MAINTAIN,
-	S_DEBUG,
-	S_CCS_PRECHARGE_ST0,
-	S_CCS_PRECHARGE_ST1,
-	S_UPDATE,
-	S_NONE,
+    S_TERMINATING,
+    S_COMPLETE,
+    S_ALARM,
+    S_FAULT,
+    S_RESERVATION,
+    S_BOOKING,
+    S_MAINTAIN,
+    S_DEBUG,
+    S_CCS_PRECHARGE_ST0,
+    S_CCS_PRECHARGE_ST1,
+    S_UPDATE,
+    S_NONE,
 };
 
-enum _AC_SYSTEM_STATUS
-{
-	AC_SYS_NONE = 	0,
-	AC_SYS_A,
-	AC_SYS_B,
-	AC_SYS_C,
-	AC_SYS_D,
-	AC_SYS_E
+enum _AC_SYSTEM_STATUS {
+    AC_SYS_NONE = 0,
+    AC_SYS_A,
+    AC_SYS_B,
+    AC_SYS_C,
+    AC_SYS_D,
+    AC_SYS_E,
 };
 
-enum _GUN_TYPE
-{
-	_Type_Chademo = 		0,
-	_Type_CCS_2,
-	_Type_GB,
-	_Type_AC,
+enum _GUN_TYPE {
+    _Type_Chademo = 0,
+    _Type_CCS_2,
+    _Type_GB,
+    _Type_AC,
 };
 
 //enum _LCM_INDEX
 //{
-//	_LCM_INIT = 			0x00,
-//	_LCM_IDLE = 			0x01,
-//	_LCM_AUTHORIZING = 		0x04,
-//	_LCM_AUTHORIZ_COMP = 	0x05,
-//	_LCM_AUTHORIZ_FAIL = 	0x06,
-//	_LCM_WAIT_FOR_PLUG = 	0x07,
-//	_LCM_PRE_CHARGE = 		0x08,
-//	_LCM_CHARGING = 		0x09,
-//	_LCM_COMPLETE = 		0x0A,
-//	_LCM_FIX = 				0x0B,
-//	_LCM_NONE = 			0xFF,
+//  _LCM_INIT =             0x00,
+//  _LCM_IDLE =             0x01,
+//  _LCM_AUTHORIZING =      0x04,
+//  _LCM_AUTHORIZ_COMP =    0x05,
+//  _LCM_AUTHORIZ_FAIL =    0x06,
+//  _LCM_WAIT_FOR_PLUG =    0x07,
+//  _LCM_PRE_CHARGE =       0x08,
+//  _LCM_CHARGING =         0x09,
+//  _LCM_COMPLETE =         0x0A,
+//  _LCM_FIX =              0x0B,
+//  _LCM_NONE =             0xFF,
 //};
 
-enum _LCM_INDEX
-{
-	_LCM_INIT = 			0x00,
-	_LCM_IDLE = 			0x01,
-	_LCM_AUTHORIZING = 		0x02,
-	_LCM_AUTHORIZ_COMP = 	0x03,
-	_LCM_AUTHORIZ_FAIL = 	0x04,
-	_LCM_WAIT_FOR_PLUG = 	0x05,
-	_LCM_PRE_CHARGE = 		0x06,
-	_LCM_CHARGING = 		0x07,
-	_LCM_COMPLETE = 		0x08,
-	_LCM_FIX = 				0x09,
-	_LCM_NONE = 			0xFF,
+enum _LCM_INDEX {
+    _LCM_INIT          = 0x00,
+    _LCM_IDLE          = 0x01,
+    _LCM_AUTHORIZING   = 0x02,
+    _LCM_AUTHORIZ_COMP = 0x03,
+    _LCM_AUTHORIZ_FAIL = 0x04,
+    _LCM_WAIT_FOR_PLUG = 0x05,
+    _LCM_PRE_CHARGE    = 0x06,
+    _LCM_CHARGING      = 0x07,
+    _LCM_COMPLETE      = 0x08,
+    _LCM_FIX           = 0x09,
+    _LCM_SELECT_GUN    = 0x0A,
+    _LCM_NONE          = 0xFF,
 };
 
-enum _SELF_TEST_SEQ
-{
-	_STEST_VERSION = 0x00,
-	_STEST_AC_CONTACTOR = 0x01,
-	_STEST_PSU_DETECT = 0x02,
-	_STEST_PSU_CAP = 0x03,
-	_STEST_FAIL = 0x04,
-	_STEST_COMPLETE = 0xEE,
+enum _SELF_TEST_SEQ {
+    _STEST_VERSION      = 0x00,
+    _STEST_AC_CONTACTOR = 0x01,
+    _STEST_PSU_DETECT   = 0x02,
+    _STEST_PSU_CAP      = 0x03,
+    _STEST_FAIL         = 0x04,
+    _STEST_COMPLETE     = 0xEE,
 };
 
-enum _MODULE_PSU_WORK_STEP
-{
-	INITIAL_START 		= 		0,
-	GET_PSU_COUNT 		= 		1,
-	GET_SYS_CAP			=		2,
-	BOOTING_COMPLETE 	= 		3,
+enum _MODULE_PSU_WORK_STEP {
+    INITIAL_START    = 0,
+    GET_PSU_COUNT    = 1,
+    GET_SYS_CAP      = 2,
+    BOOTING_COMPLETE = 3,
 
-	_WORK_CHARGING 		= 		10,
+    _WORK_CHARGING   = 10,
 
-	_TEST_MODE			=		20,
+    _TEST_MODE       = 20,
 
-	_NO_WORKING			= 		254,
-	_INIT_PSU_STATUS	= 		255
+    _NO_WORKING      = 254,
+    _INIT_PSU_STATUS = 255,
 };
 
-enum _OFFLINE_POLICY
-{
-	_OFFLINE_POLICY_LOCAL_LIST = 0x00,
-	_OFFLINE_POLICY_PHIHONG_RFID_TAG = 0x01,
-	_OFFLINE_POLICY_FREE_CHARGING = 0x02,
-	_OFFLINE_POLICY_NO_CHARGING = 0x03,
+enum _OFFLINE_POLICY {
+    _OFFLINE_POLICY_LOCAL_LIST       = 0x00,
+    _OFFLINE_POLICY_PHIHONG_RFID_TAG = 0x01,
+    _OFFLINE_POLICY_FREE_CHARGING    = 0x02,
+    _OFFLINE_POLICY_NO_CHARGING      = 0x03,
 };
 
-enum _REASSIGNED_RESOURCE_STEP
-{
-	_REASSIGNED_NONE = 				0,	//
-	_REASSIGNED_PREPARE_M_TO_A =	1,	// 系統收到需要降載需求 (輸出總電流降低),PSU Task 收到將狀態切換至下個狀態
-	_REASSIGNED_GET_NEW_CAP = 		2,	// 充電中的重新取得屬於自己火線上的總能量並透過小板通知車端 - 超過10秒直接跳下一步
-	_REASSIGNED_ADJUST_M_TO_A = 	3,	// 模塊重新分配完成
-	_REASSIGNED_RELAY_M_TO_A =		4,	// 切斷橋接的 Relay
-
-	_REASSIGNED_PREPARE_A_TO_M = 	11,
-	_REASSIGNED_ADJUST_A_TO_M = 	12, // 模塊升壓
-	_REASSIGNED_RELAY_A_TO_M = 		13,	// 搭接橋接的 Relay
-	_REASSIGNED_WAITING = 			14,
-	_REASSIGNED_COMP = 				15
+enum _REASSIGNED_RESOURCE_STEP {
+    _REASSIGNED_NONE           = 0,  //
+    _REASSIGNED_PREPARE_M_TO_A = 1,  // 系統收到需要降載需求 (輸出總電流降低),PSU Task 收到將狀態切換至下個狀態
+    _REASSIGNED_GET_NEW_CAP    = 2,  // 充電中的重新取得屬於自己火線上的總能量並透過小板通知車端 - 超過10秒直接跳下一步
+    _REASSIGNED_ADJUST_M_TO_A  = 3,  // 模塊重新分配完成
+    _REASSIGNED_RELAY_M_TO_A   = 4,  // 切斷橋接的 Relay
+
+    _REASSIGNED_PREPARE_A_TO_M = 11,
+    _REASSIGNED_ADJUST_A_TO_M  = 12, // 模塊升壓
+    _REASSIGNED_RELAY_A_TO_M   = 13, // 搭接橋接的 Relay
+    _REASSIGNED_WAITING        = 14,
+    _REASSIGNED_COMP           = 15,
 };
 
-enum _MAIN_CHARGING_MODE
-{
-	_MAIN_CHARGING_MODE_MAX = 0,
-	_MAIN_CHARGING_MODE_AVER = 1,
+enum _MAIN_CHARGING_MODE {
+    _MAIN_CHARGING_MODE_MAX  = 0,
+    _MAIN_CHARGING_MODE_AVER = 1,
 };
 
-enum _EXTRA_ERR_PROCESS
-{
-	_EXTRA_ERR_PROCESS_NONE = 0,
-	_EXTRA_ERR_PROCESS_INUVP = 1,
-	_EXTRA_ERR_PROCESS_INOVP = 2
+enum _EXTRA_ERR_PROCESS {
+    _EXTRA_ERR_PROCESS_NONE  = 0,
+    _EXTRA_ERR_PROCESS_INUVP = 1,
+    _EXTRA_ERR_PROCESS_INOVP = 2,
 };
 
-enum _CHARGER_TYPE
-{
-	_CHARGER_TYPE_IEC = 0,
-	_CHARGER_TYPE_UL = 1,
+enum _CHARGER_TYPE {
+    _CHARGER_TYPE_IEC = 0,
+    _CHARGER_TYPE_UL  = 1,
 };
 
-enum _SYS_WIFI_MODE
-{
-	_SYS_WIFI_MODE_DISABLE = 0,
-	_SYS_WIFI_MODE_STATION = 1,
-	_SYS_WIFI_MODE_AP = 2
+enum _SYS_WIFI_MODE {
+    _SYS_WIFI_MODE_DISABLE = 0,
+    _SYS_WIFI_MODE_STATION = 1,
+    _SYS_WIFI_MODE_AP      = 2,
 };
 
-enum _LED_INTENSITY_LV
-{
-	_LED_INTENSITY_DARKEST 	 = 0,
-	_LED_INTENSITY_MEDIUM 	 = 1,
-	_LED_INTENSITY_BRIGHTEST = 2
+enum _LED_INTENSITY_LV {
+    _LED_INTENSITY_DARKEST   = 0,
+    _LED_INTENSITY_MEDIUM    = 1,
+    _LED_INTENSITY_BRIGHTEST = 2,
 };
 
-enum _CCS_COMM_PROTOCOL
-{
-	_CCS_COMM_V2GMessage_DIN70121 		= 0x01,
-	_CCS_COMM_V2GMessage_ISO15118_2014 	= 0x02,
-	_CCS_COMM_V2GMessage_ISO15118_2018 	= 0x03
+enum _CCS_COMM_PROTOCOL {
+    _CCS_COMM_V2GMessage_DIN70121      = 0x01,
+    _CCS_COMM_V2GMessage_ISO15118_2014 = 0x02,
+    _CCS_COMM_V2GMessage_ISO15118_2018 = 0x03,
 };
 
 #endif /* CONFIG_H_ */

BIN
EVSE/Projects/DD360Audi/Apps/DoComm


BIN
EVSE/Projects/DD360Audi/Apps/FactoryConfig


+ 105 - 63
EVSE/Projects/DD360Audi/Apps/Makefile

@@ -1,106 +1,148 @@
 -include ../../../../Rules.make
 export PATH=/bin:/sbin:/usr/bin:$(SDK_PATH_TARGET)/usr/bin:$PATH
 
+ModularizationPath = ../../../Modularization
+RootPath = ../Images/root
+OutputPath = ../output
+
+DEFINE = -D $(Project)
+
+CFLAGS = -O0 -g3 -Wall -c -fmessage-length=0
+
 #define library variable
-Internal485ProtocolLib = -L ../../../Modularization/Internal485Protocol -lInternal485Protocol
-#PsuCommProtocolLib = -L ../../../Modularization/PsuCommProtocol -lPsuCommProtocol
+Internal485ProtocolLib = -L $(ModularizationPath)/Internal485Protocol -lInternal485Protocol
+#PsuCommProtocolLib = -L $(ModularizationPath)/PsuCommProtocol -lPsuCommProtocol
 
 #define library variable
-Lib_Module_RFID = "-L../../../Modularization" -lModule_RFID
-Lib_Module_Upgrade = "-L../../../Modularization" -lModule_Upgrade
-Lib_SQLite3 = "-L../../../Modularization/ocppfiles" -lsqlite3
+Lib_Module_RFID = "-L$(ModularizationPath)" -lModule_RFID
+Lib_Module_Upgrade = "-L$(ModularizationPath)" -lModule_Upgrade
+Lib_SQLite3 = "-L$(ModularizationPath)/ocppfiles" -lsqlite3
+
+SQLite3_H = -include$(ModularizationPath)/ocppfiles/sqlite3.h
+ModuleUpgrade_H = -include$(ModularizationPath)/Module_Upgrade.h
+RFID_H = -include$(ModularizationPath)/Module_RFID.h
+
+InfypwrPsuComm_H = -include$(ModularizationPath)/Infypwr_PsuCommObj.h
+InfypwrPsuComm_A = $(ModularizationPath)/libInfypwr_PsuCommObj.a
 
 all: CopyFile apps
-#apps: Module_CSU Module_EvComm Module_EventLogging Module_InternalComm Module_LcmControl Module_PrimaryComm Module_PsuComm 
+#apps: Module_CSU Module_EvComm Module_EventLogging Module_InternalComm Module_LcmControl Module_PrimaryComm Module_PsuComm
 # ReadCmdline kill.sh
-apps: MainTask DoCommTask EvCommTask EventLoggingTask InternalCommTask LcmControlTask PrimaryCommTask ReadCmdlineTask UnsafetyOutputTool FactoryConfigApp OtherTools
+apps: MainTask DoCommTask EvCommTask \
+		EventLoggingTask InternalCommTask LcmControlTask \
+			PrimaryCommTask ReadCmdlineTask UnsafetyOutputTool \
+				FactoryConfigApp OtherTools CleanExec
 
 MainTask:
-	rm -f *.o
 	rm -f main;
-	$(CC) -D $(Project) -include../../../Modularization/ocppfiles/sqlite3.h -include../../../Modularization/Module_Upgrade.h -include../../../Modularization/Module_RFID.h -O0 -g3 -Wall -c -fmessage-length=0 -o main.o main.c
-	$(CC) -D $(Project) -include../../../Modularization/ocppfiles/sqlite3.h -include../../../Modularization/Module_Upgrade.h -include../../../Modularization/Module_RFID.h -O0 -g3 -Wall -c -fmessage-length=0 -o timeout.o timeout.c
-	$(CC) -o main main.o timeout.o ${Lib_Module_RFID} ${Lib_Module_Upgrade} ${Lib_SQLite3}	
-	cp -f main ../Images/root
+	$(CC) $(DEFINE) $(SQLite3_H) $(ModuleUpgrade_H) $(RFID_H) $(CFLAGS) -o main.o main.c
+	$(CC) $(DEFINE) $(SQLite3_H) $(ModuleUpgrade_H) $(RFID_H) $(CFLAGS) -o timeout.o timeout.c
+	$(CC) -o main main.o timeout.o ${Lib_Module_RFID} ${Lib_Module_Upgrade} ${Lib_SQLite3}
 
 DoCommTask:
 	rm -f DoComm;
-	$(CC) -D $(Project) -includeConfig.h -O0 -g3 -Wall -c -fmessage-length=0 -o DoComm.o DoComm.c
-	$(CC) -o DoComm DoComm.o
-	cp -f DoComm ../Images/root	
-	
+	$(CC) $(DEFINE) $(CFLAGS) -o ReDoComm.o ReDoComm.c
+	$(CC) -o DoComm ReDoComm.o
+
 EvCommTask:
 	rm -f Module_EvComm;
-	$(CC) -D $(Project) -includeConfig.h -O0 -g3 -Wall -c -fmessage-length=0 -o Ev_Comm.o Ev_Comm.c
-	$(CC) -D $(Project) -includeConfig.h -O0 -g3 -Wall -c -fmessage-length=0 -o Module_EvComm.o Module_EvComm.c
+	$(CC) $(DEFINE) $(CFLAGS) -o Ev_Comm.o Ev_Comm.c
+	$(CC) $(DEFINE) $(CFLAGS) -o Module_EvComm.o Module_EvComm.c
 	$(CC) -o Module_EvComm Ev_Comm.o Module_EvComm.o
-	cp -f Module_EvComm ../Images/root	
-	
+
 EventLoggingTask:
 	rm -f Module_EventLogging;
-	$(CC) -D $(Project) -includeConfig.h -O0 -g3 -Wall -c -fmessage-length=0 -o Module_EventLogging.o Module_EventLogging.c
-	$(CC) -o Module_EventLogging Module_EventLogging.o 	
-	cp -f Module_EventLogging ../Images/root	
-	
+	$(CC) $(DEFINE) $(CFLAGS) -o Module_EventLogging.o Module_EventLogging.c
+	$(CC) -o Module_EventLogging Module_EventLogging.o
+
 InternalCommTask:
-	rm -f Module_InternalComm; 
-	$(CC) -D $(Project) -includeConfig.h -O0 -g3 -Wall -c -fmessage-length=0 -o internalComm.o internalComm.c
-	$(CC) -D $(Project) -includeConfig.h -O0 -g3 -Wall -c -fmessage-length=0 -o Module_InternalComm.o Module_InternalComm.c
-	$(CC) -o Module_InternalComm Module_InternalComm.o internalComm.o 	
-	cp -f Module_InternalComm ../Images/root
-	
+	rm -f Module_InternalComm;
+	$(CC) $(DEFINE) $(CFLAGS) -o internalComm.o internalComm.c
+	$(CC) $(DEFINE) $(CFLAGS) -o Module_InternalComm.o Module_InternalComm.c
+	$(CC) -o Module_InternalComm Module_InternalComm.o internalComm.o
+
 LcmControlTask:
-	rm -f Module_LcmControl; 
-	$(CC) -D $(Project) -includeConfig.h -O0 -g3 -Wall -c -fmessage-length=0 -o Module_LcmControl.o Module_LcmControl.c
+	rm -f Module_LcmControl;
+	$(CC) $(DEFINE) $(CFLAGS) -o Module_LcmControl.o Module_LcmControl.c
 	$(CC) -o Module_LcmControl Module_LcmControl.o
-	cp -f Module_LcmControl ../Images/root			
 
 PrimaryCommTask:
-	rm -f Module_PrimaryComm; 
-	$(CC) -D $(Project) -includeConfig.h -O0 -g3 -Wall -c -fmessage-length=0 -o Module_PrimaryComm.o Module_PrimaryComm.c
-	$(CC) -D $(Project) -includeConfig.h -O0 -g3 -Wall -c -fmessage-length=0 -o PrimaryComm.o PrimaryComm.c
+	rm -f Module_PrimaryComm;
+	$(CC) $(DEFINE) $(CFLAGS) -o Module_PrimaryComm.o Module_PrimaryComm.c
+	$(CC) $(DEFINE) $(CFLAGS) -o PrimaryComm.o PrimaryComm.c
 	$(CC) -o Module_PrimaryComm Module_PrimaryComm.o PrimaryComm.o
-	cp -f Module_PrimaryComm ../Images/root	
 
 PsuCommTask:
-	rm -f Module_PsuComm; 
-	$(CC) -D $(Project) -include../../../Modularization/Infypwr_PsuCommObj.h -includeConfig.h -O0 -g3 -Wall -c -fmessage-length=0 -o Module_PsuComm.o Module_PsuComm.c
-	$(CC) -o Module_PsuComm Module_PsuComm.o ../../../Modularization/libInfypwr_PsuCommObj.a
-	cp -f Module_PsuComm ../Images/root	
-	
+	rm -f Module_PsuComm;
+	$(CC) $(DEFINE) $(InfypwrPsuComm_H) $(CFLAGS) -o Module_PsuComm.o Module_PsuComm.c
+	$(CC) -o Module_PsuComm Module_PsuComm.o $(InfypwrPsuComm_A)
+
 ReadCmdlineTask:
-	rm -f ReadCmdline; 
-	$(CC) -D $(Project) -includeConfig.h -O0 -g3 -Wall -c -fmessage-length=0 -o ReadCmdline.o ReadCmdline.c
+	rm -f ReadCmdline;
+	$(CC) $(DEFINE) $(CFLAGS) -o ReadCmdline.o ReadCmdline.c
 	$(CC) -o ReadCmdline ReadCmdline.o
-	cp -f ReadCmdline ../Images/root
 
 UnsafetyOutputTool:
-	rm -f UnsafetyOutputTask; 
-	$(CC) -D $(Project) -include../../../Modularization/Infypwr_PsuCommObj.h -O0 -g3 -Wall -c -fmessage-length=0 -o OutputTask.o OutputTask.c
-	$(CC) -o UnsafetyOutputTask OutputTask.o ../../../Modularization/libInfypwr_PsuCommObj.a
-	cp -f UnsafetyOutputTask ../Images/root	
+	rm -f UnsafetyOutputTask;
+	$(CC) $(DEFINE) $(InfypwrPsuComm_H) $(CFLAGS) -o OutputTask.o OutputTask.c
+	$(CC) -o UnsafetyOutputTask OutputTask.o $(InfypwrPsuComm_A)
 
 FactoryConfigApp:
 	@echo "===== Module_FactoryConfig_Task =================================="
 	rm -f FactoryConfig
-#	gcc -D $(Project) "-I../../" -o FactoryConfig "./FactoryConfig.c"
-#	mkdir -p /Storage/SystemLog	
+#	gcc $(DEFINE) "-I../../" -o FactoryConfig "./FactoryConfig.c"
+#	mkdir -p /Storage/SystemLog
 #	./FactoryConfig -f;true
 #	cp /mnt/FactoryDefaultConfig.bin ../Images
-#	rm -f FactoryConfig; 
-	$(CC) -D $(Project) -O0 -g3 -Wall -c -fmessage-length=0 -o FactoryConfig.o FactoryConfig.c 
-	$(CC) -o FactoryConfig FactoryConfig.o 
-	cp -f FactoryConfig ../Images/root
+#	rm -f FactoryConfig;
+	$(CC) $(DEFINE) $(CFLAGS) -o FactoryConfig.o FactoryConfig.c
+	$(CC) -o FactoryConfig FactoryConfig.o
 
 OtherTools:
-	cp -f init.sh ../Images/root
-	cp -f kill.sh ../Images/root
-	cp -f web.sh ../Images/root
-
-CopyFile: 
-	rm -rfv ../Images/root
-	mkdir -p ../Images/root
+	cp -f init.sh $(RootPath)
+	cp -f kill.sh $(RootPath)
+	cp -f web.sh $(RootPath)
+	cp -f main $(RootPath)
+	cp -f DoComm $(RootPath)
+	cp -f Module_EvComm $(RootPath)
+	cp -f Module_EventLogging $(RootPath)
+	cp -f Module_InternalComm $(RootPath)
+	cp -f Module_LcmControl $(RootPath)
+	cp -f Module_PrimaryComm $(RootPath)
+	#cp -f Module_PsuComm $(RootPath)
+	cp -f ReadCmdline $(RootPath)
+	cp -f UnsafetyOutputTask $(RootPath)
+	cp -f FactoryConfig $(RootPath)
 
+	if [ ! -d $(OutputPath) ]; then mkdir -p $(OutputPath); fi
+	cp -f init.sh $(OutputPath)
+	cp -f kill.sh $(OutputPath)
+	cp -f web.sh $(OutputPath)
+	cp -f main $(OutputPath)
+	cp -f DoComm $(OutputPath)
+	cp -f Module_EvComm $(OutputPath)
+	cp -f Module_EventLogging $(OutputPath)
+	cp -f Module_InternalComm $(OutputPath)
+	cp -f Module_LcmControl $(OutputPath)
+	cp -f Module_PrimaryComm $(OutputPath)
+	#cp -f Module_PsuComm $(OutputPath)
+	cp -f ReadCmdline $(OutputPath)
+	cp -f UnsafetyOutputTask $(OutputPath)
+	cp -f FactoryConfig $(OutputPath)
 
+CopyFile:
+	rm -rfv $(RootPath)
+	mkdir -p $(RootPath)
 
-	
+CleanExec:
+	rm -f *.o
+	rm main
+	rm Module_EvComm
+	rm Module_EventLogging
+	rm Module_InternalComm
+	rm Module_LcmControl
+	rm Module_PrimaryComm
+	#rm Module_PsuComm
+	rm ReadCmdline
+	rm FactoryConfig
+	rm DoComm

BIN
EVSE/Projects/DD360Audi/Apps/Module_EvComm


+ 2779 - 3397
EVSE/Projects/DD360Audi/Apps/Module_EvComm.c

@@ -1,51 +1,53 @@
-#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/shm.h>
-#include 	<sys/mman.h>
-#include 	<linux/can.h>
-#include 	<linux/can/raw.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 	<errno.h>
-#include 	<string.h>
-#include	<time.h>
-#include	<ctype.h>
-#include 	<ifaddrs.h>
-#include	"../../define.h"
-#include 	"Module_EvComm.h"
-
-#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
-#define PASS				1
-#define FAIL				-1
-#define START				1
-#define STOP				0
-#define YES					1
-#define NO					0
-#define EQUAL				0
-
-struct SysConfigAndInfo			*ShmSysConfigAndInfo;
-struct StatusCodeData 			*ShmStatusCodeData;
-struct FanModuleData			*ShmFanModuleData;
-struct CHAdeMOData				*ShmCHAdeMOData;
-struct GBTData					*ShmGBTData;
-struct CcsData					*ShmCcsData;
+#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/shm.h>
+#include <sys/mman.h>
+#include <linux/can.h>
+#include <linux/can/raw.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 <errno.h>
+#include <string.h>
+#include <time.h>
+#include <ctype.h>
+#include <ifaddrs.h>
+
+#include "../../define.h"
+#include "Module_EvComm.h"
+#include "Config.h"
+
+#define ARRAY_SIZE(A)       (sizeof(A) / sizeof(A[0]))
+#define PASS                1
+#define FAIL                -1
+#define START               1
+#define STOP                0
+#define YES                 1
+#define NO                  0
+#define EQUAL               0
+
+struct SysConfigAndInfo         *ShmSysConfigAndInfo;
+struct StatusCodeData           *ShmStatusCodeData;
+struct FanModuleData            *ShmFanModuleData;
+struct CHAdeMOData              *ShmCHAdeMOData;
+struct GBTData                  *ShmGBTData;
+struct CcsData                  *ShmCcsData;
 
 byte gun_count;
 int chargingTime[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
@@ -61,39 +63,39 @@ float _outCur_1 = 0;
 float _outVol_2 = 0;
 float _outCur_2 = 0;
 
-// 限制最大充電電壓,因應不同 type 槍線來限制
+// �𣂼���憭批��駁𤓖憯橒��䭾�銝滚� type 瑽滨�靘����
 // Chademo : 500V, 125A,
 // GB : 750, 120A
 // CCS : 950V, 120A
-float maxChargingVol[2] = { 5000, 9500 };			// 限制最大充電電壓,如依照模塊則填上 0
-// 限制最大充電電流與能量透過 Web
-float maxChargingCur[2] = { 5000, 1200 };			// 限制最大充電電流,如依照模塊則填上 0
-float maxChargingPow = 0;							// 限制最大充電能量,如依照模塊則填上 0
+float maxChargingVol[2] = { 5000, 9500 };           // �𣂼���憭批��駁𤓖憯橒�憒���扳芋憛𠰴�憛思� 0
+// �𣂼���憭批��駁𤓖瘚���賡��誯� Web
+float maxChargingCur[2] = { 5000, 1200 };           // �𣂼���憭批��駁𤓖瘚��憒���扳芋憛𠰴�憛思� 0
+float maxChargingPow = 0;                           // �𣂼���憭批��餉��𧶏�憒���扳芋憛𠰴�憛思� 0
 
-// 槍資訊
+// 瑽滩�閮�
 struct ChargingInfoData *_chargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 
-struct Ev_Board_Cmd Ev_Cmd={
-		0,
-		0x00000200,
-		0x00000400,
-		0x00000500,
-		0x00000600,
-		0x00000700,
-		0x00000800,
-		0x00000900,
-		0x00000A00,
-		0x00000C00,
-		0x00000D00,
-
-		0x00000E00,
-		0x00000F00,
-		0x00001000,
-		0x00001100,
-
-		0x00001200,
-		0x00001400,
-		0x00001500,
+struct Ev_Board_Cmd Ev_Cmd = {
+    0,
+    0x00000200,
+    0x00000400,
+    0x00000500,
+    0x00000600,
+    0x00000700,
+    0x00000800,
+    0x00000900,
+    0x00000A00,
+    0x00000C00,
+    0x00000D00,
+
+    0x00000E00,
+    0x00000F00,
+    0x00001000,
+    0x00001100,
+
+    0x00001200,
+    0x00001400,
+    0x00001500,
 };
 
 unsigned char mask_table[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
@@ -110,66 +112,63 @@ unsigned long GetTimeoutValue(struct timeval _sour_time);
 
 unsigned long GetTimeoutValue(struct timeval _sour_time)
 {
-	struct timeval _end_time;
-	gettimeofday(&_end_time, NULL);
+    struct timeval _end_time;
+    gettimeofday(&_end_time, NULL);
 
-	return 1000000 * (_end_time.tv_sec - _sour_time.tv_sec) + _end_time.tv_usec - _sour_time.tv_usec;
+    return 1000000 * (_end_time.tv_sec - _sour_time.tv_sec) + _end_time.tv_usec - _sour_time.tv_usec;
 }
 
 int StoreLogMsg(const char *fmt, ...)
 {
-	char Buf[4096+256];
-	char buffer[4096];
-	va_list args;
-	struct timeb  SeqEndTime;
-	struct tm *tm;
-
-	va_start(args, fmt);
-	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
-	va_end(args);
-
-	memset(Buf,0,sizeof(Buf));
-	ftime(&SeqEndTime);
-	SeqEndTime.time = time(NULL);
-	tm=localtime(&SeqEndTime.time);
-
-	if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES)
-	{
-		sprintf(Buf,"%02d:%02d:%02d:%03d - %s",
-			tm->tm_hour,tm->tm_min,tm->tm_sec,SeqEndTime.millitm, buffer);
-		printf("%s \n", Buf);
-	}
-	else
-	{
-		sprintf(Buf,"echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,SeqEndTime.millitm,
-			buffer,
-			tm->tm_year+1900,tm->tm_mon+1);
-		system(Buf);
-	}
-
-	return rc;
+    char Buf[4096 + 256];
+    char buffer[4096];
+    va_list args;
+    struct timeb  SeqEndTime;
+    struct tm *tm;
+
+    va_start(args, fmt);
+    int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+    va_end(args);
+
+    memset(Buf, 0, sizeof(Buf));
+    ftime(&SeqEndTime);
+    SeqEndTime.time = time(NULL);
+    tm = localtime(&SeqEndTime.time);
+
+    if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES) {
+        sprintf(Buf, "%02d:%02d:%02d:%03d - %s",
+                tm->tm_hour, tm->tm_min, tm->tm_sec, SeqEndTime.millitm, buffer);
+        printf("%s \n", Buf);
+    } else {
+        sprintf(Buf, "echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+                tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, SeqEndTime.millitm,
+                buffer,
+                tm->tm_year + 1900, tm->tm_mon + 1);
+        system(Buf);
+    }
+
+    return rc;
 }
 
 int DiffTimeb(struct timeb ST, struct timeb ET)
 {
-	//return milli-second
-	unsigned int StartTime,StopTime;
+    //return milli-second
+    unsigned int StartTime, StopTime;
 
-	StartTime=(unsigned int)ST.time;
-	StopTime=(unsigned int)ET.time;
-	return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
+    StartTime = (unsigned int)ST.time;
+    StopTime = (unsigned int)ET.time;
+    return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
 }
 
 void PRINTF_FUNC(char *string, ...)
 {
-	va_list args;
-	char buffer[4096];
-	va_start(args, string);
-	vsnprintf(buffer, sizeof(buffer), string, args);
-	va_end(args);
+    va_list args;
+    char buffer[4096];
+    va_start(args, string);
+    vsnprintf(buffer, sizeof(buffer), string, args);
+    va_end(args);
 
-	DEBUG_INFO("%s \n", buffer);
+    DEBUG_INFO("%s \n", buffer);
 }
 
 //=================================
@@ -177,37 +176,32 @@ void PRINTF_FUNC(char *string, ...)
 //=================================
 void getTimeString(char *buff)
 {
-	time_t timep;
-	struct tm *p;
-	time(&timep);
-	p=gmtime(&timep);
+    time_t timep;
+    struct tm *p;
+    time(&timep);
+    p = gmtime(&timep);
 
-	sprintf(buff, "[%04d-%02d-%02d %02d:%02d:%02d]", (1900+p->tm_year), (1+p->tm_mon), p->tm_mday, p->tm_hour, p->tm_hour, p->tm_sec);
+    sprintf(buff, "[%04d-%02d-%02d %02d:%02d:%02d]", (1900 + p->tm_year), (1 + p->tm_mon), p->tm_mday, p->tm_hour, p->tm_hour, p->tm_sec);
 }
 
 bool CheckUniqNumber(byte value)
 {
-	for (byte index = 0; index < gun_count; index++)
-	{
-		if (_chargingData[index]->Evboard_id == value)
-		{
-			struct timeval _end_time;
-			gettimeofday(&_end_time, NULL);
-			unsigned long diff = 1000000 *	(_end_time.tv_sec - _id_assign_time.tv_sec) + _end_time.tv_usec - _id_assign_time.tv_usec;
-			if (diff >= 3000000)
-			{
-				gettimeofday(&_id_assign_time, NULL);
-				return true;
-			}
-			else
-			{
-				return false;
-			}
-		}
-	}
-
-	gettimeofday(&_id_assign_time, NULL);
-	return true;
+    for (byte index = 0; index < gun_count; index++) {
+        if (_chargingData[index]->Evboard_id == value) {
+            struct timeval _end_time;
+            gettimeofday(&_end_time, NULL);
+            unsigned long diff = 1000000 *  (_end_time.tv_sec - _id_assign_time.tv_sec) + _end_time.tv_usec - _id_assign_time.tv_usec;
+            if (diff >= 3000000) {
+                gettimeofday(&_id_assign_time, NULL);
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
+
+    gettimeofday(&_id_assign_time, NULL);
+    return true;
 }
 
 //==========================================
@@ -215,102 +209,80 @@ bool CheckUniqNumber(byte value)
 //==========================================
 int InitShareMemory()
 {
-	int result = PASS;
-	int MeterSMId;
-
-	//initial ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
-    {
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
-		#endif
-		result = FAIL;
-	}
-    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-    {
-    	#ifdef SystemLogMessage
-    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
-		#endif
-    	result = FAIL;
-   	 }
-    else
+    int result = PASS;
+    int MeterSMId;
+
+    //initial ShmSysConfigAndInfo
+    if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+#endif
+        result = FAIL;
+    } else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+#endif
+        result = FAIL;
+    } else
     {}
 
-   	 //initial ShmStatusCodeData
-   	 if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
-    {
-		#ifdef SystemLogMessage
-   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
-		#endif
-   		result = FAIL;
-	}
-    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-    {
-    	#ifdef SystemLogMessage
-    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
-		#endif
-    	result = FAIL;
-   	}
-    else
+    //initial ShmStatusCodeData
+    if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+#endif
+        result = FAIL;
+    } else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+#endif
+        result = FAIL;
+    } else
     {}
 
-   	if(CHAdeMO_QUANTITY > 0)
-   	{
-   		if ((MeterSMId = shmget(ShmCHAdeMOCommKey, sizeof(struct CHAdeMOData),	IPC_CREAT | 0777)) < 0)
-   		{
-   			#ifdef SystemLogMessage
-   		   	DEBUG_ERROR("[shmget ShmCHAdeMOData NG \n");
-   			#endif
-   			return FAIL;
-   		}
-   		else if ((ShmCHAdeMOData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-   		{
-   			#ifdef SystemLogMessage
-   		   	DEBUG_ERROR("shmat ShmCHAdeMOData NG \n");
-   			#endif
-   			return FAIL;
-   		}
-   		else
-   		{}
-   	}
-	if(GB_QUANTITY > 0)
-	{
-		if ((MeterSMId = shmget(ShmGBTCommKey, sizeof(struct GBTData),	IPC_CREAT | 0777)) < 0)
-	   	{
-	   		#ifdef SystemLogMessage
-	   		DEBUG_ERROR("[shmget ShmGBTData NG \n");
-	   		#endif
-	   		return FAIL;
-	   	}
-	   	else if ((ShmGBTData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-	   	{
-	   		#ifdef SystemLogMessage
-	   		DEBUG_ERROR("shmat ShmGBTData NG \n");
-	   		#endif
-	   		return FAIL;
-	   	}
-	   	else
-	   	{}
-	}
-
-   	if(CCS_QUANTITY > 0)
-   	{
-   		if ((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData),	IPC_CREAT | 0777)) < 0)
-   		{
-   			#ifdef SystemLogMessage
-   			DEBUG_ERROR("shmget ShmCcsData NG \n");
-   			#endif
-   			return FAIL;
-   		}
-   		else if ((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *) -1) {
-   			#ifdef SystemLogMessage
-   		   	DEBUG_ERROR("shmat ShmCcsData NG \n");
-   			#endif
-   			return FAIL;
-   		}
-   		else
-   		{}
-   	}
+    if (CHAdeMO_QUANTITY > 0) {
+        if ((MeterSMId = shmget(ShmCHAdeMOCommKey, sizeof(struct CHAdeMOData),  IPC_CREAT | 0777)) < 0) {
+#ifdef SystemLogMessage
+            DEBUG_ERROR("[shmget ShmCHAdeMOData NG \n");
+#endif
+            return FAIL;
+        } else if ((ShmCHAdeMOData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+#ifdef SystemLogMessage
+            DEBUG_ERROR("shmat ShmCHAdeMOData NG \n");
+#endif
+            return FAIL;
+        } else
+        {}
+    }
+    if (GB_QUANTITY > 0) {
+        if ((MeterSMId = shmget(ShmGBTCommKey, sizeof(struct GBTData),  IPC_CREAT | 0777)) < 0) {
+#ifdef SystemLogMessage
+            DEBUG_ERROR("[shmget ShmGBTData NG \n");
+#endif
+            return FAIL;
+        } else if ((ShmGBTData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+#ifdef SystemLogMessage
+            DEBUG_ERROR("shmat ShmGBTData NG \n");
+#endif
+            return FAIL;
+        } else
+        {}
+    }
+
+    if (CCS_QUANTITY > 0) {
+        if ((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData),  IPC_CREAT | 0777)) < 0) {
+#ifdef SystemLogMessage
+            DEBUG_ERROR("shmget ShmCcsData NG \n");
+#endif
+            return FAIL;
+        } else if ((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+#ifdef SystemLogMessage
+            DEBUG_ERROR("shmat ShmCcsData NG \n");
+#endif
+            return FAIL;
+        } else
+        {}
+    }
 
     return result;
 }
@@ -320,46 +292,43 @@ int InitShareMemory()
 //================================================
 int InitCanBus()
 {
-	int 					s0,nbytes;
-	struct timeval			tv;
-	struct ifreq 			ifr0;
-	struct sockaddr_can		addr0;
-
-	system("/sbin/ip link set can0 down");
-	system("/sbin/ip link set can0 type can bitrate 500000 restart-ms 100");
-	system("/sbin/ip link set can0 up");
-
-	s0 = socket(PF_CAN, SOCK_RAW, CAN_RAW);
-
-	tv.tv_sec = 0;
-	tv.tv_usec = 10000;
-   	if (setsockopt(s0, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct	timeval)) < 0)
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("Set SO_RCVTIMEO NG");
-		#endif
-	}
-	nbytes=40960;
-	if (setsockopt(s0, SOL_SOCKET,  SO_RCVBUF, &nbytes, sizeof(int)) < 0)
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("Set SO_RCVBUF NG");
-		#endif
-	}
-	nbytes=40960;
-	if (setsockopt(s0, SOL_SOCKET, SO_SNDBUF, &nbytes, sizeof(int)) < 0)
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("Set SO_SNDBUF NG");
-		#endif
-	}
-
-   	strcpy(ifr0.ifr_name, "can0" );
-	ioctl(s0, SIOCGIFINDEX, &ifr0); /* ifr.ifr_ifindex gets filled with that device's index */
-	addr0.can_family = AF_CAN;
-	addr0.can_ifindex = ifr0.ifr_ifindex;
-	bind(s0, (struct sockaddr *)&addr0, sizeof(addr0));
-	return s0;
+    int                     s0, nbytes;
+    struct timeval          tv;
+    struct ifreq            ifr0;
+    struct sockaddr_can     addr0;
+
+    system("/sbin/ip link set can0 down");
+    system("/sbin/ip link set can0 type can bitrate 500000 restart-ms 100");
+    system("/sbin/ip link set can0 up");
+
+    s0 = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+
+    tv.tv_sec = 0;
+    tv.tv_usec = 10000;
+    if (setsockopt(s0, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct  timeval)) < 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("Set SO_RCVTIMEO NG");
+#endif
+    }
+    nbytes = 40960;
+    if (setsockopt(s0, SOL_SOCKET,  SO_RCVBUF, &nbytes, sizeof(int)) < 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("Set SO_RCVBUF NG");
+#endif
+    }
+    nbytes = 40960;
+    if (setsockopt(s0, SOL_SOCKET, SO_SNDBUF, &nbytes, sizeof(int)) < 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("Set SO_SNDBUF NG");
+#endif
+    }
+
+    strcpy(ifr0.ifr_name, "can0" );
+    ioctl(s0, SIOCGIFINDEX, &ifr0); /* ifr.ifr_ifindex gets filled with that device's index */
+    addr0.can_family = AF_CAN;
+    addr0.can_ifindex = ifr0.ifr_ifindex;
+    bind(s0, (struct sockaddr *)&addr0, sizeof(addr0));
+    return s0;
 }
 
 //================================================
@@ -369,3190 +338,2603 @@ int InitCanBus()
 //================================================
 bool FindChargingInfoData(byte target, struct ChargingInfoData **chargingData)
 {
-	for (byte index = 0; index < CHAdeMO_QUANTITY; index++)
-	{
-		if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == target)
-		{
-			chargingData[target] = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index];
-			return true;
-		}
-	}
-
-	for (byte index = 0; index < CCS_QUANTITY; index++)
-	{
-		if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == target)
-		{
-			chargingData[target] = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[index];
-			return true;
-		}
-	}
-
-	for (byte index = 0; index < GB_QUANTITY; index++)
-	{
-		if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == target)
-		{
-			chargingData[target] = &ShmSysConfigAndInfo->SysInfo.GbChargingData[index];
-			return true;
-		}
-	}
-
-	return false;
+    for (byte index = 0; index < CHAdeMO_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == target) {
+            chargingData[target] = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index];
+            return true;
+        }
+    }
+
+    for (byte index = 0; index < CCS_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == target) {
+            chargingData[target] = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[index];
+            return true;
+        }
+    }
+
+    for (byte index = 0; index < GB_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == target) {
+            chargingData[target] = &ShmSysConfigAndInfo->SysInfo.GbChargingData[index];
+            return true;
+        }
+    }
+
+    return false;
 }
 
 void AddrAssignment(byte *data)
 {
-	byte target_number[8];
-	byte index = 0x00;
-
-	memcpy(target_number, data, sizeof(target_number));
-	index = *(data + 4);
-
-	if (gun_count == 1)
-		index = 0x01;
-//	if (CheckUniqNumber(index))
-	{
-		PRINTF_FUNC("EV board id = %x \n", index);
-//		PRINTF_FUNC("target_number[0] = %x \n", target_number[0]);
-//		PRINTF_FUNC("target_number[1] = %x \n", target_number[1]);
-//		PRINTF_FUNC("target_number[2] = %x \n", target_number[2]);
-//		PRINTF_FUNC("target_number[3] = %x \n", target_number[3]);
-//		PRINTF_FUNC("target_number[4] = %x \n", target_number[4]);
-
-		PRINTF_FUNC("SetTargetAddr = %d, type = %d \n", index, _chargingData[index - 1]->Type);
-		SetTargetAddr(target_number, index);
-	}
+    byte target_number[8];
+    byte index = 0x00;
+
+    memcpy(target_number, data, sizeof(target_number));
+    index = *(data + 4);
+
+    if (gun_count == 1) {
+        index = 0x01;
+    }
+//  if (CheckUniqNumber(index))
+    {
+        PRINTF_FUNC("EV board id = %x \n", index);
+//      PRINTF_FUNC("target_number[0] = %x \n", target_number[0]);
+//      PRINTF_FUNC("target_number[1] = %x \n", target_number[1]);
+//      PRINTF_FUNC("target_number[2] = %x \n", target_number[2]);
+//      PRINTF_FUNC("target_number[3] = %x \n", target_number[3]);
+//      PRINTF_FUNC("target_number[4] = %x \n", target_number[4]);
+
+        PRINTF_FUNC("SetTargetAddr = %d, type = %d \n", index, _chargingData[index - 1]->Type);
+        SetTargetAddr(target_number, index);
+    }
 }
 
 void ClearAbnormalStatus_Chademo(byte gun_index)
 {
-	bool isCleanCheck = false;
-	char code[7];
-
-	if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) == EQUAL)
-		return;
-
-	if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023700", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvCommFail == YES)
-	{
-		memcpy(code, "023700", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023704", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryMalfun == YES)
-	{
-		memcpy(code, "023704", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023705", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoNoPermission == YES)
-	{
-		memcpy(code, "023705", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023706", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryIncompatibility == YES)
-	{
-		memcpy(code, "023706", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023707", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOVP == YES)
-	{
-		memcpy(code, "023707", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023708", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryUVP == YES)
-	{
-		memcpy(code, "023708", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023709", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOTP == YES)
-	{
-		memcpy(code, "023709", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023710", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryCurrentDiff == YES)
-	{
-		memcpy(code, "023710", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023711", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryVoltageDiff == YES)
-	{
-		memcpy(code, "023711", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023712", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoShiftPosition == YES)
-	{
-		memcpy(code, "023712", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023713", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOtherFault == YES)
-	{
-		memcpy(code, "023713", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023714", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargingSystemError == YES)
-	{
-		memcpy(code, "023714", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023715", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvNormalStop == YES)
-	{
-		memcpy(code, "023715", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023716", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoTempSensorBroken == YES)
-	{
-		memcpy(code, "023716", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023717", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoConnectorLockFail == YES)
-	{
-		memcpy(code, "023717", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023718", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoD1OnNoReceive == YES)
-	{
-		memcpy(code, "023718", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023719", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJTimeout == YES)
-	{
-		memcpy(code, "023719", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023720", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeAllowTimeout == YES)
-	{
-		memcpy(code, "023720", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023721", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoWaitGfdTimeout == YES)
-	{
-		memcpy(code, "023721", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023722", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayTimeout == YES)
-	{
-		memcpy(code, "023722", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023723", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsReqCurrentTimeout == YES)
-	{
-		memcpy(code, "023723", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023724", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJOffTimeout == YES)
-	{
-		memcpy(code, "023724", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023725", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayOffTimeout == YES)
-	{
-		memcpy(code, "023725", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023726", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan10V == YES)
-	{
-		memcpy(code, "023726", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023727", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan20V == YES)
-	{
-		memcpy(code, "023727", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023728", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeBeforeStop == YES)
-	{
-		memcpy(code, "023728", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023729", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetNormalStop == YES)
-	{
-		memcpy(code, "023729", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023730", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetEmergencyStop == YES)
-	{
-		memcpy(code, "023730", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023731", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoIsolationResultFail == YES)
-	{
-		memcpy(code, "023731", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023732", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoMissLinkWithMotherBoard == YES)
-	{
-		memcpy(code, "023732", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023733", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoOutputVolMoreThanLimit == YES)
-	{
-		memcpy(code, "023733", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023734", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReqCurrentMoreThanLimit == YES)
-	{
-		memcpy(code, "023734", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023735", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReCapBmsEqrCurrentExceed == YES)
-	{
-		memcpy(code, "023735", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023736", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargeRemainCountDown == YES)
-	{
-		memcpy(code, "023736", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-
-	if (isCleanCheck)
-	{
-		for (byte index = 0; index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; index++)
-		{
-			if (index != gun_index || ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1)
-			{
-				PRINTF_FUNC("CHA clean error : index = %d, EvConnAlarmCode = %s, code = %s \n", index, _chargingData[index]->EvConnAlarmCode, code);
-				if (strncmp((char *)_chargingData[index]->EvConnAlarmCode, code, 6) != EQUAL)
-				{
-					if (strncmp(code, "023700", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvCommFail = NO;
-					if (strncmp(code, "023704", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryMalfun = NO;
-					if (strncmp(code, "023705", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoNoPermission = NO;
-					if (strncmp(code, "023706", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryIncompatibility = NO;
-					if (strncmp(code, "023707", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOVP = NO;
-					if (strncmp(code, "023708", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryUVP = NO;
-					if (strncmp(code, "023709", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOTP = NO;
-					if (strncmp(code, "023710", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryCurrentDiff = NO;
-					if (strncmp(code, "023711", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryVoltageDiff = NO;
-					if (strncmp(code, "023712", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoShiftPosition = NO;
-					if (strncmp(code, "023713", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOtherFault = NO;
-					if (strncmp(code, "023714", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargingSystemError = NO;
-					if (strncmp(code, "023715", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvNormalStop = NO;
-					if (strncmp(code, "023716", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoTempSensorBroken = NO;
-					if (strncmp(code, "023717", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoConnectorLockFail = NO;
-					if (strncmp(code, "023718", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoD1OnNoReceive = NO;
-					if (strncmp(code, "023719", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJTimeout = NO;
-					if (strncmp(code, "023720", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeAllowTimeout = NO;
-					if (strncmp(code, "023721", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoWaitGfdTimeout = NO;
-					if (strncmp(code, "023722", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayTimeout = NO;
-					if (strncmp(code, "023723", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsReqCurrentTimeout = NO;
-					if (strncmp(code, "023724", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJOffTimeout = NO;
-					if (strncmp(code, "023725", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayOffTimeout = NO;
-					if (strncmp(code, "023726", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan10V = NO;
-					if (strncmp(code, "023727", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan20V = NO;
-					if (strncmp(code, "023728", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeBeforeStop = NO;
-					if (strncmp(code, "023729", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetNormalStop = NO;
-					if (strncmp(code, "023730", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetEmergencyStop = NO;
-					if (strncmp(code, "023731", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoIsolationResultFail = NO;
-					if (strncmp(code, "023732", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoMissLinkWithMotherBoard = NO;
-					if (strncmp(code, "023733", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoOutputVolMoreThanLimit = NO;
-					if (strncmp(code, "023734", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReqCurrentMoreThanLimit = NO;
-					if (strncmp(code, "023735", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReCapBmsEqrCurrentExceed = NO;
-					if (strncmp(code, "023736", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargeRemainCountDown = NO;
-				}
-			}
-		}
-	}
+    bool isCleanCheck = false;
+    char code[7];
+
+    if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) == EQUAL) {
+        return;
+    }
+
+    if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023700", 6) == EQUAL &&
+            ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvCommFail == YES) {
+        memcpy(code, "023700", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023704", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryMalfun == YES) {
+        memcpy(code, "023704", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023705", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoNoPermission == YES) {
+        memcpy(code, "023705", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023706", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryIncompatibility == YES) {
+        memcpy(code, "023706", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023707", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOVP == YES) {
+        memcpy(code, "023707", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023708", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryUVP == YES) {
+        memcpy(code, "023708", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023709", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOTP == YES) {
+        memcpy(code, "023709", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023710", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryCurrentDiff == YES) {
+        memcpy(code, "023710", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023711", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryVoltageDiff == YES) {
+        memcpy(code, "023711", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023712", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoShiftPosition == YES) {
+        memcpy(code, "023712", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023713", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOtherFault == YES) {
+        memcpy(code, "023713", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023714", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargingSystemError == YES) {
+        memcpy(code, "023714", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023715", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvNormalStop == YES) {
+        memcpy(code, "023715", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023716", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoTempSensorBroken == YES) {
+        memcpy(code, "023716", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023717", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoConnectorLockFail == YES) {
+        memcpy(code, "023717", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023718", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoD1OnNoReceive == YES) {
+        memcpy(code, "023718", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023719", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJTimeout == YES) {
+        memcpy(code, "023719", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023720", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeAllowTimeout == YES) {
+        memcpy(code, "023720", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023721", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoWaitGfdTimeout == YES) {
+        memcpy(code, "023721", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023722", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayTimeout == YES) {
+        memcpy(code, "023722", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023723", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsReqCurrentTimeout == YES) {
+        memcpy(code, "023723", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023724", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJOffTimeout == YES) {
+        memcpy(code, "023724", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023725", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayOffTimeout == YES) {
+        memcpy(code, "023725", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023726", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan10V == YES) {
+        memcpy(code, "023726", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023727", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan20V == YES) {
+        memcpy(code, "023727", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023728", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeBeforeStop == YES) {
+        memcpy(code, "023728", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023729", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetNormalStop == YES) {
+        memcpy(code, "023729", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023730", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetEmergencyStop == YES) {
+        memcpy(code, "023730", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023731", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoIsolationResultFail == YES) {
+        memcpy(code, "023731", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023732", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoMissLinkWithMotherBoard == YES) {
+        memcpy(code, "023732", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023733", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoOutputVolMoreThanLimit == YES) {
+        memcpy(code, "023733", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023734", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReqCurrentMoreThanLimit == YES) {
+        memcpy(code, "023734", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023735", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReCapBmsEqrCurrentExceed == YES) {
+        memcpy(code, "023735", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023736", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargeRemainCountDown == YES) {
+        memcpy(code, "023736", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    }
+
+    if (isCleanCheck) {
+        for (byte index = 0; index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; index++) {
+            if (index != gun_index || ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1) {
+                PRINTF_FUNC("CHA clean error : index = %d, EvConnAlarmCode = %s, code = %s \n", index, _chargingData[index]->EvConnAlarmCode, code);
+                if (strncmp((char *)_chargingData[index]->EvConnAlarmCode, code, 6) != EQUAL) {
+                    if (strncmp(code, "023700", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvCommFail = NO; }
+                    if (strncmp(code, "023704", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryMalfun = NO; }
+                    if (strncmp(code, "023705", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoNoPermission = NO; }
+                    if (strncmp(code, "023706", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryIncompatibility = NO; }
+                    if (strncmp(code, "023707", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOVP = NO; }
+                    if (strncmp(code, "023708", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryUVP = NO; }
+                    if (strncmp(code, "023709", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOTP = NO; }
+                    if (strncmp(code, "023710", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryCurrentDiff = NO; }
+                    if (strncmp(code, "023711", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryVoltageDiff = NO; }
+                    if (strncmp(code, "023712", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoShiftPosition = NO; }
+                    if (strncmp(code, "023713", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOtherFault = NO; }
+                    if (strncmp(code, "023714", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargingSystemError = NO; }
+                    if (strncmp(code, "023715", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvNormalStop = NO; }
+                    if (strncmp(code, "023716", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoTempSensorBroken = NO; }
+                    if (strncmp(code, "023717", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoConnectorLockFail = NO; }
+                    if (strncmp(code, "023718", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoD1OnNoReceive = NO; }
+                    if (strncmp(code, "023719", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJTimeout = NO; }
+                    if (strncmp(code, "023720", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeAllowTimeout = NO; }
+                    if (strncmp(code, "023721", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoWaitGfdTimeout = NO; }
+                    if (strncmp(code, "023722", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayTimeout = NO; }
+                    if (strncmp(code, "023723", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsReqCurrentTimeout = NO; }
+                    if (strncmp(code, "023724", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJOffTimeout = NO; }
+                    if (strncmp(code, "023725", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayOffTimeout = NO; }
+                    if (strncmp(code, "023726", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan10V = NO; }
+                    if (strncmp(code, "023727", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan20V = NO; }
+                    if (strncmp(code, "023728", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeBeforeStop = NO; }
+                    if (strncmp(code, "023729", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetNormalStop = NO; }
+                    if (strncmp(code, "023730", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetEmergencyStop = NO; }
+                    if (strncmp(code, "023731", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoIsolationResultFail = NO; }
+                    if (strncmp(code, "023732", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoMissLinkWithMotherBoard = NO; }
+                    if (strncmp(code, "023733", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoOutputVolMoreThanLimit = NO; }
+                    if (strncmp(code, "023734", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReqCurrentMoreThanLimit = NO; }
+                    if (strncmp(code, "023735", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReCapBmsEqrCurrentExceed = NO; }
+                    if (strncmp(code, "023736", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargeRemainCountDown = NO; }
+                }
+            }
+        }
+    }
 }
 
 void ClearAbnormalStatus_GB(byte gun_index)
 {
-	bool isCleanCheck = false;
-	char code[7];
-
-	if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) == EQUAL)
-		return;
-
-	if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023702", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.GbEvCommFail == YES)
-	{
-		memcpy(code, "023702", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023900", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_LOS_CC1 == YES)
-	{
-		memcpy(code, "023900", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023901", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CONNECTOR_LOCK_FAIL == YES)
-	{
-		memcpy(code, "023901", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023902", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BATTERY_INCOMPATIBLE == YES)
-	{
-		memcpy(code, "023902", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023903", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_BROAA_TIMEOUT == YES)
-	{
-		memcpy(code, "023903", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023904", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CSU_PRECHARGE_TIMEOUT == YES)
-	{
-		memcpy(code, "023904", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023905", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_PRESENT_VOLTAGE_FAULT == YES)
-	{
-		memcpy(code, "023905", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023906", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_VOLTAGE_OVER_RANGE == YES)
-	{
-		memcpy(code, "023906", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023907", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BSM_CHARGE_ALLOW_00_10MIN_COUUNTDONE == YES)
-	{
-		memcpy(code, "023907", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023908", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_WAIT_GROUNDFAULT_TIMEOUT == YES)
-	{
-		memcpy(code, "023908", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023909", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_10V == YES)
-	{
-		memcpy(code, "023909", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023910", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_60V == YES)
-	{
-		memcpy(code, "023910", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023911", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_NORMAL_STOP_CMD == YES)
-	{
-		memcpy(code, "023911", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023912", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_EMERGENCY_STOP_CMD == YES)
-	{
-		memcpy(code, "023912", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023913", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ISOLATION_RESULT_FAIL == YES)
-	{
-		memcpy(code, "023913", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023914", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_MOTHER_BOARD_MISS_LINK == YES)
-	{
-		memcpy(code, "023914", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023915", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_LIMIT == YES)
-	{
-		memcpy(code, "023915", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023916", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_REQ_CURRENT_MORE_THAN_LIMIT == YES)
-	{
-		memcpy(code, "023916", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023917", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_10_PERCENT == YES)
-	{
-		memcpy(code, "023917", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023918", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_DIFF_BCS_5_PERCENT == YES)
-	{
-		memcpy(code, "023918", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023919", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_STOP_ADC_MORE_THAN_10V == YES)
-	{
-		memcpy(code, "023919", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023930", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BHM_TIMEOUT == YES)
-	{
-		memcpy(code, "023930", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023931", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRM_TIMEOUT == YES)
-	{
-		memcpy(code, "023931", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023932", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCP_TIMEOUT == YES)
-	{
-		memcpy(code, "023932", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023933", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRO_TIMEOUT == YES)
-	{
-		memcpy(code, "023933", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023934", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCL_TIMEOUT == YES)
-	{
-		memcpy(code, "023934", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023935", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCS_TIMEOUT == YES)
-	{
-		memcpy(code, "023935", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023936", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSM_TIMEOUT == YES)
-	{
-		memcpy(code, "023936", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023937", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BST_TIMEOUT == YES)
-	{
-		memcpy(code, "023937", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023938", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSD_TIMEOUT == YES)
-	{
-		memcpy(code, "023938", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023939", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BEM_OTHER_TIMEOUT == YES)
-	{
-		memcpy(code, "023939", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023940", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRM_TIMEOUT == YES)
-	{
-		memcpy(code, "023940", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023941", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRMAA_TIMEOUT == YES)
-	{
-		memcpy(code, "023941", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023942", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CTS_CML_TIMEOUT == YES)
-	{
-		memcpy(code, "023942", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023943", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRO_TIMEOUT == YES)
-	{
-		memcpy(code, "023943", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023944", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CCS_TIMEOUT == YES)
-	{
-		memcpy(code, "023944", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023945", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CST_TIMEOUT == YES)
-	{
-		memcpy(code, "023945", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023946", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CSD_TIMEOUT == YES)
-	{
-		memcpy(code, "023946", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023947", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_BEM_OTHER_TIMEOUT == YES)
-	{
-		memcpy(code, "023947", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023950", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_SOC_GOAL == YES)
-	{
-		memcpy(code, "023950", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023951", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_TOTAL_VOLTAGE_GOAL == YES)
-	{
-		memcpy(code, "023951", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023952", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CELL_VOLTAGE_GOAL == YES)
-	{
-		memcpy(code, "023952", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023953", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_GET_CST == YES)
-	{
-		memcpy(code, "023953", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023954", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_ISOLATION == YES)
-	{
-		memcpy(code, "023954", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023955", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OUTPUT_CONNECTOR_OTP == YES)
-	{
-		memcpy(code, "023955", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023956", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_COMPONENT == YES)
-	{
-		memcpy(code, "023956", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023957", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CHARGE_CONNECTOR == YES)
-	{
-		memcpy(code, "023957", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023958", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTP == YES)
-	{
-		memcpy(code, "023958", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023959", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTHER == YES)
-	{
-		memcpy(code, "023959", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023960", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_HIGH_V == YES)
-	{
-		memcpy(code, "023960", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023961", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CC2 == YES)
-	{
-		memcpy(code, "023961", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023962", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CURRENT == YES)
-	{
-		memcpy(code, "023962", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023963", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_VOLTAGE == YES)
-	{
-		memcpy(code, "023963", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023964", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GET_BST_NO_REASON == YES)
-	{
-		memcpy(code, "023964", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023970", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_OVER_VOLTAGE == YES)
-	{
-		memcpy(code, "023970", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023971", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_UNDER_VOLTAGE == YES)
-	{
-		memcpy(code, "023971", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023972", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OVER_SOC == YES)
-	{
-		memcpy(code, "023972", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023973", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_UNDER_SOC == YES)
-	{
-		memcpy(code, "023973", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023974", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CURRENT == YES)
-	{
-		memcpy(code, "023974", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023975", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_TEMPERATURE == YES)
-	{
-		memcpy(code, "023975", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023976", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_ISOLATE == YES)
-	{
-		memcpy(code, "023976", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023977", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OUTPUT_CONNECTOR == YES)
-	{
-		memcpy(code, "023977", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-
-	if (isCleanCheck)
-	{
-		for (byte index = 0; index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; index++)
-		{
-			if (index != gun_index || ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1)
-			{
-				PRINTF_FUNC("GBT clean error : index = %d, EvConnAlarmCode = %s, code = %s \n", index, _chargingData[index]->EvConnAlarmCode, code);
-				if (strncmp((char *)_chargingData[index]->EvConnAlarmCode, code, 6) != EQUAL)
-				{
-					if (strncmp(code, "023702", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.GbEvCommFail = NO;
-					if (strncmp(code, "023900", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_LOS_CC1 = NO;
-					if (strncmp(code, "023901", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CONNECTOR_LOCK_FAIL = NO;
-					if (strncmp(code, "023902", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BATTERY_INCOMPATIBLE = NO;
-					if (strncmp(code, "023903", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_BROAA_TIMEOUT = NO;
-					if (strncmp(code, "023904", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CSU_PRECHARGE_TIMEOUT = NO;
-					if (strncmp(code, "023905", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_PRESENT_VOLTAGE_FAULT = NO;
-					if (strncmp(code, "023906", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_VOLTAGE_OVER_RANGE = NO;
-					if (strncmp(code, "023907", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BSM_CHARGE_ALLOW_00_10MIN_COUUNTDONE = NO;
-					if (strncmp(code, "023908", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_WAIT_GROUNDFAULT_TIMEOUT = NO;
-					if (strncmp(code, "023909", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_10V = NO;
-					if (strncmp(code, "023910", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_60V = NO;
-					if (strncmp(code, "023911", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_NORMAL_STOP_CMD = NO;
-					if (strncmp(code, "023912", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_EMERGENCY_STOP_CMD = NO;
-					if (strncmp(code, "023913", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ISOLATION_RESULT_FAIL = NO;
-					if (strncmp(code, "023914", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_MOTHER_BOARD_MISS_LINK = NO;
-					if (strncmp(code, "023915", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_LIMIT = NO;
-					if (strncmp(code, "023916", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_REQ_CURRENT_MORE_THAN_LIMIT = NO;
-					if (strncmp(code, "023917", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_10_PERCENT = NO;
-					if (strncmp(code, "023918", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_DIFF_BCS_5_PERCENT = NO;
-					if (strncmp(code, "023919", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_STOP_ADC_MORE_THAN_10V = NO;
-					if (strncmp(code, "023930", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BHM_TIMEOUT = NO;
-					if (strncmp(code, "023931", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRM_TIMEOUT = NO;
-					if (strncmp(code, "023932", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCP_TIMEOUT = NO;
-					if (strncmp(code, "023933", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRO_TIMEOUT = NO;
-					if (strncmp(code, "023934", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCL_TIMEOUT = NO;
-					if (strncmp(code, "023935", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCS_TIMEOUT = NO;
-					if (strncmp(code, "023936", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSM_TIMEOUT = NO;
-					if (strncmp(code, "023937", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BST_TIMEOUT = NO;
-					if (strncmp(code, "023938", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSD_TIMEOUT = NO;
-					if (strncmp(code, "023939", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BEM_OTHER_TIMEOUT = NO;
-					if (strncmp(code, "023940", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRM_TIMEOUT = NO;
-					if (strncmp(code, "023941", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRMAA_TIMEOUT = NO;
-					if (strncmp(code, "023942", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CTS_CML_TIMEOUT = NO;
-					if (strncmp(code, "023943", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRO_TIMEOUT = NO;
-					if (strncmp(code, "023944", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CCS_TIMEOUT = NO;
-					if (strncmp(code, "023945", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CST_TIMEOUT = NO;
-					if (strncmp(code, "023946", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CSD_TIMEOUT = NO;
-					if (strncmp(code, "023947", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_BEM_OTHER_TIMEOUT = NO;
-					if (strncmp(code, "023950", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_SOC_GOAL = NO;
-					if (strncmp(code, "023951", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_TOTAL_VOLTAGE_GOAL = NO;
-					if (strncmp(code, "023952", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CELL_VOLTAGE_GOAL = NO;
-					if (strncmp(code, "023953", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_GET_CST = NO;
-					if (strncmp(code, "023954", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_ISOLATION = NO;
-					if (strncmp(code, "023955", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OUTPUT_CONNECTOR_OTP = NO;
-					if (strncmp(code, "023956", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_COMPONENT = NO;
-					if (strncmp(code, "023957", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CHARGE_CONNECTOR = NO;
-					if (strncmp(code, "023958", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTP = NO;
-					if (strncmp(code, "023959", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTHER = NO;
-					if (strncmp(code, "023960", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_HIGH_V = NO;
-					if (strncmp(code, "023961", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CC2 = NO;
-					if (strncmp(code, "023962", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CURRENT = NO;
-					if (strncmp(code, "023963", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_VOLTAGE = NO;
-					if (strncmp(code, "023964", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GET_BST_NO_REASON = NO;
-					if (strncmp(code, "023970", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_OVER_VOLTAGE = NO;
-					if (strncmp(code, "023971", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_UNDER_VOLTAGE = NO;
-					if (strncmp(code, "023972", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OVER_SOC = NO;
-					if (strncmp(code, "023973", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_UNDER_SOC = NO;
-					if (strncmp(code, "023974", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CURRENT = NO;
-					if (strncmp(code, "023975", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_TEMPERATURE = NO;
-					if (strncmp(code, "023976", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_ISOLATE = NO;
-					if (strncmp(code, "023977", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OUTPUT_CONNECTOR = NO;
-				}
-			}
-		}
-	}
+    bool isCleanCheck = false;
+    char code[7];
+
+    if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) == EQUAL) {
+        return;
+    }
+
+    if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023702", 6) == EQUAL &&
+            ShmStatusCodeData->InfoCode.InfoEvents.bits.GbEvCommFail == YES) {
+        memcpy(code, "023702", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023900", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_LOS_CC1 == YES) {
+        memcpy(code, "023900", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023901", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CONNECTOR_LOCK_FAIL == YES) {
+        memcpy(code, "023901", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023902", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BATTERY_INCOMPATIBLE == YES) {
+        memcpy(code, "023902", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023903", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_BROAA_TIMEOUT == YES) {
+        memcpy(code, "023903", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023904", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CSU_PRECHARGE_TIMEOUT == YES) {
+        memcpy(code, "023904", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023905", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_PRESENT_VOLTAGE_FAULT == YES) {
+        memcpy(code, "023905", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023906", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_VOLTAGE_OVER_RANGE == YES) {
+        memcpy(code, "023906", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023907", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BSM_CHARGE_ALLOW_00_10MIN_COUUNTDONE == YES) {
+        memcpy(code, "023907", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023908", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_WAIT_GROUNDFAULT_TIMEOUT == YES) {
+        memcpy(code, "023908", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023909", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_10V == YES) {
+        memcpy(code, "023909", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023910", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_60V == YES) {
+        memcpy(code, "023910", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023911", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_NORMAL_STOP_CMD == YES) {
+        memcpy(code, "023911", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023912", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_EMERGENCY_STOP_CMD == YES) {
+        memcpy(code, "023912", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023913", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ISOLATION_RESULT_FAIL == YES) {
+        memcpy(code, "023913", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023914", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_MOTHER_BOARD_MISS_LINK == YES) {
+        memcpy(code, "023914", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023915", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_LIMIT == YES) {
+        memcpy(code, "023915", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023916", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_REQ_CURRENT_MORE_THAN_LIMIT == YES) {
+        memcpy(code, "023916", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023917", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_10_PERCENT == YES) {
+        memcpy(code, "023917", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023918", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_DIFF_BCS_5_PERCENT == YES) {
+        memcpy(code, "023918", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023919", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_STOP_ADC_MORE_THAN_10V == YES) {
+        memcpy(code, "023919", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023930", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BHM_TIMEOUT == YES) {
+        memcpy(code, "023930", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023931", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRM_TIMEOUT == YES) {
+        memcpy(code, "023931", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023932", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCP_TIMEOUT == YES) {
+        memcpy(code, "023932", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023933", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRO_TIMEOUT == YES) {
+        memcpy(code, "023933", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023934", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCL_TIMEOUT == YES) {
+        memcpy(code, "023934", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023935", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCS_TIMEOUT == YES) {
+        memcpy(code, "023935", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023936", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSM_TIMEOUT == YES) {
+        memcpy(code, "023936", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023937", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BST_TIMEOUT == YES) {
+        memcpy(code, "023937", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023938", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSD_TIMEOUT == YES) {
+        memcpy(code, "023938", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023939", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BEM_OTHER_TIMEOUT == YES) {
+        memcpy(code, "023939", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023940", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRM_TIMEOUT == YES) {
+        memcpy(code, "023940", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023941", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRMAA_TIMEOUT == YES) {
+        memcpy(code, "023941", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023942", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CTS_CML_TIMEOUT == YES) {
+        memcpy(code, "023942", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023943", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRO_TIMEOUT == YES) {
+        memcpy(code, "023943", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023944", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CCS_TIMEOUT == YES) {
+        memcpy(code, "023944", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023945", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CST_TIMEOUT == YES) {
+        memcpy(code, "023945", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023946", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CSD_TIMEOUT == YES) {
+        memcpy(code, "023946", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023947", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_BEM_OTHER_TIMEOUT == YES) {
+        memcpy(code, "023947", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023950", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_SOC_GOAL == YES) {
+        memcpy(code, "023950", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023951", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_TOTAL_VOLTAGE_GOAL == YES) {
+        memcpy(code, "023951", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023952", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CELL_VOLTAGE_GOAL == YES) {
+        memcpy(code, "023952", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023953", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_GET_CST == YES) {
+        memcpy(code, "023953", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023954", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_ISOLATION == YES) {
+        memcpy(code, "023954", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023955", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OUTPUT_CONNECTOR_OTP == YES) {
+        memcpy(code, "023955", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023956", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_COMPONENT == YES) {
+        memcpy(code, "023956", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023957", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CHARGE_CONNECTOR == YES) {
+        memcpy(code, "023957", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023958", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTP == YES) {
+        memcpy(code, "023958", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023959", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTHER == YES) {
+        memcpy(code, "023959", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023960", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_HIGH_V == YES) {
+        memcpy(code, "023960", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023961", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CC2 == YES) {
+        memcpy(code, "023961", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023962", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CURRENT == YES) {
+        memcpy(code, "023962", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023963", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_VOLTAGE == YES) {
+        memcpy(code, "023963", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023964", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GET_BST_NO_REASON == YES) {
+        memcpy(code, "023964", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023970", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_OVER_VOLTAGE == YES) {
+        memcpy(code, "023970", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023971", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_UNDER_VOLTAGE == YES) {
+        memcpy(code, "023971", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023972", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OVER_SOC == YES) {
+        memcpy(code, "023972", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023973", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_UNDER_SOC == YES) {
+        memcpy(code, "023973", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023974", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CURRENT == YES) {
+        memcpy(code, "023974", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023975", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_TEMPERATURE == YES) {
+        memcpy(code, "023975", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023976", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_ISOLATE == YES) {
+        memcpy(code, "023976", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023977", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OUTPUT_CONNECTOR == YES) {
+        memcpy(code, "023977", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    }
+
+    if (isCleanCheck) {
+        for (byte index = 0; index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; index++) {
+            if (index != gun_index || ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1) {
+                PRINTF_FUNC("GBT clean error : index = %d, EvConnAlarmCode = %s, code = %s \n", index, _chargingData[index]->EvConnAlarmCode, code);
+                if (strncmp((char *)_chargingData[index]->EvConnAlarmCode, code, 6) != EQUAL) {
+                    if (strncmp(code, "023702", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.GbEvCommFail = NO; }
+                    if (strncmp(code, "023900", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_LOS_CC1 = NO; }
+                    if (strncmp(code, "023901", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CONNECTOR_LOCK_FAIL = NO; }
+                    if (strncmp(code, "023902", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BATTERY_INCOMPATIBLE = NO; }
+                    if (strncmp(code, "023903", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_BROAA_TIMEOUT = NO; }
+                    if (strncmp(code, "023904", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CSU_PRECHARGE_TIMEOUT = NO; }
+                    if (strncmp(code, "023905", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_PRESENT_VOLTAGE_FAULT = NO; }
+                    if (strncmp(code, "023906", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_VOLTAGE_OVER_RANGE = NO; }
+                    if (strncmp(code, "023907", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BSM_CHARGE_ALLOW_00_10MIN_COUUNTDONE = NO; }
+                    if (strncmp(code, "023908", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_WAIT_GROUNDFAULT_TIMEOUT = NO; }
+                    if (strncmp(code, "023909", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_10V = NO; }
+                    if (strncmp(code, "023910", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_60V = NO; }
+                    if (strncmp(code, "023911", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_NORMAL_STOP_CMD = NO; }
+                    if (strncmp(code, "023912", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_EMERGENCY_STOP_CMD = NO; }
+                    if (strncmp(code, "023913", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ISOLATION_RESULT_FAIL = NO; }
+                    if (strncmp(code, "023914", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_MOTHER_BOARD_MISS_LINK = NO; }
+                    if (strncmp(code, "023915", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_LIMIT = NO; }
+                    if (strncmp(code, "023916", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_REQ_CURRENT_MORE_THAN_LIMIT = NO; }
+                    if (strncmp(code, "023917", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_10_PERCENT = NO; }
+                    if (strncmp(code, "023918", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_DIFF_BCS_5_PERCENT = NO; }
+                    if (strncmp(code, "023919", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_STOP_ADC_MORE_THAN_10V = NO; }
+                    if (strncmp(code, "023930", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BHM_TIMEOUT = NO; }
+                    if (strncmp(code, "023931", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRM_TIMEOUT = NO; }
+                    if (strncmp(code, "023932", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCP_TIMEOUT = NO; }
+                    if (strncmp(code, "023933", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRO_TIMEOUT = NO; }
+                    if (strncmp(code, "023934", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCL_TIMEOUT = NO; }
+                    if (strncmp(code, "023935", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCS_TIMEOUT = NO; }
+                    if (strncmp(code, "023936", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSM_TIMEOUT = NO; }
+                    if (strncmp(code, "023937", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BST_TIMEOUT = NO; }
+                    if (strncmp(code, "023938", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSD_TIMEOUT = NO; }
+                    if (strncmp(code, "023939", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BEM_OTHER_TIMEOUT = NO; }
+                    if (strncmp(code, "023940", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRM_TIMEOUT = NO; }
+                    if (strncmp(code, "023941", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRMAA_TIMEOUT = NO; }
+                    if (strncmp(code, "023942", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CTS_CML_TIMEOUT = NO; }
+                    if (strncmp(code, "023943", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRO_TIMEOUT = NO; }
+                    if (strncmp(code, "023944", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CCS_TIMEOUT = NO; }
+                    if (strncmp(code, "023945", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CST_TIMEOUT = NO; }
+                    if (strncmp(code, "023946", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CSD_TIMEOUT = NO; }
+                    if (strncmp(code, "023947", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_BEM_OTHER_TIMEOUT = NO; }
+                    if (strncmp(code, "023950", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_SOC_GOAL = NO; }
+                    if (strncmp(code, "023951", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_TOTAL_VOLTAGE_GOAL = NO; }
+                    if (strncmp(code, "023952", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CELL_VOLTAGE_GOAL = NO; }
+                    if (strncmp(code, "023953", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_GET_CST = NO; }
+                    if (strncmp(code, "023954", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_ISOLATION = NO; }
+                    if (strncmp(code, "023955", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OUTPUT_CONNECTOR_OTP = NO; }
+                    if (strncmp(code, "023956", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_COMPONENT = NO; }
+                    if (strncmp(code, "023957", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CHARGE_CONNECTOR = NO; }
+                    if (strncmp(code, "023958", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTP = NO; }
+                    if (strncmp(code, "023959", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTHER = NO; }
+                    if (strncmp(code, "023960", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_HIGH_V = NO; }
+                    if (strncmp(code, "023961", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CC2 = NO; }
+                    if (strncmp(code, "023962", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CURRENT = NO; }
+                    if (strncmp(code, "023963", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_VOLTAGE = NO; }
+                    if (strncmp(code, "023964", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GET_BST_NO_REASON = NO; }
+                    if (strncmp(code, "023970", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_OVER_VOLTAGE = NO; }
+                    if (strncmp(code, "023971", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_UNDER_VOLTAGE = NO; }
+                    if (strncmp(code, "023972", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OVER_SOC = NO; }
+                    if (strncmp(code, "023973", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_UNDER_SOC = NO; }
+                    if (strncmp(code, "023974", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CURRENT = NO; }
+                    if (strncmp(code, "023975", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_TEMPERATURE = NO; }
+                    if (strncmp(code, "023976", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_ISOLATE = NO; }
+                    if (strncmp(code, "023977", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OUTPUT_CONNECTOR = NO; }
+                }
+            }
+        }
+    }
 }
 
 void ClearAbnormalStatus_CCS(byte gun_index)
 {
-	bool isCleanCheck = false;
-	char code[7];
-
-	if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) == EQUAL)
-		return;
-
-	if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023701", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail == YES)
-	{
-		memcpy(code, "023701", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023737", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsRESTemperatureInhibit == YES)
-	{
-		memcpy(code, "023737", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023738", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVShiftPosition == YES)
-	{
-		memcpy(code, "023738", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023739", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargerConnectorLockFault == YES)
-	{
-		memcpy(code, "023739", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023740", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVRESSMalfunction == YES)
-	{
-		memcpy(code, "023740", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023741", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingCurrentdifferential == YES)
-	{
-		memcpy(code, "023741", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023742", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingVoltageOutOfRange == YES)
-	{
-		memcpy(code, "023742", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023743", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingSystemIncompatibility == YES)
-	{
-		memcpy(code, "023743", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023744", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEmergencyEvent == YES)
-	{
-		memcpy(code, "023744", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023745", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsBreaker == YES)
-	{
-		memcpy(code, "023745", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023746", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoData == YES)
-	{
-		memcpy(code, "023746", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023747", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_A == YES)
-	{
-		memcpy(code, "023747", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023748", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_B == YES)
-	{
-		memcpy(code, "023748", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023749", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_C == YES)
-	{
-		memcpy(code, "023749", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023750", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_1 == YES)
-	{
-		memcpy(code, "023750", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023751", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_2 == YES)
-	{
-		memcpy(code, "023751", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023752", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_3 == YES)
-	{
-		memcpy(code, "023752", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023753", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_1 == YES)
-	{
-		memcpy(code, "023753", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023754", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_2 == YES)
-	{
-		memcpy(code, "023754", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023755", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_3 == YES)
-	{
-		memcpy(code, "023755", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023756", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_4 == YES)
-	{
-		memcpy(code, "023756", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023757", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_5 == YES)
-	{
-		memcpy(code, "023757", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023758", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequenceError == YES)
-	{
-		memcpy(code, "023758", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023759", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSignatureError == YES)
-	{
-		memcpy(code, "023759", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023760", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnknownSession == YES)
-	{
-		memcpy(code, "023760", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023761", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceIDInvalid == YES)
-	{
-		memcpy(code, "023761", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023762", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPaymentSelectionInvalid == YES)
-	{
-		memcpy(code, "023762", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023763", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsIdentificationSelectionInvalid == YES)
-	{
-		memcpy(code, "023763", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023764", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceSelectionInvalid == YES)
-	{
-		memcpy(code, "023764", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023765", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateExpired == YES)
-	{
-		memcpy(code, "023765", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023766", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotYetValid == YES)
-	{
-		memcpy(code, "023766", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023767", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateRevoked == YES)
-	{
-		memcpy(code, "023767", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023768", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoCertificateAvailable == YES)
-	{
-		memcpy(code, "023768", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023769", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertChainError == YES)
-	{
-		memcpy(code, "023769", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023770", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertValidationError == YES)
-	{
-		memcpy(code, "023770", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023771", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertVerificationError == YES)
-	{
-		memcpy(code, "023771", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023772", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractCanceled == YES)
-	{
-		memcpy(code, "023772", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023773", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChallengeInvalid == YES)
-	{
-		memcpy(code, "023773", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023774", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongEnergyTransferMode == YES)
-	{
-		memcpy(code, "023774", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023775", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongChargeParameter == YES)
-	{
-		memcpy(code, "023775", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023776", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingProfileInvalid == YES)
-	{
-		memcpy(code, "023776", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023777", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTariffSelectionInvalid == YES)
-	{
-		memcpy(code, "023777", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023778", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEPresentVoltageToLow == YES)
-	{
-		memcpy(code, "023778", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023779", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryNotApplied == YES)
-	{
-		memcpy(code, "023779", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023780", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMeteringSignatureNotValid == YES)
-	{
-		memcpy(code, "023780", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023781", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoChargeServiceSelected == YES)
-	{
-		memcpy(code, "023781", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023782", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContactorError == YES)
-	{
-		memcpy(code, "023782", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023783", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotAllowedAtThisEVSE == YES)
-	{
-		memcpy(code, "023783", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023784", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsGAChargeStop == YES)
-	{
-		memcpy(code, "023784", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023785", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAlignmentError == YES)
-	{
-		memcpy(code, "023785", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023786", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsACDError == YES)
-	{
-		memcpy(code, "023786", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023787", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAssociationError == YES)
-	{
-		memcpy(code, "023787", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023788", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEChargeAbort == YES)
-	{
-		memcpy(code, "023788", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023789", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoSupportedAppProtocol == YES)
-	{
-		memcpy(code, "023789", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023790", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractNotAccepted == YES)
-	{
-		memcpy(code, "023790", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023791", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMOUnknown == YES)
-	{
-		memcpy(code, "023791", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023792", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_Prov_CertificateRevoke == YES)
-	{
-		memcpy(code, "023792", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023793", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA1_CertificateRevoked == YES)
-	{
-		memcpy(code, "023793", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023794", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA2_CertificateRevoked == YES)
-	{
-		memcpy(code, "023794", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023795", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_RootCA_CertificateRevoked == YES)
-	{
-		memcpy(code, "023795", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023796", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_Prov_CertificateRevoked == YES)
-	{
-		memcpy(code, "023796", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023797", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA1_CertificateRevoked == YES)
-	{
-		memcpy(code, "023797", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023798", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA2_CertificateRevoked == YES)
-	{
-		memcpy(code, "023798", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023799", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_RootCA_CertificateRevoked == YES)
-	{
-		memcpy(code, "023799", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023800", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_Prov_CertificateRevoked == YES)
-	{
-		memcpy(code, "023800", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023801", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA1_CertificateRevoked == YES)
-	{
-		memcpy(code, "023801", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023802", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA2_CertificateRevoked == YES)
-	{
-		memcpy(code, "023802", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023803", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_RootCA_CertificateRevoked == YES)
-	{
-		memcpy(code, "023803", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023809", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_SLAC_init == YES)
-	{
-		memcpy(code, "023809", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023810", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_match_response == YES)
-	{
-		memcpy(code, "023810", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023811", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_sequence == YES)
-	{
-		memcpy(code, "023811", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023812", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_match_MNBC == YES)
-	{
-		memcpy(code, "023812", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023813", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_avg_atten_calc == YES)
-	{
-		memcpy(code, "023813", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023814", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_response == YES)
-	{
-		memcpy(code, "023814", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023815", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_match_session == YES)
-	{
-		memcpy(code, "023815", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023816", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_assoc_session == YES)
-	{
-		memcpy(code, "023816", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023817", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_vald_toggle == YES)
-	{
-		memcpy(code, "023817", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023818", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmMnbcSound == YES)
-	{
-		memcpy(code, "023818", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023819", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmValidateReq == YES)
-	{
-		memcpy(code, "023819", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023823", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUDP_TT_match_join == YES)
-	{
-		memcpy(code, "023823", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023824", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTCP_TT_match_join == YES)
-	{
-		memcpy(code, "023824", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023825", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_amp_map_exchange == YES)
-	{
-		memcpy(code, "023825", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023826", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_link_ready_notification == YES)
-	{
-		memcpy(code, "023826", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023832", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSupportedAppProtocolRes == YES)
-	{
-		memcpy(code, "023832", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023833", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionSetupRes == YES)
-	{
-		memcpy(code, "023833", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023834", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceDiscoveryRes == YES)
-	{
-		memcpy(code, "023834", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023835", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServicePaymentSelectionRes == YES)
-	{
-		memcpy(code, "023835", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023836", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractAuthenticationRes == YES)
-	{
-		memcpy(code, "023836", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023837", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargeParameterDiscoveryRes == YES)
-	{
-		memcpy(code, "023837", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023838", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryRes == YES)
-	{
-		memcpy(code, "023838", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023839", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheckRes == YES)
-	{
-		memcpy(code, "023839", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023840", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPreChargeRes == YES)
-	{
-		memcpy(code, "023840", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023841", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCurrentDemandRes == YES)
-	{
-		memcpy(code, "023841", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023842", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWeldingDetectionRes == YES)
-	{
-		memcpy(code, "023842", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023843", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionStopRes == YES)
-	{
-		memcpy(code, "023843", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023844", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequence_Time == YES)
-	{
-		memcpy(code, "023844", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023845", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsReadyToCharge_Performance_Time == YES)
-	{
-		memcpy(code, "023845", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023846", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCommunicationSetup_Performance_Time == YES)
-	{
-		memcpy(code, "023846", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023847", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheck_Performance_Time == YES)
-	{
-		memcpy(code, "023847", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023848", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPState_Detection_Time == YES)
-	{
-		memcpy(code, "023848", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023849", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPOscillator_Retain_Time == YES)
-	{
-		memcpy(code, "023849", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023850", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutV2GPreChargePerformaceTime == YES)
-	{
-		memcpy(code, "023850", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023855", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_TARGET_INFO == YES)
-	{
-		memcpy(code, "023855", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023856", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_TARGET_INFO == YES)
-	{
-		memcpy(code, "023856", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023857", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_BATTERY_INFO == YES)
-	{
-		memcpy(code, "023857", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023858", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_BATTERY_INFO == YES)
-	{
-		memcpy(code, "023858", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023859", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EV_STOP_EVENT == YES)
-	{
-		memcpy(code, "023859", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023860", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EV_STOP_EVENT == YES)
-	{
-		memcpy(code, "023860", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023861", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_STOP_EVENT == YES)
-	{
-		memcpy(code, "023861", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023862", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_STOP_EVENT == YES)
-	{
-		memcpy(code, "023862", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023863", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_MISC_INFO == YES)
-	{
-		memcpy(code, "023863", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023864", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_MISC_INFO == YES)
-	{
-		memcpy(code, "023864", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023865", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_REQUEST == YES)
-	{
-		memcpy(code, "023865", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023866", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_REQUEST == YES)
-	{
-		memcpy(code, "023866", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023867", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_START_BLOCK_TRANSFER == YES)
-	{
-		memcpy(code, "023867", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023868", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_START_BLOCK_TRANSFER == YES)
-	{
-		memcpy(code, "023868", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023869", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DATA_TRANSFER == YES)
-	{
-		memcpy(code, "023869", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023870", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DATA_TRANSFER == YES)
-	{
-		memcpy(code, "023870", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023871", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_FINISH == YES)
-	{
-		memcpy(code, "023871", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023872", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_FINISH == YES)
-	{
-		memcpy(code, "023872", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023873", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_ISOLATION_STATUS == YES)
-	{
-		memcpy(code, "023873", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023874", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_ISOLATION_STATUS == YES)
-	{
-		memcpy(code, "023874", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023875", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_CONNECTOR_INFO == YES)
-	{
-		memcpy(code, "023875", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023876", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_CONNECTOR_INFO == YES)
-	{
-		memcpy(code, "023876", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023877", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_RTC_INFO == YES)
-	{
-		memcpy(code, "023877", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023878", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_RTC_INFO == YES)
-	{
-		memcpy(code, "023878", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023879", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_PRECHARGE_INFO == YES)
-	{
-		memcpy(code, "023879", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023880", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_PRECHARGE_INFO == YES)
-	{
-		memcpy(code, "023880", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023881", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMSG_Sequence == YES)
-	{
-		memcpy(code, "023881", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023882", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCAN_MSG_Unrecognized_CMD_ID == YES)
-	{
-		memcpy(code, "023882", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023883", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Decode_Error == YES)
-	{
-		memcpy(code, "023883", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023884", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Encode_Error == YES)
-	{
-		memcpy(code, "023884", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023885", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Decode_Error == YES)
-	{
-		memcpy(code, "023885", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023886", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Encode_Error == YES)
-	{
-		memcpy(code, "023886", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023887", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Decode_Error == YES)
-	{
-		memcpy(code, "023887", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023888", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Encode_Error == YES)
-	{
-		memcpy(code, "023888", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023889", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCpStatus_Error == YES)
-	{
-		memcpy(code, "023889", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023890", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnexpectVolBeforeCharing_Error == YES)
-	{
-		memcpy(code, "023890", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023891", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccNotReadyForCharging == YES)
-	{
-		memcpy(code, "023891", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-//	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023892", 6) == EQUAL &&
-//			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutQCA7000Comm == YES)
-//	{
-//		memcpy(code, "023892", 6);
-//		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-//		isCleanCheck = true;
-//	}
-	else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023893", 6) == EQUAL &&
-			ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccFailForQCA7000SetKey == YES)
-	{
-		memcpy(code, "023893", 6);
-		memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
-		isCleanCheck = true;
-	}
-
-	if (isCleanCheck)
-	{
-		for (byte index = 0; index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; index++)
-		{
-			if (index != gun_index || ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1)
-			{
-				PRINTF_FUNC("CCS clean error : index = %d, EvConnAlarmCode = %s, code = %s \n", index, _chargingData[index]->EvConnAlarmCode, code);
-				if (strncmp((char *)_chargingData[index]->EvConnAlarmCode, code, 6) != EQUAL)
-				{
-					if (strncmp(code, "023701", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail = NO;
-					if (strncmp(code, "023737", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsRESTemperatureInhibit = NO;
-					if (strncmp(code, "023738", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVShiftPosition = NO;
-					if (strncmp(code, "023739", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargerConnectorLockFault = NO;
-					if (strncmp(code, "023740", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVRESSMalfunction = NO;
-					if (strncmp(code, "023741", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingCurrentdifferential = NO;
-					if (strncmp(code, "023742", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingVoltageOutOfRange = NO;
-					if (strncmp(code, "023743", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingSystemIncompatibility = NO;
-					if (strncmp(code, "023744", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEmergencyEvent = NO;
-					if (strncmp(code, "023745", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsBreaker = NO;
-					if (strncmp(code, "023746", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoData = NO;
-					if (strncmp(code, "023747", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_A = NO;
-					if (strncmp(code, "023748", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_B = NO;
-					if (strncmp(code, "023749", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_C = NO;
-					if (strncmp(code, "023750", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_1 = NO;
-					if (strncmp(code, "023751", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_2 = NO;
-					if (strncmp(code, "023752", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_3 = NO;
-					if (strncmp(code, "023753", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_1 = NO;
-					if (strncmp(code, "023754", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_2 = NO;
-					if (strncmp(code, "023755", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_3 = NO;
-					if (strncmp(code, "023756", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_4 = NO;
-					if (strncmp(code, "023757", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_5 = NO;
-					if (strncmp(code, "023758", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequenceError = NO;
-					if (strncmp(code, "023759", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSignatureError = NO;
-					if (strncmp(code, "023760", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnknownSession = NO;
-					if (strncmp(code, "023761", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceIDInvalid = NO;
-					if (strncmp(code, "023762", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPaymentSelectionInvalid = NO;
-					if (strncmp(code, "023763", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsIdentificationSelectionInvalid = NO;
-					if (strncmp(code, "023764", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceSelectionInvalid = NO;
-					if (strncmp(code, "023765", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateExpired = NO;
-					if (strncmp(code, "023766", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotYetValid = NO;
-					if (strncmp(code, "023767", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateRevoked = NO;
-					if (strncmp(code, "023768", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoCertificateAvailable = NO;
-					if (strncmp(code, "023769", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertChainError = NO;
-					if (strncmp(code, "023770", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertValidationError = NO;
-					if (strncmp(code, "023771", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertVerificationError = NO;
-					if (strncmp(code, "023772", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractCanceled = NO;
-					if (strncmp(code, "023773", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChallengeInvalid = NO;
-					if (strncmp(code, "023774", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongEnergyTransferMode = NO;
-					if (strncmp(code, "023775", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongChargeParameter = NO;
-					if (strncmp(code, "023776", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingProfileInvalid = NO;
-					if (strncmp(code, "023777", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTariffSelectionInvalid = NO;
-					if (strncmp(code, "023778", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEPresentVoltageToLow = NO;
-					if (strncmp(code, "023779", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryNotApplied = NO;
-					if (strncmp(code, "023780", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMeteringSignatureNotValid = NO;
-					if (strncmp(code, "023781", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoChargeServiceSelected = NO;
-					if (strncmp(code, "023782", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContactorError = NO;
-					if (strncmp(code, "023783", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotAllowedAtThisEVSE = NO;
-					if (strncmp(code, "023784", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsGAChargeStop = NO;
-					if (strncmp(code, "023785", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAlignmentError = NO;
-					if (strncmp(code, "023786", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsACDError = NO;
-					if (strncmp(code, "023787", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAssociationError = NO;
-					if (strncmp(code, "023788", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEChargeAbort = NO;
-					if (strncmp(code, "023789", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoSupportedAppProtocol = NO;
-					if (strncmp(code, "023790", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractNotAccepted = NO;
-					if (strncmp(code, "023791", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMOUnknown = NO;
-					if (strncmp(code, "023792", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_Prov_CertificateRevoke = NO;
-					if (strncmp(code, "023793", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA1_CertificateRevoked = NO;
-					if (strncmp(code, "023794", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA2_CertificateRevoked = NO;
-					if (strncmp(code, "023795", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_RootCA_CertificateRevoked = NO;
-					if (strncmp(code, "023796", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_Prov_CertificateRevoked = NO;
-					if (strncmp(code, "023797", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA1_CertificateRevoked = NO;
-					if (strncmp(code, "023798", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA2_CertificateRevoked = NO;
-					if (strncmp(code, "023799", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_RootCA_CertificateRevoked = NO;
-					if (strncmp(code, "023800", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_Prov_CertificateRevoked = NO;
-					if (strncmp(code, "023801", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA1_CertificateRevoked = NO;
-					if (strncmp(code, "023802", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA2_CertificateRevoked = NO;
-					if (strncmp(code, "023803", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_RootCA_CertificateRevoked = NO;
-					if (strncmp(code, "023809", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_SLAC_init = NO;
-					if (strncmp(code, "023810", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_match_response = NO;
-					if (strncmp(code, "023811", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_sequence = NO;
-					if (strncmp(code, "023812", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_match_MNBC = NO;
-					if (strncmp(code, "023813", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_avg_atten_calc = NO;
-					if (strncmp(code, "023814", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_response = NO;
-					if (strncmp(code, "023815", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_match_session = NO;
-					if (strncmp(code, "023816", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_assoc_session = NO;
-					if (strncmp(code, "023817", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_vald_toggle = NO;
-					if (strncmp(code, "023818", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmMnbcSound = NO;
-					if (strncmp(code, "023819", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmValidateReq = NO;
-					if (strncmp(code, "023823", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUDP_TT_match_join = NO;
-					if (strncmp(code, "023824", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTCP_TT_match_join = NO;
-					if (strncmp(code, "023825", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_amp_map_exchange = NO;
-					if (strncmp(code, "023826", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_link_ready_notification = NO;
-					if (strncmp(code, "023832", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSupportedAppProtocolRes = NO;
-					if (strncmp(code, "023833", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionSetupRes = NO;
-					if (strncmp(code, "023834", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceDiscoveryRes = NO;
-					if (strncmp(code, "023835", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServicePaymentSelectionRes = NO;
-					if (strncmp(code, "023836", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractAuthenticationRes = NO;
-					if (strncmp(code, "023837", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargeParameterDiscoveryRes = NO;
-					if (strncmp(code, "023838", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryRes = NO;
-					if (strncmp(code, "023839", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheckRes = NO;
-					if (strncmp(code, "023840", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPreChargeRes = NO;
-					if (strncmp(code, "023841", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCurrentDemandRes = NO;
-					if (strncmp(code, "023842", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWeldingDetectionRes = NO;
-					if (strncmp(code, "023843", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionStopRes = NO;
-					if (strncmp(code, "023844", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequence_Time = NO;
-					if (strncmp(code, "023845", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsReadyToCharge_Performance_Time = NO;
-					if (strncmp(code, "023846", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCommunicationSetup_Performance_Time = NO;
-					if (strncmp(code, "023847", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheck_Performance_Time = NO;
-					if (strncmp(code, "023848", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPState_Detection_Time = NO;
-					if (strncmp(code, "023849", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPOscillator_Retain_Time = NO;
-					if (strncmp(code, "023850", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutV2GPreChargePerformaceTime = NO;
-					if (strncmp(code, "023855", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_TARGET_INFO = NO;
-					if (strncmp(code, "023856", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_TARGET_INFO = NO;
-					if (strncmp(code, "023857", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_BATTERY_INFO = NO;
-					if (strncmp(code, "023858", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_BATTERY_INFO = NO;
-					if (strncmp(code, "023859", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EV_STOP_EVENT = NO;
-					if (strncmp(code, "023860", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EV_STOP_EVENT = NO;
-					if (strncmp(code, "023861", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_STOP_EVENT = NO;
-					if (strncmp(code, "023862", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_STOP_EVENT = NO;
-					if (strncmp(code, "023863", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_MISC_INFO = NO;
-					if (strncmp(code, "023864", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_MISC_INFO = NO;
-					if (strncmp(code, "023865", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_REQUEST = NO;
-					if (strncmp(code, "023866", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_REQUEST = NO;
-					if (strncmp(code, "023867", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_START_BLOCK_TRANSFER = NO;
-					if (strncmp(code, "023868", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_START_BLOCK_TRANSFER = NO;
-					if (strncmp(code, "023869", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DATA_TRANSFER = NO;
-					if (strncmp(code, "023870", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DATA_TRANSFER = NO;
-					if (strncmp(code, "023871", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_FINISH = NO;
-					if (strncmp(code, "023872", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_FINISH = NO;
-					if (strncmp(code, "023873", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_ISOLATION_STATUS = NO;
-					if (strncmp(code, "023874", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_ISOLATION_STATUS = NO;
-					if (strncmp(code, "023875", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_CONNECTOR_INFO = NO;
-					if (strncmp(code, "023876", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_CONNECTOR_INFO = NO;
-					if (strncmp(code, "023877", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_RTC_INFO = NO;
-					if (strncmp(code, "023878", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_RTC_INFO = NO;
-					if (strncmp(code, "023879", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_PRECHARGE_INFO = NO;
-					if (strncmp(code, "023880", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_PRECHARGE_INFO = NO;
-					if (strncmp(code, "023881", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMSG_Sequence = NO;
-					if (strncmp(code, "023882", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCAN_MSG_Unrecognized_CMD_ID = NO;
-					if (strncmp(code, "023883", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Decode_Error = NO;
-					if (strncmp(code, "023884", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Encode_Error = NO;
-					if (strncmp(code, "023885", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Decode_Error = NO;
-					if (strncmp(code, "023886", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Encode_Error = NO;
-					if (strncmp(code, "023887", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Decode_Error = NO;
-					if (strncmp(code, "023888", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Encode_Error = NO;
-					if (strncmp(code, "023889", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCpStatus_Error = NO;
-					if (strncmp(code, "023890", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnexpectVolBeforeCharing_Error = NO;
-					if (strncmp(code, "023891", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccNotReadyForCharging = NO;
-					//if (strncmp(code, "023892", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutQCA7000Comm = NO;
-					if (strncmp(code, "023893", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccFailForQCA7000SetKey = NO;
-				}
-			}
-		}
-	}
+    bool isCleanCheck = false;
+    char code[7];
+
+    if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) == EQUAL) {
+        return;
+    }
+
+    if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023701", 6) == EQUAL &&
+            ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail == YES) {
+        memcpy(code, "023701", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023737", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsRESTemperatureInhibit == YES) {
+        memcpy(code, "023737", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023738", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVShiftPosition == YES) {
+        memcpy(code, "023738", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023739", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargerConnectorLockFault == YES) {
+        memcpy(code, "023739", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023740", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVRESSMalfunction == YES) {
+        memcpy(code, "023740", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023741", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingCurrentdifferential == YES) {
+        memcpy(code, "023741", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023742", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingVoltageOutOfRange == YES) {
+        memcpy(code, "023742", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023743", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingSystemIncompatibility == YES) {
+        memcpy(code, "023743", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023744", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEmergencyEvent == YES) {
+        memcpy(code, "023744", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023745", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsBreaker == YES) {
+        memcpy(code, "023745", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023746", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoData == YES) {
+        memcpy(code, "023746", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023747", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_A == YES) {
+        memcpy(code, "023747", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023748", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_B == YES) {
+        memcpy(code, "023748", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023749", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_C == YES) {
+        memcpy(code, "023749", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023750", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_1 == YES) {
+        memcpy(code, "023750", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023751", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_2 == YES) {
+        memcpy(code, "023751", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023752", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_3 == YES) {
+        memcpy(code, "023752", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023753", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_1 == YES) {
+        memcpy(code, "023753", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023754", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_2 == YES) {
+        memcpy(code, "023754", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023755", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_3 == YES) {
+        memcpy(code, "023755", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023756", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_4 == YES) {
+        memcpy(code, "023756", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023757", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_5 == YES) {
+        memcpy(code, "023757", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023758", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequenceError == YES) {
+        memcpy(code, "023758", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023759", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSignatureError == YES) {
+        memcpy(code, "023759", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023760", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnknownSession == YES) {
+        memcpy(code, "023760", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023761", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceIDInvalid == YES) {
+        memcpy(code, "023761", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023762", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPaymentSelectionInvalid == YES) {
+        memcpy(code, "023762", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023763", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsIdentificationSelectionInvalid == YES) {
+        memcpy(code, "023763", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023764", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceSelectionInvalid == YES) {
+        memcpy(code, "023764", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023765", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateExpired == YES) {
+        memcpy(code, "023765", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023766", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotYetValid == YES) {
+        memcpy(code, "023766", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023767", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateRevoked == YES) {
+        memcpy(code, "023767", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023768", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoCertificateAvailable == YES) {
+        memcpy(code, "023768", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023769", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertChainError == YES) {
+        memcpy(code, "023769", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023770", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertValidationError == YES) {
+        memcpy(code, "023770", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023771", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertVerificationError == YES) {
+        memcpy(code, "023771", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023772", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractCanceled == YES) {
+        memcpy(code, "023772", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023773", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChallengeInvalid == YES) {
+        memcpy(code, "023773", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023774", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongEnergyTransferMode == YES) {
+        memcpy(code, "023774", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023775", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongChargeParameter == YES) {
+        memcpy(code, "023775", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023776", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingProfileInvalid == YES) {
+        memcpy(code, "023776", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023777", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTariffSelectionInvalid == YES) {
+        memcpy(code, "023777", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023778", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEPresentVoltageToLow == YES) {
+        memcpy(code, "023778", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023779", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryNotApplied == YES) {
+        memcpy(code, "023779", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023780", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMeteringSignatureNotValid == YES) {
+        memcpy(code, "023780", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023781", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoChargeServiceSelected == YES) {
+        memcpy(code, "023781", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023782", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContactorError == YES) {
+        memcpy(code, "023782", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023783", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotAllowedAtThisEVSE == YES) {
+        memcpy(code, "023783", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023784", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsGAChargeStop == YES) {
+        memcpy(code, "023784", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023785", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAlignmentError == YES) {
+        memcpy(code, "023785", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023786", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsACDError == YES) {
+        memcpy(code, "023786", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023787", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAssociationError == YES) {
+        memcpy(code, "023787", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023788", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEChargeAbort == YES) {
+        memcpy(code, "023788", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023789", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoSupportedAppProtocol == YES) {
+        memcpy(code, "023789", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023790", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractNotAccepted == YES) {
+        memcpy(code, "023790", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023791", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMOUnknown == YES) {
+        memcpy(code, "023791", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023792", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_Prov_CertificateRevoke == YES) {
+        memcpy(code, "023792", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023793", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA1_CertificateRevoked == YES) {
+        memcpy(code, "023793", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023794", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA2_CertificateRevoked == YES) {
+        memcpy(code, "023794", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023795", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_RootCA_CertificateRevoked == YES) {
+        memcpy(code, "023795", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023796", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_Prov_CertificateRevoked == YES) {
+        memcpy(code, "023796", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023797", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA1_CertificateRevoked == YES) {
+        memcpy(code, "023797", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023798", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA2_CertificateRevoked == YES) {
+        memcpy(code, "023798", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023799", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_RootCA_CertificateRevoked == YES) {
+        memcpy(code, "023799", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023800", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_Prov_CertificateRevoked == YES) {
+        memcpy(code, "023800", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023801", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA1_CertificateRevoked == YES) {
+        memcpy(code, "023801", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023802", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA2_CertificateRevoked == YES) {
+        memcpy(code, "023802", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023803", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_RootCA_CertificateRevoked == YES) {
+        memcpy(code, "023803", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023809", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_SLAC_init == YES) {
+        memcpy(code, "023809", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023810", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_match_response == YES) {
+        memcpy(code, "023810", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023811", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_sequence == YES) {
+        memcpy(code, "023811", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023812", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_match_MNBC == YES) {
+        memcpy(code, "023812", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023813", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_avg_atten_calc == YES) {
+        memcpy(code, "023813", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023814", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_response == YES) {
+        memcpy(code, "023814", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023815", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_match_session == YES) {
+        memcpy(code, "023815", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023816", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_assoc_session == YES) {
+        memcpy(code, "023816", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023817", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_vald_toggle == YES) {
+        memcpy(code, "023817", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023818", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmMnbcSound == YES) {
+        memcpy(code, "023818", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023819", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmValidateReq == YES) {
+        memcpy(code, "023819", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023823", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUDP_TT_match_join == YES) {
+        memcpy(code, "023823", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023824", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTCP_TT_match_join == YES) {
+        memcpy(code, "023824", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023825", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_amp_map_exchange == YES) {
+        memcpy(code, "023825", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023826", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_link_ready_notification == YES) {
+        memcpy(code, "023826", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023832", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSupportedAppProtocolRes == YES) {
+        memcpy(code, "023832", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023833", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionSetupRes == YES) {
+        memcpy(code, "023833", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023834", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceDiscoveryRes == YES) {
+        memcpy(code, "023834", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023835", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServicePaymentSelectionRes == YES) {
+        memcpy(code, "023835", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023836", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractAuthenticationRes == YES) {
+        memcpy(code, "023836", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023837", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargeParameterDiscoveryRes == YES) {
+        memcpy(code, "023837", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023838", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryRes == YES) {
+        memcpy(code, "023838", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023839", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheckRes == YES) {
+        memcpy(code, "023839", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023840", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPreChargeRes == YES) {
+        memcpy(code, "023840", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023841", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCurrentDemandRes == YES) {
+        memcpy(code, "023841", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023842", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWeldingDetectionRes == YES) {
+        memcpy(code, "023842", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023843", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionStopRes == YES) {
+        memcpy(code, "023843", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023844", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequence_Time == YES) {
+        memcpy(code, "023844", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023845", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsReadyToCharge_Performance_Time == YES) {
+        memcpy(code, "023845", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023846", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCommunicationSetup_Performance_Time == YES) {
+        memcpy(code, "023846", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023847", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheck_Performance_Time == YES) {
+        memcpy(code, "023847", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023848", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPState_Detection_Time == YES) {
+        memcpy(code, "023848", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023849", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPOscillator_Retain_Time == YES) {
+        memcpy(code, "023849", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023850", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutV2GPreChargePerformaceTime == YES) {
+        memcpy(code, "023850", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023855", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_TARGET_INFO == YES) {
+        memcpy(code, "023855", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023856", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_TARGET_INFO == YES) {
+        memcpy(code, "023856", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023857", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_BATTERY_INFO == YES) {
+        memcpy(code, "023857", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023858", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_BATTERY_INFO == YES) {
+        memcpy(code, "023858", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023859", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EV_STOP_EVENT == YES) {
+        memcpy(code, "023859", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023860", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EV_STOP_EVENT == YES) {
+        memcpy(code, "023860", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023861", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_STOP_EVENT == YES) {
+        memcpy(code, "023861", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023862", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_STOP_EVENT == YES) {
+        memcpy(code, "023862", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023863", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_MISC_INFO == YES) {
+        memcpy(code, "023863", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023864", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_MISC_INFO == YES) {
+        memcpy(code, "023864", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023865", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_REQUEST == YES) {
+        memcpy(code, "023865", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023866", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_REQUEST == YES) {
+        memcpy(code, "023866", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023867", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_START_BLOCK_TRANSFER == YES) {
+        memcpy(code, "023867", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023868", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_START_BLOCK_TRANSFER == YES) {
+        memcpy(code, "023868", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023869", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DATA_TRANSFER == YES) {
+        memcpy(code, "023869", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023870", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DATA_TRANSFER == YES) {
+        memcpy(code, "023870", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023871", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_FINISH == YES) {
+        memcpy(code, "023871", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023872", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_FINISH == YES) {
+        memcpy(code, "023872", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023873", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_ISOLATION_STATUS == YES) {
+        memcpy(code, "023873", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023874", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_ISOLATION_STATUS == YES) {
+        memcpy(code, "023874", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023875", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_CONNECTOR_INFO == YES) {
+        memcpy(code, "023875", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023876", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_CONNECTOR_INFO == YES) {
+        memcpy(code, "023876", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023877", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_RTC_INFO == YES) {
+        memcpy(code, "023877", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023878", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_RTC_INFO == YES) {
+        memcpy(code, "023878", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023879", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_PRECHARGE_INFO == YES) {
+        memcpy(code, "023879", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023880", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_PRECHARGE_INFO == YES) {
+        memcpy(code, "023880", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023881", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMSG_Sequence == YES) {
+        memcpy(code, "023881", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023882", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCAN_MSG_Unrecognized_CMD_ID == YES) {
+        memcpy(code, "023882", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023883", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Decode_Error == YES) {
+        memcpy(code, "023883", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023884", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Encode_Error == YES) {
+        memcpy(code, "023884", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023885", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Decode_Error == YES) {
+        memcpy(code, "023885", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023886", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Encode_Error == YES) {
+        memcpy(code, "023886", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023887", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Decode_Error == YES) {
+        memcpy(code, "023887", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023888", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Encode_Error == YES) {
+        memcpy(code, "023888", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023889", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCpStatus_Error == YES) {
+        memcpy(code, "023889", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023890", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnexpectVolBeforeCharing_Error == YES) {
+        memcpy(code, "023890", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    } else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023891", 6) == EQUAL &&
+               ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccNotReadyForCharging == YES) {
+        memcpy(code, "023891", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    }
+//  else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023892", 6) == EQUAL &&
+//          ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutQCA7000Comm == YES)
+//  {
+//      memcpy(code, "023892", 6);
+//      memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+//      isCleanCheck = true;
+//  }
+    else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023893", 6) == EQUAL &&
+             ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccFailForQCA7000SetKey == YES) {
+        memcpy(code, "023893", 6);
+        memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
+        isCleanCheck = true;
+    }
+
+    if (isCleanCheck) {
+        for (byte index = 0; index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; index++) {
+            if (index != gun_index || ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1) {
+                PRINTF_FUNC("CCS clean error : index = %d, EvConnAlarmCode = %s, code = %s \n", index, _chargingData[index]->EvConnAlarmCode, code);
+                if (strncmp((char *)_chargingData[index]->EvConnAlarmCode, code, 6) != EQUAL) {
+                    if (strncmp(code, "023701", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail = NO; }
+                    if (strncmp(code, "023737", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsRESTemperatureInhibit = NO; }
+                    if (strncmp(code, "023738", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVShiftPosition = NO; }
+                    if (strncmp(code, "023739", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargerConnectorLockFault = NO; }
+                    if (strncmp(code, "023740", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVRESSMalfunction = NO; }
+                    if (strncmp(code, "023741", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingCurrentdifferential = NO; }
+                    if (strncmp(code, "023742", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingVoltageOutOfRange = NO; }
+                    if (strncmp(code, "023743", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingSystemIncompatibility = NO; }
+                    if (strncmp(code, "023744", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEmergencyEvent = NO; }
+                    if (strncmp(code, "023745", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsBreaker = NO; }
+                    if (strncmp(code, "023746", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoData = NO; }
+                    if (strncmp(code, "023747", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_A = NO; }
+                    if (strncmp(code, "023748", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_B = NO; }
+                    if (strncmp(code, "023749", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_C = NO; }
+                    if (strncmp(code, "023750", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_1 = NO; }
+                    if (strncmp(code, "023751", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_2 = NO; }
+                    if (strncmp(code, "023752", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_3 = NO; }
+                    if (strncmp(code, "023753", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_1 = NO; }
+                    if (strncmp(code, "023754", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_2 = NO; }
+                    if (strncmp(code, "023755", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_3 = NO; }
+                    if (strncmp(code, "023756", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_4 = NO; }
+                    if (strncmp(code, "023757", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_5 = NO; }
+                    if (strncmp(code, "023758", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequenceError = NO; }
+                    if (strncmp(code, "023759", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSignatureError = NO; }
+                    if (strncmp(code, "023760", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnknownSession = NO; }
+                    if (strncmp(code, "023761", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceIDInvalid = NO; }
+                    if (strncmp(code, "023762", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPaymentSelectionInvalid = NO; }
+                    if (strncmp(code, "023763", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsIdentificationSelectionInvalid = NO; }
+                    if (strncmp(code, "023764", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceSelectionInvalid = NO; }
+                    if (strncmp(code, "023765", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateExpired = NO; }
+                    if (strncmp(code, "023766", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotYetValid = NO; }
+                    if (strncmp(code, "023767", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateRevoked = NO; }
+                    if (strncmp(code, "023768", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoCertificateAvailable = NO; }
+                    if (strncmp(code, "023769", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertChainError = NO; }
+                    if (strncmp(code, "023770", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertValidationError = NO; }
+                    if (strncmp(code, "023771", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertVerificationError = NO; }
+                    if (strncmp(code, "023772", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractCanceled = NO; }
+                    if (strncmp(code, "023773", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChallengeInvalid = NO; }
+                    if (strncmp(code, "023774", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongEnergyTransferMode = NO; }
+                    if (strncmp(code, "023775", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongChargeParameter = NO; }
+                    if (strncmp(code, "023776", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingProfileInvalid = NO; }
+                    if (strncmp(code, "023777", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTariffSelectionInvalid = NO; }
+                    if (strncmp(code, "023778", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEPresentVoltageToLow = NO; }
+                    if (strncmp(code, "023779", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryNotApplied = NO; }
+                    if (strncmp(code, "023780", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMeteringSignatureNotValid = NO; }
+                    if (strncmp(code, "023781", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoChargeServiceSelected = NO; }
+                    if (strncmp(code, "023782", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContactorError = NO; }
+                    if (strncmp(code, "023783", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotAllowedAtThisEVSE = NO; }
+                    if (strncmp(code, "023784", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsGAChargeStop = NO; }
+                    if (strncmp(code, "023785", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAlignmentError = NO; }
+                    if (strncmp(code, "023786", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsACDError = NO; }
+                    if (strncmp(code, "023787", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAssociationError = NO; }
+                    if (strncmp(code, "023788", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEChargeAbort = NO; }
+                    if (strncmp(code, "023789", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoSupportedAppProtocol = NO; }
+                    if (strncmp(code, "023790", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractNotAccepted = NO; }
+                    if (strncmp(code, "023791", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMOUnknown = NO; }
+                    if (strncmp(code, "023792", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_Prov_CertificateRevoke = NO; }
+                    if (strncmp(code, "023793", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA1_CertificateRevoked = NO; }
+                    if (strncmp(code, "023794", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA2_CertificateRevoked = NO; }
+                    if (strncmp(code, "023795", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_RootCA_CertificateRevoked = NO; }
+                    if (strncmp(code, "023796", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_Prov_CertificateRevoked = NO; }
+                    if (strncmp(code, "023797", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA1_CertificateRevoked = NO; }
+                    if (strncmp(code, "023798", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA2_CertificateRevoked = NO; }
+                    if (strncmp(code, "023799", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_RootCA_CertificateRevoked = NO; }
+                    if (strncmp(code, "023800", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_Prov_CertificateRevoked = NO; }
+                    if (strncmp(code, "023801", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA1_CertificateRevoked = NO; }
+                    if (strncmp(code, "023802", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA2_CertificateRevoked = NO; }
+                    if (strncmp(code, "023803", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_RootCA_CertificateRevoked = NO; }
+                    if (strncmp(code, "023809", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_SLAC_init = NO; }
+                    if (strncmp(code, "023810", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_match_response = NO; }
+                    if (strncmp(code, "023811", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_sequence = NO; }
+                    if (strncmp(code, "023812", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_match_MNBC = NO; }
+                    if (strncmp(code, "023813", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_avg_atten_calc = NO; }
+                    if (strncmp(code, "023814", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_response = NO; }
+                    if (strncmp(code, "023815", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_match_session = NO; }
+                    if (strncmp(code, "023816", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_assoc_session = NO; }
+                    if (strncmp(code, "023817", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_vald_toggle = NO; }
+                    if (strncmp(code, "023818", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmMnbcSound = NO; }
+                    if (strncmp(code, "023819", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmValidateReq = NO; }
+                    if (strncmp(code, "023823", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUDP_TT_match_join = NO; }
+                    if (strncmp(code, "023824", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTCP_TT_match_join = NO; }
+                    if (strncmp(code, "023825", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_amp_map_exchange = NO; }
+                    if (strncmp(code, "023826", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_link_ready_notification = NO; }
+                    if (strncmp(code, "023832", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSupportedAppProtocolRes = NO; }
+                    if (strncmp(code, "023833", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionSetupRes = NO; }
+                    if (strncmp(code, "023834", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceDiscoveryRes = NO; }
+                    if (strncmp(code, "023835", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServicePaymentSelectionRes = NO; }
+                    if (strncmp(code, "023836", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractAuthenticationRes = NO; }
+                    if (strncmp(code, "023837", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargeParameterDiscoveryRes = NO; }
+                    if (strncmp(code, "023838", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryRes = NO; }
+                    if (strncmp(code, "023839", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheckRes = NO; }
+                    if (strncmp(code, "023840", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPreChargeRes = NO; }
+                    if (strncmp(code, "023841", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCurrentDemandRes = NO; }
+                    if (strncmp(code, "023842", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWeldingDetectionRes = NO; }
+                    if (strncmp(code, "023843", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionStopRes = NO; }
+                    if (strncmp(code, "023844", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequence_Time = NO; }
+                    if (strncmp(code, "023845", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsReadyToCharge_Performance_Time = NO; }
+                    if (strncmp(code, "023846", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCommunicationSetup_Performance_Time = NO; }
+                    if (strncmp(code, "023847", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheck_Performance_Time = NO; }
+                    if (strncmp(code, "023848", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPState_Detection_Time = NO; }
+                    if (strncmp(code, "023849", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPOscillator_Retain_Time = NO; }
+                    if (strncmp(code, "023850", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutV2GPreChargePerformaceTime = NO; }
+                    if (strncmp(code, "023855", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_TARGET_INFO = NO; }
+                    if (strncmp(code, "023856", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_TARGET_INFO = NO; }
+                    if (strncmp(code, "023857", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_BATTERY_INFO = NO; }
+                    if (strncmp(code, "023858", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_BATTERY_INFO = NO; }
+                    if (strncmp(code, "023859", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EV_STOP_EVENT = NO; }
+                    if (strncmp(code, "023860", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EV_STOP_EVENT = NO; }
+                    if (strncmp(code, "023861", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_STOP_EVENT = NO; }
+                    if (strncmp(code, "023862", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_STOP_EVENT = NO; }
+                    if (strncmp(code, "023863", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_MISC_INFO = NO; }
+                    if (strncmp(code, "023864", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_MISC_INFO = NO; }
+                    if (strncmp(code, "023865", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_REQUEST = NO; }
+                    if (strncmp(code, "023866", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_REQUEST = NO; }
+                    if (strncmp(code, "023867", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_START_BLOCK_TRANSFER = NO; }
+                    if (strncmp(code, "023868", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_START_BLOCK_TRANSFER = NO; }
+                    if (strncmp(code, "023869", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DATA_TRANSFER = NO; }
+                    if (strncmp(code, "023870", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DATA_TRANSFER = NO; }
+                    if (strncmp(code, "023871", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_FINISH = NO; }
+                    if (strncmp(code, "023872", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_FINISH = NO; }
+                    if (strncmp(code, "023873", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_ISOLATION_STATUS = NO; }
+                    if (strncmp(code, "023874", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_ISOLATION_STATUS = NO; }
+                    if (strncmp(code, "023875", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_CONNECTOR_INFO = NO; }
+                    if (strncmp(code, "023876", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_CONNECTOR_INFO = NO; }
+                    if (strncmp(code, "023877", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_RTC_INFO = NO; }
+                    if (strncmp(code, "023878", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_RTC_INFO = NO; }
+                    if (strncmp(code, "023879", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_PRECHARGE_INFO = NO; }
+                    if (strncmp(code, "023880", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_PRECHARGE_INFO = NO; }
+                    if (strncmp(code, "023881", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMSG_Sequence = NO; }
+                    if (strncmp(code, "023882", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCAN_MSG_Unrecognized_CMD_ID = NO; }
+                    if (strncmp(code, "023883", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Decode_Error = NO; }
+                    if (strncmp(code, "023884", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Encode_Error = NO; }
+                    if (strncmp(code, "023885", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Decode_Error = NO; }
+                    if (strncmp(code, "023886", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Encode_Error = NO; }
+                    if (strncmp(code, "023887", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Decode_Error = NO; }
+                    if (strncmp(code, "023888", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Encode_Error = NO; }
+                    if (strncmp(code, "023889", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCpStatus_Error = NO; }
+                    if (strncmp(code, "023890", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnexpectVolBeforeCharing_Error = NO; }
+                    if (strncmp(code, "023891", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccNotReadyForCharging = NO; }
+                    //if (strncmp(code, "023892", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutQCA7000Comm = NO;
+                    if (strncmp(code, "023893", 6) == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccFailForQCA7000SetKey = NO; }
+                }
+            }
+        }
+    }
 }
 
 void AbnormalStopAnalysis(byte gun_index, byte *errCode)
 {
-	char string[7];
-	sprintf(string, "%d%d%d%d%d%d", *(errCode + 0), *(errCode + 1), *(errCode + 2), *(errCode + 3), *(errCode + 4), *(errCode + 5));
-
-	PRINTF_FUNC("NOTIFICATION_EV_STOP : Err Code = %s \n", string);
-	if (strncmp(string, "000000", 6) == EQUAL ||
-			strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) != EQUAL)
-		return;
-
-	memcpy(_chargingData[gun_index]->EvConnAlarmCode, string, 6);
-	PRINTF_FUNC("NOTIFICATION_EV_STOP : EvConnAlarmCode = %s \n", _chargingData[gun_index]->EvConnAlarmCode);
-
-	if (strcmp(string, "023700") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvCommFail = YES;
-	if (strcmp(string, "023704") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryMalfun = YES;
-	if (strcmp(string, "023705") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoNoPermission = YES;
-	if (strcmp(string, "023706") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryIncompatibility = YES;
-	if (strcmp(string, "023707") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOVP = YES;
-	if (strcmp(string, "023708") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryUVP = YES;
-	if (strcmp(string, "023709") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOTP = YES;
-	if (strcmp(string, "023710") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryCurrentDiff = YES;
-	if (strcmp(string, "023711") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryVoltageDiff = YES;
-	if (strcmp(string, "023712") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoShiftPosition = YES;
-	if (strcmp(string, "023713") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOtherFault = YES;
-	if (strcmp(string, "023714") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargingSystemError = YES;
-	if (strcmp(string, "023715") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvNormalStop = YES;
-	if (strcmp(string, "023716") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoTempSensorBroken = YES;
-	if (strcmp(string, "023717") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoConnectorLockFail = YES;
-	if (strcmp(string, "023718") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoD1OnNoReceive = YES;
-	if (strcmp(string, "023719") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJTimeout = YES;
-	if (strcmp(string, "023720") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeAllowTimeout = YES;
-	if (strcmp(string, "023721") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoWaitGfdTimeout = YES;
-	if (strcmp(string, "023722") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayTimeout = YES;
-	if (strcmp(string, "023723") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsReqCurrentTimeout = YES;
-	if (strcmp(string, "023724") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJOffTimeout = YES;
-	if (strcmp(string, "023725") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayOffTimeout = YES;
-	if (strcmp(string, "023726") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan10V = YES;
-	if (strcmp(string, "023727") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan20V = YES;
-	if (strcmp(string, "023728") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeBeforeStop = YES;
-	if (strcmp(string, "023729") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetNormalStop = YES;
-	if (strcmp(string, "023730") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetEmergencyStop = YES;
-	if (strcmp(string, "023731") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoIsolationResultFail = YES;
-	if (strcmp(string, "023732") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoMissLinkWithMotherBoard = YES;
-	if (strcmp(string, "023733") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoOutputVolMoreThanLimit = YES;
-	if (strcmp(string, "023734") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReqCurrentMoreThanLimit = YES;
-	if (strcmp(string, "023735") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReCapBmsEqrCurrentExceed = YES;
-	if (strcmp(string, "023736") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargeRemainCountDown = YES;
-
-	if (strcmp(string, "023701") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail = YES;
-	if (strcmp(string, "023737") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsRESTemperatureInhibit = YES;
-	if (strcmp(string, "023738") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVShiftPosition = YES;
-	if (strcmp(string, "023739") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargerConnectorLockFault = YES;
-	if (strcmp(string, "023740") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVRESSMalfunction = YES;
-	if (strcmp(string, "023741") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingCurrentdifferential = YES;
-	if (strcmp(string, "023742") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingVoltageOutOfRange = YES;
-	if (strcmp(string, "023743") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingSystemIncompatibility = YES;
-	if (strcmp(string, "023744") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEmergencyEvent = YES;
-	if (strcmp(string, "023745") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsBreaker = YES;
-	if (strcmp(string, "023746") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoData = YES;
-	if (strcmp(string, "023747") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_A = YES;
-	if (strcmp(string, "023748") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_B = YES;
-	if (strcmp(string, "023749") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_C = YES;
-	if (strcmp(string, "023750") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_1 = YES;
-	if (strcmp(string, "023751") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_2 = YES;
-	if (strcmp(string, "023752") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_3 = YES;
-	if (strcmp(string, "023753") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_1 = YES;
-	if (strcmp(string, "023754") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_2 = YES;
-	if (strcmp(string, "023755") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_3 = YES;
-	if (strcmp(string, "023756") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_4 = YES;
-	if (strcmp(string, "023757") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_5 = YES;
-	if (strcmp(string, "023758") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequenceError = YES;
-	if (strcmp(string, "023759") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSignatureError = YES;
-	if (strcmp(string, "023760") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnknownSession = YES;
-	if (strcmp(string, "023761") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceIDInvalid = YES;
-	if (strcmp(string, "023762") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPaymentSelectionInvalid = YES;
-	if (strcmp(string, "023763") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsIdentificationSelectionInvalid = YES;
-	if (strcmp(string, "023764") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceSelectionInvalid = YES;
-	if (strcmp(string, "023765") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateExpired = YES;
-	if (strcmp(string, "023766") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotYetValid = YES;
-	if (strcmp(string, "023767") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateRevoked = YES;
-	if (strcmp(string, "023768") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoCertificateAvailable = YES;
-	if (strcmp(string, "023769") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertChainError = YES;
-	if (strcmp(string, "023770") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertValidationError = YES;
-	if (strcmp(string, "023771") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertVerificationError = YES;
-	if (strcmp(string, "023772") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractCanceled = YES;
-	if (strcmp(string, "023773") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChallengeInvalid = YES;
-	if (strcmp(string, "023774") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongEnergyTransferMode = YES;
-	if (strcmp(string, "023775") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongChargeParameter = YES;
-	if (strcmp(string, "023776") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingProfileInvalid = YES;
-	if (strcmp(string, "023777") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTariffSelectionInvalid = YES;
-	if (strcmp(string, "023778") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEPresentVoltageToLow = YES;
-	if (strcmp(string, "023779") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryNotApplied = YES;
-	if (strcmp(string, "023780") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMeteringSignatureNotValid = YES;
-	if (strcmp(string, "023781") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoChargeServiceSelected = YES;
-	if (strcmp(string, "023782") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContactorError = YES;
-	if (strcmp(string, "023783") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotAllowedAtThisEVSE = YES;
-	if (strcmp(string, "023784") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsGAChargeStop = YES;
-	if (strcmp(string, "023785") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAlignmentError = YES;
-	if (strcmp(string, "023786") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsACDError = YES;
-	if (strcmp(string, "023787") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAssociationError = YES;
-	if (strcmp(string, "023788") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEChargeAbort = YES;
-	if (strcmp(string, "023789") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoSupportedAppProtocol = YES;
-	if (strcmp(string, "023790") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractNotAccepted = YES;
-	if (strcmp(string, "023791") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMOUnknown = YES;
-	if (strcmp(string, "023792") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_Prov_CertificateRevoke = YES;
-	if (strcmp(string, "023793") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA1_CertificateRevoked = YES;
-	if (strcmp(string, "023794") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA2_CertificateRevoked = YES;
-	if (strcmp(string, "023795") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_RootCA_CertificateRevoked = YES;
-	if (strcmp(string, "023796") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_Prov_CertificateRevoked = YES;
-	if (strcmp(string, "023797") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA1_CertificateRevoked = YES;
-	if (strcmp(string, "023798") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA2_CertificateRevoked = YES;
-	if (strcmp(string, "023799") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_RootCA_CertificateRevoked = YES;
-	if (strcmp(string, "023800") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_Prov_CertificateRevoked = YES;
-	if (strcmp(string, "023801") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA1_CertificateRevoked = YES;
-	if (strcmp(string, "023802") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA2_CertificateRevoked = YES;
-	if (strcmp(string, "023803") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_RootCA_CertificateRevoked = YES;
-	if (strcmp(string, "023809") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_SLAC_init = YES;
-	if (strcmp(string, "023810") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_match_response = YES;
-	if (strcmp(string, "023811") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_sequence = YES;
-	if (strcmp(string, "023812") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_match_MNBC = YES;
-	if (strcmp(string, "023813") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_avg_atten_calc = YES;
-	if (strcmp(string, "023814") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_response = YES;
-	if (strcmp(string, "023815") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_match_session = YES;
-	if (strcmp(string, "023816") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_assoc_session = YES;
-	if (strcmp(string, "023817") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_vald_toggle = YES;
-	if (strcmp(string, "023818") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmMnbcSound = YES;
-	if (strcmp(string, "023819") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmValidateReq = YES;
-	if (strcmp(string, "023823") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUDP_TT_match_join = YES;
-	if (strcmp(string, "023824") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTCP_TT_match_join = YES;
-	if (strcmp(string, "023825") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_amp_map_exchange = YES;
-	if (strcmp(string, "023826") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_link_ready_notification = YES;
-	if (strcmp(string, "023832") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSupportedAppProtocolRes = YES;
-	if (strcmp(string, "023833") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionSetupRes = YES;
-	if (strcmp(string, "023834") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceDiscoveryRes = YES;
-	if (strcmp(string, "023835") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServicePaymentSelectionRes = YES;
-	if (strcmp(string, "023836") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractAuthenticationRes = YES;
-	if (strcmp(string, "023837") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargeParameterDiscoveryRes = YES;
-	if (strcmp(string, "023838") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryRes = YES;
-	if (strcmp(string, "023839") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheckRes = YES;
-	if (strcmp(string, "023840") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPreChargeRes = YES;
-	if (strcmp(string, "023841") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCurrentDemandRes = YES;
-	if (strcmp(string, "023842") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWeldingDetectionRes = YES;
-	if (strcmp(string, "023843") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionStopRes = YES;
-	if (strcmp(string, "023844") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequence_Time = YES;
-	if (strcmp(string, "023845") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsReadyToCharge_Performance_Time = YES;
-	if (strcmp(string, "023846") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCommunicationSetup_Performance_Time = YES;
-	if (strcmp(string, "023847") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheck_Performance_Time = YES;
-	if (strcmp(string, "023848") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPState_Detection_Time = YES;
-	if (strcmp(string, "023849") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPOscillator_Retain_Time = YES;
-	if (strcmp(string, "023850") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutV2GPreChargePerformaceTime = YES;
-	if (strcmp(string, "023855") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_TARGET_INFO = YES;
-	if (strcmp(string, "023856") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_TARGET_INFO = YES;
-	if (strcmp(string, "023857") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_BATTERY_INFO = YES;
-	if (strcmp(string, "023858") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_BATTERY_INFO = YES;
-	if (strcmp(string, "023859") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EV_STOP_EVENT = YES;
-	if (strcmp(string, "023860") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EV_STOP_EVENT = YES;
-	if (strcmp(string, "023861") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_STOP_EVENT = YES;
-	if (strcmp(string, "023862") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_STOP_EVENT = YES;
-	if (strcmp(string, "023863") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_MISC_INFO = YES;
-	if (strcmp(string, "023864") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_MISC_INFO = YES;
-	if (strcmp(string, "023865") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_REQUEST = YES;
-	if (strcmp(string, "023866") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_REQUEST = YES;
-	if (strcmp(string, "023867") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_START_BLOCK_TRANSFER = YES;
-	if (strcmp(string, "023868") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_START_BLOCK_TRANSFER = YES;
-	if (strcmp(string, "023869") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DATA_TRANSFER = YES;
-	if (strcmp(string, "023870") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DATA_TRANSFER = YES;
-	if (strcmp(string, "023871") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_FINISH = YES;
-	if (strcmp(string, "023872") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_FINISH = YES;
-	if (strcmp(string, "023873") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_ISOLATION_STATUS = YES;
-	if (strcmp(string, "023874") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_ISOLATION_STATUS = YES;
-	if (strcmp(string, "023875") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_CONNECTOR_INFO = YES;
-	if (strcmp(string, "023876") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_CONNECTOR_INFO = YES;
-	if (strcmp(string, "023877") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_RTC_INFO = YES;
-	if (strcmp(string, "023878") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_RTC_INFO = YES;
-	if (strcmp(string, "023879") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_PRECHARGE_INFO = YES;
-	if (strcmp(string, "023880") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_PRECHARGE_INFO = YES;
-	if (strcmp(string, "023881") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMSG_Sequence = YES;
-	if (strcmp(string, "023882") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCAN_MSG_Unrecognized_CMD_ID = YES;
-	if (strcmp(string, "023883") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Decode_Error = YES;
-	if (strcmp(string, "023884") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Encode_Error = YES;
-	if (strcmp(string, "023885") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Decode_Error = YES;
-	if (strcmp(string, "023886") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Encode_Error = YES;
-	if (strcmp(string, "023887") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Decode_Error = YES;
-	if (strcmp(string, "023888") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Encode_Error = YES;
-	if (strcmp(string, "023889") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCpStatus_Error = YES;
-	if (strcmp(string, "023890") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnexpectVolBeforeCharing_Error = YES;
-	if (strcmp(string, "023891") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccNotReadyForCharging = YES;
-	if (strcmp(string, "023892") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutQCA7000Comm = YES;
-	if (strcmp(string, "023893") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccFailForQCA7000SetKey = YES;
-
-	if (strcmp(string, "023702") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.GbEvCommFail = YES;
-	if (strcmp(string, "023900") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_LOS_CC1 = YES;
-	if (strcmp(string, "023901") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CONNECTOR_LOCK_FAIL = YES;
-	if (strcmp(string, "023902") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BATTERY_INCOMPATIBLE = YES;
-	if (strcmp(string, "023903") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_BROAA_TIMEOUT = YES;
-	if (strcmp(string, "023904") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CSU_PRECHARGE_TIMEOUT = YES;
-	if (strcmp(string, "023905") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_PRESENT_VOLTAGE_FAULT = YES;
-	if (strcmp(string, "023906") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_VOLTAGE_OVER_RANGE = YES;
-	if (strcmp(string, "023907") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BSM_CHARGE_ALLOW_00_10MIN_COUUNTDONE = YES;
-	if (strcmp(string, "023908") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_WAIT_GROUNDFAULT_TIMEOUT = YES;
-	if (strcmp(string, "023909") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_10V = YES;
-	if (strcmp(string, "023910") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_60V = YES;
-	if (strcmp(string, "023911") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_NORMAL_STOP_CMD = YES;
-	if (strcmp(string, "023912") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_EMERGENCY_STOP_CMD = YES;
-	if (strcmp(string, "023913") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ISOLATION_RESULT_FAIL = YES;
-	if (strcmp(string, "023914") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_MOTHER_BOARD_MISS_LINK = YES;
-	if (strcmp(string, "023915") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_LIMIT = YES;
-	if (strcmp(string, "023916") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_REQ_CURRENT_MORE_THAN_LIMIT = YES;
-	if (strcmp(string, "023917") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_10_PERCENT = YES;
-	if (strcmp(string, "023918") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_DIFF_BCS_5_PERCENT = YES;
-	if (strcmp(string, "023919") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_STOP_ADC_MORE_THAN_10V = YES;
-	if (strcmp(string, "023930") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BHM_TIMEOUT = YES;
-	if (strcmp(string, "023931") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRM_TIMEOUT = YES;
-	if (strcmp(string, "023932") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCP_TIMEOUT = YES;
-	if (strcmp(string, "023933") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRO_TIMEOUT = YES;
-	if (strcmp(string, "023934") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCL_TIMEOUT = YES;
-	if (strcmp(string, "023935") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCS_TIMEOUT = YES;
-	if (strcmp(string, "023936") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSM_TIMEOUT = YES;
-	if (strcmp(string, "023937") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BST_TIMEOUT = YES;
-	if (strcmp(string, "023938") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSD_TIMEOUT = YES;
-	if (strcmp(string, "023939") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BEM_OTHER_TIMEOUT = YES;
-	if (strcmp(string, "023940") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRM_TIMEOUT = YES;
-	if (strcmp(string, "023941") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRMAA_TIMEOUT = YES;
-	if (strcmp(string, "023942") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CTS_CML_TIMEOUT = YES;
-	if (strcmp(string, "023943") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRO_TIMEOUT = YES;
-	if (strcmp(string, "023944") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CCS_TIMEOUT = YES;
-	if (strcmp(string, "023945") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CST_TIMEOUT = YES;
-	if (strcmp(string, "023946") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CSD_TIMEOUT = YES;
-	if (strcmp(string, "023947") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_BEM_OTHER_TIMEOUT = YES;
-	if (strcmp(string, "023950") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_SOC_GOAL = YES;
-	if (strcmp(string, "023951") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_TOTAL_VOLTAGE_GOAL = YES;
-	if (strcmp(string, "023952") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CELL_VOLTAGE_GOAL = YES;
-	if (strcmp(string, "023953") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_GET_CST = YES;
-	if (strcmp(string, "023954") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_ISOLATION = YES;
-	if (strcmp(string, "023955") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OUTPUT_CONNECTOR_OTP = YES;
-	if (strcmp(string, "023956") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_COMPONENT = YES;
-	if (strcmp(string, "023957") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CHARGE_CONNECTOR = YES;
-	if (strcmp(string, "023958") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTP = YES;
-	if (strcmp(string, "023959") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTHER = YES;
-	if (strcmp(string, "023960") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_HIGH_V = YES;
-	if (strcmp(string, "023961") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CC2 = YES;
-	if (strcmp(string, "023962") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CURRENT = YES;
-	if (strcmp(string, "023963") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_VOLTAGE = YES;
-	if (strcmp(string, "023964") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GET_BST_NO_REASON = YES;
-	if (strcmp(string, "023970") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_OVER_VOLTAGE = YES;
-	if (strcmp(string, "023971") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_UNDER_VOLTAGE = YES;
-	if (strcmp(string, "023972") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OVER_SOC = YES;
-	if (strcmp(string, "023973") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_UNDER_SOC = YES;
-	if (strcmp(string, "023974") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CURRENT = YES;
-	if (strcmp(string, "023975") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_TEMPERATURE = YES;
-	if (strcmp(string, "023976") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_ISOLATE = YES;
-	if (strcmp(string, "023977") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OUTPUT_CONNECTOR = YES;
+    char string[7];
+    sprintf(string, "%d%d%d%d%d%d", *(errCode + 0), *(errCode + 1), *(errCode + 2), *(errCode + 3), *(errCode + 4), *(errCode + 5));
+
+    PRINTF_FUNC("NOTIFICATION_EV_STOP : Err Code = %s \n", string);
+    if (strncmp(string, "000000", 6) == EQUAL ||
+            strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) != EQUAL) {
+        return;
+    }
+
+    memcpy(_chargingData[gun_index]->EvConnAlarmCode, string, 6);
+    PRINTF_FUNC("NOTIFICATION_EV_STOP : EvConnAlarmCode = %s \n", _chargingData[gun_index]->EvConnAlarmCode);
+
+    if (strcmp(string, "023700") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvCommFail = YES; }
+    if (strcmp(string, "023704") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryMalfun = YES; }
+    if (strcmp(string, "023705") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoNoPermission = YES; }
+    if (strcmp(string, "023706") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryIncompatibility = YES; }
+    if (strcmp(string, "023707") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOVP = YES; }
+    if (strcmp(string, "023708") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryUVP = YES; }
+    if (strcmp(string, "023709") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOTP = YES; }
+    if (strcmp(string, "023710") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryCurrentDiff = YES; }
+    if (strcmp(string, "023711") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryVoltageDiff = YES; }
+    if (strcmp(string, "023712") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoShiftPosition = YES; }
+    if (strcmp(string, "023713") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOtherFault = YES; }
+    if (strcmp(string, "023714") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargingSystemError = YES; }
+    if (strcmp(string, "023715") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvNormalStop = YES; }
+    if (strcmp(string, "023716") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoTempSensorBroken = YES; }
+    if (strcmp(string, "023717") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoConnectorLockFail = YES; }
+    if (strcmp(string, "023718") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoD1OnNoReceive = YES; }
+    if (strcmp(string, "023719") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJTimeout = YES; }
+    if (strcmp(string, "023720") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeAllowTimeout = YES; }
+    if (strcmp(string, "023721") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoWaitGfdTimeout = YES; }
+    if (strcmp(string, "023722") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayTimeout = YES; }
+    if (strcmp(string, "023723") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsReqCurrentTimeout = YES; }
+    if (strcmp(string, "023724") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJOffTimeout = YES; }
+    if (strcmp(string, "023725") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayOffTimeout = YES; }
+    if (strcmp(string, "023726") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan10V = YES; }
+    if (strcmp(string, "023727") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan20V = YES; }
+    if (strcmp(string, "023728") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeBeforeStop = YES; }
+    if (strcmp(string, "023729") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetNormalStop = YES; }
+    if (strcmp(string, "023730") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetEmergencyStop = YES; }
+    if (strcmp(string, "023731") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoIsolationResultFail = YES; }
+    if (strcmp(string, "023732") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoMissLinkWithMotherBoard = YES; }
+    if (strcmp(string, "023733") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoOutputVolMoreThanLimit = YES; }
+    if (strcmp(string, "023734") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReqCurrentMoreThanLimit = YES; }
+    if (strcmp(string, "023735") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReCapBmsEqrCurrentExceed = YES; }
+    if (strcmp(string, "023736") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargeRemainCountDown = YES; }
+
+    if (strcmp(string, "023701") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail = YES; }
+    if (strcmp(string, "023737") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsRESTemperatureInhibit = YES; }
+    if (strcmp(string, "023738") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVShiftPosition = YES; }
+    if (strcmp(string, "023739") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargerConnectorLockFault = YES; }
+    if (strcmp(string, "023740") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVRESSMalfunction = YES; }
+    if (strcmp(string, "023741") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingCurrentdifferential = YES; }
+    if (strcmp(string, "023742") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingVoltageOutOfRange = YES; }
+    if (strcmp(string, "023743") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingSystemIncompatibility = YES; }
+    if (strcmp(string, "023744") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEmergencyEvent = YES; }
+    if (strcmp(string, "023745") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsBreaker = YES; }
+    if (strcmp(string, "023746") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoData = YES; }
+    if (strcmp(string, "023747") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_A = YES; }
+    if (strcmp(string, "023748") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_B = YES; }
+    if (strcmp(string, "023749") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_C = YES; }
+    if (strcmp(string, "023750") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_1 = YES; }
+    if (strcmp(string, "023751") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_2 = YES; }
+    if (strcmp(string, "023752") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_3 = YES; }
+    if (strcmp(string, "023753") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_1 = YES; }
+    if (strcmp(string, "023754") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_2 = YES; }
+    if (strcmp(string, "023755") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_3 = YES; }
+    if (strcmp(string, "023756") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_4 = YES; }
+    if (strcmp(string, "023757") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_5 = YES; }
+    if (strcmp(string, "023758") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequenceError = YES; }
+    if (strcmp(string, "023759") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSignatureError = YES; }
+    if (strcmp(string, "023760") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnknownSession = YES; }
+    if (strcmp(string, "023761") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceIDInvalid = YES; }
+    if (strcmp(string, "023762") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPaymentSelectionInvalid = YES; }
+    if (strcmp(string, "023763") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsIdentificationSelectionInvalid = YES; }
+    if (strcmp(string, "023764") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceSelectionInvalid = YES; }
+    if (strcmp(string, "023765") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateExpired = YES; }
+    if (strcmp(string, "023766") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotYetValid = YES; }
+    if (strcmp(string, "023767") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateRevoked = YES; }
+    if (strcmp(string, "023768") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoCertificateAvailable = YES; }
+    if (strcmp(string, "023769") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertChainError = YES; }
+    if (strcmp(string, "023770") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertValidationError = YES; }
+    if (strcmp(string, "023771") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertVerificationError = YES; }
+    if (strcmp(string, "023772") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractCanceled = YES; }
+    if (strcmp(string, "023773") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChallengeInvalid = YES; }
+    if (strcmp(string, "023774") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongEnergyTransferMode = YES; }
+    if (strcmp(string, "023775") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongChargeParameter = YES; }
+    if (strcmp(string, "023776") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingProfileInvalid = YES; }
+    if (strcmp(string, "023777") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTariffSelectionInvalid = YES; }
+    if (strcmp(string, "023778") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEPresentVoltageToLow = YES; }
+    if (strcmp(string, "023779") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryNotApplied = YES; }
+    if (strcmp(string, "023780") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMeteringSignatureNotValid = YES; }
+    if (strcmp(string, "023781") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoChargeServiceSelected = YES; }
+    if (strcmp(string, "023782") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContactorError = YES; }
+    if (strcmp(string, "023783") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotAllowedAtThisEVSE = YES; }
+    if (strcmp(string, "023784") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsGAChargeStop = YES; }
+    if (strcmp(string, "023785") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAlignmentError = YES; }
+    if (strcmp(string, "023786") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsACDError = YES; }
+    if (strcmp(string, "023787") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAssociationError = YES; }
+    if (strcmp(string, "023788") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEChargeAbort = YES; }
+    if (strcmp(string, "023789") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoSupportedAppProtocol = YES; }
+    if (strcmp(string, "023790") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractNotAccepted = YES; }
+    if (strcmp(string, "023791") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMOUnknown = YES; }
+    if (strcmp(string, "023792") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_Prov_CertificateRevoke = YES; }
+    if (strcmp(string, "023793") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA1_CertificateRevoked = YES; }
+    if (strcmp(string, "023794") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA2_CertificateRevoked = YES; }
+    if (strcmp(string, "023795") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_RootCA_CertificateRevoked = YES; }
+    if (strcmp(string, "023796") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_Prov_CertificateRevoked = YES; }
+    if (strcmp(string, "023797") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA1_CertificateRevoked = YES; }
+    if (strcmp(string, "023798") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA2_CertificateRevoked = YES; }
+    if (strcmp(string, "023799") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_RootCA_CertificateRevoked = YES; }
+    if (strcmp(string, "023800") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_Prov_CertificateRevoked = YES; }
+    if (strcmp(string, "023801") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA1_CertificateRevoked = YES; }
+    if (strcmp(string, "023802") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA2_CertificateRevoked = YES; }
+    if (strcmp(string, "023803") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_RootCA_CertificateRevoked = YES; }
+    if (strcmp(string, "023809") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_SLAC_init = YES; }
+    if (strcmp(string, "023810") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_match_response = YES; }
+    if (strcmp(string, "023811") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_sequence = YES; }
+    if (strcmp(string, "023812") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_match_MNBC = YES; }
+    if (strcmp(string, "023813") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_avg_atten_calc = YES; }
+    if (strcmp(string, "023814") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_response = YES; }
+    if (strcmp(string, "023815") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_match_session = YES; }
+    if (strcmp(string, "023816") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_assoc_session = YES; }
+    if (strcmp(string, "023817") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_vald_toggle = YES; }
+    if (strcmp(string, "023818") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmMnbcSound = YES; }
+    if (strcmp(string, "023819") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmValidateReq = YES; }
+    if (strcmp(string, "023823") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUDP_TT_match_join = YES; }
+    if (strcmp(string, "023824") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTCP_TT_match_join = YES; }
+    if (strcmp(string, "023825") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_amp_map_exchange = YES; }
+    if (strcmp(string, "023826") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_link_ready_notification = YES; }
+    if (strcmp(string, "023832") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSupportedAppProtocolRes = YES; }
+    if (strcmp(string, "023833") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionSetupRes = YES; }
+    if (strcmp(string, "023834") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceDiscoveryRes = YES; }
+    if (strcmp(string, "023835") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServicePaymentSelectionRes = YES; }
+    if (strcmp(string, "023836") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractAuthenticationRes = YES; }
+    if (strcmp(string, "023837") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargeParameterDiscoveryRes = YES; }
+    if (strcmp(string, "023838") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryRes = YES; }
+    if (strcmp(string, "023839") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheckRes = YES; }
+    if (strcmp(string, "023840") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPreChargeRes = YES; }
+    if (strcmp(string, "023841") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCurrentDemandRes = YES; }
+    if (strcmp(string, "023842") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWeldingDetectionRes = YES; }
+    if (strcmp(string, "023843") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionStopRes = YES; }
+    if (strcmp(string, "023844") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequence_Time = YES; }
+    if (strcmp(string, "023845") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsReadyToCharge_Performance_Time = YES; }
+    if (strcmp(string, "023846") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCommunicationSetup_Performance_Time = YES; }
+    if (strcmp(string, "023847") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheck_Performance_Time = YES; }
+    if (strcmp(string, "023848") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPState_Detection_Time = YES; }
+    if (strcmp(string, "023849") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPOscillator_Retain_Time = YES; }
+    if (strcmp(string, "023850") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutV2GPreChargePerformaceTime = YES; }
+    if (strcmp(string, "023855") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_TARGET_INFO = YES; }
+    if (strcmp(string, "023856") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_TARGET_INFO = YES; }
+    if (strcmp(string, "023857") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_BATTERY_INFO = YES; }
+    if (strcmp(string, "023858") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_BATTERY_INFO = YES; }
+    if (strcmp(string, "023859") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EV_STOP_EVENT = YES; }
+    if (strcmp(string, "023860") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EV_STOP_EVENT = YES; }
+    if (strcmp(string, "023861") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_STOP_EVENT = YES; }
+    if (strcmp(string, "023862") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_STOP_EVENT = YES; }
+    if (strcmp(string, "023863") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_MISC_INFO = YES; }
+    if (strcmp(string, "023864") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_MISC_INFO = YES; }
+    if (strcmp(string, "023865") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_REQUEST = YES; }
+    if (strcmp(string, "023866") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_REQUEST = YES; }
+    if (strcmp(string, "023867") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_START_BLOCK_TRANSFER = YES; }
+    if (strcmp(string, "023868") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_START_BLOCK_TRANSFER = YES; }
+    if (strcmp(string, "023869") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DATA_TRANSFER = YES; }
+    if (strcmp(string, "023870") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DATA_TRANSFER = YES; }
+    if (strcmp(string, "023871") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_FINISH = YES; }
+    if (strcmp(string, "023872") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_FINISH = YES; }
+    if (strcmp(string, "023873") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_ISOLATION_STATUS = YES; }
+    if (strcmp(string, "023874") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_ISOLATION_STATUS = YES; }
+    if (strcmp(string, "023875") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_CONNECTOR_INFO = YES; }
+    if (strcmp(string, "023876") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_CONNECTOR_INFO = YES; }
+    if (strcmp(string, "023877") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_RTC_INFO = YES; }
+    if (strcmp(string, "023878") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_RTC_INFO = YES; }
+    if (strcmp(string, "023879") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_PRECHARGE_INFO = YES; }
+    if (strcmp(string, "023880") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_PRECHARGE_INFO = YES; }
+    if (strcmp(string, "023881") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMSG_Sequence = YES; }
+    if (strcmp(string, "023882") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCAN_MSG_Unrecognized_CMD_ID = YES; }
+    if (strcmp(string, "023883") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Decode_Error = YES; }
+    if (strcmp(string, "023884") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Encode_Error = YES; }
+    if (strcmp(string, "023885") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Decode_Error = YES; }
+    if (strcmp(string, "023886") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Encode_Error = YES; }
+    if (strcmp(string, "023887") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Decode_Error = YES; }
+    if (strcmp(string, "023888") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Encode_Error = YES; }
+    if (strcmp(string, "023889") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCpStatus_Error = YES; }
+    if (strcmp(string, "023890") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnexpectVolBeforeCharing_Error = YES; }
+    if (strcmp(string, "023891") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccNotReadyForCharging = YES; }
+    if (strcmp(string, "023892") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutQCA7000Comm = YES; }
+    if (strcmp(string, "023893") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccFailForQCA7000SetKey = YES; }
+
+    if (strcmp(string, "023702") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.GbEvCommFail = YES; }
+    if (strcmp(string, "023900") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_LOS_CC1 = YES; }
+    if (strcmp(string, "023901") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CONNECTOR_LOCK_FAIL = YES; }
+    if (strcmp(string, "023902") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BATTERY_INCOMPATIBLE = YES; }
+    if (strcmp(string, "023903") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_BROAA_TIMEOUT = YES; }
+    if (strcmp(string, "023904") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CSU_PRECHARGE_TIMEOUT = YES; }
+    if (strcmp(string, "023905") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_PRESENT_VOLTAGE_FAULT = YES; }
+    if (strcmp(string, "023906") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_VOLTAGE_OVER_RANGE = YES; }
+    if (strcmp(string, "023907") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BSM_CHARGE_ALLOW_00_10MIN_COUUNTDONE = YES; }
+    if (strcmp(string, "023908") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_WAIT_GROUNDFAULT_TIMEOUT = YES; }
+    if (strcmp(string, "023909") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_10V = YES; }
+    if (strcmp(string, "023910") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_60V = YES; }
+    if (strcmp(string, "023911") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_NORMAL_STOP_CMD = YES; }
+    if (strcmp(string, "023912") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_EMERGENCY_STOP_CMD = YES; }
+    if (strcmp(string, "023913") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ISOLATION_RESULT_FAIL = YES; }
+    if (strcmp(string, "023914") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_MOTHER_BOARD_MISS_LINK = YES; }
+    if (strcmp(string, "023915") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_LIMIT = YES; }
+    if (strcmp(string, "023916") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_REQ_CURRENT_MORE_THAN_LIMIT = YES; }
+    if (strcmp(string, "023917") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_10_PERCENT = YES; }
+    if (strcmp(string, "023918") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_DIFF_BCS_5_PERCENT = YES; }
+    if (strcmp(string, "023919") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_STOP_ADC_MORE_THAN_10V = YES; }
+    if (strcmp(string, "023930") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BHM_TIMEOUT = YES; }
+    if (strcmp(string, "023931") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRM_TIMEOUT = YES; }
+    if (strcmp(string, "023932") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCP_TIMEOUT = YES; }
+    if (strcmp(string, "023933") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRO_TIMEOUT = YES; }
+    if (strcmp(string, "023934") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCL_TIMEOUT = YES; }
+    if (strcmp(string, "023935") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCS_TIMEOUT = YES; }
+    if (strcmp(string, "023936") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSM_TIMEOUT = YES; }
+    if (strcmp(string, "023937") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BST_TIMEOUT = YES; }
+    if (strcmp(string, "023938") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSD_TIMEOUT = YES; }
+    if (strcmp(string, "023939") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BEM_OTHER_TIMEOUT = YES; }
+    if (strcmp(string, "023940") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRM_TIMEOUT = YES; }
+    if (strcmp(string, "023941") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRMAA_TIMEOUT = YES; }
+    if (strcmp(string, "023942") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CTS_CML_TIMEOUT = YES; }
+    if (strcmp(string, "023943") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRO_TIMEOUT = YES; }
+    if (strcmp(string, "023944") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CCS_TIMEOUT = YES; }
+    if (strcmp(string, "023945") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CST_TIMEOUT = YES; }
+    if (strcmp(string, "023946") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CSD_TIMEOUT = YES; }
+    if (strcmp(string, "023947") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_BEM_OTHER_TIMEOUT = YES; }
+    if (strcmp(string, "023950") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_SOC_GOAL = YES; }
+    if (strcmp(string, "023951") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_TOTAL_VOLTAGE_GOAL = YES; }
+    if (strcmp(string, "023952") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CELL_VOLTAGE_GOAL = YES; }
+    if (strcmp(string, "023953") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_GET_CST = YES; }
+    if (strcmp(string, "023954") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_ISOLATION = YES; }
+    if (strcmp(string, "023955") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OUTPUT_CONNECTOR_OTP = YES; }
+    if (strcmp(string, "023956") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_COMPONENT = YES; }
+    if (strcmp(string, "023957") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CHARGE_CONNECTOR = YES; }
+    if (strcmp(string, "023958") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTP = YES; }
+    if (strcmp(string, "023959") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTHER = YES; }
+    if (strcmp(string, "023960") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_HIGH_V = YES; }
+    if (strcmp(string, "023961") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CC2 = YES; }
+    if (strcmp(string, "023962") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CURRENT = YES; }
+    if (strcmp(string, "023963") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_VOLTAGE = YES; }
+    if (strcmp(string, "023964") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GET_BST_NO_REASON = YES; }
+    if (strcmp(string, "023970") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_OVER_VOLTAGE = YES; }
+    if (strcmp(string, "023971") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_UNDER_VOLTAGE = YES; }
+    if (strcmp(string, "023972") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OVER_SOC = YES; }
+    if (strcmp(string, "023973") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_UNDER_SOC = YES; }
+    if (strcmp(string, "023974") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CURRENT = YES; }
+    if (strcmp(string, "023975") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_TEMPERATURE = YES; }
+    if (strcmp(string, "023976") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_ISOLATE = YES; }
+    if (strcmp(string, "023977") == EQUAL) { ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OUTPUT_CONNECTOR = YES; }
 }
 
 void CANReceiver()
 {
-	pid_t canRecPid;
-
-	canRecPid = fork();
-
-	if(canRecPid > 0)
-	{
-		int nbytes;
-		struct can_frame frame;
-		int intCmd;
-
-		// 槍資訊
-		struct ChargingInfoData *_chargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
-		struct timeval _cmd_ack_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
-
-		bool isPass = false;
-		gun_count = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
-
-		while(!isPass)
-		{
-			isPass = true;
-			for (byte _index = 0; _index < gun_count; _index++)
-			{
-				if (!FindChargingInfoData(_index, &_chargingData[0]))
-				{
-					DEBUG_ERROR("EvComm (main) : FindChargingInfoData false \n");
-					isPass = false;
-					break;
-				}
-			}
-
-			sleep(1);
-		}
-
-		for (byte _index = 0; _index < gun_count; _index++)
-			gettimeofday(&_cmd_ack_timeout[_index], NULL);
-
-		while (1)
-		{
-			memset(&frame, 0, sizeof(struct can_frame));
-			nbytes = read(CanFd, &frame, sizeof(struct can_frame));
-
-			for (byte _index = 0; _index < gun_count; _index++)
-			{
-				if (GetTimeoutValue(_cmd_ack_timeout[_index]) >= 5000000)
-				{
-					// ACK timeout
-					//PRINTF_FUNC("gun = %x, ack timeout \n", _index);
-				}
-			}
-
-			if (nbytes > 0)
-			{
-				byte target;
-				byte targetGun = 0x00;
-				intCmd = (int) (frame.can_id & CAN_EFF_MASK);
-
-				if (intCmd == ADDRESS_REQ)
-				{
-					AddrAssignment(frame.data);
-					continue;
-				}
-				intCmd = (int) (frame.can_id & CAN_EFF_MASK & 0xFFFFFF00);
-				target = ((byte) (frame.can_id & 0x000000FF));		// 0x01 or 0x02
-
-				for (byte _index = 0; _index < gun_count; _index++)
-				{
-					if (_chargingData[_index]->Evboard_id == target)
-					{
-						targetGun = _index;
-						break;
-					}
-				}
-
-				if(targetGun < 0 || targetGun >= CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY)
-				{
-					PRINTF_FUNC("EvComm (CANReceiver) : Target index = %x is < 0 or > QUANTITY \n", targetGun);
-					continue;
-				}
-				if(intCmd == 256)
-				{
-					continue;
-				}
-
-				gettimeofday(&_cmd_ack_timeout[targetGun], NULL);
-				switch (intCmd)
-				{
-					case NOTIFICATION_EV_STATUS:
-					{
-						if (_chargingData[targetGun]->ConnectorPlugIn != frame.data[0])
-							PRINTF_FUNC("index = %d, ConnectorPlugIn = %x, data[0] = %x \n", targetGun, _chargingData[targetGun]->ConnectorPlugIn, frame.data[0]);
-
-						_chargingData[targetGun]->ConnectorPlugIn = frame.data[0];
-						_chargingData[targetGun]->PilotVoltage = frame.data[1];
-
-						//PRINTF_FUNC("index = %d, ConnectorPlugIn = %x, data[0] = %x \n", targetGun, _chargingData[targetGun]->ConnectorPlugIn, frame.data[0]);
-						//PRINTF_FUNC("ConnectorPlugIn = %x \n", (-120 + frame.data[1]) / 10);
-					}
-						break;
-					case ACK_EV_FW_VERSION:
-					{
-						byte ver[16];
-
-						memset(ver, 0, sizeof(ver));
-						if (_chargingData[targetGun]->Type == _Type_Chademo)
-						{
-							memcpy(ver, frame.data, frame.can_dlc);
-							memcpy(ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].version, ver, ARRAY_SIZE(ver));
-							ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].SelfTest_Comp = PASS;
-							//PRINTF_FUNC("chademo ver. : %s\n", ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].version);
-						}
-						else if (_chargingData[targetGun]->Type == _Type_GB)
-						{
-							memcpy(ver, frame.data, frame.can_dlc);
-							memcpy(ShmGBTData->evse[_chargingData[targetGun]->type_index].version, ver, ARRAY_SIZE(ver));
-							ShmGBTData->evse[_chargingData[targetGun]->type_index].SelfTest_Comp = PASS;
-							//PRINTF_FUNC("gbt ver. : %s\n", ShmGBTData->evse[_chargingData[targetGun]->type_index].version);
-						}
-						else if (_chargingData[targetGun]->Type == _Type_CCS_2)
-						{
-							if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121)
-							{
-								for (byte _vCount = 0, _vPoint = 0; _vCount < frame.can_dlc; _vCount++)
-								{
-									/*if (_vCount % 2 == 0 && _vCount != 0)
-									{
-										ver[_vCount + _vPoint] = 0x2E;
-										_vPoint++;
-									}*/
-
-									ver[_vCount + _vPoint] = frame.data[_vCount];
-								}
-
-								memcpy(&ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].version, ver, ARRAY_SIZE(ver));
-								ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].SelfTest_Comp = PASS;
-								//PRINTF_FUNC("CCS FW = %s \n", ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].version);
-							}
-						}
-
-						if (targetGun == 0)
-						{
-							memset(ShmSysConfigAndInfo->SysInfo.Connector1FwRev, 0, sizeof(ShmSysConfigAndInfo->SysInfo.Connector1FwRev));
-							memcpy(ShmSysConfigAndInfo->SysInfo.Connector1FwRev, ver, ARRAY_SIZE(ver));
-						}
-						else
-						{
-							memset(ShmSysConfigAndInfo->SysInfo.Connector2FwRev, 0, sizeof(ShmSysConfigAndInfo->SysInfo.Connector2FwRev));
-							memcpy(ShmSysConfigAndInfo->SysInfo.Connector2FwRev, ver, ARRAY_SIZE(ver));
-						}
-					}
-						break;
-					case ACK_EV_HW_VERSION:
-					{
-						//PRINTF_FUNC("Get EV HW = %s \n", frame.data);
-					}
-						break;
-					case ACK_GET_OUTPUT_REQ:
-					{
-						_chargingData[targetGun]->EvBatterySoc = frame.data[1];
-						_chargingData[targetGun]->EvBatterytargetVoltage = (float)((frame.data[3] << 8) + frame.data[2]) / 10;
-						_chargingData[targetGun]->EvBatterytargetCurrent = (float)((frame.data[5] << 8) + frame.data[4]) / 10;
-						_chargingData[targetGun]->RemainChargingDuration = ((short) frame.data[7] << 8) + (short) frame.data[6];
-
-						if (_chargingData[targetGun]->Type == _Type_Chademo)
-						{
-							//if (ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].EvDetection != frame.data[0])
-							{
-								ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].PresentMsgFlowStatus = frame.data[0];
-							}
-
-							ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].EvDetection = frame.data[0];
-							ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].SOC = _chargingData[targetGun]->EvBatterySoc;
-							ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].TargetBatteryVoltage = (_chargingData[targetGun]->EvBatterytargetVoltage * 10);
-							ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].ChargingCurrentRequest = (_chargingData[targetGun]->EvBatterytargetCurrent * 10);
-						}
-						else if (_chargingData[targetGun]->Type == _Type_GB)
-						{
-							//if (ShmGBTData->ev[_chargingData[targetGun]->type_index].EvDetection != frame.data[0])
-							{
-								ShmGBTData->ev[_chargingData[targetGun]->type_index].PresentMsgFlowStatus = frame.data[0];
-							}
-
-							ShmGBTData->ev[_chargingData[targetGun]->type_index].EvDetection = frame.data[0];
-							ShmGBTData->ev[_chargingData[targetGun]->type_index].SOC = _chargingData[targetGun]->EvBatterySoc;
-							ShmGBTData->ev[_chargingData[targetGun]->type_index].TargetBatteryVoltage = (_chargingData[targetGun]->EvBatterytargetVoltage * 10);
-							ShmGBTData->ev[_chargingData[targetGun]->type_index].ChargingCurrentRequest = (_chargingData[targetGun]->EvBatterytargetCurrent * 10);
-						}
-						else if (_chargingData[targetGun]->Type == _Type_CCS_2)
-						{
-							if(ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121)
-							{
-								ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].PresentMsgFlowStatus = frame.data[0];
-							}
-						}
-
-						//PRINTF_FUNC("EvBatterytargetVoltage = %f \n", _chargingData[targetGun]->EvBatterytargetVoltage);
-						//PRINTF_FUNC("EvBatterytargetCurrent = %f \n", _chargingData[targetGun]->EvBatterytargetCurrent);
-						//PRINTF_FUNC("BatteryVoltage = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].TargetBatteryVoltage);
-						//PRINTF_FUNC("CurrentRequest = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].ChargingCurrentRequest);
-					}
-						break;
-					case ACK_GET_EV_BATTERY_INFO:
-					{
-						//_chargingData[target].EvACorDCcharging = frame.data[0];
-						//_chargingData[target]->TotalBatteryCap = ((float) frame.data[4] << 8) + (short) frame.data[3];
-						_chargingData[targetGun]->EvBatteryMaxVoltage = (((short) frame.data[4] << 8) + (short) frame.data[3]) / 10;
-						//_chargingData[target]->EvBatteryMaxCurrent = ((float) frame.data[4] << 8) + (short) frame.data[3];
-						//_chargingData[target].MaxiBatteryCurrent = ((short) frame.data[6] << 8) + (short) frame.data[5];
-						if (_chargingData[targetGun]->Type == _Type_Chademo)
-						{
-							ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].TotalBatteryCapacity = ((short) frame.data[2] << 8) + (short) frame.data[1];
-							ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].MaxiBatteryVoltage = _chargingData[targetGun]->EvBatteryMaxVoltage;
-
-							//PRINTF_FUNC("EvBatteryMaxVoltage = %f \n", _chargingData[target]->EvBatteryMaxVoltage);
-							//PRINTF_FUNC("TotalBatteryCapacity = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].TotalBatteryCapacity);
-							//PRINTF_FUNC("MaxiBatteryVoltage = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].MaxiBatteryVoltage);
-						}
-						else if (_chargingData[targetGun]->Type == _Type_GB)
-						{
-							ShmGBTData->ev[_chargingData[targetGun]->type_index].TotalBatteryCapacity = ((short) frame.data[2] << 8) + (short) frame.data[1];
-							ShmGBTData->ev[_chargingData[targetGun]->type_index].MaxiBatteryVoltage = _chargingData[targetGun]->EvBatteryMaxVoltage;
-						}
-						else if (_chargingData[targetGun]->Type == _Type_CCS_2)
-						{
-
-						}
-					}
-						break;
-					case ACK_GET_MISCELLANEOUS_INFO:
-					{
-						_chargingData[targetGun]->GunLocked = frame.data[0];
-						_chargingData[targetGun]->PilotVoltage = (float)(-120 + frame.data[3]) / 10;
-
-						if (_chargingData[targetGun]->Type == _Type_Chademo)
-						{
-							ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureP = frame.data[1];
-							ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureN = frame.data[2];
-							ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].EvboardStatus = frame.data[7];
-						}
-						else if (_chargingData[targetGun]->Type == _Type_GB)
-						{
-							ShmGBTData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureP = frame.data[1];
-							ShmGBTData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureN = frame.data[2];
-							ShmGBTData->evse[_chargingData[targetGun]->type_index].EvboardStatus = frame.data[7];
-						}
-						else if (_chargingData[targetGun]->Type == _Type_CCS_2)
-						{
-							if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121)
-							{
-								//ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index]. .ConnectorTemperatureP = frame.data[1];
-								//ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index]. .ConnectorTemperatureN = frame.data[2];
-							}
-						}
-
-						//PRINTF_FUNC("EvboardStatus = %x \n", ShmCHAdeMOData->evse[_chargingData[target]->type_index].EvboardStatus);
-						//PRINTF_FUNC("ConnectorPlug locked = %x \n", frame.data[0]);
-						//PRINTF_FUNC("ConnectorTemp 0= %d \n", ShmCHAdeMOData->evse[_chargingData[target]->type_index].ConnectorTemperatureP);
-						//PRINTF_FUNC("ConnectorTemp 1= %d \n", ShmCHAdeMOData->evse[_chargingData[target]->type_index].ConnectorTemperatureN);
-						//PRINTF_FUNC("PilotVoltage = %x \n", (-120 + frame.data[3]) / 10);
-					}
-						break;
-					case ACK_EVSE_ISOLATION_STATUS:	{}
-						break;
-					case ACK_EVSE_PRECHAGE_INFO:
-					{
-						_chargingData[targetGun]->PrechargeStatus = frame.data[0];
-					}
-						break;
-					case NOTIFICATION_EV_STOP:
-					{
-						// 車端要求停止
-						// frame.data[0] : 0x01 => normal stop, 0x02 => ev emergency stop
-						PRINTF_FUNC("(%d) NOTIFICATION_EV_STOP err level = %d-----------------------------\n", targetGun, frame.data[0]);
-						//if (frame.data[0] == 0x02)
-						{
-							AbnormalStopAnalysis(targetGun, frame.data + 1);
-						}
-						_chargingData[targetGun]->StopChargeFlag = YES;
-					}
-						break;
-					default:
-						PRINTF_FUNC("EV board = %d, Ack none defined. intCmd = %d  \n", targetGun, intCmd);
-						break;
-				}
-			}
-			usleep(10000);
-		}
-	}
+    pid_t canRecPid;
+
+    canRecPid = fork();
+
+    if (canRecPid > 0) {
+        int nbytes;
+        struct can_frame frame;
+        int intCmd;
+
+        // 瑽滩�閮�
+        struct ChargingInfoData *_chargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
+        struct timeval _cmd_ack_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
+
+        bool isPass = false;
+        gun_count = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
+
+        while (!isPass) {
+            isPass = true;
+            for (byte _index = 0; _index < gun_count; _index++) {
+                if (!FindChargingInfoData(_index, &_chargingData[0])) {
+                    DEBUG_ERROR("EvComm (main) : FindChargingInfoData false \n");
+                    isPass = false;
+                    break;
+                }
+            }
+
+            sleep(1);
+        }
+
+        for (byte _index = 0; _index < gun_count; _index++) {
+            gettimeofday(&_cmd_ack_timeout[_index], NULL);
+        }
+
+        while (1) {
+            memset(&frame, 0, sizeof(struct can_frame));
+            nbytes = read(CanFd, &frame, sizeof(struct can_frame));
+
+            for (byte _index = 0; _index < gun_count; _index++) {
+                if (GetTimeoutValue(_cmd_ack_timeout[_index]) >= 5000000) {
+                    // ACK timeout
+                    //PRINTF_FUNC("gun = %x, ack timeout \n", _index);
+                }
+            }
+
+            if (nbytes > 0) {
+                byte target;
+                byte targetGun = 0x00;
+                intCmd = (int) (frame.can_id & CAN_EFF_MASK);
+
+                if (intCmd == ADDRESS_REQ) {
+                    AddrAssignment(frame.data);
+                    continue;
+                }
+                intCmd = (int) (frame.can_id & CAN_EFF_MASK & 0xFFFFFF00);
+                target = ((byte) (frame.can_id & 0x000000FF));      // 0x01 or 0x02
+
+                for (byte _index = 0; _index < gun_count; _index++) {
+                    if (_chargingData[_index]->Evboard_id == target) {
+                        targetGun = _index;
+                        break;
+                    }
+                }
+
+                if (targetGun < 0 || targetGun >= CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY) {
+                    PRINTF_FUNC("EvComm (CANReceiver) : Target index = %x is < 0 or > QUANTITY \n", targetGun);
+                    continue;
+                }
+                if (intCmd == 256) {
+                    continue;
+                }
+
+                gettimeofday(&_cmd_ack_timeout[targetGun], NULL);
+                switch (intCmd) {
+                case NOTIFICATION_EV_STATUS: {
+                    if (_chargingData[targetGun]->ConnectorPlugIn != frame.data[0]) {
+                        PRINTF_FUNC("index = %d, ConnectorPlugIn = %x, data[0] = %x \n", targetGun, _chargingData[targetGun]->ConnectorPlugIn, frame.data[0]);
+                    }
+
+                    _chargingData[targetGun]->ConnectorPlugIn = frame.data[0];
+                    _chargingData[targetGun]->PilotVoltage = frame.data[1];
+
+                    //PRINTF_FUNC("index = %d, ConnectorPlugIn = %x, data[0] = %x \n", targetGun, _chargingData[targetGun]->ConnectorPlugIn, frame.data[0]);
+                    //PRINTF_FUNC("ConnectorPlugIn = %x \n", (-120 + frame.data[1]) / 10);
+                }
+                break;
+                case ACK_EV_FW_VERSION: {
+                    byte ver[16];
+
+                    memset(ver, 0, sizeof(ver));
+                    if (_chargingData[targetGun]->Type == _Type_Chademo) {
+                        memcpy(ver, frame.data, frame.can_dlc);
+                        memcpy(ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].version, ver, ARRAY_SIZE(ver));
+                        ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].SelfTest_Comp = PASS;
+                        //PRINTF_FUNC("chademo ver. : %s\n", ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].version);
+                    } else if (_chargingData[targetGun]->Type == _Type_GB) {
+                        memcpy(ver, frame.data, frame.can_dlc);
+                        memcpy(ShmGBTData->evse[_chargingData[targetGun]->type_index].version, ver, ARRAY_SIZE(ver));
+                        ShmGBTData->evse[_chargingData[targetGun]->type_index].SelfTest_Comp = PASS;
+                        //PRINTF_FUNC("gbt ver. : %s\n", ShmGBTData->evse[_chargingData[targetGun]->type_index].version);
+                    } else if (_chargingData[targetGun]->Type == _Type_CCS_2) {
+                        if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121) {
+                            for (byte _vCount = 0, _vPoint = 0; _vCount < frame.can_dlc; _vCount++) {
+                                /*if (_vCount % 2 == 0 && _vCount != 0)
+                                {
+                                    ver[_vCount + _vPoint] = 0x2E;
+                                    _vPoint++;
+                                }*/
+
+                                ver[_vCount + _vPoint] = frame.data[_vCount];
+                            }
+
+                            memcpy(&ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].version, ver, ARRAY_SIZE(ver));
+                            ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].SelfTest_Comp = PASS;
+                            //PRINTF_FUNC("CCS FW = %s \n", ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].version);
+                        }
+                    }
+
+                    if (targetGun == 0) {
+                        memset(ShmSysConfigAndInfo->SysInfo.Connector1FwRev, 0, sizeof(ShmSysConfigAndInfo->SysInfo.Connector1FwRev));
+                        memcpy(ShmSysConfigAndInfo->SysInfo.Connector1FwRev, ver, ARRAY_SIZE(ver));
+                    } else {
+                        memset(ShmSysConfigAndInfo->SysInfo.Connector2FwRev, 0, sizeof(ShmSysConfigAndInfo->SysInfo.Connector2FwRev));
+                        memcpy(ShmSysConfigAndInfo->SysInfo.Connector2FwRev, ver, ARRAY_SIZE(ver));
+                    }
+                }
+                break;
+                case ACK_EV_HW_VERSION: {
+                    //PRINTF_FUNC("Get EV HW = %s \n", frame.data);
+                }
+                break;
+                case ACK_GET_OUTPUT_REQ: {
+                    _chargingData[targetGun]->EvBatterySoc = frame.data[1];
+                    _chargingData[targetGun]->EvBatterytargetVoltage = (float)((frame.data[3] << 8) + frame.data[2]) / 10;
+                    _chargingData[targetGun]->EvBatterytargetCurrent = (float)((frame.data[5] << 8) + frame.data[4]) / 10;
+                    _chargingData[targetGun]->RemainChargingDuration = ((short) frame.data[7] << 8) + (short) frame.data[6];
+
+                    if (_chargingData[targetGun]->Type == _Type_Chademo) {
+                        //if (ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].EvDetection != frame.data[0])
+                        {
+                            ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].PresentMsgFlowStatus = frame.data[0];
+                        }
+
+                        ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].EvDetection = frame.data[0];
+                        ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].SOC = _chargingData[targetGun]->EvBatterySoc;
+                        ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].TargetBatteryVoltage = (_chargingData[targetGun]->EvBatterytargetVoltage * 10);
+                        ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].ChargingCurrentRequest = (_chargingData[targetGun]->EvBatterytargetCurrent * 10);
+                    } else if (_chargingData[targetGun]->Type == _Type_GB) {
+                        //if (ShmGBTData->ev[_chargingData[targetGun]->type_index].EvDetection != frame.data[0])
+                        {
+                            ShmGBTData->ev[_chargingData[targetGun]->type_index].PresentMsgFlowStatus = frame.data[0];
+                        }
+
+                        ShmGBTData->ev[_chargingData[targetGun]->type_index].EvDetection = frame.data[0];
+                        ShmGBTData->ev[_chargingData[targetGun]->type_index].SOC = _chargingData[targetGun]->EvBatterySoc;
+                        ShmGBTData->ev[_chargingData[targetGun]->type_index].TargetBatteryVoltage = (_chargingData[targetGun]->EvBatterytargetVoltage * 10);
+                        ShmGBTData->ev[_chargingData[targetGun]->type_index].ChargingCurrentRequest = (_chargingData[targetGun]->EvBatterytargetCurrent * 10);
+                    } else if (_chargingData[targetGun]->Type == _Type_CCS_2) {
+                        if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121) {
+                            ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].PresentMsgFlowStatus = frame.data[0];
+                        }
+                    }
+
+                    //PRINTF_FUNC("EvBatterytargetVoltage = %f \n", _chargingData[targetGun]->EvBatterytargetVoltage);
+                    //PRINTF_FUNC("EvBatterytargetCurrent = %f \n", _chargingData[targetGun]->EvBatterytargetCurrent);
+                    //PRINTF_FUNC("BatteryVoltage = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].TargetBatteryVoltage);
+                    //PRINTF_FUNC("CurrentRequest = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].ChargingCurrentRequest);
+                }
+                break;
+                case ACK_GET_EV_BATTERY_INFO: {
+                    //_chargingData[target].EvACorDCcharging = frame.data[0];
+                    //_chargingData[target]->TotalBatteryCap = ((float) frame.data[4] << 8) + (short) frame.data[3];
+                    _chargingData[targetGun]->EvBatteryMaxVoltage = (((short) frame.data[4] << 8) + (short) frame.data[3]) / 10;
+                    //_chargingData[target]->EvBatteryMaxCurrent = ((float) frame.data[4] << 8) + (short) frame.data[3];
+                    //_chargingData[target].MaxiBatteryCurrent = ((short) frame.data[6] << 8) + (short) frame.data[5];
+                    if (_chargingData[targetGun]->Type == _Type_Chademo) {
+                        ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].TotalBatteryCapacity = ((short) frame.data[2] << 8) + (short) frame.data[1];
+                        ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].MaxiBatteryVoltage = _chargingData[targetGun]->EvBatteryMaxVoltage;
+
+                        //PRINTF_FUNC("EvBatteryMaxVoltage = %f \n", _chargingData[target]->EvBatteryMaxVoltage);
+                        //PRINTF_FUNC("TotalBatteryCapacity = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].TotalBatteryCapacity);
+                        //PRINTF_FUNC("MaxiBatteryVoltage = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].MaxiBatteryVoltage);
+                    } else if (_chargingData[targetGun]->Type == _Type_GB) {
+                        ShmGBTData->ev[_chargingData[targetGun]->type_index].TotalBatteryCapacity = ((short) frame.data[2] << 8) + (short) frame.data[1];
+                        ShmGBTData->ev[_chargingData[targetGun]->type_index].MaxiBatteryVoltage = _chargingData[targetGun]->EvBatteryMaxVoltage;
+                    } else if (_chargingData[targetGun]->Type == _Type_CCS_2) {
+
+                    }
+                }
+                break;
+                case ACK_GET_MISCELLANEOUS_INFO: {
+                    _chargingData[targetGun]->GunLocked = frame.data[0];
+                    _chargingData[targetGun]->PilotVoltage = (float)(-120 + frame.data[3]) / 10;
+
+                    if (_chargingData[targetGun]->Type == _Type_Chademo) {
+                        ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureP = frame.data[1];
+                        ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureN = frame.data[2];
+                        ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].EvboardStatus = frame.data[7];
+                    } else if (_chargingData[targetGun]->Type == _Type_GB) {
+                        ShmGBTData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureP = frame.data[1];
+                        ShmGBTData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureN = frame.data[2];
+                        ShmGBTData->evse[_chargingData[targetGun]->type_index].EvboardStatus = frame.data[7];
+                    } else if (_chargingData[targetGun]->Type == _Type_CCS_2) {
+                        if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121) {
+                            //ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index]. .ConnectorTemperatureP = frame.data[1];
+                            //ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index]. .ConnectorTemperatureN = frame.data[2];
+                        }
+                    }
+
+                    //PRINTF_FUNC("EvboardStatus = %x \n", ShmCHAdeMOData->evse[_chargingData[target]->type_index].EvboardStatus);
+                    //PRINTF_FUNC("ConnectorPlug locked = %x \n", frame.data[0]);
+                    //PRINTF_FUNC("ConnectorTemp 0= %d \n", ShmCHAdeMOData->evse[_chargingData[target]->type_index].ConnectorTemperatureP);
+                    //PRINTF_FUNC("ConnectorTemp 1= %d \n", ShmCHAdeMOData->evse[_chargingData[target]->type_index].ConnectorTemperatureN);
+                    //PRINTF_FUNC("PilotVoltage = %x \n", (-120 + frame.data[3]) / 10);
+                }
+                break;
+                case ACK_EVSE_ISOLATION_STATUS: {}
+                    break;
+                case ACK_EVSE_PRECHAGE_INFO: {
+                    _chargingData[targetGun]->PrechargeStatus = frame.data[0];
+                }
+                break;
+                case NOTIFICATION_EV_STOP: {
+                    // 頠羓垢閬���𨀣迫
+                    // frame.data[0] : 0x01 => normal stop, 0x02 => ev emergency stop
+                    PRINTF_FUNC("(%d) NOTIFICATION_EV_STOP err level = %d-----------------------------\n", targetGun, frame.data[0]);
+                    //if (frame.data[0] == 0x02)
+                    {
+                        AbnormalStopAnalysis(targetGun, frame.data + 1);
+                    }
+                    _chargingData[targetGun]->StopChargeFlag = YES;
+                }
+                break;
+                default:
+                    PRINTF_FUNC("EV board = %d, Ack none defined. intCmd = %d  \n", targetGun, intCmd);
+                    break;
+                }
+            }
+            usleep(10000);
+        }
+    }
 }
 
 //================================================
 // Main process
 //================================================
-// 檢查 Byte 中某個 Bit 的值
-// _byte : 欲改變的 byte
-// _bit : 該 byte 的第幾個 bit
+// 瑼X䰻 Byte 銝剜��� Bit ����
+// _byte : 甈脫㺿霈羓� byte
+// _bit : 閰� byte ��洵撟曉�� bit
 unsigned char EvDetectionStatus(unsigned char _byte, unsigned char _bit)
 {
-	return ( _byte & mask_table[_bit] ) != 0x00;
+    return ( _byte & mask_table[_bit] ) != 0x00;
 }
 
 bool IsConnectorPlugIn(struct ChargingInfoData *chargingData)
 {
-	return (chargingData->ConnectorPlugIn == 0x01) ? true : false;
+    return (chargingData->ConnectorPlugIn == 0x01) ? true : false;
 }
 
 void SetPresentChargingOutputPower(struct ChargingInfoData *chargingData_1, struct ChargingInfoData *chargingData_2)
 {
-	float vol1 = 0, cur1 = 0;
-	float vol2 = 0, cur2 = 0;
-
-	vol1 = chargingData_1->FireChargingVoltage;
-	cur1 = (chargingData_1->PresentChargingCurrent * 10);
-	vol2 = chargingData_2->FireChargingVoltage;
-	cur2 = (chargingData_2->PresentChargingCurrent * 10);
-
-	if (_outVol_1 != vol1 ||
-		_outCur_1 != cur1 ||
-		_outVol_2 != vol2 ||
-		_outCur_2 != cur2)
-	{
-		/*PRINTF_FUNC("G1 -> Output Vol = %f, Output Cur = %f -- G2 -> Output Vol = %f, Output Cur = %f \n",
-			vol1, cur1, vol2, cur2);
-		*/	
-		_outVol_1 = vol1; _outCur_1 = cur1; _outVol_2 = vol2; _outCur_2 = cur2;
-	}
-
-	SetPresentOutputPower(vol1, cur1, vol2, cur2);
+    float vol1 = 0, cur1 = 0;
+    float vol2 = 0, cur2 = 0;
+
+    vol1 = chargingData_1->FireChargingVoltage;
+    cur1 = (chargingData_1->PresentChargingCurrent * 10);
+    vol2 = chargingData_2->FireChargingVoltage;
+    cur2 = (chargingData_2->PresentChargingCurrent * 10);
+
+    if (_outVol_1 != vol1 ||
+            _outCur_1 != cur1 ||
+            _outVol_2 != vol2 ||
+            _outCur_2 != cur2) {
+        /*PRINTF_FUNC("G1 -> Output Vol = %f, Output Cur = %f -- G2 -> Output Vol = %f, Output Cur = %f \n",
+            vol1, cur1, vol2, cur2);
+        */
+        _outVol_1 = vol1; _outCur_1 = cur1; _outVol_2 = vol2; _outCur_2 = cur2;
+    }
+
+    SetPresentOutputPower(vol1, cur1, vol2, cur2);
 }
 
 void SetPresentChargingOutputCap(struct ChargingInfoData *chargingData_1, struct ChargingInfoData *chargingData_2)
 {
-	float pow1 = 0, cur1 = 0;
-	float pow2 = 0, cur2 = 0;
-	float vol = 0;
-
-	pow1 = chargingData_1->AvailableChargingPower;
-	cur1 = chargingData_1->AvailableChargingCurrent;
-
-	vol = chargingData_1->MaximumChargingVoltage;
-	#ifndef DD360
-	GetMaxVolAndCurMethod(chargingData_1->Index, &vol, &cur1);
-	GetMaxPowerMethod(chargingData_1->Index, &pow1);
-	#endif
-
-	pow2 = chargingData_2->AvailableChargingPower;
-	cur2 = chargingData_2->AvailableChargingCurrent;
-	vol = chargingData_2->MaximumChargingVoltage;
-	#ifndef DD360
-	GetMaxVolAndCurMethod(chargingData_2->Index, &vol, &cur2);
-	GetMaxPowerMethod(chargingData_2->Index, &pow2);
-	#endif
-
-	if (_pow_1 != pow1 ||
-		_cur_1 != cur1 ||
-		_pow_2 != pow2 ||
-		_cur_2 != cur2)
-	{
-		PRINTF_FUNC("To EV (Real) Power_1 = %f, Cur_1 = %f, Power_2 = %f, Cur_2 = %f \n",
-				pow1, cur1, pow2, cur2);
-		_pow_1 = pow1; _cur_1 = cur1; _pow_2 = pow2; _cur_2 = cur2;
-		chargingData_1->RealMaxCurrent = _cur_1;
-		chargingData_1->RealMaxPower = pow1;
-
-		if (gun_count == 2)
-		{
-			chargingData_2->RealMaxCurrent = cur2;
-			chargingData_2->RealMaxPower = pow2;
-		}
-	}
-
-	SetPresentOutputCapacity(pow1, cur1, pow2, cur2);
+    float pow1 = 0, cur1 = 0;
+    float pow2 = 0, cur2 = 0;
+
+#if !defined DD360 && !defined DD360Audi
+    float vol = 0;
+#endif //!defined DD360 && !defined DD360Audi
+
+    pow1 = chargingData_1->AvailableChargingPower;
+    cur1 = chargingData_1->AvailableChargingCurrent;
+
+#if !defined DD360 && !defined DD360Audi
+    vol = chargingData_1->MaximumChargingVoltage;
+    GetMaxVolAndCurMethod(chargingData_1->Index, &vol, &cur1);
+    GetMaxPowerMethod(chargingData_1->Index, &pow1);
+#endif //!defined DD360 && !defined DD360Audi
+
+    pow2 = chargingData_2->AvailableChargingPower;
+    cur2 = chargingData_2->AvailableChargingCurrent;
+
+#if !defined DD360 && !defined DD360Audi
+    vol = chargingData_2->MaximumChargingVoltage;
+    GetMaxVolAndCurMethod(chargingData_2->Index, &vol, &cur2);
+    GetMaxPowerMethod(chargingData_2->Index, &pow2);
+#endif //!defined DD360 && !defined DD360Audi
+
+    if (_pow_1 != pow1 ||
+            _cur_1 != cur1 ||
+            _pow_2 != pow2 ||
+            _cur_2 != cur2) {
+        PRINTF_FUNC("To EV (Real) Power_1 = %f, Cur_1 = %f, Power_2 = %f, Cur_2 = %f \n",
+                    pow1, cur1, pow2, cur2);
+        _pow_1 = pow1; _cur_1 = cur1; _pow_2 = pow2; _cur_2 = cur2;
+        chargingData_1->RealMaxCurrent = _cur_1;
+        chargingData_1->RealMaxPower = pow1;
+
+        if (gun_count == 2) {
+            chargingData_2->RealMaxCurrent = cur2;
+            chargingData_2->RealMaxPower = pow2;
+        }
+    }
+
+    SetPresentOutputCapacity(pow1, cur1, pow2, cur2);
 }
 
 void Initialization()
 {
-	bool isPass = false;
-	while(!isPass)
-	{
-		isPass = true;
-		for (byte _index = 0; _index < gun_count; _index++)
-		{
-			if (!FindChargingInfoData(_index, &_chargingData[0]))
-			{
-				DEBUG_ERROR("EvComm (main) : FindChargingInfoData false \n");
-				isPass = false;
-				break;
-			}
-		}
-		sleep(1);
-	}
+    bool isPass = false;
+    while (!isPass) {
+        isPass = true;
+        for (byte _index = 0; _index < gun_count; _index++) {
+            if (!FindChargingInfoData(_index, &_chargingData[0])) {
+                DEBUG_ERROR("EvComm (main) : FindChargingInfoData false \n");
+                isPass = false;
+                break;
+            }
+        }
+        sleep(1);
+    }
 }
 
 void GetMaxVolAndCurMethod(byte index, float *vol, float *cur)
 {
-	if (maxChargingVol[index] != 0 && maxChargingVol[index] <= *vol)
-		*vol = maxChargingVol[index];
-
-	if (maxChargingCur[index] != 0 && maxChargingCur[index] <= *cur)
-		*cur = maxChargingCur[index];
-
-	if (_chargingData[index]->SystemStatus == S_CHARGING &&
-			_chargingData[index]->ChargingProfileCurrent > 0 &&
-			_chargingData[index]->ChargingProfileCurrent <= *cur)
-	{
-		*cur = _chargingData[index]->ChargingProfileCurrent;
-	}
+    if (maxChargingVol[index] != 0 && maxChargingVol[index] <= *vol) {
+        *vol = maxChargingVol[index];
+    }
+
+    if (maxChargingCur[index] != 0 && maxChargingCur[index] <= *cur) {
+        *cur = maxChargingCur[index];
+    }
+
+    if (_chargingData[index]->SystemStatus == S_CHARGING &&
+            _chargingData[index]->ChargingProfileCurrent > 0 &&
+            _chargingData[index]->ChargingProfileCurrent <= *cur) {
+        *cur = _chargingData[index]->ChargingProfileCurrent;
+    }
 }
 
 void GetMaxPowerMethod(byte index, float *pow)
 {
-	if (maxChargingPow != 0 && maxChargingPow <= *pow)
-		*pow = maxChargingPow;
-
-	if (_chargingData[index]->SystemStatus == S_CHARGING &&
-			_chargingData[index]->ChargingProfilePower > 0 &&
-			_chargingData[index]->ChargingProfilePower <= *pow)
-	{
-		*pow = _chargingData[index]->ChargingProfilePower;
-	}
+    if (maxChargingPow != 0 && maxChargingPow <= *pow) {
+        *pow = maxChargingPow;
+    }
+
+    if (_chargingData[index]->SystemStatus == S_CHARGING &&
+            _chargingData[index]->ChargingProfilePower > 0 &&
+            _chargingData[index]->ChargingProfilePower <= *pow) {
+        *pow = _chargingData[index]->ChargingProfilePower;
+    }
 }
 
 time_t GetRtcInfoForEpoch()
 {
-	struct timeb csuTime;
-	struct tm *tmCSU;
-	struct tm t;
-	time_t result;
-
-	ftime(&csuTime);
-	tmCSU = localtime(&csuTime.time);
-
-	t.tm_year = tmCSU->tm_year;
-	t.tm_mon = tmCSU->tm_mon;
-	t.tm_mday = tmCSU->tm_mday;
-	t.tm_hour = tmCSU->tm_hour;
-	t.tm_min = tmCSU->tm_min;
-	t.tm_sec = tmCSU->tm_sec;
-	t.tm_isdst = -1;
-	result = mktime(&t);
-
-	return result;
+    struct timeb csuTime;
+    struct tm *tmCSU;
+    struct tm t;
+    time_t result;
+
+    ftime(&csuTime);
+    tmCSU = localtime(&csuTime.time);
+
+    t.tm_year = tmCSU->tm_year;
+    t.tm_mon = tmCSU->tm_mon;
+    t.tm_mday = tmCSU->tm_mday;
+    t.tm_hour = tmCSU->tm_hour;
+    t.tm_min = tmCSU->tm_min;
+    t.tm_sec = tmCSU->tm_sec;
+    t.tm_isdst = -1;
+    result = mktime(&t);
+
+    return result;
 }
 
 byte GetStopChargingReasonByEvse(byte gunIndex, byte *reason)
 {
-	byte result = NO;
-
-	if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip == 0x01)
-	{
-		// 012251
-		*(reason + 5)  = 0;
-		*(reason + 4)  = 1;
-		*(reason + 3)  = 2;
-		*(reason + 2)  = 2;
-		*(reason + 1)  = 5;
-		*(reason + 0)  = 1;
-		result = YES;
-	}
-
-	if (_chargingData[gunIndex]->Type == _Type_Chademo)
-	{
-		if (ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayDrivingFault == YES)
-		{
-			// 011012
-			*(reason + 5) = 0;
-			*(reason + 4) = 1;
-			*(reason + 3) = 1;
-			*(reason + 2) = 0;
-			*(reason + 1) = 1;
-			*(reason + 0) = 2;
-			result = YES;
-		}
-		else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.ChademoOutputUVPFail == YES)
-		{
-			// 012289
-			*(reason + 5) = 0;
-			*(reason + 4) = 1;
-			*(reason + 3) = 2;
-			*(reason + 2) = 2;
-			*(reason + 1) = 8;
-			*(reason + 0) = 9;
-			result = YES;
-		}
-		else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.ChademoGfdTrip == YES)
-		{
-			// 012234
-			*(reason + 5) = 0;
-			*(reason + 4) = 1;
-			*(reason + 3) = 2;
-			*(reason + 2) = 2;
-			*(reason + 1) = 3;
-			*(reason + 0) = 4;
-			result = YES;
-		}
-	}
-	else if (_chargingData[gunIndex]->Type == _Type_GB)
-	{
-		if (ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayDrivingFault == YES)
-		{
-			// 012290
-			*(reason + 5) = 0;
-			*(reason + 4) = 1;
-			*(reason + 3) = 2;
-			*(reason + 2) = 2;
-			*(reason + 1) = 9;
-			*(reason + 0) = 0;
-			result = YES;
-		}
-		else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.GbGfdTrip == YES)
-		{
-			// 012236
-			*(reason + 5) = 0;
-			*(reason + 4) = 1;
-			*(reason + 3) = 2;
-			*(reason + 2) = 2;
-			*(reason + 1) = 3;
-			*(reason + 0) = 6;
-			result = YES;
-		}
-	}
-	else if (_chargingData[gunIndex]->Type == _Type_CCS_2)
-	{
-		if (ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsOutputRelayDrivingFault == YES)
-		{
-			// 011014
-			*(reason + 5) = 0;
-			*(reason + 4) = 1;
-			*(reason + 3) = 1;
-			*(reason + 2) = 0;
-			*(reason + 1) = 1;
-			*(reason + 0) = 4;
-			result = YES;
-		}
-		else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsOutputUVPFail == YES)
-		{
-			// 012288
-			*(reason + 5) = 0;
-			*(reason + 4) = 1;
-			*(reason + 3) = 2;
-			*(reason + 2) = 2;
-			*(reason + 1) = 8;
-			*(reason + 0) = 8;
-			result = YES;
-		}
-		else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsGfdTrip == YES)
-		{
-			// 012235
-			*(reason + 5) = 0;
-			*(reason + 4) = 1;
-			*(reason + 3) = 2;
-			*(reason + 2) = 2;
-			*(reason + 1) = 3;
-			*(reason + 0) = 5;
-			result = YES;
-		}
-	}
-
-	return result;
+    byte result = NO;
+
+    if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip == 0x01) {
+        // 012251
+        *(reason + 5)  = 0;
+        *(reason + 4)  = 1;
+        *(reason + 3)  = 2;
+        *(reason + 2)  = 2;
+        *(reason + 1)  = 5;
+        *(reason + 0)  = 1;
+        result = YES;
+    }
+
+    if (_chargingData[gunIndex]->Type == _Type_Chademo) {
+        if (ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayDrivingFault == YES) {
+            // 011012
+            *(reason + 5) = 0;
+            *(reason + 4) = 1;
+            *(reason + 3) = 1;
+            *(reason + 2) = 0;
+            *(reason + 1) = 1;
+            *(reason + 0) = 2;
+            result = YES;
+        } else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.ChademoOutputUVPFail == YES) {
+            // 012289
+            *(reason + 5) = 0;
+            *(reason + 4) = 1;
+            *(reason + 3) = 2;
+            *(reason + 2) = 2;
+            *(reason + 1) = 8;
+            *(reason + 0) = 9;
+            result = YES;
+        } else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.ChademoGfdTrip == YES) {
+            // 012234
+            *(reason + 5) = 0;
+            *(reason + 4) = 1;
+            *(reason + 3) = 2;
+            *(reason + 2) = 2;
+            *(reason + 1) = 3;
+            *(reason + 0) = 4;
+            result = YES;
+        }
+    } else if (_chargingData[gunIndex]->Type == _Type_GB) {
+        if (ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayDrivingFault == YES) {
+            // 012290
+            *(reason + 5) = 0;
+            *(reason + 4) = 1;
+            *(reason + 3) = 2;
+            *(reason + 2) = 2;
+            *(reason + 1) = 9;
+            *(reason + 0) = 0;
+            result = YES;
+        } else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.GbGfdTrip == YES) {
+            // 012236
+            *(reason + 5) = 0;
+            *(reason + 4) = 1;
+            *(reason + 3) = 2;
+            *(reason + 2) = 2;
+            *(reason + 1) = 3;
+            *(reason + 0) = 6;
+            result = YES;
+        }
+    } else if (_chargingData[gunIndex]->Type == _Type_CCS_2) {
+        if (ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsOutputRelayDrivingFault == YES) {
+            // 011014
+            *(reason + 5) = 0;
+            *(reason + 4) = 1;
+            *(reason + 3) = 1;
+            *(reason + 2) = 0;
+            *(reason + 1) = 1;
+            *(reason + 0) = 4;
+            result = YES;
+        } else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsOutputUVPFail == YES) {
+            // 012288
+            *(reason + 5) = 0;
+            *(reason + 4) = 1;
+            *(reason + 3) = 2;
+            *(reason + 2) = 2;
+            *(reason + 1) = 8;
+            *(reason + 0) = 8;
+            result = YES;
+        } else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsGfdTrip == YES) {
+            // 012235
+            *(reason + 5) = 0;
+            *(reason + 4) = 1;
+            *(reason + 3) = 2;
+            *(reason + 2) = 2;
+            *(reason + 1) = 3;
+            *(reason + 0) = 5;
+            result = YES;
+        }
+    }
+
+    return result;
 }
 
 int main(int argc, char *argv[])
 {
-	if(InitShareMemory() == FAIL)
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("InitShareMemory NG\n");
-		#endif
-		if(ShmStatusCodeData != NULL)
-		{
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
-		}
-		sleep(5);
-		return 0;
-	}
-
-	gun_count = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
-	Initialization();
-	CanFd = InitCanBus();
-	CANReceiver();
-
-	byte priorityLow = 1;
-	time_t rtc = GetRtcInfoForEpoch();
-	while(CanFd)
-	{
-		for(byte _index = 0; _index < gun_count; _index++)
-		{
-			if (priorityLow == 1)
-			{
-				// 優先權較低 - 只要有回應即不會再詢問
-				if (_chargingData[_index]->Type == _Type_Chademo &&
-						ShmCHAdeMOData->evse[_chargingData[_index]->type_index].SelfTest_Comp != PASS)
-				{
-					SyncRtcInfo(_index, _chargingData[_index]->Evboard_id, (int)rtc);
-					GetFirmwareVersion(_index, _chargingData[_index]->Evboard_id);
-				}
-				else if (_chargingData[_index]->Type == _Type_GB &&
-						ShmGBTData->evse[_chargingData[_index]->type_index].SelfTest_Comp != PASS)
-				{
-					SyncRtcInfo(_index, _chargingData[_index]->Evboard_id, (int)rtc);
-					GetFirmwareVersion(_index, _chargingData[_index]->Evboard_id);
-				}
-				else if (_chargingData[_index]->Type == _Type_CCS_2)
-				{
-					if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121 &&
-						ShmCcsData->V2GMessage_DIN70121[_chargingData[_index]->type_index].SelfTest_Comp != PASS)
-					{
-						SyncRtcInfo(_index, _chargingData[_index]->Evboard_id, (int)rtc);
-						GetFirmwareVersion(_index, _chargingData[_index]->Evboard_id);
-					}
-				}
-
-				// 固定要取得的資訊 : 1.槍鎖狀態, 2."Connector 1" 溫度, 3."Connector 2" 溫度, 4.Pilot Voltage
-				//PRINTF_FUNC("GetMiscellaneousInfo. index = %d, Eid = %d \n", _index, _chargingData[_index]->Evboard_id);
-				GetMiscellaneousInfo(_index,
-						_chargingData[_index]->RelayK1K2Status,
-						_chargingData[_index]->PresentChargedEnergy,
-						(_chargingData[_index]->PresentChargingVoltage * 10),
-						_chargingData[_index]->Evboard_id);
-			}
-
-			switch (_chargingData[_index]->SystemStatus)
-			{
-				case S_IDLE:
-				case S_RESERVATION:
-					if (_chargingData[_index]->Type == _Type_Chademo)
-					{
-						ClearAbnormalStatus_Chademo(_index);
-					}
-					else if (_chargingData[_index]->Type == _Type_GB)
-					{
-						ClearAbnormalStatus_GB(_index);
-					}
-					else if (_chargingData[_index]->Type == _Type_CCS_2)
-					{
-						ClearAbnormalStatus_CCS(_index);
-					}
-
-					if (priorityLow == 1)
-					{
-						_chargingData[_index]->PresentChargedEnergy = 0;
-						_chargingData[_index]->PresentChargingPower = 0;
-						_chargingData[_index]->GroundFaultStatus = GFD_WAIT;
-						_chargingData[_index]->RealRatingPower = 0;
-						_chargingData[_index]->StopChargeFlag = NO;
-						_chargingData[_index]->ChargingFee = 0.0;
-						_chargingData[_index]->EvBatterySoc = 0;
-						_chargingData[_index]->PresentChargingVoltage = 0;
-						_chargingData[_index]->PresentChargingCurrent = 0;
-						_chargingData[_index]->EvBatteryMaxVoltage = 0;
-
-						chargingTime[_index] = 0;
-
-						//maxChargingCur[_index] = ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent * 10;
-						maxChargingPow = (ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10);
-					}
-					break;
-				case S_PREPARNING:
-				{
-					// 設定當前輸出
-					if (gun_count == 1)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
-					else if (gun_count == 2)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
-
-					_chargingData[_index]->PowerConsumption = 0;
-				}
-					break;
-				case S_PREPARING_FOR_EV:
-				{
-					// 開始確認車端是否同意開始充電 : 1.SOC, 2.Target Vol, 3.Target Cur, 4.Charging remaining time
-					GetOutputReq(_index, _chargingData[_index]->Evboard_id);
-
-//					PRINTF_FUNC("PresentChargingVoltage = %f \n", _chargingData[_index]->PresentChargingVoltage);
-//					PRINTF_FUNC("PresentChargingCurrent = %f \n", _chargingData[_index]->PresentChargingCurrent);
-//					PRINTF_FUNC("AvailableChargingPower = %f \n", _chargingData[_index]->AvailableChargingPower);
-//					PRINTF_FUNC("AvailableChargingCurrent = %f \n", _chargingData[_index]->AvailableChargingCurrent);
-//					PRINTF_FUNC("MaximumChargingVoltage = %f \n", _chargingData[_index]->MaximumChargingVoltage);
-
-					// 設定當前輸出
-					if (gun_count == 1)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
-					else if (gun_count == 2)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
-
-					if (priorityLow == 1)
-					{
-						float maxVol, maxCur;
-						// 樁端輸出能力
-						maxVol = _chargingData[_index]->MaximumChargingVoltage;
-						maxCur = _chargingData[_index]->AvailableChargingCurrent;
-
-						GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
-
-						PRINTF_FUNC("To EV_%d Max_Vol = %f, Cap_Cur = %f, Cap_Pow = %f \n",
-								_index, maxVol, maxCur, _chargingData[_index]->AvailableChargingPower);
-						_chargingData[_index]->RealMaxVoltage = maxVol;
-
-						SetChargingPermission(_index, START,
-						_chargingData[_index]->AvailableChargingPower,
-								maxCur,
-								maxVol,
-								_chargingData[_index]->Evboard_id);
-
-						// 取得車端電池資訊 : 1.AC or DC ? 2.Total battery cap, 3.Max battery vol, 4.Max battery cur
-						GetEvBatteryInfo(_index, _chargingData[_index]->Evboard_id);
-					}
-					gettimeofday(&_chk_ratingPower_timeout[_index], NULL);
-				}
-					break;
-				case S_PREPARING_FOR_EVSE:
-				case S_CCS_PRECHARGE_ST0:
-				case S_CCS_PRECHARGE_ST1:
-				{
-					// 開始確認車端是否同意開始充電
-					GetOutputReq(_index, _chargingData[_index]->Evboard_id);
-
-					// 設定當前輸出
-					if (gun_count == 1)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
-					else if (gun_count == 2)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
-
-					if (priorityLow % 5 == 1)
-					{
-						// 樁端輸出能力改變
-						if (gun_count == 1)
-							SetPresentChargingOutputCap(_chargingData[0], _chargingData[0]);
-						else if (gun_count == 2)
-							SetPresentChargingOutputCap(_chargingData[0], _chargingData[1]);
-					}
-					// 持續通知 Isolation 測試狀態
-					if (priorityLow == 1)
-					{
-						// 拉 500 V 如果在一秒鐘內 GFD 都符合則 PASS
-//						if (_chargingData[_index]->FireChargingVoltage >= 3500)
-//							_chargingData[_index]->GroundFaultStatus = GFD_PASS;
-
-						//PRINTF_FUNC("To EV_%d GFD = %d \n",	_index, _chargingData[_index]->GroundFaultStatus);
-						//if(_chargingData[_index]->GroundFaultStatus != GFD_WAIT)
-						{
-							//if ((GetTimeoutValue(_derating_time) / 1000) > 1000)
-							unsigned char _result = _chargingData[_index]->GroundFaultStatus;
-
-							// GB & Chademo ~ Warning 也先算 Pass,因為 CCS 認證會驗 Warning 故不可更動
-							if(_chargingData[_index]->Type == _Type_Chademo ||
-								_chargingData[_index]->Type == _Type_GB)
-							{
-								if (_result == GFD_WARNING)
-								{
-									_result = GFD_PASS;
-								}
-							}
-
-							if (_result == GFD_WARNING || _result == GFD_PASS)
-							{
-								if (((GetTimeoutValue(_chk_ratingPower_timeout[_index]) / 1000) > 12000 &&
-										_chargingData[_index]->RealRatingPower > 0) ||
-										(GetTimeoutValue(_chk_ratingPower_timeout[_index]) / 1000) > 14000)
-								{
-									PRINTF_FUNC("**********EvComm : _index= %d, RealRatingPower = %d \n",
-											_index, _chargingData[_index]->RealRatingPower);
-									//_result = GFD_PASS;
-								}
-								else
-									_result = GFD_WAIT;
-							}
-
-							SetIsolationStatus(_index, _result, _chargingData[_index]->Evboard_id);
-						}
-
-						if(_chargingData[_index]->SystemStatus == S_CCS_PRECHARGE_ST0 &&
-							_chargingData[_index]->PrechargeStatus == PRECHARGE_READY)
-						{
-							SetEvsePrechargeInfo(_index, PRECHARGE_PRERELAY_PASS, _chargingData[_index]->Evboard_id);
-						}
-					}
-				}
-					break;
-				case S_CHARGING:
-				{
-					// 計算 Power
-					_chargingData[_index]->PresentChargingPower = ((float)((_chargingData[_index]->PresentChargingVoltage) * (_chargingData[_index]->PresentChargingCurrent)) / 1000);
-
-					if (chargingTime[_index] == 0 ||
-							chargingTime[_index] > _chargingData[_index]->PresentChargedDuration)
-					{
-						chargingTime[_index] = _chargingData[_index]->PresentChargedDuration;
-					}
-					else
-					{
-						int passTime = _chargingData[_index]->PresentChargedDuration - chargingTime[_index];
-
-						if (passTime > 0)
-						{
-							float changingPow = (_chargingData[_index]->PresentChargingPower) * passTime / 3600;
-							if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling)
-							{
-								_chargingData[_index]->ChargingFee += changingPow * ShmSysConfigAndInfo->SysConfig.BillingData.Cur_fee;
-							}
-
-							_chargingData[_index]->PresentChargedEnergy += changingPow;
-							_chargingData[_index]->PowerConsumption += changingPow;
-							chargingTime[_index] = _chargingData[_index]->PresentChargedDuration;
-						}
-					}
-
-					// 開始確認車端是否同意開始充電
-					GetOutputReq(_index, _chargingData[_index]->Evboard_id);
-
-					// 設定當前輸出
-					if (gun_count == 1)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
-					else if (gun_count == 2)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
-
-					// for test end
-					if (priorityLow % 5 == 0)
-					{
-						// 樁端輸出能力改變
-						if (gun_count == 1)
-							SetPresentChargingOutputCap(_chargingData[0], _chargingData[0]);
-						else if (gun_count == 2)
-							SetPresentChargingOutputCap(_chargingData[0], _chargingData[1]);
-					}
-
-					if(_chargingData[_index]->GroundFaultStatus == GFD_FAIL)
-					{
-						SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
-					}
-					else if(_chargingData[_index]->Type == _Type_CCS_2)
-					{
-						SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
-					}
-
-					// GFD 失敗再通知
-					if (priorityLow == 1)
-					{
-						if(_chargingData[_index]->Type == _Type_CCS_2 &&
-							_chargingData[_index]->PrechargeStatus == PRECHARGE_READY)
-						{
-							SetEvsePrechargeInfo(_index, PRECHARGE_CHARELAY_PASS, _chargingData[_index]->Evboard_id);
-						}
-					}
-				}
-					break;
-				case S_TERMINATING:
-				{
-					// 設定當前輸出
-					if (gun_count == 1)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
-					else if (gun_count == 2)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
-
-					// 槍鎖還在,則代表是樁端要求的停止
-					if (_chargingData[_index]->GunLocked == START ||
-							_chargingData[_index]->Type == _Type_CCS_2)
-					{
-						byte normalStop = 0x01;
-						byte stopReason[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
-						if (GetStopChargingReasonByEvse(_index, stopReason))
-						{
-							normalStop = 0x02;
-						}
-
-						EvseStopChargingEvent(normalStop, stopReason, _chargingData[_index]->Evboard_id);
-					}
-
-					if(_chargingData[_index]->Type == _Type_CCS_2)
-					{
-						SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
-					}
-
-					GetOutputReq(_index, _chargingData[_index]->Evboard_id);
-				}
-					break;
-				case S_COMPLETE:
-				{
-					// 設定當前輸出
-					if (gun_count == 1)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
-					else if (gun_count == 2)
-						SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
-
-					if (priorityLow == 1)
-					{
-						float maxVol, maxCur;
-
-						// 樁端輸出能力
-						maxVol = _chargingData[_index]->MaximumChargingVoltage;
-						maxCur = _chargingData[_index]->AvailableChargingCurrent;
-
-						GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
-						SetChargingPermission(_index, STOP,
-								_chargingData[_index]->AvailableChargingPower,
-								maxCur,
-								maxVol,
-								_chargingData[_index]->Evboard_id);
-					}
-				}
-					break;
-			}
-		}
-		priorityLow >= 20 ? priorityLow = 1 : priorityLow++;
-		usleep(45000); //EV 小板通訊 (50 ms)
-	}
-	DEBUG_INFO("Module_EvComm : Can-bus port = %d \n", CanFd);
-	return FAIL;
+    if (InitShareMemory() == FAIL) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("InitShareMemory NG\n");
+#endif
+        if (ShmStatusCodeData != NULL) {
+            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
+        }
+        sleep(5);
+        return 0;
+    }
+
+    gun_count = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
+    Initialization();
+    CanFd = InitCanBus();
+    CANReceiver();
+
+    byte priorityLow = 1;
+    time_t rtc = GetRtcInfoForEpoch();
+    while (CanFd) {
+        for (byte _index = 0; _index < gun_count; _index++) {
+            if (priorityLow == 1) {
+                // �芸�甈𡃏�雿� - �芾��匧��匧朖銝齿��滩岷��
+                if (_chargingData[_index]->Type == _Type_Chademo &&
+                        ShmCHAdeMOData->evse[_chargingData[_index]->type_index].SelfTest_Comp != PASS) {
+                    SyncRtcInfo(_index, _chargingData[_index]->Evboard_id, (int)rtc);
+                    GetFirmwareVersion(_index, _chargingData[_index]->Evboard_id);
+                } else if (_chargingData[_index]->Type == _Type_GB &&
+                           ShmGBTData->evse[_chargingData[_index]->type_index].SelfTest_Comp != PASS) {
+                    SyncRtcInfo(_index, _chargingData[_index]->Evboard_id, (int)rtc);
+                    GetFirmwareVersion(_index, _chargingData[_index]->Evboard_id);
+                } else if (_chargingData[_index]->Type == _Type_CCS_2) {
+                    if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121 &&
+                            ShmCcsData->V2GMessage_DIN70121[_chargingData[_index]->type_index].SelfTest_Comp != PASS) {
+                        SyncRtcInfo(_index, _chargingData[_index]->Evboard_id, (int)rtc);
+                        GetFirmwareVersion(_index, _chargingData[_index]->Evboard_id);
+                    }
+                }
+
+                // �箏�閬��敺㛖�鞈�� : 1.瑽漤�����, 2."Connector 1" 皞怠漲, 3."Connector 2" 皞怠漲, 4.Pilot Voltage
+                //PRINTF_FUNC("GetMiscellaneousInfo. index = %d, Eid = %d \n", _index, _chargingData[_index]->Evboard_id);
+                GetMiscellaneousInfo(_index,
+                                     _chargingData[_index]->RelayK1K2Status,
+                                     _chargingData[_index]->PresentChargedEnergy,
+                                     (_chargingData[_index]->PresentChargingVoltage * 10),
+                                     _chargingData[_index]->Evboard_id);
+            }
+
+            switch (_chargingData[_index]->SystemStatus) {
+            case S_IDLE:
+            case S_RESERVATION:
+                if (_chargingData[_index]->Type == _Type_Chademo) {
+                    ClearAbnormalStatus_Chademo(_index);
+                } else if (_chargingData[_index]->Type == _Type_GB) {
+                    ClearAbnormalStatus_GB(_index);
+                } else if (_chargingData[_index]->Type == _Type_CCS_2) {
+                    ClearAbnormalStatus_CCS(_index);
+                }
+
+                if (priorityLow == 1) {
+                    _chargingData[_index]->PresentChargedEnergy = 0;
+                    _chargingData[_index]->PresentChargingPower = 0;
+                    _chargingData[_index]->GroundFaultStatus = GFD_WAIT;
+                    _chargingData[_index]->RealRatingPower = 0;
+                    _chargingData[_index]->StopChargeFlag = NO;
+                    _chargingData[_index]->ChargingFee = 0.0;
+                    _chargingData[_index]->EvBatterySoc = 0;
+                    _chargingData[_index]->PresentChargingVoltage = 0;
+                    _chargingData[_index]->PresentChargingCurrent = 0;
+                    _chargingData[_index]->EvBatteryMaxVoltage = 0;
+
+                    chargingTime[_index] = 0;
+
+                    //maxChargingCur[_index] = ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent * 10;
+                    maxChargingPow = (ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10);
+                }
+                break;
+            case S_PREPARNING: {
+                // 閮剖��嗅�頛詨枂
+                if (gun_count == 1) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
+                } else if (gun_count == 2) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
+                }
+
+                _chargingData[_index]->PowerConsumption = 0;
+            }
+            break;
+            case S_PREPARING_FOR_EV: {
+                // �见�蝣箄�頠羓垢�臬炏�峕��见���𤓖 : 1.SOC, 2.Target Vol, 3.Target Cur, 4.Charging remaining time
+                GetOutputReq(_index, _chargingData[_index]->Evboard_id);
+
+//                  PRINTF_FUNC("PresentChargingVoltage = %f \n", _chargingData[_index]->PresentChargingVoltage);
+//                  PRINTF_FUNC("PresentChargingCurrent = %f \n", _chargingData[_index]->PresentChargingCurrent);
+//                  PRINTF_FUNC("AvailableChargingPower = %f \n", _chargingData[_index]->AvailableChargingPower);
+//                  PRINTF_FUNC("AvailableChargingCurrent = %f \n", _chargingData[_index]->AvailableChargingCurrent);
+//                  PRINTF_FUNC("MaximumChargingVoltage = %f \n", _chargingData[_index]->MaximumChargingVoltage);
+
+                // 閮剖��嗅�頛詨枂
+                if (gun_count == 1) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
+                } else if (gun_count == 2) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
+                }
+
+                if (priorityLow == 1) {
+                    float maxVol, maxCur;
+                    // 璅�垢頛詨枂�賢�
+                    maxVol = _chargingData[_index]->MaximumChargingVoltage;
+                    maxCur = _chargingData[_index]->AvailableChargingCurrent;
+
+                    GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
+
+                    PRINTF_FUNC("To EV_%d Max_Vol = %f, Cap_Cur = %f, Cap_Pow = %f \n",
+                                _index, maxVol, maxCur, _chargingData[_index]->AvailableChargingPower);
+                    _chargingData[_index]->RealMaxVoltage = maxVol;
+
+                    SetChargingPermission(_index, START,
+                                          _chargingData[_index]->AvailableChargingPower,
+                                          maxCur,
+                                          maxVol,
+                                          _chargingData[_index]->Evboard_id);
+
+                    // �硋�頠羓垢�餅�鞈�� : 1.AC or DC ? 2.Total battery cap, 3.Max battery vol, 4.Max battery cur
+                    GetEvBatteryInfo(_index, _chargingData[_index]->Evboard_id);
+                }
+                gettimeofday(&_chk_ratingPower_timeout[_index], NULL);
+            }
+            break;
+            case S_PREPARING_FOR_EVSE:
+            case S_CCS_PRECHARGE_ST0:
+            case S_CCS_PRECHARGE_ST1: {
+                // �见�蝣箄�頠羓垢�臬炏�峕��见���𤓖
+                GetOutputReq(_index, _chargingData[_index]->Evboard_id);
+
+                // 閮剖��嗅�頛詨枂
+                if (gun_count == 1) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
+                } else if (gun_count == 2) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
+                }
+
+                if (priorityLow % 5 == 1) {
+                    // 璅�垢頛詨枂�賢��寡�
+                    if (gun_count == 1) {
+                        SetPresentChargingOutputCap(_chargingData[0], _chargingData[0]);
+                    } else if (gun_count == 2) {
+                        SetPresentChargingOutputCap(_chargingData[0], _chargingData[1]);
+                    }
+                }
+                // ����𡁶䰻 Isolation 皜祈岫����
+                if (priorityLow == 1) {
+                    // �� 500 V 憒���其�蝘㘾��� GFD �賜泵��� PASS
+//                      if (_chargingData[_index]->FireChargingVoltage >= 3500)
+//                          _chargingData[_index]->GroundFaultStatus = GFD_PASS;
+
+                    //PRINTF_FUNC("To EV_%d GFD = %d \n",   _index, _chargingData[_index]->GroundFaultStatus);
+                    //if(_chargingData[_index]->GroundFaultStatus != GFD_WAIT)
+                    {
+                        //if ((GetTimeoutValue(_derating_time) / 1000) > 1000)
+                        unsigned char _result = _chargingData[_index]->GroundFaultStatus;
+
+                        // GB & Chademo ~ Warning 銋笔�蝞� Pass嚗���� CCS 隤滩���� Warning ����舀凒��
+                        if (_chargingData[_index]->Type == _Type_Chademo ||
+                                _chargingData[_index]->Type == _Type_GB) {
+                            if (_result == GFD_WARNING) {
+                                _result = GFD_PASS;
+                            }
+                        }
+
+                        if (_result == GFD_WARNING || _result == GFD_PASS) {
+                            if (((GetTimeoutValue(_chk_ratingPower_timeout[_index]) / 1000) > 12000 &&
+                                    _chargingData[_index]->RealRatingPower > 0) ||
+                                    (GetTimeoutValue(_chk_ratingPower_timeout[_index]) / 1000) > 14000) {
+                                PRINTF_FUNC("**********EvComm : _index= %d, RealRatingPower = %d \n",
+                                            _index, _chargingData[_index]->RealRatingPower);
+                                //_result = GFD_PASS;
+                            } else {
+                                _result = GFD_WAIT;
+                            }
+                        }
+
+                        SetIsolationStatus(_index, _result, _chargingData[_index]->Evboard_id);
+                    }
+
+                    if (_chargingData[_index]->SystemStatus == S_CCS_PRECHARGE_ST0 &&
+                            _chargingData[_index]->PrechargeStatus == PRECHARGE_READY) {
+                        SetEvsePrechargeInfo(_index, PRECHARGE_PRERELAY_PASS, _chargingData[_index]->Evboard_id);
+                    }
+                }
+            }
+            break;
+            case S_CHARGING: {
+                // 閮�� Power
+                _chargingData[_index]->PresentChargingPower = ((float)((_chargingData[_index]->PresentChargingVoltage) * (_chargingData[_index]->PresentChargingCurrent)) / 1000);
+
+                if (chargingTime[_index] == 0 ||
+                        chargingTime[_index] > _chargingData[_index]->PresentChargedDuration) {
+                    chargingTime[_index] = _chargingData[_index]->PresentChargedDuration;
+                } else {
+                    int passTime = _chargingData[_index]->PresentChargedDuration - chargingTime[_index];
+
+                    if (passTime > 0) {
+                        float changingPow = (_chargingData[_index]->PresentChargingPower) * passTime / 3600;
+                        if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling) {
+                            _chargingData[_index]->ChargingFee += changingPow * ShmSysConfigAndInfo->SysConfig.BillingData.Cur_fee;
+                        }
+
+                        _chargingData[_index]->PresentChargedEnergy += changingPow;
+                        _chargingData[_index]->PowerConsumption += changingPow;
+                        chargingTime[_index] = _chargingData[_index]->PresentChargedDuration;
+                    }
+                }
+
+                // �见�蝣箄�頠羓垢�臬炏�峕��见���𤓖
+                GetOutputReq(_index, _chargingData[_index]->Evboard_id);
+
+                // 閮剖��嗅�頛詨枂
+                if (gun_count == 1) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
+                } else if (gun_count == 2) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
+                }
+
+                // for test end
+                if (priorityLow % 5 == 0) {
+                    // 璅�垢頛詨枂�賢��寡�
+                    if (gun_count == 1) {
+                        SetPresentChargingOutputCap(_chargingData[0], _chargingData[0]);
+                    } else if (gun_count == 2) {
+                        SetPresentChargingOutputCap(_chargingData[0], _chargingData[1]);
+                    }
+                }
+
+                if (_chargingData[_index]->GroundFaultStatus == GFD_FAIL) {
+                    SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
+                } else if (_chargingData[_index]->Type == _Type_CCS_2) {
+                    SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
+                }
+
+                // GFD 憭望��漤�𡁶䰻
+                if (priorityLow == 1) {
+                    if (_chargingData[_index]->Type == _Type_CCS_2 &&
+                            _chargingData[_index]->PrechargeStatus == PRECHARGE_READY) {
+                        SetEvsePrechargeInfo(_index, PRECHARGE_CHARELAY_PASS, _chargingData[_index]->Evboard_id);
+                    }
+                }
+            }
+            break;
+            case S_TERMINATING: {
+                // 閮剖��嗅�頛詨枂
+                if (gun_count == 1) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
+                } else if (gun_count == 2) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
+                }
+
+                // 瑽漤���銁嚗��隞�”�舀�蝡航�瘙���𨀣迫
+                if (_chargingData[_index]->GunLocked == START ||
+                        _chargingData[_index]->Type == _Type_CCS_2) {
+                    byte normalStop = 0x01;
+                    byte stopReason[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+                    if (GetStopChargingReasonByEvse(_index, stopReason)) {
+                        normalStop = 0x02;
+                    }
+
+                    EvseStopChargingEvent(normalStop, stopReason, _chargingData[_index]->Evboard_id);
+                }
+
+                if (_chargingData[_index]->Type == _Type_CCS_2) {
+                    SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
+                }
+
+                GetOutputReq(_index, _chargingData[_index]->Evboard_id);
+            }
+            break;
+            case S_COMPLETE: {
+                // 閮剖��嗅�頛詨枂
+                if (gun_count == 1) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
+                } else if (gun_count == 2) {
+                    SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
+                }
+
+                if (priorityLow == 1) {
+                    float maxVol, maxCur;
+
+                    // 璅�垢頛詨枂�賢�
+                    maxVol = _chargingData[_index]->MaximumChargingVoltage;
+                    maxCur = _chargingData[_index]->AvailableChargingCurrent;
+
+                    GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
+                    SetChargingPermission(_index, STOP,
+                                          _chargingData[_index]->AvailableChargingPower,
+                                          maxCur,
+                                          maxVol,
+                                          _chargingData[_index]->Evboard_id);
+                }
+            }
+            break;
+            }
+        }
+        priorityLow >= 20 ? priorityLow = 1 : priorityLow++;
+        usleep(45000); //EV 撠𤩺踎�朞� (50 ms)
+    }
+    DEBUG_INFO("Module_EvComm : Can-bus port = %d \n", CanFd);
+    return FAIL;
 }

BIN
EVSE/Projects/DD360Audi/Apps/Module_EventLogging


BIN
EVSE/Projects/DD360Audi/Apps/Module_InternalComm


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 671 - 744
EVSE/Projects/DD360Audi/Apps/Module_InternalComm.c


+ 213 - 181
EVSE/Projects/DD360Audi/Apps/Module_LcmContro.h

@@ -1,196 +1,228 @@
-#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/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 	<errno.h>
-#include 	<string.h>
-#include	<time.h>
-#include	<ctype.h>
-#include 	<ifaddrs.h>
-#include 	<stdbool.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
-
-typedef unsigned char 			byte;
-
-struct SysConfigAndInfo			*ShmSysConfigAndInfo;
-struct StatusCodeData 			*ShmStatusCodeData;
-struct FanModuleData			*ShmFanModuleData;
-
-#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_TITLE_1				0x5A
-#define CMD_TITLE_2				0xA5
-#define CMD_READ				0x80
-#define CMD_WRITE				0x81
-#define CMD_MULTI_WRITE			0x82
-#define CMD_MULTI_READ			0x83
-
-#define CMD_BACKLIGHT			0x01
-#define CMD_REGISTER			0x03
-
-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,
+#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/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 <errno.h>
+#include <string.h>
+#include <time.h>
+#include <ctype.h>
+#include <ifaddrs.h>
+#include <stdbool.h>
+#include "../../define.h"
+#include "Config.h"
+
+#define ARRAY_SIZE(A)       (sizeof(A) / sizeof(A[0]))
+#define PASS                1
+#define FAIL                -1
+#define YES                 1
+#define NO                  0
+
+typedef unsigned char           byte;
+
+struct SysConfigAndInfo         *ShmSysConfigAndInfo;
+struct StatusCodeData           *ShmStatusCodeData;
+struct FanModuleData            *ShmFanModuleData;
+
+#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_TITLE_1             0x5A
+#define CMD_TITLE_2             0xA5
+#define CMD_READ                0x80
+#define CMD_WRITE               0x81
+#define CMD_MULTI_WRITE         0x82
+#define CMD_MULTI_READ          0x83
+
+#define CMD_BACKLIGHT           0x01
+#define CMD_REGISTER            0x03
+
+#define NOODOE_QR_CODE_URL      "https://ev-alpha-test.noodoe.com/station?id=" ////For Audi
+
+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 _port;
-//char* pPortName = "/dev/ttyO2";
-char* pPortName = "/dev/ttyS3";
-char* moduleName = "DMT80480T070_09WT";
+//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;
-// 當前選擇的槍號
-short _currentPage = _LCM_NONE;
-short _oldPage = _LCM_NONE;
-byte _gunIndex = 0;
-bool _wifi_conn_status = false;
+byte isDiffStatus         = false;
+byte isChangeBattMap      = false;
+// �嗅��豢������
+short _currentPage        = _LCM_SELECT_GUN;//_LCM_NONE; ////For Audi
+short _oldPage            = _LCM_SELECT_GUN;//_LCM_NONE; ////For Audi
+byte _gunIndex            = 0;
+bool _wifi_conn_status    = false;
 bool _battery_display_ani = false;
-byte _curPage_index = 0;
-bool _page_reload = false;
+byte _curPage_index       = 0;
+bool _page_reload         = false;
 
 // LCM - HW
-byte _everyPageRollChange = 0;
-short __conn_status = 0x0030;
-short __ethernet_status = 0x0032;
-short __3G4G_status = 0x0036;
-short __wifi_status = 0x003C;
-
-short __sel_gun_btn = 0x0040;
-short __ret_home_btn = 0x0042;
-short __stop_method_btn = 0x0044;
-
-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 __qr_code_pre = 0x0280;
-
-short __side_top = 0x0090;
-short __side_down = 0x0092;
-short __side_mid = 0x0094;
-
-short __conn_line_chag = 0x0096;
-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 __output_eng_tx = 0x0120;
-short __total_out_eng_tx = 0x0130;
-short __conn_line_comp = 0x0140;
-short __charging_fee_map = 0x0146;
-short __charging_fee_tx = 0x0150;
-
-short __money_by_rate = 0x0200;
-short __money_rate = 0x0220;
-short __money_rate_map = 0x0230;
+byte _everyPageRollChange    = 0;
+short __conn_status          = 0x0030;
+short __ethernet_status      = 0x0032;
+short __3G4G_status          = 0x0036;
+short __3G4G_status1         = 0x0037;
+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 __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 __cmp_gun_type_index   = 0x0080; ////For Audi
+short __batt_map_empty       = 0x0090; ////For Audi
+short __qr_code_pre          = 0x0280;
+
+short __side_top             = 0x0090;
+short __side_down            = 0x0092;
+short __side_mid             = 0x0094;
+
+short __conn_line_chag       = 0x0096;
+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 __output_eng_tx        = 0x0120;
+short __total_out_eng_tx     = 0x0130;
+short __conn_line_comp       = 0x0140;
+short __charging_fee_map     = 0x0146;
+short __charging_fee_tx      = 0x0150;
+
+short __money_by_rate        = 0x0200;
+short __money_rate           = 0x0220;
+short __money_rate_map       = 0x0230;
+
+////For Audi, for select gun
+short __left_gun_map         = 0x0260;
+short __right_gun_map        = 0x0262;
+short __add_chk_btn          = 0x0264;
+//short __station_id         = 0x0270;
+short __balance              = 0x0270;
+short __remain_balance       = 0x0280;
+short __custStationIdL1      = 0x0450;
+//short __custStationIdL2      = 0x0470;
 
 // 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 _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 _side_none_rfid = 52;
-byte _side_rfid = 53;
-byte _side_none_app = 54;
-byte _side_app = 55;
-byte _side_none_qr = 56;
-byte _side_qr = 57;
-byte _eth_disconnect = 58;
-byte _eth_connect = 59;
+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 _side_none_rfid       = 52;
+//byte _side_rfid            = 53;
+//byte _side_none_app        = 54;
+//byte _side_app             = 55;
+//byte _side_none_qr         = 56;
+//byte _side_qr              = 57;
+byte _eth_disconnect         = 52; //58;
+byte _eth_connect            = 53; //59;
+
+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;
+
+////For Audi
+byte _left_gun_disable_map   = 66;
+byte _left_gun_enable_map    = 67;
+byte _right_gun_disable_map  = 68;
+byte _right_gun_enable_map   = 69;
+byte _select_gun_btn         = 70;

BIN
EVSE/Projects/DD360Audi/Apps/Module_LcmControl


+ 1267 - 1182
EVSE/Projects/DD360Audi/Apps/Module_LcmControl.c

@@ -1,5 +1,8 @@
 #include "Module_LcmContro.h"
+#include "Config.h"
+#include "AudiCust.h"
 
+static AudiCustInfo *gAudiCustInfo = NULL;
 bool needReloadQr = true;
 
 void PRINTF_FUNC(char *string, ...);
@@ -9,68 +12,65 @@ int StoreLogMsg(const char *fmt, ...);
 #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
 #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
 
-char* getTimeString(void);
+char *getTimeString(void);
 
 //=================================
 // Common routine
 //=================================
 int StoreLogMsg(const char *fmt, ...)
 {
-	char Buf[4096+256];
-	char buffer[4096];
-	va_list args;
-	struct timeb  SeqEndTime;
-	struct tm *tm;
-
-	va_start(args, fmt);
-	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
-	va_end(args);
-
-	memset(Buf,0,sizeof(Buf));
-	ftime(&SeqEndTime);
-	SeqEndTime.time = time(NULL);
-	tm=localtime(&SeqEndTime.time);
-
-	if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES)
-	{
-		sprintf(Buf,"%02d:%02d:%02d:%03d - %s",
-			tm->tm_hour,tm->tm_min,tm->tm_sec,SeqEndTime.millitm, buffer);
-		printf("%s \n", Buf);
-	}
-	else
-	{
-		sprintf(Buf,"echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,SeqEndTime.millitm,
-			buffer,
-			tm->tm_year+1900,tm->tm_mon+1);
-		system(Buf);
-	}
-
-	return rc;
+    char Buf[4096 + 256];
+    char buffer[4096];
+    va_list args;
+    struct timeb  SeqEndTime;
+    struct tm *tm;
+
+    va_start(args, fmt);
+    int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+    va_end(args);
+
+    memset(Buf, 0, sizeof(Buf));
+    ftime(&SeqEndTime);
+    SeqEndTime.time = time(NULL);
+    tm = localtime(&SeqEndTime.time);
+
+    if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES) {
+        sprintf(Buf, "%02d:%02d:%02d:%03d - %s",
+                tm->tm_hour, tm->tm_min, tm->tm_sec, SeqEndTime.millitm, buffer);
+        printf("%s \n", Buf);
+    } else {
+        sprintf(Buf, "echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+                tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, SeqEndTime.millitm,
+                buffer,
+                tm->tm_year + 1900, tm->tm_mon + 1);
+        system(Buf);
+    }
+
+    return rc;
 }
 
-char* getTimeString(void)
+char *getTimeString(void)
 {
-	char *result=malloc(21);
-	time_t timep;
-	struct tm *p;
-	time(&timep);
-	p=gmtime(&timep);
+    char *result = malloc(21);
+    time_t timep;
+    struct tm *p;
+    time(&timep);
+    p = gmtime(&timep);
 
-	sprintf(result, "[%04d-%02d-%02d %02d:%02d:%02d]", (1900+p->tm_year), (1+p->tm_mon), p->tm_mday, p->tm_hour, p->tm_hour, p->tm_sec);
+    sprintf(result, "[%04d-%02d-%02d %02d:%02d:%02d]", (1900 + p->tm_year), (1 + p->tm_mon), p->tm_mday, p->tm_hour, p->tm_hour, p->tm_sec);
 
-	return result;
+    return result;
 }
 
 void PRINTF_FUNC(char *string, ...)
 {
-	va_list args;
-	char buffer[4096];
-	va_start(args, string);
-	vsnprintf(buffer, sizeof(buffer), string, args);
-	va_end(args);
+    va_list args;
+    char buffer[4096];
+    va_start(args, string);
+    vsnprintf(buffer, sizeof(buffer), string, args);
+    va_end(args);
 
-	DEBUG_INFO("%s \n", buffer);
+    DEBUG_INFO("%s \n", buffer);
 }
 
 //==========================================
@@ -78,45 +78,46 @@ void PRINTF_FUNC(char *string, ...)
 //==========================================
 int InitShareMemory()
 {
-	int result = PASS;
-	int MeterSMId;
-
-	//creat ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
-    {
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
-		#endif
-		result = FAIL;
-	}
-    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-    {
-    	#ifdef SystemLogMessage
-    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
-		#endif
-    	result = FAIL;
-   	 }
-    else
+    int result = PASS;
+    int MeterSMId;
+
+    //creat ShmSysConfigAndInfo
+    if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+#endif
+        result = FAIL;
+    } else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+#endif
+        result = FAIL;
+    } else
     {}
 
-   	 //creat ShmStatusCodeData
-   	 if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
-    {
-		#ifdef SystemLogMessage
-   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
-		#endif
-   		result = FAIL;
-	}
-    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-    {
-    	#ifdef SystemLogMessage
-    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
-		#endif
-    	result = FAIL;
-   	}
-    else
+    //creat ShmStatusCodeData
+    if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+#endif
+        result = FAIL;
+    } else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+#endif
+        result = FAIL;
+    } else
     {}
 
+    //creat Audi customization info
+    if ((MeterSMId = shmget(ShmAudiCustInfoKey, sizeof(AudiCustInfo), IPC_CREAT | 0777)) < 0) {
+        DEBUG_ERROR("[main]CreatShareMemory:shmget select gun info NG \n");
+        return 0;
+    } else if ((gAudiCustInfo = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+        DEBUG_ERROR("[main]CreatShareMemory:shmat shmget select gun info \n");
+        return 0;
+    }
+
     return result;
 }
 
@@ -125,75 +126,68 @@ int InitShareMemory()
 //==========================================
 int CreateCommunicationLcmPort()
 {
-	int fd;
-	struct termios tios;
-
-	fd = open(pPortName, O_RDWR);
-	if (fd <= 0) {
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("open /dev/ttyS3 NG \n");
-		#endif
-		return -1;
-	}
-	ioctl(fd, TCGETS, &tios);
-	tios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
-	tios.c_lflag = 0;
-	tios.c_iflag = 0;
-	tios.c_oflag = 0;
-	tios.c_cc[VMIN] = 0;
-	tios.c_cc[VTIME] = (unsigned char) 5;
-	tios.c_lflag = 0;
-	tcflush(fd, TCIFLUSH);
-	ioctl(fd, TCSETS, &tios);
-
-	return fd;
+    int fd;
+    struct termios tios;
+
+    fd = open(pPortName, O_RDWR);
+    if (fd <= 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("open /dev/ttyS3 NG \n");
+#endif
+        return -1;
+    }
+    ioctl(fd, TCGETS, &tios);
+    tios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
+    tios.c_lflag = 0;
+    tios.c_iflag = 0;
+    tios.c_oflag = 0;
+    tios.c_cc[VMIN] = 0;
+    tios.c_cc[VTIME] = (unsigned char) 5;
+    tios.c_lflag = 0;
+    tcflush(fd, TCIFLUSH);
+    ioctl(fd, TCSETS, &tios);
+
+    return fd;
 }
 
 void CloseCommunicationLcmPort()
 {
-	close(_port);
+    close(_port);
 }
 
 void WriteCmdToLcm(byte *cmd, byte cmdLen)
 {
-	int len = write(_port, cmd, cmdLen);
-	if(len >= sizeof(cmd))
-	{
-		//PRINTF_FUNC("Write cmd to LCM successfully. \n");
-	}
+    int len = write(_port, cmd, cmdLen);
+    if (len >= sizeof(cmd)) {
+        //PRINTF_FUNC("Write cmd to LCM successfully. \n");
+    }
 }
 
 void ReadMsgFromLcm(byte *msg, byte readLen)
 {
-	read(_port, msg, readLen);
-
-	if(*msg == CMD_TITLE_1 && *(msg + 1) == CMD_TITLE_2)
-	{
-		if(*(msg + 3) == CMD_WRITE)
-		{
-			switch (*(msg + 4))
-			{
-				case CMD_REGISTER:
-				{
-					// 頁面
-					strcpy((char *)ShmSysConfigAndInfo->SysInfo.LcmHwRev, moduleName);
-				}
-				break;
-			}
-		}
-		else if (*(msg + 3) == CMD_MULTI_READ)
-		{
-//			switch ((unsigned short) (*(msg + 4) << 8) + (unsigned short) *(msg + 5))
-//			{
-//				case BUTTON_GUN_INDEX:
-//				{
-//					// 當前選的槍號
-//					_curGunIndex = (*(msg + 8));
-//				}
-//				break;
-//			}
-		}
-	}
+    read(_port, msg, readLen);
+
+    if (*msg == CMD_TITLE_1 && *(msg + 1) == CMD_TITLE_2) {
+        if (*(msg + 3) == CMD_WRITE) {
+            switch (*(msg + 4)) {
+            case CMD_REGISTER: {
+                // ��𢒰
+                strcpy((char *)ShmSysConfigAndInfo->SysInfo.LcmHwRev, moduleName);
+            }
+            break;
+            }
+        } else if (*(msg + 3) == CMD_MULTI_READ) {
+//          switch ((unsigned short) (*(msg + 4) << 8) + (unsigned short) *(msg + 5))
+//          {
+//              case BUTTON_GUN_INDEX:
+//              {
+//                  // �嗅��貊�瑽滩�
+//                  _curGunIndex = (*(msg + 8));
+//              }
+//              break;
+//          }
+        }
+    }
 }
 
 //================================================
@@ -201,109 +195,107 @@ void ReadMsgFromLcm(byte *msg, byte readLen)
 //================================================
 void ChangeToOtherPage(short newPage)
 {
-	byte cmd[7];
-	memset(cmd, 0x00, sizeof(cmd));
-
-	cmd[0] = CMD_TITLE_1;
-	cmd[1] = CMD_TITLE_2;
-	cmd[2] = 0x02 + sizeof(newPage);
-	cmd[3] = CMD_READ;
-	cmd[4] = CMD_REGISTER;
-	cmd[5] = newPage >> 8;
-	cmd[6] = newPage & 0x00FF;
-
-	WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
-	usleep(100000);
+    byte cmd[7];
+    memset(cmd, 0x00, sizeof(cmd));
+
+    cmd[0] = CMD_TITLE_1;
+    cmd[1] = CMD_TITLE_2;
+    cmd[2] = 0x02 + sizeof(newPage);
+    cmd[3] = CMD_READ;
+    cmd[4] = CMD_REGISTER;
+    cmd[5] = newPage >> 8;
+    cmd[6] = newPage & 0x00FF;
+
+    WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
+    usleep(100000);
 }
 
 void ChangeBackLight(bool islight)
 {
-	byte value = 0x01;
-
-	if (islight)
-	{
-		value = 0x20;
-	}
-	byte cmd[7];
-	memset(cmd, 0x00, sizeof(cmd));
-
-	cmd[0] = CMD_TITLE_1;
-	cmd[1] = CMD_TITLE_2;
-	cmd[2] = 0x03;
-	cmd[3] = CMD_READ;
-	cmd[4] = CMD_BACKLIGHT;
-	cmd[5] = value;
-
-	WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
-	usleep(100000);
+    byte value = 0x01;
+
+    if (islight) {
+        value = 0x20;
+    }
+    byte cmd[7];
+    memset(cmd, 0x00, sizeof(cmd));
+
+    cmd[0] = CMD_TITLE_1;
+    cmd[1] = CMD_TITLE_2;
+    cmd[2] = 0x03;
+    cmd[3] = CMD_READ;
+    cmd[4] = CMD_BACKLIGHT;
+    cmd[5] = value;
+
+    WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
+    usleep(100000);
 }
 
 void GetCurrentPage()
 {
-	byte cmd[6];
-	memset(cmd, 0x00, sizeof(cmd));
-	byte msg[8];
-	memset(msg, 0x00, sizeof(msg));
-
-	cmd[0] = CMD_TITLE_1;
-	cmd[1] = CMD_TITLE_2;
-	cmd[2] = 0x03;				// 底下總長度
-	cmd[3] = CMD_WRITE;
-	cmd[4] = CMD_REGISTER;
-	cmd[5] = 0x02;
-
-	WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
-	usleep(100000);
-	ReadMsgFromLcm(msg, ARRAY_SIZE(msg));
+    byte cmd[6];
+    memset(cmd, 0x00, sizeof(cmd));
+    byte msg[8];
+    memset(msg, 0x00, sizeof(msg));
+
+    cmd[0] = CMD_TITLE_1;
+    cmd[1] = CMD_TITLE_2;
+    cmd[2] = 0x03;              // 摨蓥�蝮賡𩑈摨�
+    cmd[3] = CMD_WRITE;
+    cmd[4] = CMD_REGISTER;
+    cmd[5] = 0x02;
+
+    WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
+    usleep(100000);
+    ReadMsgFromLcm(msg, ARRAY_SIZE(msg));
 }
 
 void DisplayValueToLcm(short address, byte *data, byte len)
 {
-	byte cmd[256];
-	memset(cmd, 0x00, sizeof(cmd));
-
-	cmd[0] = CMD_TITLE_1;
-	cmd[1] = CMD_TITLE_2;
-	cmd[2] = 0x03 + len;
-	cmd[3] = CMD_MULTI_WRITE;
-	cmd[4] = address >> 8;
-	cmd[5] = address & 0x00FF;
-
-	for(byte count = 0; count < len; count++)
-	{
-		cmd[6 + count] = *(data + count);
-	}
-
-	WriteCmdToLcm(cmd, cmd[2] + 3);
+    byte cmd[256];
+    memset(cmd, 0x00, sizeof(cmd));
+
+    cmd[0] = CMD_TITLE_1;
+    cmd[1] = CMD_TITLE_2;
+    cmd[2] = 0x03 + len;
+    cmd[3] = CMD_MULTI_WRITE;
+    cmd[4] = address >> 8;
+    cmd[5] = address & 0x00FF;
+
+    for (byte count = 0; count < len; count++) {
+        cmd[6 + count] = *(data + count);
+    }
+
+    WriteCmdToLcm(cmd, cmd[2] + 3);
 }
 
 void ChangeDisplay2Value(short address, short value)
 {
-	byte data[2];
-	data[0] = value >> 8;
-	data[1] = value & 0x00FF;
+    byte data[2];
+    data[0] = value >> 8;
+    data[1] = value & 0x00FF;
 
-	DisplayValueToLcm(address, data, sizeof(data));
+    DisplayValueToLcm(address, data, sizeof(data));
 }
 
 void GetBtnStatus(short address, byte len)
 {
-	byte cmd[8];
-	memset(cmd, 0x00, sizeof(cmd));
-	byte msg[8];
-	memset(msg, 0x00, sizeof(msg));
-
-	cmd[0] = CMD_TITLE_1;
-	cmd[1] = CMD_TITLE_2;
-	cmd[2] = 0x03 + len;
-	cmd[3] = CMD_MULTI_READ;
-	cmd[4] = address >> 8;
-	cmd[5] = address & 0x00FF;
-	cmd[6] = 0x00 + len;
-
-	WriteCmdToLcm(cmd, cmd[2] + 3);
-	usleep(100000);
-	ReadMsgFromLcm(msg, (len * 2) + sizeof(msg));
+    byte cmd[8];
+    memset(cmd, 0x00, sizeof(cmd));
+    byte msg[8];
+    memset(msg, 0x00, sizeof(msg));
+
+    cmd[0] = CMD_TITLE_1;
+    cmd[1] = CMD_TITLE_2;
+    cmd[2] = 0x03 + len;
+    cmd[3] = CMD_MULTI_READ;
+    cmd[4] = address >> 8;
+    cmd[5] = address & 0x00FF;
+    cmd[6] = 0x00 + len;
+
+    WriteCmdToLcm(cmd, cmd[2] + 3);
+    usleep(100000);
+    ReadMsgFromLcm(msg, (len * 2) + sizeof(msg));
 }
 
 //================================================
@@ -317,8 +309,7 @@ void string2ByteArray(unsigned char *input, byte *output)
     loop = 0;
     i = 0;
 
-    while(input[loop] != '\0')
-    {
+    while (input[loop] != '\0') {
         output[i++] = input[loop++];
     }
     output[loop] = '\0';
@@ -326,83 +317,76 @@ void string2ByteArray(unsigned char *input, byte *output)
 
 void ChangeWarningFunc()
 {
-	byte cmd[7];
-	byte i = 0,j=0;
-	//PRINTF_FUNC("ChangeWarningFunc \n");
-	// 最多一次五筆
-	//PRINTF_FUNC("LCM PageIndex = %d \n", ShmSysConfigAndInfo->SysWarningInfo.PageIndex);
-	//PRINTF_FUNC("WarningCount = %d \n", ShmSysConfigAndInfo->SysWarningInfo.WarningCount);
-	#if 0
-	for(i = 0; (i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5) < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++)
-	{
-		memset(cmd, 0x00, sizeof(cmd));
-		if((i) >= 5)
-		{
-			break;
-		}
-
-		//error code
-		string2ByteArray(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], cmd);
-		DisplayValueToLcm(0x0010 + ((i) * 6), cmd, sizeof(cmd));
-		//警告標示
-		memset(cmd, 0x00, sizeof(cmd));
-
-		cmd[0] = 0x00;
-		cmd[1] = 0x01;
-		DisplayValueToLcm(0x0002 + ((i) * 2), cmd, 2);
-	}
-
-	memset(cmd, 0x00, sizeof(cmd));
-	for(; i < 5; i++)
-	{
-		DisplayValueToLcm(0x0010 + ((i) * 6), cmd, sizeof(cmd));
-		DisplayValueToLcm(0x0002 + ((i) * 2), cmd, 2);
-	}
-	#else
-	for(i = 0; (i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5) < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++)
-	{
-		memset(cmd, 0x00, sizeof(cmd));
-		if((i-j) >= 5)
-		{
-			break;
-		}
-		if((memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "033900", 6) == 0) ||
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "033901", 6) == 0) ||
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "033902", 6) == 0) ||
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043627", 6) == 0) ||
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043628", 6) == 0) ||
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043622", 6) == 0)  ||
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043623", 6) == 0) ||
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043624", 6) == 0)||
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043625", 6) == 0) ||  
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043626", 6) == 0)  ||
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "042241", 6) == 0) ||  
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "042242", 6) == 0) 
-		   )
-		{
-			j++;
-			continue;
-		}
-		//error code
-		string2ByteArray(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], cmd);
-		DisplayValueToLcm(0x0010 + ((i-j) * 6), cmd, sizeof(cmd));
-		//警告標示
-		memset(cmd, 0x00, sizeof(cmd));
-
-		cmd[0] = 0x00;
-		cmd[1] = 0x01;
-		DisplayValueToLcm(0x0002 + ((i-j) * 2), cmd, 2);
-	}
-
-	memset(cmd, 0x00, sizeof(cmd));
-	i=i-j;
-	for(; (i)< 5; i++)
-	{
-		DisplayValueToLcm(0x0010 + ((i) * 6), cmd, sizeof(cmd));
-		DisplayValueToLcm(0x0002 + ((i) * 2), cmd, 2);
-	}
-	
-	#endif
+    byte cmd[7];
+    byte i = 0, j = 0;
+    //PRINTF_FUNC("ChangeWarningFunc \n");
+    // ��憭帋�甈∩�蝑�
+    //PRINTF_FUNC("LCM PageIndex = %d \n", ShmSysConfigAndInfo->SysWarningInfo.PageIndex);
+    //PRINTF_FUNC("WarningCount = %d \n", ShmSysConfigAndInfo->SysWarningInfo.WarningCount);
+#if 0
+    for (i = 0; (i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5) < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
+        memset(cmd, 0x00, sizeof(cmd));
+        if ((i) >= 5) {
+            break;
+        }
+
+        //error code
+        string2ByteArray(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], cmd);
+        DisplayValueToLcm(0x0010 + ((i) * 6), cmd, sizeof(cmd));
+        //霅血�璅嗵內
+        memset(cmd, 0x00, sizeof(cmd));
+
+        cmd[0] = 0x00;
+        cmd[1] = 0x01;
+        DisplayValueToLcm(0x0002 + ((i) * 2), cmd, 2);
+    }
+
+    memset(cmd, 0x00, sizeof(cmd));
+    for (; i < 5; i++) {
+        DisplayValueToLcm(0x0010 + ((i) * 6), cmd, sizeof(cmd));
+        DisplayValueToLcm(0x0002 + ((i) * 2), cmd, 2);
+    }
+#else
+    for (i = 0; (i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5) < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
+        memset(cmd, 0x00, sizeof(cmd));
+        if ((i - j) >= 5) {
+            break;
+        }
+        if ((memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "033900", 6) == 0) ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "033901", 6) == 0) ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "033902", 6) == 0) ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043627", 6) == 0) ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043628", 6) == 0) ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043622", 6) == 0)  ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043623", 6) == 0) ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043624", 6) == 0) ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043625", 6) == 0) ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "043626", 6) == 0)  ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "042241", 6) == 0) ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], "042242", 6) == 0)
+           ) {
+            j++;
+            continue;
+        }
+        //error code
+        string2ByteArray(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5][0], cmd);
+        DisplayValueToLcm(0x0010 + ((i - j) * 6), cmd, sizeof(cmd));
+        //霅血�璅嗵內
+        memset(cmd, 0x00, sizeof(cmd));
+
+        cmd[0] = 0x00;
+        cmd[1] = 0x01;
+        DisplayValueToLcm(0x0002 + ((i - j) * 2), cmd, 2);
+    }
+
+    memset(cmd, 0x00, sizeof(cmd));
+    i = i - j;
+    for (; (i) < 5; i++) {
+        DisplayValueToLcm(0x0010 + ((i) * 6), cmd, sizeof(cmd));
+        DisplayValueToLcm(0x0002 + ((i) * 2), cmd, 2);
+    }
+
+#endif
 }
 
 //================================================
@@ -410,34 +394,122 @@ void ChangeWarningFunc()
 //================================================
 void ChangeQrCode_Idle(char *input)
 {
-	int len = strlen(input);
-	byte cmd[len];
-
-	int loop = 0;
-	int i = 0;
+    int len = strlen(input) + 3;
+    int loop = 0;
+    int i = 0, j = 0;
+    uint8_t qrUrl[128] = {0};
+    uint16_t urlLen = 0;
+    uint8_t cmd[len];
+    uint8_t tmpBuf[15] = {0};
+    uint8_t tmpLen = sizeof(tmpBuf) - 1;
+
+    strncpy((char *)cmd, " ", len);
+
+    while (input[loop] != '\0') {
+        cmd[i++] = input[loop++];
+    }
 
-	while(input[loop] != '\0')
-	{
-		cmd[i++] = input[loop++];
-	}
+    j += sprintf((char *)&cmd[i], ":%d", ShmSysConfigAndInfo->SysInfo.CurGunSelected); ////For Audi
+    cmd[len - 1] = '\0';
+    urlLen = sprintf((char *)qrUrl, "%s%s", NOODOE_QR_CODE_URL, cmd);
+    DisplayValueToLcm(__qr_code, qrUrl, urlLen);
+
+    j = 0;
+    j += sprintf((char *)&cmd[i], "0%d", ShmSysConfigAndInfo->SysInfo.CurGunSelected); ////For Audi
+    cmd[len - 1] = '\0';
+
+    strncpy((char *)tmpBuf, (char *)cmd, sizeof(tmpBuf));
+    tmpBuf[tmpLen] = '\0';
+    DisplayValueToLcm(__custStationIdL1, tmpBuf, sizeof(tmpBuf));
+
+    /*if (len > sizeof(tmpBuf)) {
+        strncpy((char *)tmpBuf, (char *)cmd, sizeof(tmpBuf));
+        tmpBuf[tmpLen] = '\0';
+        DisplayValueToLcm(__custStationIdL1, tmpBuf, sizeof(tmpBuf));
+
+        memset(tmpBuf, 0, sizeof(tmpBuf));
+        strncpy((char *)tmpBuf, (char *)&cmd[tmpLen], sizeof(tmpBuf));
+        tmpBuf[tmpLen] = '\0';
+        DisplayValueToLcm(__custStationIdL2, tmpBuf, sizeof(tmpBuf));
+    } else {
+        DisplayValueToLcm(__custStationIdL1, cmd, len);
+
+        strncpy((char *)tmpBuf, " ", sizeof(tmpBuf));
+        tmpBuf[tmpLen] = '\0';
+        DisplayValueToLcm(__custStationIdL2, tmpBuf, sizeof(tmpBuf));
+    }*/
+
+#if 0
+    int len = strlen(input);
+    byte cmd[len];
+
+    int loop = 0;
+    int i = 0;
+
+    while (input[loop] != '\0') {
+        cmd[i++] = input[loop++];
+    }
 
-	DisplayValueToLcm(__qr_code, cmd, len);
+    DisplayValueToLcm(__qr_code, cmd, len);
+#endif //0
 }
 
 void ChangeQrCode_Charge(char *input)
 {
-	int len = strlen(input);
-	byte cmd[len];
+    int len = strlen(input) + 3;
+    int loop = 0;
+    int i = 0, j = 0;
+    uint8_t cmd[len];
+    uint8_t tmpBuf[15] = {0};
+    uint8_t tmpLen = sizeof(tmpBuf) - 1;
 
-	int loop = 0;
-	int i = 0;
+    strncpy((char *)cmd, " ", len);
 
-	while(input[loop] != '\0')
-	{
-		cmd[i++] = input[loop++];
-	}
+    while (input[loop] != '\0') {
+        cmd[i++] = input[loop++];
+    }
 
-	DisplayValueToLcm(__qr_code_pre, cmd, len);
+    j += sprintf((char *)&cmd[i], ":%d", ShmSysConfigAndInfo->SysInfo.CurGunSelected); ////For Audi
+    cmd[len - 1] = '\0';
+    DisplayValueToLcm(__qr_code, cmd, len);
+
+    j = 0;
+    j += sprintf((char *)&cmd[i], "0%d", ShmSysConfigAndInfo->SysInfo.CurGunSelected); ////For Audi
+    cmd[len - 1] = '\0';
+
+    strncpy((char *)tmpBuf, (char *)cmd, sizeof(tmpBuf));
+    tmpBuf[tmpLen] = '\0';
+    DisplayValueToLcm(__custStationIdL1, tmpBuf, sizeof(tmpBuf));
+    /*if (len > sizeof(tmpBuf)) {
+        strncpy((char *)tmpBuf, (char *)cmd, sizeof(tmpBuf));
+        tmpBuf[tmpLen] = '\0';
+        DisplayValueToLcm(__custStationIdL1, tmpBuf, sizeof(tmpBuf));
+
+        memset(tmpBuf, 0, sizeof(tmpBuf));
+        strncpy((char *)tmpBuf, (char *)&cmd[tmpLen], sizeof(tmpBuf));
+        tmpBuf[tmpLen] = '\0';
+        DisplayValueToLcm(__custStationIdL2, tmpBuf, sizeof(tmpBuf));
+    } else {
+        DisplayValueToLcm(__custStationIdL1, cmd, len);
+
+        strncpy((char *)tmpBuf, " ", sizeof(tmpBuf));
+        tmpBuf[tmpLen] = '\0';
+        DisplayValueToLcm(__custStationIdL2, tmpBuf, sizeof(tmpBuf));
+    }*/
+
+#if 0
+    int len = strlen(input);
+    byte cmd[len];
+
+    int loop = 0;
+    int i = 0;
+
+    while (input[loop] != '\0') {
+        cmd[i++] = input[loop++];
+    }
+
+    DisplayValueToLcm(__qr_code_pre, cmd, len);
+#endif //0
 }
 
 //================================================
@@ -445,13 +517,12 @@ void ChangeQrCode_Charge(char *input)
 //================================================
 void ChangeCurPage()
 {
-	//PRINTF_FUNC("cur = %d, new = %d \n", _currentPage, ShmSysConfigAndInfo->SysInfo.PageIndex);
-	if (_currentPage != ShmSysConfigAndInfo->SysInfo.PageIndex)
-	{
-		_currentPage = ShmSysConfigAndInfo->SysInfo.PageIndex;
-		ChangeToOtherPage(_currentPage);
-		_everyPageRollChange = 0;
-	}
+    //PRINTF_FUNC("cur = %d, new = %d \n", _currentPage, ShmSysConfigAndInfo->SysInfo.PageIndex);
+    if (_currentPage != ShmSysConfigAndInfo->SysInfo.PageIndex) {
+        _currentPage = ShmSysConfigAndInfo->SysInfo.PageIndex;
+        ChangeToOtherPage(_currentPage);
+        _everyPageRollChange = 0;
+    }
 }
 
 //================================================
@@ -460,35 +531,33 @@ void ChangeCurPage()
 byte demoCount = 0;
 void DemoFunction()
 {
-	if (demoCount == 0)
-	{
-		ShmSysConfigAndInfo->SysWarningInfo.WarningCount = 6;
-		memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[0][0], "000001", 7);
-		memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[1][0], "000002", 7);
-		memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[2][0], "000003", 7);
-		memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[3][0], "000004", 7);
-		memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[4][0], "000005", 7);
-		memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[5][0], "000006", 7);
-	}
-	else
-	{
-		if (demoCount == 20) {
-			ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_IDLE;
-		} else if (demoCount == 80) {
-			ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_AUTHORIZING;
-		} else if (demoCount == 100) {
-			ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_AUTHORIZ_COMP;
-		} else if (demoCount == 120) {
-			ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_AUTHORIZ_FAIL;
-		} else if (demoCount == 140) {
-			ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_PRE_CHARGE;
-		} else if (demoCount == 180) {
-			ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_CHARGING;
-		}
-	}
-
-	if (demoCount < 180)
-		demoCount++;
+    if (demoCount == 0) {
+        ShmSysConfigAndInfo->SysWarningInfo.WarningCount = 6;
+        memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[0][0], "000001", 7);
+        memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[1][0], "000002", 7);
+        memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[2][0], "000003", 7);
+        memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[3][0], "000004", 7);
+        memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[4][0], "000005", 7);
+        memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[5][0], "000006", 7);
+    } else {
+        if (demoCount == 20) {
+            ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_SELECT_GUN; //_LCM_IDLE; ////For Audi
+        } else if (demoCount == 80) {
+            ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_AUTHORIZING;
+        } else if (demoCount == 100) {
+            ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_AUTHORIZ_COMP;
+        } else if (demoCount == 120) {
+            ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_AUTHORIZ_FAIL;
+        } else if (demoCount == 140) {
+            ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_PRE_CHARGE;
+        } else if (demoCount == 180) {
+            ShmSysConfigAndInfo->SysInfo.PageIndex = _LCM_CHARGING;
+        }
+    }
+
+    if (demoCount < 180) {
+        demoCount++;
+    }
 }
 
 //================================================
@@ -496,909 +565,925 @@ void DemoFunction()
 //================================================
 bool FindChargingInfoData(byte target, struct ChargingInfoData **_chargingData)
 {
-	for (byte index = 0; index < CHAdeMO_QUANTITY; index++)
-	{
-		if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == target)
-		{
-			_chargingData[target] = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index];
-			return true;
-		}
-	}
-
-	for (byte index = 0; index < CCS_QUANTITY; index++)
-	{
-		if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == target)
-		{
-			_chargingData[target] = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[index];
-			return true;
-		}
-	}
-
-	for (byte index = 0; index < GB_QUANTITY; index++)
-	{
-		if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == target)
-		{
-			_chargingData[target] = &ShmSysConfigAndInfo->SysInfo.GbChargingData[index];
-			return true;
-		}
-	}
-
-	return false;
+    for (byte index = 0; index < CHAdeMO_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == target) {
+            _chargingData[target] = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index];
+            return true;
+        }
+    }
+
+    for (byte index = 0; index < CCS_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == target) {
+            _chargingData[target] = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[index];
+            return true;
+        }
+    }
+
+    for (byte index = 0; index < GB_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == target) {
+            _chargingData[target] = &ShmSysConfigAndInfo->SysInfo.GbChargingData[index];
+            return true;
+        }
+    }
+
+    return false;
 }
 
 bool FindAcChargingInfoData(byte target, struct ChargingInfoData **acChargingData)
 {
-	if (target < AC_QUANTITY)
-	{
-		acChargingData[target] = &ShmSysConfigAndInfo->SysInfo.AcChargingData[target];
-		return true;
-	}
+    if (target < AC_QUANTITY) {
+        acChargingData[target] = &ShmSysConfigAndInfo->SysInfo.AcChargingData[target];
+        return true;
+    }
 
-	return false;
+    return false;
+}
+
+/**
+ * [ChangeBalanceValue :print balance information]
+ * @Author
+ * @DateTime 2020-11-26
+ */
+static void ChangeBalanceValue(uint16_t addr, uint8_t index) ////For Audi
+{
+    byte cmd[10] = {0};
+    byte value[10] = {0};
+    uint8_t len = 0;
+    float balance = gAudiCustInfo->PricesInfo[index].Balance;
+
+    if ((balance) == (FAIL_BALANCE_PRICES)) {
+        balance = 0.0;
+    }
+
+    len += sprintf((char *) value, "%.2f", balance);
+    if (len < 6) {
+        sprintf((char *)&value[len], "%s",
+                (byte *)Currency[ShmSysConfigAndInfo->SysConfig.BillingData.Currency]);
+    }
+
+    value[sizeof(value) - 1] = '\0';
+
+    string2ByteArray(value, cmd);
+    DisplayValueToLcm(addr, cmd, sizeof(cmd));
 }
 
 void ChangeAcBattMapAndValue(short page)
 {
-	if (page == _LCM_CHARGING)
-	{
-		if (isDiffStatus != _battery_display_ani)
-		{
-			isChangeBattMap = false;
-			isDiffStatus = _battery_display_ani;
-		}
-
-		if (ac_chargingInfo[0]->IsCharging && !isChangeBattMap)
-		{
-			isChangeBattMap = true;
-			if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV5)
-			{
-				ChangeDisplay2Value(__batt_map, _battery_empty);
-				ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_EMP;
-			}
-			else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_EMP)
-			{
-				ChangeDisplay2Value(__batt_map, _battery_cap_20);
-				ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV1;
-			}
-			else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV1)
-			{
-				ChangeDisplay2Value(__batt_map, _battery_cap_40);
-				ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV2;
-			}
-			else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV2)
-			{
-				ChangeDisplay2Value(__batt_map, _battery_cap_60);
-				ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV3;
-			}
-			else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV3)
-			{
-				ChangeDisplay2Value(__batt_map, _battery_cap_80);
-				ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV4;
-			}
-			else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV4)
-			{
-				ChangeDisplay2Value(__batt_map, _battery_cap_100);
-				ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV5;
-			}
-		}
-	}
-	else if (page == _LCM_COMPLETE)
-	{
-		if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV5)
-			ChangeDisplay2Value(__batt_map, _battery_soc_20);
-		else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_EMP)
-			ChangeDisplay2Value(__batt_map, _battery_soc_20);
-		else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV1)
-			ChangeDisplay2Value(__batt_map, _battery_soc_40);
-		else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV2)
-			ChangeDisplay2Value(__batt_map, _battery_soc_60);
-		else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV3)
-			ChangeDisplay2Value(__batt_map, _battery_soc_80);
-		else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV4)
-			ChangeDisplay2Value(__batt_map, _battery_soc_100);
-	}
-
-	ChangeDisplay2Value(__soc_value_charging, _disappear);
+    if (page == _LCM_CHARGING) {
+        if (isDiffStatus != _battery_display_ani) {
+            isChangeBattMap = false;
+            isDiffStatus = _battery_display_ani;
+        }
+
+        if (ac_chargingInfo[0]->IsCharging && !isChangeBattMap) {
+            isChangeBattMap = true;
+            if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV5) {
+                ChangeDisplay2Value(__batt_map, _battery_empty);
+                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_EMP;
+            } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_EMP) {
+                ChangeDisplay2Value(__batt_map, _battery_cap_20);
+                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV1;
+            } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV1) {
+                ChangeDisplay2Value(__batt_map, _battery_cap_40);
+                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV2;
+            } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV2) {
+                ChangeDisplay2Value(__batt_map, _battery_cap_60);
+                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV3;
+            } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV3) {
+                ChangeDisplay2Value(__batt_map, _battery_cap_80);
+                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV4;
+            } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV4) {
+                ChangeDisplay2Value(__batt_map, _battery_cap_100);
+                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV5;
+            }
+        }
+    } else if (page == _LCM_COMPLETE) {
+        if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV5) {
+            ChangeDisplay2Value(__batt_map, _battery_soc_20);
+        } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_EMP) {
+            ChangeDisplay2Value(__batt_map, _battery_soc_20);
+        } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV1) {
+            ChangeDisplay2Value(__batt_map, _battery_soc_40);
+        } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV2) {
+            ChangeDisplay2Value(__batt_map, _battery_soc_60);
+        } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV3) {
+            ChangeDisplay2Value(__batt_map, _battery_soc_80);
+        } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV4) {
+            ChangeDisplay2Value(__batt_map, _battery_soc_100);
+        }
+    }
+
+    ChangeDisplay2Value(__soc_value_charging, _disappear);
 }
 
 void ChangeBattMapAndValue(short page, int soc)
 {
-//	srand(time(NULL));
-//	int min = 10;
-//	int max = 90;
-//	soc = rand() % (max - min + 1) + min;
-
-	if (page == _LCM_CHARGING)
-	{
-		if (soc < 20)
-		{
-			if (_battery_display_ani)
-				ChangeDisplay2Value(__batt_map, _battery_empty);
-			else
-				ChangeDisplay2Value(__batt_map, _battery_cap_20);
-		}
-		else if (soc >= 20 && soc < 40)
-		{
-			if (_battery_display_ani)
-				ChangeDisplay2Value(__batt_map, _battery_cap_20);
-			else
-				ChangeDisplay2Value(__batt_map, _battery_cap_40);
-		}
-		else if (soc >= 40 && soc < 60)
-		{
-			if (_battery_display_ani)
-				ChangeDisplay2Value(__batt_map, _battery_cap_40);
-			else
-				ChangeDisplay2Value(__batt_map, _battery_cap_60);
-		}
-		else if (soc >= 60 && soc < 80)
-		{
-			if (_battery_display_ani)
-				ChangeDisplay2Value(__batt_map, _battery_cap_60);
-			else
-				ChangeDisplay2Value(__batt_map, _battery_cap_80);
-		}
-		else if (soc >= 80 && soc <= 100)
-			ChangeDisplay2Value(__batt_map, _battery_cap_100);
-	}
-	else if (page == _LCM_COMPLETE)
-	{
-		if (soc < 20)
-			ChangeDisplay2Value(__batt_map, _battery_soc_20);
-		else if (soc >= 20 && soc < 40)
-			ChangeDisplay2Value(__batt_map, _battery_soc_40);
-		else if (soc >= 40 && soc < 60)
-			ChangeDisplay2Value(__batt_map, _battery_soc_60);
-		else if (soc >= 60 && soc < 80)
-			ChangeDisplay2Value(__batt_map, _battery_soc_80);
-		else if (soc >= 80 && soc <= 100)
-			ChangeDisplay2Value(__batt_map, _battery_soc_100);
-	}
-
-	byte cmd[5];
-	byte value[5];
-
-	memset(cmd, 0x00, sizeof(cmd));
-	memset(value, 0x00, sizeof(value));
-	sprintf((char *)value, "%d%%", soc);
-	string2ByteArray(value, cmd);
-	DisplayValueToLcm(__soc_value_charging, cmd, sizeof(cmd));
+//  srand(time(NULL));
+//  int min = 10;
+//  int max = 90;
+//  soc = rand() % (max - min + 1) + min;
+
+    if (page == _LCM_PRE_CHARGE) {
+        ChangeDisplay2Value(__batt_map_empty, _battery_empty);
+    } else if (page == _LCM_CHARGING) {
+        if (soc < 20) {
+            if (_battery_display_ani) {
+                ChangeDisplay2Value(__batt_map, _battery_empty);
+            } else {
+                ChangeDisplay2Value(__batt_map, _battery_cap_20);
+            }
+        } else if (soc >= 20 && soc < 40) {
+            if (_battery_display_ani) {
+                ChangeDisplay2Value(__batt_map, _battery_cap_20);
+            } else {
+                ChangeDisplay2Value(__batt_map, _battery_cap_40);
+            }
+        } else if (soc >= 40 && soc < 60) {
+            if (_battery_display_ani) {
+                ChangeDisplay2Value(__batt_map, _battery_cap_40);
+            } else {
+                ChangeDisplay2Value(__batt_map, _battery_cap_60);
+            }
+        } else if (soc >= 60 && soc < 80) {
+            if (_battery_display_ani) {
+                ChangeDisplay2Value(__batt_map, _battery_cap_60);
+            } else {
+                ChangeDisplay2Value(__batt_map, _battery_cap_80);
+            }
+        } else if (soc >= 80 && soc <= 100) {
+            ChangeDisplay2Value(__batt_map, _battery_cap_100);
+        }
+    } else if (page == _LCM_COMPLETE) {
+        if (soc < 20) {
+            ChangeDisplay2Value(__batt_map, _battery_soc_20);
+        } else if (soc >= 20 && soc < 40) {
+            ChangeDisplay2Value(__batt_map, _battery_soc_40);
+        } else if (soc >= 40 && soc < 60) {
+            ChangeDisplay2Value(__batt_map, _battery_soc_60);
+        } else if (soc >= 60 && soc < 80) {
+            ChangeDisplay2Value(__batt_map, _battery_soc_80);
+        } else if (soc >= 80 && soc <= 100) {
+            ChangeDisplay2Value(__batt_map, _battery_soc_100);
+        }
+    }
+
+    byte cmd[5];
+    byte value[5];
+
+    memset(cmd, 0x00, sizeof(cmd));
+    memset(value, 0x00, sizeof(value));
+    sprintf((char *)value, "%d%%", soc);
+    string2ByteArray(value, cmd);
+    DisplayValueToLcm(__soc_value_charging, cmd, sizeof(cmd));
 }
 
 void ChangeRemainTime(int sec)
 {
-	int h, m, s;
-	byte cmd[10];
-	byte value[10];
-
-	memset(cmd, 0x00, sizeof(cmd));
-
-//	srand(time(NULL));
-//	int min = 0;
-//	int max = 65536;
-//	sec = rand() % (max - min + 1) + min;
-
-	h = (sec / 3600);
-	m = (sec - (3600 * h)) / 60;
-	s = (sec - (3600 * h) - (m * 60));
-	sprintf((char *)value, "%02d:%02d:%02d", h, m, s);
-	string2ByteArray(value, cmd);
-	DisplayValueToLcm(__remain_time_tx, cmd, sizeof(cmd));
+    int h, m, s;
+    byte cmd[10];
+    byte value[10];
+
+    memset(cmd, 0x00, sizeof(cmd));
+
+//  srand(time(NULL));
+//  int min = 0;
+//  int max = 65536;
+//  sec = rand() % (max - min + 1) + min;
+
+    h = (sec / 3600);
+    m = (sec - (3600 * h)) / 60;
+    s = (sec - (3600 * h) - (m * 60));
+    sprintf((char *)value, "%02d:%02d:%02d", h, m, s);
+    string2ByteArray(value, cmd);
+    DisplayValueToLcm(__remain_time_tx, cmd, sizeof(cmd));
 }
 
 void ChangeChargingEnergyValue(float energy)
 {
-	byte cmd[10];
-	byte value[10];
-
-	memset(cmd, 0x00, sizeof(cmd));
-	if (energy >= 0.05)
-		energy -= 0.05;
-	sprintf((char *) value, "%.1f kWh", energy);
-	string2ByteArray(value, cmd);
-	DisplayValueToLcm(__total_out_eng_tx, cmd, sizeof(cmd));
+    byte cmd[10];
+    byte value[10];
+
+    memset(cmd, 0x00, sizeof(cmd));
+    if (energy >= 0.05) {
+        energy -= 0.05;
+    }
+    sprintf((char *) value, "%.1f kWh", energy);
+    string2ByteArray(value, cmd);
+    DisplayValueToLcm(__total_out_eng_tx, cmd, sizeof(cmd));
 }
 
 void ChangeChargingPowerValue(float pow)
 {
-	byte cmd[10];
-	byte value[10];
+    byte cmd[10];
+    byte value[10];
 
-	memset(cmd, 0x00, sizeof(cmd));
+    memset(cmd, 0x00, sizeof(cmd));
 
-//	float min = 0.0;
-//	float max = 50;
-//	pow = (max - min) * rand() / (RAND_MAX + 1.0) + min;
-	sprintf((char *) value, "%.1f kW", pow);
-	string2ByteArray(value, cmd);
-	DisplayValueToLcm(__output_eng_tx, cmd, sizeof(cmd));
+//  float min = 0.0;
+//  float max = 50;
+//  pow = (max - min) * rand() / (RAND_MAX + 1.0) + min;
+    sprintf((char *) value, "%.1f kW", pow);
+    string2ByteArray(value, cmd);
+    DisplayValueToLcm(__output_eng_tx, cmd, sizeof(cmd));
 }
 
 void ChangeChargingFeeValue(float fee)
 {
-	byte cmd[10];
-	byte value[10];
+    byte cmd[10];
+    byte value[10];
 
-	memset(cmd, 0x00, sizeof(cmd));
+    memset(cmd, 0x00, sizeof(cmd));
 
-	sprintf((char *) value, "%.2f", fee);
-	string2ByteArray(value, cmd);
-	DisplayValueToLcm(__charging_fee_tx, cmd, sizeof(cmd));
+    sprintf((char *) value, "%.2f", fee);
+    string2ByteArray(value, cmd);
+    DisplayValueToLcm(__charging_fee_tx, cmd, sizeof(cmd));
 }
 
 void DisplayMoneyRate(float money)
 {
-	byte cmd[8];
-	byte value[8];
+    byte cmd[8];
+    byte value[8];
 
-	memset(cmd, 0x00, sizeof(cmd));
+    memset(cmd, 0x00, sizeof(cmd));
 
-	sprintf((char *) value, "%.2f", money);
-	string2ByteArray(value, cmd);
-	DisplayValueToLcm(__money_by_rate, cmd, sizeof(cmd));
+    sprintf((char *) value, "%.2f", money);
+    string2ByteArray(value, cmd);
+    DisplayValueToLcm(__money_by_rate, cmd, sizeof(cmd));
 }
 
 void DisplayMoneyCur(byte *cur)
 {
-	byte cmd[5];
-	byte buf[5];
-
-	*(cur + 3) = '\0';
-	memset(cmd, 0x00, sizeof(cmd));
-	sprintf((char *) buf, "%s", cur);
-	string2ByteArray(buf, cmd);
-	DisplayValueToLcm(__money_rate, cmd, sizeof(cmd));
+    byte cmd[10] = {0};
+    byte buf[10] = {0};
+    uint8_t len = 0;
+
+    *(cur + 3) = '\0';
+    memset(cmd, 0x00, sizeof(cmd));
+    len = sprintf((char *) buf, "%s/KWh", cur);
+    buf[len] = '\0';
+    string2ByteArray(buf, cmd);
+    DisplayValueToLcm(__money_rate, cmd, sizeof(cmd));
 }
 
 void RefreshPageAnimation(byte value)
 {
-	switch(_currentPage)
-	{
-		case _LCM_IDLE:
-		{
-
-		}
-			break;
-		case _LCM_WAIT_FOR_PLUG:
-		{
-			if(_everyPageRollChange == 0)
-				ChangeDisplay2Value(__plug_in_arrow, _arrow_dark);
-			else if(_everyPageRollChange == 15)
-				ChangeDisplay2Value(__plug_in_arrow, _arrow_light);
-
-			_everyPageRollChange > 30 ? _everyPageRollChange = 0 : _everyPageRollChange++;
-		}
-			break;
-		case _LCM_PRE_CHARGE:
-		case _LCM_CHARGING:
-		case _LCM_COMPLETE:
-		{
-			if (_currentPage == _LCM_PRE_CHARGE)
-			{
-				if (_everyPageRollChange == 0 || _everyPageRollChange == 22)
-					ChangeDisplay2Value(__conn_line, _conn_map1);
-				else if (_everyPageRollChange == 11 || _everyPageRollChange == 33)
-					ChangeDisplay2Value(__conn_line, _conn_map2);
-			}
-			else if (_currentPage == _LCM_CHARGING)
-			{
-				if (_everyPageRollChange == 0 || _everyPageRollChange == 22)
-					ChangeDisplay2Value(__conn_line_chag, _charging_map1);
-				else if (_everyPageRollChange == 11 || _everyPageRollChange == 33)
-					ChangeDisplay2Value(__conn_line_chag, _charging_map2);
-			}
-			else if (_currentPage == _LCM_COMPLETE)
-			{
-				if (_everyPageRollChange == 0)
-					ChangeDisplay2Value(__conn_line_comp, _complete_map);
-			}
-
-			_everyPageRollChange >= 45 ? _everyPageRollChange = 0 : _everyPageRollChange++;
-		}
-			break;
-	}
+    switch (_currentPage) {
+    case _LCM_IDLE: {
+
+    }
+    break;
+    case _LCM_WAIT_FOR_PLUG: {
+        if (_everyPageRollChange == 0) {
+            ChangeDisplay2Value(__plug_in_arrow, _arrow_dark);
+        } else if (_everyPageRollChange == 15) {
+            ChangeDisplay2Value(__plug_in_arrow, _arrow_light);
+        }
+
+        _everyPageRollChange > 30 ? _everyPageRollChange = 0 : _everyPageRollChange++;
+    }
+    break;
+    case _LCM_PRE_CHARGE:
+    case _LCM_CHARGING:
+    case _LCM_COMPLETE: {
+        if (_currentPage == _LCM_PRE_CHARGE) {
+            if (_everyPageRollChange == 0 || _everyPageRollChange == 22) {
+                ChangeDisplay2Value(__conn_line, _conn_map1);
+            } else if (_everyPageRollChange == 11 || _everyPageRollChange == 33) {
+                ChangeDisplay2Value(__conn_line, _conn_map2);
+            }
+        } else if (_currentPage == _LCM_CHARGING) {
+            if (_everyPageRollChange == 0 || _everyPageRollChange == 22) {
+                ChangeDisplay2Value(__conn_line_chag, _charging_map1);
+            } else if (_everyPageRollChange == 11 || _everyPageRollChange == 33) {
+                ChangeDisplay2Value(__conn_line_chag, _charging_map2);
+            }
+        } else if (_currentPage == _LCM_COMPLETE) {
+            if (_everyPageRollChange == 0) {
+                ChangeDisplay2Value(__conn_line_comp, _complete_map);
+            }
+        }
+
+        _everyPageRollChange >= 45 ? _everyPageRollChange = 0 : _everyPageRollChange++;
+    }
+    break;
+    }
 }
 
 void RefreshConnStatus()
 {
-	// Wifi priority is higher than Ethernet
-	#ifdef DD360
-	unsigned char flag[4];
-	
-
-	memset(flag,0,sizeof(flag));
-	for(unsigned char i = 0; i < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++)
-	{
-		if(memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "012304", 6) == 0)
-		{	
-			flag[0]=1;
-			continue;
-		}
-		if(memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "043625", 6) == 0)//disconnected from AP through WiFi	
-		{	
-			flag[1]=1;
-			continue;
-		}	
-		if(memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "043627", 6) == 0)//wifi disabled
-		{	
-			flag[1]=2;
-			continue;
-		}	
-		if((memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "033900", 6) == 0) ||
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "033901", 6) == 0) ||
-		   (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "033902", 6) == 0))
-		{	
-			flag[2]=1;
-			continue;
-		}	
-		if(memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "043626", 6) == 0)//disconnected from APN through 3G/4G	
-		{	
-			flag[3]=1;
-			continue;
-		}	
-		if(memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "043628", 6) == 0)//4g disabled
-		{	
-			flag[3]=2;
-			continue;
-		}	
-	}
-	if(flag[0]==1)
-		ChangeDisplay2Value(__ethernet_status, _eth_disconnect);
-	else
-		ChangeDisplay2Value(__ethernet_status, _eth_connect);		
-	if(flag[1]==1)
-		ChangeDisplay2Value(__wifi_status, _wifi_disconnect);
-	else if(flag[1]==2)
-		ChangeDisplay2Value(__wifi_status, _disappear);
-	else	
-		ChangeDisplay2Value(__wifi_status, _wifi_connect);	
-	if(flag[2]==1)
-		ChangeDisplay2Value(__conn_status, _disconnect);
-	else
-		ChangeDisplay2Value(__conn_status, _connect);
-	if(flag[3]==1)
-		 ChangeDisplay2Value(__3G4G_status, _3G4G_disconnect);
-	else if(flag[3]==2)
-		ChangeDisplay2Value(__3G4G_status, _disappear);	 
-	else
-		 ChangeDisplay2Value(__3G4G_status, __3G4G_connect);
-		
-	#else
-	if (ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn == YES ||
-			ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == _SYS_WIFI_MODE_AP)
-	{
-		_wifi_conn_status = true;
-		ChangeDisplay2Value(__wifi_status, _wifi_connect);
-		ChangeDisplay2Value(__ethernet_status, _disappear);
-	}
-	else
-	{
-		_wifi_conn_status = false;
-		ChangeDisplay2Value(__wifi_status, _disappear);
-	}
-
-	if (!_wifi_conn_status)
-	{
-		if (ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn == YES ||
-				ShmSysConfigAndInfo->SysInfo.InternetConn == YES)
-		{
-			ChangeDisplay2Value(__ethernet_status, _ethernet_connect);
-		}
-		else
-		{
-			ChangeDisplay2Value(__ethernet_status, _ethernet_disconnect);
-		}
-	}
-
-	// 連線到後台
-	if (ShmSysConfigAndInfo->SysInfo.OcppConnStatus == YES)
-		ChangeDisplay2Value(__conn_status, _connect);
-	else
-		ChangeDisplay2Value(__conn_status, _disconnect);
-	#endif	
+    // Wifi priority is higher than Ethernet
+#if defined DD360 || defined DD360Audi
+    uint8_t i = 0;
+    unsigned char flag[4] = {0};
+
+    for (i = 0; i < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
+        //printf("status code = %s\r\n", &ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0]);
+        if (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "012304", 6) == 0) {
+            flag[0] = 1;
+            continue;
+        }
+
+        if (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "043625", 6) == 0) {
+            //disconnected from AP through WiFi
+            flag[1] = 1;
+            continue;
+        }
+
+        if (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "043627", 6) == 0) { //wifi disabled
+            flag[1] = 2;
+            continue;
+        }
+
+        if ((memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "033900", 6) == 0) ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "033901", 6) == 0) ||
+                (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "033902", 6) == 0)) {
+            flag[2] = 1;
+            continue;
+        }
+
+        if (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "043626", 6) == 0) {
+            //disconnected from APN through 3G/4G
+            flag[3] = 1;
+            continue;
+        }
+
+        if (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "043628", 6) == 0) { //4g disabled
+            flag[3] = 2;
+            continue;
+        }
+    }
+
+    if (flag[0] == 1) {
+        ChangeDisplay2Value(__ethernet_status, _eth_disconnect);
+    } else {
+        ChangeDisplay2Value(__ethernet_status, _eth_connect);
+    }
+
+    //ChangeDisplay2Value(__wifi_status, _disappear);
+    //ChangeDisplay2Value(__conn_status, _disappear);
+    //ChangeDisplay2Value(__3G4G_status, _disappear);
+
+    if (flag[1] == 1) {
+        ChangeDisplay2Value(__3G4G_move_status, _disappear);
+        ChangeDisplay2Value(__wifi_status, _wifi_disconnect);
+    } else if (flag[1] == 2) {
+        ChangeDisplay2Value(__wifi_status, _disappear);
+    } else {
+        ChangeDisplay2Value(__3G4G_move_status, _disappear);
+        ChangeDisplay2Value(__wifi_status, _wifi_connect);
+    }
+
+    if (flag[2] == 1) {
+        ChangeDisplay2Value(__conn_status, _disconnect);
+    } else {
+        ChangeDisplay2Value(__conn_status, _connect);
+    }
+
+    if (flag[1] == 2) {
+        ChangeDisplay2Value(__3G4G_status, _disappear);
+        if (flag[3] == 1) {
+            ChangeDisplay2Value(__3G4G_move_status, _3G4G_disconnect);
+        } else if (flag[3] == 2) {
+            ChangeDisplay2Value(__3G4G_move_status, _disappear);
+        } else {
+            ChangeDisplay2Value(__3G4G_move_status, __3G4G_connect);
+        }
+    } else {
+        if (flag[3] == 1) {
+            ChangeDisplay2Value(__3G4G_status, _3G4G_disconnect);
+        } else if (flag[3] == 2) {
+            ChangeDisplay2Value(__3G4G_status, _disappear);
+        } else {
+            ChangeDisplay2Value(__3G4G_status, __3G4G_connect);
+        }
+    }
+#else
+    if (ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn == YES ||
+            ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == _SYS_WIFI_MODE_AP) {
+        _wifi_conn_status = true;
+        ChangeDisplay2Value(__wifi_status, _wifi_connect);
+        ChangeDisplay2Value(__ethernet_status, _disappear);
+    } else {
+        _wifi_conn_status = false;
+        ChangeDisplay2Value(__wifi_status, _disappear);
+    }
+
+    if (!_wifi_conn_status) {
+        if (ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn == YES ||
+                ShmSysConfigAndInfo->SysInfo.InternetConn == YES) {
+            ChangeDisplay2Value(__ethernet_status, _ethernet_connect);
+        } else {
+            ChangeDisplay2Value(__ethernet_status, _ethernet_disconnect);
+        }
+    }
+
+    // ����啣���
+    if (ShmSysConfigAndInfo->SysInfo.OcppConnStatus == YES) {
+        ChangeDisplay2Value(__conn_status, _connect);
+    } else {
+        ChangeDisplay2Value(__conn_status, _disconnect);
+    }
+#endif //defined DD360 || defined DD360Audi
 }
 
 byte FirstPageChanged()
 {
-	byte result = NO;
+    byte result = NO;
 
-	if (_currentPage != _oldPage)
-	{
-		result = YES;
-		_oldPage = _currentPage;
-	}
+    if (_currentPage != _oldPage) {
+        result = YES;
+        _oldPage = _currentPage;
+    }
 
-	return result;
+    return result;
 }
 
 bool IsPageReloadChk()
 {
-	bool result = false;
-
-	if (ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc == NO_DEFINE)
-	{
-		if (_curPage_index != ShmSysConfigAndInfo->SysInfo.CurGunSelected)
-		{
-			_curPage_index = ShmSysConfigAndInfo->SysInfo.CurGunSelected;
-			result = true;
-		}
-	}
-	else
-	{
-		if (_curPage_index != ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc)
-		{
-			_curPage_index = ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc;
-			result = true;
-		}
-	}
-
-	return result;
+    bool result = false;
+
+    if (ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc == NO_DEFINE) {
+        if (_curPage_index != ShmSysConfigAndInfo->SysInfo.CurGunSelected) {
+            _curPage_index = ShmSysConfigAndInfo->SysInfo.CurGunSelected;
+            result = true;
+        }
+    } else {
+        if (_curPage_index != ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc) {
+            _curPage_index = ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc;
+            result = true;
+        }
+    }
+
+    return result;
 }
 
 void ProcessPageInfo()
 {
-	_page_reload = IsPageReloadChk();
-
-	switch(_currentPage)
-	{
-		case _LCM_IDLE:
-		{
-			if (ShmSysConfigAndInfo->SysConfig.isRFID)
-				ChangeDisplay2Value(__main_rfid, _main_rfid);
-			else
-				ChangeDisplay2Value(__main_rfid, _main_none_rfid);
-
-			if (ShmSysConfigAndInfo->SysConfig.isQRCode)
-				ChangeDisplay2Value(__main_qr, _main_qr);
-			else
-			{
-				ChangeDisplay2Value(__qr_code, _disappear);
-				ChangeDisplay2Value(__main_qr, _main_none_qr);
-				needReloadQr = true;
-			}
-
-			if (ShmSysConfigAndInfo->SysConfig.isAPP)
-				ChangeDisplay2Value(__main_app, _main_app);
-			else
-				ChangeDisplay2Value(__main_app, _main_none_app);
-
-			if (FirstPageChanged() == YES || needReloadQr || _page_reload)
-			{
-				if (ShmSysConfigAndInfo->SysConfig.isQRCode)
-				{
-					needReloadQr = false;
-					ChangeQrCode_Idle((char *)ShmSysConfigAndInfo->SysConfig.SystemId);
-				}
-			}
-		}
-			break;
-		case _LCM_AUTHORIZING:
-		case _LCM_AUTHORIZ_COMP:
-		case _LCM_AUTHORIZ_FAIL:
-		case _LCM_WAIT_FOR_PLUG:
-		{
-			FirstPageChanged();
-		}
-			break;
-		case _LCM_PRE_CHARGE:
-		case _LCM_CHARGING:
-		case _LCM_COMPLETE:
-		{
-			if (_totalCount + acgunCount >= 2)
-			{
-				if (ShmSysConfigAndInfo->SysConfig.isRFID)
-					ChangeDisplay2Value(__side_top, _side_rfid);
-				else
-					ChangeDisplay2Value(__side_top, _side_none_rfid);
-
-				if (ShmSysConfigAndInfo->SysConfig.isQRCode)
-					ChangeDisplay2Value(__side_mid, _side_qr);
-				else
-				{
-					ChangeDisplay2Value(__qr_code_pre, _disappear);
-					ChangeDisplay2Value(__side_mid, _side_none_qr);
-					needReloadQr = true;
-				}
-
-				if (ShmSysConfigAndInfo->SysConfig.isAPP)
-					ChangeDisplay2Value(__side_down, _side_app);
-				else
-					ChangeDisplay2Value(__side_down, _side_none_app);
-			}
-			else
-			{
-				ChangeDisplay2Value(__side_top, _disappear);
-				ChangeDisplay2Value(__side_mid, _disappear);
-				ChangeDisplay2Value(__side_down, _disappear);
-			}
-
-			bool isShowAc = false;
-			if (acgunCount > 0)
-			{
-				if (ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc != NO_DEFINE)
-				{
-					isShowAc = true;
-					ChangeDisplay2Value(__gun_type_index + (2 * 2), _actype_light);
-
-					if (_currentPage == _LCM_CHARGING)
-					{
-						ChangeAcBattMapAndValue(_LCM_CHARGING);
-						if (ac_chargingInfo[0]->PresentChargedDuration >= 0 &&
-								ac_chargingInfo[0]->PresentChargedDuration <= TIME_MAX_SEC)
-							ChangeRemainTime(ac_chargingInfo[0]->PresentChargedDuration);
-						else
-							ChangeRemainTime(0);
-
-						if (ac_chargingInfo[0]->PresentChargingPower >= 0.1 &&
-								ac_chargingInfo[0]->PresentChargingPower <= POWER_MAX_KW)
-							ChangeChargingPowerValue(ac_chargingInfo[0]->PresentChargingPower);
-						else
-							ChangeChargingPowerValue(0);
-
-						if (ac_chargingInfo[0]->PresentChargedEnergy >= 0.1 &&
-								ac_chargingInfo[0]->PresentChargedEnergy <= ENERGY_MAX_KWH)
-							ChangeChargingEnergyValue(ac_chargingInfo[0]->PresentChargedEnergy);
-						else
-							ChangeChargingEnergyValue(0);
-
-						if (strcmp((char *)ac_chargingInfo[0]->StartUserId, "") == 0)
-							ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn);
-						else
-							ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn_scan);
-					}
-					else if (_currentPage == _LCM_COMPLETE)
-					{
-						ChangeAcBattMapAndValue(_LCM_COMPLETE);
-						if (ac_chargingInfo[0]->PresentChargedDuration >= 0 &&
-								ac_chargingInfo[0]->PresentChargedDuration <= TIME_MAX_SEC)
-							ChangeRemainTime(ac_chargingInfo[0]->PresentChargedDuration);
-						else
-							ChangeRemainTime(0);
-
-						if (ac_chargingInfo[0]->PresentChargingPower >= 0.1 &&
-								ac_chargingInfo[0]->PresentChargingPower <= POWER_MAX_KW)
-							ChangeChargingPowerValue(ac_chargingInfo[0]->PresentChargingPower);
-						else
-							ChangeChargingPowerValue(0);
-
-						if (ac_chargingInfo[0]->PresentChargedEnergy >= 0.1&&
-								ac_chargingInfo[0]->PresentChargedEnergy <= ENERGY_MAX_KWH)
-						{
-							ChangeChargingEnergyValue(ac_chargingInfo[0]->PresentChargedEnergy);
-
-							if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling &&
-									ac_chargingInfo[0]->ChargingFee >= 0)
-							{
-								ChangeChargingFeeValue(ac_chargingInfo[0]->ChargingFee);
-							}
-						}
-						else
-						{
-							ChangeChargingEnergyValue(0);
-							if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling)
-								ChangeChargingFeeValue(0);
-						}
-
-						if(!ShmSysConfigAndInfo->SysConfig.BillingData.isBilling)
-						{
-							ChangeDisplay2Value(__charging_fee_map, _disappear);
-							ChangeDisplay2Value(__charging_fee_tx, _disappear);
-						}
-						else
-						{
-							ChangeDisplay2Value(__charging_fee_map, _money_map);
-						}
-					}
-				}
-				else
-					ChangeDisplay2Value(__gun_type_index + (2 * 2), _actype_dark);
-			}
-			else
-				ChangeDisplay2Value(__gun_type_index + (2 * 2), _disappear);
-
-			for(byte i = 0; i < _totalCount; i++)
-			{
-				switch(_chargingInfoData[i]->Type)
-				{
-					case _Type_Chademo:
-					{
-						if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i && !isShowAc)
-						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _chademo_light);
-						}
-						else
-						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _chademo_dark);
-						}
-					}
-						break;
-					case _Type_GB:
-					{
-						if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i && !isShowAc)
-						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _gbt_light);
-						}
-						else
-						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _gbt_dark);
-						}
-					}
-						break;
-					case _Type_CCS_2:
-					{
-						if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i && !isShowAc)
-						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _ccs_light);
-						}
-						else
-						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _ccs_dark);
-						}
-					}
-						break;
-				}
-
-				if (_currentPage == _LCM_CHARGING && !isShowAc)
-				{
-					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i)
-					{
-						ChangeBattMapAndValue(_LCM_CHARGING, _chargingInfoData[i]->EvBatterySoc);
-						if (_chargingInfoData[i]->PresentChargedDuration >= 0 &&
-								_chargingInfoData[i]->PresentChargedDuration <= TIME_MAX_SEC)
-							ChangeRemainTime(_chargingInfoData[i]->PresentChargedDuration);
-						else
-							ChangeRemainTime(0);
-
-						if (_chargingInfoData[i]->PresentChargingPower >= 0 &&
-								_chargingInfoData[i]->PresentChargingPower <= POWER_MAX_KW)
-							ChangeChargingPowerValue(_chargingInfoData[i]->PresentChargingPower);
-						else
-							ChangeChargingPowerValue(0);
-
-						if (_chargingInfoData[i]->PresentChargedEnergy >= 0.1 &&
-								_chargingInfoData[i]->PresentChargedEnergy <= ENERGY_MAX_KWH)
-							ChangeChargingEnergyValue(_chargingInfoData[i]->PresentChargedEnergy);
-						else
-							ChangeChargingEnergyValue(0);
-
-						if (strcmp((char *)_chargingInfoData[i]->StartUserId, "") == 0)
-							ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn);
-						else
-							ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn_scan);
-					}
-				}
-				else if (_currentPage == _LCM_COMPLETE && !isShowAc)
-				{
-					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i)
-					{
-						ChangeBattMapAndValue(_LCM_COMPLETE, _chargingInfoData[i]->EvBatterySoc);
-						if (_chargingInfoData[i]->PresentChargedDuration >= 0 &&
-								_chargingInfoData[i]->PresentChargedDuration <= TIME_MAX_SEC)
-							ChangeRemainTime(_chargingInfoData[i]->PresentChargedDuration);
-						else
-							ChangeRemainTime(0);
-
-						if (_chargingInfoData[i]->PresentChargingPower >= 0 &&
-								_chargingInfoData[i]->PresentChargingPower <= POWER_MAX_KW)
-							ChangeChargingPowerValue(_chargingInfoData[i]->PresentChargingPower);
-						else
-							ChangeChargingPowerValue(0);
-
-						if (_chargingInfoData[i]->PresentChargedEnergy >= 0.1 &&
-								_chargingInfoData[i]->PresentChargedEnergy <= ENERGY_MAX_KWH)
-						{
-							ChangeChargingEnergyValue(_chargingInfoData[i]->PresentChargedEnergy);
-
-							if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling &&
-								_chargingInfoData[i]->ChargingFee >= 0)
-							{
-								ChangeChargingFeeValue(_chargingInfoData[i]->ChargingFee);
-							}
-						}
-						else
-						{
-							ChangeChargingEnergyValue(0);
-							if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling)
-								ChangeChargingFeeValue(0);
-						}
-
-						if(!ShmSysConfigAndInfo->SysConfig.BillingData.isBilling)
-						{
-							ChangeDisplay2Value(__charging_fee_map, _disappear);
-							ChangeDisplay2Value(__charging_fee_tx, _disappear);
-						}
-						else
-						{
-							ChangeDisplay2Value(__charging_fee_map, _money_map);
-						}
-					}
-				}
-			}
-
-			// gun btn and QR code
-			if (_totalCount + acgunCount >= 2 && _currentPage)
-			{
-				byte index = 0;
-				for(index = 0; index < _totalCount; index++)
-				{
-					if(ShmSysConfigAndInfo->SysInfo.CurGunSelected != index)
-					{
-						break;
-					}
-				}
-
-				if (_chargingInfoData[index]->SystemStatus == S_IDLE ||
-						_chargingInfoData[index]->SystemStatus == S_RESERVATION ||
-						_chargingInfoData[index]->SystemStatus == S_BOOTING)
-				{
-					if (FirstPageChanged() == YES || needReloadQr || _page_reload)
-					{
-						if (ShmSysConfigAndInfo->SysConfig.isQRCode)
-						{
-							needReloadQr = false;
-							ChangeQrCode_Charge((char *)ShmSysConfigAndInfo->SysConfig.SystemId);
-						}
-					}
-				}
-			}
-		}
-			break;
-	}
+    _page_reload = IsPageReloadChk();
+
+    switch (_currentPage) {
+    case _LCM_SELECT_GUN: ////For Audi
+        if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == 0) {
+            ChangeDisplay2Value(__left_gun_map, _left_gun_enable_map);
+            ChangeDisplay2Value(__right_gun_map, _right_gun_disable_map);
+        } else if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == 1) {
+            ChangeDisplay2Value(__left_gun_map, _left_gun_disable_map);
+            ChangeDisplay2Value(__right_gun_map, _right_gun_enable_map);
+        }
+        ChangeDisplay2Value(__add_chk_btn, _select_gun_btn);
+        break;
+
+    case _LCM_IDLE: {
+        if (ShmSysConfigAndInfo->SysConfig.isRFID) {
+            ChangeDisplay2Value(__main_rfid, _main_rfid);
+        } else {
+            ChangeDisplay2Value(__main_rfid, _main_none_rfid);
+        }
+
+        if (ShmSysConfigAndInfo->SysConfig.isQRCode) {
+            ChangeDisplay2Value(__main_qr, _main_qr);
+        } else {
+            ChangeDisplay2Value(__qr_code, _disappear);
+            ChangeDisplay2Value(__main_qr, _main_none_qr);
+            needReloadQr = true;
+        }
+
+        if (ShmSysConfigAndInfo->SysConfig.isAPP) {
+            ChangeDisplay2Value(__main_app, _main_app);
+        } else {
+            ChangeDisplay2Value(__main_app, _main_none_app);
+        }
+
+        //if (FirstPageChanged() == YES || needReloadQr || _page_reload) {
+        if (ShmSysConfigAndInfo->SysConfig.isQRCode) {
+            needReloadQr = false;
+            ChangeQrCode_Idle((char *)ShmSysConfigAndInfo->SysConfig.SystemId);
+        }
+        //}
+    }
+    break;
+    case _LCM_AUTHORIZING:
+    case _LCM_AUTHORIZ_COMP:
+    case _LCM_AUTHORIZ_FAIL:
+    case _LCM_WAIT_FOR_PLUG: {
+        FirstPageChanged();
+        if (_currentPage == _LCM_AUTHORIZ_COMP) { ////For Audi
+            ChangeBalanceValue(__balance, ShmSysConfigAndInfo->SysInfo.CurGunSelected);
+        }
+    }
+    break;
+    case _LCM_PRE_CHARGE:
+    case _LCM_CHARGING:
+    case _LCM_COMPLETE: {
+#if 0
+        if (_totalCount + acgunCount >= 2) {
+            if (ShmSysConfigAndInfo->SysConfig.isRFID) {
+                ChangeDisplay2Value(__side_top, _side_rfid);
+            } else {
+                ChangeDisplay2Value(__side_top, _side_none_rfid);
+            }
+
+            if (ShmSysConfigAndInfo->SysConfig.isQRCode) {
+                ChangeDisplay2Value(__side_mid, _side_qr);
+            } else {
+                ChangeDisplay2Value(__qr_code_pre, _disappear);
+                ChangeDisplay2Value(__side_mid, _side_none_qr);
+                needReloadQr = true;
+            }
+
+            if (ShmSysConfigAndInfo->SysConfig.isAPP) {
+                ChangeDisplay2Value(__side_down, _side_app);
+            } else {
+                ChangeDisplay2Value(__side_down, _side_none_app);
+            }
+        } else {
+            ChangeDisplay2Value(__side_top, _disappear);
+            ChangeDisplay2Value(__side_mid, _disappear);
+            ChangeDisplay2Value(__side_down, _disappear);
+        }
+#endif //0
+
+        bool isShowAc = false;
+        if (acgunCount > 0) {
+            if (ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc != NO_DEFINE) {
+                isShowAc = true;
+                ChangeDisplay2Value(__gun_type_index + (2 * 2), _actype_light);
+
+                if (_currentPage == _LCM_CHARGING) {
+                    ChangeAcBattMapAndValue(_LCM_CHARGING);
+                    if (ac_chargingInfo[0]->PresentChargedDuration >= 0 &&
+                            ac_chargingInfo[0]->PresentChargedDuration <= TIME_MAX_SEC) {
+                        ChangeRemainTime(ac_chargingInfo[0]->PresentChargedDuration);
+                    } else {
+                        ChangeRemainTime(0);
+                    }
+
+                    if (ac_chargingInfo[0]->PresentChargingPower >= 0.1 &&
+                            ac_chargingInfo[0]->PresentChargingPower <= POWER_MAX_KW) {
+                        ChangeChargingPowerValue(ac_chargingInfo[0]->PresentChargingPower);
+                    } else {
+                        ChangeChargingPowerValue(0);
+                    }
+
+                    if (ac_chargingInfo[0]->PresentChargedEnergy >= 0.1 &&
+                            ac_chargingInfo[0]->PresentChargedEnergy <= ENERGY_MAX_KWH) {
+                        ChangeChargingEnergyValue(ac_chargingInfo[0]->PresentChargedEnergy);
+                    } else {
+                        ChangeChargingEnergyValue(0);
+                    }
+
+                    if (strcmp((char *)ac_chargingInfo[0]->StartUserId, "") == 0) {
+                        ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn);
+                    } else {
+                        ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn_scan);
+                    }
+                } else if (_currentPage == _LCM_COMPLETE) {
+                    ChangeAcBattMapAndValue(_LCM_COMPLETE);
+                    if (ac_chargingInfo[0]->PresentChargedDuration >= 0 &&
+                            ac_chargingInfo[0]->PresentChargedDuration <= TIME_MAX_SEC) {
+                        ChangeRemainTime(ac_chargingInfo[0]->PresentChargedDuration);
+                    } else {
+                        ChangeRemainTime(0);
+                    }
+
+                    if (ac_chargingInfo[0]->PresentChargingPower >= 0.1 &&
+                            ac_chargingInfo[0]->PresentChargingPower <= POWER_MAX_KW) {
+                        ChangeChargingPowerValue(ac_chargingInfo[0]->PresentChargingPower);
+                    } else {
+                        ChangeChargingPowerValue(0);
+                    }
+
+                    if (ac_chargingInfo[0]->PresentChargedEnergy >= 0.1 &&
+                            ac_chargingInfo[0]->PresentChargedEnergy <= ENERGY_MAX_KWH) {
+                        ChangeChargingEnergyValue(ac_chargingInfo[0]->PresentChargedEnergy);
+
+                        if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling &&
+                                ac_chargingInfo[0]->ChargingFee >= 0) {
+                            ChangeChargingFeeValue(ac_chargingInfo[0]->ChargingFee);
+                        }
+                    } else {
+                        ChangeChargingEnergyValue(0);
+                        if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling) {
+                            ChangeChargingFeeValue(0);
+                        }
+                    }
+
+                    if (!ShmSysConfigAndInfo->SysConfig.BillingData.isBilling) {
+                        ChangeDisplay2Value(__charging_fee_map, _disappear);
+                        ChangeDisplay2Value(__charging_fee_tx, _disappear);
+                    } else {
+                        ChangeDisplay2Value(__charging_fee_map, _money_map);
+                    }
+                }
+            } else {
+                ChangeDisplay2Value(__gun_type_index + (2 * 2), _actype_dark);
+            }
+        } else {
+            ChangeDisplay2Value(__gun_type_index + (2 * 2), _disappear);
+        }
+
+        for (byte i = 0; i < _totalCount; i++) {
+            switch (_chargingInfoData[i]->Type) {
+            case _Type_Chademo: {
+                if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i && !isShowAc) {
+                    if (_currentPage == _LCM_COMPLETE) {
+                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _chademo_light_cmp);
+                    } else {
+                        ChangeDisplay2Value(__gun_type_index + (i * 2), _chademo_light);
+                    }
+                } else {
+                    if (_currentPage == _LCM_COMPLETE) {
+                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _chademo_dark_cmp);
+                    } else {
+                        ChangeDisplay2Value(__gun_type_index + (i * 2), _chademo_dark);
+                    }
+                }
+            }
+            break;
+            case _Type_GB: {
+                if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i && !isShowAc) {
+                    if (_currentPage == _LCM_COMPLETE) {
+                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _gbt_light_cmp);
+                    } else {
+                        ChangeDisplay2Value(__gun_type_index + (i * 2), _gbt_light);
+                    }
+                } else {
+                    if (_currentPage == _LCM_COMPLETE) {
+                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _gbt_dark_cmp);
+                    } else {
+                        ChangeDisplay2Value(__gun_type_index + (i * 2), _gbt_dark);
+                    }
+                }
+            }
+            break;
+            case _Type_CCS_2: {
+                if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i && !isShowAc) {
+                    if (_currentPage == _LCM_COMPLETE) {
+                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _ccs_light_cmp);
+                    } else {
+                        ChangeDisplay2Value(__gun_type_index + (i * 2), _ccs_light);
+                    }
+                } else {
+                    if (_currentPage == _LCM_COMPLETE) {
+                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _ccs_dark_cmp);
+                    } else {
+                        ChangeDisplay2Value(__gun_type_index + (i * 2), _ccs_dark);
+                    }
+                }
+            }
+            break;
+            }
+
+            if (_currentPage == _LCM_PRE_CHARGE && !isShowAc) {
+                if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i) {
+                    ChangeBattMapAndValue(_currentPage, _chargingInfoData[i]->EvBatterySoc);
+                }
+            } else if (_currentPage == _LCM_CHARGING && !isShowAc) {
+                if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i) {
+                    ChangeBattMapAndValue(_LCM_CHARGING, _chargingInfoData[i]->EvBatterySoc);
+                    if (_chargingInfoData[i]->PresentChargedDuration >= 0 &&
+                            _chargingInfoData[i]->PresentChargedDuration <= TIME_MAX_SEC) {
+                        ChangeRemainTime(_chargingInfoData[i]->PresentChargedDuration);
+                    } else {
+                        ChangeRemainTime(0);
+                    }
+
+                    if (_chargingInfoData[i]->PresentChargingPower >= 0 &&
+                            _chargingInfoData[i]->PresentChargingPower <= POWER_MAX_KW) {
+                        ChangeChargingPowerValue(_chargingInfoData[i]->PresentChargingPower);
+                    } else {
+                        ChangeChargingPowerValue(0);
+                    }
+
+                    if (_chargingInfoData[i]->PresentChargedEnergy >= 0.1 &&
+                            _chargingInfoData[i]->PresentChargedEnergy <= ENERGY_MAX_KWH) {
+                        ChangeChargingEnergyValue(_chargingInfoData[i]->PresentChargedEnergy);
+                    } else {
+                        ChangeChargingEnergyValue(0);
+                    }
+
+                    if (strcmp((char *)_chargingInfoData[i]->StartUserId, "") == 0) {
+                        ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn);
+                    } else {
+                        ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn_scan);
+                    }
+                }
+            } else if (_currentPage == _LCM_COMPLETE && !isShowAc) {
+                if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i) {
+                    ChangeBattMapAndValue(_LCM_COMPLETE, _chargingInfoData[i]->EvBatterySoc);
+                    if (_chargingInfoData[i]->PresentChargedDuration >= 0 &&
+                            _chargingInfoData[i]->PresentChargedDuration <= TIME_MAX_SEC) {
+                        ChangeRemainTime(_chargingInfoData[i]->PresentChargedDuration);
+                    } else {
+                        ChangeRemainTime(0);
+                    }
+
+                    if (_chargingInfoData[i]->PresentChargingPower >= 0 &&
+                            _chargingInfoData[i]->PresentChargingPower <= POWER_MAX_KW) {
+                        ChangeChargingPowerValue(_chargingInfoData[i]->PresentChargingPower);
+                    } else {
+                        ChangeChargingPowerValue(0);
+                    }
+#if 0
+                    if (_chargingInfoData[i]->PresentChargedEnergy >= 0.1 &&
+                            _chargingInfoData[i]->PresentChargedEnergy <= ENERGY_MAX_KWH) {
+                        ChangeChargingEnergyValue(_chargingInfoData[i]->PresentChargedEnergy);
+
+                        if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling &&
+                                _chargingInfoData[i]->ChargingFee >= 0) {
+                            ChangeChargingFeeValue(_chargingInfoData[i]->ChargingFee);
+                            ChangeBalanceValue(__remain_balance, i);
+                        }
+                    } else {
+                        ChangeChargingEnergyValue(0);
+                        if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling) {
+                            ChangeChargingFeeValue(0);
+                            ChangeBalanceValue(__remain_balance, i);
+                        }
+                    }
+#endif // 0
+                    ChangeChargingEnergyValue(_chargingInfoData[i]->PresentChargedEnergy);
+
+                    if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling &&
+                            _chargingInfoData[i]->ChargingFee >= 0) {
+                        ChangeChargingFeeValue(_chargingInfoData[i]->ChargingFee);
+                        ChangeBalanceValue(__remain_balance, i);
+                    }
+
+                    if (!ShmSysConfigAndInfo->SysConfig.BillingData.isBilling) {
+                        ChangeDisplay2Value(__charging_fee_map, _disappear);
+                        ChangeDisplay2Value(__charging_fee_tx, _disappear);
+                    } else {
+                        ChangeDisplay2Value(__charging_fee_map, _money_map);
+                    }
+                }
+            }
+        }
+
+        // gun btn and QR code
+        if (_totalCount + acgunCount >= 2 && _currentPage) {
+            byte index = 0;
+            for (index = 0; index < _totalCount; index++) {
+                if (ShmSysConfigAndInfo->SysInfo.CurGunSelected != index) {
+                    break;
+                }
+            }
+
+            if (_chargingInfoData[index]->SystemStatus == S_IDLE ||
+                    _chargingInfoData[index]->SystemStatus == S_RESERVATION ||
+                    _chargingInfoData[index]->SystemStatus == S_BOOTING) {
+                if (FirstPageChanged() == YES || needReloadQr || _page_reload) {
+                    if (ShmSysConfigAndInfo->SysConfig.isQRCode) {
+                        needReloadQr = false;
+                        ChangeQrCode_Charge((char *)ShmSysConfigAndInfo->SysConfig.SystemId);
+                    }
+                }
+            }
+        }
+    }
+    break;
+    }
 }
 
 void ChangeDisplayMoneyInfo()
 {
-	if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling)
-	{
-		struct timeb csuTime;
-		struct tm *tmCSU;
-
-		ftime(&csuTime);
-		tmCSU = localtime(&csuTime.time);
-
-		ChangeDisplay2Value(__money_rate_map, _charging_money);
-
-		if (tmCSU->tm_hour <= 23)
-		{
-			ShmSysConfigAndInfo->SysConfig.BillingData.Cur_fee = ShmSysConfigAndInfo->SysConfig.BillingData.Fee[tmCSU->tm_hour];
-			DisplayMoneyRate(ShmSysConfigAndInfo->SysConfig.BillingData.Cur_fee);
-		}
-
-		if (ShmSysConfigAndInfo->SysConfig.BillingData.Currency <= 53)
-			DisplayMoneyCur((byte *)Currency[ShmSysConfigAndInfo->SysConfig.BillingData.Currency]);
-	}
-	else
-	{
-		ChangeDisplay2Value(__money_rate_map, _disappear);
-		ChangeDisplay2Value(__money_by_rate, _disappear);
-		ChangeDisplay2Value(__money_rate, _disappear);
-	}
+    if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling) {
+        struct timeb csuTime;
+        struct tm *tmCSU;
+
+        ftime(&csuTime);
+        tmCSU = localtime(&csuTime.time);
+
+        ChangeDisplay2Value(__money_rate_map, _charging_money);
+
+        if (tmCSU->tm_hour <= 23) {
+            ShmSysConfigAndInfo->SysConfig.BillingData.Cur_fee = ShmSysConfigAndInfo->SysConfig.BillingData.Fee[tmCSU->tm_hour];
+            DisplayMoneyRate(ShmSysConfigAndInfo->SysConfig.BillingData.Cur_fee);
+        }
+
+        if (ShmSysConfigAndInfo->SysConfig.BillingData.Currency <= 53) {
+            DisplayMoneyCur((byte *)Currency[ShmSysConfigAndInfo->SysConfig.BillingData.Currency]);
+        }
+    } else {
+        ChangeDisplay2Value(__money_rate_map, _disappear);
+        ChangeDisplay2Value(__money_by_rate, _disappear);
+        ChangeDisplay2Value(__money_rate, _disappear);
+    }
 }
 
 void Initialization()
 {
-	bool isPass = false;
-	byte count = 5;
-	while(!isPass && count > 0)
-	{
-		isPass = true;
-		for (byte _index = 0; _index < _totalCount; _index++)
-		{
-			if (!FindChargingInfoData(_index, &_chargingInfoData[0]))
-			{
-				DEBUG_ERROR("LcmComm (main) : FindChargingInfoData false \n");
-				isPass = false;
-				count--;
-				break;
-			}
-		}
-
-		sleep(1);
-	}
-
-	isPass = false;
-
-	if (acgunCount > 0)
-	{
-		while(!isPass)
-		{
-			isPass = true;
-			for (byte _index = 0; _index < acgunCount; _index++)
-			{
-				if (!FindAcChargingInfoData(_index, &ac_chargingInfo[0]))
-				{
-					DEBUG_ERROR("LcmComm : FindAcChargingInfoData false \n");
-					isPass = false;
-					break;
-				}
-			}
-
-			sleep(1);
-		}
-	}
-
-	if (count == 0)
-		PRINTF_FUNC("LCM Initialization Gun Fail.............\n");
+    bool isPass = false;
+    byte count = 5;
+    while (!isPass && count > 0) {
+        isPass = true;
+        for (byte _index = 0; _index < _totalCount; _index++) {
+            if (!FindChargingInfoData(_index, &_chargingInfoData[0])) {
+                DEBUG_ERROR("LcmComm (main) : FindChargingInfoData false \n");
+                isPass = false;
+                count--;
+                break;
+            }
+        }
+
+        sleep(1);
+    }
+
+    isPass = false;
+
+    if (acgunCount > 0) {
+        while (!isPass) {
+            isPass = true;
+            for (byte _index = 0; _index < acgunCount; _index++) {
+                if (!FindAcChargingInfoData(_index, &ac_chargingInfo[0])) {
+                    DEBUG_ERROR("LcmComm : FindAcChargingInfoData false \n");
+                    isPass = false;
+                    break;
+                }
+            }
+
+            sleep(1);
+        }
+    }
+
+    if (count == 0) {
+        PRINTF_FUNC("LCM Initialization Gun Fail.............\n");
+    }
 }
 
 int main(void)
 {
-	if(InitShareMemory() == FAIL)
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("InitShareMemory NG\n");
-		#endif
-		if (ShmStatusCodeData != NULL)
-		{
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory =	1;
-		}
-		sleep(5);
-		return 0;
-	}
-
-	_port = CreateCommunicationLcmPort();
-	byte changeWarningPriority = 0;
-	byte curWarningCount = 255;
-	ChangeBackLight(true);
-	_totalCount = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
-	acgunCount = ShmSysConfigAndInfo->SysConfig.AcConnectorCount;
-	Initialization();
-
-	//ChangeToOtherPage(_LCM_COMPLETE);
-	//return 0;
-	for(byte i = 0; i < 3; i++)
-		ChangeDisplay2Value(__gun_type_index + (i * 2), _disappear);
-
-	while(_port != -1)
-	{
-		if (strcmp((char *)ShmSysConfigAndInfo->SysInfo.LcmHwRev, moduleName) != 0x00)
-		{
-			GetCurrentPage();
-			sleep(1);
-		}
-		else
-		{
-			//DemoFunction();
-
-			// Warning 處理
-			if(curWarningCount != ShmSysConfigAndInfo->SysWarningInfo.WarningCount)
-			{
-				changeWarningPriority = 0;
-				ShmSysConfigAndInfo->SysWarningInfo.PageIndex = 0;
-				curWarningCount = ShmSysConfigAndInfo->SysWarningInfo.WarningCount;
-				ChangeWarningFunc();
-			}
-			else if (ShmSysConfigAndInfo->SysWarningInfo.WarningCount > 5 && changeWarningPriority == 0)
-			{
-				// 當有兩頁 Warning 則每隔三秒改變一次
-				if(ShmSysConfigAndInfo->SysWarningInfo.PageIndex == 0)
-					ShmSysConfigAndInfo->SysWarningInfo.PageIndex = 1;
-				else
-					ShmSysConfigAndInfo->SysWarningInfo.PageIndex = 0;
-
-				ChangeWarningFunc();
-			}
-
-			// 頁面資訊處理
-			ProcessPageInfo();
-
-			// 網路 - wifi - 連線訊號處理
-			RefreshConnStatus();
-
-			// 換頁處理
-			ChangeCurPage();
-
-			RefreshPageAnimation(_everyPageRollChange);
-
-			if (changeWarningPriority == 0)
-				ChangeDisplayMoneyInfo();
-
-			changeWarningPriority >= 15 ? (_battery_display_ani = true) : (_battery_display_ani = false);
-			changeWarningPriority >= 30 ? changeWarningPriority = 0 : changeWarningPriority++;
-			usleep(100000);
-		}
-	}
-
-	CloseCommunicationLcmPort();
-	return FAIL;
+    if (InitShareMemory() == FAIL) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("InitShareMemory NG\n");
+#endif
+        if (ShmStatusCodeData != NULL) {
+            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
+        }
+        sleep(5);
+        return 0;
+    }
+
+    _port = CreateCommunicationLcmPort();
+    byte changeWarningPriority = 0;
+    byte curWarningCount = 255;
+    ChangeBackLight(true);
+    _totalCount = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
+    acgunCount = ShmSysConfigAndInfo->SysConfig.AcConnectorCount;
+    Initialization();
+
+    //ChangeToOtherPage(_LCM_COMPLETE);
+    //return 0;
+
+    for (byte i = 0; i < 3; i++) {
+        ChangeDisplay2Value(__gun_type_index + (i * 2), _disappear);
+    }
+
+    while (_port != -1) {
+        if (strcmp((char *)ShmSysConfigAndInfo->SysInfo.LcmHwRev, moduleName) != 0x00) {
+            GetCurrentPage();
+            sleep(1);
+        } else {
+            //DemoFunction();
+
+            // Warning �閧�
+            if (curWarningCount != ShmSysConfigAndInfo->SysWarningInfo.WarningCount) {
+                changeWarningPriority = 0;
+                ShmSysConfigAndInfo->SysWarningInfo.PageIndex = 0;
+                curWarningCount = ShmSysConfigAndInfo->SysWarningInfo.WarningCount;
+                ChangeWarningFunc();
+            } else if (ShmSysConfigAndInfo->SysWarningInfo.WarningCount > 5 && changeWarningPriority == 0) {
+                // �嗆��拚� Warning ����𥪯�蝘埝㺿霈𠹺�甈�
+                if (ShmSysConfigAndInfo->SysWarningInfo.PageIndex == 0) {
+                    ShmSysConfigAndInfo->SysWarningInfo.PageIndex = 1;
+                } else {
+                    ShmSysConfigAndInfo->SysWarningInfo.PageIndex = 0;
+                }
+
+                ChangeWarningFunc();
+            }
+
+            // ��𢒰鞈���閧�
+            ProcessPageInfo();
+
+            // 蝬脰楝 - wifi - ���閮𡃏��閧�
+            RefreshConnStatus();
+
+            // �偦��閧�
+            ChangeCurPage();
+
+            RefreshPageAnimation(_everyPageRollChange);
+
+            //if (changeWarningPriority == 0) { ////For Audi
+            ChangeDisplayMoneyInfo();
+            //}
+
+            changeWarningPriority >= 15 ? (_battery_display_ani = true) : (_battery_display_ani = false);
+            changeWarningPriority >= 30 ? changeWarningPriority = 0 : changeWarningPriority++;
+            usleep(100000);
+        }
+    }
+
+    CloseCommunicationLcmPort();
+    return FAIL;
 }

BIN
EVSE/Projects/DD360Audi/Apps/Module_PrimaryComm


+ 396 - 448
EVSE/Projects/DD360Audi/Apps/Module_PrimaryComm.c

@@ -1,51 +1,51 @@
-#include 	<sys/time.h>
-#include 	<sys/timeb.h>
+#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/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 	<errno.h>
-#include 	<string.h>
-#include	<time.h>
-#include	<ctype.h>
-#include 	<ifaddrs.h>
-#include 	<math.h>
-#include	"../../define.h"
-#include	"PrimaryComm.h"
-#include 	<stdbool.h>
-
-#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
-#define PASS				1
-#define FAIL				-1
-#define YES					1
-#define NO					0
-
-typedef unsigned char 		byte;
-
-struct SysConfigAndInfo			*ShmSysConfigAndInfo;
-struct StatusCodeData 			*ShmStatusCodeData;
-struct PrimaryMcuData			*ShmPrimaryMcuData;
+#include    <sys/types.h>
+#include    <sys/ioctl.h>
+#include    <sys/socket.h>
+#include    <sys/ipc.h>
+#include    <sys/shm.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    <errno.h>
+#include    <string.h>
+#include    <time.h>
+#include    <ctype.h>
+#include    <ifaddrs.h>
+#include    <math.h>
+#include    "../../define.h"
+#include    "PrimaryComm.h"
+#include    <stdbool.h>
+
+#define ARRAY_SIZE(A)       (sizeof(A) / sizeof(A[0]))
+#define PASS                1
+#define FAIL                -1
+#define YES                 1
+#define NO                  0
+
+typedef unsigned char       byte;
+
+struct SysConfigAndInfo         *ShmSysConfigAndInfo;
+struct StatusCodeData           *ShmStatusCodeData;
+struct PrimaryMcuData           *ShmPrimaryMcuData;
 
 void trim(char *s);
-int mystrcmp(char *p1,char *p2);
-void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+int mystrcmp(char *p1, char *p2);
+void substr(char *dest, const char *src, unsigned int start, unsigned int cnt);
 void split(char **arr, char *str, const char *del);
 
 int Uart1Fd;
@@ -56,7 +56,7 @@ Rtc rtc;
 
 struct timeval _flash_time;
 byte flash = NO;
-struct ChargingInfoData *ChargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];	
+struct ChargingInfoData *ChargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 unsigned char ChillerSwitch;
 unsigned int ChillerOnTime;
 
@@ -69,124 +69,123 @@ int StoreLogMsg(const char *fmt, ...);
 
 int StoreLogMsg(const char *fmt, ...)
 {
-	char Buf[4096+256];
-	char buffer[4096];
-	va_list args;
-	struct timeb  SeqEndTime;
-	struct tm *tm;
-
-	va_start(args, fmt);
-	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
-	va_end(args);
-
-	memset(Buf,0,sizeof(Buf));
-	ftime(&SeqEndTime);
-	SeqEndTime.time = time(NULL);
-	tm=localtime(&SeqEndTime.time);
-
-	if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES)
-	{
-		sprintf(Buf,"%02d:%02d:%02d:%03d - %s",
-			tm->tm_hour,tm->tm_min,tm->tm_sec,SeqEndTime.millitm, buffer);
-		printf("%s \n", Buf);
-	}
-	else
-	{
-		sprintf(Buf,"echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,SeqEndTime.millitm,
-			buffer,
-			tm->tm_year+1900,tm->tm_mon+1);
-		system(Buf);
-	}
-
-	return rc;
+    char Buf[4096 + 256];
+    char buffer[4096];
+    va_list args;
+    struct timeb  SeqEndTime;
+    struct tm *tm;
+
+    va_start(args, fmt);
+    int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+    va_end(args);
+
+    memset(Buf, 0, sizeof(Buf));
+    ftime(&SeqEndTime);
+    SeqEndTime.time = time(NULL);
+    tm = localtime(&SeqEndTime.time);
+
+    if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES) {
+        sprintf(Buf, "%02d:%02d:%02d:%03d - %s",
+                tm->tm_hour, tm->tm_min, tm->tm_sec, SeqEndTime.millitm, buffer);
+        printf("%s \n", Buf);
+    } else {
+        sprintf(Buf, "echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+                tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, SeqEndTime.millitm,
+                buffer,
+                tm->tm_year + 1900, tm->tm_mon + 1);
+        system(Buf);
+    }
+
+    return rc;
 }
 
 int DiffTimeb(struct timeb ST, struct timeb ET)
 {
-	//return milli-second
-	unsigned int StartTime,StopTime;
+    //return milli-second
+    unsigned int StartTime, StopTime;
 
-	StartTime=(unsigned int)ST.time;
-	StopTime=(unsigned int)ET.time;
-	return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
+    StartTime = (unsigned int)ST.time;
+    StopTime = (unsigned int)ET.time;
+    return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
 }
 
 void PRINTF_FUNC(char *string, ...)
 {
-	va_list args;
-	char buffer[4096];
-	va_start(args, string);
-	vsnprintf(buffer, sizeof(buffer), string, args);
-	va_end(args);
+    va_list args;
+    char buffer[4096];
+    va_start(args, string);
+    vsnprintf(buffer, sizeof(buffer), string, args);
+    va_end(args);
 
-	DEBUG_INFO("%s \n", buffer);
+    DEBUG_INFO("%s \n", buffer);
 }
 //=================================
 // Common routine
 //=================================
-char* getTimeString(void)
+char *getTimeString(void)
 {
-	char *result=malloc(21);
-	time_t timep;
-	struct tm *p;
-	time(&timep);
-	p=gmtime(&timep);
+    char *result = malloc(21);
+    time_t timep;
+    struct tm *p;
+    time(&timep);
+    p = gmtime(&timep);
 
-	sprintf(result, "[%04d-%02d-%02d %02d:%02d:%02d]", (1900+p->tm_year), (1+p->tm_mon), p->tm_mday, p->tm_hour, p->tm_hour, p->tm_sec);
+    sprintf(result, "[%04d-%02d-%02d %02d:%02d:%02d]", (1900 + p->tm_year), (1 + p->tm_mon), p->tm_mday, p->tm_hour, p->tm_hour, p->tm_sec);
 
-	return result;
+    return result;
 }
 
 void trim(char *s)
 {
-    int i=0, j, k, l=0;
+    int i = 0, j, k, l = 0;
 
-    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+    while ((s[i] == ' ') || (s[i] == '\t') || (s[i] == '\n')) {
         i++;
+    }
 
-    j = strlen(s)-1;
-    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+    j = strlen(s) - 1;
+    while ((s[j] == ' ') || (s[j] == '\t') || (s[j] == '\n')) {
         j--;
+    }
 
-    if(i==0 && j==strlen(s)-1) { }
-    else if(i==0) s[j+1] = '\0';
+    if (i == 0 && j == strlen(s) - 1) { }
+    else if (i == 0) { s[j + 1] = '\0'; }
     else {
-        for(k=i; k<=j; k++) s[l++] = s[k];
+        for (k = i; k <= j; k++) { s[l++] = s[k]; }
         s[l] = '\0';
     }
 }
 
-int mystrcmp(char *p1,char *p2)
+int mystrcmp(char *p1, char *p2)
 {
-    while(*p1==*p2)
-    {
-        if(*p1=='\0' || *p2=='\0')
+    while (*p1 == *p2) {
+        if (*p1 == '\0' || *p2 == '\0') {
             break;
+        }
         p1++;
         p2++;
     }
-    if(*p1=='\0' && *p2=='\0')
-        return(PASS);
-    else
-        return(FAIL);
+    if (*p1 == '\0' && *p2 == '\0') {
+        return (PASS);
+    } else {
+        return (FAIL);
+    }
 }
 
-void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+void substr(char *dest, const char *src, unsigned int start, unsigned int cnt)
 {
-	strncpy(dest, src + start, cnt);
-	dest[cnt] = 0;
+    strncpy(dest, src + start, cnt);
+    dest[cnt] = 0;
 }
 
 void split(char **arr, char *str, const char *del)
 {
-	char *s = strtok(str, del);
+    char *s = strtok(str, del);
 
-	while(s != NULL)
-	{
-		*arr++ = s;
-		s = strtok(NULL, del);
-	}
+    while (s != NULL) {
+        *arr++ = s;
+        s = strtok(NULL, del);
+    }
 }
 
 //==========================================
@@ -194,56 +193,47 @@ void split(char **arr, char *str, const char *del)
 //==========================================
 int InitShareMemory()
 {
-	int result = PASS;
-	int MeterSMId;
-
-	//creat ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
-    {
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
-		#endif
-		result = FAIL;
-	}
-    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-    {
-    	#ifdef SystemLogMessage
-    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
-		#endif
-    	result = FAIL;
-   	 }
-
-   	 //creat ShmStatusCodeData
-   	 if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
-    {
-		#ifdef SystemLogMessage
-   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
-		#endif
-   		result = FAIL;
-	}
-    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-    {
-    	#ifdef SystemLogMessage
-    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
-		#endif
-    	result = FAIL;
-   	}
-
-	//creat ShmStatusCodeData
-	if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), 0777)) < 0)
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("shmget ShmPrimaryMcuData NG\n");
-		#endif
-		result = FAIL;
-	}
-	else if ((ShmPrimaryMcuData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-	{
-		#ifdef ShmPrimaryMcuData
-		DEBUG_ERROR("shmat ShmPrimaryMcuData NG\n");
-		#endif
-		result = FAIL;
-	}
+    int result = PASS;
+    int MeterSMId;
+
+    //creat ShmSysConfigAndInfo
+    if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+#endif
+        result = FAIL;
+    } else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+#endif
+        result = FAIL;
+    }
+
+    //creat ShmStatusCodeData
+    if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+#endif
+        result = FAIL;
+    } else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+#endif
+        result = FAIL;
+    }
+
+    //creat ShmStatusCodeData
+    if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), 0777)) < 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("shmget ShmPrimaryMcuData NG\n");
+#endif
+        result = FAIL;
+    } else if ((ShmPrimaryMcuData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+#ifdef ShmPrimaryMcuData
+        DEBUG_ERROR("shmat ShmPrimaryMcuData NG\n");
+#endif
+        result = FAIL;
+    }
 
     return result;
 }
@@ -253,156 +243,138 @@ int InitShareMemory()
 //================================================
 void GetFwAndHwVersion()
 {
-	if(Query_FW_Ver(Uart1Fd, Addr.IoExtend, &ver) == PASS)
-	{
-		//PRINTF_FUNC("Primary FW Rev = %s \n", ver.Version_FW);
-		strcpy((char *)ShmPrimaryMcuData->version, ver.Version_FW);
-		strcpy((char *) ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ver.Version_FW);
-	}
-
-	if (Query_HW_Ver(Uart1Fd, Addr.IoExtend, &ver) == PASS)
-		;//PRINTF_FUNC("Primary HW Rev  = %s \n", ver.Version_HW);
+    if (Query_FW_Ver(Uart1Fd, Addr.IoExtend, &ver) == PASS) {
+        //PRINTF_FUNC("Primary FW Rev = %s \n", ver.Version_FW);
+        strcpy((char *)ShmPrimaryMcuData->version, ver.Version_FW);
+        strcpy((char *) ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ver.Version_FW);
+    }
+
+    if (Query_HW_Ver(Uart1Fd, Addr.IoExtend, &ver) == PASS)
+        ;//PRINTF_FUNC("Primary HW Rev  = %s \n", ver.Version_HW);
 }
 
 void GetInputGpioStatus()
 {
-	//PRINTF_FUNC("GetInputGpioStatus \n");
-	if (Query_Gpio_Input(Uart1Fd, Addr.IoExtend, &gpio_in) == PASS)
-	{
-		#ifndef DD360
-		ShmSysConfigAndInfo->SysInfo.AcContactorStatus = ShmPrimaryMcuData->InputDet.bits.AcContactorDetec = gpio_in.AC_Connector;
-		ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec = gpio_in.AC_MainBreaker;
-		#else
-		ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsLiquidChillerWaterLevelWarning = ~gpio_in.AC_Connector;
-		ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsLiquidChillerWaterLevelFault = ~gpio_in.AC_MainBreaker;
-		#endif
-		
-		ShmPrimaryMcuData->InputDet.bits.SpdDetec = gpio_in.SPD;
-		ShmPrimaryMcuData->InputDet.bits.DoorOpen = ~gpio_in.Door_Open;
-
-		ShmPrimaryMcuData->InputDet.bits.Button1 = gpio_in.Button[0];
-		ShmPrimaryMcuData->InputDet.bits.Button2 = gpio_in.Button[1];
-		ShmPrimaryMcuData->InputDet.bits.EmergencyButton = gpio_in.Emergency_Btn;
-		ShmPrimaryMcuData->InputDet.bits.Key0 = ~gpio_in.Key[0]&0x01;	
-		ShmPrimaryMcuData->InputDet.bits.Key1 = ~gpio_in.Key[1]&0x01;
-		ShmPrimaryMcuData->InputDet.bits.Key2 = ~gpio_in.Key[2]&0x01;
-		ShmPrimaryMcuData->InputDet.bits.Key3 = ~gpio_in.Key[3]&0x01;
-		/*printf(" gpio_in.Key[0]~ gpio_in.Key[3]=%d, %d, %d, %d\n", 
-		ShmPrimaryMcuData->InputDet.bits.Key0 , ShmPrimaryMcuData->InputDet.bits.Key1,
-		ShmPrimaryMcuData->InputDet.bits.Key2,ShmPrimaryMcuData->InputDet.bits.Key3);
-		printf("ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsLiquidChillerWaterLevelWarning=%d\n", ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsLiquidChillerWaterLevelWarning);
-		printf("ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsLiquidChillerWaterLevelFault=%d\n", ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsLiquidChillerWaterLevelFault);
-		*/
-		//PRINTF_FUNC("left = %d \n", ShmPrimaryMcuData->InputDet.bits.Button1);
-		//PRINTF_FUNC("right = %d \n", ShmPrimaryMcuData->InputDet.bits.Button2);
-		//PRINTF_FUNC("ShmSysConfigAndInfo->SysInfo.AcContactorStatus = %d \n", ShmSysConfigAndInfo->SysInfo.AcContactorStatus);
-		#ifndef DD360
-		if (ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec == YES)
-			DEBUG_ERROR("AC Mainbreaker occur. \n");
-		#endif	
-	}
+    //PRINTF_FUNC("GetInputGpioStatus \n");
+    if (Query_Gpio_Input(Uart1Fd, Addr.IoExtend, &gpio_in) == PASS) {
+#if !defined DD360 && !defined DD360Audi
+        ShmSysConfigAndInfo->SysInfo.AcContactorStatus = ShmPrimaryMcuData->InputDet.bits.AcContactorDetec = gpio_in.AC_Connector;
+        ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec = gpio_in.AC_MainBreaker;
+#else
+        ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsLiquidChillerWaterLevelWarning = ~gpio_in.AC_Connector;
+        ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsLiquidChillerWaterLevelFault = ~gpio_in.AC_MainBreaker;
+#endif //!defined DD360 && !defined DD360Audi
+
+        ShmPrimaryMcuData->InputDet.bits.SpdDetec = gpio_in.SPD;
+        ShmPrimaryMcuData->InputDet.bits.DoorOpen = ~gpio_in.Door_Open;
+
+        ShmPrimaryMcuData->InputDet.bits.Button1 = gpio_in.Button[0];
+        ShmPrimaryMcuData->InputDet.bits.Button2 = gpio_in.Button[1];
+        ShmPrimaryMcuData->InputDet.bits.EmergencyButton = gpio_in.Emergency_Btn;
+        ShmPrimaryMcuData->InputDet.bits.Key0 = ~gpio_in.Key[0] & 0x01;
+        ShmPrimaryMcuData->InputDet.bits.Key1 = ~gpio_in.Key[1] & 0x01;
+        ShmPrimaryMcuData->InputDet.bits.Key2 = ~gpio_in.Key[2] & 0x01;
+        ShmPrimaryMcuData->InputDet.bits.Key3 = ~gpio_in.Key[3] & 0x01;
+        /*printf(" gpio_in.Key[0]~ gpio_in.Key[3]=%d, %d, %d, %d\n",
+        ShmPrimaryMcuData->InputDet.bits.Key0 , ShmPrimaryMcuData->InputDet.bits.Key1,
+        ShmPrimaryMcuData->InputDet.bits.Key2,ShmPrimaryMcuData->InputDet.bits.Key3);
+        printf("ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsLiquidChillerWaterLevelWarning=%d\n", ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsLiquidChillerWaterLevelWarning);
+        printf("ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsLiquidChillerWaterLevelFault=%d\n", ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsLiquidChillerWaterLevelFault);
+        */
+        //PRINTF_FUNC("left = %d \n", ShmPrimaryMcuData->InputDet.bits.Button1);
+        //PRINTF_FUNC("right = %d \n", ShmPrimaryMcuData->InputDet.bits.Button2);
+        //PRINTF_FUNC("ShmSysConfigAndInfo->SysInfo.AcContactorStatus = %d \n", ShmSysConfigAndInfo->SysInfo.AcContactorStatus);
+#if !defined DD360 && !defined DD360Audi
+        if (ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec == YES) {
+            DEBUG_ERROR("AC Mainbreaker occur. \n");
+        }
+#endif //!defined DD360 && !defined DD360Audi
+    }
 }
 
 void SetOutputGpio(byte flash)
 {
-	Gpio_out gpio;
-	gpio.Button_LED[0] = flash;
-	gpio.Button_LED[1] = flash;
-
-	gpio.System_LED[0] = 0x00;
-	gpio.System_LED[1] = 0x00;
-	gpio.System_LED[2] = 0x00;
-	gpio.System_LED[3] = 0x00;
-	
-	#ifdef DD360
-	if((ChargingData[0]->PresentChargingCurrent)>=150)
-	{	
-		ChillerSwitch=1;
-		ChillerOnTime=time((time_t*)NULL);
-	}
-	else
-	{
-		if(ChillerSwitch==1)
-		{
-			if((ChargingData[0]->PresentChargingCurrent)>=100)
-			{	
-				ChillerSwitch=1;
-				ChillerOnTime=time((time_t*)NULL);
-			}
-			else
-			{
-				if((time((time_t*)NULL)-ChillerOnTime)>=600)
-				{
-					ChillerSwitch=0;
-				}
-				else
-				{
-					ChillerSwitch=1;	
-				}
-			}		
-		}	
-		else
-		{
-			ChillerSwitch=0;
-		}
-	}	
-	gpio.AC_Connector = ChillerSwitch;//Chiller ON/OFF Control, "0: Chiller disable, 1: Chiller enable"
-	
-	//printf("ChargingData[0]->PresentChargingCurrent=%f,ChargingData[1]->PresentChargingCurrent=%f,ChillerSwitch=%d\n",ChargingData[0]->PresentChargingCurrent,ChargingData[1]->PresentChargingCurrent,ChillerSwitch);
-	#else
-	gpio.AC_Connector = 0x00;
-	#endif
-	gpio.AC_Breaker = 0x00;
-
-	if (Config_Gpio_Output(Uart1Fd, Addr.IoExtend, &gpio) == PASS)
-	{
-		//PRINTF_FUNC("SetOutputGpio sucessfully. %d \n", flash);
-	}
-	else
-	{
-		//PRINTF_FUNC("SetOutputGpio fail. \n");
-	}
+    Gpio_out gpio;
+    gpio.Button_LED[0] = flash;
+    gpio.Button_LED[1] = flash;
+
+    gpio.System_LED[0] = 0x00;
+    gpio.System_LED[1] = 0x00;
+    gpio.System_LED[2] = 0x00;
+    gpio.System_LED[3] = 0x00;
+
+#if defined DD360 || defined DD360Audi
+    if ((ChargingData[0]->PresentChargingCurrent) >= 150) {
+        ChillerSwitch = 1;
+        ChillerOnTime = time((time_t *)NULL);
+    } else {
+        if (ChillerSwitch == 1) {
+            if ((ChargingData[0]->PresentChargingCurrent) >= 100) {
+                ChillerSwitch = 1;
+                ChillerOnTime = time((time_t *)NULL);
+            } else {
+                if ((time((time_t *)NULL) - ChillerOnTime) >= 600) {
+                    ChillerSwitch = 0;
+                } else {
+                    ChillerSwitch = 1;
+                }
+            }
+        } else {
+            ChillerSwitch = 0;
+        }
+    }
+    gpio.AC_Connector = ChillerSwitch;//Chiller ON/OFF Control, "0: Chiller disable, 1: Chiller enable"
+
+    //printf("ChargingData[0]->PresentChargingCurrent=%f,ChargingData[1]->PresentChargingCurrent=%f,ChillerSwitch=%d\n",ChargingData[0]->PresentChargingCurrent,ChargingData[1]->PresentChargingCurrent,ChillerSwitch);
+#else
+    gpio.AC_Connector = 0x00;
+#endif //defined DD360 || DD360Audi
+
+    gpio.AC_Breaker = 0x00;
+
+    if (Config_Gpio_Output(Uart1Fd, Addr.IoExtend, &gpio) == PASS) {
+        //PRINTF_FUNC("SetOutputGpio sucessfully. %d \n", flash);
+    } else {
+        //PRINTF_FUNC("SetOutputGpio fail. \n");
+    }
 }
 
 void SetRtcData()
 {
-	struct timeb csuTime;
-	struct tm *tmCSU;
-
-	ftime(&csuTime);
-	tmCSU = localtime(&csuTime.time);
-//	PRINTF_FUNC("Time : %04d-%02d-%02d %02d:%02d:%02d \n", tmCSU->tm_year + 1900,
-//			tmCSU->tm_mon + 1, tmCSU->tm_mday, tmCSU->tm_hour, tmCSU->tm_min,
-//			tmCSU->tm_sec);
-
-	rtc.RtcData[0] = '0' + (tmCSU->tm_year + 1900) / 1000 % 10;
-	rtc.RtcData[1] = '0' + (tmCSU->tm_year + 1900) / 100 % 10;
-	rtc.RtcData[2] = '0' + (tmCSU->tm_year + 1900) / 10 % 10;
-	rtc.RtcData[3] = '0' + (tmCSU->tm_year + 1900) / 1 % 10;
-
-	rtc.RtcData[4] = '0' + (tmCSU->tm_mon + 1) / 10 % 10;
-	rtc.RtcData[5] = '0' + (tmCSU->tm_mon + 1) / 1 % 10;
-
-	rtc.RtcData[6] = '0' + (tmCSU->tm_mday) / 10 % 10;
-	rtc.RtcData[7] = '0' + (tmCSU->tm_mday) / 1 % 10;
-
-	rtc.RtcData[8] = '0' + (tmCSU->tm_hour) / 10 % 10;
-	rtc.RtcData[9] = '0' + (tmCSU->tm_hour) / 1 % 10;
-
-	rtc.RtcData[10] = '0' + (tmCSU->tm_min) / 10 % 10;
-	rtc.RtcData[11] = '0' + (tmCSU->tm_min) / 1 % 10;
-
-	rtc.RtcData[12] = '0' + (tmCSU->tm_sec) / 10 % 10;
-	rtc.RtcData[13] = '0' + (tmCSU->tm_sec) / 1 % 10;
-
-	if (Config_Rtc_Data(Uart1Fd, Addr.IoExtend, &rtc) == PASS)
-	{
-		//PRINTF_FUNC("SetRtc sucessfully. \n");
-	}
-	else
-	{
-		//PRINTF_FUNC("SetRtc fail. \n");
-	}
+    struct timeb csuTime;
+    struct tm *tmCSU;
+
+    ftime(&csuTime);
+    tmCSU = localtime(&csuTime.time);
+//  PRINTF_FUNC("Time : %04d-%02d-%02d %02d:%02d:%02d \n", tmCSU->tm_year + 1900,
+//          tmCSU->tm_mon + 1, tmCSU->tm_mday, tmCSU->tm_hour, tmCSU->tm_min,
+//          tmCSU->tm_sec);
+
+    rtc.RtcData[0] = '0' + (tmCSU->tm_year + 1900) / 1000 % 10;
+    rtc.RtcData[1] = '0' + (tmCSU->tm_year + 1900) / 100 % 10;
+    rtc.RtcData[2] = '0' + (tmCSU->tm_year + 1900) / 10 % 10;
+    rtc.RtcData[3] = '0' + (tmCSU->tm_year + 1900) / 1 % 10;
+
+    rtc.RtcData[4] = '0' + (tmCSU->tm_mon + 1) / 10 % 10;
+    rtc.RtcData[5] = '0' + (tmCSU->tm_mon + 1) / 1 % 10;
+
+    rtc.RtcData[6] = '0' + (tmCSU->tm_mday) / 10 % 10;
+    rtc.RtcData[7] = '0' + (tmCSU->tm_mday) / 1 % 10;
+
+    rtc.RtcData[8] = '0' + (tmCSU->tm_hour) / 10 % 10;
+    rtc.RtcData[9] = '0' + (tmCSU->tm_hour) / 1 % 10;
+
+    rtc.RtcData[10] = '0' + (tmCSU->tm_min) / 10 % 10;
+    rtc.RtcData[11] = '0' + (tmCSU->tm_min) / 1 % 10;
+
+    rtc.RtcData[12] = '0' + (tmCSU->tm_sec) / 10 % 10;
+    rtc.RtcData[13] = '0' + (tmCSU->tm_sec) / 1 % 10;
+
+    if (Config_Rtc_Data(Uart1Fd, Addr.IoExtend, &rtc) == PASS) {
+        //PRINTF_FUNC("SetRtc sucessfully. \n");
+    } else {
+        //PRINTF_FUNC("SetRtc fail. \n");
+    }
 }
 
 //================================================
@@ -410,160 +382,136 @@ void SetRtcData()
 //================================================
 int InitComPort()
 {
-	int fd;
-	struct termios tios;
-
-	fd = open(priPortName, O_RDWR);
-	if(fd<=0)
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("open 407 Communication port NG \n");
-		#endif
-		return -1;
-	}
-	ioctl (fd, TCGETS, &tios);
-	tios.c_cflag = B115200| CS8 | CLOCAL | CREAD;
-	tios.c_lflag = 0;
-	tios.c_iflag = 0;
-	tios.c_oflag = 0;
-	tios.c_cc[VMIN]=0;
-	tios.c_cc[VTIME]=(unsigned char)1;
-	tios.c_lflag=0;
-	tcflush(fd, TCIFLUSH);
-	ioctl (fd, TCSETS, &tios);
-
-	return fd;
+    int fd;
+    struct termios tios;
+
+    fd = open(priPortName, O_RDWR);
+    if (fd <= 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("open 407 Communication port NG \n");
+#endif
+        return -1;
+    }
+    ioctl (fd, TCGETS, &tios);
+    tios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
+    tios.c_lflag = 0;
+    tios.c_iflag = 0;
+    tios.c_oflag = 0;
+    tios.c_cc[VMIN] = 0;
+    tios.c_cc[VTIME] = (unsigned char)1;
+    tios.c_lflag = 0;
+    tcflush(fd, TCIFLUSH);
+    ioctl (fd, TCSETS, &tios);
+
+    return fd;
 }
 
 unsigned long GetTimeoutValue(struct timeval _sour_time)
 {
-	struct timeval _end_time;
-	gettimeofday(&_end_time, NULL);
+    struct timeval _end_time;
+    gettimeofday(&_end_time, NULL);
 
-	return 1000000 * (_end_time.tv_sec - _sour_time.tv_sec) + _end_time.tv_usec - _sour_time.tv_usec;
+    return 1000000 * (_end_time.tv_sec - _sour_time.tv_sec) + _end_time.tv_usec - _sour_time.tv_usec;
 }
 
 int FindChargingInfoData(byte target, struct ChargingInfoData **chargingData)
 {
-	for (byte index = 0; index < CHAdeMO_QUANTITY; index++)
-	{
-		if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == target)
-		{
-			chargingData[target] = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index];
-			return 1;
-		}
-	}
-
-	for (byte index = 0; index < CCS_QUANTITY; index++)
-	{
-		if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == target)
-		{
-			chargingData[target] = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[index];
-			return 1;
-		}
-	}
-
-	for (byte index = 0; index < GB_QUANTITY; index++)
-	{
-		if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == target)
-		{
-			chargingData[target] = &ShmSysConfigAndInfo->SysInfo.GbChargingData[index];
-			return 1;
-		}
-	}
-
-	return 0;
+    for (byte index = 0; index < CHAdeMO_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == target) {
+            chargingData[target] = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index];
+            return 1;
+        }
+    }
+
+    for (byte index = 0; index < CCS_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == target) {
+            chargingData[target] = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[index];
+            return 1;
+        }
+    }
+
+    for (byte index = 0; index < GB_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == target) {
+            chargingData[target] = &ShmSysConfigAndInfo->SysInfo.GbChargingData[index];
+            return 1;
+        }
+    }
+
+    return 0;
 }
 
 int main(void)
 {
-	if(InitShareMemory() == FAIL)
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("InitShareMemory NG\n");
-		#endif
-		if(ShmStatusCodeData!=NULL)
-		{
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
-		}
-		sleep(5);
-		return 0;
-	}
-	
-	for (byte _index = 0; _index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; _index++)
-	{
-		if (!FindChargingInfoData(_index, &ChargingData[0]))
-		{
-			DEBUG_ERROR("FindChargingInfoData false \n");
-			break;
-		}
-	}
-	ChillerSwitch=0;
-	Uart1Fd = InitComPort();
-	//PRINTF_FUNC("407 Port id = %d \n", Uart1Fd);
-
-	if(Uart1Fd < 0)
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("InitComPort (Uart1 : AM3352 - STM32) NG");
-		#endif
-
-		if (ShmStatusCodeData != NULL)
-		{
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
-		}
-		sleep(5);
-		return 0;
-	}
-
-	SetRtcData();
-	gettimeofday(&_flash_time, NULL);
-	for(;;)
-	{
-		if (strcmp((char *)ShmSysConfigAndInfo->SysInfo.LcmHwRev, " ") == 0x00)
-		{
-			if ((GetTimeoutValue(_flash_time) / 1000) > 1000)
-			{
-				if (flash == NO)
-					flash = YES;
-				else
-					flash = NO;
-				SetOutputGpio(flash);
-				gettimeofday(&_flash_time, NULL);
-			}
-		}
-		else
-		{
-			if ((GetTimeoutValue(_flash_time) / 1000) > 5000)
-			{
-				if (flash == NO)
-					flash = YES;
-
-				SetOutputGpio(flash);
-				gettimeofday(&_flash_time, NULL);
-			}
-		}
-
-		// 程序開始之前~ 必須先確定 FW 版本與硬體版本,確認後!!~ 該模組才算是真正的 Initial Comp.
-		// 模組更新 FW 後,需重新做
-		if(ShmPrimaryMcuData->SelfTest_Comp != PASS)
-		{
-			//PRINTF_FUNC("(407) Get Fw and Hw Ver. \n");
-			GetFwAndHwVersion();
-			sleep(1);
-			ShmPrimaryMcuData->SelfTest_Comp = PASS;
-		}
-		else
-		{
-			GetInputGpioStatus();
-		}
-
-		usleep(100000);
-	}
-
-	return FAIL;
-}
-
+    if (InitShareMemory() == FAIL) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("InitShareMemory NG\n");
+#endif
+        if (ShmStatusCodeData != NULL) {
+            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
+        }
+        sleep(5);
+        return 0;
+    }
 
+    for (byte _index = 0; _index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; _index++) {
+        if (!FindChargingInfoData(_index, &ChargingData[0])) {
+            DEBUG_ERROR("FindChargingInfoData false \n");
+            break;
+        }
+    }
+    ChillerSwitch = 0;
+    Uart1Fd = InitComPort();
+    //PRINTF_FUNC("407 Port id = %d \n", Uart1Fd);
+
+    if (Uart1Fd < 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("InitComPort (Uart1 : AM3352 - STM32) NG");
+#endif
+
+        if (ShmStatusCodeData != NULL) {
+            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
+        }
+        sleep(5);
+        return 0;
+    }
 
+    SetRtcData();
+    gettimeofday(&_flash_time, NULL);
+    for (;;) {
+        if (strcmp((char *)ShmSysConfigAndInfo->SysInfo.LcmHwRev, " ") == 0x00) {
+            if ((GetTimeoutValue(_flash_time) / 1000) > 1000) {
+                if (flash == NO) {
+                    flash = YES;
+                } else {
+                    flash = NO;
+                }
+                SetOutputGpio(flash);
+                gettimeofday(&_flash_time, NULL);
+            }
+        } else {
+            if ((GetTimeoutValue(_flash_time) / 1000) > 5000) {
+                if (flash == NO) {
+                    flash = YES;
+                }
+
+                SetOutputGpio(flash);
+                gettimeofday(&_flash_time, NULL);
+            }
+        }
+
+        // 蝔见��见�銋见�~ 敹����Ⅱ摰� FW ��𧋦��′擃𠉛��穿�蝣箄�敺�!!~ 閰脫芋蝯��蝞埈糓��迤�� Initial Comp.
+        // 璅∠��湔鰵 FW 敺䕘����齿鰵��
+        if (ShmPrimaryMcuData->SelfTest_Comp != PASS) {
+            //PRINTF_FUNC("(407) Get Fw and Hw Ver. \n");
+            GetFwAndHwVersion();
+            sleep(1);
+            ShmPrimaryMcuData->SelfTest_Comp = PASS;
+        } else {
+            GetInputGpioStatus();
+        }
+
+        usleep(100000);
+    }
 
+    return FAIL;
+}

+ 1826 - 0
EVSE/Projects/DD360Audi/Apps/ReDoComm.c

@@ -0,0 +1,1826 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdbool.h>
+
+#include <sys/time.h>
+#include <sys/timeb.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
+#include <arpa/inet.h>
+#include <netinet/in.h>
+
+#include <assert.h>
+#include <time.h>
+#include <errno.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include "../../define.h"
+#include "Config.h"
+#include "ReDoComm.h"
+#include "AudiCust.h"
+
+//------------------------------------------------------------------------------
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+
+//------------------------------------------------------------------------------
+//static int TcpSock = 0;
+//static uint8_t PacketSe;
+static DoCommGblData gDoCommGblData = {0};
+
+static struct SysConfigAndInfo  *ShmSysConfigAndInfo;
+static struct StatusCodeData    *ShmStatusCodeData;
+static struct PsuData           *ShmPsuData;
+static struct OCPP16Data        *ShmOCPP16Data;
+static struct PrimaryMcuData    *ShmPrimaryMcuData;
+static struct ChargingInfoData  *ChargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
+static struct timeb             gRegTimeUp[2][MAX_REGISTER_NUM] = {0};
+static struct WARNING_CODE_INFO PreSysWarningInfo = {0};
+static AudiCustInfo             *gAudiCustInfo = NULL;
+
+//------------------------------------------------------------------------------
+static void removeFaultCodeToBuf(uint8_t *Code);
+static void addFaultCodeToBuf(uint8_t *Code);
+static int readMiscCommand(int fd, uint8_t id);
+static int writeCsuModuleVersion(int fd);
+
+//------------------------------------------------------------------------------
+//--- Common function ---
+//------------------------------------------------------------------------------
+static int StoreLogMsg(const char *fmt, ...)
+{
+    char Buf[4096 + 256];
+    char buffer[4096];
+    va_list args;
+    struct timeb  SeqEndTime;
+    struct tm *tm;
+
+    va_start(args, fmt);
+    int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+    va_end(args);
+
+    memset(Buf, 0, sizeof(Buf));
+    ftime(&SeqEndTime);
+    SeqEndTime.time = time(NULL);
+    tm = localtime(&SeqEndTime.time);
+
+    if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == 1) {
+        sprintf(Buf, "%02d:%02d:%02d:%03d - %s",
+                tm->tm_hour, tm->tm_min, tm->tm_sec, SeqEndTime.millitm, buffer);
+        printf("%s \n", Buf);
+    } else {
+        sprintf(Buf, "echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+                tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, SeqEndTime.millitm,
+                buffer,
+                tm->tm_year + 1900, tm->tm_mon + 1);
+        system(Buf);
+    }
+
+    return rc;
+}
+
+static int DiffTimeb(struct timeb ST, struct timeb ET)
+{
+    //return milli-second
+    unsigned int StartTime, StopTime;
+
+    StartTime = (unsigned int)ST.time;
+    StopTime = (unsigned int)ET.time;
+
+    return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
+}
+
+/**
+ * [hexdump : check data]
+ * @Author   Jerry
+ * @DateTime 2018-12-21
+ * @param    p          [description]
+ * @param    size       [description]
+ */
+static void Hexdump(const void *p, size_t size)
+{
+    const uint8_t *c = p;
+    char message[10240] = {0};
+    uint32_t i = 0;
+    uint32_t message_len = 0;
+
+    assert(p);
+
+    //printf("Dumping %u bytes from %p:\r\n", size, p);
+    message_len += sprintf(&message[message_len], "\r\nDumping %u bytes from %p:\r\n",  (unsigned int)size, p);
+
+    while (size > 0) {
+        for (i = 0; i < 16; i++) {
+            if (i < size) {
+                //printf("%02x ", c[i]);
+                message_len += sprintf(&message[message_len], "%02x ", c[i]);
+            } else {
+                //printf("   ");
+                message_len += sprintf(&message[message_len], "   ");
+            }
+        }
+
+        for (i = 0; i < 16; i++) {
+            if (i < size) {
+                //printf("%c", c[i] >= 32 && c[i] < 127 ? c[i] : '.');
+                message_len += sprintf(&message[message_len], "%c", c[i] >= 32 && c[i] < 127 ? c[i] : '.');
+            } else {
+                //printf(" ");
+                message_len += sprintf(&message[message_len], " ");
+            }
+        }
+
+        //printf("\n");
+        message_len += sprintf(&message[message_len], "\r\n");
+        c += 16;
+
+        if (size <= 16) {
+            break;
+        }
+
+        size -= 16;
+    }
+
+    message_len += sprintf(&message[message_len], "\r\n");
+
+    printf("%s", message);
+}
+
+static int string2ByteArray(char *input, byte *output)
+{
+    int loop = 0;
+    int i = 0;
+
+    while (input[loop] != '\0') {
+        output[i++] = input[loop++];
+    }
+    output[loop] = '\0';
+
+    return loop + 1;
+}
+
+static void unixSocketSigPipeHandle(int sig)
+{
+    DEBUG_ERROR("socket packet error %x\r\n", sig);
+}
+
+static void InitSocketSigPipe(void)
+{
+    struct sigaction action;
+
+    action.sa_handler = unixSocketSigPipeHandle;
+    sigemptyset(&action.sa_mask);
+    action.sa_flags = 0;
+    sigaction(SIGPIPE, &action, NULL);
+}
+
+//------------------------------------------------------------------------------
+static void setTcpStatus(uint8_t setValue)
+{
+    ShmStatusCodeData->AlarmCode.AlarmEvents.bits.DisconnectedFromDo = setValue;
+}
+
+//------------------------------------------------------------------------------
+//--- TCP socket function ---
+//------------------------------------------------------------------------------
+static int sendTcpSocket(int fd, uint8_t *data, uint16_t dataLen)
+{
+    int size = -1;
+
+    size = send(fd, data, dataLen , 0);
+    if ((size < 0) || (errno == EAGAIN)) {
+        if (size < 0) {
+            DEBUG_ERROR("Size = %d, EAGAIN error %d:%s\r\n", size, errno, strerror(errno));
+        }
+    }
+
+    return size;
+}
+
+static int recvTcpSocket(int fd, uint8_t *data, uint16_t dataLen)
+{
+    int size = -1;
+    uint8_t *pdata = (uint8_t *)data;
+
+    size = recv(fd, pdata, dataLen, MSG_WAITALL);
+    if ((errno == EAGAIN) || (size < 0)) {
+        DEBUG_ERROR("Size = %d, EAGAIN error %d:%s\r\n", size, errno, strerror(errno));
+    }
+
+    return size;
+}
+
+static int getSO_ERROR(int fd)
+{
+    int err = 1;
+    socklen_t len = sizeof err;
+
+    if (-1 == getsockopt(fd, SOL_SOCKET, SO_ERROR, (char *)&err, &len)) {
+        DEBUG_ERROR("getSO_ERROR\r\n");
+    }
+
+    if (err) {
+        errno = err;        // set errno to the socket SO_ERROR
+    }
+
+    return err;
+}
+
+static void closeSocket(int fd)        // *not* the Windows closesocket()
+{
+    if (fd < 0) {
+        return;
+    }
+
+    getSO_ERROR(fd); // first clear any errors, which can cause close to fail
+    if (shutdown(fd, SHUT_RDWR) < 0) { // secondly, terminate the 'reliable' delivery
+        if (errno != ENOTCONN && errno != EINVAL) { // SGI causes EINVAL
+            DEBUG_INFO("shutdown\r\n");
+        }
+    }
+
+    if (close(fd) < 0) { // finally call close()
+        DEBUG_INFO("client socket close\r\n");
+    }
+}
+
+static int doCommConnToServer(void)
+{
+    struct sockaddr_in dest;
+    struct timeval tv;
+    int flag;
+    int TcpSock = 0;
+
+    //if (TcpSock > 0) {
+    //    close(TcpSock);
+    //}
+
+    if ((TcpSock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+        DEBUG_ERROR("Open TCP socket NG");
+        return -1;
+    }
+
+    //flag = fcntl (TcpSock, F_GETFL, 0);
+    //if (flag >= 0) {
+    //    flag |= O_NONBLOCK;
+    //    fcntl(TcpSock, F_SETFL, flag );
+    //}
+
+    tv.tv_sec = 0;
+    tv.tv_usec = 100000;
+    setsockopt(TcpSock, SOL_SOCKET,  SO_RCVTIMEO, &tv, sizeof(struct timeval));
+    setsockopt(TcpSock, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(struct timeval));
+    flag = 1;
+    setsockopt(TcpSock, SOL_SOCKET, MSG_NOSIGNAL, &flag, sizeof(flag));
+
+    memset(&dest, 0, sizeof(dest));
+    dest.sin_family = AF_INET;
+    dest.sin_port = htons(DoTcpPort);
+    inet_aton(DoIPAddress, (struct in_addr *) &dest.sin_addr.s_addr);
+
+    if (connect(TcpSock, (struct sockaddr *) &dest, sizeof(dest)) != 0) {
+        close(TcpSock);
+        return -1;
+    }
+
+    return TcpSock;
+}
+
+//------------------------------------------------------------------------------
+//--- DoComm function ---
+//------------------------------------------------------------------------------
+static int compareOpcode(uint8_t opCode)
+{
+    if (opCode != OP_WAIT_RESPONSE) {
+        //DEBUG_ERROR("response operative code fail\r\n");
+        return FAIL;
+    }
+
+    return PASS;
+}
+
+static int compareResult(uint8_t result)
+{
+    if (result != COMMAND_RESULT_OK) {
+        //DEBUG_ERROR("response result fail\r\n");
+        return FAIL;
+    }
+
+    return PASS;
+}
+
+static int compareRegister(uint8_t srcReg, uint8_t destReg)
+{
+    if (srcReg != destReg) {
+        //DEBUG_ERROR("response register fail\r\n");
+        return FAIL;
+    }
+
+    return PASS;
+}
+
+static int getConfirmSelectedGun(uint8_t curSel)
+{
+    if (((curSel == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun >= SEL_GUN_CONFIRM)) ||
+            ((curSel == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun >= SEL_GUN_CONFIRM))) {
+        return PASS;
+    }
+
+    return FAIL;
+}
+
+static int getSelGunWaitToAuthor(uint8_t curGun)
+{
+    if (curGun == LEFT_GUN_NUM && gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR) {
+        return FAIL;
+    }
+
+    if (curGun == RIGHT_GUN_NUM && gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR) {
+        return FAIL;
+    }
+
+    return PASS;
+}
+
+static void setConfirmSelGun(uint8_t selGun)
+{
+    if (selGun == LEFT_GUN_NUM && gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_RELEASE) {
+        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_CONFIRM;
+        printf("confirmSelGun left\r\n");
+    } else if (selGun == RIGHT_GUN_NUM && gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_RELEASE) {
+        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_CONFIRM;
+        printf("confirmSelGun right\r\n");
+    }
+}
+
+static float transPricesUnit(int prices)
+{
+    //printf("prices = %.2f\r\n", prices * PRICES_UNIT);
+    return (prices * PRICES_UNIT);
+}
+
+static void clearMiscCommand(void)
+{
+    gDoCommGblData.MiscCmd = 0;
+}
+
+static int qrCodeUrlInfoHandle(uint8_t *data)
+{
+    int len = 0;
+    char cmdBuf[128] = {0};
+    char localTime[128] = {0};
+    uint16_t timeLen = 0;
+    struct timeb SeqEndTime;
+    struct tm *tm;
+
+    if ((char *)&data[0] == '\0') {
+        DEBUG_ERROR("QR code date error\r\n");
+        return FAIL;
+    }
+
+    //get local system time
+    ftime(&SeqEndTime);
+    SeqEndTime.time = time(NULL);
+    tm = localtime(&SeqEndTime.time);
+    timeLen = sprintf(localTime, "%04d-%02d-%02d %02d:%02d",
+                      tm->tm_year + 1900,
+                      tm->tm_mon + 1,
+                      tm->tm_mday,
+                      tm->tm_hour,
+                      tm->tm_min);
+
+    //copy QR code string
+    if (strncmp((char *)localTime, (char *)&data[0], timeLen) != 0) {
+        memset(ShmSysConfigAndInfo->SysConfig.SystemId, '\0', sizeof(ShmSysConfigAndInfo->SysConfig.SystemId));
+        len = string2ByteArray((char *)data, (uint8_t *)ShmSysConfigAndInfo->SysConfig.SystemId);
+    }
+
+    if ((char *)&data[len] == '\0') {
+        DEBUG_ERROR("power cabinet system date error\r\n");
+        return FAIL;
+    }
+
+    //set system date
+    if (strncmp((char *)localTime, (char *)&data[len], timeLen) != 0) {
+        sprintf(cmdBuf, "date -s \"%s\" >> /dev/null", (char *)&data[len]);
+        system(cmdBuf);
+        DEBUG_INFO("local time = %s, data time =  %s\r\n", localTime, (char *)&data[len]);
+    }
+
+    return PASS;
+}
+
+static int updateFirmwareHandle(uint8_t *imgName)
+{
+    char cmdBuf[1024] = {0};
+    int status = 0;
+
+    system("touch ./tftpUpdate.sh"); //創建shell
+    sprintf(cmdBuf, "echo tftp -gr %s -l %s/%s %s; > ./tftpUpdate.sh",
+            imgName,
+            IMAGE_FILE_PATH,
+            imgName,
+            DoIPAddress);
+    system("chmod +x ./tftpUpdate.sh"); //修改權限
+
+    status = system("sh tftpUpdate.sh"); //執行shell
+    if (-1 == status) {
+        printf("system error!");
+    } else {
+        printf("exit status value = [0x%x]\n", status);
+
+        if (WIFEXITED(status)) {
+            if (0 == WEXITSTATUS(status)) {
+                printf("run shell script successfully.\n");
+                ShmSysConfigAndInfo->SysInfo.FirmwareUpdate = YES;
+            } else {
+                printf("run shell script fail, script exit code: %d\n", WEXITSTATUS(status));
+            }
+        } else {
+            printf("exit status = [%d]\n", WEXITSTATUS(status));
+        }
+    }
+
+    system("rm -rf ./tftpUpdate.sh"); //刪除shell
+
+    return PASS;
+}
+
+static int miscCommandHandle(uint8_t dataLen, uint8_t id, uint8_t *data)
+{
+    int ret = PASS;
+    uint8_t i = 0, j = 0;
+    uint8_t cmdCount = (dataLen / 6);
+    uint16_t cmd = 0;
+    uint32_t value = 0;
+    float prices = 0;
+    MiscCommand *pMiscCmd = NULL;
+
+    if (cmdCount < 1) {
+        gDoCommGblData.MiscCmd = 0;
+        //printf("cmdCount fail = %d, data len = %d\r\n", cmdCount, dataLen);
+        return FAIL;
+    }
+
+    for (i = 0; i < cmdCount; i++) {
+        pMiscCmd = (MiscCommand *)data + i;
+        cmd = ntohs(pMiscCmd->CMD);
+        value = ntohl(*((uint32_t *)&pMiscCmd->Value[0]));
+        //DEBUG_INFO("misc command = %x, value = %d\r\n", cmd, value);
+
+        switch (cmd) {
+        //--- Execute parameter ---
+        case MISC_CMD_CONNECOTOR_TIMEOUT:
+            gAudiCustInfo->RemoteSetup.ConnectionTimeout = value;
+            DEBUG_INFO("connection timeout = %d\r\n", gAudiCustInfo->RemoteSetup.ConnectionTimeout);
+            clearMiscCommand();
+            break;
+
+        case MISC_CMD_OPERATIVE_STATE:
+            if ((value > YES) || (value < NO)) {
+                break;
+            }
+
+            DEBUG_INFO("change availability id = %d, value = %d\r\n", id - 1, value);
+            ShmOCPP16Data->CsMsg.bits[id - 1].ChangeAvailabilityReq = YES;
+            if (value == YES) {
+                strcpy((char *)ShmOCPP16Data->ChangeAvailability[id - 1].Type, "Operative");
+            } else if (value == NO) {
+                strcpy((char *)ShmOCPP16Data->ChangeAvailability[id - 1].Type, "Inoperative");
+            }
+
+            if (id == 2) {
+                clearMiscCommand();
+            }
+            break;
+
+        case MISC_CMD_DEFAULT_PRICES:
+            prices = transPricesUnit((int)value);
+            DEBUG_INFO("default prices = %.2f\r\n", prices);
+
+            ShmSysConfigAndInfo->SysConfig.BillingData.isBilling = YES;
+            for (j = 0; j < 24; j++) {
+                ShmSysConfigAndInfo->SysConfig.BillingData.Fee[j] = prices;
+            }
+
+            clearMiscCommand();
+            break;
+
+        case MISC_CMD_DEFAULT_CURRENCY:
+            if (value < 0) {
+                return FAIL;
+            }
+
+            DEBUG_INFO("default currency = %s%c\r\n", (uint8_t *)Currency[value]);
+            ShmSysConfigAndInfo->SysConfig.BillingData.Currency = value;
+            clearMiscCommand();
+            break;
+
+        case MISC_CMD_ACCOUNT_BALANCE:
+            if (ShmSysConfigAndInfo->SysInfo.CurGunSelected != (id - 1)) {
+                break;
+            }
+
+            gAudiCustInfo->PricesInfo[id - 1].Balance = transPricesUnit((int)value);
+            DEBUG_INFO("%d misc balance = %.2f\r\n", id, gAudiCustInfo->PricesInfo[id - 1].Balance);
+            clearMiscCommand();
+            break;
+
+        //--- Control Dispenser ---
+        case MISC_CMD_HARDWARE_REBOOT:
+            if (value != YES) {
+                break;
+            }
+
+            DEBUG_INFO("Hardware reboot\r\n");
+            ShmOCPP16Data->MsMsg.bits.ResetReq = YES;
+            strcpy((char *)ShmOCPP16Data->Reset.Type, "Hard");
+            clearMiscCommand();
+            break;
+
+        case MISC_CMD_SOFTWARE_RESTART:
+            if (value != YES) {
+                break;
+            }
+
+            clearMiscCommand();
+            DEBUG_INFO("Software reboot\r\n");
+            ShmOCPP16Data->MsMsg.bits.ResetReq = YES;
+            strcpy((char *)ShmOCPP16Data->Reset.Type, "Soft");
+            break;
+
+        case MISC_CMD_REMOTE_START_CHARGING:
+            if (value != YES) {
+                break;
+            }
+            DEBUG_INFO("Remote start charging id = %d\r\n", id);
+
+            //if (getConfirmSelectedGun(id - 1) == FAIL) {
+            //    DEBUG_INFO("Remote start not select gun\r\n");
+            //    break;
+            //}
+
+            if (getSelGunWaitToAuthor(id - 1) == FAIL) {
+                DEBUG_ERROR("Remote start gun already charging\r\n");
+                break;
+            }
+
+            if (ShmSysConfigAndInfo->SysInfo.CurGunSelected != (id - 1)) {
+                ShmSysConfigAndInfo->SysInfo.CurGunSelected = (id - 1);
+                ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc = NO_DEFINE;
+            }
+
+            setConfirmSelGun(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
+
+            ShmOCPP16Data->CsMsg.bits[id - 1].RemoteStartTransactionReq = YES;
+            if (id == 2) {
+                clearMiscCommand();
+            }
+            break;
+
+        default:
+            clearMiscCommand();
+            break;
+        }
+    }
+
+    return ret;
+}
+
+static int chargingcapabilityHandle(uint8_t *data, uint8_t gunID)
+{
+    float MaxVolt, MaxCurrent, MaxPower;
+    CapabilityInfo *pCapabilityInfo = NULL;
+    AccountInfo *pAccountInfo = NULL;
+
+    pCapabilityInfo = (CapabilityInfo *)&data[0];
+
+    MaxVolt = (float)(ntohs(pCapabilityInfo->OutputVoltage));
+    if ((MaxVolt >= 0) && (MaxVolt <= MAX_VOLTAGE)) {
+        ChargingData[gunID]->MaximumChargingVoltage = MaxVolt;
+    }
+
+    MaxCurrent = (float)(ntohs(pCapabilityInfo->OutputCurrent));
+    if ((MaxCurrent >= 0) && (MaxCurrent <= MAX_CURRENCY)) {
+        ChargingData[gunID]->AvailableChargingCurrent = MaxCurrent;
+    }
+
+    MaxPower = (float)(ntohs(pCapabilityInfo->OutputPower));
+    if ((MaxPower >= 0) && (MaxPower <= MAX_POWER)) {
+        ChargingData[gunID]->AvailableChargingPower = MaxPower;
+    }
+    //MaxVolt = (float)(data[0] << 8 |data[1]);
+    //MaxCurrent = (float)(data[2] << 8 | data[3]);
+    //MaxPower = (float)(data[4] << 8 | data[5]);
+    //printf("MaxVolt=%f, MaxCurrent=%f, MaxPower=%f,\n", MaxVolt, MaxCurrent, MaxPower);
+
+    pAccountInfo = (AccountInfo *)&data[6];
+
+    ShmSysConfigAndInfo->SysConfig.BillingData.Currency = pAccountInfo->Currency;
+    gAudiCustInfo->PricesInfo[gunID].UserPrices        = transPricesUnit(ntohl(pAccountInfo->UserPrices));
+    ChargingData[gunID]->ChargingFee                   = transPricesUnit(ntohl(pAccountInfo->TotalCost));
+    gAudiCustInfo->PricesInfo[gunID].Balance           = transPricesUnit(ntohl(pAccountInfo->Balance));
+
+    DEBUG_INFO("id = %d, user prices = %.2f, Total cost = %.2f, Account balances = %.2f, currency = %s\r\n",
+               gunID,
+               gAudiCustInfo->PricesInfo[gunID].UserPrices,
+               ChargingData[gunID]->ChargingFee,
+               gAudiCustInfo->PricesInfo[gunID].Balance,
+               (uint8_t *)Currency[ShmSysConfigAndInfo->SysConfig.BillingData.Currency]);
+
+    return PASS;
+}
+
+static void addFaultCodeToBuf(uint8_t *Code)
+{
+    uint8_t warningCount = ShmSysConfigAndInfo->SysWarningInfo.WarningCount;
+
+    if (warningCount < 10) {
+        memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[warningCount][0],
+               Code,
+               strlen((char *)Code));
+        ShmSysConfigAndInfo->SysWarningInfo.WarningCount++;
+    }
+}
+
+static void removeFaultCodeToBuf(uint8_t *Code)
+{
+    uint8_t find = 0x01;
+    uint8_t i = 0;
+    char _code[7] = {0};
+
+    sprintf(_code, "%s", Code);
+
+    // 把相關的錯誤碼一次移除,避免重複顯示
+    while (find) {
+        find = 0x00;
+        for (i = 0; i < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
+            if (find == 0x00) {
+                if (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], _code, 7) == 0) {
+                    find = 0x01;
+                }
+            } else {
+                memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i - 1][0],
+                       &ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], 7);
+            }
+        }
+
+        if (find) {
+            ShmSysConfigAndInfo->SysWarningInfo.WarningCount--;
+        }
+    }
+}
+
+static int powerCabinetStatusProcess(uint8_t dataLen, uint8_t *data)
+{
+    uint8_t ret = 0;
+    uint8_t i = 0;
+    uint8_t count = 0;
+    uint8_t EventCodeTmp[7] = {0};
+    uint8_t StatusArray[MAX_REGISTER_NUM][WARNING_CODE_SIZE] = {0};
+
+    if (dataLen < WARNING_CODE_SIZE) {
+        DEBUG_ERROR("raw data len < 6 = %d\r\n", dataLen);
+        if (ShmSysConfigAndInfo->SysWarningInfo.WarningCount > 0) {
+            for (i = 0; i < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
+                if (ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][1] >= 0x33) { //from backend or power cabinet
+                    memset(EventCodeTmp, 0, sizeof(EventCodeTmp));
+                    memcpy(EventCodeTmp,
+                           ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i],
+                           sizeof(EventCodeTmp));
+                    removeFaultCodeToBuf(EventCodeTmp);
+                }
+            }
+        }
+        return FAIL;
+    }
+
+    for (count = 0; count < dataLen; count += WARNING_CODE_SIZE) {
+        //printf("status code = %s\r\n", &data[count]);
+
+        // misc command status code handle
+        if (strcmp((char *)&data[count], MISC_ST_MISC_CMD) == 0) {
+            gDoCommGblData.MiscCmd = REG_MISC_CONTROL;
+            memset((char *)&data[count], 0, WARNING_CODE_SIZE);
+            continue;
+        } else if (strcmp((char *)&data[count], MISC_ST_VERSION) == 0) {
+            gDoCommGblData.MiscCmd = REG_REPORT_CSU_VERSION;
+            memset((char *)&data[count], 0, WARNING_CODE_SIZE);
+            continue;
+        }
+
+        strncpy((char *)&StatusArray[count / WARNING_CODE_SIZE], (char *)&data[count], WARNING_CODE_SIZE);
+        ret = 0;
+        for (i = 0; i < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
+
+            if (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0],
+                       StatusArray[count / WARNING_CODE_SIZE],
+                       WARNING_CODE_SIZE) == 0) {
+                ret = 1;
+                break;
+            }
+        }
+
+        if (ret == 0) {
+            addFaultCodeToBuf(StatusArray[count / WARNING_CODE_SIZE]);
+        }
+        //Rtn=StatusCodeProcessing(StatusArray[count/6]);
+    }
+
+    for (i = 0; i < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
+        if (ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][1] >= '3') { //from backend or power cabinet 0x33
+            ret = 0;
+
+            for (count = 0; count < (dataLen / WARNING_CODE_SIZE); count++) {
+                if (memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0],
+                           StatusArray[count],
+                           WARNING_CODE_SIZE) == 0) {
+                    ret = 1;
+                    break;
+                }
+            }
+
+            if (ret == 0) {
+                memset(EventCodeTmp, 0, sizeof(EventCodeTmp));
+                memcpy(EventCodeTmp,
+                       ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i],
+                       sizeof(EventCodeTmp));
+                removeFaultCodeToBuf(EventCodeTmp);
+            }
+        }
+    }
+
+    return PASS;
+}
+
+static int responsePackeHandle(int fd, uint8_t *pResult, uint8_t id, uint8_t reg)
+{
+    int ret = PASS;
+    uint8_t rawDataLen = 0;
+    CsuResultPkt *pCsuResult = (CsuResultPkt *)pResult;
+    SoftwareUpdInfo *pSoftwareUpd = NULL;
+
+    //Hexdump((uint8_t *)pCsuResult, sizeof(CmdHead) + pCsuResult->Head.DataLen);
+    if (compareOpcode(pCsuResult->Head.OP) == FAIL ||
+            compareResult(pCsuResult->Data.Result) == FAIL ||
+            compareRegister(pCsuResult->Data.Register, reg) == FAIL) {
+        if (reg != REG_CHARGING_PERMISSION) {
+            return FAIL;
+        }
+    }
+
+    rawDataLen = (pCsuResult->Head.DataLen - 2); //2 byte = register and result byte
+
+    switch (pCsuResult->Data.Register) {
+    case REG_MODEL_NAME:
+        break;
+
+    case REG_CONNECTOR_ID:
+        gDoCommGblData.ConnectorID[0] = pCsuResult->Data.Data[0];
+        gDoCommGblData.ConnectorID[1] = pCsuResult->Data.Data[1];
+        DEBUG_INFO("OK (Left connector ID = %d, Right connector ID = %d)\n",
+                   pCsuResult->Data.Data[0],
+                   pCsuResult->Data.Data[1]);
+        break;
+
+    case REG_POWER_CABINET_STATUS:
+        ret = powerCabinetStatusProcess(rawDataLen, pCsuResult->Data.Data);
+        break;
+
+    case REG_DISPENSER_STATUS:
+        memset(&PreSysWarningInfo, 0, sizeof(struct WARNING_CODE_INFO));
+        memcpy(&PreSysWarningInfo,
+               &(ShmSysConfigAndInfo->SysWarningInfo),
+               sizeof(struct WARNING_CODE_INFO));
+        break;
+
+    case REG_CHARGING_CAP:
+        chargingcapabilityHandle(pCsuResult->Data.Data, id - 1);
+        break;
+
+    case REG_CHARGING_TARGET:
+        break;
+
+    case REG_SOFTWARE_UPDATE:
+        pSoftwareUpd = (SoftwareUpdInfo *)&pCsuResult->Data.Data[0];
+
+        if ((pSoftwareUpd->ImgName == NULL) || (rawDataLen == 0)) {
+            ret = FAIL;
+            break;
+        }
+
+        updateFirmwareHandle(pSoftwareUpd->ImgName);
+        break;
+
+    case REG_PLUG_IN_STATE:
+        break;
+
+    case REG_CONNECTOR_STATE:
+        break;
+
+    case REG_USER_ID:
+        //DEBUG_INFO("%s\n", pCsuResult->Data.Data[0] == 1 ? "Accept" : "Reject" );
+        //if (pCsuResult->Data.Data[0] <= 0) {
+        //    return FAIL;
+        //}
+        if (pCsuResult->Data.Result == COMMAND_RESULT_NG) {
+            return COMMAND_RESULT_NG;
+        }
+        return pCsuResult->Data.Data[0];
+        break;
+
+    case REG_CHARGING_PERMISSION:
+        //DEBUG_INFO("id = %d, result = %s, action = %s\r\n",
+        //           pCsuResult->Head.ID,
+        //           pCsuResult->Data.Result == 1 ? "OK" : "NG",
+        //           pCsuResult->Data.Data[0] == 1 ? "Permitted" : "NOT permitted");
+        if (pCsuResult->Data.Result == COMMAND_RESULT_NG) {
+            return COMMAND_RESULT_NG;
+        }
+        return pCsuResult->Data.Data[0];
+        break;
+
+    case REG_MISC_CONTROL:
+        miscCommandHandle(rawDataLen, pCsuResult->Head.ID, pCsuResult->Data.Data);
+        break;
+
+    case REG_REPORT_CSU_VERSION:
+    case REG_REPORT_OTHER_VERSION:
+        break;
+
+    case REG_PRESENT_CHARGING_INFO:
+        break;
+
+    case REG_QRCODE_URL_INFO:
+        ret = qrCodeUrlInfoHandle(pCsuResult->Data.Data);
+        break;
+
+    case REG_WAIT_PLUG_IT_STATE:
+        break;
+
+    default:
+        break;
+    }
+
+    return ret;
+}
+
+static int composeSocketData(int fd,
+                             uint8_t id,
+                             uint8_t opCode,
+                             uint8_t reg,
+                             uint8_t dataLen,
+                             uint8_t *data)
+{
+    int ret = PASS;
+    int size = 0;
+    int sendPktLen = 0;
+    CsuCmdPkt csuCmdPkt = {0};
+    CsuResultPkt csuResult = {0};
+
+    csuCmdPkt.Head.SeqNum = gDoCommGblData.SeqNum++;
+    csuCmdPkt.Head.ID = id;
+    csuCmdPkt.Head.OP = opCode;
+    csuCmdPkt.Head.DataLen = dataLen + 1; //+1 for register byte
+
+    csuCmdPkt.Data.Register = reg;
+    if ((data != NULL) && (dataLen > 0)) {
+        memcpy(csuCmdPkt.Data.Data, data, dataLen);
+    }
+
+    sendPktLen = csuCmdPkt.Head.DataLen + sizeof(csuCmdPkt.Head);
+
+    //Hexdump((uint8_t *)&csuCmdPkt, sendPktLen);
+
+    //send command packet
+    if ((size = sendTcpSocket(fd, (uint8_t *)&csuCmdPkt, sendPktLen)) < 0) {
+        DEBUG_ERROR("TCP socket send packet fail = %d\r\n", size);
+        gDoCommGblData.DisConnCount++;
+        return FAIL;
+    }
+
+    //receive result head
+    if ((size = recvTcpSocket(fd, (uint8_t *)&csuResult.Head, sizeof(csuResult.Head))) < 0) {
+        DEBUG_ERROR("TCP socket RX head fail = %d\r\n", size);
+        gDoCommGblData.DisConnCount++;
+        return FAIL;
+    }
+
+    //receive result raw data
+    if ((size = recvTcpSocket(fd, (uint8_t *)&csuResult.Data, csuResult.Head.DataLen)) < 0) {
+        DEBUG_ERROR("TCP socket RX data fail = %d\r\n", size);
+        gDoCommGblData.DisConnCount++;
+        return FAIL;
+    }
+
+    ret = responsePackeHandle(fd, (uint8_t *)&csuResult, id, csuCmdPkt.Data.Register);
+
+    return ret;
+}
+
+static int writeWaitPlugItState(int fd, uint8_t id)
+{
+    int ret = PASS;
+    uint8_t data[2] = {ShmSysConfigAndInfo->SysInfo.WaitForPlugit, 0};
+
+    //printf("WaitForPlugit = %d\r\n", ShmSysConfigAndInfo->SysInfo.WaitForPlugit);
+
+    if ((ret = composeSocketData(fd,
+                                 id,
+                                 OP_WRITE_DATA,
+                                 REG_WAIT_PLUG_IT_STATE,
+                                 1,
+                                 &data[0])) == FAIL) {
+        return ret;
+    }
+
+    return ret;
+}
+
+static int readPowerCabinetSystemID(int fd)
+{
+    int ret = PASS;
+
+    ret = composeSocketData(fd,
+                            ID_REGISTER,
+                            OP_READ_DATA,
+                            REG_QRCODE_URL_INFO,
+                            0,
+                            NULL);
+    return ret;
+}
+
+static int writePresentChargingInfo(int fd, uint8_t plugNum, uint8_t id)
+{
+    int ret = PASS;
+    uint8_t dataBuf[16] = {0};
+    PreChargingInfo *pPreChargingInfo = (PreChargingInfo *)dataBuf;
+
+    pPreChargingInfo->EvBatterySoc = htonl(ChargingData[plugNum]->EvBatterySoc);
+    pPreChargingInfo->RemainChargingDuration = htonl(ChargingData[plugNum]->RemainChargingDuration);
+    pPreChargingInfo->PresentChargingVoltage = htonl(ChargingData[plugNum]->PresentChargingVoltage);
+    pPreChargingInfo->PresentChargingCurrent = htonl(ChargingData[plugNum]->PresentChargingCurrent);
+
+    ret = composeSocketData(fd,
+                            id,
+                            OP_WRITE_DATA,
+                            REG_PRESENT_CHARGING_INFO,
+                            sizeof(PreChargingInfo),
+                            (uint8_t *)pPreChargingInfo);
+    return ret;
+}
+
+static int writeOtherModuleVersion(int fd)
+{
+    int ret = PASS;
+    uint8_t data[255] = {0};
+    uint8_t dataLen = 0;
+
+    //report other module version message
+    memcpy(&data[dataLen], ShmSysConfigAndInfo->SysInfo.FanModuleFwRev, VERSION_BUF_SIZE);
+    dataLen += VERSION_BUF_SIZE;
+    memcpy(&data[dataLen], ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev, VERSION_BUF_SIZE);
+    dataLen += VERSION_BUF_SIZE;
+    memcpy(&data[dataLen], ShmSysConfigAndInfo->SysInfo.Connector1FwRev, VERSION_BUF_SIZE);
+    dataLen += VERSION_BUF_SIZE;
+    memcpy(&data[dataLen], ShmSysConfigAndInfo->SysInfo.Connector2FwRev, VERSION_BUF_SIZE);
+    dataLen += VERSION_BUF_SIZE;
+    memcpy(&data[dataLen], ShmSysConfigAndInfo->SysInfo.LedModuleFwRev, VERSION_BUF_SIZE);
+    dataLen += VERSION_BUF_SIZE;
+
+    ret = composeSocketData(fd,
+                            ID_REGISTER,
+                            OP_WRITE_DATA,
+                            REG_REPORT_OTHER_VERSION,
+                            dataLen,
+                            &data[0]);
+
+    return ret;
+}
+
+static int writeCsuModuleVersion(int fd)
+{
+    int ret = PASS;
+    uint8_t data[255] = {0};
+    uint8_t dataLen = 0;
+
+    //report CSU platform version message
+    memcpy(&data[dataLen], ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev, VERSION_BUF_SIZE);
+    dataLen += VERSION_BUF_SIZE;
+    memcpy(&data[dataLen], ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, VERSION_BUF_SIZE);
+    dataLen += VERSION_BUF_SIZE;
+    memcpy(&data[dataLen], ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, VERSION_BUF_SIZE);
+    dataLen += VERSION_BUF_SIZE;
+    memcpy(&data[dataLen], ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, VERSION_BUF_SIZE);
+    dataLen += VERSION_BUF_SIZE;
+
+    ret = composeSocketData(fd,
+                            ID_REGISTER,
+                            OP_WRITE_DATA,
+                            REG_REPORT_CSU_VERSION,
+                            dataLen,
+                            &data[0]);
+
+    return ret;
+}
+
+static int readMiscCommand(int fd, uint8_t id)
+{
+    int ret = PASS;
+
+    ret = composeSocketData(fd,
+                            id,
+                            OP_READ_DATA,
+                            REG_MISC_CONTROL,
+                            0,
+                            NULL);
+
+    return ret;
+}
+
+static int readChargePermission(int fd, uint8_t id)
+{
+    //int ret = PASS;
+
+    //if ((ret = composeSocketData(fd,
+    //                             id,
+    //                             OP_READ_DATA,
+    //                             REG_CHARGING_PERMISSION,
+    //                             0,
+    //                             NULL)) == FAIL) {
+    //    return ret;
+    //}
+
+    return composeSocketData(fd,
+                             id,
+                             OP_READ_DATA,
+                             REG_CHARGING_PERMISSION,
+                             0,
+                             NULL);
+}
+
+static int writeUserID(int fd, uint8_t id, uint8_t *pUserID)
+{
+    if ((strlen((char *)pUserID) <= 0) || (pUserID == NULL)) {
+        return FAIL;
+    }
+
+    return composeSocketData(fd,
+                             id,
+                             OP_WRITE_DATA,
+                             REG_USER_ID,
+                             strlen((char *)pUserID),
+                             pUserID);
+}
+
+static int writeConnectorState(int fd, uint8_t plugNum, uint8_t id)
+{
+    uint8_t dataBuf[2] = {0};
+    int ret = PASS;
+
+    if (ChargingData[plugNum]->SystemStatus <= 2) {
+        dataBuf[0] = 0;    //idle
+    } else if ((ChargingData[plugNum]->SystemStatus <= 7) ||
+               (ChargingData[plugNum]->SystemStatus == 17) ||
+               (ChargingData[plugNum]->SystemStatus == 18)) {
+        dataBuf[0] = 1;    //preparing
+    } else if (ChargingData[plugNum]->SystemStatus == 8) {
+        dataBuf[0] = 2;    //charging
+    } else if (ChargingData[plugNum]->SystemStatus == 9) {
+        dataBuf[0] = 3;    //terminating
+    }
+
+    ret = composeSocketData(fd,
+                            id,
+                            OP_WRITE_DATA,
+                            REG_CONNECTOR_STATE,
+                            1,
+                            &dataBuf[0]);
+    return ret;
+}
+
+static int writePlugInStatus(int fd, uint8_t plugNum, uint8_t id)
+{
+    int ret = PASS;
+    uint8_t dataBuf[2] = {ChargingData[plugNum]->ConnectorPlugIn, 0};
+
+    ret = composeSocketData(fd,
+                            id,
+                            OP_WRITE_DATA,
+                            REG_PLUG_IN_STATE,
+                            1,
+                            &dataBuf[0]);
+    return ret;
+}
+
+static int readSoftwareUpdate(int fd)
+{
+    int ret = PASS;
+
+    ret = composeSocketData(fd,
+                            ID_REGISTER,
+                            OP_READ_DATA,
+                            REG_SOFTWARE_UPDATE,
+                            0,
+                            NULL);
+
+    return ret;
+}
+
+static int writeChargingTarget(int fd, uint8_t plugNum, uint8_t id)
+{
+    int ret = PASS;
+    float ChargingVolt, ChargingAmp;
+    uint8_t dataBuf[4] = {0};
+
+    ChargingVolt = ChargingData[plugNum]->EvBatterytargetVoltage;
+    ChargingAmp = ChargingData[plugNum]->EvBatterytargetCurrent;
+    ChargingVolt *= 10;
+    ChargingAmp *= 10;
+
+    dataBuf[0] = ((uint16_t)ChargingVolt >> 8) & 0xFF;
+    dataBuf[1] = ((uint16_t)ChargingVolt) & 0xFF;
+    dataBuf[2] = ((uint16_t)ChargingAmp >> 8) & 0xFF;
+    dataBuf[3] = ((uint16_t)ChargingAmp) & 0xFF;
+
+    ret = composeSocketData(fd,
+                            id,
+                            OP_WRITE_DATA,
+                            REG_CHARGING_TARGET,
+                            sizeof(dataBuf),
+                            &dataBuf[0]);
+
+    return ret;
+}
+
+static int readChargingCapability(int fd, uint8_t id)
+{
+    int ret = PASS;
+
+    ret = composeSocketData(fd,
+                            id,
+                            OP_READ_DATA,
+                            REG_CHARGING_CAP,
+                            0,
+                            NULL);
+
+    return ret;
+}
+
+static int writeDispenserStatus(int fd)
+{
+    uint8_t warningCount = 0;
+    uint8_t count = 0;
+    uint8_t CurWarnCodeTmp[10][6] = {0};
+    uint8_t PreWarnCodeTmp[10][6] = {0};
+    int ret = PASS;
+
+    if ((ShmSysConfigAndInfo->SysWarningInfo.WarningCount <= 0) &&
+            (PreSysWarningInfo.WarningCount <= 0)) {
+        return FAIL;
+    }
+
+    warningCount = ShmSysConfigAndInfo->SysWarningInfo.WarningCount;
+    for (count = 0; count < warningCount; count++) {
+        memcpy(CurWarnCodeTmp[count], ShmSysConfigAndInfo->SysWarningInfo.WarningCode[count], WARNING_CODE_SIZE);
+    }
+
+    warningCount = PreSysWarningInfo.WarningCount;
+    for (count = 0; count < warningCount; count++) {
+        memcpy(PreWarnCodeTmp[count], PreSysWarningInfo.WarningCode[count], WARNING_CODE_SIZE);
+    }
+
+    if (strcmp((char *)&CurWarnCodeTmp[0], (char *)&PreWarnCodeTmp[0]) == 0) {
+        return FAIL;
+    }
+
+    ret = composeSocketData(fd,
+                            ID_OF_DISPENSER,
+                            OP_WRITE_DATA,
+                            REG_DISPENSER_STATUS,
+                            strlen((char *)CurWarnCodeTmp),
+                            &CurWarnCodeTmp[0][0]);
+
+    return ret;
+}
+
+static int readPowerCabinetStatus(int fd)
+{
+    int ret = PASS;
+
+    ret = composeSocketData(fd,
+                            ID_OF_DISPENSER,
+                            OP_READ_DATA,
+                            REG_POWER_CABINET_STATUS,
+                            0,
+                            NULL);
+
+    return ret;
+}
+
+static int readConnectorID(int fd)
+{
+    int ret = PASS;
+
+    ret = composeSocketData(fd,
+                            ID_REGISTER,
+                            OP_READ_DATA,
+                            REG_CONNECTOR_ID,
+                            0,
+                            NULL);
+
+    return ret;
+}
+
+static int WriteModelName(int fd)
+{
+    int ret = PASS;
+    uint8_t Tmp = 0;
+    uint8_t TmpBuf[255] = {0};
+
+    memcpy(TmpBuf,
+           ShmSysConfigAndInfo->SysConfig.ModelName,
+           strlen((char *)ShmSysConfigAndInfo->SysConfig.ModelName));
+
+    Tmp = (uint8_t)(ShmPrimaryMcuData->InputDet.bits.Key2 << 2 |
+                    ShmPrimaryMcuData->InputDet.bits.Key1 << 1 |
+                    ShmPrimaryMcuData->InputDet.bits.Key0);
+
+    TmpBuf[strlen((char *)ShmSysConfigAndInfo->SysConfig.ModelName)] = Tmp; //Dispenser switch value
+
+    ret = composeSocketData(fd,
+                            ID_REGISTER,
+                            OP_WRITE_DATA,
+                            REG_MODEL_NAME,
+                            strlen((char *)ShmSysConfigAndInfo->SysConfig.ModelName) + 1,
+                            &TmpBuf[0]);
+
+    return ret;
+}
+
+static void calDisconnectCount(uint8_t *pValue, uint8_t maxCount)
+{
+    sleep(3); //wait 1 second
+
+    if ((*pValue) >= maxCount) {
+        setTcpStatus(ABNORMAL);
+    } else {
+        (*pValue)++;
+    }
+}
+
+static int CheckNetworkStatus(void)
+{
+    char *ipAddr = (char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress;
+
+    //printf("Check network IP Header = %s\n", ipAddr);
+    if (strstr(ipAddr, CMP_ETH_IP_HEAD) != NULL) {
+        return 1;
+    }
+
+    return 0;
+}
+
+static int FindChargingInfoData(byte target, struct ChargingInfoData **chargingData)
+{
+    uint8_t index = 0;
+
+    for (index = 0; index < CHAdeMO_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == target) {
+            chargingData[target] = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index];
+            return 1;
+        }
+    }
+
+    for (index = 0; index < CCS_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == target) {
+            chargingData[target] = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[index];
+            return 1;
+        }
+    }
+
+    for (index = 0; index < GB_QUANTITY; index++) {
+        if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == target) {
+            chargingData[target] = &ShmSysConfigAndInfo->SysInfo.GbChargingData[index];
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+static int InitShareMemory(void)
+{
+    int result = 1;
+    int MeterSMId = 0;
+
+    if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0) {
+        DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+        result = 0;
+    } else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+        DEBUG_ERROR("[shmat ShmSysConfigAndInfo NG\n");
+        result = 0;
+    }
+
+    if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0) {
+        DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+        result = 0;
+    } else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+        DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+        result = 0;
+    }
+
+    //creat ShmPsuData
+    if ((MeterSMId = shmget(ShmPsuKey, sizeof(struct PsuData),  0777)) < 0) {
+        DEBUG_ERROR("shmget ShmPsuData NG \n");
+        result = 0;
+    } else if ((ShmPsuData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+        DEBUG_ERROR("shmat ShmPsuData NG \n");
+        result = 0;
+    }
+
+    //creat ShmOCPP16Data
+    if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data),  0777)) < 0) {
+        DEBUG_ERROR("shmget ShmOCPP16Data NG \n");
+        result = 0;
+    } else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+        DEBUG_ERROR("shmat ShmOCPP16Data NG \n");
+        result = 0;
+    }
+
+    if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), 0777)) < 0) {
+        DEBUG_ERROR("shmget ShmPrimaryMcuData NG\n");
+        result = 0;
+    } else if ((ShmPrimaryMcuData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+        DEBUG_ERROR("shmat ShmPrimaryMcuData NG\n");
+        result = 0;
+    }
+
+    //creat Audi customization info
+    if ((MeterSMId = shmget(ShmAudiCustInfoKey, sizeof(AudiCustInfo), IPC_CREAT | 0777)) < 0) {
+        DEBUG_ERROR("[main]CreatShareMemory:shmget select gun info NG \n");
+        return 0;
+    } else if ((gAudiCustInfo = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
+        DEBUG_ERROR("[main]CreatShareMemory:shmat shmget select gun info \n");
+        return 0;
+    }
+
+    return result;
+}
+
+static void checkAuthorProcess(int fd, uint8_t plugNum)
+{
+    int ret = 0;
+    struct timeb AuthNowTime;
+
+    if ((ShmOCPP16Data->SpMsg.bits.AuthorizeReq == YES) || (ShmSysConfigAndInfo->SysInfo.AuthorizeFlag == YES)) {
+        ftime(&AuthNowTime);
+
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_USER_ID], AuthNowTime) > LOOP_RETRY_TIME) {
+            ret = writeUserID(fd,
+                              ShmSysConfigAndInfo->SysInfo.CurGunSelected + 1,
+                              ShmSysConfigAndInfo->SysConfig.UserId);
+            if (ret >= 0) {
+                memset(ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status,
+                       0,
+                       sizeof(ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status));
+                if (ret == 0) {
+                    strcpy((char *)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Invalid");
+                } else {
+                    strcpy((char *)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted");
+                }
+
+                //printf("gAudiCustInfo->PricesInfo[plugNum].Balance = %.2f, %.2f\r\n",
+                //       gAudiCustInfo->PricesInfo[plugNum].Balance,
+                //       FAIL_BALANCE_PRICES);
+                if (gAudiCustInfo->PricesInfo[plugNum].Balance != FAIL_BALANCE_PRICES) {
+                    ShmOCPP16Data->SpMsg.bits.AuthorizeConf    = 1; //isAuthorizedComplete
+                    ShmOCPP16Data->SpMsg.bits.AuthorizeReq     = 0;
+                    ShmSysConfigAndInfo->SysInfo.AuthorizeFlag = 0;
+                    ShmPsuData->SystemAvailablePower           = 0;
+                    ShmPsuData->SystemPresentPsuQuantity       = 0;
+                }
+            }
+            ftime(&gRegTimeUp[plugNum][REG_USER_ID]);
+        }
+    }
+}
+
+static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg)
+{
+    int ret = DISPENSER_INIT_SUCC;
+    int isContinue = 1;
+    struct timeb NowTime;
+
+    while (isContinue) {
+        ftime(&NowTime);
+
+        switch (curReg) {
+        case REG_MODEL_NAME:
+            if (WriteModelName(fd) == PASS) {
+                gDoCommGblData.DisConnCount = 0;
+                curReg = REG_CONNECTOR_ID;
+            }
+            break;
+
+        case REG_CONNECTOR_ID:
+            if (readConnectorID(fd) == PASS) {
+                gDoCommGblData.DisConnCount = 0;
+                curReg = REG_REPORT_CSU_VERSION;
+            }
+            break;
+
+        case REG_POWER_CABINET_STATUS:
+            if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > LOOP_RETRY_TIME) {
+                readPowerCabinetStatus(fd);
+                ftime(&gRegTimeUp[plugNum][curReg]);
+            }
+            curReg = REG_DISPENSER_STATUS;
+            break;
+
+        case REG_DISPENSER_STATUS:
+            if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > LOOP_RETRY_TIME) {
+                writeDispenserStatus(fd);
+                ftime(&gRegTimeUp[plugNum][curReg]);
+            }
+            curReg = REG_PLUG_IN_STATE;
+            break;
+
+        //case REG_CHARGING_CAP:
+        //    readChargingCapability(fd, plugNum, gunID);
+        //    break;
+
+        //case REG_CHARGING_TARGET:
+        //    writeChargingTarget(fd, plugNum, gunID);
+        //    break;
+
+        //case REG_SOFTWARE_UPDATE:
+        //    if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > LOOP_RETRY_TIME) {
+        //        readSoftwareUpdate(fd);
+        //        ftime(&gRegTimeUp[plugNum][curReg]);
+        //    }
+        //    curReg = REG_PLUG_IN_STATE;
+        //    break;
+
+        case REG_PLUG_IN_STATE:
+            if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > LOOP_RETRY_TIME) {
+                writePlugInStatus(fd, plugNum, gunID);
+                ftime(&gRegTimeUp[plugNum][curReg]);
+            }
+            curReg = REG_CONNECTOR_STATE;
+            break;
+
+        case REG_CONNECTOR_STATE:
+            if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > LOOP_RETRY_TIME) {
+                writeConnectorState(fd, plugNum, gunID);
+                ftime(&gRegTimeUp[plugNum][curReg]);
+            }
+
+            //check misc command from power cabinet
+            if (gDoCommGblData.MiscCmd != 0) {
+                curReg = gDoCommGblData.MiscCmd;
+            } else {
+                curReg = REG_QRCODE_URL_INFO;
+            }
+            break;
+
+        //case REG_USER_ID:
+        //    writeUserID(fd, gunID, uint8_t *pUserID);
+        //    break;
+
+        //case REG_CHARGING_PERMISSION:
+        //    readChargePermission(fd, gunID);
+        //    break;
+
+        case REG_MISC_CONTROL:
+            readMiscCommand(fd, gunID);
+            isContinue = 0;
+            break;
+
+        case REG_REPORT_CSU_VERSION:
+        case REG_REPORT_OTHER_VERSION:
+            if (gDoCommGblData.MiscCmd != 0) {
+                writeCsuModuleVersion(fd);
+                writeOtherModuleVersion(fd);
+                clearMiscCommand();
+                isContinue = 0;
+            } else {
+                //power up write dispenser version and get power cabinet system ID
+                if ((writeCsuModuleVersion(fd) == PASS) &&
+                        (writeOtherModuleVersion(fd) == PASS) &&
+                        (readPowerCabinetSystemID(fd) == PASS)) {
+                    gDoCommGblData.DisConnCount = 0;
+                    isContinue = 0;
+                }
+            }
+            break;
+
+        //case REG_PRESENT_CHARGING_INFO:
+        //    break;
+
+        case REG_QRCODE_URL_INFO:
+            if (gunID == 1) {
+                if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > (LOOP_RETRY_TIME * 10)) {
+                    readPowerCabinetSystemID(fd);
+                    ftime(&gRegTimeUp[plugNum][curReg]);
+                }
+            }
+            isContinue = 0;
+            //curReg = REG_WAIT_PLUG_IT_STATE;
+            break;
+
+        //case REG_WAIT_PLUG_IT_STATE:
+        //    if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > (LOOP_RETRY_TIME / 10)) {
+        //        writeWaitPlugItState(fd, gunID);
+        //        ftime(&gRegTimeUp[plugNum][curReg]);
+        //    }
+        //    isContinue = 0;
+        //    break;
+
+        default:
+            break;
+        }
+
+        if (gDoCommGblData.DisConnCount >= CHECK_NETWORK_FAIL_COUNT) {
+            return DISPENSER_SOCKET_RECONN;
+        }
+    }//for
+
+    return ret;
+}
+
+static void systemStatusProcess(int fd, uint8_t plugNum, uint8_t gunID)
+{
+    struct timeb AuthNowTime = {0};
+
+    switch (ChargingData[plugNum]->SystemStatus) {
+    case S_IDLE:
+    case S_RESERVATION:
+    case S_MAINTAIN:
+    case S_ALARM:
+    case S_AUTHORIZING:
+        checkAuthorProcess(fd, plugNum);
+
+        //authorization complete, write wait plug it state
+        if (gAudiCustInfo->PricesInfo[plugNum].Balance != FAIL_BALANCE_PRICES) {
+            ftime(&AuthNowTime);
+            if (DiffTimeb(gRegTimeUp[plugNum][REG_WAIT_PLUG_IT_STATE], AuthNowTime) > (LOOP_RETRY_TIME / 10)) {
+                writeWaitPlugItState(fd, gunID);
+                ftime(&gRegTimeUp[plugNum][REG_WAIT_PLUG_IT_STATE]);
+            }
+        }
+
+        //check update firmware
+        //if (ChargingData[plugNum]->SystemStatus == S_IDLE) {
+        //    ftime(&AuthNowTime);
+        //    if (DiffTimeb(gRegTimeUp[plugNum][REG_SOFTWARE_UPDATE], AuthNowTime) > LOOP_RETRY_TIME) {
+        //        readSoftwareUpdate(fd);
+        //        ftime(&gRegTimeUp[plugNum][REG_SOFTWARE_UPDATE]);
+        //    }
+        //}
+        break;
+
+    case S_PREPARNING: //get permission
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_CONNECTOR_STATE], AuthNowTime) > LOOP_RETRY_TIME) {
+            writeConnectorState(fd, plugNum, gunID);
+            ftime(&gRegTimeUp[plugNum][REG_CONNECTOR_STATE]);
+        }
+
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_PERMISSION], AuthNowTime) > LOOP_RETRY_TIME) {
+            if (readChargePermission(fd, gunID) && readChargingCapability(fd, gunID)) {
+                ShmPsuData->SystemAvailablePower = (ChargingData[0]->AvailableChargingPower +
+                                                    ChargingData[1]->AvailableChargingPower);
+                ShmPsuData->SystemPresentPsuQuantity = (ShmPsuData->SystemAvailablePower / 30);
+            }
+            ftime(&gRegTimeUp[plugNum][REG_CHARGING_PERMISSION]);
+        }
+
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_PRESENT_CHARGING_INFO], AuthNowTime) > LOOP_RETRY_TIME) {
+            writePresentChargingInfo(fd, plugNum, gunID);
+            ftime(&gRegTimeUp[plugNum][REG_PRESENT_CHARGING_INFO]);
+        }
+        break;
+
+    case S_PREPARING_FOR_EV://wait connector lock
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_CAP], AuthNowTime) > LOOP_RETRY_TIME) {
+            readChargingCapability(fd, gunID);
+            ftime(&gRegTimeUp[plugNum][REG_CHARGING_CAP]);
+        }
+
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_PERMISSION], AuthNowTime) > LOOP_RETRY_TIME) {
+            if (readChargePermission(fd, gunID) == 0) {
+                DEBUG_INFO("Stop charging by power cabinet's permission = %d, %d\r\n",
+                           plugNum,
+                           REG_CHARGING_PERMISSION);
+                ChargingData[plugNum]->StopChargeFlag = 1;
+            }
+            ftime(&gRegTimeUp[plugNum][REG_CHARGING_PERMISSION]);
+        }
+
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_PRESENT_CHARGING_INFO], AuthNowTime) > LOOP_RETRY_TIME) {
+            writePresentChargingInfo(fd, plugNum, gunID);
+            ftime(&gRegTimeUp[plugNum][REG_PRESENT_CHARGING_INFO]);
+        }
+        break;
+
+    case S_PREPARING_FOR_EVSE: //insaulation test
+    case S_CCS_PRECHARGE_ST0:
+    case S_CCS_PRECHARGE_ST1:
+        writeChargingTarget(fd, plugNum, gunID);
+
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_CAP], AuthNowTime) > LOOP_RETRY_TIME) {
+            readChargingCapability(fd, gunID);
+            ftime(&gRegTimeUp[plugNum][REG_CHARGING_CAP]);
+        }
+
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_PERMISSION], AuthNowTime) > LOOP_RETRY_TIME) {
+            if (readChargePermission(fd, gunID) == 0) {
+                DEBUG_INFO("Stop charging by power cabinet's permission = %d, %d\r\n",
+                           plugNum,
+                           REG_CHARGING_PERMISSION);
+                ChargingData[plugNum]->StopChargeFlag = 1;
+            }
+            ftime(&gRegTimeUp[plugNum][REG_CHARGING_PERMISSION]);
+        }
+
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_PRESENT_CHARGING_INFO], AuthNowTime) > LOOP_RETRY_TIME) {
+            writePresentChargingInfo(fd, plugNum, gunID);
+            ftime(&gRegTimeUp[plugNum][REG_PRESENT_CHARGING_INFO]);
+        }
+        break;
+
+    case S_CHARGING: //charging
+    case S_TERMINATING:
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_CAP], AuthNowTime) > LOOP_RETRY_TIME) {
+            readChargingCapability(fd, gunID);
+            ftime(&gRegTimeUp[plugNum][REG_CHARGING_CAP]);
+        }
+
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_PERMISSION], AuthNowTime) > LOOP_RETRY_TIME) {
+            if (readChargePermission(fd, gunID) == 0) {
+                DEBUG_INFO("Stop charging by power cabinet's permission = %d, %d\r\n",
+                           plugNum,
+                           REG_CHARGING_PERMISSION);
+                ChargingData[plugNum]->StopChargeFlag = 1;
+            }
+            ftime(&gRegTimeUp[plugNum][REG_CHARGING_PERMISSION]);
+        }
+        writeChargingTarget(fd, plugNum, gunID);
+
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_PRESENT_CHARGING_INFO], AuthNowTime) > LOOP_RETRY_TIME) {
+            writePresentChargingInfo(fd, plugNum, gunID);
+            ftime(&gRegTimeUp[plugNum][REG_PRESENT_CHARGING_INFO]);
+        }
+        break;
+
+    case S_COMPLETE:
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_CAP], AuthNowTime) > LOOP_RETRY_TIME) {
+            readChargingCapability(fd, gunID);
+            ftime(&gRegTimeUp[plugNum][REG_CHARGING_CAP]);
+        }
+        break;
+
+    default:
+        break;
+    }
+}
+
+static int networkCreatePorcess(void)
+{
+    int fd = 0;
+
+    /**************** Check Network **********/
+    DEBUG_INFO("Check Dispenser Network Information");
+    while (!CheckNetworkStatus()) {
+        calDisconnectCount(&gDoCommGblData.DisConnCount, CHECK_NETWORK_FAIL_COUNT);
+        DEBUG_ERROR("disconnect count = % d\r\n", gDoCommGblData.DisConnCount);
+    }
+    DEBUG_INFO("Dispenser Network Information checked: IP = % s Netmask = % s, Gateway = % s",
+               ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
+               ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,
+               ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
+
+    gDoCommGblData.DisConnCount = 0;
+
+    /**************** Power cabinet connection **********/
+    DEBUG_INFO("Connect to Power Cabinet");
+    while ((fd = doCommConnToServer()) <= 0) {
+        calDisconnectCount(&gDoCommGblData.DisConnCount, CONNECT_SERVER_FAIL_COUNT);
+        DEBUG_ERROR("disconnect count = %d, fd = %d\r\n", gDoCommGblData.DisConnCount, fd);
+    }
+    DEBUG_INFO("Power cabinet connected(fd = % d): IP = % s Netmask = % s, Gateway = % s",
+               fd,
+               ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
+               ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,
+               ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
+
+    gDoCommGblData.DisConnCount = 0;
+
+    sleep(3);
+
+    setTcpStatus(NORMAL);
+
+    return fd;
+}
+
+int main(int argc, char *argv[])
+{
+    uint8_t plugNum = 0, gunID = 0;
+    uint8_t index = 0;
+    uint8_t totalConnCount = 0;
+    uint8_t initDone = DISPENER_INIT_FAIL;
+    int fd = 0;
+    int isContinue = 1;
+
+    InitSocketSigPipe();
+
+    /**************** Initialization **********/
+    if (InitShareMemory() == 0) {
+        if (ShmStatusCodeData != NULL) {
+            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = YES;
+        }
+
+        DEBUG_ERROR("DoComm Initial share memory fail\r\n");
+        sleep(5);
+
+        return 0;
+    }
+
+    totalConnCount =  ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
+
+    for (index = 0; index < totalConnCount; index++) {
+        if (!FindChargingInfoData(index, &ChargingData[0])) {
+            DEBUG_ERROR("FindChargingInfoData false \n");
+            break;
+        }
+        gAudiCustInfo->PricesInfo[index].Balance = FAIL_BALANCE_PRICES;
+    }
+
+    //initial trigger message timer
+    for (index = 0; index < MAX_REGISTER_NUM; index++) {
+        ftime(&gRegTimeUp[0][index]);
+        ftime(&gRegTimeUp[1][index]);
+        usleep(50000);
+    }
+
+    setTcpStatus(NORMAL);
+
+    while (isContinue) {
+        if (initDone == DISPENER_INIT_FAIL) {
+            fd = networkCreatePorcess();
+
+            initDone = messageTrigger(fd, 0, 0, REG_MODEL_NAME); //first trigger model name and connector id
+        } else {
+            checkAuthorProcess(fd, 0);
+
+            plugNum = 0;
+            gunID = 0;
+            for (plugNum = 0; plugNum < totalConnCount; plugNum++) {
+                //plugNum = setup chargingData value for bottom layer
+                gunID = (plugNum  + 1); //connector Id, 1 = left gun, 2 = right gun
+                systemStatusProcess(fd, plugNum, gunID);
+
+                if ((initDone = messageTrigger(fd,
+                                               plugNum,
+                                               gunID,
+                                               REG_POWER_CABINET_STATUS)) == DISPENSER_SOCKET_RECONN) {
+                    break;
+                }
+            }
+        }
+
+        if (initDone == DISPENSER_SOCKET_RECONN) {
+            DEBUG_INFO("Disconnected from power cabinet...re-connecting");
+            setTcpStatus(ABNORMAL);
+
+            gDoCommGblData.DisConnCount = 0;
+            gDoCommGblData.SeqNum = 0;
+
+            closeSocket(fd);
+            fd = 0;
+
+            initDone = DISPENER_INIT_FAIL;
+        }
+    }
+}

+ 203 - 0
EVSE/Projects/DD360Audi/Apps/ReDoComm.h

@@ -0,0 +1,203 @@
+#ifndef _DO_COMM_H_
+#define _DO_COMM_H_
+
+//------------------------------------------------------------------------------
+//--- common define ---
+//------------------------------------------------------------------------------
+#define CMP_ETH_IP_HEAD                         "192.168.100"
+
+#define DoIPAddress                             "192.168.100.1"
+#define DoTcpPort                               36000
+
+#define IMAGE_FILE_PATH                         "../mnt"
+#define TFTP_PULL_CMD                           "tftp"
+#define SIGTERM_MSG                             "SegmentFault.~~~~\n"
+
+#define MAX_REGISTER_NUM                        30
+
+#define CHECK_NETWORK_FAIL_COUNT                10
+#define CONNECT_SERVER_FAIL_COUNT               5
+#define WARNING_CODE_SIZE                       6
+
+#define MAX_VOLTAGE                             10000
+#define MAX_CURRENCY                            5000
+#define MAX_POWER                               3600
+
+#define DISPENSER_INIT_SUCC                     0x01
+#define DISPENER_INIT_FAIL                      0x02
+#define DISPENSER_SOCKET_RECONN                 0x03
+
+#define VERSION_BUF_SIZE                        32
+
+#define PRICES_UNIT                             0.01
+
+#define PASS                                    (1)
+#define FAIL                                    (-1)
+
+#define YES                                     (1)
+#define NO                                      (0)
+
+#define NO_DEFINE                               255
+
+#define LOOP_RETRY_TIME                         1000 //1 second
+
+#define NORMAL                                  0
+#define ABNORMAL                                1
+
+//------------------------------------------------------------------------------
+//--- dispenser ID ---
+//------------------------------------------------------------------------------
+#define ID_RESERVER                             0x00
+#define ID_OF_DISPENSER                         0x01
+#define ID_REGISTER                             0xFF
+
+//------------------------------------------------------------------------------
+//--- dispenser operation ---
+//------------------------------------------------------------------------------
+#define OP_READ_DATA                            0x01
+#define OP_WRITE_DATA                           0x02
+#define OP_WAIT_RESPONSE                        0x03
+
+//------------------------------------------------------------------------------
+//--- dispenser register ---
+//------------------------------------------------------------------------------
+#define REG_MODEL_NAME                          0x01
+#define REG_CONNECTOR_ID                        0x02
+#define REG_POWER_CABINET_STATUS                0x03
+#define REG_DISPENSER_STATUS                    0x04
+#define REG_CHARGING_CAP                        0x05
+#define REG_CHARGING_TARGET                     0x06
+#define REG_SOFTWARE_UPDATE                     0x07
+#define REG_PLUG_IN_STATE                       0x08
+#define REG_CONNECTOR_STATE                     0x09
+#define REG_USER_ID                             0x0A
+#define REG_CHARGING_PERMISSION                 0x0B
+#define REG_MISC_CONTROL                        0X0C
+#define REG_REPORT_CSU_VERSION                  0X0D
+#define REG_REPORT_OTHER_VERSION                0X0E
+#define REG_PRESENT_CHARGING_INFO               0X0F
+#define REG_QRCODE_URL_INFO                     0X10
+#define REG_WAIT_PLUG_IT_STATE                  0x11
+
+//------------------------------------------------------------------------------
+//--- dispenser result ---
+//------------------------------------------------------------------------------
+#define COMMAND_RESULT_OK                       0x01
+#define COMMAND_RESULT_NG                       0x02
+
+//------------------------------------------------------------------------------
+//--- power cabinet misc status code ---
+//------------------------------------------------------------------------------
+#define MISC_ST_MISC_CMD                        "B40001"
+
+#define MISC_ST_VERSION                         "B40999"
+
+//------------------------------------------------------------------------------
+//--- power cabinet misc command ---
+//------------------------------------------------------------------------------
+#define MISC_CMD_CONNECOTOR_TIMEOUT             0X0001
+#define MISC_CMD_OPERATIVE_STATE                0X0002
+#define MISC_CMD_DEFAULT_PRICES                 0x0003
+#define MISC_CMD_DEFAULT_CURRENCY               0x0004
+#define MISC_CMD_ACCOUNT_BALANCE                0x0005
+
+#define MISC_CMD_HARDWARE_REBOOT                0x0101
+#define MISC_CMD_SOFTWARE_RESTART               0x0102
+#define MISC_CMD_REMOTE_START_CHARGING          0x0103
+
+//------------------------------------------------------------------------------
+#pragma pack(push)
+#pragma pack(1)
+
+typedef struct StDoCommGlobalVar {
+    uint8_t SeqNum;
+    uint8_t DisConnCount;
+    uint8_t ConnectorID[2]; //keep from power cabinet
+    uint8_t MiscCmd;
+    uint8_t Reserved[4];
+} DoCommGblData;
+
+typedef struct StCommnadHead {
+    uint8_t SeqNum;     //sequence number 0 ~ 255
+    uint8_t ID;         //0: Reserved, 0x01 ~ 0xFE: connector ID, 0xFF: exists in register 1 and register 2
+    uint8_t OP;         //0x01: read, 0x02: write, 0x03: response from power cabinet
+    uint8_t DataLen;    //raw data Length
+} CmdHead;
+
+typedef struct StCommandData {
+    uint8_t Register;   /*  0x01: dispenser model name (maximum 32 bytes) and the value of dispenser switch
+                            0x02: The ID to connector equipped at dispenser
+                            0x03: Power cabinet status
+                            0x04: Dispenser status
+                            0x05: The charging capacity of each connector
+                            0x06: The required voltage and current during charging
+                            0x07: The indicator of software update to dispenser
+                            0x08: Indicate whether the connector is plug-in or not
+                            0x09: Indicate the connector state
+                            0x0A: The user ID can be RFID card number, EVCCID, etc.
+                            0x0B: Charging permission from power cabinet to dispenser
+                        */
+    uint8_t Data[250];
+} CmdData;
+
+typedef struct StResultData {
+    uint8_t Register;   /*  0x01: dispenser model name (maximum 32 bytes) and the value of dispenser switch
+                            0x02: The ID to connector equipped at dispenser
+                            0x03: Power cabinet status
+                            0x04: Dispenser status
+                            0x05: The charging capacity of each connector
+                            0x06: The required voltage and current during charging
+                            0x07: The indicator of software update to dispenser
+                            0x08: Indicate whether the connector is plug-in or not
+                            0x09: Indicate the connector state
+                            0x0A: The user ID can be RFID card number, EVCCID, etc.
+                            0x0B: Charging permission from power cabinet to dispenser
+                        */
+    uint8_t Result;
+    uint8_t Data[249];
+} ResultData;
+
+typedef struct StCsuCmdPkt {
+    CmdHead Head;
+    CmdData Data;
+} CsuCmdPkt;
+
+typedef struct StCsuResultPkt {
+    CmdHead Head;
+    ResultData Data;
+} CsuResultPkt;
+
+typedef struct StMiscCommand {
+    uint16_t CMD;
+    uint8_t Value[4];
+} MiscCommand;
+
+typedef struct StPresentChargingInfo {
+    int EvBatterySoc;               // 0~100%
+    int RemainChargingDuration;     // second
+    float PresentChargingVoltage;   //0~6553.5 volt
+    float PresentChargingCurrent;   //0~6553.5 amp
+} PreChargingInfo;
+
+typedef struct StSoftwareUpdInfo {
+    uint8_t ImgName[249];
+} SoftwareUpdInfo;
+
+typedef struct StCapabilityInfo {
+    uint16_t OutputVoltage;
+    uint16_t OutputCurrent;
+    uint16_t OutputPower;
+    uint8_t Reserved[2];
+} CapabilityInfo;
+
+typedef struct StAccountInfo {
+    uint8_t Currency;
+    int UserPrices;
+    int TotalCost;
+    int Balance;
+    uint8_t Reserved[3];
+} AccountInfo;
+
+#pragma pack(pop)
+
+#endif /* _DO_COMM_H_ */

BIN
EVSE/Projects/DD360Audi/Apps/ReadCmdline


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 475 - 590
EVSE/Projects/DD360Audi/Apps/ReadCmdline.c


BIN
EVSE/Projects/DD360Audi/Apps/UnsafetyOutputTask


+ 1 - 1
EVSE/Projects/DD360Audi/Apps/init.sh

@@ -8,4 +8,4 @@ chmod 777 Module_PsuComm
 chmod 777 OcppBackend
 chmod 777 kill.sh
 chmod 777 ReadCmdline
-
+chmod 777 DoComm

+ 1060 - 1114
EVSE/Projects/DD360Audi/Apps/internalComm.c

@@ -1,1257 +1,1203 @@
 /*
  * internalComm.c
  *
- *  Created on: 2019¦~5¤ë7¤é
+ *  Created on: 2019年5月7日
  *      Author: foluswen
  */
-#include 	<sys/time.h>
-#include 	<sys/timeb.h>
+#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/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>      /*¼Ð·Ç¿é¤J¿é¥X©w¸q*/
-#include    <stdlib.h>     /*¼Ð·Ç¨ç¼Æ®w©w¸q*/
-#include    <unistd.h>     /*Unix ¼Ð·Ç¨ç¼Æ©w¸q*/
-#include    <fcntl.h>      /*Àɱ±¨î©w¸q*/
-#include    <termios.h>    /*PPSIX ²×ºÝ±±¨î©w¸q*/
-#include    <errno.h>      /*¿ù»~¸¹©w¸q*/
-#include 	<errno.h>
-#include 	<string.h>
-#include	<time.h>
-#include	<ctype.h>
-#include 	<ifaddrs.h>
-#include 	<math.h>
-#include 	"internalComm.h"
-
-#define PASS				1
-#define FAIL				-1
-
-#ifndef DD360
-struct Address Addr={0x01,0x02,0x03,0x05,0x06,0xFF};
+#include    <sys/types.h>
+#include    <sys/ioctl.h>
+#include    <sys/socket.h>
+#include    <sys/ipc.h>
+#include    <sys/shm.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    <errno.h>
+#include    <string.h>
+#include    <time.h>
+#include    <ctype.h>
+#include    <ifaddrs.h>
+#include    <math.h>
+#include    "internalComm.h"
+
+#define PASS                1
+#define FAIL                -1
+
+#if !defined DD360 && !defined DD360Audi
+struct Address Addr = {0x01, 0x02, 0x03, 0x05, 0x06, 0xFF};
 #else
-struct Address Addr={0x01,0x02,0x09,0x05,0x06,0xFF};
-#endif
+struct Address Addr = {0x01, 0x02, 0x09, 0x05, 0x06, 0xFF};
+#endif //!defined DD360 || !define DD360Audi
 
-struct Command Cmd={0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x24,0x27,0x28,0x29,0x2C,0x81,0x83,
-		0x85,0x86,0x87,0x88,0x089,0x8A,0x8B,0x8C,0x90,0x93,0xe0,0xe1,0xe2,0xe3};
+struct Command Cmd = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x24, 0x27, 0x28, 0x29, 0x2C, 0x81, 0x83,
+           0x85, 0x86, 0x87, 0x88, 0x089, 0x8A, 0x8B, 0x8C, 0x90, 0x93, 0xe0, 0xe1, 0xe2, 0xe3
+};
 
-int tranceiveRelDelayTime(int fd, unsigned char* cmd, unsigned char cmd_len, unsigned char* rx, unsigned short _delay)
+int tranceiveRelDelayTime(int fd, unsigned char *cmd, unsigned char cmd_len, unsigned char *rx, unsigned short _delay)
 {
-	int len;
-	//sleep(2); //required to make flush work, for some reason
-	tcflush(fd,TCIOFLUSH);
-
-	if(write(fd, cmd, cmd_len) >= cmd_len)
-	{
-		usleep(_delay * 1000);
-		len = read(fd, rx, 512);
-	}
-	else
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("Serial command %s response fail.\n", cmd);
-		#endif
-	}
-
-	return len;
+    int len;
+    //sleep(2); //required to make flush work, for some reason
+    tcflush(fd, TCIOFLUSH);
+
+    if (write(fd, cmd, cmd_len) >= cmd_len) {
+        usleep(_delay * 1000);
+        len = read(fd, rx, 512);
+    } else {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("Serial command %s response fail.\n", cmd);
+#endif
+    }
+
+    return len;
 }
 
-int tranceive(int fd, unsigned char* cmd, unsigned char cmd_len, unsigned char* rx)
+int tranceive(int fd, unsigned char *cmd, unsigned char cmd_len, unsigned char *rx)
 {
-	int len;
-	//sleep(2); //required to make flush work, for some reason
-	tcflush(fd,TCIOFLUSH);
-
-	if(write(fd, cmd, cmd_len) >= cmd_len)
-	{
-		usleep(15000);
-		len = read(fd, rx, 512);
-	}
-	else
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("Serial command %s response fail.\n", cmd);
-		#endif
-	}
-
-	return len;
+    int len;
+    //sleep(2); //required to make flush work, for some reason
+    tcflush(fd, TCIOFLUSH);
+
+    if (write(fd, cmd, cmd_len) >= cmd_len) {
+        usleep(15000);
+        len = read(fd, rx, 512);
+    } else {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("Serial command %s response fail.\n", cmd);
+#endif
+    }
+
+    return len;
 }
 
 unsigned char Query_FW_Ver(unsigned char fd, unsigned char targetAddr, Ver *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_FW_Ver, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-//		for (int i = 0; i < 7; i++)
-//			printf("tx = %x \n", tx[i]);
-//		for (int i = 0; i < len; i++)
-//			printf("rx = %x \n", rx[i]);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-			memcpy(Ret_Buf->Version_FW, (char *)rx+6, (rx[4] | rx[5]<<8));
-			*(Ret_Buf->Version_FW + 8) = 0x00;
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_FW_Ver, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+//      for (int i = 0; i < 7; i++)
+//          printf("tx = %x \n", tx[i]);
+//      for (int i = 0; i < len; i++)
+//          printf("rx = %x \n", rx[i]);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            memcpy(Ret_Buf->Version_FW, (char *)rx + 6, (rx[4] | rx[5] << 8));
+            *(Ret_Buf->Version_FW + 8) = 0x00;
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_HW_Ver(unsigned char fd, unsigned char targetAddr, Ver *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_HW_Ver, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-			memcpy(Ret_Buf->Version_HW, (char *)rx+6, (rx[4] | rx[5]<<8));
-			*(Ret_Buf->Version_HW + 8) = 0x00;
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_HW_Ver, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            memcpy(Ret_Buf->Version_HW, (char *)rx + 6, (rx[4] | rx[5] << 8));
+            *(Ret_Buf->Version_HW + 8) = 0x00;
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_Present_InputVoltage(unsigned char fd, unsigned char targetAddr, PresentInputVoltage *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Present_InputVoltage, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 13)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]) &&
-		   chksum != 0)
-		{
-			Ret_Buf->inputType = rx[6];
-			Ret_Buf->L1N_L12 =(rx[7] | (rx[8]<<8))/10.0;
-			Ret_Buf->L2N_L23 =(rx[9] | (rx[10]<<8))/10.0;
-			Ret_Buf->L3N_L31 =(rx[11] | (rx[12]<<8))/10.0;
-
-			if (Ret_Buf->L1N_L12 >= 320 ||
-					Ret_Buf->L2N_L23 >= 320 ||
-					Ret_Buf->L3N_L31 >= 320)
-			{
-				result = FAIL;
-			}
-			else
-				result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Present_InputVoltage, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 13) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                chksum != 0) {
+            Ret_Buf->inputType = rx[6];
+            Ret_Buf->L1N_L12 = (rx[7] | (rx[8] << 8)) / 10.0;
+            Ret_Buf->L2N_L23 = (rx[9] | (rx[10] << 8)) / 10.0;
+            Ret_Buf->L3N_L31 = (rx[11] | (rx[12] << 8)) / 10.0;
+
+            if (Ret_Buf->L1N_L12 >= 320 ||
+                    Ret_Buf->L2N_L23 >= 320 ||
+                    Ret_Buf->L3N_L31 >= 320) {
+                result = FAIL;
+            } else {
+                result = PASS;
+            }
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_Present_OutputVoltage(unsigned char fd, unsigned char targetAddr, PresentOutputVoltage *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Present_OutputVoltage, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-
-			Ret_Buf->behindFuse_Voltage_C1 =(rx[6] | (rx[7]<<8));
-			Ret_Buf->behindRelay_Voltage_C1 =(rx[8] | (rx[9]<<8));
-			if((rx[4] | rx[5]<<8) > 4)
-			{
-				Ret_Buf->behindFuse_Voltage_C2 =(rx[10] | (rx[11]<<8));
-				Ret_Buf->behindRelay_Voltage_C2 =(rx[12] | (rx[13]<<8));
-			}
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Present_OutputVoltage, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+
+            Ret_Buf->behindFuse_Voltage_C1 = (rx[6] | (rx[7] << 8));
+            Ret_Buf->behindRelay_Voltage_C1 = (rx[8] | (rx[9] << 8));
+            if ((rx[4] | rx[5] << 8) > 4) {
+                Ret_Buf->behindFuse_Voltage_C2 = (rx[10] | (rx[11] << 8));
+                Ret_Buf->behindRelay_Voltage_C2 = (rx[12] | (rx[13] << 8));
+            }
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_Fan_Speed(unsigned char fd, unsigned char targetAddr, FanSpeed *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Fan_Speed, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-			for(int idx=0;idx < 4;idx++)
-				Ret_Buf->speed[idx] = (rx[6+(2*idx)] | (rx[6+(2*idx)+1]<<8));
-
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Fan_Speed, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            for (int idx = 0; idx < 4; idx++) {
+                Ret_Buf->speed[idx] = (rx[6 + (2 * idx)] | (rx[6 + (2 * idx) + 1] << 8));
+            }
+
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_Temperature(unsigned char fd, unsigned char targetAddr, Temperature *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Temperature, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-			for(int idx=0;idx < 4;idx++)
-				Ret_Buf->temperature[idx] = rx[6+idx] - 60;
-
-			result = PASS;
-		}
-	}
-
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Temperature, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            for (int idx = 0; idx < 4; idx++) {
+                Ret_Buf->temperature[idx] = rx[6 + idx] - 60;
+            }
+
+            result = PASS;
+        }
+    }
+
+
+    return result;
 }
 
 unsigned char Query_Aux_PowerVoltage(unsigned char fd, unsigned char targetAddr, AuxPower *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Aux_PowerVoltage, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-			for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
-				Ret_Buf->voltage[idx] = rx[6+idx];
-
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Aux_PowerVoltage, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+                Ret_Buf->voltage[idx] = rx[6 + idx];
+            }
+
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_Relay_Output(unsigned char fd, unsigned char targetAddr, Relay *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Relay_Output, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-//	for (int i = 0; i < 7; i++)
-//		printf("tx = %x \n", tx[i]);
-//	for (int i = 0; i < len; i++)
-//		printf("rx = %x \n", rx[i]);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-			Ret_Buf->relay_event.bits.AC_Contactor = (rx[6] >> 0) & 0x01;
-			Ret_Buf->relay_event.bits.CCS_Precharge = (rx[6] >> 1) & 0x01;
-
-			Ret_Buf->relay_event.bits.Gun1_N = (rx[7] >> 0) & 0x01;
-			Ret_Buf->relay_event.bits.Gun1_P = (rx[7] >> 1) & 0x01;
-			Ret_Buf->relay_event.bits.Gun1_Parallel_N = (rx[7] >> 2) & 0x01;
-			Ret_Buf->relay_event.bits.Gun1_Parallel_P = (rx[7] >> 3) & 0x01;
-
-			Ret_Buf->relay_event.bits.Gun2_N = (rx[8] >> 0) & 0x01;
-			Ret_Buf->relay_event.bits.Gun2_P = (rx[8] >> 1) & 0x01;
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Relay_Output, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+//  for (int i = 0; i < 7; i++)
+//      printf("tx = %x \n", tx[i]);
+//  for (int i = 0; i < len; i++)
+//      printf("rx = %x \n", rx[i]);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            Ret_Buf->relay_event.bits.AC_Contactor = (rx[6] >> 0) & 0x01;
+            Ret_Buf->relay_event.bits.CCS_Precharge = (rx[6] >> 1) & 0x01;
+
+            Ret_Buf->relay_event.bits.Gun1_N = (rx[7] >> 0) & 0x01;
+            Ret_Buf->relay_event.bits.Gun1_P = (rx[7] >> 1) & 0x01;
+            Ret_Buf->relay_event.bits.Gun1_Parallel_N = (rx[7] >> 2) & 0x01;
+            Ret_Buf->relay_event.bits.Gun1_Parallel_P = (rx[7] >> 3) & 0x01;
+
+            Ret_Buf->relay_event.bits.Gun2_N = (rx[8] >> 0) & 0x01;
+            Ret_Buf->relay_event.bits.Gun2_P = (rx[8] >> 1) & 0x01;
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_Gfd_Adc(unsigned char fd, unsigned char targetAddr, Gfd *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Gfd_Adc, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-//	for(int i = 0; i < 7; i++)
-//		printf ("tx = %d \n", tx[i]);
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-		{
-			//printf("Query_Gfd_Adc fail \n");
-			return result;
-		}
-
-//		for(int i = 0; i < len; i++)
-//			printf ("rx = %d \n", rx[i]);
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-			Ret_Buf->Resister_conn1 = (rx[6] | (rx[7] << 8));
-			Ret_Buf->voltage_conn1 = (rx[8] | (rx[9] << 8));
-			Ret_Buf->result_conn1 = rx[10];
-			Ret_Buf->rb_step_1 = rx[11];
-
-			Ret_Buf->Resister_conn2 = (rx[12] | (rx[13] << 8));
-			Ret_Buf->voltage_conn2 = (rx[14] | (rx[15] << 8));
-			Ret_Buf->result_conn2 = rx[16];
-			Ret_Buf->rb_step_2 = rx[17];
-
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Gfd_Adc, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+//  for(int i = 0; i < 7; i++)
+//      printf ("tx = %d \n", tx[i]);
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            //printf("Query_Gfd_Adc fail \n");
+            return result;
+        }
+
+//      for(int i = 0; i < len; i++)
+//          printf ("rx = %d \n", rx[i]);
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            Ret_Buf->Resister_conn1 = (rx[6] | (rx[7] << 8));
+            Ret_Buf->voltage_conn1 = (rx[8] | (rx[9] << 8));
+            Ret_Buf->result_conn1 = rx[10];
+            Ret_Buf->rb_step_1 = rx[11];
+
+            Ret_Buf->Resister_conn2 = (rx[12] | (rx[13] << 8));
+            Ret_Buf->voltage_conn2 = (rx[14] | (rx[15] << 8));
+            Ret_Buf->result_conn2 = rx[16];
+            Ret_Buf->rb_step_2 = rx[17];
+
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_Gpio_Input(unsigned char fd, unsigned char targetAddr, Gpio_in *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Gpio_In, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-			Ret_Buf->AC_Connector 		= (rx[6] >> 0) & 0x01;
-			Ret_Buf->AC_MainBreaker 	= (rx[6] >> 1) & 0x01;
-			Ret_Buf->SPD 				= (rx[6] >> 2) & 0x01;	
-			Ret_Buf->Door_Open 			= ((rx[6] >> 3) & 0x01);
-			Ret_Buf->GFD[0] 			= (rx[6] >> 4) & 0x01;
-			Ret_Buf->GFD[1] 			= (rx[6] >> 5) & 0x01;
-			Ret_Buf->AC_Drop 			= (rx[6] >> 6) & 0x01;
-
-			Ret_Buf->Emergency_IO		= (rx[7] >> 0) & 0x01;
-
-			Ret_Buf->Button_Emergency_Press	= (rx[8] >> 0) & 0x01;
-			Ret_Buf->Button_On_Press 	= (rx[8] >> 1) & 0x01;
-			Ret_Buf->Button_Off_Press	= (rx[8] >> 2) & 0x01;
-			Ret_Buf->Key_1_Press 		= (rx[8] >> 3) & 0x01;
-			Ret_Buf->Key_2_Press 		= (rx[8] >> 4) & 0x01;
-			Ret_Buf->Key_3_Press 		= (rx[8] >> 5) & 0x01;
-			Ret_Buf->Key_4_Press 		= (rx[8] >> 6) & 0x01;
-
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Gpio_In, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            Ret_Buf->AC_Connector       = (rx[6] >> 0) & 0x01;
+            Ret_Buf->AC_MainBreaker     = (rx[6] >> 1) & 0x01;
+            Ret_Buf->SPD                = (rx[6] >> 2) & 0x01;
+            Ret_Buf->Door_Open          = ((rx[6] >> 3) & 0x01);
+            Ret_Buf->GFD[0]             = (rx[6] >> 4) & 0x01;
+            Ret_Buf->GFD[1]             = (rx[6] >> 5) & 0x01;
+            Ret_Buf->AC_Drop            = (rx[6] >> 6) & 0x01;
+
+            Ret_Buf->Emergency_IO       = (rx[7] >> 0) & 0x01;
+
+            Ret_Buf->Button_Emergency_Press = (rx[8] >> 0) & 0x01;
+            Ret_Buf->Button_On_Press    = (rx[8] >> 1) & 0x01;
+            Ret_Buf->Button_Off_Press   = (rx[8] >> 2) & 0x01;
+            Ret_Buf->Key_1_Press        = (rx[8] >> 3) & 0x01;
+            Ret_Buf->Key_2_Press        = (rx[8] >> 4) & 0x01;
+            Ret_Buf->Key_3_Press        = (rx[8] >> 5) & 0x01;
+            Ret_Buf->Key_4_Press        = (rx[8] >> 6) & 0x01;
+
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_Model_Name(unsigned char fd, unsigned char targetAddr, unsigned char *modelname)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Model_Name, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-			strncpy((char *)modelname, (char *)(rx + 6), (rx[4] | rx[5]<<8));
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_Model_Name, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            strncpy((char *)modelname, (char *)(rx + 6), (rx[4] | rx[5] << 8));
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_Fan_Speed(unsigned char fd, unsigned char targetAddr, FanSpeed *Set_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[15] = {0xaa, 0x00, targetAddr, Cmd.config_Fan_Speed, 0x08, 0x00, Set_Buf->speed[0]&0xff, (Set_Buf->speed[0]>>8)&0xff, Set_Buf->speed[1]&0xff, (Set_Buf->speed[1]>>8)&0xff, Set_Buf->speed[2]&0xff, (Set_Buf->speed[2]>>8)&0xff, Set_Buf->speed[3]&0xff, (Set_Buf->speed[3]>>8)&0xff, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	for(int idx = 0;idx<(tx[4] | tx[5]<<8);idx++)
-		chksum ^= tx[6+idx];
-	tx[14] = chksum;
-
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		chksum = 0x00;
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]) &&
-		   rx[6] == PASS)
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[15] = {0xaa, 0x00, targetAddr, Cmd.config_Fan_Speed, 0x08, 0x00, Set_Buf->speed[0] & 0xff, (Set_Buf->speed[0] >> 8) & 0xff, Set_Buf->speed[1] & 0xff, (Set_Buf->speed[1] >> 8) & 0xff, Set_Buf->speed[2] & 0xff, (Set_Buf->speed[2] >> 8) & 0xff, Set_Buf->speed[3] & 0xff, (Set_Buf->speed[3] >> 8) & 0xff, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[14] = chksum;
+
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                rx[6] == PASS) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_Relay_Output(unsigned char fd, unsigned char targetAddr, Relay *Set_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[10] = {0xaa, 0x00, targetAddr, Cmd.config_Relay_Output, 0x03, 0x00, Set_Buf->relay_event.relay_status[0], Set_Buf->relay_event.relay_status[1], Set_Buf->relay_event.relay_status[2]};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	for(int idx = 0;idx<(tx[4] | tx[5]<<8);idx++)
-		chksum ^= tx[6 + idx];
-	tx[9] = chksum;
-
-//	for (int i = 0; i < 10; i++)
-//		printf("set relay cmd : tx = %x \n", tx[i]);
-
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-//		for (int i = 0; i < len; i++)
-//			printf("set relay cmd : rx = %x \n", rx[i]);
-
-		chksum = 0x00;
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]) &&
-		   rx[6] == PASS)
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[10] = {0xaa, 0x00, targetAddr, Cmd.config_Relay_Output, 0x03, 0x00, Set_Buf->relay_event.relay_status[0], Set_Buf->relay_event.relay_status[1], Set_Buf->relay_event.relay_status[2]};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[9] = chksum;
+
+//  for (int i = 0; i < 10; i++)
+//      printf("set relay cmd : tx = %x \n", tx[i]);
+
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+//      for (int i = 0; i < len; i++)
+//          printf("set relay cmd : rx = %x \n", rx[i]);
+
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                rx[6] == PASS) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_Gpio_Output(unsigned char fd, unsigned char targetAddr, Gpio_out *Set_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[9] = {0xaa, 0x00, targetAddr, Cmd.config_Gpio_Output, 0x01, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	tx[6] |= (Set_Buf->AC_Connector?0x01:0x00);
-
-	for(int idx = 0;idx<2;idx++)
-		tx[6] |= (Set_Buf->Button_LED[idx]?0x01:0x00)<<(1+idx);
-
-	for(int idx = 0;idx<4;idx++)
-			tx[6] |= (Set_Buf->System_LED[idx]?0x01:0x00)<<(3+idx);
-
-	for(int idx = 0;idx<(tx[4] | tx[5]<<8);idx++)
-		chksum ^= tx[6+idx];
-	tx[14] = chksum;
-
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		chksum = 0x00;
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[9] = {0xaa, 0x00, targetAddr, Cmd.config_Gpio_Output, 0x01, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    tx[6] |= (Set_Buf->AC_Connector ? 0x01 : 0x00);
+
+    for (int idx = 0; idx < 2; idx++) {
+        tx[6] |= (Set_Buf->Button_LED[idx] ? 0x01 : 0x00) << (1 + idx);
+    }
+
+    for (int idx = 0; idx < 4; idx++) {
+        tx[6] |= (Set_Buf->System_LED[idx] ? 0x01 : 0x00) << (3 + idx);
+    }
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[14] = chksum;
+
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_Gfd_Value(unsigned char fd, unsigned char targetAddr, Gfd_config *Set_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[9] = {0xaa, 0x00, targetAddr, Cmd.config_Gfd_Value, 0x02, 0x00, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	tx[6] = Set_Buf->index;
-	tx[7] = Set_Buf->state;
-
-	for(int idx = 0; idx<(tx[4] | tx[5]<<8);idx++)
-		chksum ^= tx[6+idx];
-	tx[8] = chksum;
-
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		chksum = 0x00;
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]))
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[9] = {0xaa, 0x00, targetAddr, Cmd.config_Gfd_Value, 0x02, 0x00, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    tx[6] = Set_Buf->index;
+    tx[7] = Set_Buf->state;
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[8] = chksum;
+
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_Model_Name(unsigned char fd, unsigned char targetAddr, unsigned char *modelname)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[21] = {0xaa, 0x00, targetAddr, Cmd.config_Model_Name, 0x0E, 0x00,
-			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	memcpy(tx + 6, modelname, 14);
-
-	for(int idx = 0; idx<(tx[4] | tx[5]<<8);idx++)
-		chksum ^= tx[6+idx];
-	tx[20] = chksum;
-
-//	for(int i = 0; i < 21; i++)
-//				printf ("tx = %x \n", tx[i]);
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-//	for(int i = 0; i < len; i++)
-//					printf ("rx = %x \n", rx[i]);
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		chksum = 0x00;
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-			  (rx[2] == tx[1]) &&
-			  (rx[1] == tx[2]) &&
-			  (rx[3] == tx[3]) &&
-			  rx[6] == PASS)
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[21] = {0xaa, 0x00, targetAddr, Cmd.config_Model_Name, 0x0E, 0x00,
+                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+                           };
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    memcpy(tx + 6, modelname, 14);
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[20] = chksum;
+
+//  for(int i = 0; i < 21; i++)
+//              printf ("tx = %x \n", tx[i]);
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+//  for(int i = 0; i < len; i++)
+//                  printf ("rx = %x \n", rx[i]);
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                rx[6] == PASS) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_Rtc_Data(unsigned char fd, unsigned char targetAddr, Rtc *Set_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[21] = { 0xaa, 0x00, targetAddr, Cmd.config_Rtc_Data, 0x0E, 0x00, Set_Buf->RtcData[0], Set_Buf->RtcData[1],
-			Set_Buf->RtcData[2], Set_Buf->RtcData[3], Set_Buf->RtcData[4], Set_Buf->RtcData[5], Set_Buf->RtcData[6], Set_Buf->RtcData[7],
-			Set_Buf->RtcData[8], Set_Buf->RtcData[9], Set_Buf->RtcData[10], Set_Buf->RtcData[11], Set_Buf->RtcData[12], Set_Buf->RtcData[13]};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++)
-		chksum ^= tx[6 + idx];
-	tx[20] = chksum;
-
-	if (tranceive(fd, tx, sizeof(tx), rx) > 0)
-	{
-		chksum = 0x00;
-		for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++)
-		{
-			chksum ^= rx[6 + idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-				(rx[2] == tx[1]) &&
-				(rx[1] == tx[2]) &&
-				(rx[3] == tx[3]) &&
-				rx[6] == PASS)
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[21] = { 0xaa, 0x00, targetAddr, Cmd.config_Rtc_Data, 0x0E, 0x00, Set_Buf->RtcData[0], Set_Buf->RtcData[1],
+                             Set_Buf->RtcData[2], Set_Buf->RtcData[3], Set_Buf->RtcData[4], Set_Buf->RtcData[5], Set_Buf->RtcData[6], Set_Buf->RtcData[7],
+                             Set_Buf->RtcData[8], Set_Buf->RtcData[9], Set_Buf->RtcData[10], Set_Buf->RtcData[11], Set_Buf->RtcData[12], Set_Buf->RtcData[13]
+                           };
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[20] = chksum;
+
+    if (tranceive(fd, tx, sizeof(tx), rx) > 0) {
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                rx[6] == PASS) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Update_Start(unsigned char fd, unsigned char targetAddr, unsigned int crc32)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[11] = {0xaa, 0x00, targetAddr, Cmd.update_Start, 0x04, 0x00, (crc32>>0)&0xff, (crc32>>8)&0xff, (crc32>>16)&0xff, (crc32>>24)&0xff, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	for(int idx = 0;idx<(tx[4] | tx[5]<<8);idx++)
-		chksum ^= tx[6+idx];
-	tx[10] = chksum;
-
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		chksum = 0x00;
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]) &&
-		   (rx[6] == 0x00))
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[11] = {0xaa, 0x00, targetAddr, Cmd.update_Start, 0x04, 0x00, (crc32 >> 0) & 0xff, (crc32 >> 8) & 0xff, (crc32 >> 16) & 0xff, (crc32 >> 24) & 0xff, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[10] = chksum;
+
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                (rx[6] == 0x00)) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Update_Abord(unsigned char fd, unsigned char targetAddr)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.update_Start, 0x04, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]) &&
-		   (rx[6] == 0x00))
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.update_Start, 0x04, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                (rx[6] == 0x00)) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Update_Transfer(unsigned char fd, unsigned char targetAddr, unsigned int startAddr, unsigned char *data, unsigned short int length)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[11 + length];
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	tx[0] = 0xaa;
-	tx[1] = 0x00;
-	tx[2] = targetAddr;
-	tx[3] = Cmd.update_Transfer;
-	tx[4] = (4 + length) & 0xff;
-	tx[5] = ((4 + length)>>8) & 0xff;
-	tx[6] = (startAddr>>0) & 0xff;
-	tx[7] = (startAddr>>8) & 0xff;
-	tx[8] = (startAddr>>16) & 0xff;
-	tx[9] = (startAddr>>24) & 0xff;
-	memcpy(tx+10, data, length);
-
-	for(int idx = 0;idx<(tx[4] | tx[5]<<8);idx++)
-		chksum ^= tx[6+idx];
-	tx[sizeof(tx)-1] = chksum;
-
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]) &&
-		   (rx[6] == 0x00))
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[11 + length];
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    tx[0] = 0xaa;
+    tx[1] = 0x00;
+    tx[2] = targetAddr;
+    tx[3] = Cmd.update_Transfer;
+    tx[4] = (4 + length) & 0xff;
+    tx[5] = ((4 + length) >> 8) & 0xff;
+    tx[6] = (startAddr >> 0) & 0xff;
+    tx[7] = (startAddr >> 8) & 0xff;
+    tx[8] = (startAddr >> 16) & 0xff;
+    tx[9] = (startAddr >> 24) & 0xff;
+    memcpy(tx + 10, data, length);
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[sizeof(tx) - 1] = chksum;
+
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                (rx[6] == 0x00)) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Update_Finish(unsigned char fd, unsigned char targetAddr)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.update_Finish, 0x04, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]) &&
-		   (rx[6] == 0x00))
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.update_Finish, 0x04, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                (rx[6] == 0x00)) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_AC_Status(unsigned char fd, unsigned char targetAddr, Ac_Status *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_ac_status, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-				(rx[2] == tx[1]) &&
-				(rx[1] == tx[2]) &&
-				(rx[3] == tx[3]))
-		{
-			Ret_Buf->CpStatus = rx[6];
-			Ret_Buf->CurLimit = (rx[7] | (rx[8] << 8));
-			Ret_Buf->PilotVol_P = (rx[9] | (rx[10] << 8));
-			Ret_Buf->PilotVol_N = (rx[11] | (rx[12] << 8));
-			Ret_Buf->LockStatus = rx[13];
-			Ret_Buf->RelayStatus = rx[14];
-			Ret_Buf->ShutterStatus = rx[15];
-			Ret_Buf->MeterStatus = rx[16];
-			Ret_Buf->PpStatus = rx[17];
-			Ret_Buf->MaxCurrent = rx[18];
-			Ret_Buf->RotateSwitchStatus = rx[19];
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_ac_status, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            Ret_Buf->CpStatus = rx[6];
+            Ret_Buf->CurLimit = (rx[7] | (rx[8] << 8));
+            Ret_Buf->PilotVol_P = (rx[9] | (rx[10] << 8));
+            Ret_Buf->PilotVol_N = (rx[11] | (rx[12] << 8));
+            Ret_Buf->LockStatus = rx[13];
+            Ret_Buf->RelayStatus = rx[14];
+            Ret_Buf->ShutterStatus = rx[15];
+            Ret_Buf->MeterStatus = rx[16];
+            Ret_Buf->PpStatus = rx[17];
+            Ret_Buf->MaxCurrent = rx[18];
+            Ret_Buf->RotateSwitchStatus = rx[19];
 //
-//			Ret_Buf->AC_Connector 		= (rx[6] >> 0) & 0x01;
-//			Ret_Buf->AC_MainBreaker 	= (rx[6] >> 1) & 0x01;
-//			Ret_Buf->SPD 				= (rx[6] >> 2) & 0x01;
-//			Ret_Buf->Door_Open 			= (rx[6] >> 3) & 0x01;
-//			Ret_Buf->GFD[0] 			= (rx[6] >> 4) & 0x01;
-//			Ret_Buf->GFD[1] 			= (rx[6] >> 5) & 0x01;
-//			Ret_Buf->AC_Drop 			= (rx[6] >> 6) & 0x01;
+//          Ret_Buf->AC_Connector       = (rx[6] >> 0) & 0x01;
+//          Ret_Buf->AC_MainBreaker     = (rx[6] >> 1) & 0x01;
+//          Ret_Buf->SPD                = (rx[6] >> 2) & 0x01;
+//          Ret_Buf->Door_Open          = (rx[6] >> 3) & 0x01;
+//          Ret_Buf->GFD[0]             = (rx[6] >> 4) & 0x01;
+//          Ret_Buf->GFD[1]             = (rx[6] >> 5) & 0x01;
+//          Ret_Buf->AC_Drop            = (rx[6] >> 6) & 0x01;
 //
-//			Ret_Buf->Emergency_IO		= (rx[7] >> 0) & 0x01;
+//          Ret_Buf->Emergency_IO       = (rx[7] >> 0) & 0x01;
 //
-//			Ret_Buf->Button_Emergency_Press	= (rx[8] >> 0) & 0x01;
-//			Ret_Buf->Button_On_Press 	= (rx[8] >> 1) & 0x01;
-//			Ret_Buf->Button_Off_Press	= (rx[8] >> 2) & 0x01;
-//			Ret_Buf->Key_1_Press 		= (rx[8] >> 3) & 0x01;
-//			Ret_Buf->Key_2_Press 		= (rx[8] >> 4) & 0x01;
-//			Ret_Buf->Key_3_Press 		= (rx[8] >> 5) & 0x01;
-//			Ret_Buf->Key_4_Press 		= (rx[8] >> 6) & 0x01;
-
-			result = PASS;
-		}
-	}
-
-	return result;
+//          Ret_Buf->Button_Emergency_Press = (rx[8] >> 0) & 0x01;
+//          Ret_Buf->Button_On_Press    = (rx[8] >> 1) & 0x01;
+//          Ret_Buf->Button_Off_Press   = (rx[8] >> 2) & 0x01;
+//          Ret_Buf->Key_1_Press        = (rx[8] >> 3) & 0x01;
+//          Ret_Buf->Key_2_Press        = (rx[8] >> 4) & 0x01;
+//          Ret_Buf->Key_3_Press        = (rx[8] >> 5) & 0x01;
+//          Ret_Buf->Key_4_Press        = (rx[8] >> 6) & 0x01;
+
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_AC_Alarm_Code(unsigned char fd, unsigned char targetAddr, Ac_Alarm_code *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_ac_alarm_code, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-				(rx[2] == tx[1]) &&
-				(rx[1] == tx[2]) &&
-				(rx[3] == tx[3]))
-		{
-			Ret_Buf->AcAlarmCode = rx[6] + (rx[7] << 8) + (rx[8] << 16) + (rx[9] << 24);
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_ac_alarm_code, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            Ret_Buf->AcAlarmCode = rx[6] + (rx[7] << 8) + (rx[8] << 16) + (rx[9] << 24);
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_Charging_Energy(unsigned char fd, unsigned char targetAddr, Ac_Charging_energy *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_ac_output_energy, 0x00, 0x00,0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-				(rx[2] == tx[1]) &&
-				(rx[1] == tx[2]) &&
-				(rx[3] == tx[3]))
-		{
-			Ret_Buf->Energy = rx[6] + (rx[7] << 8) + (rx[8] << 16) + (rx[9] << 24);
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_ac_output_energy, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            Ret_Buf->Energy = rx[6] + (rx[7] << 8) + (rx[8] << 16) + (rx[9] << 24);
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Query_Charging_Current(unsigned char fd, unsigned char targetAddr, Ac_Charging_current *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_ac_output_current, 0x00, 0x00, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-	unsigned char len = tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-				(rx[2] == tx[1]) &&
-				(rx[1] == tx[2]) &&
-				(rx[3] == tx[3]))
-		{
-			Ret_Buf->OuputCurrentL1 = rx[6] + (rx[7] << 8);
-			Ret_Buf->OuputCurrentL2 = rx[8] + (rx[9] << 8);
-			Ret_Buf->OuputCurrentL3 = rx[10] + (rx[11] << 8);
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[7] = {0xaa, 0x00, targetAddr, Cmd.query_ac_output_current, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len = tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3])) {
+            Ret_Buf->OuputCurrentL1 = rx[6] + (rx[7] << 8);
+            Ret_Buf->OuputCurrentL2 = rx[8] + (rx[9] << 8);
+            Ret_Buf->OuputCurrentL3 = rx[10] + (rx[11] << 8);
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_LED_Status(unsigned char fd, unsigned char targetAddr, Ac_Led_Status *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[12] = {0xaa, 0x00, targetAddr, Cmd.config_ac_led_status, 0x05, 0x00, Ret_Buf->ActionMode, (Ret_Buf->AcAlarmCode >> 0) & 0xFF,
-			(Ret_Buf->AcAlarmCode >> 8) & 0xFF, (Ret_Buf->AcAlarmCode >> 16) & 0xFF, (Ret_Buf->AcAlarmCode >> 24) & 0xFF};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++)
-			chksum ^= tx[6 + idx];
-	tx[11] = chksum;
-
-	if (tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100) > 0)
-	{
-		chksum = 0x00;
-		for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++)
-		{
-			chksum ^= rx[6 + idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-			(rx[2] == tx[1]) &&
-			(rx[1] == tx[2]) &&
-			(rx[3] == tx[3]) &&
-			rx[6] == PASS)
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[12] = {0xaa, 0x00, targetAddr, Cmd.config_ac_led_status, 0x05, 0x00, Ret_Buf->ActionMode, (Ret_Buf->AcAlarmCode >> 0) & 0xFF,
+                            (Ret_Buf->AcAlarmCode >> 8) & 0xFF, (Ret_Buf->AcAlarmCode >> 16) & 0xFF, (Ret_Buf->AcAlarmCode >> 24) & 0xFF
+                           };
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[11] = chksum;
+
+    if (tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100) > 0) {
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                rx[6] == PASS) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_Legacy_Req(unsigned char fd, unsigned char targetAddr, unsigned char _switch)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[9] = {0xaa, 0x00, targetAddr, Cmd.config_Legacy_Req, 0x02, 0x00, _switch, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++)
-		chksum ^= tx[6 + idx];
-	tx[8] = chksum;
-
-	if (tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100) > 0)
-	{
-		chksum = 0x00;
-		for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++)
-		{
-			chksum ^= rx[6 + idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-				(rx[2] == tx[1]) &&
-				(rx[1] == tx[2]) &&
-				(rx[3] == tx[3]) &&
-				rx[6] == PASS)
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[9] = {0xaa, 0x00, targetAddr, Cmd.config_Legacy_Req, 0x02, 0x00, _switch, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[8] = chksum;
+
+    if (tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100) > 0) {
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                rx[6] == PASS) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_Ac_Duty(unsigned char fd, unsigned char targetAddr, unsigned char _value)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[8] = {0xaa, 0x00, targetAddr, Cmd.config_ac_duty, 0x01, 0x00, _value};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++)
-		chksum ^= tx[6 + idx];
-	tx[7] = chksum;
-
-	if (tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100) > 0)
-	{
-		chksum = 0x00;
-		for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++)
-		{
-			chksum ^= rx[6 + idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-				(rx[2] == tx[1]) &&
-				(rx[1] == tx[2]) &&
-				(rx[3] == tx[3]) &&
-				rx[6] == PASS)
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[8] = {0xaa, 0x00, targetAddr, Cmd.config_ac_duty, 0x01, 0x00, _value};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[7] = chksum;
+
+    if (tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100) > 0) {
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                rx[6] == PASS) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_CSU_Mode(unsigned char fd, unsigned char targetAddr)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[9] = {0xaa, 0x00, targetAddr, Cmd.config_csu_mode, 0x02, 0x00, 0x01, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++)
-		chksum ^= tx[6 + idx];
-	tx[7] = chksum;
-
-	if (tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100) > 0)
-	{
-		chksum = 0x00;
-		for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++)
-		{
-			chksum ^= rx[6 + idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-				(rx[2] == tx[1]) &&
-				(rx[1] == tx[2]) &&
-				(rx[3] == tx[3]) &&
-				rx[6] == PASS)
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[9] = {0xaa, 0x00, targetAddr, Cmd.config_csu_mode, 0x02, 0x00, 0x01, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[7] = chksum;
+
+    if (tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100) > 0) {
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                rx[6] == PASS) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_Reset_MCU(unsigned char fd, unsigned char targetAddr)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[9] = {0xaa, 0x00, targetAddr, Cmd.config_reset_mcu, 0x02, 0x00, 0x01, 0x00};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++)
-		chksum ^= tx[6 + idx];
-	tx[7] = chksum;
-
-	if (tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100) > 0)
-	{
-		chksum = 0x00;
-		for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++)
-		{
-			chksum ^= rx[6 + idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-				(rx[2] == tx[1]) &&
-				(rx[1] == tx[2]) &&
-				(rx[3] == tx[3]) &&
-				rx[6] == PASS)
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[9] = {0xaa, 0x00, targetAddr, Cmd.config_reset_mcu, 0x02, 0x00, 0x01, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[7] = chksum;
+
+    if (tranceiveRelDelayTime(fd, tx, sizeof(tx), rx, 100) > 0) {
+        chksum = 0x00;
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                rx[6] == PASS) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 
 unsigned char Config_Led_Color(unsigned char fd, unsigned char targetAddr, Led_Color *Ret_Buf)
 {
-	unsigned char result = FAIL;
-	unsigned char tx[13] = {0xaa, 0x00, targetAddr, Cmd.config_led_color, 0x06, 0x00,
-			Ret_Buf->Connect_1_Red, Ret_Buf->Connect_1_Green, Ret_Buf->Connect_1_Blue,
-			Ret_Buf->Connect_2_Red, Ret_Buf->Connect_2_Green, Ret_Buf->Connect_2_Blue};
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++)
-		chksum ^= tx[6 + idx];
-	tx[13] = chksum;
-
-//	for(int i = 0; i < 13; i++)
-//			printf ("tx = %x \n", tx[i]);
-
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-//	for(int i = 0; i < len; i++)
-//		printf ("rx = %x \n", rx[i]);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-			  (rx[2] == tx[1]) &&
-			  (rx[1] == tx[2]) &&
-			  (rx[3] == tx[3]) &&
-			  (rx[6] == PASS))
-		{
-			result = PASS;
-		}
-	}
-
-	return result;
+    unsigned char result = FAIL;
+    unsigned char tx[13] = {0xaa, 0x00, targetAddr, Cmd.config_led_color, 0x06, 0x00,
+                            Ret_Buf->Connect_1_Red, Ret_Buf->Connect_1_Green, Ret_Buf->Connect_1_Blue,
+                            Ret_Buf->Connect_2_Red, Ret_Buf->Connect_2_Green, Ret_Buf->Connect_2_Blue
+                           };
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+
+    for (int idx = 0; idx < (tx[4] | tx[5] << 8); idx++) {
+        chksum ^= tx[6 + idx];
+    }
+    tx[13] = chksum;
+
+//  for(int i = 0; i < 13; i++)
+//          printf ("tx = %x \n", tx[i]);
+
+    unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+//  for(int i = 0; i < len; i++)
+//      printf ("rx = %x \n", rx[i]);
+
+    if (len > 6) {
+        if (len < 6 + (rx[4] | rx[5] << 8)) {
+            return result;
+        }
+
+        for (int idx = 0; idx < (rx[4] | rx[5] << 8); idx++) {
+            chksum ^= rx[6 + idx];
+        }
+
+        if ((chksum == rx[6 + (rx[4] | rx[5] << 8)]) &&
+                (rx[2] == tx[1]) &&
+                (rx[1] == tx[2]) &&
+                (rx[3] == tx[3]) &&
+                (rx[6] == PASS)) {
+            result = PASS;
+        }
+    }
+
+    return result;
 }
 

+ 24 - 0
EVSE/Projects/DD360Audi/Apps/kill.sh

@@ -9,5 +9,29 @@ pkill Module_4g
 pkill Module_Wifi
 pkill OcppBackend
 pkill Module_ProduceUtils
+pkill DoComm
 pkill main
 
+ipcrm -M 0x000003e9
+ipcrm -M 0x000003ed
+ipcrm -M 0x000003ea
+ipcrm -M 0x000003ec
+ipcrm -M 0x000003ee
+ipcrm -M 0x000003ef
+ipcrm -M 0x000003f0
+ipcrm -M 0x000003f3
+ipcrm -M 0x000003f1
+ipcrm -M 0x000003f6
+
+ipcrm -M 0x000003e9
+ipcrm -M 0x000003ed
+ipcrm -M 0x000003ea
+ipcrm -M 0x000003ec
+ipcrm -M 0x000003ee
+ipcrm -M 0x000003ef
+ipcrm -M 0x000003f0
+ipcrm -M 0x000003f3
+ipcrm -M 0x000003f1
+ipcrm -M 0x000003f6
+
+ipcs

BIN
EVSE/Projects/DD360Audi/Apps/main


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 597 - 462
EVSE/Projects/DD360Audi/Apps/main.c


+ 37 - 37
EVSE/Projects/DD360Audi/Apps/timeout.h

@@ -1,55 +1,55 @@
 #ifndef TIMEOUT_H_
 #define TIMEOUT_H_
 
-#include 	<sys/time.h>
-#include 	<sys/timeb.h>
+#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/shm.h>
-#include 	<sys/mman.h>
-#include 	<linux/wireless.h>
-#include 	<linux/can.h>
-#include 	<linux/can/raw.h>
-#include 	<arpa/inet.h>
-#include 	<netinet/in.h>
+#include    <sys/types.h>
+#include    <sys/ioctl.h>
+#include    <sys/socket.h>
+#include    <sys/ipc.h>
+#include    <sys/shm.h>
+#include    <sys/shm.h>
+#include    <sys/mman.h>
+#include    <linux/wireless.h>
+#include    <linux/can.h>
+#include    <linux/can/raw.h>
+#include    <arpa/inet.h>
+#include    <netinet/in.h>
 
-#include 	<unistd.h>
-#include 	<stdarg.h>
+#include    <unistd.h>
+#include    <stdarg.h>
 #include    <stdio.h>
 #include    <stdlib.h>
 #include    <unistd.h>
 #include    <fcntl.h>
 #include    <termios.h>
 #include    <errno.h>
-#include 	<errno.h>
-#include 	<string.h>
-#include	<time.h>
-#include	<ctype.h>
-#include 	<ifaddrs.h>
+#include    <errno.h>
+#include    <string.h>
+#include    <time.h>
+#include    <ctype.h>
+#include    <ifaddrs.h>
 
-#define CONN_PLUG_TIME_OUT			40
+#define CONN_PLUG_TIME_OUT          40
 
-enum Timeout_flag
-{
-	Timeout_None =						0,
-	Timeout_SelftestChk = 				1,
-	Timeout_Authorizing = 				2,
-	Timeout_VerifyFail = 				3,
-	Timeout_VerifyComp = 				4,
-	Timeout_WaitPlug = 					5,
+enum Timeout_flag {
+    Timeout_None                   = 0,
+    Timeout_SelftestChk            = 1,
+    Timeout_Authorizing            = 2,
+    Timeout_VerifyFail             = 3,
+    Timeout_VerifyComp             = 4,
+    Timeout_WaitPlug               = 5,
 
-	Timeout_Preparing = 				6,
-	Timeout_EvChargingDet = 			7,
-	Timeout_EvseChargingDet = 			8,
-	Timeout_EvseCompleteDet = 			9,
-	Timeout_ForCcsPrechargeDet = 		10,
-	Timeout_ReturnToChargingGunDet = 	11,
-	Timeout_AuthorizingForStop = 		12
+    Timeout_Preparing              = 6,
+    Timeout_EvChargingDet          = 7,
+    Timeout_EvseChargingDet        = 8,
+    Timeout_EvseCompleteDet        = 9,
+    Timeout_ForCcsPrechargeDet     = 10,
+    Timeout_ReturnToChargingGunDet = 11,
+    Timeout_AuthorizingForStop     = 12,
+    Timeout_SelectGun              = 13,
 };
 
 // for timeout fork

BIN
EVSE/Projects/DD360Audi/AudiUI/DWIN_SET.7z


BIN
EVSE/Projects/DD360Audi/Images/MLO


BIN
EVSE/Projects/DD360Audi/Images/am335x-evm.dtb


BIN
EVSE/Projects/DD360Audi/Images/ramdisk.gz


BIN
EVSE/Projects/DD360Audi/Images/u-boot-spl.bin


BIN
EVSE/Projects/DD360Audi/Images/u-boot.img


BIN
EVSE/Projects/DD360Audi/Images/zImage


BIN
EVSE/Projects/DD360Audi/output/DoComm


BIN
EVSE/Projects/DD360Audi/output/FactoryConfig


BIN
EVSE/Projects/DD360Audi/output/Module_EvComm


BIN
EVSE/Projects/DD360Audi/output/Module_EventLogging


BIN
EVSE/Projects/DD360Audi/output/Module_InternalComm


BIN
EVSE/Projects/DD360Audi/output/Module_LcmControl


BIN
EVSE/Projects/DD360Audi/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360Audi/output/ReadCmdline


BIN
EVSE/Projects/DD360Audi/output/UnsafetyOutputTask


+ 11 - 0
EVSE/Projects/DD360Audi/output/init.sh

@@ -0,0 +1,11 @@
+chmod 777 Module_CSU
+chmod 777 Module_PrimaryComm
+chmod 777 Module_LcmControl
+chmod 777 Module_InternalComm
+chmod 777 Module_EventLogging
+chmod 777 Module_EvComm
+chmod 777 Module_PsuComm
+chmod 777 OcppBackend
+chmod 777 kill.sh
+chmod 777 ReadCmdline
+chmod 777 DoComm

+ 37 - 0
EVSE/Projects/DD360Audi/output/kill.sh

@@ -0,0 +1,37 @@
+pkill Module_CSU
+pkill Module_PrimaryComm
+pkill Module_LcmControl
+pkill Module_InternalComm
+pkill Module_EventLogging
+pkill Module_EvComm
+pkill Module_PsuComm
+pkill Module_4g
+pkill Module_Wifi
+pkill OcppBackend
+pkill Module_ProduceUtils
+pkill DoComm
+pkill main
+
+ipcrm -M 0x000003e9
+ipcrm -M 0x000003ed
+ipcrm -M 0x000003ea
+ipcrm -M 0x000003ec
+ipcrm -M 0x000003ee
+ipcrm -M 0x000003ef
+ipcrm -M 0x000003f0
+ipcrm -M 0x000003f3
+ipcrm -M 0x000003f1
+ipcrm -M 0x000003f6
+
+ipcrm -M 0x000003e9
+ipcrm -M 0x000003ed
+ipcrm -M 0x000003ea
+ipcrm -M 0x000003ec
+ipcrm -M 0x000003ee
+ipcrm -M 0x000003ef
+ipcrm -M 0x000003f0
+ipcrm -M 0x000003f3
+ipcrm -M 0x000003f1
+ipcrm -M 0x000003f6
+
+ipcs

BIN
EVSE/Projects/DD360Audi/output/main


+ 45 - 0
EVSE/Projects/DD360Audi/output/sftp-config.json

@@ -0,0 +1,45 @@
+{
+    // The tab key will cycle through the settings when first created
+    // Visit http://wbond.net/sublime_packages/sftp/settings for help
+
+    // sftp, ftp or ftps
+    "type": "ftp",
+
+    "save_before_upload": true,
+    "upload_on_save": false,
+    "sync_down_on_open": false,
+    "sync_skip_deletes": false,
+    "sync_same_age": true,
+    "confirm_downloads": false,
+    "confirm_sync": true,
+    "confirm_overwrite_newer": false,
+
+    "host": "192.168.0.10",
+    "user": "root",
+    "password": "y42j/4cj84",
+    "port": "21",
+
+    "remote_path": "/root/",
+    "ignore_regexes": [
+        "\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
+        "sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
+        "\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"
+    ],
+    //"file_permissions": "664",
+    //"dir_permissions": "775",
+
+    //"extra_list_connections": 0,
+
+    "connect_timeout": 30,
+    //"keepalive": 120,
+    //"ftp_passive_mode": true,
+    //"ftp_obey_passive_host": false,
+    //"ssh_key_file": "~/.ssh/id_rsa",
+    //"sftp_flags": ["-F", "/path/to/ssh_config"],
+
+    //"preserve_modification_times": false,
+    //"remote_time_offset_in_hours": 0,
+    //"remote_encoding": "utf-8",
+    //"remote_locale": "C",
+    //"allow_config_upload": false,
+}

+ 1 - 0
EVSE/Projects/DD360Audi/output/web.sh

@@ -0,0 +1 @@
+/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf  -m /lib

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 469 - 480
EVSE/Projects/define.h


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است