|
@@ -9480,7 +9480,7 @@ int handleChangeConfigurationRequest(char *uuid, char *payload)
|
|
|
mtrace();
|
|
|
int result = FAIL;
|
|
|
char keystr[40]={0};
|
|
|
- char valuestr[256]={0};
|
|
|
+ char valuestr[501]={0}; //value should be limited in 500 bytes
|
|
|
char comfirmstr[20]={0};
|
|
|
|
|
|
DEBUG_INFO("handleChangeConfigurationRequest...\n");
|
|
@@ -9492,15 +9492,21 @@ int handleChangeConfigurationRequest(char *uuid, char *payload)
|
|
|
if(json_object_object_get(ChangeConfiguration, "key") != NULL)
|
|
|
sprintf((char*)keystr, "%s", json_object_get_string(json_object_object_get(ChangeConfiguration, "key")));
|
|
|
|
|
|
- if(json_object_object_get(ChangeConfiguration, "value") != NULL)
|
|
|
+ if((json_object_object_get(ChangeConfiguration, "value") != NULL) && (strlen(json_object_get_string(json_object_object_get(ChangeConfiguration, "value"))) < ARRAY_SIZE(valuestr)))
|
|
|
+ {
|
|
|
sprintf((char*)valuestr, "%s", json_object_get_string(json_object_object_get(ChangeConfiguration, "value")));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DEBUG_ERROR("The ChangeConfiguration value is NULL or OVER SIZE.\n");
|
|
|
+ }
|
|
|
}
|
|
|
json_object_put(ChangeConfiguration);
|
|
|
|
|
|
|
|
|
- if((uuid==NULL) || (payload ==NULL) )
|
|
|
+ if((uuid==NULL) || (payload ==NULL) || (strlen(valuestr)<=0))
|
|
|
{
|
|
|
- DEBUG_ERROR("Payload is null\n");
|
|
|
+ DEBUG_ERROR("Payload is null or not accepted.\n");
|
|
|
sprintf(comfirmstr, "%s", ConfigurationStatusStr[ConfigurationStatus_Rejected] );
|
|
|
}
|
|
|
else
|
|
@@ -9534,7 +9540,7 @@ int handleChangeConfigurationRequest(char *uuid, char *payload)
|
|
|
sendChangeConfigurationConfirmation(uuid, comfirmstr);
|
|
|
ShmOCPP16Data->MsMsg.bits.ChangeConfigurationConf = 1;
|
|
|
|
|
|
- if(((strcmp(keystr,"AuthorizationKey")==0) || (strcmp(keystr,"SecurityProfile")==0)) && (strcmp(comfirmstr,"Accepted")==0))
|
|
|
+ if(((strcmp(keystr,"AuthorizationKey")==0) || (strcmp(keystr,"SecurityProfile")==0) || (strcmp(keystr,"OcppServer")==0) || (strcmp(keystr,"MaintainServer")==0)) && (strcmp(comfirmstr,"Accepted")==0))
|
|
|
{
|
|
|
StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
|
|
|
SetOcppConnStatus(FALSE);
|
|
@@ -13372,7 +13378,6 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
for(uint8_t idxPeriod=0;idxPeriod<chargingSchedulePeriodCount;idxPeriod++)
|
|
|
{
|
|
|
-
|
|
|
if((SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit > (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit[0]=='W'?modelnameInfo.ratedPower:modelnameInfo.ParsingInfo[0].Current)))
|
|
|
{
|
|
|
sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected] );
|
|
@@ -15125,7 +15130,7 @@ int initialConfigurationTable(void)
|
|
|
char sstr[256]={0};
|
|
|
int c = 0;
|
|
|
char *loc;
|
|
|
- int confVersion = 10;
|
|
|
+ int confVersion = 11;
|
|
|
|
|
|
DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
|
|
|
//start_t = clock();
|
|
@@ -15506,6 +15511,20 @@ int initialConfigurationTable(void)
|
|
|
|
|
|
fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","FreeVend", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[FreeVend].ItemData);
|
|
|
|
|
|
+ // OcppServer
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemName, "OcppServer");
|
|
|
+ memcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemData, (char*)ShmSysConfigAndInfo->SysConfig.OcppServerURL, 500);
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","OcppServer", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemData);
|
|
|
+
|
|
|
+ // MaintainServer
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemName, "MaintainServer");
|
|
|
+ memcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemData, (char*)ShmSysConfigAndInfo->SysConfig.MaintainServerURL, 500);
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MaintainServer", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemData);
|
|
|
+
|
|
|
// Configuration Version
|
|
|
ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = 0;
|
|
|
strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemName, "ConfigurationVersion");
|
|
@@ -15940,6 +15959,18 @@ int initialConfigurationTable(void)
|
|
|
sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[FreeVend].ItemData, "%s", (ShmSysConfigAndInfo->SysConfig.AuthorisationMode ? "TRUE" : "FALSE"));
|
|
|
}
|
|
|
|
|
|
+ if(strcmp(keystr, "OcppServer") == 0)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
|
+ memcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemData, (char *)ShmSysConfigAndInfo->SysConfig.OcppServerURL, 500);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(keystr, "MaintainServer") == 0)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
|
+ memcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemData, (char *)ShmSysConfigAndInfo->SysConfig.MaintainServerURL,500);
|
|
|
+ }
|
|
|
+
|
|
|
if(strcmp(keystr, "ConfigurationVersion") == 0)
|
|
|
{
|
|
|
ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
@@ -16445,6 +16476,24 @@ void StoreConfigurationTable(void)
|
|
|
|
|
|
fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","FreeVend", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[FreeVend].ItemData);
|
|
|
|
|
|
+ // OcppServer
|
|
|
+ /*
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemName, "OcppServer");
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemData, "FALSE" );
|
|
|
+ */
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","OcppServer", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemData);
|
|
|
+
|
|
|
+ // MaintainServer
|
|
|
+ /*
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemName, "MaintainServer");
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemData, "FALSE" );
|
|
|
+ */
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MaintainServer", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemData);
|
|
|
+
|
|
|
// ConfigurationVersion
|
|
|
/*
|
|
|
ShmOCPP16Data->ConfigurationTable.CoreProfile[ConfigurationVersion].ItemAccessibility = 1;
|
|
@@ -17380,6 +17429,42 @@ void getKeyValue(char *keyReq)
|
|
|
isKnowKey = TRUE;
|
|
|
}
|
|
|
|
|
|
+ if(isEmpty || strcmp(keyReq, "OcppServer") == 0 )
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_OcppServer].Item, "OcppServer");
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_OcppServer].Key, "OcppServer");
|
|
|
+
|
|
|
+ if(ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_OcppServer].ReadOnly, "0"/*"FALSE"*/);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_OcppServer].ReadOnly, "1"/*"TRUE"*/);
|
|
|
+ }
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_OcppServer].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemData);
|
|
|
+ isKnowKey = TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isEmpty || strcmp(keyReq, "MaintainServer") == 0 )
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_MaintainServer].Item, "MaintainServer");
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_MaintainServer].Key, "MaintainServer");
|
|
|
+
|
|
|
+ if(ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_MaintainServer].ReadOnly, "0"/*"FALSE"*/);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_MaintainServer].ReadOnly, "1"/*"TRUE"*/);
|
|
|
+ }
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_MaintainServer].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemData);
|
|
|
+ isKnowKey = TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
if(isEmpty || strcmp(keyReq, "ConfigurationVersion") == 0 )
|
|
|
{
|
|
|
strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_ConfigurationVersion].Item, "ConfigurationVersion");
|
|
@@ -17592,7 +17677,7 @@ int setKeyValue(char *key, char *value)
|
|
|
{
|
|
|
int isSuccess = NotSupported;
|
|
|
int check_ascii=0;
|
|
|
- char str[256]={0};
|
|
|
+ char str[501]={0};
|
|
|
|
|
|
DEBUG_INFO(" setKeyValue %s = %s\n", key, value);
|
|
|
|
|
@@ -18546,7 +18631,38 @@ int setKeyValue(char *key, char *value)
|
|
|
{
|
|
|
isSuccess = ConfigurationStatus_Rejected;
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(key, "OcppServer") == 0)
|
|
|
+ {
|
|
|
+ if(ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy(str, (const char*)value);
|
|
|
+ sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[OcppServer].ItemData, "%s", str );
|
|
|
+ sprintf((char *)ShmSysConfigAndInfo->SysConfig.OcppServerURL, "%s", str );
|
|
|
+
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(key, "MaintainServer") == 0)
|
|
|
+ {
|
|
|
+ if(ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy(str, (const char*)value);
|
|
|
+ sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MaintainServer].ItemData, "%s", str );
|
|
|
+ sprintf((char *)ShmSysConfigAndInfo->SysConfig.MaintainServerURL, "%s", str );
|
|
|
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#if 0
|