|
@@ -26,7 +26,7 @@ struct PsuData *ShmPsuData ;
|
|
|
struct OCPP16Data *ShmOCPP16Data;
|
|
|
|
|
|
//ConfigurationMaxKeys
|
|
|
-#define GetConfigurationMaxKeysNUM 44
|
|
|
+#define GetConfigurationMaxKeysNUM _GetConfiguration_CNT
|
|
|
|
|
|
pthread_mutex_t lock_send = PTHREAD_MUTEX_INITIALIZER;
|
|
|
char queuedata[QUEUE_MESSAGE_LENGTH] = {0};
|
|
@@ -6526,23 +6526,21 @@ int handleChangeConfigurationRequest(char *uuid, char *payload)
|
|
|
sprintf(comfirmstr, "%s", ConfigurationStatusStr[ConfigurationStatus_Accepted]);
|
|
|
ShmOCPP16Data->MsMsg.bits.ChangeConfigurationReq = 1;
|
|
|
StoreConfigurationTable();
|
|
|
- break;
|
|
|
-
|
|
|
- case ConfigurationStatus_Rejected:
|
|
|
- sprintf(comfirmstr, "%s", ConfigurationStatusStr[ConfigurationStatus_Rejected] );
|
|
|
- break;
|
|
|
+ break;
|
|
|
|
|
|
case RebootRequired:
|
|
|
sprintf(comfirmstr, "%s", ConfigurationStatusStr[RebootRequired]);
|
|
|
StoreConfigurationTable();
|
|
|
- break;
|
|
|
+ break;
|
|
|
|
|
|
case NotSupported:
|
|
|
sprintf(comfirmstr, "%s", ConfigurationStatusStr[NotSupported] );
|
|
|
break;
|
|
|
|
|
|
+ case ConfigurationStatus_Rejected:
|
|
|
default:
|
|
|
- break;
|
|
|
+ sprintf(comfirmstr, "%s", ConfigurationStatusStr[ConfigurationStatus_Rejected] );
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -6553,6 +6551,11 @@ int handleChangeConfigurationRequest(char *uuid, char *payload)
|
|
|
ChageWebSocketPingInterval(atoi(valuestr));
|
|
|
}
|
|
|
|
|
|
+ if((strcmp(keystr,"SecurityProfile")==0)&&(strcmp(comfirmstr,"Accepted")==0))
|
|
|
+ {
|
|
|
+ ShmSysConfigAndInfo->SysInfo.InternetConn = 0;
|
|
|
+ }
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -11640,6 +11643,19 @@ int initialConfigurationTable(void)
|
|
|
|
|
|
fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","QueueOffLineStartTransactionMessage", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData);
|
|
|
|
|
|
+ // AuthorizationKey
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemName, "AuthorizationKey");
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, "" );
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AuthorizationKey", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData);
|
|
|
+
|
|
|
+ // SecurityProfile
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemName, "SecurityProfile");
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData, "0" );
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","SecurityProfile", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData);
|
|
|
|
|
|
//* Local Auth List Management Profile*/
|
|
|
#if 0
|
|
@@ -11998,6 +12014,18 @@ int initialConfigurationTable(void)
|
|
|
sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData, "%s", valuestr);
|
|
|
}
|
|
|
|
|
|
+ if(strcmp(keystr, "AuthorizationKey") == 0)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
|
+ sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, "%s", valuestr);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(keystr, "SecurityProfile") == 0)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
|
+ sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData, "%d", atoi(valuestr) );
|
|
|
+ }
|
|
|
+
|
|
|
if(strcmp(keystr, "LocalAuthListEnabled") == 0)
|
|
|
{
|
|
|
ShmOCPP16Data->ConfigurationTable.LocalAuthListManagementProfile[LocalAuthListEnabled].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
@@ -12399,6 +12427,23 @@ void StoreConfigurationTable(void)
|
|
|
|
|
|
fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","QueueOffLineStartTransactionMessage", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData);
|
|
|
|
|
|
+ // AuthorizationKey
|
|
|
+ /*
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemName, "AuthorizationKey");
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, "0" );
|
|
|
+ */
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AuthorizationKey", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData);
|
|
|
+
|
|
|
+ // SecurityProfile
|
|
|
+ /*
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemName, "SecurityProfile");
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData, "30" );
|
|
|
+ */
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","SecurityProfile", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData);
|
|
|
|
|
|
//* Local Auth List Management Profile*/
|
|
|
//LocalAuthListEnabled
|
|
@@ -13134,7 +13179,42 @@ void getKeyValue(char *keyReq)
|
|
|
isKnowKey = TRUE;
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ if(isEmpty || strcmp(keyReq, "AuthorizationKey") == 0 )
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_AuthorizationKey].Item, "AuthorizationKey");
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_AuthorizationKey].Key, "AuthorizationKey");
|
|
|
+
|
|
|
+ if(ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_AuthorizationKey].ReadOnly, "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_AuthorizationKey].ReadOnly, "1");
|
|
|
+ }
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_AuthorizationKey].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData );
|
|
|
+ isKnowKey = TRUE;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ if(isEmpty || strcmp(keyReq, "SecurityProfile") == 0 )
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_SecurityProfile].Item, "SecurityProfile");
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_SecurityProfile].Key, "SecurityProfile");
|
|
|
|
|
|
+ if(ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_SecurityProfile].ReadOnly, "0"/*"FALSE"*/);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_SecurityProfile].ReadOnly, "1"/*"TRUE"*/);
|
|
|
+ }
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_SecurityProfile].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData );
|
|
|
+ isKnowKey = TRUE;
|
|
|
+ }
|
|
|
#if 1
|
|
|
if(isEmpty || strcmp(keyReq, "LocalAuthListEnabled") == 0 )
|
|
|
{
|
|
@@ -14092,7 +14172,6 @@ int setKeyValue(char *key, char *value)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-
|
|
|
sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[WebSocketPingInterval].ItemData, "%d", atoi(value) );
|
|
|
isSuccess = ConfigurationStatus_Accepted;
|
|
|
}
|
|
@@ -14123,6 +14202,50 @@ int setKeyValue(char *key, char *value)
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if(strcmp(key, "AuthorizationKey") == 0)
|
|
|
+ {
|
|
|
+ if((ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemAccessibility == 1) && (strlen(value) <= 40))
|
|
|
+ {
|
|
|
+ strcpy(str, (const char*)value);
|
|
|
+ sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, "%s", str);
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(key, "SecurityProfile") == 0)
|
|
|
+ {
|
|
|
+ if(ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ check_ascii = value[0];
|
|
|
+ if( (check_ascii < 0x30) || (check_ascii > 0x33) )
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ else if(check_ascii == 0x33)
|
|
|
+ {
|
|
|
+ isSuccess = NotSupported;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(atoi((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData) <= (check_ascii - 0x30))
|
|
|
+ {
|
|
|
+ sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData, "%d", atoi(value) );
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
#if 0
|
|
|
//For OCPP Test Case
|
|
|
if(strcmp(key, "LocalAuthorizationListEnabled") == 0)
|
|
@@ -16061,6 +16184,21 @@ int GetServerSign(void)
|
|
|
return server_sign;
|
|
|
}
|
|
|
|
|
|
+uint8_t GetOcppSecurityProfile()
|
|
|
+{
|
|
|
+ return atoi((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData);
|
|
|
+}
|
|
|
+
|
|
|
+void GetOcppChargerBoxId(uint8_t *data)
|
|
|
+{
|
|
|
+ sprintf((char*)data, "%s", ShmOCPP16Data->ChargeBoxId);
|
|
|
+}
|
|
|
+
|
|
|
+void GetOcppSecurityPassword(uint8_t *data)
|
|
|
+{
|
|
|
+ sprintf((char*)data, "%s", ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData);
|
|
|
+}
|
|
|
+
|
|
|
void SetServerSign(int value)
|
|
|
{
|
|
|
server_sign = value;
|