Browse Source

Merge branch 'master' into DM30/DW30

TC_Hsu 4 years ago
parent
commit
dc4cd9fe8e
30 changed files with 1075 additions and 701 deletions
  1. 62 0
      EVSE/Modularization/Infypwr_PsuCommObj.c
  2. 25 15
      EVSE/Modularization/Infypwr_PsuCommObj.h
  3. 375 258
      EVSE/Modularization/ocppfiles/MessageHandler.c
  4. 34 3
      EVSE/Modularization/ocppfiles/Module_OcppBackend.c
  5. 1 0
      EVSE/Modularization/ocppfiles/Module_OcppBackend.h
  6. 2 2
      EVSE/Projects/AW-CCS/Apps/Module_AlarmDetect.c
  7. 1 1
      EVSE/Projects/AW-CCS/Apps/Module_FactoryConfig.c
  8. 3 2
      EVSE/Projects/AW-CCS/Apps/Module_InternalComm.c
  9. 2 2
      EVSE/Projects/AW-CCS/Apps/Module_Speaker.c
  10. 348 270
      EVSE/Projects/AW-CCS/Apps/main.c
  11. 7 0
      EVSE/Projects/AW-CCS/Apps/main.h
  12. BIN
      EVSE/Projects/AW-CCS/Images/FactoryDefaultConfig.bin
  13. BIN
      EVSE/Projects/AW-CCS/Images/ramdisk.gz
  14. 2 2
      EVSE/Projects/AW-Regular/Apps/Module_AlarmDetect.c
  15. 2 2
      EVSE/Projects/AW-Regular/Apps/Module_EventLogging.c
  16. 1 1
      EVSE/Projects/AW-Regular/Apps/Module_FactoryConfig.c
  17. 2 2
      EVSE/Projects/AW-Regular/Apps/Module_InternalComm.c
  18. 2 2
      EVSE/Projects/AW-Regular/Apps/Module_Speaker.c
  19. 162 138
      EVSE/Projects/AW-Regular/Apps/main.c
  20. BIN
      EVSE/Projects/AW-Regular/Images/FactoryDefaultConfig.bin
  21. BIN
      EVSE/Projects/AW-Regular/Images/MLO
  22. BIN
      EVSE/Projects/AW-Regular/Images/ramdisk.gz
  23. BIN
      EVSE/Projects/AW-Regular/Images/u-boot.img
  24. BIN
      EVSE/Projects/AW-Regular/Images/zImage
  25. BIN
      EVSE/Projects/BYTON-GB/Images/FactoryDefaultConfig.bin
  26. BIN
      EVSE/Projects/BYTON-GB/Images/ramdisk.gz
  27. BIN
      EVSE/Projects/Noodoe/Images/FactoryDefaultConfig.bin
  28. BIN
      EVSE/Projects/Noodoe/Images/ramdisk.gz
  29. 43 0
      EVSE/rootfs/var/www/get_query_action.php
  30. 1 1
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.version

+ 62 - 0
EVSE/Modularization/Infypwr_PsuCommObj.c

@@ -108,6 +108,11 @@ void RefreshGetOutput(void *func)
 	return_get_output = func;
 }
 
+void RefreshGetOutputF(void *func)
+{
+	return_get_output_float = func;
+}
+
 void RefreshFanInfo(void *func)
 {
 	return_fanspeed_info = func;
@@ -269,7 +274,20 @@ void ReceiveDataFromCanBus()
 					//PRINTF_LIB_FUNC("address = %d, outputVol = %d, outputCur = %d \n", address, outputVol, outputCur);
 				}
 					break;
+				case INFYPWR_GROUP_SHIFT | MODULE_OUTPUT_VOL_CUR_FLOAT:
+				{
+					group = frame.can_id & 0x000000FF;
 
+					byte vol[4], cur[4];
+					memcpy(vol, frame.data, 4);
+					memcpy(cur, frame.data + 4, 4);
+
+					float _Vol = IEEE_754_to_float(vol);
+					float _Cur = IEEE_754_to_float(cur);
+
+					return_get_output_float(group, _Vol, _Cur);
+				}
+					break;
 				case INFYPWR_GROUP_SHIFT | MODULE_IAVAILABLE:
 				case MODULE_IAVAILABLE:
 				{
@@ -703,3 +721,47 @@ void GetModuleOutput(byte group)
 	SendCmdToPsu(cmd, data, sizeof(data));
 }
 
+void GetModuleOutputF(byte group)
+{
+	byte data[8];
+	uint cmd = INFYPWR_CMD | MODULE_OUTPUT_VOL_CUR_FLOAT;
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+
+	if (group == SYSTEM_CMD)
+		cmd |= INFYPWR_BROADCAST | INFYPWR_DEFAULT;
+	else
+		cmd |= INFYPWR_GROUP_SHIFT | (group << 8) | INFYPWR_DEFAULT;
+	SendCmdToPsu(cmd, data, sizeof(data));
+}
+
+/**********************************************************************************/
+/***                                                                            ***/
+/***                                 Upgrate                                    ***/
+/***                                                                            ***/
+/**********************************************************************************/
+void ChangePsuBaudrate(short baudrate)
+{
+	byte data[8];
+	uint cmd = CHANGE_BAUDRATE;  //0x180100E5
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+
+	data[0] = 0x11;
+	data[1] = 0x26;
+
+	if (baudrate == 125)
+		data[7] = 0xA0;
+	else if (baudrate == 250)
+		data[7] = 0xA1;
+	else if (baudrate == 500)
+		data[7] = 0xA2;
+
+	cmd |= INFYPWR_BROADCAST | INFYPWR_DEFAULT;
+	SendCmdToPsu(cmd, data, sizeof(data));
+}
+
+
+
+
+

+ 25 - 15
EVSE/Modularization/Infypwr_PsuCommObj.h

@@ -91,25 +91,28 @@ enum PSU_SET_CMD
 	SLEEP_MODE =  	            0x00990000,		// 當 SWITCH POWER 打開時,可透過該指令讓模塊休眠 (風扇會停)
     SWITCH_POWER = 	            0x009A0000,		// 打開,則模塊依照設定的輸出功率輸出
 	PRESENT_OUT_VOL = 			0x009B0000,
-	/*Test mode used*/
+	/*Ver : 9.06 used*/
 	TEST_PRESENT_OUT = 			0x180100E5,
+	/*Upgrade*/
+	CHANGE_BAUDRATE = 			0x028F0000
 };
 
 enum PSU_GET_CMD
 {
-	MODULE_COUNT = 	            0x00820000,		// 取得模塊數量
-	STATUS = 					0x00840000,		// 取得溫度、狀態
-	MODULE_INPUT = 				0x00860000,		// 取得三向輸入電壓
-	MODULE_VER = 				0x00870000,		// 取得版號
-	MODULE_OUTPUT_VOL_CUR = 	0x00880000,		// 取得當前輸出電壓電流
-	MODULE_CAP = 				0x008A0000,		// 取得當前 Group 的最大電壓、最大電流、最小電壓、額定功率
-	MODULE_BARCODE =			0x008B0000,		// 取得 BarCode
-	MODULE_IAVAILABLE =			0x008C0000,		// 取得實際模塊可輸出的電流能力 (降載)
-	MODULE_MIS_INFO = 			0x008E0000,		// 取得模塊資訊 (Tdc、Tpfc、風扇速度)
-	/*Test mode used*/
-	AUTO_OUTPUT_TEMP = 			0x00010000,
-	AUTO_MODULE_STATUS = 		0x00020000,
-	AUTO_MODULE_INPUT = 		0x00030000,
+	MODULE_OUTPUT_VOL_CUR_FLOAT = 	0x00810000,		// 取得當前輸出電壓電流 (float)
+	MODULE_COUNT = 	            	0x00820000,		// 取得模塊數量
+	STATUS = 						0x00840000,		// 取得溫度、狀態
+	MODULE_INPUT = 					0x00860000,		// 取得三向輸入電壓
+	MODULE_VER = 					0x00870000,		// 取得版號
+	MODULE_OUTPUT_VOL_CUR = 		0x00880000,		// 取得當前輸出電壓電流
+	MODULE_CAP = 					0x008A0000,		// 取得當前 Group 的最大電壓、最大電流、最小電壓、額定功率
+	MODULE_BARCODE =				0x008B0000,		// 取得 BarCode
+	MODULE_IAVAILABLE =				0x008C0000,		// 取得實際模塊可輸出的電流能力 (降載)
+	MODULE_MIS_INFO = 				0x008E0000,		// 取得模塊資訊 (Tdc、Tpfc、風扇速度)
+	/*Ver : 9.06 used*/
+	AUTO_OUTPUT_TEMP = 				0x00010000,
+	AUTO_MODULE_STATUS = 			0x00020000,
+	AUTO_MODULE_INPUT = 			0x00030000,
 };
 
 union FloatingPointIEEE754
@@ -134,7 +137,7 @@ void PresentOutputVol(byte group, int voltage, int current);
 void FanNoiseInfo(byte group, byte value);
 void SetWalkInConfig(byte group, byte enable, byte sec);
 
-/*Test mode used*/
+/*Ver : 9.06 used*/
 void SetDirModulePresentOutput(byte group, int voltage, int current, byte _switch);
 /*Get Cmd*/
 void GetStatus(byte group);
@@ -146,6 +149,10 @@ void GetModuleBarCode(byte group);
 void GetModuleInput(byte group);
 void GetModuleIavailable(byte group);
 void GetModuleOutput(byte group);
+void GetModuleOutputF(byte group);
+
+/*Upgrade*/
+void ChangePsuBaudrate(short baudrate);
 
 /* Callback Function */
 void RefreshStatus(void *func);
@@ -166,6 +173,9 @@ void (*return_input_vol)(byte address, unsigned short vol1, unsigned short vol2,
 void RefreshGetOutput(void *func);
 void (*return_get_output)(byte address, unsigned short outVol, unsigned short outCur);
 
+void RefreshGetOutputF(void *func);
+void (*return_get_output_float)(byte group, float outVol, float outCur);
+
 void RefreshFanInfo(void *func);
 void (*return_fanspeed_info)(byte address, unsigned int fanSpeed);
 

File diff suppressed because it is too large
+ 375 - 258
EVSE/Modularization/ocppfiles/MessageHandler.c


+ 34 - 3
EVSE/Modularization/ocppfiles/Module_OcppBackend.c

@@ -460,6 +460,30 @@ end:
 	pthread_exit(NULL/*(void *) fname*/);
 }
 
+int isQueueOverSize()
+{
+	FILE *fp;
+	uint32_t file_size;
+	uint8_t result = FALSE;
+
+	fp = fopen("/Storage/OCPP/TransactionRelatedQueue" , "r");
+	if(fp != NULL)
+	{
+		fseek(fp, 0L, SEEK_END);
+		file_size = ftell(fp);
+
+		if(file_size > (500*1024*1024))
+		{
+			result = TRUE;
+
+			DEBUG_WARN("Queue file over size.\n");
+		}
+		fclose(fp);
+	}
+
+	return result;
+}
+
 int showfront(char *uuid, char *data)
 {
 	FILE *fp;
@@ -1210,6 +1234,7 @@ void CheckTransactionPacket(char *uuid)
 int queue_operation(int type, char *frontUUID, char *frontData)
 {
 	int result=0;
+
 	while(1)
 	{
 		if (!IsUsing )
@@ -1234,7 +1259,11 @@ int queue_operation(int type, char *frontUUID, char *frontData)
 			}
 			else if(type == QUEUE_OPERATION_ADD)         		// add items to the queue
 			{
-				result = addq(frontUUID, frontData);
+				// If queue file over size only add start * stop transaction message
+				if(!isQueueOverSize() || (strstr(frontData, "MeterValues") == NULL))
+				{
+					result = addq(frontUUID, frontData);
+				}
 			}
 
 			IsUsing = FALSE;
@@ -1388,8 +1417,8 @@ int main(void)
 		else
 		{
 			// Sign in
-			if( ((GetBootNotificationInterval() != 0  && ((time((time_t*)NULL)-startTime.bootNotification)>= GetBootNotificationInterval()) )  ||
-				((time((time_t*)NULL)-startTime.bootNotification) >= defaultWaitingTime) ) && (GetServerSign() == FALSE))
+			if((GetServerSign() == FALSE) &&
+			   ( ((GetBootNotificationInterval() != 0)  && ((time((time_t*)NULL)-startTime.bootNotification)>= GetBootNotificationInterval())) || ((time((time_t*)NULL)-startTime.bootNotification) >= defaultWaitingTime) ) )
 			{
 				sendBootNotificationRequest();
 				startTime.bootNotification=time((time_t*)NULL);
@@ -1405,10 +1434,12 @@ int main(void)
 				{
 					queue_operation(QUEUE_OPERATION_SENT, "", "");
 					req_SendQueue = 0;
+					lws_service(context, 0);//timeout_ms
 				}
 
 				// Check System Value
 				CheckSystemValue();
+				lws_service(context, 0);//timeout_ms
 
 				if(GetHeartBeatWithNOResponse() >= 3)
 				{

+ 1 - 0
EVSE/Modularization/ocppfiles/Module_OcppBackend.h

@@ -89,6 +89,7 @@ extern int InitShareMemory();
 extern int ProcessShareMemory();
 extern void CheckSystemValue(void);
 
+extern int isQueueOverSize();
 extern int showfront(char *uuid, char *data);
 extern int addq(char *uuid, char *data) ;
 extern int delq();

+ 2 - 2
EVSE/Projects/AW-CCS/Apps/Module_AlarmDetect.c

@@ -92,7 +92,7 @@ int StoreLogMsg(const char *fmt, ...)
 
 	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
 					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1,
@@ -101,7 +101,7 @@ int StoreLogMsg(const char *fmt, ...)
 	}
 	else
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %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,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1);

+ 1 - 1
EVSE/Projects/AW-CCS/Apps/Module_FactoryConfig.c

@@ -66,7 +66,7 @@ int StoreLogMsg(const char *fmt, ...)
 	memset(Buf,0,sizeof(Buf));
 	CurrentTime = time(NULL);
 	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/%04d-%02d_%s_%s_SystemLog",
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/%04d-%02d_%s_%s_SystemLog",
 			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 			buffer,
 			tm->tm_year+1900,tm->tm_mon+1,

+ 3 - 2
EVSE/Projects/AW-CCS/Apps/Module_InternalComm.c

@@ -75,7 +75,7 @@ int StoreLogMsg(const char *fmt, ...)
 
 	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
 					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1,
@@ -84,7 +84,7 @@ int StoreLogMsg(const char *fmt, ...)
 	}
 	else
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %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,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1);
@@ -2366,6 +2366,7 @@ int main(void)
 						if(Query_Temperature(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].temperature) == PASS)
 						{
 							ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp = ShmCharger->gun_info[gun_index].temperature.point[0];
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ConnectorTemp = ShmCharger->gun_info[gun_index].temperature.point[0];
 
 							failCount[gun_index] = 0;
 						}

+ 2 - 2
EVSE/Projects/AW-CCS/Apps/Module_Speaker.c

@@ -82,7 +82,7 @@ int StoreLogMsg(const char *fmt, ...)
 
 	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
 					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1,
@@ -91,7 +91,7 @@ int StoreLogMsg(const char *fmt, ...)
 	}
 	else
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %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,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1);

+ 348 - 270
EVSE/Projects/AW-CCS/Apps/main.c

@@ -34,6 +34,7 @@
 #define TIMEOUT_SPEC_LOGPPRINTOUT				30000
 #define TIMEOUT_SPEC_PROFILE_PREPARE			5000
 #define TIMEOUT_SPEC_BS_HLC_HANDSHAKE			2000
+#define TIMEOUT_SPEC_EV_READY					30000
 #define TIMEOUT_SPEC_CCS_HEARTBEAT_COUNT_RESET		10000
 #define TIMEOUT_SPEC_CCS_HANDSHAKE				120000
 
@@ -1196,7 +1197,7 @@ void get_firmware_version(unsigned char gun_index)
 	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
 
 	// Get CSU root file system version
-	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.24.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.25.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)
@@ -1935,10 +1936,13 @@ void checkTask()
 		system("/root/Module_EventLogging &");
 	}
 
-	if(system("pidof -s OcppBackend > /dev/null") != 0)
+	if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") != 0)
 	{
-		DEBUG_INFO("OcppBackend not running, restart it.\r\n");
-		system("/root/OcppBackend &");
+		if(system("pidof -s OcppBackend > /dev/null") != 0)
+		{
+			DEBUG_INFO("OcppBackend not running, restart it.\r\n");
+			system("/root/OcppBackend &");
+		}
 	}
 
 	if(system("pidof -s Module_AlarmDetect > /dev/null") != 0)
@@ -2300,10 +2304,19 @@ int main(void)
 						ShmCharger->gun_info[gun_index].isInitialPass = YES;
 
 						// Set max current to rating current
-						//ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
-						ShmCharger->gun_info[gun_index].acCcsInfo.EVSEMaxCurrent = (float)ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
-						ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
-						ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;							
+						ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+						
+						// Default Ethernet / Wifi / 4G to 1:disconnected 
+						ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet = ON;
+						ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = ON;
+						ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = ON;
+						
+						// If Web Server OPCC URL is empty kill Module_OcppBackend
+						if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0)
+						{
+							DEBUG_INFO("URL is empty kill Module_OcppBackend...\r\n");
+							system ("pkill OcppBackend");
+						}
 
 						// If rotate switch equal zero, the system needs to change Debug mode
 						if(ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch == 0)
@@ -2334,6 +2347,8 @@ int main(void)
 						//ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = (ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent > 0) ? ((ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent<ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].primaryMcuState.rating_current) : ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
 						ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor = OFF;
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId = -1;
+						
+						ShmCharger->gun_info[gun_index].isDoEvReadyOnce = OFF;
 
 						// Response StopTransactionConf
 						if(ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionConf == ON)
@@ -2489,7 +2504,7 @@ int main(void)
 							case START_METHOD_RFID:
 								if((ShmOCPP16Data->SpMsg.bits.AuthorizeConf) ||
 								   (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)) ||
-								   (!ShmOCPP16Data->OcppConnStatus && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
+								   (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
 								   (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_NOCHARGE))
 								{
 									if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
@@ -2646,7 +2661,9 @@ int main(void)
 								if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
 								{			
 									ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_BS_MODE;
-									DEBUG_INFO("Enter BS Mode charging.\r\n");			
+									DEBUG_INFO("Enter BS Mode charging.\r\n");		
+									//for EV READY 30 secs didn't start charging to STATE E
+									ftime(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
 								}						
 								break;	
 							case HANDSHAKE_BS_MODE:
@@ -2672,7 +2689,71 @@ int main(void)
 									ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionReq = ON;
 
 									setChargerMode(gun_index, SYS_MODE_CHARGING);
-								}						
+								}
+								//EV READY CHECK
+								if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_BS_HLC_HANDSHAKE]) > TIMEOUT_SPEC_EV_READY) && (ShmCharger->gun_info[gun_index].isEvReady2StateE == OFF))
+								{
+									if(ShmCharger->gun_info[gun_index].isDoEvReadyOnce == OFF)
+									{
+										DEBUG_INFO("EV READY STATE E 4sec.\r\n");
+										ShmCharger->gun_info[gun_index].isEvReady2StateE = ON;
+										ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_CP_STATE_E;
+										ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;					
+										ShmCharger->gun_info[gun_index].evReadyState = EV_READY_STAT_E;
+									}
+								}
+								if(ShmCharger->gun_info[gun_index].isEvReady2StateE == ON)
+								{
+									switch(ShmCharger->gun_info[gun_index].evReadyState)
+									{
+										case EV_READY_STAT_E:
+											if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
+											{
+												sleep(4);	
+												ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
+												ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;				
+												ShmCharger->gun_info[gun_index].evReadyState = EV_READY_STAT_C;			
+											}
+											break;
+										case EV_READY_STAT_C:
+											if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
+											{
+												usleep(500000);	
+												DEBUG_INFO("EV READY Determine max charging current to MCU.\r\n");										
+												if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+												{
+													ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+													if(ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current)
+													{
+														ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+														ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
+													}
+												}
+												else
+												{
+													ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+													if(ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current)
+													{
+														ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+														ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
+													}
+												}
+												ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;				
+												ShmCharger->gun_info[gun_index].evReadyState = EV_READY_SET_MAX_CURRENT;			
+											}										
+											break;
+										case EV_READY_SET_MAX_CURRENT:
+											if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
+											{
+												ShmCharger->gun_info[gun_index].isEvReady2StateE = OFF;
+												ShmCharger->gun_info[gun_index].isDoEvReadyOnce = ON;
+											}
+											break;											
+										default:
+											break;																														
+									}									
+								}
+								
 								break;		
 							case HANDSHAKE_HLC_MODE:	
 #ifdef	CCS_SIMULATION_DATA				
@@ -2825,7 +2906,131 @@ int main(void)
 							   (ShmOCPP16Data->MsMsg.bits.ResetReq) ||
 							   (ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON))
 							{
-								setChargerMode(gun_index, SYS_MODE_TERMINATING);
+								if(ShmCharger->gun_info[gun_index].rfidReq)
+								{
+									// If RFID SN different with start user, it need to authorize ID
+									if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
+									{
+										if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH) && !ShmOCPP16Data->SpMsg.bits.AuthorizeReq)
+										{
+											// Request authorization
+											ftime(&startTime[gun_index][TMR_IDX_AUTH]);
+											memset(ShmSysConfigAndInfo->SysConfig.UserId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+											if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
+											{
+												// Big endian
+												switch(rfid.snType)
+												{
+													case RFID_SN_TYPE_6BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
+														break;
+													case RFID_SN_TYPE_7BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
+														break;
+													case RFID_SN_TYPE_10BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
+														break;
+													case RFID_SN_TYPE_4BYTE:
+													default:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
+														break;
+												}
+											}
+											else
+											{
+												// Little endian
+												switch(rfid.snType)
+												{
+													case RFID_SN_TYPE_6BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+														break;
+													case RFID_SN_TYPE_7BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+														break;
+													case RFID_SN_TYPE_10BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+														break;
+													case RFID_SN_TYPE_4BYTE:
+													default:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+														break;
+												}
+											}
+											DEBUG_INFO("End request User Id : %s\r\n", ShmSysConfigAndInfo->SysConfig.UserId);
+											DEBUG_INFO("Start method : %d...\r\n ", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod);
+
+											if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID) ||
+											   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND) ||
+											   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BLE))
+											{
+												switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
+												{
+													case AUTH_MODE_ENABLE:
+														if(ShmOCPP16Data->OcppConnStatus)
+														{
+															// On line
+															ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
+														}
+														else
+														{
+															// Off line
+															switch(ShmSysConfigAndInfo->SysConfig.OfflinePolicy)
+															{
+																case OFF_POLICY_LOCALLIST:
+																	ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
+																	break;
+																case OFF_POLICY_PH_RFID:
+																	break;
+																case OFF_POLICY_FREE:
+																	break;
+																case OFF_POLICY_NOCHARGE:
+																default:
+																	break;
+															}
+														}
+														break;
+													case AUTH_MODE_DISABLE:
+													default:
+														break;
+												}
+											}
+										}
+										else
+										{
+											if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf ||
+											  (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
+											  (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
+											  (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
+											{
+												if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
+												   (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
+												   (!ShmOCPP16Data->OcppConnStatus && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
+												   (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
+												{
+													ShmCharger->gun_info[gun_index].isAuthPassEnd = ON;
+												}
+												else
+												{
+													ShmCharger->gun_info[gun_index].rfidReq = OFF;
+													ShmOCPP16Data->SpMsg.bits.AuthorizeReq = OFF;
+													DEBUG_INFO("Authorize fail.\r\n");
+													setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
+													setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
+													sleep(3);
+												}
+
+												startTime[gun_index][TMR_IDX_AUTH].time -= TIMEOUT_SPEC_AUTH;
+												ShmOCPP16Data->SpMsg.bits.AuthorizeConf = OFF;
+											}
+										}
+									}
+
+									// If Authorize is accpted or Rfid card match with start User, The system should terminating to the end
+									if(ShmCharger->gun_info[gun_index].isAuthPassEnd || isMatchStartUser(gun_index))
+										setChargerMode(gun_index, SYS_MODE_TERMINATING);
+								}
+								else
+									setChargerMode(gun_index, SYS_MODE_TERMINATING);
 							}
 							else
 							{
@@ -3015,8 +3220,137 @@ int main(void)
 							   (ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_RENEGOTIATE_MODE) ||
 							   (ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_STANDBY_MODE))
 							{
-								setChargerMode(gun_index, SYS_MODE_TERMINATING);
-								setRelay(gun_index, OFF);
+								if(ShmCharger->gun_info[gun_index].rfidReq)
+								{
+									// If RFID SN different with start user, it need to authorize ID
+									if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
+									{
+										if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH) && !ShmOCPP16Data->SpMsg.bits.AuthorizeReq)
+										{
+											// Request authorization
+											ftime(&startTime[gun_index][TMR_IDX_AUTH]);
+											memset(ShmSysConfigAndInfo->SysConfig.UserId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+											if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
+											{
+												// Big endian
+												switch(rfid.snType)
+												{
+													case RFID_SN_TYPE_6BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
+														break;
+													case RFID_SN_TYPE_7BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
+														break;
+													case RFID_SN_TYPE_10BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
+														break;
+													case RFID_SN_TYPE_4BYTE:
+													default:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
+														break;
+												}
+											}
+											else
+											{
+												// Little endian
+												switch(rfid.snType)
+												{
+													case RFID_SN_TYPE_6BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+														break;
+													case RFID_SN_TYPE_7BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+														break;
+													case RFID_SN_TYPE_10BYTE:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+														break;
+													case RFID_SN_TYPE_4BYTE:
+													default:
+														sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+														break;
+												}
+											}
+											DEBUG_INFO("End request User Id : %s\r\n", ShmSysConfigAndInfo->SysConfig.UserId);
+											DEBUG_INFO("Start method : %d...\r\n ", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod);
+
+											if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID) ||
+											   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND) ||
+											   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BLE))
+											{
+												switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
+												{
+													case AUTH_MODE_ENABLE:
+														if(ShmOCPP16Data->OcppConnStatus)
+														{
+															// On line
+															ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
+														}
+														else
+														{
+															// Off line
+															switch(ShmSysConfigAndInfo->SysConfig.OfflinePolicy)
+															{
+																case OFF_POLICY_LOCALLIST:
+																	ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
+																	break;
+																case OFF_POLICY_PH_RFID:
+																	break;
+																case OFF_POLICY_FREE:
+																	break;
+																case OFF_POLICY_NOCHARGE:
+																default:
+																	break;
+															}
+														}
+														break;
+													case AUTH_MODE_DISABLE:
+													default:
+														break;
+												}
+											}
+										}
+										else
+										{
+											if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf ||
+											  (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
+											  (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
+											  (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
+											{
+												if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
+												   (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
+												   (!ShmOCPP16Data->OcppConnStatus && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
+												   (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
+												{
+													ShmCharger->gun_info[gun_index].isAuthPassEnd = ON;
+												}
+												else
+												{
+													ShmCharger->gun_info[gun_index].rfidReq = OFF;
+													ShmOCPP16Data->SpMsg.bits.AuthorizeReq = OFF;
+													DEBUG_INFO("Authorize fail.\r\n");
+													setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
+													setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
+													sleep(3);
+												}
+
+												startTime[gun_index][TMR_IDX_AUTH].time -= TIMEOUT_SPEC_AUTH;
+												ShmOCPP16Data->SpMsg.bits.AuthorizeConf = OFF;
+											}
+										}
+									}
+
+									// If Authorize is accpted or Rfid card match with start User, The system should terminating to the end
+									if(ShmCharger->gun_info[gun_index].isAuthPassEnd || isMatchStartUser(gun_index))
+									{
+										setChargerMode(gun_index, SYS_MODE_TERMINATING);
+										setRelay(gun_index, OFF);
+									}
+								}
+								else
+								{
+									setChargerMode(gun_index, SYS_MODE_TERMINATING);
+									setRelay(gun_index, OFF);
+								}
 							}
 							else
 							{
@@ -3205,134 +3539,6 @@ int main(void)
 					switch(ShmCharger->gun_info[gun_index].chargingMode)
 					{
 						case CHARGING_MODE_BS:
-								// If RFID SN different with start user, it need to authorize ID
-								if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
-								{
-									if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH) && !ShmOCPP16Data->SpMsg.bits.AuthorizeReq)
-									{
-										// Request authorization
-										ftime(&startTime[gun_index][TMR_IDX_AUTH]);
-										memset(ShmSysConfigAndInfo->SysConfig.UserId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
-										if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
-										{
-											// Big endian
-											switch(rfid.snType)
-											{
-												case RFID_SN_TYPE_6BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
-													break;
-												case RFID_SN_TYPE_7BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
-													break;
-												case RFID_SN_TYPE_10BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
-													break;
-												case RFID_SN_TYPE_4BYTE:
-												default:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
-													break;
-											}
-										}
-										else
-										{
-											// Little endian
-											switch(rfid.snType)
-											{
-												case RFID_SN_TYPE_6BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-													break;
-												case RFID_SN_TYPE_7BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-													break;
-												case RFID_SN_TYPE_10BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-													break;
-												case RFID_SN_TYPE_4BYTE:
-												default:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-													break;
-											}
-										}
-										DEBUG_INFO("End request User Id : %s\r\n", ShmSysConfigAndInfo->SysConfig.UserId);
-										DEBUG_INFO("Start method : %d...\r\n ", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod);
-
-
-										if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID)
-										{
-											switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
-											{
-												case AUTH_MODE_ENABLE:
-													if(ShmOCPP16Data->OcppConnStatus)
-													{
-														// On line
-														ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
-													}
-													else
-													{
-														// Off line
-														switch(ShmSysConfigAndInfo->SysConfig.OfflinePolicy)
-														{
-															case OFF_POLICY_LOCALLIST:
-																ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
-																break;
-															case OFF_POLICY_PH_RFID:
-																break;
-															case OFF_POLICY_FREE:
-																break;
-															case OFF_POLICY_NOCHARGE:
-															default:
-																break;
-														}
-													}
-													break;
-												case AUTH_MODE_DISABLE:
-												default:
-													break;
-											}
-										}
-										else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND)
-										{
-											ShmCharger->gun_info[gun_index].rfidReq = OFF;
-											DEBUG_INFO("Need to match with start method : START_METHOD_BACKEND...\r\n");
-											setChargerMode(gun_index, SYS_MODE_CHARGING);
-										}
-										else if (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BLE)
-										{
-											ShmCharger->gun_info[gun_index].rfidReq = OFF;
-											DEBUG_INFO("Need to match with start method : START_METHOD_BLE...\r\n");
-											setChargerMode(gun_index, SYS_MODE_CHARGING);
-										}
-										else
-										{}
-
-									}
-									else
-									{
-										if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf ||
-										  (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
-										  (!ShmOCPP16Data->OcppConnStatus&&(ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
-										{
-											if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
-											   (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
-											   (!ShmOCPP16Data->OcppConnStatus&&(ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
-											{
-												ShmCharger->gun_info[gun_index].isAuthPassEnd = ON;
-											}
-											else
-											{
-												ShmCharger->gun_info[gun_index].rfidReq = OFF;
-
-												DEBUG_INFO("Authorize fail.\r\n");
-												setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
-												setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
-												sleep(3);
-											}
-
-											ShmOCPP16Data->SpMsg.bits.AuthorizeConf = OFF;
-										}
-									}
-								}
-
 								// End authorize pass
 								if(((ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchStartUser(gun_index)) ||
 								   (ShmCharger->gun_info[gun_index].isAuthPassEnd) ||
@@ -3382,134 +3588,6 @@ int main(void)
 								}
 								break;
 						case CHARGING_MODE_HLC:
-								// If RFID SN different with start user, it need to authorize ID
-								if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
-								{
-									if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH) && !ShmOCPP16Data->SpMsg.bits.AuthorizeReq)
-									{
-										// Request authorization
-										ftime(&startTime[gun_index][TMR_IDX_AUTH]);
-										memset(ShmSysConfigAndInfo->SysConfig.UserId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
-										if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
-										{
-											// Big endian
-											switch(rfid.snType)
-											{
-												case RFID_SN_TYPE_6BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
-													break;
-												case RFID_SN_TYPE_7BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
-													break;
-												case RFID_SN_TYPE_10BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
-													break;
-												case RFID_SN_TYPE_4BYTE:
-												default:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
-													break;
-											}
-										}
-										else
-										{
-											// Little endian
-											switch(rfid.snType)
-											{
-												case RFID_SN_TYPE_6BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-													break;
-												case RFID_SN_TYPE_7BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-													break;
-												case RFID_SN_TYPE_10BYTE:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-													break;
-												case RFID_SN_TYPE_4BYTE:
-												default:
-													sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-													break;
-											}
-										}
-										DEBUG_INFO("End request User Id : %s\r\n", ShmSysConfigAndInfo->SysConfig.UserId);
-										DEBUG_INFO("Start method : %d...\r\n ", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod);
-
-
-										if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID)
-										{
-											switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
-											{
-												case AUTH_MODE_ENABLE:
-													if(ShmOCPP16Data->OcppConnStatus)
-													{
-														// On line
-														ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
-													}
-													else
-													{
-														// Off line
-														switch(ShmSysConfigAndInfo->SysConfig.OfflinePolicy)
-														{
-															case OFF_POLICY_LOCALLIST:
-																ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
-																break;
-															case OFF_POLICY_PH_RFID:
-																break;
-															case OFF_POLICY_FREE:
-																break;
-															case OFF_POLICY_NOCHARGE:
-															default:
-																break;
-														}
-													}
-													break;
-												case AUTH_MODE_DISABLE:
-												default:
-													break;
-											}
-										}
-										else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND)
-										{
-											ShmCharger->gun_info[gun_index].rfidReq = OFF;
-											DEBUG_INFO("Need to match with start method : START_METHOD_BACKEND...\r\n");
-											setChargerMode(gun_index, SYS_MODE_CHARGING);
-										}
-										else if (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BLE)
-										{
-											ShmCharger->gun_info[gun_index].rfidReq = OFF;
-											DEBUG_INFO("Need to match with start method : START_METHOD_BLE...\r\n");
-											setChargerMode(gun_index, SYS_MODE_CHARGING);
-										}
-										else
-										{}
-
-									}
-									else
-									{
-										if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf ||
-										  (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
-										  (!ShmOCPP16Data->OcppConnStatus&&(ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
-										{
-											if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
-											   (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
-											   (!ShmOCPP16Data->OcppConnStatus&&(ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
-											{
-												ShmCharger->gun_info[gun_index].isAuthPassEnd = ON;
-											}
-											else
-											{
-												ShmCharger->gun_info[gun_index].rfidReq = OFF;
-
-												DEBUG_INFO("Authorize fail.\r\n");
-												setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
-												setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
-												sleep(3);
-											}
-
-											ShmOCPP16Data->SpMsg.bits.AuthorizeConf = OFF;
-										}
-									}
-								}
-
 								// End authorize pass
 								if(((ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchStartUser(gun_index)) ||
 								   (ShmCharger->gun_info[gun_index].isAuthPassEnd) ||

+ 7 - 0
EVSE/Projects/AW-CCS/Apps/main.h

@@ -162,6 +162,10 @@
 #define HANDSHAKE_BS_MODE				6
 #define HANDSHAKE_HLC_MODE				7
 
+#define	EV_READY_STAT_E					1
+#define	EV_READY_STAT_C					2
+#define	EV_READY_SET_MAX_CURRENT		3
+
 #define	CHARGING_MODE_BS				0
 #define	CHARGING_MODE_HLC				1
 
@@ -610,6 +614,7 @@ typedef struct GUN_INFO
 	uint8_t											PreviousEVChargeProgress;	
 	uint8_t											chargingMode;
 	uint16_t										targetCurrent;
+	uint8_t											evReadyState;
 	
 	uint16_t										isAuthPassEnd:1;
 	uint16_t										rfidReq:1;
@@ -621,6 +626,8 @@ typedef struct GUN_INFO
 	uint16_t										isOperactive:1;
 	uint16_t										isCCSWaitChangeDuty:1;
 	uint16_t										isCCSStartTransation:1;
+	uint16_t										isEvReady2StateE:1;
+	uint16_t										isDoEvReadyOnce:1;
 }Gun_Info;
 
 struct Charger

BIN
EVSE/Projects/AW-CCS/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/AW-CCS/Images/ramdisk.gz


+ 2 - 2
EVSE/Projects/AW-Regular/Apps/Module_AlarmDetect.c

@@ -92,7 +92,7 @@ int StoreLogMsg(const char *fmt, ...)
 
 	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
 					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1,
@@ -101,7 +101,7 @@ int StoreLogMsg(const char *fmt, ...)
 	}
 	else
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %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,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1);

+ 2 - 2
EVSE/Projects/AW-Regular/Apps/Module_EventLogging.c

@@ -96,7 +96,7 @@ int StoreEventLogMsg(const char *fmt, ...)
 
 	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]%s_%s_EventLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]%s_%s_EventLog",
 					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1,
@@ -105,7 +105,7 @@ int StoreEventLogMsg(const char *fmt, ...)
 	}
 	else
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]EventLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]EventLog",
 					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1);

+ 1 - 1
EVSE/Projects/AW-Regular/Apps/Module_FactoryConfig.c

@@ -66,7 +66,7 @@ int StoreLogMsg(const char *fmt, ...)
 	memset(Buf,0,sizeof(Buf));
 	CurrentTime = time(NULL);
 	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/%04d-%02d_%s_%s_SystemLog",
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/%04d-%02d_%s_%s_SystemLog",
 			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 			buffer,
 			tm->tm_year+1900,tm->tm_mon+1,

+ 2 - 2
EVSE/Projects/AW-Regular/Apps/Module_InternalComm.c

@@ -75,7 +75,7 @@ int StoreLogMsg(const char *fmt, ...)
 
 	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
 					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1,
@@ -84,7 +84,7 @@ int StoreLogMsg(const char *fmt, ...)
 	}
 	else
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %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,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1);

+ 2 - 2
EVSE/Projects/AW-Regular/Apps/Module_Speaker.c

@@ -82,7 +82,7 @@ int StoreLogMsg(const char *fmt, ...)
 
 	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
 					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1,
@@ -91,7 +91,7 @@ int StoreLogMsg(const char *fmt, ...)
 	}
 	else
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %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,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1);

+ 162 - 138
EVSE/Projects/AW-Regular/Apps/main.c

@@ -156,7 +156,7 @@ int StoreLogMsg(const char *fmt, ...)
 
 	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
 					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1,
@@ -165,7 +165,7 @@ int StoreLogMsg(const char *fmt, ...)
 	}
 	else
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %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,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1);
@@ -974,7 +974,6 @@ void InitEthernet()
 		{
 			if(isReachableInternet() == PASS)
 			{
-				ShmSysConfigAndInfo->SysInfo.InternetConn = ON;
 				ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=OFF;
 				cnt_pingDNS_Fail = 0;
 			}
@@ -982,10 +981,20 @@ void InitEthernet()
 			{
 				if(++cnt_pingDNS_Fail > 3)
 				{
-					ShmSysConfigAndInfo->SysInfo.InternetConn = OFF;
 					ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=ON;
 				}
 			}
+			
+			if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet &&
+			   ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi &&
+			   ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi)
+			{
+				ShmSysConfigAndInfo->SysInfo.InternetConn = OFF;
+			}
+			else
+			{
+				ShmSysConfigAndInfo->SysInfo.InternetConn = ON;
+			}
 
 			sleep(5);
 		}
@@ -1181,7 +1190,7 @@ void get_firmware_version(unsigned char gun_index)
 	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
 
 	// Get CSU root file system version
-	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.48.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.50.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)
@@ -1636,8 +1645,7 @@ int isReachableInternet()
 
 	for(int idx=0;idx<ARRAY_SIZE(valid_Internet);idx++)
 	{
-		strcpy(cmd, "ping -c 1 -w 3 ");
-		strcat(cmd, valid_Internet[idx]);
+		sprintf(cmd, "ping -c 1 -w 3 -I eth0 %s", valid_Internet[idx]);
 		fp = popen(cmd, "r");
 		if(fp != NULL)
 		{
@@ -1884,10 +1892,13 @@ void checkTask()
 		system("/root/Module_EventLogging &");
 	}
 
-	if(system("pidof -s OcppBackend > /dev/null") != 0)
+	if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") != 0)
 	{
-		DEBUG_INFO("OcppBackend not running, restart it.\r\n");
-		system("/root/OcppBackend &");
+		if(system("pidof -s OcppBackend > /dev/null") != 0)
+		{
+			DEBUG_INFO("OcppBackend not running, restart it.\r\n");
+			system("/root/OcppBackend &");
+		}
 	}
 
 	if(system("pidof -s Module_AlarmDetect > /dev/null") != 0)
@@ -2250,6 +2261,18 @@ int main(void)
 
 						// Set max current to rating current
 						ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+						
+						// Default Ethernet / Wifi / 4G to 1:disconnected 
+						ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet = ON;
+						ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = ON;
+						ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = ON;
+						
+						// If Web Server OPCC URL is empty kill Module_OcppBackend
+						if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0)
+						{
+							DEBUG_INFO("URL is empty kill Module_OcppBackend...\r\n");
+							system ("pkill OcppBackend");
+						}
 
 						// If rotate switch equal zero, the system needs to change Debug mode
 						if(ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch == 0)
@@ -2425,7 +2448,7 @@ int main(void)
 							case START_METHOD_RFID:
 								if((ShmOCPP16Data->SpMsg.bits.AuthorizeConf) ||
 								   (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)) ||
-								   (!ShmOCPP16Data->OcppConnStatus && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
+								   (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
 								   (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_NOCHARGE))
 								{
 									if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
@@ -2531,6 +2554,8 @@ int main(void)
 						ftime(&startChargingTime[gun_index]);
 						ftime(&startTime[gun_index][TMR_IDX_LOGPPRINTOUT]);
 						ftime(&startTime[gun_index][TMR_IDX_PROFILE_PREPARE]);
+						startTime[gun_index][TMR_IDX_AUTH].time -= TIMEOUT_SPEC_AUTH;
+						ShmOCPP16Data->SpMsg.bits.AuthorizeReq = OFF;
 					}
 
 					if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
@@ -2540,7 +2565,132 @@ int main(void)
 					   (ShmOCPP16Data->MsMsg.bits.ResetReq) ||
 					   (ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON))
 					{
-						setChargerMode(gun_index, SYS_MODE_TERMINATING);
+
+						if(ShmCharger->gun_info[gun_index].rfidReq)
+						{
+							// If RFID SN different with start user, it need to authorize ID
+							if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
+							{
+								if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH) && !ShmOCPP16Data->SpMsg.bits.AuthorizeReq)
+								{
+									// Request authorization
+									ftime(&startTime[gun_index][TMR_IDX_AUTH]);
+									memset(ShmSysConfigAndInfo->SysConfig.UserId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+									if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
+									{
+										// Big endian
+										switch(rfid.snType)
+										{
+											case RFID_SN_TYPE_6BYTE:
+												sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
+												break;
+											case RFID_SN_TYPE_7BYTE:
+												sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
+												break;
+											case RFID_SN_TYPE_10BYTE:
+												sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
+												break;
+											case RFID_SN_TYPE_4BYTE:
+											default:
+												sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
+												break;
+										}
+									}
+									else
+									{
+										// Little endian
+										switch(rfid.snType)
+										{
+											case RFID_SN_TYPE_6BYTE:
+												sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+												break;
+											case RFID_SN_TYPE_7BYTE:
+												sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+												break;
+											case RFID_SN_TYPE_10BYTE:
+												sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+												break;
+											case RFID_SN_TYPE_4BYTE:
+											default:
+												sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+												break;
+										}
+									}
+									DEBUG_INFO("End request User Id : %s\r\n", ShmSysConfigAndInfo->SysConfig.UserId);
+									DEBUG_INFO("Start method : %d...\r\n ", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod);
+
+									if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID) ||
+									   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND) ||
+									   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BLE))
+									{
+										switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
+										{
+											case AUTH_MODE_ENABLE:
+												if(ShmOCPP16Data->OcppConnStatus)
+												{
+													// On line
+													ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
+												}
+												else
+												{
+													// Off line
+													switch(ShmSysConfigAndInfo->SysConfig.OfflinePolicy)
+													{
+														case OFF_POLICY_LOCALLIST:
+															ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
+															break;
+														case OFF_POLICY_PH_RFID:
+															break;
+														case OFF_POLICY_FREE:
+															break;
+														case OFF_POLICY_NOCHARGE:
+														default:
+															break;
+													}
+												}
+												break;
+											case AUTH_MODE_DISABLE:
+											default:
+												break;
+										}
+									}
+								}
+								else
+								{
+									if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf ||
+									  (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
+									  (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
+									  (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
+									{
+										if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
+										   (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
+										   (!ShmOCPP16Data->OcppConnStatus && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
+										   (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
+										{
+											ShmCharger->gun_info[gun_index].isAuthPassEnd = ON;
+										}
+										else
+										{
+											ShmCharger->gun_info[gun_index].rfidReq = OFF;
+											ShmOCPP16Data->SpMsg.bits.AuthorizeReq = OFF;
+											DEBUG_INFO("Authorize fail.\r\n");
+											setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
+											setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
+											sleep(3);
+										}
+
+										startTime[gun_index][TMR_IDX_AUTH].time -= TIMEOUT_SPEC_AUTH;
+										ShmOCPP16Data->SpMsg.bits.AuthorizeConf = OFF;
+									}
+								}
+							}
+
+							// If Authorize is accpted or Rfid card match with start User, The system should terminating to the end
+							if(ShmCharger->gun_info[gun_index].isAuthPassEnd || isMatchStartUser(gun_index))
+								setChargerMode(gun_index, SYS_MODE_TERMINATING);
+						}
+						else
+							setChargerMode(gun_index, SYS_MODE_TERMINATING);
 					}
 					else
 					{
@@ -2767,132 +2917,6 @@ int main(void)
 						getDateTimeString((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StopDateTime);
 					}
 
-					// If RFID SN different with start user, it need to authorize ID
-					if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
-					{
-						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH) && !ShmOCPP16Data->SpMsg.bits.AuthorizeReq)
-						{
-							// Request authorization
-							ftime(&startTime[gun_index][TMR_IDX_AUTH]);
-							memset(ShmSysConfigAndInfo->SysConfig.UserId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
-							if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
-							{
-								// Big endian
-								switch(rfid.snType)
-								{
-									case RFID_SN_TYPE_6BYTE:
-										sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
-										break;
-									case RFID_SN_TYPE_7BYTE:
-										sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
-										break;
-									case RFID_SN_TYPE_10BYTE:
-										sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
-										break;
-									case RFID_SN_TYPE_4BYTE:
-									default:
-										sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
-										break;
-								}
-							}
-							else
-							{
-								// Little endian
-								switch(rfid.snType)
-								{
-									case RFID_SN_TYPE_6BYTE:
-										sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-										break;
-									case RFID_SN_TYPE_7BYTE:
-										sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-										break;
-									case RFID_SN_TYPE_10BYTE:
-										sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-										break;
-									case RFID_SN_TYPE_4BYTE:
-									default:
-										sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
-										break;
-								}
-							}
-							DEBUG_INFO("End request User Id : %s\r\n", ShmSysConfigAndInfo->SysConfig.UserId);
-							DEBUG_INFO("Start method : %d...\r\n ", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod);
-
-							if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID)
-							{
-								switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
-								{
-									case AUTH_MODE_ENABLE:
-										if(ShmOCPP16Data->OcppConnStatus)
-										{
-											// On line
-											ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
-										}
-										else
-										{
-											// Off line
-											switch(ShmSysConfigAndInfo->SysConfig.OfflinePolicy)
-											{
-												case OFF_POLICY_LOCALLIST:
-													ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
-													break;
-												case OFF_POLICY_PH_RFID:
-													break;
-												case OFF_POLICY_FREE:
-													break;
-												case OFF_POLICY_NOCHARGE:
-												default:
-													break;
-											}
-										}
-										break;
-									case AUTH_MODE_DISABLE:
-									default:
-										break;
-								}
-							}
-							else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND)
-							{
-								ShmCharger->gun_info[gun_index].rfidReq = OFF;
-								DEBUG_INFO("Need to match with start method : START_METHOD_BACKEND...\r\n");
-								setChargerMode(gun_index, SYS_MODE_CHARGING);
-							}
-							else if (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BLE)
-							{
-								ShmCharger->gun_info[gun_index].rfidReq = OFF;
-								DEBUG_INFO("Need to match with start method : START_METHOD_BLE...\r\n");
-								setChargerMode(gun_index, SYS_MODE_CHARGING);
-							}
-							else
-							{}
-						}
-						else
-						{
-							if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf ||
-							  (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
-							  (!ShmOCPP16Data->OcppConnStatus&&(ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
-							{
-								if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
-								   (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
-								   (!ShmOCPP16Data->OcppConnStatus&&(ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
-								{
-									ShmCharger->gun_info[gun_index].isAuthPassEnd = ON;
-								}
-								else
-								{
-									ShmCharger->gun_info[gun_index].rfidReq = OFF;
-
-									DEBUG_INFO("Authorize fail.\r\n");
-									setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
-									setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
-									sleep(3);
-								}
-
-								ShmOCPP16Data->SpMsg.bits.AuthorizeConf = OFF;
-							}
-						}
-					}
-
 					// End authorize pass
 					if(((ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchStartUser(gun_index)) ||
 					   (ShmCharger->gun_info[gun_index].isAuthPassEnd) ||

BIN
EVSE/Projects/AW-Regular/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/AW-Regular/Images/MLO


BIN
EVSE/Projects/AW-Regular/Images/ramdisk.gz


BIN
EVSE/Projects/AW-Regular/Images/u-boot.img


BIN
EVSE/Projects/AW-Regular/Images/zImage


BIN
EVSE/Projects/BYTON-GB/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/BYTON-GB/Images/ramdisk.gz


BIN
EVSE/Projects/Noodoe/Images/FactoryDefaultConfig.bin


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


+ 43 - 0
EVSE/rootfs/var/www/get_query_action.php

@@ -0,0 +1,43 @@
+<?php
+	// 設置資料類型 json,編碼格式 utf-8
+	header('Content-Type: application/json; charset=UTF-8');
+	
+	// 判斷如果是 GET 請求,則進行搜尋;如果是 POST 請求,則進行新建
+	// $_SERVER['REQUEST_METHOD'] 返回訪問頁面使用的請求方法
+	if ($_SERVER['REQUEST_METHOD'] == "GET") {
+		create();
+	} else if ($_SERVER['REQUEST_METHOD'] == "POST") {
+		create();
+	}
+
+	// 新建員工
+	function create() {
+		if($_REQUEST['opt']!=0 && $_REQUEST['opt']!=1 && $_REQUEST['opt']!=2 && $_REQUEST['opt']!=3 && $_REQUEST['opt']!=4){
+			echo "parameter error, opt should be integer between 0~4";
+			exit;
+		} 
+		chdir("/root");
+		exec("'./WebService' 'query'",$output,$return_var);
+		if(count($output)==0){
+//			echo '<script>alert("Something went wrong on machine");</script>';
+			echo "Something went wrong on machine";
+			exit;
+		}
+		if(trim($output[0])=="InitShareMemory Error"){
+//			echo '<script>alert("InitShareMemory Error");</script>';
+			echo "InitShareMemory Error";
+			exit;
+		}
+		$obj[1] = trim($output[0]);
+		$obj[2] = trim($output[1]);
+		$obj[3] = trim($output[2]);
+		$obj[4] = trim($output[3]);
+		$obj10 = json_decode(trim($output[0]));
+		$obj20 = json_decode(trim($output[1]));
+		$obj30 = json_decode(trim($output[2]));
+		$obj40 = json_decode(trim($output[3]));
+		$arr=array($obj10,$obj20,$obj30,$obj40);
+		$obj[0]=json_encode($arr);
+		echo $obj[$_REQUEST['opt']];
+	}
+?>

+ 1 - 1
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.version

@@ -1 +1 @@
-9
+10

Some files were not shown because too many files changed in this diff