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

2020-03-16 /Kathy Yeh
1. modify configuration key SupportedFeatureProfiles value
2. modify configuration key StopTxnSampledData value
3. modify Authorize logic

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

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

@@ -41,7 +41,6 @@
 
 
 
-
 #define PASS				1
 #define FAIL				-1
 
@@ -1246,15 +1245,15 @@ void CheckSystemValue(void)
 		//===============================
 		if((server_sign == TRUE) && (ShmOCPP16Data->SpMsg.bits.AuthorizeReq == 1)&&(authorizeRetryTimes < 3)/*authenrequest == FALSE*/)
 		{
-			if(strcmp((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeRemoteTxRequests].ItemData, "TRUE") == 0)// [If AuthorizeRemoteTxRequests = true
-			{
+			//if(strcmp((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeRemoteTxRequests].ItemData, "TRUE") == 0)// [If AuthorizeRemoteTxRequests = true
+			//{
 				sendAuthorizeRequest(0);
 
 				authorizeRetryTimes = authorizeRetryTimes + 1;
 				// authenrequest = TRUE
 				if(authorizeRetryTimes < 3)
 				ShmOCPP16Data->SpMsg.bits.AuthorizeReq = 0;
-			}
+			//}
 
 		}
 		else if((server_sign == TRUE) && (ShmOCPP16Data->SpMsg.bits.AuthorizeReq == 1)&&(authorizeRetryTimes >= 3))
@@ -10456,16 +10455,14 @@ int initialConfigurationTable(void)
 	memset(&(ShmOCPP16Data->ConfigurationTable), 0, sizeof(struct OCPP16ConfigurationTable) );
 
 
-	if((access("../Storage/OCPP/OCPPConfiguration",F_OK))==-1)
+	if((access("/Storage/OCPP/OCPPConfiguration",F_OK))==-1)
 	{
-		outfile = fopen("../Storage/OCPP/OCPPConfiguration" , "w+");
+		outfile = fopen("/Storage/OCPP/OCPPConfiguration" , "w+");
 		if(outfile == NULL) {
 			DEBUG_INFO("Error opening file");
 			return FALSE;
 		}
 
-
-		//outfile = fopen ("../Storage/OCPP/OCPPConfiguration", "a");
 		/*Core Profile*/
 		//AllowOfflineTxForUnknownId
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemAccessibility = 1;
@@ -10473,8 +10470,6 @@ int initialConfigurationTable(void)
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemName, "AllowOfflineTxForUnknownId");
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemData, "TRUE" );
 
-
-		//DEBUG_INFO("data=%s\n",data);
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\": %s,\"value\":\"%s\"}\n","AllowOfflineTxForUnknownId", "false", "TRUE");
 
 		//AuthorizationCacheEnabled
@@ -10666,23 +10661,32 @@ int initialConfigurationTable(void)
 		// StopTxnSampledData
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnSampledData].ItemAccessibility = 1;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnSampledData].ItemName, "StopTxnSampledData");
-		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnSampledData].ItemData, "Energy.Active.Import.Register" );
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnSampledData].ItemData, "Current.Export,Energy.Active.Export.Interval,Power.Active.Export,Voltage,SOC" );
 
-		fprintf(outfile,"{\"key\":\"%s\",\"readonly\": %s,\"value\":\"%s\"}\n","StopTxnSampledData", "false", "Energy.Active.Import.Register");
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\": %s,\"value\":\"%s\"}\n","StopTxnSampledData", "false", "Current.Export,Energy.Active.Export.Interval,Power.Active.Export,Voltage,SOC");
 
 		// StopTxnSampledDataMaxLength
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnSampledDataMaxLength].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnSampledDataMaxLength].ItemName, "StopTxnSampledDataMaxLength");
-		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnSampledDataMaxLength].ItemData, "0" );
 
-		fprintf(outfile,"{\"key\":\"%s\",\"readonly\": %s,\"value\":\"%s\"}\n","StopTxnSampledDataMaxLength", "true", "0");
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+		{
+			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnSampledDataMaxLength].ItemData, "%d", 6);
+		}
+		else
+		{
+			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnSampledDataMaxLength].ItemData, "%d", 5);
+		}
+
+		//strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnSampledDataMaxLength].ItemData, "0" );
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\": %s,\"value\":\"%s\"}\n","StopTxnSampledDataMaxLength", "true", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnSampledDataMaxLength].ItemData);
 
 		// SupportedFeatureProfiles
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[SupportedFeatureProfiles].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SupportedFeatureProfiles].ItemName, "SupportedFeatureProfiles");
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SupportedFeatureProfiles].ItemData, "Core,FirmwareManagement,LocalAuthListManagement,Reservation,SmartCharging,RemoteTrigger" );
 
-		fprintf(outfile,"{\"key\":\"%s\",\"readonly\": %s,\"value\":\"%s\"}\n","SupportedFeatureProfiles", "true", "0");
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\": %s,\"value\":\"%s\"}\n","SupportedFeatureProfiles", "true", "Core,FirmwareManagement,LocalAuthListManagement,Reservation,SmartCharging,RemoteTrigger");
 
 		// SupportedFeatureProfilesMaxLength
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[SupportedFeatureProfilesMaxLength].ItemAccessibility = 0;