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

Merge branch 'master' into DO360

Wendell 2 жил өмнө
parent
commit
26e58c1b01

+ 13 - 0
EVSE/Modularization/Module_PowerSharing.c

@@ -319,6 +319,18 @@ uint16_t checkChargingProfileLimit()
 	return targetMaxCurrent;
 }
 
+void getClientp(int socketFd)
+{
+	char clientip[20];
+	struct sockaddr_in addr;
+	socklen_t addr_size = sizeof(struct sockaddr_in);
+
+	getpeername(socketFd, (struct sockaddr *)&addr, &addr_size);
+	strcpy(clientip, inet_ntoa(addr.sin_addr));
+
+	DEBUG_INFO("Client IP address: %s\n", clientip);
+}
+
 //==========================================
 // Init all share memory
 //==========================================
@@ -822,6 +834,7 @@ int tcpSocketServer(void)
 		fcntl(clientSockFd, F_SETFD, FD_CLOEXEC);
 		DEBUG_INFO("Client connect in.\n");
 		DEBUG_INFO("clientSockFd : %d\n", clientSockFd);
+		getClientp(clientSockFd);
 
 		if(clientSockFd > 0)
 		{

+ 3 - 0
EVSE/Modularization/WebService.c

@@ -1751,6 +1751,7 @@ int main(int argc, char *argv[]) {
 		struct json_object *TelcomModemFwRev;
 		struct json_object *Connector1FwRev;
 		struct json_object *Connector2FwRev;
+		struct json_object *PsuLostQuantity;
 		/* for DC+AC*/
 		struct json_object *Connector3FwRev;
 		struct json_object *LedModuleFwRev;
@@ -2019,6 +2020,7 @@ int main(int argc, char *argv[]) {
 		TelcomModemFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev);
 		Connector1FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Connector1FwRev);
 		Connector2FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
+		PsuLostQuantity = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuLostQuantity);
 		/* for DC+AC*/
 		if(connectorType3==4){
 			Connector3FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[0].version);
@@ -2710,6 +2712,7 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj1,"TelcomModemFwRev",TelcomModemFwRev);
 		json_object_object_add(jobj1,"Connector1FwRev",Connector1FwRev);
 		json_object_object_add(jobj1,"Connector2FwRev",Connector2FwRev);
+		json_object_object_add(jobj1,"PsuLostQuantity",PsuLostQuantity);
 		/* for DC+AC*/
 		if(connectorType3==4){
 			json_object_object_add(jobj1,"Connector3FwRev",Connector3FwRev);

+ 28 - 3
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -811,7 +811,7 @@ static int localversion=0;
 //===============================
 // Variable Version
 //===============================
-static int variableVersion=7;
+static int variableVersion=8;
 
 //===============================
 // OCPP sign variable
@@ -886,6 +886,7 @@ struct ClientTime
 	struct timespec StopTransaction;
 	struct timespec MeterValues[CONNECTOR_QUANTITY];
 	struct timespec RemoteStartWait;
+	struct timespec CharingProfileRefresh[CONNECTOR_QUANTITY];
 
 }clientTime;
 
@@ -2297,6 +2298,16 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_StatusNotificationInterval].variableAttribute[0].value, "120");
 		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_StatusNotificationInterval]);
 
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].component.name, "OCPPCommCtrlr");
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].variable.name, "CharingProfileRefreshInterval");
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].variableCharacteristics.unit, "Seconds");
+		ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].variableCharacteristics.minLimit = 5;
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_integer]);
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].variableAttribute[0].value, "30");
+		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval]);
+
 		/* ReservationCtrlr Required item */
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[ReservationCtrlr_Enabled].component.name, "ReservationCtrlr");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[ReservationCtrlr_Enabled].variable.name, "Enabled");
@@ -2995,6 +3006,9 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_StatusNotificationInterval].component.name, "OCPPCommCtrlr");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_StatusNotificationInterval].variable.name, "StatusNotificationInterval");
 
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].component.name, "OCPPCommCtrlr");
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].variable.name, "CharingProfileRefreshInterval");
+
 		/* ReservationCtrlr Required item */
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[ReservationCtrlr_Enabled].component.name, "ReservationCtrlr");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[ReservationCtrlr_Enabled].variable.name, "Enabled");
@@ -7669,13 +7683,16 @@ void CheckSystemValue(void)
 		}
 
 		//==============================================
-		// CSU Trigger Smart Charging Profile
+		// CSU Trigger or timer timeout refresh Smart Charging Profile
 		//==============================================
-		if(ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq == ON)
+		if((ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq == ON) ||
+		   ((cpinitateMsg.bits[gun_index].isOnCharging) && (atoi((const char *)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].variableAttribute[0].value) > 0) && (getDiffSecNow(clientTime.CharingProfileRefresh[gun_index]) > atoi((const char *)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_CharingProfileRefreshInterval].variableAttribute[0].value))))
 		{
 			checkChargingStationMaxProfile(86400, &ShmOCPP20Data->MaxChargingProfile, 0, TRUE);
 			checkCompositeSchedule(gun_index+1, 86400, &ShmOCPP20Data->SmartChargingProfile[gun_index], 0, TRUE);
 			ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq = OFF;
+
+			refreshStartTimer(&clientTime.CharingProfileRefresh[gun_index]);
 		}
 
 		//==============================================
@@ -18609,6 +18626,14 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 									strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Accepted]);
 							}
 
+							if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "OCPPCommCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "CharingProfileRefreshInterval") != NULL))
+							{
+								if((0 < atoi((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue)) && (atoi((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue) < (int)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit) )
+									strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_OutOfRange]);
+								else
+									strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Accepted]);
+							}
+
 							if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "SecurityCtrlr") != NULL) &&
 							   ((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "SecurityProfile") != NULL) || (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "BasicAuthPassword") != NULL)))
 							{

+ 67 - 3
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -133,6 +133,7 @@ struct ClientTime
 	struct timespec MeterValues[CONNECTOR_QUANTITY];
 	struct timespec RemoteStartWait;
 	struct timespec TcciQueryDeduct;
+	struct timespec CharingProfileRefresh[CONNECTOR_QUANTITY];
 }clientTime;
 
 typedef union
@@ -5425,12 +5426,15 @@ void CheckSystemValue(void)
 		}
 
 		//==============================================
-		// CSU Trigger Smart Charging Profile
+		// CSU Trigger or timer timeout refresh Smart Charging Profile
 	    //==============================================
-	    if(ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq == 1)
+	    if((ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq == 1) ||
+	       ((cpinitateMsg.bits[gun_index].isOnCharging) && (atoi((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData) > 0) && (getDiffSecNow(clientTime.CharingProfileRefresh[gun_index]) > atoi((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData))))
 	    {
 	    	checkCompositeSchedule(gun_index+1, 86400, &ShmOCPP16Data->SmartChargingProfile[gun_index], TRUE);
 	    	ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq = 0;
+
+	    	refreshStartTimer(&clientTime.CharingProfileRefresh[gun_index]);
 	    }
 
 		//==============================================
@@ -16342,7 +16346,7 @@ int initialConfigurationTable(void)
 	char sstr[256]={0};
 	int c = 0;
 	char *loc;
-	int	confVersion = 17;
+	int	confVersion = 18;
 
 	DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
 	//start_t = clock();
@@ -16800,6 +16804,14 @@ int initialConfigurationTable(void)
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","ConfigurationVersion", "true", ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemData);
 
+		// Charging profile refresh interval
+		ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemName, "CharingProfileRefreshInterval");
+		sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData, "30");
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","CharingProfileRefreshInterval", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData);
+
+
 		//* Local Auth List Management Profile*/
 		#if 0
 			//For OCTT Test Case
@@ -17293,6 +17305,12 @@ int initialConfigurationTable(void)
 					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemData, "%d", atoi(valuestr));
 				}
 
+				if(strcmp(keystr, "CharingProfileRefreshInterval") == 0)
+				{
+					ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData, "%s", valuestr);
+				}
+
 				if(strcmp(keystr, "LocalAuthListEnabled") == 0)
 				{
 					ShmOCPP16Data->ConfigurationTable.LocalAuthListManagementProfile[LocalAuthListEnabled].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
@@ -17891,6 +17909,15 @@ void StoreConfigurationTable(void)
 
 	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","ConfigurationVersion", "true", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemData);
 
+	// CharingProfileRefreshInterval
+	/*
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemName, "CharingProfileRefreshInterval");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData, "" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","CharingProfileRefreshInterval", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData);
+
 	//* Local Auth List Management Profile*/
 	//LocalAuthListEnabled
 	/*
@@ -19015,6 +19042,23 @@ void getKeyValue(char *keyReq)
 			  isKnowKey = TRUE;
 		  }
 
+		  if(isEmpty ||  strcmp(keyReq, "CharingProfileRefreshInterval") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_CharingProfileRefreshInterval].Item, "CharingProfileRefreshInterval");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CharingProfileRefreshInterval].Key, "CharingProfileRefreshInterval");
+
+			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CharingProfileRefreshInterval].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CharingProfileRefreshInterval].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CharingProfileRefreshInterval].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData );
+			  isKnowKey = TRUE;
+		  }
 #if 1
 	      if(isEmpty ||  strcmp(keyReq, "LocalAuthListEnabled") == 0 )
 	      {
@@ -20368,6 +20412,26 @@ int setKeyValue(char *key, char *value)
 		}
 	}
 
+	if(strcmp(key, "CharingProfileRefreshInterval") == 0)
+	{
+		if(ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemAccessibility == 1)
+		{
+			if((atoi(value) != 0) && (atoi(value) < 5))
+			{
+				isSuccess = ConfigurationStatus_Rejected;
+			}
+			else{
+				strcpy(str, (const char*)value);
+				sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData, "%s", str );
+				isSuccess = ConfigurationStatus_Accepted;
+			}
+		}
+		else
+		{
+			isSuccess = ConfigurationStatus_Rejected;
+		}
+	}
+
 #if 0
     //For OCPP Test Case
     if(strcmp(key, "LocalAuthorizationListEnabled") == 0)

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

@@ -417,6 +417,7 @@ enum GetConfigurationKey {
 	GetConfiguration_ConnectorSwitch3to1PhaseSupported,
 	GetConfiguration_MaxChargingProfilesInstalled,
 	GetConfiguration_ConfigurationVersion,
+	GetConfiguration_CharingProfileRefreshInterval,
 	_GetConfiguration_CNT
 };
 

+ 67 - 4
EVSE/Modularization/ocppph/MessageHandler.c

@@ -134,6 +134,7 @@ struct ClientTime
 	struct timespec MeterValues[CONNECTOR_QUANTITY];
 	struct timespec RemoteStartWait;
 	struct timespec TcciQueryDeduct;
+	struct timespec CharingProfileRefresh[CONNECTOR_QUANTITY];
 }clientTime;
 
 typedef union
@@ -4946,12 +4947,15 @@ void CheckSystemValue(void)
 		}
 
 		//==============================================
-		// CSU Trigger Smart Charging Profile
+		// CSU Trigger or timer timeout refresh Smart Charging Profile
 	    //==============================================
-	    if(ShmOCPP16DataPH->CSUMsg.bits[gun_index].ChargingProfileReq == 1)
-	    {
+		 if((ShmOCPP16DataPH->CSUMsg.bits[gun_index].ChargingProfileReq == 1) ||
+		   ((cpinitateMsg.bits[gun_index].isOnCharging) && (atoi((const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData) > 0) && (getDiffSecNow(clientTime.CharingProfileRefresh[gun_index]) > atoi((const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData))))
+		{
 	    	checkCompositeSchedule(gun_index+1, 86400, &ShmOCPP16DataPH->SmartChargingProfile[gun_index], TRUE);
 	    	ShmOCPP16DataPH->CSUMsg.bits[gun_index].ChargingProfileReq = 0;
+
+	    	refreshStartTimer(&clientTime.CharingProfileRefresh[gun_index]);
 	    }
 
 		//==============================================
@@ -15834,7 +15838,7 @@ int initialConfigurationTable(void)
 	char sstr[256]={0};
 	int c = 0;
 	char *loc;
-	int	confVersion = 16;
+	int	confVersion = 17;
 
 	DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
 	//start_t = clock();
@@ -16264,6 +16268,13 @@ int initialConfigurationTable(void)
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","ConfigurationVersion", "true", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemData);
 
+		// Charging profile refresh interval
+		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemName, "CharingProfileRefreshInterval");
+		sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData, "30");
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","CharingProfileRefreshInterval", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData);
+
 		//* Local Auth List Management Profile*/
 		#if 0
 			//For OCTT Test Case
@@ -16734,6 +16745,12 @@ int initialConfigurationTable(void)
 					sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemData, "%d", atoi(valuestr));
 				}
 
+				if(strcmp(keystr, "CharingProfileRefreshInterval") == 0)
+				{
+					ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData, "%s", valuestr);
+				}
+
 				if(strcmp(keystr, "LocalAuthListEnabled") == 0)
 				{
 					ShmOCPP16DataPH->ConfigurationTable.LocalAuthListManagementProfile[LocalAuthListEnabled].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
@@ -17295,6 +17312,16 @@ void StoreConfigurationTable(void)
 
 	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","ConfigurationVersion", "true", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemData);
 
+	// CharingProfileRefreshInterval
+	/*
+	ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemName, "CharingProfileRefreshInterval");
+	strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData, "" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","CharingProfileRefreshInterval", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData);
+
+
 	//* Local Auth List Management Profile*/
 	//LocalAuthListEnabled
 	/*
@@ -18347,6 +18374,23 @@ void getKeyValue(char *keyReq)
 			  isKnowKey = TRUE;
 		  }
 
+		  if(isEmpty ||  strcmp(keyReq, "CharingProfileRefreshInterval") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_CharingProfileRefreshInterval].Item, "CharingProfileRefreshInterval");
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CharingProfileRefreshInterval].Key, "CharingProfileRefreshInterval");
+
+			  if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CharingProfileRefreshInterval].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CharingProfileRefreshInterval].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CharingProfileRefreshInterval].Value, (const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData );
+			  isKnowKey = TRUE;
+		  }
 #if 1
 	      if(isEmpty ||  strcmp(keyReq, "LocalAuthListEnabled") == 0 )
 	      {
@@ -19643,6 +19687,25 @@ int setKeyValue(char *key, char *value)
 		}
 	}
 
+	if(strcmp(key, "CharingProfileRefreshInterval") == 0)
+	{
+		if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemAccessibility == 1)
+		{
+			if((atoi(value) != 0) && (atoi(value) < 5))
+			{
+				isSuccess = ConfigurationStatus_Rejected;
+			}
+			else{
+				strcpy(str, (const char*)value);
+				sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CharingProfileRefreshInterval].ItemData, "%s", str );
+				isSuccess = ConfigurationStatus_Accepted;
+			}
+		}
+		else
+		{
+			isSuccess = ConfigurationStatus_Rejected;
+		}
+	}
 #if 0
     //For OCPP Test Case
     if(strcmp(key, "LocalAuthorizationListEnabled") == 0)

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

@@ -413,6 +413,7 @@ enum GetConfigurationKey {
 	GetConfiguration_ConnectorSwitch3to1PhaseSupported,
 	GetConfiguration_MaxChargingProfilesInstalled,
 	GetConfiguration_ConfigurationVersion,
+	GetConfiguration_CharingProfileRefreshInterval,
 	_GetConfiguration_CNT
 };
 

+ 72 - 13
EVSE/Projects/AW-Regular/Apps/Module_ConfigTools.c

@@ -378,7 +378,17 @@ int main(void)
 			printf("\n  cboxid: Charger box id.");
 			printf("\n  vender: Charger point vender.");
 			printf("\n  offlinepolicy: Charger off line policy.");
-			printf("\n  localloadbalance: Charger local load balance.");
+			printf("\n  localpowersharing: Charger local load balance.");
+			if(ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing == 1)
+			{
+				printf("\n  powersharingcapacity: Power Sharing Capacity.");
+			}
+			else if(ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing == 2)
+			{
+				printf("\n  powersharingserverip: Power Sharing Server IP.");
+			}
+			else
+			{}
 			printf("\n  maintainurl: Maintain server url.");
 			printf("\n  maintainsecurity: Maintain server security profile.");
 			printf("\n **************************************************");
@@ -409,7 +419,7 @@ int main(void)
 			if(strcmp(cmd, "mtserverurl") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n ***** mtserverurl *********************************");
+				printf("\n ***** mtserverurl ********************************");
 				printf("\n  Current maintain server url: %s", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new ocpp url.");
@@ -513,27 +523,76 @@ int main(void)
 						break;
 				}
 			}
-			else if(strcmp(cmd, "localloadbalance") == 0)
+			else if(strcmp(cmd, "localpowersharing") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n ***** localloadbalance ***************************");
-				printf("\n  Current local loading balance: %d", ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing);
+				printf("\n ***** localpowersharing **************************");
+				printf("\n  Current local power sharing: %d", ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing);
 				printf("\n  0: Disable.");
-				printf("\n  1: Enable.");
+				printf("\n  1: Master.");
+				printf("\n  2: Slave.");
 				printf("\n **************************************************");
 				printf("\n  Please input local load balance mode: ");
 				scanf("%s", &cmd[0]);
 
-				ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd):0);
-				if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
-					DEBUG_INFO("Local loading balance: Enable\n");
-				else
-					DEBUG_INFO("Local loading balance: Disable\n");
+				ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing = ((0<=atoi(cmd))&&(atoi(cmd)<=2)?atoi(cmd):0);
+
+				switch(ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing)
+				{
+					case 0:
+						DEBUG_INFO("Local loading balance: Disable\n");
+						break;
+					case 1:
+						DEBUG_INFO("Local loading balance: Master\n");
+						break;
+					case 2:
+						DEBUG_INFO("Local loading balance: Slave\n");
+						break;
+				}
+			}
+			else if(strcmp(cmd, "powersharingcapacity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** powersharingcapacity ***********************");
+				printf("\n  Current local power sharing capacity: %d", ShmSysConfigAndInfo->SysConfig.PowerSharingCapacityPower);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new capacity(W).");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input capacity(W): ");
+					scanf("%s", &cmd[0]);
+					ShmSysConfigAndInfo->SysConfig.PowerSharingCapacityPower = ((0<=atoi(cmd))?atoi(cmd):0);
+				}
+			}
+			else if(strcmp(cmd, "powersharingserverip") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** powersharingserverip ***********************");
+				printf("\n  Current power sharing server IP: %s", ShmSysConfigAndInfo->SysConfig.PowerSharingServerIP);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new server IP address.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+				
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input power sharing server IP address: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.PowerSharingServerIP[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.PowerSharingServerIP));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.PowerSharingServerIP[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input server IP address: %s\n", ShmSysConfigAndInfo->SysConfig.PowerSharingServerIP);
+				}
 			}
 			else if(strcmp(cmd, "maintainurl") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n ***** maintainurl *********************************");
+				printf("\n ***** maintainurl ********************************");
 				printf("\n  Current maintain url: %s", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new maintain url.");
@@ -554,7 +613,7 @@ int main(void)
 			else if(strcmp(cmd, "maintainsecurity") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n ***** maintainsecurity ****************************");
+				printf("\n ***** maintainsecurity ***************************");
 				printf("\n  Current maintain security profile: %d", ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile);
 				printf("\n  0: Profile-0.");
 				printf("\n  1: Profile-1.");

+ 2 - 0
EVSE/Projects/define.h

@@ -344,6 +344,7 @@ enum CoreProfile {
      EVCCID_PREFIX,
      OffLineMaxChargingPower,
      ConfigurationVersion,
+	 CharingProfileRefreshInterval,
 	 _CoreProfile_CNT
 };
 
@@ -5067,6 +5068,7 @@ enum OCPP20CtrlrVariable
 	OCPPCommCtrlr_PublicKeyWithSignedMeterValue,
     OCPPCommCtrlr_StatusNotificationPeriodically,
     OCPPCommCtrlr_StatusNotificationInterval,
+	OCPPCommCtrlr_CharingProfileRefreshInterval,
     OCPPCommCtrlr_VariableVersion,
 	ReservationCtrlr_Enabled,
 	ReservationCtrlr_Available,

+ 1 - 0
EVSE/rootfs/etc/logrotate.d/evse

@@ -11,6 +11,7 @@
 /var/log/**/*.log{
 	daily
         rotate 3
+	nodateext
         size 3M
         missingok
         compress

+ 0 - 1
board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/.MLO.byteswap.cmd

@@ -1 +0,0 @@
-cmd_MLO.byteswap := ./tools/mkimage -T omapimage -n byteswap -a 0x402F0400 -d spl/u-boot-spl.bin MLO.byteswap  >/dev/null

+ 0 - 1
board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/.MLO.cmd

@@ -1 +0,0 @@
-cmd_MLO := ./tools/mkimage -T omapimage -a 0x402F0400 -d spl/u-boot-spl.bin MLO  >/dev/null