Browse Source

2020-05-05 / Kathy Yeh
1. modify RemoteStartRequest error: ReservationId's default value is -1

Kathy_Yeh 4 years ago
parent
commit
9d0ad2f85d
1 changed files with 10 additions and 15 deletions
  1. 10 15
      EVSE/Modularization/ocppfiles/MessageHandler.c

+ 10 - 15
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -7636,12 +7636,12 @@ int handleRemoteStartRequest(char *uuid, char *payload)
 				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == (connectorIdInt -1))
 				{
 
-					if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ReservationId != 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) == 0))
+					if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ReservationId != -1)&&(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ReservationId >= 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) == 0))
 					{
 						//Reserved
 						DEBUG_INFO("Reserved now !!!The idTag matches the idTag of Reservation!!!\n");
 					}
-					else if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ReservationId != 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) != 0))
+					else if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ReservationId != -1)&&(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ReservationId >= 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) != 0))
 					{
 						//Reserved
 						DEBUG_INFO("Reserved now !!! The idTag does NOT match the idTag of Reservation!!! Reject it!!!\n");
@@ -7668,12 +7668,12 @@ int handleRemoteStartRequest(char *uuid, char *payload)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == (connectorIdInt -1))
 				{
-					if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ReservationId != 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) == 0))
+					if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ReservationId != -1)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ReservationId >= 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) == 0))
 					{
 						//Reserved
 						DEBUG_INFO("Reserved now !!!The idTag matches the idTag of Reservation!!!\n");
 					}
-					else if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ReservationId != 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) != 0))
+					else if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ReservationId != -1)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ReservationId >= 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) != 0))
 					{
 						//Reserved
 						DEBUG_INFO("Reserved now !!! The idTag does NOT match the idTag of Reservation!!! Reject it!!!\n");
@@ -7699,12 +7699,12 @@ int handleRemoteStartRequest(char *uuid, char *payload)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == (connectorIdInt -1))
 				{
-					if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ReservationId != 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) == 0))
+					if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ReservationId != -1)&&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ReservationId >= 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) == 0))
 					{
 						//Reserved
 						DEBUG_INFO("Reserved now !!!The idTag matches the idTag of Reservation!!!\n");
 					}
-					else if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ReservationId != 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) != 0))
+					else if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ReservationId != -1)&&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ReservationId >= 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) != 0))
 					{
 						//Reserved
 						DEBUG_INFO("Reserved now !!! The idTag does NOT match the idTag of Reservation!!! Reject it!!!\n");
@@ -7734,12 +7734,12 @@ int handleRemoteStartRequest(char *uuid, char *payload)
 				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == (connectorIdInt -1))
 				{
 
-					if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].ReservationId != 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) == 0))
+					if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].ReservationId != -1)&&(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].ReservationId >= 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) == 0))
 					{
 						//Reserved
 						DEBUG_INFO("Reserved now !!!The idTag matches the idTag of Reservation!!!\n");
 					}
-					else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].ReservationId != 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) != 0))
+					else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].ReservationId != -1)&&(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].ReservationId >= 0)&&(strcmp((const char *)ShmSysConfigAndInfo->SysConfig.UserId, idTagstr) != 0))
 					{
 						//Reserved
 						DEBUG_INFO("Reserved now !!! The idTag does NOT match the idTag of Reservation!!! Reject it!!!\n");
@@ -15695,7 +15695,7 @@ void GetChargingProfileRequest(int gunindex)
 	//*****************************ChargePointMaxProfile******************************************/
 	strcpy(fname, ChargePointMaxProfile_JSON);
 	ChargePointMaxProfileIsNull=TRUE;
-	DEBUG_INFO("test 1\n");
+
 	if((access(ChargePointMaxProfile_JSON,F_OK))!=-1)
 	{
 	  	fptr1 = fopen(fname, "r");
@@ -15714,7 +15714,6 @@ void GetChargingProfileRequest(int gunindex)
 	  	}
 	  	else
 	  	{
-	  		DEBUG_INFO("test 2\n");
 	  		ChargePointMaxProfileIsNull=FALSE;
 	  		while(fscanf(fptr1, "%s", word) != EOF)
 	  		{
@@ -15911,7 +15910,6 @@ void GetChargingProfileRequest(int gunindex)
 	  			strcpy(tempvalidFromStr,"");
 	  		}
 
-
 	  		//***********validTo **************/
 	  		c = 0;
 	  		loc = strstr(sLineWord, "validTo");
@@ -16119,7 +16117,6 @@ void GetChargingProfileRequest(int gunindex)
 
 	  }// the end of access file ChargePointMaxProfile
 
-	DEBUG_INFO("test 3\n");
 	  //****************************TxDefaultProfile************************************************/
 
 	  memset(fname, 0, sizeof fname);
@@ -16553,7 +16550,6 @@ void GetChargingProfileRequest(int gunindex)
 	  }// the end of ACCESS TxDefaultProfile
 
 	  	//****************************TxProfile************************************************/
-	  DEBUG_INFO("test 4\n");
 
 	  	memset(fname, 0, sizeof fname);
 	  	sprintf(fname, "/Storage/OCPP/TxProfile_%d.json", (gunindex + 1));
@@ -16965,7 +16961,6 @@ void GetChargingProfileRequest(int gunindex)
 
 	  	}// the end of ACCESS TxProfile
 
-	  	DEBUG_INFO("test 5\n");
 	  	//-----------------------------------------------CompositeSchedule--------------------------//
 	  	int period=0;
 	  	if((TxDefaultProfileFileIsNull==FALSE) && (ChargePointMaxProfileIsNull==FALSE) && (TxProfileIsNull==FALSE) )
@@ -17245,7 +17240,7 @@ void GetChargingProfileRequest(int gunindex)
 	  			ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[l].StartPeriod = TxProfile.Period[l].StartPeriod;
 	  		}
 	    }
-	  	DEBUG_INFO("test 7\n");
+
 	  	confirmPeriods = period;
 	  	if(confirmPeriods != 0)
 	  	{