Jelajahi Sumber

2022-03-16/Jerry Wang
Action:
1. Modify clear ReportReaderStatusReq flag timing.
2. Add new configuration key 'PreAuthAmount' and update the configuration table version to 14.

File:
1. EVSE/Modularization/ocppfiles/MessageHandler.c
--> Action 1,2
2. EVSE/Modularization/ocppfiles/MessageHandler.h
--> Action 2
3. define.h
--> Action 2

Jerry Wang 3 tahun lalu
induk
melakukan
07b132cf0f

+ 71 - 2
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -4975,6 +4975,9 @@ void CheckSystemValue(void)
 		{
 			sendDataTransferRequest(gun_index);
 			ShmOCPP16Data->CsMsg.bits[gun_index].DataTransferReq = 0;
+
+			if((ShmOCPP16Data->TcciCustomData.ReaderStatus[gun_index].ReportReaderStatusReq) && (strstr((char *)ShmOCPP16Data->DataTransfer[gun_index].MessageId, "ID_ReaderStatus") != NULL))
+				ShmOCPP16Data->TcciCustomData.ReaderStatus[gun_index].ReportReaderStatusReq = 0;
 		}
 
 		//==========================================
@@ -5332,7 +5335,7 @@ void CheckSystemValue(void)
 		if(ShmOCPP16Data->TcciCustomData.ReaderStatus[gun_index].ReportReaderStatusReq == 1)
 		{
 			reportReaderStatus(gun_index);
-			ShmOCPP16Data->TcciCustomData.ReaderStatus[gun_index].ReportReaderStatusReq = 0;
+			//ShmOCPP16Data->TcciCustomData.ReaderStatus[gun_index].ReportReaderStatusReq = 0;
 		}
 
 		//==============================================
@@ -15835,7 +15838,7 @@ int initialConfigurationTable(void)
 	char sstr[256]={0};
 	int c = 0;
 	char *loc;
-	int	confVersion = 13;
+	int	confVersion = 14;
 
 	DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
 	//start_t = clock();
@@ -16251,6 +16254,13 @@ int initialConfigurationTable(void)
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","StatusNotificationInterval", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[StatusNotificationInterval].ItemData);
 
+		// PreAuthAmount
+		ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemName, "PreAuthAmount");
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemData, "888" );
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","PreAuthAmount", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemData);
+
 		// Configuration Version
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemName, "ConfigurationVersion");
@@ -16715,6 +16725,12 @@ int initialConfigurationTable(void)
 					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StatusNotificationInterval].ItemData, "%d", atoi(valuestr));
 				}
 
+				if(strcmp(keystr, "PreAuthAmount") == 0)
+				{
+					ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemData, "%.2f", atof(valuestr));
+				}
+
 				if(strcmp(keystr, "ConfigurationVersion") == 0)
 				{
 					ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
@@ -17265,6 +17281,15 @@ void StoreConfigurationTable(void)
 
 	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","StatusNotificationInterval", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StatusNotificationInterval].ItemData);
 
+	// PreAuthAmount
+	/*
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemName, "PreAuthAmount");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemData, "120" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","PreAuthAmount", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemData);
+
 	// ConfigurationVersion
 	/*
 	ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = 1;
@@ -18290,6 +18315,24 @@ void getKeyValue(char *keyReq)
 			  isKnowKey = TRUE;
 		  }
 
+		  if(isEmpty ||  strcmp(keyReq, "PreAuthAmount") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_PreAuthAmount].Item, "PreAuthAmount");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PreAuthAmount].Key, "PreAuthAmount");
+
+			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PreAuthAmount].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PreAuthAmount].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PreAuthAmount].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemData );
+			  isKnowKey = TRUE;
+		  }
+
 	      if(isEmpty ||  strcmp(keyReq, "ConfigurationVersion") == 0 )
 		  {
 			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_ConfigurationVersion].Item, "ConfigurationVersion");
@@ -19559,6 +19602,32 @@ int setKeyValue(char *key, char *value)
 		}
 	}
 
+	if(strcmp(key, "PreAuthAmount") == 0)
+	{
+		if(ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemAccessibility == 1)
+		{
+			check_ascii = value[0];
+			if( (check_ascii < 48) || (check_ascii > 57) )
+			{
+				isSuccess = ConfigurationStatus_Rejected;
+			}
+			else
+			{
+				if(atof(value) >= 0)
+				{
+					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemData, "%.2f", atof(value) );
+					isSuccess = ConfigurationStatus_Accepted;
+				}
+				else
+					isSuccess = ConfigurationStatus_Rejected;
+			}
+		}
+		else
+		{
+			isSuccess = ConfigurationStatus_Rejected;
+		}
+	}
+
 #if 0
     //For OCPP Test Case
     if(strcmp(key, "LocalAuthorizationListEnabled") == 0)

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

@@ -402,6 +402,7 @@ enum GetConfigurationKey {
 	GetConfiguration_MaintainServer,
 	GetConfiguration_StatusNotificationPeriodically,
 	GetConfiguration_StatusNotificationInterval,
+	GetConfiguration_PreAuthAmount,
 	GetConfiguration_LocalAuthListEnabled,
 	GetConfiguration_LocalAuthListMaxLength,
 	GetConfiguration_SendLocalListMaxLength,

+ 1 - 0
EVSE/Projects/define.h

@@ -328,6 +328,7 @@ enum CoreProfile {
      MaintainServer,
      StatusNotificationPeriodically,
      StatusNotificationInterval,
+	 PreAuthAmount,
      ConfigurationVersion,
 	 _CoreProfile_CNT
 };