فهرست منبع

Merge branch 'master' into AW-Regular

FolusWen 5 سال پیش
والد
کامیت
ecf579459e
3فایلهای تغییر یافته به همراه22 افزوده شده و 95 حذف شده
  1. 22 95
      EVSE/Modularization/WebService.c
  2. BIN
      EVSE/Projects/AW-Regular/Images/ramdisk.gz
  3. BIN
      EVSE/rootfs/root/WebService

+ 22 - 95
EVSE/Modularization/WebService.c

@@ -255,18 +255,22 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	{
 		memset(BufTmp,0,MtdBlockSize);
 		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
+
 		for(i=0;i<MtdBlockSize-4;i++)
-			Chk+=*(ptr+i);
+			Chk+=*(BufTmp+i);
+
 		memcpy(	BufTmp+MtdBlockSize-4,&Chk,4);
+
 		fd = open("/dev/mtdblock10", O_RDWR);
-		if (fd > 0)
+
+		if (fd>0)
 		{
 			wrd=write(fd, BufTmp, MtdBlockSize);
 			close(fd);
 			if(wrd>=MtdBlockSize)
 			{
 				fd = open("/dev/mtdblock11", O_RDWR);
-				if (fd > 0)
+				if (fd>0)
 				{
 					wrd=write(fd, BufTmp, MtdBlockSize);
     					close(fd);
@@ -275,19 +279,18 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 						DEBUG_ERROR("write /dev/mtdblock11(backup) NG\r\n");
 				   		result = FAIL;
 					}
-			    	}
-			    	else
-			    	{
-			    		DEBUG_ERROR("open /dev/mtdblock11(backup) NG\r\n");
+				}
+				else
+				{
+					DEBUG_ERROR("open /dev/mtdblock11(backup) NG\r\n");
 					result = FAIL;
-			    	}
+				}
 			}
 			else
 			{
 		    		DEBUG_ERROR("write /dev/mtdblock10 NG\r\n");
 		    		result = FAIL;
 			}
-
 		}
 		else
 		{
@@ -298,14 +301,16 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	else
 	{
 		DEBUG_ERROR("alloc BlockSize NG\r\n");
-    		result = FAIL;
+    	result = FAIL;
 	}
+
 	if(BufTmp!=NULL)
 		free(BufTmp);
 
 	return result;
 }
 
+
 //================================================
 // Main process
 //================================================
@@ -604,8 +609,10 @@ int main(int argc, char *argv[]) {
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,OcppServerURL);
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,ChargeBoxId);
 		}
+		struct SysConfigData 	SysConfig;
+		memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
 
-		int result = StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
+		int result = StoreUsrConfigData(&SysConfig);
 		if(result != 1){
 			#ifdef SystemLogMessage
 			StoreLogMsg("[WebService]StoreUsrConfigData: normal NG");
@@ -744,7 +751,9 @@ int main(int argc, char *argv[]) {
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,"");
 
 		ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=0;
-		StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
+		struct SysConfigData 	SysConfig;
+		memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
+		StoreUsrConfigData(&SysConfig);
 
 		#ifdef SystemLogMessage
 		DEBUG_INFO("WebService initial OK");
@@ -937,16 +946,6 @@ int main(int argc, char *argv[]) {
 		struct json_object *OcppServerURL;
 		struct json_object *ChargeBoxId;
 
-		/* log for debug charginginfodata start*/
-//		#ifdef SystemLogMessage
-			WriteLogMsg("ModelName:%s",(char *)&ShmSysConfigAndInfo->SysConfig.ModelName);
-			WriteLogMsg("connectorType1:%d",connectorType1);
-			WriteLogMsg("connectorType2:%d",connectorType2);
-			WriteLogMsg("connectorType3:%d",connectorType3);
-//		#endif
-		/* log for debug charginginfodata end*/
-
-
 //		array_obj = json_object_new_array();
 		jobj1=json_object_new_object();
 		jobj2=json_object_new_object();
@@ -1094,30 +1093,6 @@ int main(int argc, char *argv[]) {
 				CHAdeMOGunQty++;
 			}
 			else if(connectorType1 == 4){//AC
-		/* log for debug charginginfodata start*/
-//		#ifdef SystemLogMessage
-			WriteLogMsg("PresentChargingVoltage[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
-			WriteLogMsg("PresentChargingCurrent[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
-			WriteLogMsg("PresentChargingPower[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
-			WriteLogMsg("PresentChargedEnergy[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
-			WriteLogMsg("PresentChargedDuration[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
-			WriteLogMsg("RemainChargingDuration[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
-			WriteLogMsg("EvBatteryMaxVoltage[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
-			WriteLogMsg("EvBatterytargetVoltage[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
-			WriteLogMsg("EvBatterySoc[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
-			WriteLogMsg("SystemStatus[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
-			WriteLogMsg("Index[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
-			WriteLogMsg("Type[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
-			WriteLogMsg("type_index[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
-			WriteLogMsg("EvBatterytargetCurrent[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
-			WriteLogMsg("CardNumber[0]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
-			WriteLogMsg("StartUserId[0]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
-			WriteLogMsg("StartDateTime[0]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
-			WriteLogMsg("StopDateTime[0]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
-			WriteLogMsg("StartMethod[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
-			WriteLogMsg("ConnectorTemp[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
-//		#endif
-		/* log for debug charginginfodata end*/
 				PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
 				PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
 				PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
@@ -1212,30 +1187,6 @@ int main(int argc, char *argv[]) {
 				CHAdeMOGunQty++;
 			}
 			else if(connectorType2 == 4){//AC
-		/* log for debug charginginfodata start*/
-//		#ifdef SystemLogMessage
-			WriteLogMsg("PresentChargingVoltage[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
-			WriteLogMsg("PresentChargingCurrent[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
-			WriteLogMsg("PresentChargingPower[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
-			WriteLogMsg("PresentChargedEnergy[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
-			WriteLogMsg("PresentChargedDuration[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
-			WriteLogMsg("RemainChargingDuration[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
-			WriteLogMsg("EvBatteryMaxVoltage[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
-			WriteLogMsg("EvBatterytargetVoltage[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
-			WriteLogMsg("EvBatterySoc[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
-			WriteLogMsg("SystemStatus[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
-			WriteLogMsg("Index[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
-			WriteLogMsg("Type[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
-			WriteLogMsg("type_index[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
-			WriteLogMsg("EvBatterytargetCurrent[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
-			WriteLogMsg("CardNumber[1]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
-			WriteLogMsg("StartUserId[1]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
-			WriteLogMsg("StartDateTime[1]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
-			WriteLogMsg("StopDateTime[1]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
-			WriteLogMsg("StartMethod[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
-			WriteLogMsg("ConnectorTemp[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
-//		#endif
-		/* log for debug charginginfodata end*/
 				PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
 				PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
 				PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
@@ -1330,30 +1281,6 @@ int main(int argc, char *argv[]) {
 				CHAdeMOGunQty++;
 			}
 			else if(connectorType3 == 4){//AC
-		/* log for debug charginginfodata start*/
-//		#ifdef SystemLogMessage
-			WriteLogMsg("PresentChargingVoltage[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
-			WriteLogMsg("PresentChargingCurrent[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
-			WriteLogMsg("PresentChargingPower[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
-			WriteLogMsg("PresentChargedEnergy[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
-			WriteLogMsg("PresentChargedDuration[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
-			WriteLogMsg("RemainChargingDuration[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
-			WriteLogMsg("EvBatteryMaxVoltage[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
-			WriteLogMsg("EvBatterytargetVoltage[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
-			WriteLogMsg("EvBatterySoc[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
-			WriteLogMsg("SystemStatus[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
-			WriteLogMsg("Index[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
-			WriteLogMsg("Type[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
-			WriteLogMsg("type_index[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
-			WriteLogMsg("EvBatterytargetCurrent[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
-			WriteLogMsg("CardNumber[2]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
-			WriteLogMsg("StartUserId[2]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
-			WriteLogMsg("StartDateTime[2]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
-			WriteLogMsg("StopDateTime[2]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
-			WriteLogMsg("StartMethod[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
-			WriteLogMsg("ConnectorTemp[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
-//		#endif
-		/* log for debug charginginfodata end*/
 				PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
 				PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
 				PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
@@ -1408,7 +1335,7 @@ int main(int argc, char *argv[]) {
 		TelcomChapPapPwd = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
 		TelcomModemImei = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei);
 		TelcomSimImsi = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi);
-		TelcomSimIccid = json_object_new_string((char*)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid);
+		TelcomSimIccid = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid);
 		TelcomSimStatus = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus);
 		TelcomModemMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode);
 		TelcomIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress);

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


BIN
EVSE/rootfs/root/WebService