Преглед изворни кода

2019-12-13 / ct_chen

Actions:
1. optimize web service
2. fix error "413 request entity too large"

Files:
1. EVSE/rootfs/var/www/*.php
   EVSE/Modularization/WebService.c
2. EVSE/rootfs/etc/lighttpd/lighttpd.conf
ct_chen пре 5 година
родитељ
комит
036b989b43

+ 179 - 84
EVSE/Modularization/WebService.c

@@ -640,38 +640,38 @@ int main(int argc, char *argv[]) {
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ModelName, "DWLU700111W1PH");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber, "SerialNumber");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId, "1234567890");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemDateTime, "SystemDateTime");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AcPhaseCount, "1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FactoryConfiguration, "1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AuthorisationMode, "1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.DefaultLanguage, "a");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemDateTime, "2019-12-31 23:59:59");
+		ShmSysConfigAndInfo->SysConfig.AcPhaseCount=1;
+		ShmSysConfigAndInfo->SysInfo.FactoryConfiguration=0;
+		ShmSysConfigAndInfo->SysConfig.AuthorisationMode=0;
+		ShmSysConfigAndInfo->SysConfig.DefaultLanguage=0;
 		ShmSysConfigAndInfo->SysInfo.InputVoltageR=0;
 		ShmSysConfigAndInfo->SysInfo.InputVoltageS=0;
 		ShmSysConfigAndInfo->SysInfo.InputVoltageT=0;
 		ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed=0;
 		ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed=0;
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian, "0");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPower5V, "0");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPower12V, "0");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPower24V, "0");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPower48V, "0");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev, "CsuHwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev, "CsuBootLoadFwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, "CsuKernelFwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "CsuRootFsFwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, "CsuPrimFwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev, "LcmHwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev, "LcmFwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev, "PsuHwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev, "PsuPrimFwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev, "PsuSecFwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev, "AuxPwrHwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev, "AuxPwrFwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev, "FanModuleHwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev, "FanModuleFwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev, "RelayModuleHwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev, "RelayModuleFwRev");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev, "TelcomModemFwRev");
+		ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian=0;
+		ShmSysConfigAndInfo->SysInfo.AuxPower5V=0;
+		ShmSysConfigAndInfo->SysInfo.AuxPower12V=0;
+		ShmSysConfigAndInfo->SysInfo.AuxPower24V=0;
+		ShmSysConfigAndInfo->SysInfo.AuxPower48V=0;
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev, "");
+		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev, "");
 		ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp=0;
 		ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp=0;
 		ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp=0;
@@ -689,7 +689,7 @@ int main(int argc, char *argv[]) {
 		ShmSysConfigAndInfo->SysConfig.MaxChargingPower=0;
 		ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent= 0;
 		ShmSysConfigAndInfo->SysConfig.MaxChargingDuration=0;
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy, "1");
+		ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy=0;
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0], "111");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1], "222");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2], "333");
@@ -701,8 +701,8 @@ int main(int argc, char *argv[]) {
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8], "999");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9], "aaa");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.UserId, "UserId");
-		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingVoltage=(float) 64;
-		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingCurrent=(double) 6553.5;
+		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingVoltage=0;
+		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingCurrent=0;
 		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingPower=0;
 		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedEnergy=0;
 		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedDuration=0;
@@ -710,53 +710,53 @@ int main(int argc, char *argv[]) {
 		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatteryMaxVoltage=0;
 		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetVoltage=0;
 		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterySoc=0;
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].SystemStatus, "1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Index, "1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Type, "0");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].type_index, "1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetCurrent, "1");
+		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].SystemStatus=1;
+		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Index=0;
+		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Type=0;
+		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].type_index=0;
+		ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetCurrent=1;
 		//network
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.InternetConn,"1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,"FtpServer");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient,"1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress,"EthMacAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,"EthIpAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,"EthIpAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,"EthGatewayAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient,"1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress,"EthMacAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,"EthIpAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,"EthSubmaskAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,"EthGatewayAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode,"1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,"WifiSsid");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,"WifiSsid");
+		ShmSysConfigAndInfo->SysInfo.InternetConn=0;
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,"");
+		ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=1;
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress,"");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,"192.168.1.10");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,"255.255.255.0");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,"192.168.1.1");
+		ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient=1;
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress,"");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,"192.168.0.10");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,"255.255.255.0");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,"192.168.0.1");
+		ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=1;
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,"");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,"");
 		ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi=0;
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer,"1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient,"1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress,"WifiMacAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,"WifiIpAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,"WifiSubmaskAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,"WifiGatewayAddress");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,"TelcomApn");
+		ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=0;
+		ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=0;
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress,"");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,"");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,"");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,"");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,"");
 		ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi=0;
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,"TelcomChapPapId");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,"TelcomChapPapPwd");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei,"TelcomModemImei");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi,"TelcomSimImsi");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus,"1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode,"1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,"TelcomIpAddress");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,"");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,"");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei,"");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi,"");
+		ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus=0;
+		ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode=0;
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,"");
 		//backend
-		ShmSysConfigAndInfo->SysConfig.BackendConnTimeout=0;
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OfflinePolicy,"1");
+		ShmSysConfigAndInfo->SysConfig.BackendConnTimeout=300;
+		ShmSysConfigAndInfo->SysConfig.OfflinePolicy=0;
 		ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy=0;
 		ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration=0;
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.OcppConnStatus,"1");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"OcppServerURL");
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,"ChargeBoxId");
+		ShmSysConfigAndInfo->SysInfo.OcppConnStatus=0;
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,"");
 
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FirmwareUpdate,"0");
+		ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=0;
 		StoreUsrConfigData(&SysConfig);
 
 		#ifdef SystemLogMessage
@@ -786,7 +786,7 @@ int main(int argc, char *argv[]) {
 		jobj=json_object_new_object();
 		//system
 		//if((char)ShmSysConfigAndInfo->SysInfo.FirmwareUpdate == '0'){
-		strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FirmwareUpdate, "1");
+		ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=1;
 		Result = json_object_new_string("success");
 		Message = json_object_new_string("file is uploaded");
 		//}
@@ -885,6 +885,12 @@ int main(int argc, char *argv[]) {
 		struct json_object *ChargingInfo1;
 		struct json_object *ChargingInfo2;
 		struct json_object *ChargingInfo3;
+		struct json_object *CardNumber[3];
+		struct json_object *StartUserId[3];
+		struct json_object *StartDateTime[3];
+		struct json_object *StopDateTime[3];
+		struct json_object *StartMethod[3];
+		struct json_object *ConnectorTemp[3];
 		struct json_object *PresentChargingVoltage[3];
 		struct json_object *PresentChargingCurrent[3];
 		struct json_object *PresentChargingPower[3];
@@ -1035,7 +1041,13 @@ int main(int argc, char *argv[]) {
 				Index[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index,1);
 				Type[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type,1);
 				type_index[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index,1);
-				EvBatterytargetCurrent[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
+				CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].CardNumber);
+				StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
+				StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
+				StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
+				StartMethod[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod,1);
+				ConnectorTemp[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp,1);
 				CcsGunQty++;
 			}
 			else if(connectorType1 == 2){//GB
@@ -1052,7 +1064,13 @@ int main(int argc, char *argv[]) {
 				Index[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index,1);
 				Type[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type,1);
 				type_index[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index,1);
-				EvBatterytargetCurrent[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
+				CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].CardNumber);
+				StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StartUserId);
+				StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StartDateTime);
+				StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StopDateTime);
+				StartMethod[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StartMethod,1);
+				ConnectorTemp[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].ConnectorTemp,1);
 				GbGunQty++;
 			}
 			else if(connectorType1 == 3){//CHAdeMO
@@ -1069,7 +1087,13 @@ int main(int argc, char *argv[]) {
 				Index[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index,1);
 				Type[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type,1);
 				type_index[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index,1);
-				EvBatterytargetCurrent[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
+				CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].CardNumber);
+				StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StartUserId);
+				StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StartDateTime);
+				StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StopDateTime);
+				StartMethod[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StartMethod,1);
+				ConnectorTemp[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].ConnectorTemp,1);
 				CHAdeMOGunQty++;
 			}
 			else if(connectorType1 == 4){//AC
@@ -1086,7 +1110,13 @@ int main(int argc, char *argv[]) {
 				Index[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index,1);
 				Type[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type,1);
 				type_index[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index,1);
-				EvBatterytargetCurrent[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
+				CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].CardNumber);
+				StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StartUserId);
+				StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StartDateTime);
+				StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StopDateTime);
+				StartMethod[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StartMethod,1);
+				ConnectorTemp[0] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].ConnectorTemp,1);
 				AcGunQty++;
 			}
 		}
@@ -1105,7 +1135,13 @@ int main(int argc, char *argv[]) {
 				Index[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index,1);
 				Type[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type,1);
 				type_index[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index,1);
-				EvBatterytargetCurrent[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
+				CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].CardNumber);
+				StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
+				StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
+				StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
+				StartMethod[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod,1);
+				ConnectorTemp[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp,1);
 				CcsGunQty++;
 			}
 			else if(connectorType2 == 2){//GB
@@ -1122,7 +1158,13 @@ int main(int argc, char *argv[]) {
 				Index[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index,1);
 				Type[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type,1);
 				type_index[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index,1);
-				EvBatterytargetCurrent[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
+				CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].CardNumber);
+				StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StartUserId);
+				StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StartDateTime);
+				StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StopDateTime);
+				StartMethod[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StartMethod,1);
+				ConnectorTemp[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].ConnectorTemp,1);
 				GbGunQty++;
 			}
 			else if(connectorType2 == 3){//CHAdeMO
@@ -1139,7 +1181,13 @@ int main(int argc, char *argv[]) {
 				Index[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index,1);
 				Type[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type,1);
 				type_index[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index,1);
-				EvBatterytargetCurrent[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
+				CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].CardNumber);
+				StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StartUserId);
+				StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StartDateTime);
+				StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StopDateTime);
+				StartMethod[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StartMethod,1);
+				ConnectorTemp[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].ConnectorTemp,1);
 				CHAdeMOGunQty++;
 			}
 			else if(connectorType2 == 4){//AC
@@ -1156,7 +1204,13 @@ int main(int argc, char *argv[]) {
 				Index[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index,1);
 				Type[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type,1);
 				type_index[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index,1);
-				EvBatterytargetCurrent[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
+				CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].CardNumber);
+				StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StartUserId);
+				StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StartDateTime);
+				StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StopDateTime);
+				StartMethod[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StartMethod,1);
+				ConnectorTemp[1] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].ConnectorTemp,1);
 				AcGunQty++;
 			}
 		}
@@ -1175,7 +1229,13 @@ int main(int argc, char *argv[]) {
 				Index[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index,1);
 				Type[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type,1);
 				type_index[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index,1);
-				EvBatterytargetCurrent[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
+				CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].CardNumber);
+				StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
+				StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
+				StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
+				StartMethod[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod,1);
+				ConnectorTemp[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp,1);
 				CcsGunQty++;
 			}
 			else if(connectorType3 == 2){//GB
@@ -1192,7 +1252,13 @@ int main(int argc, char *argv[]) {
 				Index[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index,1);
 				Type[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type,1);
 				type_index[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index,1);
-				EvBatterytargetCurrent[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
+				CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].CardNumber);
+				StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StartUserId);
+				StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StartDateTime);
+				StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StopDateTime);
+				StartMethod[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].StartMethod,1);
+				ConnectorTemp[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].ConnectorTemp,1);
 				GbGunQty++;
 			}
 			else if(connectorType3 == 3){//CHAdeMO
@@ -1209,7 +1275,13 @@ int main(int argc, char *argv[]) {
 				Index[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index,1);
 				Type[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type,1);
 				type_index[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index,1);
-				EvBatterytargetCurrent[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
+				CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].CardNumber);
+				StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StartUserId);
+				StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StartDateTime);
+				StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StopDateTime);
+				StartMethod[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].StartMethod,1);
+				ConnectorTemp[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].ConnectorTemp,1);
 				CHAdeMOGunQty++;
 			}
 			else if(connectorType3 == 4){//AC
@@ -1226,7 +1298,13 @@ int main(int argc, char *argv[]) {
 				Index[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index,1);
 				Type[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type,1);
 				type_index[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index,1);
-				EvBatterytargetCurrent[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent,1);
+				EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
+				CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].CardNumber);
+				StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StartUserId);
+				StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StartDateTime);
+				StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StopDateTime);
+				StartMethod[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].StartMethod,1);
+				ConnectorTemp[2] = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[AcGunQty].ConnectorTemp,1);
 				AcGunQty++;
 			}
 		}
@@ -1343,8 +1421,13 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj2,"LocalWhiteCard",LocalWhiteCardArr);
 //		json_object_object_add(jobj2,"CcsAuthentication",CcsAuthentication);
 //		json_object_object_add(jobj2,"AcCcsChargingMode",AcCcsChargingMode);
-		json_object_object_add(jobj2,"UserId",UserId);
 		if(connectorType1 != 0){
+			json_object_object_add(ChargingInfo1,"CardNumber",CardNumber[0]);
+			json_object_object_add(ChargingInfo1,"StartUserId",StartUserId[0]);
+			json_object_object_add(ChargingInfo1,"StartDateTime",StartDateTime[0]);
+			json_object_object_add(ChargingInfo1,"StoptDateTime",StopDateTime[0]);
+			json_object_object_add(ChargingInfo1,"StartMethod",StartMethod[0]);
+			json_object_object_add(ChargingInfo1,"ConnectorTemp",ConnectorTemp[0]);
 			json_object_object_add(ChargingInfo1,"PresentChargingVoltage",PresentChargingVoltage[0]);
 			json_object_object_add(ChargingInfo1,"PresentChargingCurrent",PresentChargingCurrent[0]);
 			json_object_object_add(ChargingInfo1,"PresentChargingPower",PresentChargingPower[0]);
@@ -1362,6 +1445,12 @@ int main(int argc, char *argv[]) {
 			json_object_object_add(jobj2,"ChargingInfo1",ChargingInfo1);
 		}
 		if(connectorType2 != 0){
+			json_object_object_add(ChargingInfo2,"CardNumber",CardNumber[1]);
+			json_object_object_add(ChargingInfo2,"StartUserId",StartUserId[1]);
+			json_object_object_add(ChargingInfo2,"StartDateTime",StartDateTime[1]);
+			json_object_object_add(ChargingInfo2,"StoptDateTime",StopDateTime[1]);
+			json_object_object_add(ChargingInfo2,"StartMethod",StartMethod[1]);
+			json_object_object_add(ChargingInfo2,"ConnectorTemp",ConnectorTemp[1]);
 			json_object_object_add(ChargingInfo2,"PresentChargingVoltage",PresentChargingVoltage[1]);
 			json_object_object_add(ChargingInfo2,"PresentChargingCurrent",PresentChargingCurrent[1]);
 			json_object_object_add(ChargingInfo2,"PresentChargingPower",PresentChargingPower[1]);
@@ -1379,6 +1468,12 @@ int main(int argc, char *argv[]) {
 			json_object_object_add(jobj2,"ChargingInfo2",ChargingInfo2);
 		}
 		if(connectorType3 != 0){
+			json_object_object_add(ChargingInfo3,"CardNumber",CardNumber[2]);
+			json_object_object_add(ChargingInfo3,"StartUserId",StartUserId[2]);
+			json_object_object_add(ChargingInfo3,"StartDateTime",StartDateTime[2]);
+			json_object_object_add(ChargingInfo3,"StoptDateTime",StopDateTime[2]);
+			json_object_object_add(ChargingInfo3,"StartMethod",StartMethod[2]);
+			json_object_object_add(ChargingInfo3,"ConnectorTemp",ConnectorTemp[2]);
 			json_object_object_add(ChargingInfo3,"PresentChargingVoltage",PresentChargingVoltage[2]);
 			json_object_object_add(ChargingInfo3,"PresentChargingCurrent",PresentChargingCurrent[2]);
 			json_object_object_add(ChargingInfo3,"PresentChargingPower",PresentChargingPower[2]);

+ 1 - 1
EVSE/rootfs/etc/lighttpd/lighttpd.conf

@@ -18,7 +18,7 @@ server.max-fds = 2048
 server.stat-cache-engine        = "simple"
 server.max-connections          = 1024
 server.follow-symlink           = "enable"
-server.upload-dirs              = ( "/var/tmp" )
+server.upload-dirs              = ( "/mnt" )
 
 ssl.engine = "enable"
 ssl.pemfile = "/etc/lighttpd/ssl/lighttpd.pem"

+ 2 - 2
EVSE/rootfs/var/www/head.php

@@ -112,8 +112,8 @@
     <!--
     * Google Fonts
     //-->
-    <link href='http://fonts.googleapis.com/css?family=Raleway:400,100,200,300,500,600,700,800' rel='stylesheet' type='text/css'>
-    <link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'>
+    <link href='//fonts.googleapis.com/css?family=Raleway:400,100,200,300,500,600,700,800' rel='stylesheet' type='text/css'>
+    <link href='//fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'>
     <!-- Bootstrap core CSS -->
     <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
     <!-- Custom CSS -->

+ 6 - 6
EVSE/rootfs/var/www/set_backend.php

@@ -51,15 +51,15 @@
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>OfflinePolicy</label>
 											<select class="form-control" id="OfflinePolicy" name="OfflinePolicy">
-												<option value="0" <?php echo $obj->{'OfflinePolicy'}==0?"selected":""?>>local list</option>
-												<option value="1" <?php echo $obj->{'OfflinePolicy'}==1?"selected":""?>>Phihong RFID tag</option>
-												<option value="2" <?php echo $obj->{'OfflinePolicy'}==2?"selected":""?>>free charging</option>
-												<option value="3" <?php echo $obj->{'OfflinePolicy'}==3?"selected":""?>>no charging</option>
+												<option value="0" <?php echo ord($obj->{'OfflinePolicy'})=="0"?"selected":""?>>local list</option>
+												<option value="1" <?php echo ord($obj->{'OfflinePolicy'})=="1"?"selected":""?>>Phihong RFID tag</option>
+												<option value="2" <?php echo ord($obj->{'OfflinePolicy'})=="2"?"selected":""?>>free charging</option>
+												<option value="3" <?php echo ord($obj->{'OfflinePolicy'})=="3"?"selected":""?>>no charging</option>
 											</select>
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>OfflineMaxChargeEnergy</label>
-											<small class="form-text text-muted-red">kWh</small>											
+											<small class="form-text text-muted-red">kWh</small>
 											<input type="text" name="OfflineMaxChargeEnergy" id="OfflineMaxChargeEnergy" class="form-control" value="<?php echo $obj->{'OfflineMaxChargeEnergy'};?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
@@ -76,7 +76,7 @@
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>OcppConnStatus</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $OcppConnStatus;?>">
-											<input type="hidden" name="OcppConnStatus" id="OcppConnStatus" value="<?php echo $obj->{'OcppConnStatus'};?>">
+											<input type="hidden" name="OcppConnStatus" id="OcppConnStatus" value="<?php echo ord($obj->{'OcppConnStatus'});?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>OcppServerURL</label>

+ 23 - 8
EVSE/rootfs/var/www/set_backend_action.php

@@ -12,22 +12,23 @@
 
 	// 新建員工
 	function create() {
+		$pattern="/^(ws|wss):\/\/((([0-9]{1,3}\.){3}[0-9]{1,3})|(([a-zA-Z0-9]+(([\-]?[a-zA-Z0-9]+)*\.)+)*[a-zA-Z]{2,}))+/";
+		if(!preg_match($pattern, $_POST['OcppServerURL'])){
+			$jsone['result'] = "Fail";
+			$jsone['message'] = "OcppServerURL format error, fill it with 'ws://' or 'wss://'";
+			echo json_encode($jsone);
+			return false;
+		}
+		checkValue("OfflinePolicy");
 //		$json = json_decode(file_get_contents("charging.txt"), true);
 //		$json = string[];
 		$json['BackendConnTimeout']			= (int)$_POST['BackendConnTimeout'];
-		$json['OfflinePolicy']				= $_POST['OfflinePolicy'];
+		$json['OfflinePolicy']				= chr($_POST['OfflinePolicy']);
 		$json['OfflineMaxChargeEnergy']		= (int)$_POST['OfflineMaxChargeEnergy'];
 		$json['OfflineMaxChargeDuration']	= (int)$_POST['OfflineMaxChargeDuration'];
 //		$json['OcppConnStatus']				= $_POST['OcppConnStatus'];
 		$json['OcppServerURL']				= $_POST['OcppServerURL'];
 		$json['ChargeBoxId']				= $_POST['ChargeBoxId'];
-		$pattern="/^(ws|wss):\/\/((([0-9]{1,3}\.){3}[0-9]{1,3})|(([a-zA-Z0-9]+(([\-]?[a-zA-Z0-9]+)*\.)+)*[a-zA-Z]{2,}))+/";
-		if(!preg_match($pattern, $_POST['OcppServerURL'])){
-			$jsone['result'] = "Fail";
-			$jsone['message'] = "OcppServerURL format error, fill it with 'ws://' or 'wss://'";
-			echo json_encode($jsone);
-			return false;
-		}
 //		var_dump($json);echo "\n\n";
 		//echo json_encode($json);
 		$jsone['result'] = "Success";
@@ -46,4 +47,18 @@
 		//echo "OK";
 	}
 
+	function checkValue($id){
+		if(strlen($_POST[$id])!=1){
+				$jsone['result'] = "Fail";
+				$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+				echo json_encode($jsone);
+				exit;
+		}
+		if(!ereg("[0-9]",$_POST[$id])){
+				$jsone['result'] = "Fail";
+				$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+				echo json_encode($jsone);
+				exit;
+		}
+	}
 ?>

+ 244 - 49
EVSE/rootfs/var/www/set_charging.php

@@ -5,6 +5,90 @@
 	$obj = json_decode(trim($output[1]),true);//var_dump($obj);
 	$ChargingInfo3=$obj['ChargingInfo3'];//var_dump($ChargingInfo3);
 	$idx=0;
+	if($obj['ChargingInfo1']){
+		switch (ord($obj['ChargingInfo1']['SystemStatus'])){
+			case 0:
+				$SystemStatus1='booting';
+				break;
+			case 1:
+				$SystemStatus1='idle';
+				break;
+			case 2:
+				$SystemStatus1='authorizing';
+				break;
+			case 3:
+				$SystemStatus1='preparing';
+				break;
+			case 4:
+				$SystemStatus1='charging';
+				break;
+			case 5:
+				$SystemStatus1='terminating';
+				break;
+			case 6:
+				$SystemStatus1='alarm';
+				break;
+			case 7:
+				$SystemStatus1='fault';
+				break;
+		}
+	}
+	if($obj['ChargingInfo2']){
+		switch (ord($obj['ChargingInfo2']['SystemStatus'])){
+			case 0:
+				$SystemStatus2='booting';
+				break;
+			case 1:
+				$SystemStatus2='idle';
+				break;
+			case 2:
+				$SystemStatus2='authorizing';
+				break;
+			case 3:
+				$SystemStatus2='preparing';
+				break;
+			case 4:
+				$SystemStatus2='charging';
+				break;
+			case 5:
+				$SystemStatus2='terminating';
+				break;
+			case 6:
+				$SystemStatus2='alarm';
+				break;
+			case 7:
+				$SystemStatus2='fault';
+				break;
+		}
+	}
+	if($obj['ChargingInfo3']){
+		switch (ord($obj['ChargingInfo3']['SystemStatus'])){
+			case 0:
+				$SystemStatus3='booting';
+				break;
+			case 1:
+				$SystemStatus3='idle';
+				break;
+			case 2:
+				$SystemStatus3='authorizing';
+				break;
+			case 3:
+				$SystemStatus3='preparing';
+				break;
+			case 4:
+				$SystemStatus3='charging';
+				break;
+			case 5:
+				$SystemStatus3='terminating';
+				break;
+			case 6:
+				$SystemStatus3='alarm';
+				break;
+			case 7:
+				$SystemStatus3='fault';
+				break;
+		}
+	}
 ?>
 	<div class="envor-content">
 		<!--
@@ -54,8 +138,8 @@
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>PhaseLossPolicy</label>
 											<select class="form-control" id="PhaseLossPolicy" name="PhaseLossPolicy">
-												<option value="0" <?php echo $obj['PhaseLossPolicy']==0?"selected":""?>>charging</option>
-												<option value="1" <?php echo $obj['PhaseLossPolicy']==1?"selected":""?>>stop charging</option>
+												<option value="0" <?php echo ord($obj['PhaseLossPolicy'])=="0"?"selected":""?>>charging</option>
+												<option value="1" <?php echo ord($obj['PhaseLossPolicy'])=="1"?"selected":""?>>stop charging</option>
 											</select>
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
@@ -98,20 +182,20 @@
 											<label>LocalWhiteCard9</label>
 											<input type="text" name="LocalWhiteCard9" id="LocalWhiteCard9" class="form-control" value="<?php echo $obj['LocalWhiteCard'][9];?>">
 										</div>
-										<div class="form-group" style="display:<?php echo $am111;?>">
+<?php /*										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>CcsAuthentication</label>
 											<select class="form-control" id="CcsAuthentication" name="CcsAuthentication">
-												<option value="0" <?php echo $obj['CcsAuthentication']==0?"selected":""?>>EIM</option>
-												<option value="1" <?php echo $obj['CcsAuthentication']==1?"selected":""?>>EIM&PnC mixed</option>
+												<option value="0" <?php echo ord($obj['CcsAuthentication'])==0?"selected":""?>>EIM</option>
+												<option value="1" <?php echo ord($obj['CcsAuthentication'])==1?"selected":""?>>EIM&PnC mixed</option>
 											</select>
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>AcCcsChargingModel</label>
 											<select class="form-control" id="AcCcsChargingModel" name="AcCcsChargingModel">
-												<option value="0" <?php echo $obj['AcCcsChargingModel']==0?"selected":""?>>BC (PWM) only</option>
-												<option value="1" <?php echo $obj['AcCcsChargingModel']==0?"selected":""?>>BC&PLC mixed</option>
+												<option value="0" <?php echo ord($obj['AcCcsChargingModel'])==0?"selected":""?>>BC (PWM) only</option>
+												<option value="1" <?php echo ord($obj['AcCcsChargingModel'])==0?"selected":""?>>BC&PLC mixed</option>
 											</select>
-										</div>
+										</div>*/?>
 									</section>
 								</article>
 <?php if($obj['ChargingInfo1']){ $idx++;?>
@@ -121,53 +205,83 @@
 									<section>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>User Id</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['UserId'];?>">
-											<input type="hidden" name="UserId" id="UserId" value="<?php echo $obj->{'UserId'};?>">
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['StartUserId'];?>">
+											<input type="hidden" name="UserId1" id="UserId1" value="<?php echo $obj['ChargingInfo1']['StartUserId'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>Card Number</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['CardNumber'];?>">
+											<input type="hidden" name="CardNumber1" id="CardNumber1" value="<?php echo $obj['ChargingInfo1']['CardNumber'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>StartDateTime</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['StartDateTime'];?>">
+											<input type="hidden" name="StartDateTime1" id="StartDateTime1" value="<?php echo $obj['ChargingInfo1']['StartDateTime'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>StoptDateTime</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['StoptDateTime'];?>">
+											<input type="hidden" name="StoptDateTime1" id="StoptDateTime1" value="<?php echo $obj['ChargingInfo1']['StoptDateTime'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>StartMethod</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo ord($obj['ChargingInfo1']['StartMethod']);?>">
+											<input type="hidden" name="StartMethod1" id="StartMethod1" value="<?php echo ord($obj['ChargingInfo1']['StartMethod']);?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>SystemStatus</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $SystemStatus1;?>">
+											<input type="hidden" name="SystemStatus1" id="SystemStatus1" value="<?php echo ord($obj['ChargingInfo1']['SystemStatus']);?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>ConnectorTemp</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['ConnectorTemp'];?>">
+											<input type="hidden" name="ConnectorTemp1" id="ConnectorTemp1" value="<?php echo $obj['ChargingInfo1']['ConnectorTemp'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>PresentChargingVoltage</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingVoltage'];?>">
-											<input type="hidden" name="PresentChargingVoltage" id="PresentChargingVoltage" value="<?php echo $obj->{'PresentChargingVoltage'};?>">
+											<input type="hidden" name="PresentChargingVoltage1" id="PresentChargingVoltage1" value="<?php echo $obj['ChargingInfo1']['PresentChargingVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargingCurrent</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingCurrent'];?>">
-											<input type="hidden" name="PresentChargingCurrent" id="PresentChargingCurrent" value="<?php echo $obj->{'PresentChargingCurrent'};?>">
+											<input type="hidden" name="PresentChargingCurrent1" id="PresentChargingCurrent1" value="<?php echo $obj['ChargingInfo1']['PresentChargingCurrent'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargingPower</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingPower'];?>">
-											<input type="hidden" name="PresentChargingPower" id="PresentChargingPower" value="<?php echo $obj->{'PresentChargingPower'};?>">
+											<input type="hidden" name="PresentChargingPower1" id="PresentChargingPower1" value="<?php echo $obj['ChargingInfo1']['PresentChargingPower'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargedEnergy</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargedEnergy'];?>">
-											<input type="hidden" name="PresentChargedEnergy" id="PresentChargedEnergy" value="<?php echo $obj->{'PresentChargedEnergy'};?>">
+											<input type="hidden" name="PresentChargedEnergy1" id="PresentChargedEnergy1" value="<?php echo $obj['ChargingInfo1']['PresentChargedEnergy'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargedDuration</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargedDuration'];?>">
-											<input type="hidden" name="PresentChargedDuration" id="PresentChargedDuration" value="<?php echo $obj->{'PresentChargedDuration'};?>">
+											<input type="hidden" name="PresentChargedDuration1" id="PresentChargedDuration1" value="<?php echo $obj['ChargingInfo1']['PresentChargedDuration'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>RemainChargingDuration</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['RemainChargingDuration'];?>">
-											<input type="hidden" name="RemainChargingDuration" id="RemainChargingDuration" value="<?php echo $obj->{'RemainChargingDuration'};?>">
+											<input type="hidden" name="RemainChargingDuration1" id="RemainChargingDuration1" value="<?php echo $obj['ChargingInfo1']['RemainChargingDuration'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EvBatteryMaxVoltage</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['EvBatteryMaxVoltage'];?>">
-											<input type="hidden" name="EvBatteryMaxVoltage" id="EvBatteryMaxVoltage" value="<?php echo $obj->{'EvBatteryMaxVoltage'};?>">
+											<input type="hidden" name="EvBatteryMaxVoltage1" id="EvBatteryMaxVoltage1" value="<?php echo $obj['ChargingInfo1']['EvBatteryMaxVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EvBatterytargetVoltage</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['EvBatterytargetVoltage'];?>">
-											<input type="hidden" name="EvBatterytargetVoltage" id="EvBatterytargetVoltage" value="<?php echo $obj->{'EvBatterytargetVoltage'};?>">
+											<input type="hidden" name="EvBatterytargetVoltage1" id="EvBatterytargetVoltage1" value="<?php echo $obj['ChargingInfo1']['EvBatterytargetVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EvBatterySoc</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['EvBatterySoc'];?>">
-											<input type="hidden" name="EvBatterySoc" id="EvBatterySoc" value="<?php echo $obj->{'EvBatterySoc'};?>">
+											<input type="hidden" name="EvBatterySoc1" id="EvBatterySoc1" value="<?php echo $obj['ChargingInfo1']['EvBatterySoc'];?>">
 										</div>
 									</section>
 								</article>
@@ -179,53 +293,83 @@
 									<section>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>User Id</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['UserId'];?>">
-											<input type="hidden" name="UserId" id="UserId" value="<?php echo $obj->{'UserId'};?>">
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['StartUserId'];?>">
+											<input type="hidden" name="UserId2" id="UserId2" value="<?php echo $obj['ChargingInfo2']['StartUserId'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>Card Number</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['CardNumber'];?>">
+											<input type="hidden" name="CardNumber2" id="CardNumber2" value="<?php echo $obj['ChargingInfo2']['CardNumber'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>StartDateTime</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['StartDateTime'];?>">
+											<input type="hidden" name="StartDateTime2" id="StartDateTime2" value="<?php echo $obj['ChargingInfo2']['StartDateTime'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>StoptDateTime</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['StoptDateTime'];?>">
+											<input type="hidden" name="StoptDateTime2" id="StoptDateTime2" value="<?php echo $obj['ChargingInfo2']['StoptDateTime'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>StartMethod</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo ord($obj['ChargingInfo2']['StartMethod']);?>">
+											<input type="hidden" name="StartMethod2" id="StartMethod2" value="<?php echo ord($obj['ChargingInfo2']['StartMethod']);?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>SystemStatus</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $SystemStatus2;?>">
+											<input type="hidden" name="SystemStatus2" id="SystemStatus2" value="<?php echo ord($obj['ChargingInfo2']['SystemStatus']);?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>ConnectorTemp</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['ConnectorTemp'];?>">
+											<input type="hidden" name="ConnectorTemp2" id="ConnectorTemp2" value="<?php echo $obj['ChargingInfo2']['ConnectorTemp'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>PresentChargingVoltage</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['PresentChargingVoltage'];?>">
-											<input type="hidden" name="PresentChargingVoltage" id="PresentChargingVoltage" value="<?php echo $obj->{'PresentChargingVoltage'};?>">
+											<input type="hidden" name="PresentChargingVoltage2" id="PresentChargingVoltage2" value="<?php echo $obj['ChargingInfo2']['PresentChargingVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargingCurrent</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['PresentChargingCurrent'];?>">
-											<input type="hidden" name="PresentChargingCurrent" id="PresentChargingCurrent" value="<?php echo $obj->{'PresentChargingCurrent'};?>">
+											<input type="hidden" name="PresentChargingCurrent2" id="PresentChargingCurrent2" value="<?php echo $obj['ChargingInfo2']['PresentChargingCurrent'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargingPower</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['PresentChargingPower'];?>">
-											<input type="hidden" name="PresentChargingPower" id="PresentChargingPower" value="<?php echo $obj->{'PresentChargingPower'};?>">
+											<input type="hidden" name="PresentChargingPower2" id="PresentChargingPower2" value="<?php echo $obj['ChargingInfo2']['PresentChargingPower'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargedEnergy</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['PresentChargedEnergy'];?>">
-											<input type="hidden" name="PresentChargedEnergy" id="PresentChargedEnergy" value="<?php echo $obj->{'PresentChargedEnergy'};?>">
+											<input type="hidden" name="PresentChargedEnergy2" id="PresentChargedEnergy2" value="<?php echo $obj['ChargingInfo2']['PresentChargedEnergy'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargedDuration</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['PresentChargedDuration'];?>">
-											<input type="hidden" name="PresentChargedDuration" id="PresentChargedDuration" value="<?php echo $obj->{'PresentChargedDuration'};?>">
+											<input type="hidden" name="PresentChargedDuration2" id="PresentChargedDuration2" value="<?php echo $obj['ChargingInfo2']['PresentChargedDuration'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>RemainChargingDuration</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['RemainChargingDuration'];?>">
-											<input type="hidden" name="RemainChargingDuration" id="RemainChargingDuration" value="<?php echo $obj->{'RemainChargingDuration'};?>">
+											<input type="hidden" name="RemainChargingDuration2" id="RemainChargingDuration2" value="<?php echo $obj['ChargingInfo2']['RemainChargingDuration'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EvBatteryMaxVoltage</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['EvBatteryMaxVoltage'];?>">
-											<input type="hidden" name="EvBatteryMaxVoltage" id="EvBatteryMaxVoltage" value="<?php echo $obj->{'EvBatteryMaxVoltage'};?>">
+											<input type="hidden" name="EvBatteryMaxVoltage2" id="EvBatteryMaxVoltage2" value="<?php echo $obj['ChargingInfo2']['EvBatteryMaxVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EvBatterytargetVoltage</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['EvBatterytargetVoltage'];?>">
-											<input type="hidden" name="EvBatterytargetVoltage" id="EvBatterytargetVoltage" value="<?php echo $obj->{'EvBatterytargetVoltage'};?>">
+											<input type="hidden" name="EvBatterytargetVoltage2" id="EvBatterytargetVoltage2" value="<?php echo $obj['ChargingInfo2']['EvBatterytargetVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EvBatterySoc</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['EvBatterySoc'];?>">
-											<input type="hidden" name="EvBatterySoc" id="EvBatterySoc" value="<?php echo $obj->{'EvBatterySoc'};?>">
+											<input type="hidden" name="EvBatterySoc2" id="EvBatterySoc2" value="<?php echo $obj['ChargingInfo2']['EvBatterySoc'];?>">
 										</div>
 									</section>
 								</article>
@@ -237,53 +381,83 @@
 									<section>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>User Id</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['UserId'];?>">
-											<input type="hidden" name="UserId" id="UserId" value="<?php echo $obj->{'UserId'};?>">
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['StartUserId'];?>">
+											<input type="hidden" name="UserId3" id="UserId3" value="<?php echo $obj['ChargingInfo3']['StartUserId'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>Card Number</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['CardNumber'];?>">
+											<input type="hidden" name="CardNumber3" id="CardNumber3" value="<?php echo $obj['ChargingInfo3']['CardNumber'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>StartDateTime</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['StartDateTime'];?>">
+											<input type="hidden" name="StartDateTime3" id="StartDateTime3" value="<?php echo $obj['ChargingInfo3']['StartDateTime'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>StoptDateTime</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['StoptDateTime'];?>">
+											<input type="hidden" name="StoptDateTime3" id="StoptDateTime3" value="<?php echo $obj['ChargingInfo3']['StoptDateTime'];?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>StartMethod</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo ord($obj['ChargingInfo3']['StartMethod']);?>">
+											<input type="hidden" name="StartMethod3" id="StartMethod3" value="<?php echo ord($obj['ChargingInfo3']['StartMethod']);?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>SystemStatus</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $SystemStatus3;?>">
+											<input type="hidden" name="SystemStatus3" id="SystemStatus3" value="<?php echo ord($obj['ChargingInfo3']['SystemStatus']);?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>ConnectorTemp</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['ConnectorTemp'];?>">
+											<input type="hidden" name="ConnectorTemp3" id="ConnectorTemp3" value="<?php echo $obj['ChargingInfo3']['ConnectorTemp'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>PresentChargingVoltage</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['PresentChargingVoltage'];?>">
-											<input type="hidden" name="PresentChargingVoltage" id="PresentChargingVoltage" value="<?php echo $obj->{'PresentChargingVoltage'};?>">
+											<input type="hidden" name="PresentChargingVoltage3" id="PresentChargingVoltage3" value="<?php echo $obj['ChargingInfo3']['PresentChargingVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargingCurrent</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['PresentChargingCurrent'];?>">
-											<input type="hidden" name="PresentChargingCurrent" id="PresentChargingCurrent" value="<?php echo $obj->{'PresentChargingCurrent'};?>">
+											<input type="hidden" name="PresentChargingCurrent3" id="PresentChargingCurrent3" value="<?php echo $obj['ChargingInfo3']['PresentChargingCurrent'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargingPower</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['PresentChargingPower'];?>">
-											<input type="hidden" name="PresentChargingPower" id="PresentChargingPower" value="<?php echo $obj->{'PresentChargingPower'};?>">
+											<input type="hidden" name="PresentChargingPower3" id="PresentChargingPower3" value="<?php echo $obj['ChargingInfo3']['PresentChargingPower'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargedEnergy</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['PresentChargedEnergy'];?>">
-											<input type="hidden" name="PresentChargedEnergy" id="PresentChargedEnergy" value="<?php echo $obj->{'PresentChargedEnergy'};?>">
+											<input type="hidden" name="PresentChargedEnergy3" id="PresentChargedEnergy3" value="<?php echo $obj['ChargingInfo3']['PresentChargedEnergy'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>PresentChargedDuration</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['PresentChargedDuration'];?>">
-											<input type="hidden" name="PresentChargedDuration" id="PresentChargedDuration" value="<?php echo $obj->{'PresentChargedDuration'};?>">
+											<input type="hidden" name="PresentChargedDuration3" id="PresentChargedDuration3" value="<?php echo $obj['ChargingInfo3']['PresentChargedDuration'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>RemainChargingDuration</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['RemainChargingDuration'];?>">
-											<input type="hidden" name="RemainChargingDuration" id="RemainChargingDuration" value="<?php echo $obj->{'RemainChargingDuration'};?>">
+											<input type="hidden" name="RemainChargingDuration3" id="RemainChargingDuration3" value="<?php echo $obj['ChargingInfo3']['RemainChargingDuration'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EvBatteryMaxVoltage</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['EvBatteryMaxVoltage'];?>">
-											<input type="hidden" name="EvBatteryMaxVoltage" id="EvBatteryMaxVoltage" value="<?php echo $obj->{'EvBatteryMaxVoltage'};?>">
+											<input type="hidden" name="EvBatteryMaxVoltage3" id="EvBatteryMaxVoltage3" value="<?php echo $obj['ChargingInfo3']['EvBatteryMaxVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EvBatterytargetVoltage</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['EvBatterytargetVoltage'];?>">
-											<input type="hidden" name="EvBatterytargetVoltage" id="EvBatterytargetVoltage" value="<?php echo $obj->{'EvBatterytargetVoltage'};?>">
+											<input type="hidden" name="EvBatterytargetVoltage3" id="EvBatterytargetVoltage3" value="<?php echo $obj['ChargingInfo3']['EvBatterytargetVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EvBatterySoc</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['EvBatterySoc'];?>">
-											<input type="hidden" name="EvBatterySoc" id="EvBatterySoc" value="<?php echo $obj->{'EvBatterySoc'};?>">
+											<input type="hidden" name="EvBatterySoc3" id="EvBatterySoc3" value="<?php echo $obj['ChargingInfo3']['EvBatterySoc'];?>">
 										</div>
 									</section>
 								</article>
@@ -327,9 +501,9 @@
 						"&LocalWhiteCard6=" + document.getElementById("LocalWhiteCard6").value+
 						"&LocalWhiteCard7=" + document.getElementById("LocalWhiteCard7").value+
 						"&LocalWhiteCard8=" + document.getElementById("LocalWhiteCard8").value+
-						"&LocalWhiteCard9=" + document.getElementById("LocalWhiteCard9").value+
-						"&CcsAuthentication=" + document.getElementById("CcsAuthentication").value+
-						"&AcCcsChargingModel=" + document.getElementById("AcCcsChargingModel").value;
+						"&LocalWhiteCard9=" + document.getElementById("LocalWhiteCard9").value;
+//						"&CcsAuthentication=" + document.getElementById("CcsAuthentication").value+
+//						"&AcCcsChargingModel=" + document.getElementById("AcCcsChargingModel").value;
 			
 			// POST 請求必須設置表頭在 open() 下面,send() 上面
 			request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
@@ -360,31 +534,52 @@
 		 
 		if(MaxChargingEnergy >65535)
 		{
-		    alert("MaxChargingEnergy must <= 65535!");
+			alert("MaxChargingEnergy must <= 65535!");
+			document.getElementById("MaxChargingEnergy").focus();
+			return false;
+		}
+		if(MaxChargingEnergy < 0)
+		{
+			alert("MaxChargingEnergy must >= 0!");
 			document.getElementById("MaxChargingEnergy").focus();
 			return false;
 		}
-		 
 		if(MaxChargingPower >65535)
 		{
-		    alert("MaxChargingPower must <= 65535!");
+			alert("MaxChargingPower must <= 65535!");
+			document.getElementById("MaxChargingPower").focus();
+			return false;
+		}
+		if(MaxChargingPower < 0)
+		{
+			alert("MaxChargingPower must >= 0!");
 			document.getElementById("MaxChargingPower").focus();
 			return false;
 		}
-		 
 		if(MaxChargingCurrent >65535)
 		{
 		    alert("MaxChargingCurrent must <= 65535!");
 			document.getElementById("MaxChargingCurrent").focus();
 			return false;
 		}
-		 
+		if(MaxChargingCurrent < 0)
+		{
+			alert("MaxChargingCurrent must >= 0!");
+			document.getElementById("MaxChargingCurrent").focus();
+			return false;
+		}
 		if(MaxChargingDuration >65535)
 		{
 		    alert("MaxChargingDuration must <= 65535!");
 			document.getElementById("MaxChargingDuration").focus();
 			return false;
 		}
+		if(MaxChargingDuration < 0)
+		{
+			alert("MaxChargingDuration must >= 0!");
+			document.getElementById("MaxChargingDuration").focus();
+			return false;
+		}
 		
 		return true;
 	}

+ 23 - 8
EVSE/rootfs/var/www/set_charging_action.php

@@ -12,13 +12,18 @@
 
 	// 新建員工
 	function create() {
+		checkMaxValue("MaxChargingEnergy");
+		checkMaxValue("MaxChargingPower");
+		checkMaxValue("MaxChargingCurrent");
+		checkMaxValue("MaxChargingDuration");
+		checkValue("PhaseLossPolicy");
 //		$json = json_decode(file_get_contents("charging.txt"), true);
 //		$json = string[];
 		$json['MaxChargingEnergy']			= (int)$_POST['MaxChargingEnergy'];
 		$json['MaxChargingPower'] 			= (int)$_POST['MaxChargingPower'];
 		$json['MaxChargingCurrent']			= (int)$_POST['MaxChargingCurrent'];
 		$json['MaxChargingDuration'] 		= (int)$_POST['MaxChargingDuration'];
-		$json['PhaseLossPolicy']			= $_POST['PhaseLossPolicy'];
+		$json['PhaseLossPolicy']			= chr($_POST['PhaseLossPolicy']);
 		$json['LocalWhiteCard0']			= $_POST['LocalWhiteCard0'];
 		$json['LocalWhiteCard1']	 		= $_POST['LocalWhiteCard1'];
 		$json['LocalWhiteCard2']			= $_POST['LocalWhiteCard2'];
@@ -29,13 +34,8 @@
 		$json['LocalWhiteCard7']			= $_POST['LocalWhiteCard7'];
 		$json['LocalWhiteCard8']			= $_POST['LocalWhiteCard8'];
 		$json['LocalWhiteCard9']			= $_POST['LocalWhiteCard9'];
-		$json['CcsAuthentication']			= $_POST['CcsAuthentication'];
-		$json['AcCcsChargingModel']			= $_POST['AcCcsChargingModel'];
-		checkMaxValue("MaxChargingEnergy");
-		checkMaxValue("MaxChargingPower");
-		checkMaxValue("MaxChargingCurrent");
-		checkMaxValue("MaxChargingDuration");
-		
+//		$json['CcsAuthentication']			= $_POST['CcsAuthentication'];
+//		$json['AcCcsChargingModel']			= $_POST['AcCcsChargingModel'];
 //		var_dump($json);echo "\n\n";
 //		echo json_encode($json);
 		$jsone['result'] = "Success";
@@ -96,4 +96,19 @@
 		}
 	}
 
+	function checkValue($id){
+		if(strlen($_POST[$id])!=1){
+				$jsone['result'] = "Fail";
+				$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+				echo json_encode($jsone);
+				exit;
+		}
+		if(!ereg("[0-9]",$_POST[$id])){
+				$jsone['result'] = "Fail";
+				$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+				echo json_encode($jsone);
+				exit;
+		}
+	}
+
 ?>

+ 22 - 22
EVSE/rootfs/var/www/set_network.php

@@ -4,7 +4,7 @@
 	include 'head.php';
 	$obj = json_decode(trim($output[2]));//var_dump($obj);
 	$InternetConn='';
-	switch ($obj->{'InternetConn'}){
+	switch (ord($obj->{'InternetConn'})){
 		case 0:
 			$InternetConn='disconnected';
 			break;
@@ -13,7 +13,7 @@
 			break;
 	}
 	$WifiNetworkConn='';
-	switch ($obj->{'WifiNetworkConn'}){
+	switch (ord($obj->{'WifiNetworkConn'})){
 		case 0:
 			$WifiNetworkConn='disconnected';
 			break;
@@ -22,7 +22,7 @@
 			break;
 	}
 	$TelcomNetworkConn='';
-	switch ($obj->{'TelcomNetworkConn'}){
+	switch (ord($obj->{'TelcomNetworkConn'})){
 		case 0:
 			$TelcomNetworkConn='disconnected';
 			break;
@@ -31,7 +31,7 @@
 			break;
 	}
 	$TelcomSimStatus='';
-	switch ($obj->{'TelcomSimStatus'}){
+	switch (ord($obj->{'TelcomSimStatus'})){
 		case 0:
 			$TelcomSimStatus='no SIM card is found';
 			break;
@@ -43,7 +43,7 @@
 			break;
 	}
 	$TelcomModemMode='';
-	switch ($obj->{'TelcomModemMode'}){
+	switch (ord($obj->{'TelcomModemMode'})){
 		case 0:
 			$TelcomModemMode='No services';
 			break;
@@ -99,7 +99,7 @@
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>InternetConn</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $InternetConn;?>">
-											<input type="hidden" name="InternetConn" id="InternetConn" value="<?php echo $obj->{'InternetConn'};?>">
+											<input type="hidden" name="InternetConn" id="InternetConn" value="<?php echo ord($obj->{'InternetConn'});?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>FtpServer</label>
@@ -114,8 +114,8 @@
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>Eth0DhcpClient</label>
 											<select class="form-control" id="Eth0DhcpClient" name="Eth0DhcpClient">
-												<option value="0" <?php echo $obj->{'Eth0DhcpClient'}==0?"selected":""?>>enable</option>
-												<option value="1" <?php echo $obj->{'Eth0DhcpClient'}==1?"selected":""?>>disable</option>
+												<option value="0" <?php echo ord($obj->{'Eth0DhcpClient'})=="0"?"selected":""?>>enable</option>
+												<option value="1" <?php echo ord($obj->{'Eth0DhcpClient'})=="1"?"selected":""?>>disable</option>
 											</select>
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
@@ -144,8 +144,8 @@
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>Eth1DhcpClient</label>
 											<select class="form-control" id="Eth1DhcpClient" name="Eth1DhcpClient">
-												<option value="0" <?php echo $obj->{'Eth1DhcpClient'}==0?"selected":""?>>enable</option>
-												<option value="1" <?php echo $obj->{'Eth1DhcpClient'}==1?"selected":""?>>disable</option>
+												<option value="0" <?php echo ord($obj->{'Eth1DhcpClient'})=="0"?"selected":""?>>enable</option>
+												<option value="1" <?php echo ord($obj->{'Eth1DhcpClient'})=="1"?"selected":""?>>disable</option>
 											</select>
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
@@ -174,10 +174,10 @@
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>WifiMode</label>
 											<select class="form-control" id="WifiMode" name="WifiMode">
-												<option value="0" <?php echo $obj->{'WifiMode'}==0?"selected":""?>>disable</option>
-												<option value="1" <?php echo $obj->{'WifiMode'}==1?"selected":""?>>Infrastructure client</option>
-												<option value="2" <?php echo $obj->{'WifiMode'}==2?"selected":""?>>Infrastructure server</option>
-												<option value="3" <?php echo $obj->{'WifiMode'}==3?"selected":""?>>Ad-Hoc</option>
+												<option value="0" <?php echo ord($obj->{'WifiMode'})=="0"?"selected":""?>>disable</option>
+												<option value="1" <?php echo ord($obj->{'WifiMode'})=="1"?"selected":""?>>Infrastructure client</option>
+												<option value="2" <?php echo ord($obj->{'WifiMode'})=="2"?"selected":""?>>Infrastructure server</option>
+												<option value="3" <?php echo ord($obj->{'WifiMode'})=="3"?"selected":""?>>Ad-Hoc</option>
 											</select>
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
@@ -196,15 +196,15 @@
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>WifiDhcpServer</label>
 											<select class="form-control" id="WifiDhcpServer" name="WifiDhcpServer">
-												<option value="0" <?php echo $obj->{'WifiDhcpServer'}==0?"selected":""?>>enable</option>
-												<option value="1" <?php echo $obj->{'WifiDhcpServer'}==1?"selected":""?>>disable</option>
+												<option value="0" <?php echo ord($obj->{'WifiDhcpServer'})=="0"?"selected":""?>>enable</option>
+												<option value="1" <?php echo ord($obj->{'WifiDhcpServer'})=="1"?"selected":""?>>disable</option>
 											</select>
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>WifiDhcpClient</label>
 											<select class="form-control" id="WifiDhcpClient" name="WifiDhcpClient">
-												<option value="0" <?php echo $obj->{'WifiDhcpClient'}==0?"selected":""?>>enable</option>
-												<option value="1" <?php echo $obj->{'WifiDhcpClient'}==1?"selected":""?>>disable</option>
+												<option value="0" <?php echo ord($obj->{'WifiDhcpClient'})=="0"?"selected":""?>>enable</option>
+												<option value="1" <?php echo ord($obj->{'WifiDhcpClient'})=="1"?"selected":""?>>disable</option>
 											</select>
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
@@ -227,7 +227,7 @@
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>WifiNetworkConn</label>
 											<input type="text" readonly class="form-control" value="<?php echo $WifiNetworkConn;?>">
-											<input type="hidden" name="WifiNetworkConn" id="WifiNetworkConn" value="<?php echo $obj->{'WifiNetworkConn'};?>">
+											<input type="hidden" name="WifiNetworkConn" id="WifiNetworkConn" value="<?php echo ord($obj->{'WifiNetworkConn'});?>">
 										</div>
 									</section>
 								</article>
@@ -270,12 +270,12 @@
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>TelcomSimStatus</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $TelcomSimStatus;?>">
-											<input type="hidden" name="TelcomSimStatus" id="TelcomSimStatus" value="<?php echo $obj->{'TelcomSimStatus'};?>">
+											<input type="hidden" name="TelcomSimStatus" id="TelcomSimStatus" value="<?php echo ord($obj->{'TelcomSimStatus'});?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>TelcomModemMode</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $TelcomModemMode;?>">
-											<input type="hidden" name="TelcomModemMode" id="TelcomModemMode" value="<?php echo $obj->{'TelcomModemMode'};?>">
+											<input type="hidden" name="TelcomModemMode" id="TelcomModemMode" value="<?php echo ord($obj->{'TelcomModemMode'});?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>TelcomIpAddress</label>
@@ -284,7 +284,7 @@
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>TelcomNetworkConn</label>
 											<input type="text" readonly class="form-control" value="<?php echo $TelcomNetworkConn;?>">
-											<input type="hidden" name="TelcomNetworkConn" id="TelcomNetworkConn" value="<?php echo $obj->{'TelcomNetworkConn'};?>">
+											<input type="hidden" name="TelcomNetworkConn" id="TelcomNetworkConn" value="<?php echo ord($obj->{'TelcomNetworkConn'});?>">
 										</div>
 									</section>
 								</article>

+ 36 - 15
EVSE/rootfs/var/www/set_network_action.php

@@ -12,22 +12,37 @@
 
 	// 新建員工
 	function create() {
+		checkip("Eth0IpAddress");
+		checkip("Eth0SubmaskAddress");
+		checkip("Eth0GatewayAddress");
+		checkip("Eth1IpAddress");
+		checkip("Eth1SubmaskAddress");
+		checkip("Eth1GatewayAddress");
+		checkip("WifiIpAddress");
+		checkip("WifiSubmaskAddress");
+		checkip("WifiGatewayAddress");
+		checkip("TelcomIpAddress");
+		checkValue("Eth0DhcpClient");
+		checkValue("Eth1DhcpClient");
+		checkValue("WifiMode");
+		checkValue("WifiDhcpServer");
+		checkValue("WifiDhcpClient");
 //		$json = json_decode(file_get_contents("charging.txt"), true);
 //		$json = string[];
 		$json['FtpServer']				= $_POST['FtpServer'];
-		$json['Eth0DhcpClient']			= $_POST['Eth0DhcpClient'];
+		$json['Eth0DhcpClient']			= chr($_POST['Eth0DhcpClient']);
 		$json['Eth0IpAddress']			= $_POST['Eth0IpAddress'];
 		$json['Eth0SubmaskAddress']		= $_POST['Eth0SubmaskAddress'];
 		$json['Eth0GatewayAddress']		= $_POST['Eth0GatewayAddress'];
-		$json['Eth1DhcpClient']			= $_POST['Eth1DhcpClient'];
+		$json['Eth1DhcpClient']			= chr($_POST['Eth1DhcpClient']);
 		$json['Eth1IpAddress']			= $_POST['Eth1IpAddress'];
 		$json['Eth1SubmaskAddress']		= $_POST['Eth1SubmaskAddress'];
 		$json['Eth1GatewayAddress']		= $_POST['Eth1GatewayAddress'];
-		$json['WifiMode']				= $_POST['WifiMode'];
+		$json['WifiMode']				= chr($_POST['WifiMode']);
 		$json['WifiSsid']				= $_POST['WifiSsid'];
 		$json['WifiPassword']			= $_POST['WifiPassword'];
-		$json['WifiDhcpServer']			= $_POST['WifiDhcpServer'];
-		$json['WifiDhcpClient']			= $_POST['WifiDhcpClient'];
+		$json['WifiDhcpServer']			= chr($_POST['WifiDhcpServer']);
+		$json['WifiDhcpClient']			= chr($_POST['WifiDhcpClient']);
 		$json['WifiIpAddress']			= $_POST['WifiIpAddress'];
 		$json['WifiSubmaskAddress']		= $_POST['WifiSubmaskAddress'];
 		$json['WifiGatewayAddress']		= $_POST['WifiGatewayAddress'];
@@ -36,16 +51,6 @@
 		$json['TelcomChapPapPwd']		= $_POST['TelcomChapPapPwd'];
 		$json['TelcomIpAddress']		= $_POST['TelcomIpAddress'];
 
-		checkip("Eth0IpAddress");
-		checkip("Eth0SubmaskAddress");
-		checkip("Eth0GatewayAddress");
-		checkip("Eth1IpAddress");
-		checkip("Eth1SubmaskAddress");
-		checkip("Eth1GatewayAddress");
-		checkip("WifiIpAddress");
-		checkip("WifiSubmaskAddress");
-		checkip("WifiGatewayAddress");
-		checkip("TelcomIpAddress");
 		
 //		var_dump($json);echo "\n\n";
 //		echo json_encode($json);
@@ -80,4 +85,20 @@
 			}
 		}
 	}
+
+	function checkValue($id){
+		if(strlen($_POST[$id])!=1){
+				$jsone['result'] = "Fail";
+				$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+				echo json_encode($jsone);
+				exit;
+		}
+		if(!ereg("[0-9]",$_POST[$id])){
+				$jsone['result'] = "Fail";
+				$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+				echo json_encode($jsone);
+				exit;
+		}
+	}
+
 ?>

+ 18 - 18
EVSE/rootfs/var/www/set_system.php

@@ -88,8 +88,8 @@
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>AcPhaseCount</label>
 											<select class="form-control" id="AcPhaseCount" name="AcPhaseCount">
-												<option value="1" <?php echo $obj->{'AcPhaseCount'}==1?"selected":""?>>One phase</option>
-												<option value="3" <?php echo $obj->{'AcPhaseCount'}==3?"selected":""?>>Three phase</option>
+												<option value="1" <?php echo ord($obj->{'AcPhaseCount'})=="1"?"selected":""?>>One phase</option>
+												<option value="3" <?php echo ord($obj->{'AcPhaseCount'})=="3"?"selected":""?>>Three phase</option>
 											</select>
 										</div>
 <?php /*										<div class="form-group" style="display:<?php echo $am111;?>">
@@ -100,17 +100,17 @@
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Factory Configuration</label>
 											<select class="form-control" id="FactoryConfiguration" name="FactoryConfiguration">
-												<option value="0" <?php echo $obj->{'FactoryConfiguration'}==0?"selected":""?>>Normal</option>
-												<option value="1" <?php echo $obj->{'FactoryConfiguration'}==1?"selected":""?>>Trigger</option>
+												<option value="0" <?php echo ord($obj->{'FactoryConfiguration'})=="0"?"selected":""?>>Normal</option>
+												<option value="1" <?php echo ord($obj->{'FactoryConfiguration'})=="1"?"selected":""?>>Trigger</option>
 											</select>
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Authorisation Mode</label>
 											<select type="text" class="form-control" id="AuthorisationMode" name="AuthorisationMode">
-												<option value="0" <?php echo $obj->{'AuthorisationMode'}=="0"?"selected":""?>>Phihong RFID tag</option>
-												<option value="1" <?php echo $obj->{'AuthorisationMode'}=="1"?"selected":""?>>OCPP backend</option>
-												<option value="2" <?php echo $obj->{'AuthorisationMode'}=="2"?"selected":""?>>Phihong backend</option>
-												<option value="3" <?php echo $obj->{'AuthorisationMode'}=="3"?"selected":""?>>free mode</option>
+												<option value="0" <?php echo ord($obj->{'AuthorisationMode'})=="0"?"selected":""?>>Phihong RFID tag</option>
+												<option value="1" <?php echo ord($obj->{'AuthorisationMode'})=="1"?"selected":""?>>OCPP backend</option>
+												<option value="2" <?php echo ord($obj->{'AuthorisationMode'})=="2"?"selected":""?>>Phihong backend</option>
+												<option value="3" <?php echo ord($obj->{'AuthorisationMode'})=="3"?"selected":""?>>free mode</option>
 											</select>
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
@@ -160,8 +160,8 @@
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>RfidCardNumEndian</label>
 											<select class="form-control" id="RfidCardNumEndian" name="RfidCardNumEndian">
-												<option value="0" <?php echo $obj->{'RfidCardNumEndian'}=="0"?"selected":""?>>little endian</option>
-												<option value="1" <?php echo $obj->{'RfidCardNumEndian'}=="1"?"selected":""?>>big endian</option>
+												<option value="0" <?php echo ord($obj->{'RfidCardNumEndian'})=="0"?"selected":""?>>little endian</option>
+												<option value="1" <?php echo ord($obj->{'RfidCardNumEndian'})=="1"?"selected":""?>>big endian</option>
 											</select>
 										</div>
 									</section>
@@ -172,23 +172,23 @@
 									<section>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>Aux Power 5V</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'AuxPower5V'};?> volt">
-											<input type="hidden" name="AuxPower5V" id="AuxPower5V" value="<?php echo $obj->{'AuxPower5V'};?>">
+											<input type="text" readonly class="form-control" placeholder="<?php echo ord($obj->{'AuxPower5V'});?> volt">
+											<input type="hidden" name="AuxPower5V" id="AuxPower5V" value="<?php echo ord($obj->{'AuxPower5V'});?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>Aux Power 12V</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'AuxPower12V'};?> volt">
-											<input type="hidden" name="AuxPower12V" id="AuxPower12V" value="<?php echo $obj->{'AuxPower12V'};?>">
+											<input type="text" readonly class="form-control" placeholder="<?php echo ord($obj->{'AuxPower12V'});?> volt">
+											<input type="hidden" name="AuxPower12V" id="AuxPower12V" value="<?php echo ord($obj->{'AuxPower12V'});?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>Aux Power 24V</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'AuxPower24V'};?> volt">
-											<input type="hidden" name="AuxPower24V" id="AuxPower24V" value="<?php echo $obj->{'AuxPower24V'};?>">
+											<input type="text" readonly class="form-control" placeholder="<?php echo ord($obj->{'AuxPower24V'});?> volt">
+											<input type="hidden" name="AuxPower24V" id="AuxPower24V" value="<?php echo ord($obj->{'AuxPower24V'});?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>Aux Power 48V</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'AuxPower48V'};?> volt">
-											<input type="hidden" name="AuxPower48V" id="AuxPower48V" value="<?php echo $obj->{'AuxPower48V'};?>">
+											<input type="text" readonly class="form-control" placeholder="<?php echo ord($obj->{'AuxPower48V'});?> volt">
+											<input type="hidden" name="AuxPower48V" id="AuxPower48V" value="<?php echo ord($obj->{'AuxPower48V'});?>">
 										</div>
 									</section>
 								</article>

+ 47 - 11
EVSE/rootfs/var/www/set_system_action.php

@@ -12,17 +12,6 @@
 
 	// 新建員工
 	function create() {
-//		$json = json_decode(file_get_contents("system.txt"), true);
-		$json['SystemId']				= $_POST["SystemId"];
-		$json['SystemDateTime'] 		= $_POST['SystemDateTime'];
-		$json['AcPhaseCount'] 			= $_POST['AcPhaseCount'];
-		$json['FactoryConfiguration']	= $_POST['FactoryConfiguration'];
-		$json['AuthorisationMode']	 	= $_POST['AuthorisationMode'];
-		$json['DefaultLanguage']		= chr($_POST['DefaultLanguage']);
-		$json['RfidCardNumEndian']		= $_POST['RfidCardNumEndian'];
-		
-//		var_dump($json);echo "\n\n";
-//		echo json_encode($json);
 		if($_POST['SystemDateTime'] != ""){
 			if(!validateDate($_POST['SystemDateTime'])){
 			$jsone['result'] = "Fail";
@@ -31,6 +20,22 @@
 			return false;
 			}
 		}
+		checkValue("AcPhaseCount",1);
+		checkValue("FactoryConfiguration",1);
+		checkValue("AuthorisationMode",1);
+		checkValue("DefaultLanguage",2);
+		checkValue("RfidCardNumEndian",1);
+//		$json = json_decode(file_get_contents("system.txt"), true);
+		$json['SystemId']				= $_POST["SystemId"];
+		$json['SystemDateTime'] 		= $_POST['SystemDateTime'];
+		$json['AcPhaseCount'] 			= chr($_POST['AcPhaseCount']);
+		$json['FactoryConfiguration']	= chr($_POST['FactoryConfiguration']);
+		$json['AuthorisationMode']	 	= chr($_POST['AuthorisationMode']);
+		$json['DefaultLanguage']		= chr($_POST['DefaultLanguage']);
+		$json['RfidCardNumEndian']		= chr($_POST['RfidCardNumEndian']);
+		
+//		var_dump($json);echo "\n\n";
+//		echo json_encode($json);
 		$jsone['result'] = "Success";
 		$jsone['message'] = $json;
 		echo json_encode($jsone);
@@ -73,4 +78,35 @@
 		return $d && $d->format($format) == $date;
 	}
 
+	function checkValue($id,$idx){
+		if($idx==1){
+			if(strlen($_POST[$id])!=1){
+					$jsone['result'] = "Fail";
+					$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+					echo json_encode($jsone);
+					exit;
+			}
+			if(!ereg("[0-9]",$_POST[$id])){
+					$jsone['result'] = "Fail";
+					$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+					echo json_encode($jsone);
+					exit;
+			}
+		}
+		if($idx==2){
+			if(strlen($_POST[$id])>2){
+					$jsone['result'] = "Fail";
+					$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+					echo json_encode($jsone);
+					exit;
+			}
+			if(!ereg("[0-9]",$_POST[$id]) & !ereg("[0-9]{2}",$_POST[$id])){
+					$jsone['result'] = "Fail";
+					$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+					echo json_encode($jsone);
+					exit;
+			}
+		}
+	}
+
 ?>