Эх сурвалжийг харах

2020-04-20 / Kathy Yeh
1. modify error: GetCharging Profie

Kathy_Yeh 5 жил өмнө
parent
commit
d51040f94a

+ 6 - 44
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -38,7 +38,6 @@
 #include	"TransactionQueue.h"
 
 
-
 #define PASS				1
 #define FAIL				-1
 
@@ -15677,7 +15676,7 @@ void GetChargingProfileRequest(int gunindex)
 	  			c = 0;
 	  			loc = strstr(SchedulePeriodList[i], "limit");
 	  			memset(sstr ,0, sizeof(sstr) );
-	  			while (loc[strlen("limit")+2+c] != ',')
+	  			while ((loc[strlen("limit")+2+c] != ',')&&(loc[strlen("limit")+2+c] != '}'))
 	  			{
 	  				sstr[c] = loc[strlen("limit")+2+c];
 	  				//printf("i=%d sstr=%c\n",c, sstr[c]);
@@ -15693,7 +15692,7 @@ void GetChargingProfileRequest(int gunindex)
 
 	  			if(loc != NULL)
 	  			{
-	  				while (loc[strlen("numberPhases")+2+c] != '}')
+	  				while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
 	  				{
 	  					sstr[c] = loc[strlen("numberPhases")+2+c];
 	  					//printf("i=%d sstr=%c\n",c, sstr[c]);
@@ -15754,26 +15753,7 @@ void GetChargingProfileRequest(int gunindex)
 
 
 	  //****************************TxDefaultProfile************************************************/
-#if 0
-	  switch(gunindex + 1)
-	  {
-	  	  case 0:
-	  		  strcpy(fname, TxDefaultProfile_0_JSON );
-	  		  break;
-
-	  	  case 1:
-	  		  strcpy(fname, TxDefaultProfile_1_JSON );
-	  		  break;
 
-	  	  case 2:
-	  		  strcpy(fname, TxDefaultProfile_2_JSON );
-	  		  break;
-
-	  	  default:
-	  		  strcpy(fname, TxDefaultProfile_1_JSON );
-	  		  break;
-	  }
-#endif
 	  memset(fname, 0, sizeof fname);
 	  sprintf(fname, "/Storage/OCPP/TxDefaultProfile_%d.json", (gunindex + 1));
 
@@ -16082,7 +16062,7 @@ void GetChargingProfileRequest(int gunindex)
 	  	  		  c = 0;
 	  	  		  loc = strstr(SchedulePeriodList[i], "limit");
 	  	  		  memset(sstr ,0, sizeof(sstr) );
-	  	  		  while (loc[strlen("limit")+2+c] != ',')
+	  	  		  while ((loc[strlen("limit")+2+c] != ',')&&(loc[strlen("limit")+2+c] != '}'))
 	  	  		  {
 	  	  			  sstr[c] = loc[strlen("limit")+2+c];
 	  	  			  //printf("i=%d sstr=%c\n",c, sstr[c]);
@@ -16098,7 +16078,7 @@ void GetChargingProfileRequest(int gunindex)
 
 	  	  		  if(loc != NULL)
 	  	  		  {
-	  	  			  while (loc[strlen("numberPhases")+2+c] != '}')
+	  	  			  while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
 	  	  			  {
 	  	  			  	  sstr[c] = loc[strlen("numberPhases")+2+c];
 	  	  			  	  //printf("i=%d sstr=%c\n",c, sstr[c]);
@@ -16197,25 +16177,7 @@ void GetChargingProfileRequest(int gunindex)
 	  }// the end of ACCESS TxDefaultProfile
 
 	  	//****************************TxProfile************************************************/
-#if 0
-	  	switch(gunindex + 1)
-	  	{
-	  		case 0:
-	  		break;
-
-	  		case 1:
-	  			strcpy(fname, TxProfile_1_JSON );
-	  		break;
 
-	  		case 2:
-	  			strcpy(fname, TxProfile_2_JSON );
-	  		break;
-
-	  		default:
-	  			strcpy(fname, TxProfile_1_JSON );
-	  		break;
-	  	}
-#endif
 	  	memset(fname, 0, sizeof fname);
 	  	sprintf(fname, "/Storage/OCPP/TxProfile_%d.json", (gunindex + 1));
 
@@ -16548,7 +16510,7 @@ void GetChargingProfileRequest(int gunindex)
 	  				c = 0;
 	  				loc = strstr(SchedulePeriodList[i], "limit");
 	  				memset(sstr ,0, sizeof(sstr) );
-	  				while (loc[strlen("limit")+2+c] != ',')
+	  				while ((loc[strlen("limit")+2+c] != ',')&&(loc[strlen("limit")+2+c] != '}'))
 	  				{
 	  				  	sstr[c] = loc[strlen("limit")+2+c];
 	  				  	//printf("i=%d sstr=%c\n",c, sstr[c]);
@@ -16564,7 +16526,7 @@ void GetChargingProfileRequest(int gunindex)
 
 	  				if(loc != NULL)
 	  				{
-	  					while (loc[strlen("numberPhases")+2+c] != '}')
+	  					while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
 	  					{
 	  						sstr[c] = loc[strlen("numberPhases")+2+c];
 	  						 //printf("i=%d sstr=%c\n",c, sstr[c]);