Browse Source

2022-04-14/Jerry Wang
Action:
1. Change confVersion (Ocpp16:14->15, Ocpp16PH:13->14).
2. [New Add]Add 3 configuration keys 'isEnableLocalPowersharing','PowerSharingServerIP','EVCCID_PREFIX'.
3. [Improve]Modify SendLocalList updateType:Full checking content logic(disable checking listVersion).
4. [Bug fix]Change temp variable 'idTagstr' and 'parentIdTagstr' length to 21 bytes in handleReserveNowTransactionRequest function.
5. [Improve]Modify the GetCompositeScheduleConfirmation message content for no profile situation.

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

Jerry Wang 2 years ago
parent
commit
f66ed01566

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

@@ -8807,7 +8807,7 @@ int sendGetCompositeScheduleConfirmation(char *uuid, char *payload, int connecto
 		}
 		else
 		{
-			sprintf(message,"[%d,\"%s\",{\"status\":\"%s\",\"connectorId\":%d,\"scheduleStart\":\"%s\",\"chargingSchedule\":{\"duration\":%d,\"startSchedule\":\"%s\",\"chargingRateUnit\":\"%s\",\"chargingSchedulePeriod\":[{\"startPeriod\":0,\"limit\":%d,\"numberPhases\":3}]}}]"
+			sprintf(message,"[%d,\"%s\",{\"status\":\"%s\",\"connectorId\":%d,\"scheduleStart\":\"%s\",\"chargingSchedule\":{\"duration\":%d,\"startSchedule\":\"%s\",\"chargingRateUnit\":\"%s\",\"chargingSchedulePeriod\":[{\"startPeriod\":0,\"limit\":%d}]}}]"
 										,MESSAGE_TYPE_CALLRESULT
 										,uuid
 										,payload
@@ -8816,7 +8816,7 @@ int sendGetCompositeScheduleConfirmation(char *uuid, char *payload, int connecto
 										,ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.Duration
 										,ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.StartSchedule
 										,ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingRateUnit
-										,(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent==0?ShmSysConfigAndInfo->SysConfig.RatingCurrent:ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent));
+										,ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingRateUnit[0]=='W'?modelnameInfo.ratedPower:(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent==0?ShmSysConfigAndInfo->SysConfig.RatingCurrent:ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent));
 		}
 	}
 	else
@@ -13058,7 +13058,7 @@ int handleReserveNowTransactionRequest(char *uuid, char *payload)
 	int result = FAIL;
 	int connectorIdInt=0, reservationIdInt=0;
 	int tempIndex = 0;
-	char expiryDatestr[30]={0}, idTagstr[20]={0},parentIdTagstr[20]={0};
+	char expiryDatestr[30]={0}, idTagstr[21]={0},parentIdTagstr[21]={0};
 	char comfirmstr[20]={0};
 	char sstr[180]={ 0 },sstrtemp[200]={ 0 };
 	int c = 0;
@@ -13739,23 +13739,22 @@ int handleSendLocalListRequest(char *uuid, char *payload)
 			{
 				//Local list full update
 				DEBUG_INFO("Local list full update.\n");
-
+				locallistVersion = 0;
 				OCPP_getListVerion();
 
-				if(ShmOCPP16Data->SendLocalList.ListVersion < locallistVersion)
+				/*if(ShmOCPP16Data->SendLocalList.ListVersion < locallistVersion)
 				{
 					strcpy(comfirmstr, UpdateStatusStr[UpdateStatus_Failed]);
 					goto end;
-				}
+				}*/
 
 				OCPP_cleanLocalList();
-
 			}
 			else if(strcmp((char*)ShmOCPP16Data->SendLocalList.UpdateType, UpdateTypeStr[Differential]) == 0)
 			{
 				//Local list different update
 				DEBUG_INFO("Local list different update.\n");
-
+				locallistVersion = 0;
 				OCPP_getListVerion();
 
 				if(ShmOCPP16Data->SendLocalList.ListVersion < locallistVersion)
@@ -14365,7 +14364,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
 		goto end;
 	}
 
-	//------------------------------Satrt: Check Configuration Key "MaxChargingProfilesInstalled" Logic---------------------------------------//
+	//------------------------------Start: Check Configuration Key "MaxChargingProfilesInstalled" Logic---------------------------------------//
 	{
 		FILE *fp;
 		char dataLine[4096]={0};
@@ -15844,7 +15843,7 @@ int initialConfigurationTable(void)
 	char sstr[256]={0};
 	int c = 0;
 	char *loc;
-	int	confVersion = 14;
+	int	confVersion = 15;
 
 	DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
 	//start_t = clock();
@@ -16267,6 +16266,27 @@ int initialConfigurationTable(void)
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","PreAuthAmount", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemData);
 
+		// isEnableLocalPowersharing
+		ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemName, "isEnableLocalPowersharing");
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData, "0" );
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","isEnableLocalPowersharing", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData);
+
+		// PowerSharingServerIP
+		ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemName, "PowerSharingServerIP");
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData, "" );
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","PowerSharingServerIP", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData);
+
+		// EVCCID_PREFIX
+		ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemName, "EVCCID_PREFIX");
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData, "" );
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","EVCCID_PREFIX", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData);
+
 		// Configuration Version
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemName, "ConfigurationVersion");
@@ -16737,6 +16757,24 @@ int initialConfigurationTable(void)
 					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemData, "%.2f", atof(valuestr));
 				}
 
+				if(strcmp(keystr, "isEnableLocalPowersharing") == 0)
+				{
+					ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData, "%d", atoi(valuestr));
+				}
+
+				if(strcmp(keystr, "PowerSharingServerIP") == 0)
+				{
+					ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData, "%s",valuestr);
+				}
+
+				if(strcmp(keystr, "EVCCID_PREFIX") == 0)
+				{
+					ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData, "%s", valuestr);
+				}
+
 				if(strcmp(keystr, "ConfigurationVersion") == 0)
 				{
 					ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
@@ -17296,6 +17334,33 @@ void StoreConfigurationTable(void)
 
 	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","PreAuthAmount", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PreAuthAmount].ItemData);
 
+	// isEnableLocalPowersharing
+	/*
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemName, "isEnableLocalPowersharing");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData, "0" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","isEnableLocalPowersharing", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData);
+
+	// PowerSharingServerIP
+	/*
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemName, "PowerSharingServerIP");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData, "" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","PowerSharingServerIP", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData);
+
+	// EVCCID_PREFIX
+	/*
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemName, "EVCCID_PREFIX");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData, "" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","EVCCID_PREFIX", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData);
+
 	// ConfigurationVersion
 	/*
 	ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = 1;
@@ -18339,6 +18404,60 @@ void getKeyValue(char *keyReq)
 			  isKnowKey = TRUE;
 		  }
 
+		  if(isEmpty ||  strcmp(keyReq, "isEnableLocalPowersharing") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_isEnableLocalPowersharing].Item, "isEnableLocalPowersharing");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_isEnableLocalPowersharing].Key, "isEnableLocalPowersharing");
+
+			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_isEnableLocalPowersharing].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_isEnableLocalPowersharing].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_isEnableLocalPowersharing].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData );
+			  isKnowKey = TRUE;
+		  }
+
+		  if(isEmpty ||  strcmp(keyReq, "PowerSharingServerIP") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_PowerSharingServerIP].Item, "PowerSharingServerIP");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PowerSharingServerIP].Key, "PowerSharingServerIP");
+
+			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PowerSharingServerIP].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PowerSharingServerIP].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PowerSharingServerIP].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData );
+			  isKnowKey = TRUE;
+		  }
+
+		  if(isEmpty ||  strcmp(keyReq, "EVCCID_PREFIX") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_EVCCID_PREFIX].Item, "EVCCID_PREFIX");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EVCCID_PREFIX].Key, "EVCCID_PREFIX");
+
+			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EVCCID_PREFIX].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EVCCID_PREFIX].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EVCCID_PREFIX].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData );
+			  isKnowKey = TRUE;
+		  }
+
 	      if(isEmpty ||  strcmp(keyReq, "ConfigurationVersion") == 0 )
 		  {
 			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_ConfigurationVersion].Item, "ConfigurationVersion");
@@ -19634,6 +19753,61 @@ int setKeyValue(char *key, char *value)
 		}
 	}
 
+	if(strcmp(key, "isEnableLocalPowersharing") == 0)
+	{
+		if(ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemAccessibility == 1)
+		{
+			check_ascii = value[0];
+			if( (check_ascii < 48) || (check_ascii > 57) )
+			{
+				isSuccess = ConfigurationStatus_Rejected;
+			}
+			else
+			{
+				if(atoi(value) >= 0)
+				{
+					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData, "%d", atoi(value) );
+					isSuccess = ConfigurationStatus_Accepted;
+				}
+				else
+					isSuccess = ConfigurationStatus_Rejected;
+			}
+		}
+		else
+		{
+			isSuccess = ConfigurationStatus_Rejected;
+		}
+	}
+
+	if(strcmp(key, "PowerSharingServerIP") == 0)
+	{
+		if(ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemAccessibility == 1)
+		{
+			strcpy(str, (const char*)value);
+			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData, "%s", str );
+			sprintf((char *)ShmSysConfigAndInfo->SysConfig.PowerSharingServerIP, "%s", str );
+			isSuccess = ConfigurationStatus_Accepted;
+		}
+		else
+		{
+			isSuccess = ConfigurationStatus_Rejected;
+		}
+	}
+
+	if(strcmp(key, "EVCCID_PREFIX") == 0)
+	{
+		if(ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemAccessibility == 1)
+		{
+			strcpy(str, (const char*)value);
+			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData, "%s", str );
+			isSuccess = ConfigurationStatus_Accepted;
+		}
+		else
+		{
+			isSuccess = ConfigurationStatus_Rejected;
+		}
+	}
+
 #if 0
     //For OCPP Test Case
     if(strcmp(key, "LocalAuthorizationListEnabled") == 0)

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

@@ -403,6 +403,9 @@ enum GetConfigurationKey {
 	GetConfiguration_StatusNotificationPeriodically,
 	GetConfiguration_StatusNotificationInterval,
 	GetConfiguration_PreAuthAmount,
+	GetConfiguration_isEnableLocalPowersharing,
+	GetConfiguration_PowerSharingServerIP,
+	GetConfiguration_EVCCID_PREFIX,
 	GetConfiguration_LocalAuthListEnabled,
 	GetConfiguration_LocalAuthListMaxLength,
 	GetConfiguration_SendLocalListMaxLength,

+ 183 - 9
EVSE/Modularization/ocppph/MessageHandler.c

@@ -8340,7 +8340,7 @@ int sendGetCompositeScheduleConfirmation(char *uuid, char *payload, int connecto
 		}
 		else
 		{
-			sprintf(message,"[%d,\"%s\",{\"status\":\"%s\",\"connectorId\":%d,\"scheduleStart\":\"%s\",\"chargingSchedule\":{\"duration\":%d,\"startSchedule\":\"%s\",\"chargingRateUnit\":\"%s\",\"chargingSchedulePeriod\":[{\"startPeriod\":0,\"limit\":%d,\"numberPhases\":3}]}}]"
+			sprintf(message,"[%d,\"%s\",{\"status\":\"%s\",\"connectorId\":%d,\"scheduleStart\":\"%s\",\"chargingSchedule\":{\"duration\":%d,\"startSchedule\":\"%s\",\"chargingRateUnit\":\"%s\",\"chargingSchedulePeriod\":[{\"startPeriod\":0,\"limit\":%d}]}}]"
 										,MESSAGE_TYPE_CALLRESULT
 										,uuid
 										,payload
@@ -8349,7 +8349,7 @@ int sendGetCompositeScheduleConfirmation(char *uuid, char *payload, int connecto
 										,ShmOCPP16DataPH->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.Duration
 										,ShmOCPP16DataPH->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.StartSchedule
 										,ShmOCPP16DataPH->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingRateUnit
-										,(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent==0?ShmSysConfigAndInfo->SysConfig.RatingCurrent:ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent));
+										,ShmOCPP16DataPH->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingRateUnit[0]=='W'?modelnameInfo.ratedPower:(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent==0?ShmSysConfigAndInfo->SysConfig.RatingCurrent:ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent));
 		}
 	}
 	else
@@ -12564,7 +12564,7 @@ int handleReserveNowTransactionRequest(char *uuid, char *payload)
 	int result = FAIL;
 	int connectorIdInt=0, reservationIdInt=0;
 	int tempIndex = 0;
-	char expiryDatestr[30]={0}, idTagstr[20]={0},parentIdTagstr[20]={0};
+	char expiryDatestr[30]={0}, idTagstr[21]={0},parentIdTagstr[21]={0};
 	char comfirmstr[20]={0};
 	char sstr[180]={ 0 },sstrtemp[200]={ 0 };
 	int c = 0;
@@ -13245,23 +13245,22 @@ int handleSendLocalListRequest(char *uuid, char *payload)
 			{
 				//Local list full update
 				DEBUG_INFO("Local list full update.\n");
-
+				locallistVersion = 0;
 				OCPP_getListVerion();
 
-				if(ShmOCPP16DataPH->SendLocalList.ListVersion < locallistVersion)
+				/*if(ShmOCPP16DataPH->SendLocalList.ListVersion < locallistVersion)
 				{
 					strcpy(comfirmstr, UpdateStatusStr[UpdateStatus_Failed]);
 					goto end;
-				}
+				}*/
 
 				OCPP_cleanLocalList();
-
 			}
 			else if(strcmp((char*)ShmOCPP16DataPH->SendLocalList.UpdateType, UpdateTypeStr[Differential]) == 0)
 			{
 				//Local list different update
 				DEBUG_INFO("Local list different update.\n");
-
+				locallistVersion = 0;
 				OCPP_getListVerion();
 
 				if(ShmOCPP16DataPH->SendLocalList.ListVersion < locallistVersion)
@@ -15339,7 +15338,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();
@@ -15734,6 +15733,27 @@ int initialConfigurationTable(void)
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","StatusNotificationInterval", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StatusNotificationInterval].ItemData);
 
+		// isEnableLocalPowersharing
+		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemName, "isEnableLocalPowersharing");
+		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData, "0" );
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","isEnableLocalPowersharing", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData);
+
+		// PowerSharingServerIP
+		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemName, "PowerSharingServerIP");
+		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData, "" );
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","PowerSharingServerIP", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData);
+
+		// EVCCID_PREFIX
+		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemName, "EVCCID_PREFIX");
+		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData, "" );
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","EVCCID_PREFIX", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData);
+
 		// Configuration Version
 		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemName, "ConfigurationVersion");
@@ -16181,6 +16201,24 @@ int initialConfigurationTable(void)
 					sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StatusNotificationInterval].ItemData, "%d", atoi(valuestr));
 				}
 
+				if(strcmp(keystr, "isEnableLocalPowersharing") == 0)
+				{
+					ShmOCPP16DataPH->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData, "%d", atoi(valuestr));
+				}
+
+				if(strcmp(keystr, "PowerSharingServerIP") == 0)
+				{
+					ShmOCPP16DataPH->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData, "%s",valuestr);
+				}
+
+				if(strcmp(keystr, "EVCCID_PREFIX") == 0)
+				{
+					ShmOCPP16DataPH->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData, "%s", valuestr);
+				}
+
 				if(strcmp(keystr, "ConfigurationVersion") == 0)
 				{
 					ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
@@ -16703,6 +16741,33 @@ void StoreConfigurationTable(void)
 
 	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","StatusNotificationInterval", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StatusNotificationInterval].ItemData);
 
+	// isEnableLocalPowersharing
+	/*
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemName, "isEnableLocalPowersharing");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData, "0" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","isEnableLocalPowersharing", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData);
+
+	// PowerSharingServerIP
+	/*
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemName, "PowerSharingServerIP");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData, "" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","PowerSharingServerIP", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData);
+
+	// EVCCID_PREFIX
+	/*
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemName, "EVCCID_PREFIX");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData, "" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","EVCCID_PREFIX", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData);
+
 	// ConfigurationVersion
 	/*
 	ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = 1;
@@ -17674,6 +17739,60 @@ void getKeyValue(char *keyReq)
 			  isKnowKey = TRUE;
 		  }
 
+		  if(isEmpty ||  strcmp(keyReq, "isEnableLocalPowersharing") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_isEnableLocalPowersharing].Item, "isEnableLocalPowersharing");
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_isEnableLocalPowersharing].Key, "isEnableLocalPowersharing");
+
+			  if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_isEnableLocalPowersharing].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_isEnableLocalPowersharing].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_isEnableLocalPowersharing].Value, (const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData );
+			  isKnowKey = TRUE;
+		  }
+
+		  if(isEmpty ||  strcmp(keyReq, "PowerSharingServerIP") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_PowerSharingServerIP].Item, "PowerSharingServerIP");
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PowerSharingServerIP].Key, "PowerSharingServerIP");
+
+			  if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PowerSharingServerIP].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PowerSharingServerIP].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_PowerSharingServerIP].Value, (const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData );
+			  isKnowKey = TRUE;
+		  }
+
+		  if(isEmpty ||  strcmp(keyReq, "EVCCID_PREFIX") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_EVCCID_PREFIX].Item, "EVCCID_PREFIX");
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EVCCID_PREFIX].Key, "EVCCID_PREFIX");
+
+			  if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EVCCID_PREFIX].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EVCCID_PREFIX].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EVCCID_PREFIX].Value, (const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData );
+			  isKnowKey = TRUE;
+		  }
+
 	      if(isEmpty ||  strcmp(keyReq, "ConfigurationVersion") == 0 )
 		  {
 			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_ConfigurationVersion].Item, "ConfigurationVersion");
@@ -18912,6 +19031,61 @@ int setKeyValue(char *key, char *value)
 		}
 	}
 
+	if(strcmp(key, "isEnableLocalPowersharing") == 0)
+	{
+		if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemAccessibility == 1)
+		{
+			check_ascii = value[0];
+			if( (check_ascii < 48) || (check_ascii > 57) )
+			{
+				isSuccess = ConfigurationStatus_Rejected;
+			}
+			else
+			{
+				if(atoi(value) >= 0)
+				{
+					sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[isEnableLocalPowersharing].ItemData, "%d", atoi(value) );
+					isSuccess = ConfigurationStatus_Accepted;
+				}
+				else
+					isSuccess = ConfigurationStatus_Rejected;
+			}
+		}
+		else
+		{
+			isSuccess = ConfigurationStatus_Rejected;
+		}
+	}
+
+	if(strcmp(key, "PowerSharingServerIP") == 0)
+	{
+		if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemAccessibility == 1)
+		{
+			strcpy(str, (const char*)value);
+			sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[PowerSharingServerIP].ItemData, "%s", str );
+			sprintf((char *)ShmSysConfigAndInfo->SysConfig.PowerSharingServerIP, "%s", str );
+			isSuccess = ConfigurationStatus_Accepted;
+		}
+		else
+		{
+			isSuccess = ConfigurationStatus_Rejected;
+		}
+	}
+
+	if(strcmp(key, "EVCCID_PREFIX") == 0)
+	{
+		if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemAccessibility == 1)
+		{
+			strcpy(str, (const char*)value);
+			sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[EVCCID_PREFIX].ItemData, "%s", str );
+			isSuccess = ConfigurationStatus_Accepted;
+		}
+		else
+		{
+			isSuccess = ConfigurationStatus_Rejected;
+		}
+	}
+
 #if 0
     //For OCPP Test Case
     if(strcmp(key, "LocalAuthorizationListEnabled") == 0)

+ 3 - 0
EVSE/Modularization/ocppph/MessageHandler.h

@@ -399,6 +399,9 @@ enum GetConfigurationKey {
 	GetConfiguration_MaintainServer,
 	GetConfiguration_StatusNotificationPeriodically,
 	GetConfiguration_StatusNotificationInterval,
+	GetConfiguration_isEnableLocalPowersharing,
+	GetConfiguration_PowerSharingServerIP,
+	GetConfiguration_EVCCID_PREFIX,
 	GetConfiguration_LocalAuthListEnabled,
 	GetConfiguration_LocalAuthListMaxLength,
 	GetConfiguration_SendLocalListMaxLength,