Răsfoiți Sursa

2023-02-10/ Jerry Wang
[OCPP 2.0.1] variableVersion 10->11
[OCPP 1.6] confVersion 26->27
Action:
1. Modify configuration key(Variable) 'EnableAcCcs' to 'Enable15118' and add logic to synchronize the value of SysConfigData key 'isEnable15118'.
2. Modify SysConfigData key 'isEnable15118' location.

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

Jerry Wang 2 ani în urmă
părinte
comite
2ff87399ed

+ 12 - 11
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -812,7 +812,7 @@ static int localversion=0;
 //===============================
 // Variable Version
 //===============================
-static int variableVersion=10;
+static int variableVersion=11;
 
 //===============================
 // OCPP sign variable
@@ -2831,13 +2831,13 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_AuthorizeTimeout].variableAttribute[0].value, "15");
 		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_AuthorizeTimeout]);
 
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_EnableAcCcs].component.name, "OCPPCommCtrlr");
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_EnableAcCcs].variable.name, "EnableAcCcs");
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_EnableAcCcs].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_boolean]);
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_EnableAcCcs].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Actual]);
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_EnableAcCcs].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_EnableAcCcs].variableAttribute[0].value, "false");
-		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_EnableAcCcs]);
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_Enable15118].component.name, "OCPPCommCtrlr");
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_Enable15118].variable.name, "Enable15118");
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_Enable15118].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_boolean]);
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_Enable15118].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Actual]);
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_Enable15118].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_Enable15118].variableAttribute[0].value, ShmSysConfigAndInfo->SysConfig.isEnable15118==1?"true":"false");
+		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_Enable15118]);
 
 		/* ReservationCtrlr Required item */
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[ReservationCtrlr_Enabled].component.name, "ReservationCtrlr");
@@ -3546,8 +3546,8 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_AuthorizeTimeout].component.name, "OCPPCommCtrlr");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_AuthorizeTimeout].variable.name, "AuthorizeTimeout");
 
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_EnableAcCcs].component.name, "OCPPCommCtrlr");
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_EnableAcCcs].variable.name, "EnableAcCcs");
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_Enable15118].component.name, "OCPPCommCtrlr");
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_Enable15118].variable.name, "Enable15118");
 
 		/* ReservationCtrlr Required item */
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[ReservationCtrlr_Enabled].component.name, "ReservationCtrlr");
@@ -20090,7 +20090,7 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 								}
 							}
 
-							if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "OCPPCommCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "EnableAcCcs") != NULL))
+							if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "OCPPCommCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "Enable15118") != NULL))
 							{
 								char tmp[ARRAY_SIZE(ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue)];
 
@@ -20099,6 +20099,7 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 								if((strstr((char*)tmp, "true") != NULL) || (strstr((char*)tmp, "false") != NULL))
 								{
 									strcpy((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue,(strstr((char*)tmp, "true") != NULL)? "true" : "false");
+									ShmSysConfigAndInfo->SysConfig.isEnable15118 = (strstr((char*)tmp, "true") != NULL)?1:0;
 									strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Accepted]);
 								}
 								else

+ 30 - 25
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -17563,7 +17563,7 @@ int initialConfigurationTable(void)
 	FILE *fp;
 	FILE *outfile;
 	char str[512]={0};
-	int	confVersion = 26;
+	int	confVersion = 27;
 
 	DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
 	//start_t = clock();
@@ -18071,11 +18071,11 @@ int initialConfigurationTable(void)
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AuthorizeTimeout", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData);
 
 		// Enable AC charger CCS function
-		ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemAccessibility = 1;
-		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemName, "EnableAcCcs");
-		sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData, "FALSE");
+		ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemName, "Enable15118");
+		sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemData, ShmSysConfigAndInfo->SysConfig.isEnable15118==1?"TRUE":"FALSE");
 
-		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","EnableAcCcs", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData);
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","Enable15118", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemData);
 
 		//* Local Auth List Management Profile*/
 		#if 0
@@ -18571,10 +18571,10 @@ int initialConfigurationTable(void)
 					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData, "%s", valuestr);
 				}
 
-				if(strcmp(keystr, "EnableAcCcs") == 0)
+				if(strcmp(keystr, "Enable15118") == 0)
 				{
-					ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
-					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData, "%s", valuestr);
+					ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemData, ShmSysConfigAndInfo->SysConfig.isEnable15118==1?"TRUE":"FALSE");
 				}
 
 				if(strcmp(keystr, "LocalAuthListEnabled") == 0)
@@ -19247,14 +19247,14 @@ void StoreConfigurationTable(void)
 
 	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AuthorizeTimeout", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData);
 
-	// EnableAcCcs
+	// Enable15118
 	/*
-	ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemAccessibility = 1;
-	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemName, "EnableAcCcs");
-	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData, "TRUE" );
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemName, "Enable15118");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemData, "TRUE" );
 	*/
 
-	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","EnableAcCcs", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData);
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","Enable15118", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemData);
 
 
 	//* Local Auth List Management Profile*/
@@ -20489,21 +20489,21 @@ void getKeyValue(char *keyReq)
 			  isKnowKey = TRUE;
 		  }
 
-		  if(isEmpty ||  strcmp(keyReq, "EnableAcCcs") == 0 )
+		  if(isEmpty ||  strcmp(keyReq, "Enable15118") == 0 )
 		  {
-			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_EnableAcCcs].Item, "EnableAcCcs");
-			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EnableAcCcs].Key, "EnableAcCcs");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_Enable15118].Item, "Enable15118");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_Enable15118].Key, "Enable15118");
 
-			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemAccessibility == 1)
+			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemAccessibility == 1)
 			  {
-				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EnableAcCcs].ReadOnly, "0"/*"FALSE"*/);
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_Enable15118].ReadOnly, "0"/*"FALSE"*/);
 			  }
 			  else
 			  {
-				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EnableAcCcs].ReadOnly, "1"/*"TRUE"*/);
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_Enable15118].ReadOnly, "1"/*"TRUE"*/);
 			  }
 
-			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EnableAcCcs].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData );
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_Enable15118].Value, ShmSysConfigAndInfo->SysConfig.isEnable15118==1?"TRUE":"FALSE");
 			  isKnowKey = TRUE;
 		  }
 
@@ -21954,10 +21954,14 @@ int setKeyValue(char *key, char *value)
 		if(ShmOCPP16Data->ConfigurationTable.CoreProfile[RfidEndianType].ItemAccessibility == 1)
 		{
 			strcpy(str, (const char*)value);
-			if((strcmp(str, "BIG")==0) || (strcmp(str, "LITTLE")==0))
+			for(int i = 0; str[i]; i++)
+			{
+			  str[i] = tolower(str[i]);
+			}
+			if((strcmp(str, "big")==0) || (strcmp(str, "little")==0))
 			{
 				sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[RfidEndianType].ItemData, "%s", str );
-				ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = (strcmp(str, "BIG")==0)?1:0;
+				ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = (strcmp(str, "big")==0)?1:0;
 				isSuccess = ConfigurationStatus_Accepted;
 			}
 			else
@@ -21998,16 +22002,17 @@ int setKeyValue(char *key, char *value)
 		}
 	}
 
-	if(strcmp(key, "EnableAcCcs") == 0)
+	if(strcmp(key, "Enable15118") == 0)
 	{
-		if(ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemAccessibility == 1)
+		if(ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemAccessibility == 1)
 		{
 			strcpy(str, (const char*)value);
 			for(int i = 0; str[i]; i++)
 			{
 			  str[i] = tolower(str[i]);
 			}
-			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
+			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[Enable15118].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE");
+			ShmSysConfigAndInfo->SysConfig.isEnable15118 = (strcmp(str, "true")==0)?1:0;
 			isSuccess = ConfigurationStatus_Accepted;
 		}
 		else

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

@@ -423,7 +423,7 @@ enum GetConfigurationKey {
 	GetConfiguration_AuthDownloadlinkCertificate,
 	GetConfiguration_RfidEndianType,
 	GetConfiguration_AuthorizeTimeout,
-	GetConfiguration_EnableAcCcs,
+	GetConfiguration_Enable15118,
 	_GetConfiguration_CNT
 };
 

+ 3 - 3
EVSE/Projects/define.h

@@ -359,7 +359,7 @@ enum CoreProfile {
 	 AuthDownloadlinkCertificate,
 	 RfidEndianType,
 	 AuthorizeTimeout,
-	 EnableAcCcs,
+	 Enable15118,
 	 _CoreProfile_CNT
 };
 
@@ -610,7 +610,6 @@ struct SysConfigData
 	unsigned char           isReqFirstUpgrade;          //EVSE is request first upgrade from PH server
 	unsigned char           isEnableLocalPowerSharing;  //0: Disable power sharing  1: Master   2: Slave
 	unsigned char           StopChargingByButton;       //0: Disable  1: Enable
-	unsigned char           isEnable15118;              //0: Disable  1: Enable
     struct LCD_NOUSE        Legacy_LcdOveride;          // LCD override info (no use anymore)
     struct TTIA             TTIA_Info;                  // TTIA configuration struct
 
@@ -629,6 +628,7 @@ struct SysConfigData
     unsigned short          MaxChargingVoltage;                 // 0: rating value, 1 ~ RATING_VOLTAGE volt
     unsigned char           isEnalbleFirewall;                  // 0: Disable   1: Enable
     unsigned char           FirewallAcceptAddr[10][128];        // Max accepted server address is 10
+    unsigned char           isEnable15118;                      // 0: Disable  1: Enable
 };
 
 struct DERATING_BY_OTP
@@ -5021,7 +5021,7 @@ enum OCPP20CtrlrVariable
 	OCPPCommCtrlr_CharingProfileRefreshInterval,
     OCPPCommCtrlr_RfidEndianType,
 	OCPPCommCtrlr_AuthorizeTimeout,
-	OCPPCommCtrlr_EnableAcCcs,
+	OCPPCommCtrlr_Enable15118,
 	ReservationCtrlr_Enabled,
 	ReservationCtrlr_Available,
 	ReservationCtrlr_NonEvseSpecific,