Browse Source

[Implement][Modularization][Module_OcppBackend20]

2021.01.05 / Folus Wen

Actions:
1. EVSE/Projects/define.h variable OcppRunningVer move to struct SysInfoData.
2. EVSE/Projects/define.h add struct NetworkConnectionProfile_20 to struct OCPP20Data.
3. Module_OcppBackend20 implement network profile configure logic.

Files:
1. As follow commit history

Image version: D0.00.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 4 years ago
parent
commit
9f454dacef

+ 264 - 42
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -1,6 +1,5 @@
 #include "Module_OcppBackend20.h"
 #include "define.h"
-//#define TEST_OCPP20
 
 static char *APNAuthenticationEnumTypeStr[] = {
 	MACROSTR(CHAP),
@@ -787,7 +786,7 @@ static int localversion=0;
 //===============================
 static int server_sign					= FALSE;
 int server_pending 						= FALSE;
-static int BootNotificationInterval 	= 0;
+static int BootNotificationInterval 	= 10;
 static int SystemInitial 				= 0;//= CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY;	// System Boot UP
 
 //===============================
@@ -933,7 +932,12 @@ int DB_Initial()
 							 "unique(componentName, componentInstance,variableName, variableInstance) on conflict replace);";
 
 	char *sqlBootType 	  =  "create table if not exists ocpp20_boot_type (idx integer primary key,"
-							 "type);";
+							 "type text);";
+
+
+	char *sqlNetworkProfile	= "create table if not exists ocpp20_networkprofile (idx integer primary key,"
+								 "slot integer UNIQUE, connectionData text);";
+
 
 	//sqlite3_config(SQLITE_CONFIG_URI, 1);
 	if(sqlite3_open(OCPP_LOCAL_DB_FILE, &db))
@@ -986,13 +990,23 @@ int DB_Initial()
 			DEBUG_INFO( "Create OCPP 2.0 boot_type table successfully\n");
 		}
 
+		if (sqlite3_exec(db, sqlNetworkProfile, 0, 0, &errMsg) != SQLITE_OK)
+		{
+			result = FAIL;
+			DEBUG_ERROR( "Create OCPP 2.0 ocpp20_networkprofile table error message: %s\n", errMsg);
+		}
+		else
+		{
+			DEBUG_INFO( "Create OCPP 2.0 ocpp20_networkprofile table successfully\n");
+		}
+
 		//sqlite3_close(db);
 	}
 
 	return result;
 }
 
-int versionCallback(void *para, int columnCount, char **columnValue, char **columnName)
+int DB_cbGetVersion(void *para, int columnCount, char **columnValue, char **columnName)
 {
    localversion = columnValue[12] ? atoi(columnValue[12]) : 0;
 
@@ -1007,13 +1021,13 @@ void DB_getListVerion()
     strcpy(sql, "select * from ocpp20_auth_local order by version desc, idx desc limit 1");
 
     /* Execute SQL statement */
-    if( sqlite3_exec(db, sql, versionCallback, 0, &errMsg) != SQLITE_OK )
+    if( sqlite3_exec(db, sql, DB_cbGetVersion, 0, &errMsg) != SQLITE_OK )
     {
     	DEBUG_INFO("SQL error: %s", errMsg);
     }
 }
 
-int IdTagCallback(void *para, int columnCount, char **columnValue, char **columnName)
+int DB_cbGetIdTag(void *para, int columnCount, char **columnValue, char **columnName)
 {
    sprintf((char*)idTagQuery.idToken.idToken,"%s", columnValue[1] ? columnValue[1] : "NULL");
    sprintf((char*)idTagQuery.idToken.type,"%s", columnValue[2] ? columnValue[2] : "NULL");
@@ -1042,13 +1056,13 @@ void DB_getIdTag(char idTag[], uint8_t isQueryFromCache)
     	sprintf(sql,"select * from ocpp20_auth_local where idToken='%s'", idTag);
 
     /* Execute SQL statement */
-    if(sqlite3_exec(db, sql, IdTagCallback, 0, &errMsg) != SQLITE_OK )
+    if(sqlite3_exec(db, sql, DB_cbGetIdTag, 0, &errMsg) != SQLITE_OK )
     {
     	DEBUG_INFO("SQL error: %s", errMsg);
     }
 }
 
-int sqlite3_exec_callback(void *para, int columnCount, char **columnValue, char **columnName)
+int DB_cbTableAuthlocalAllData(void *para, int columnCount, char **columnValue, char **columnName)
 {
     for (int i = 0; i < columnCount; i++)
     {
@@ -1066,13 +1080,13 @@ void DB_get_TableAuthlocalAllData(void)
     sprintf(sql,"select * from ocpp20_auth_local;");
 
     /* Execute SQL statement */
-    if(sqlite3_exec(db, sql, &sqlite3_exec_callback, 0,(char **)&errMsg) != SQLITE_OK)
+    if(sqlite3_exec(db, sql, DB_cbTableAuthlocalAllData, 0,&errMsg) != SQLITE_OK)
     {
     	DEBUG_INFO("SQL error: %s", errMsg);
     }
 }
 
-int listCallback(void *para, int columnCount, char **columnValue, char **columnName)
+int DB_cbAddLocalListCache(void *para, int columnCount, char **columnValue, char **columnName)
 {
    for(int i = 0; i<columnCount; i++)
    {
@@ -1101,7 +1115,7 @@ int DB_addLocalList(int listVersion, struct AuthorizationData *data)
 				 listVersion);
 
 	 //* Execute SQL statement */
-	 if(sqlite3_exec(db, sql, listCallback, 0, &errMsg) != SQLITE_OK)
+	 if(sqlite3_exec(db, sql, DB_cbAddLocalListCache, 0, &errMsg) != SQLITE_OK)
 	 {
 		 DEBUG_INFO("SQL error: %s\n", errMsg);
 		 result = FAIL;
@@ -1138,7 +1152,7 @@ int DB_addLocalCache(struct IdTokenType *idToken, struct IdTokenInfoType *idToke
 				 idTokenInfo->groupIdToken.type);
 
 	 //* Execute SQL statement */
-	 if(sqlite3_exec(db, sql, listCallback, 0, &errMsg) != SQLITE_OK)
+	 if(sqlite3_exec(db, sql, DB_cbAddLocalListCache, 0, &errMsg) != SQLITE_OK)
 	 {
 		 DEBUG_INFO("SQL error: %s\n", errMsg);
 		 result = FAIL;
@@ -1147,7 +1161,7 @@ int DB_addLocalCache(struct IdTokenType *idToken, struct IdTokenInfoType *idToke
 	 return result;
 }
 
-static int deleteIdTagcallback(void *para, int columnCount, char **columnValue, char **columnName)
+int deleteIdTagcallback(void *para, int columnCount, char **columnValue, char **columnName)
 {
 //   localversion = argv[5] ? atoi(columnValue[5]) : 0;
 //   printf("localversion=%d\n", localversion);
@@ -1219,6 +1233,16 @@ void DB_getBooType()
     }
 }
 
+int DB_cbUpdateBootType(void *para, int columnCount, char **columnValue, char **columnName)
+{
+   for(int i = 0; i<columnCount; i++)
+   {
+     // printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
+   }
+
+   return 0;
+}
+
 int DB_updateBootType(BootReasonEnumType reason)
 {
 	int result = PASS;
@@ -1228,7 +1252,7 @@ int DB_updateBootType(BootReasonEnumType reason)
 	 sprintf(sql,"insert or replace into ocpp20_boot_type (idx, type) VALUES(1, '%s');", BootReasonEnumTypeStr[reason>BootReasonEnumType_Watchdog?BootReasonEnumType_PowerUp:reason]);
 
 	 //* Execute SQL statement */
-	 if(sqlite3_exec(db, sql, listCallback, 0, &errMsg) != SQLITE_OK)
+	 if(sqlite3_exec(db, sql, DB_cbUpdateBootType, 0, &errMsg) != SQLITE_OK)
 	 {
 		 DEBUG_INFO("SQL error: %s\n", errMsg);
 		 result = FAIL;
@@ -1237,9 +1261,19 @@ int DB_updateBootType(BootReasonEnumType reason)
 	 return result;
 }
 
-uint8_t DB_variableSaveToDb(struct ReportDataType *variable)
+int DB_cbVariableSaveToDb(void *para, int columnCount, char **columnValue, char **columnName)
 {
-	uint8_t result = FAIL;
+   for(int i = 0; i<columnCount; i++)
+   {
+     // printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
+   }
+
+   return 0;
+}
+
+int DB_variableSaveToDb(struct ReportDataType *variable)
+{
+	int result = FAIL;
 
 	char sql[4096];
 	char* errMsg = NULL;
@@ -1257,7 +1291,7 @@ uint8_t DB_variableSaveToDb(struct ReportDataType *variable)
 				 variable->variableAttribute[0].value);
 
 	//* Execute SQL statement */
-	if(sqlite3_exec(db, sql, listCallback, 0, &errMsg) != SQLITE_OK)
+	if(sqlite3_exec(db, sql, DB_cbVariableSaveToDb, 0, &errMsg) != SQLITE_OK)
 	{
 		DEBUG_INFO("SQL error: %s\n", errMsg);
 		result = FAIL;
@@ -1266,7 +1300,7 @@ uint8_t DB_variableSaveToDb(struct ReportDataType *variable)
 	return result;
 }
 
-int cbVariableIsCreate(void *para, int columnCount, char **columnValue, char **columnName)
+int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char **columnName)
 {
 	memset(&ShmOCPP20Data->ControllerComponentVariable[0], 0x00, ARRAY_SIZE(ShmOCPP20Data->ControllerComponentVariable));
 
@@ -1876,7 +1910,7 @@ int cbVariableIsCreate(void *para, int columnCount, char **columnValue, char **c
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_NetworkConfigurationPriority].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_SequenceList]);
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_NetworkConfigurationPriority].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_NetworkConfigurationPriority].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_NetworkConfigurationPriority].variableAttribute[0].value, "LAN,WIFI,4G");
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_NetworkConfigurationPriority].variableAttribute[0].value, "[0]");
 		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_NetworkConfigurationPriority]);
 
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_NetworkProfileConnectionAttempts].component.name, "OCPPCommCtrlr");
@@ -2738,13 +2772,13 @@ void DB_variableIsCreate()
     sprintf(sql,"select count(idx) as quantity from ocpp20_variable;");
 
     /* Execute SQL statement */
-    if(sqlite3_exec(db, sql, cbVariableIsCreate, 0, &errMsg) != SQLITE_OK )
+    if(sqlite3_exec(db, sql, DB_cbVariableIsCreate, 0, &errMsg) != SQLITE_OK )
     {
     	DEBUG_INFO("SQL error: %s\n", errMsg);
     }
 }
 
-int cbVariableLoadFromDb(void *para, int columnCount, char **columnValue, char **columnName)
+int DB_cbVariableLoadFromDb(void *para, int columnCount, char **columnValue, char **columnName)
 {
 	for(int idx=0;idx<CtrlrVariable_CNT;idx++)
 	{
@@ -2773,12 +2807,155 @@ void DB_variableLoadFromDb()
 	sprintf(sql,"select * from ocpp20_variable;");
 
 	/* Execute SQL statement */
-	if(sqlite3_exec(db, sql, cbVariableLoadFromDb, 0, &errMsg) != SQLITE_OK )
+	if(sqlite3_exec(db, sql, DB_cbVariableLoadFromDb, 0, &errMsg) != SQLITE_OK )
+	{
+		DEBUG_INFO("SQL error: %s\n", errMsg);
+	}
+}
+
+int DB_cbGetNetworkProfileFromDb(void *para, int columnCount, char **columnValue, char **columnName)
+{
+	memset(&ShmOCPP20Data->NetworkConnectionProfile[0], 0x00, ARRAY_SIZE(ShmOCPP20Data->NetworkConnectionProfile));
+
+	if(columnCount > 0)
+	{
+		for(int idx=0;idx<columnCount;idx++)
+		{
+			json_object *SetNetworkProfile;
+
+			SetNetworkProfile = json_tokener_parse(columnValue[2]);
+			if(!is_error(SetNetworkProfile))
+			{
+				// Required data
+				if(json_object_object_get(SetNetworkProfile, "ocppVersion") != NULL)
+					sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.ocppVersion, "%s", json_object_get_string(json_object_object_get(SetNetworkProfile, "ocppVersion")));
+
+				if(json_object_object_get(SetNetworkProfile, "ocppTransport") != NULL)
+					sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.ocppTransport, "%s", json_object_get_string(json_object_object_get(SetNetworkProfile, "ocppTransport")));
+
+				if(json_object_object_get(SetNetworkProfile, "ocppCsmsUrl") != NULL)
+					sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.ocppCsmsUrl, "%s", json_object_get_string(json_object_object_get(SetNetworkProfile, "ocppCsmsUrl")));
+
+				if(json_object_object_get(SetNetworkProfile, "messageTimeout") != NULL)
+					ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.messageTimeout = json_object_get_int(json_object_object_get(SetNetworkProfile, "messageTimeout"));
+
+				if(json_object_object_get(SetNetworkProfile, "ocppInterface") != NULL)
+					sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.ocppInterface, "%s", json_object_get_string(json_object_object_get(SetNetworkProfile, "ocppInterface")));
+
+				if(json_object_object_get(SetNetworkProfile, "vpn") != NULL)
+				{
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "server") != NULL)
+						sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.vpn.server, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "server")));
+
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "user") != NULL)
+						sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.vpn.user, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "user")));
+
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "group") != NULL)
+						sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.vpn.group, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "group")));
+
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "password") != NULL)
+						sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.vpn.password, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "password")));
+
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "key") != NULL)
+						sprintf((char*)ShmOCPP20Data->SetNetworkProfile.connectionData.vpn.key, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "key")));
+
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "type") != NULL)
+						sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.vpn.type, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "vpn"), "type")));
+				}
+
+				if(json_object_object_get(SetNetworkProfile, "apn") != NULL)
+				{
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "apn") != NULL)
+					{
+						memset(ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.apn, 0x00, ARRAY_SIZE(ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.apn));
+						sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.apn, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "apn")));
+					}
+
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "apnUserName") != NULL)
+					{
+						memset(ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.apnUserName, 0x00, ARRAY_SIZE(ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.apnUserName));
+						sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.apnUserName, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "apnUserName")));
+					}
+
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "apnPassword") != NULL)
+					{
+						memset(ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.apnPassword, 0x00, ARRAY_SIZE(ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.apnPassword));
+						sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.apnPassword, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "apnPassword")));
+					}
+
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "simPin") != NULL)
+						ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.simPin = json_object_get_int(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "simPin"));
+
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "preferredNetwork") != NULL)
+						sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.preferredNetwork, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "preferredNetwork")));
+
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "useOnlyPreferredNetwork") != NULL)
+						ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.useOnlyPreferredNetwork = json_object_get_boolean(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "useOnlyPreferredNetwork"));
+
+					if(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "apnAuthentication") != NULL)
+						sprintf((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.apn.apnAuthentication, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "apn"), "apnAuthentication")));
+				}
+			}
+			json_object_put(SetNetworkProfile);
+
+			ShmOCPP20Data->NetworkConnectionProfile[idx].slot = atoi(columnValue[1]);
+		}
+	}
+
+	return 0;
+}
+
+void DB_getNetworkProfileFromDb()
+{
+	char sql[512];
+	char* errMsg = NULL;
+
+	sprintf(sql,"select * from ocpp20_networkprofile order by slot;");
+
+	/* Execute SQL statement */
+	if(sqlite3_exec(db, sql, DB_cbGetNetworkProfileFromDb, 0, &errMsg) != SQLITE_OK )
 	{
 		DEBUG_INFO("SQL error: %s\n", errMsg);
 	}
 }
 
+int DB_addNetworkProfile(int slot, char *data)
+{
+	 int result = PASS;
+	 char sql[512];
+	 char* errMsg = NULL;
+
+	 sprintf(sql,"insert or replace into ocpp20_networkprofile (slot, connectionData) VALUES('%d', '%s');  SELECT * from ocpp20_networkprofile order by slot;",
+			 	 slot,
+				 data);
+
+	 //* Execute SQL statement */
+	 if(sqlite3_exec(db, sql, DB_cbGetNetworkProfileFromDb, 0, &errMsg) != SQLITE_OK)
+	 {
+		 DEBUG_INFO("SQL error: %s\n", errMsg);
+		 result = FAIL;
+	 }
+
+	 return result;
+}
+
+int DB_deleteNetworkProfile(int slot)
+{
+	int result = PASS;
+	char sql[512];
+	char* errMsg = NULL;
+
+	sprintf(sql,"DELETE from ocpp20_networkprofile where slot=%d; SELECT * from ocpp20_networkprofile order by slot;", slot);
+
+	//* Execute SQL statement */
+	if( sqlite3_exec(db, sql, DB_cbGetNetworkProfileFromDb, 0, &errMsg) != SQLITE_OK )
+	{
+		DEBUG_INFO("SQL error: %s", errMsg);
+		result = FAIL;
+	}
+
+	return result;
+}
 
 //==========================================
 // Check time passed since today
@@ -4664,6 +4841,44 @@ int isOFFline(void)
 	}
 }
 
+void checkNetworkProfile(void)
+{
+	uint8_t isGetProfile = FALSE;
+
+	json_object *priority;
+	priority = json_tokener_parse((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_NetworkConfigurationPriority].variableAttribute[0].value);
+	if(!is_error(priority))
+	{
+		for(uint8_t idxPriority=0;idxPriority<json_object_array_length(priority);idxPriority++)
+		{
+			for(uint8_t idx=0;idx<ARRAY_SIZE(ShmOCPP20Data->NetworkConnectionProfile);idx++)
+			{
+				if((ShmOCPP20Data->NetworkConnectionProfile[idx].slot == json_object_get_int(json_object_array_get_idx(priority, idxPriority))) &&
+				   (strlen((char*)ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.ocppCsmsUrl) > 0) &&
+				   (ShmOCPP20Data->NetworkConnectionProfile[idx].retryCount < 3))
+				{
+					memcpy(ShmOCPP20Data->OcppServerURL, ShmSysConfigAndInfo->SysConfig.OcppServerURL, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppServerURL));
+					memcpy(ShmSysConfigAndInfo->SysConfig.OcppServerURL, ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.ocppCsmsUrl, ARRAY_SIZE(ShmOCPP20Data->NetworkConnectionProfile[idx].connectionData.ocppCsmsUrl));
+
+					isGetProfile = TRUE;
+					ShmOCPP20Data->NetworkConnectionProfile[idx].retryCount++;
+
+					break;
+				}
+			}
+		}
+	}
+	json_object_put(priority);
+
+
+	if(!isGetProfile && (strlen((char*)ShmOCPP20Data->OcppServerURL) > 0))
+	{
+		memcpy(ShmSysConfigAndInfo->SysConfig.OcppServerURL, ShmOCPP20Data->OcppServerURL, ARRAY_SIZE(ShmOCPP20Data->OcppServerURL));
+	}
+
+	DEBUG_INFO("Get network profile URL: %s\n", ShmSysConfigAndInfo->SysConfig.OcppServerURL);
+}
+
 void CheckSystemValue(void)
 {
 	char filenmae[100]={0};
@@ -4703,7 +4918,7 @@ void CheckSystemValue(void)
 	//===============================
 	// CSU Trigger Reset Conf
 	//===============================
-	if(isWebsocketSendable && (server_sign == TRUE) && (ShmOCPP20Data->MsMsg.bits.ResetConf == ON))
+	if(isWebsocketSendable && (ShmOCPP20Data->MsMsg.bits.ResetConf == ON))
 	{
 		sendResetConfirmation((char *)ShmOCPP20Data->Reset.guid);
 	}
@@ -7721,7 +7936,7 @@ int sendTransactionEventRequest(int gun_index)
 				else if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
 				{
 					if(strlen((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId) == 0)
-						random_uuid(ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
+						random_uuid((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
 
 					sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].StartUserId);
 
@@ -7826,7 +8041,7 @@ int sendTransactionEventRequest(int gun_index)
 				else if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
 				{
 					if(strlen((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId) == 0)
-						random_uuid(ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
+						random_uuid((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
 
 					sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].StartUserId);
 
@@ -7930,7 +8145,7 @@ int sendTransactionEventRequest(int gun_index)
 				else if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
 				{
 					if(strlen((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId) == 0)
-						random_uuid(ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
+						random_uuid((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
 
 					sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.GbChargingData[index].StartUserId);
 
@@ -8027,7 +8242,7 @@ int sendTransactionEventRequest(int gun_index)
 				else if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
 				{
 					if(strlen((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId) == 0)
-						random_uuid(ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
+						random_uuid((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
 
 					sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.StartUserId);
 
@@ -8130,7 +8345,7 @@ int sendTransactionEventRequest(int gun_index)
 				else if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
 				{
 					if(strlen((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId) == 0)
-						random_uuid(ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
+						random_uuid((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
 
 					sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.AcChargingData[index].StartUserId);
 
@@ -13457,8 +13672,12 @@ int handleSetNetworkProfileRequest(char *uuid, char *payload)
 				sprintf((char*)ShmOCPP20Data->SetNetworkProfile.connectionData.ocppTransport, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "connectionData"), "ocppTransport")));
 
 			if(json_object_object_get(json_object_object_get(SetNetworkProfile, "connectionData"), "ocppCsmsUrl") != NULL)
+			{
 				sprintf((char*)ShmOCPP20Data->SetNetworkProfile.connectionData.ocppCsmsUrl, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SetNetworkProfile, "connectionData"), "ocppCsmsUrl")));
 
+				memcpy((char*)ShmSysConfigAndInfo->SysConfig.OcppServerURL, (char*)ShmOCPP20Data->SetNetworkProfile.connectionData.ocppCsmsUrl, ARRAY_SIZE(ShmOCPP20Data->SetNetworkProfile.connectionData.ocppCsmsUrl));
+			}
+
 			if(json_object_object_get(json_object_object_get(SetNetworkProfile, "connectionData"), "messageTimeout") != NULL)
 				ShmOCPP20Data->SetNetworkProfile.connectionData.messageTimeout = json_object_get_int(json_object_object_get(json_object_object_get(SetNetworkProfile, "connectionData"), "messageTimeout"));
 
@@ -13521,6 +13740,8 @@ int handleSetNetworkProfileRequest(char *uuid, char *payload)
 				if(json_object_object_get(json_object_object_get(json_object_object_get(SetNetworkProfile, "connectionData"), "apn"), "apnAuthentication") != NULL)
 					sprintf((char*)ShmOCPP20Data->SetNetworkProfile.connectionData.apn.apnAuthentication, "%s", json_object_get_string(json_object_object_get(json_object_object_get(json_object_object_get(SetNetworkProfile, "connectionData"), "apn"), "apnAuthentication")));
 			}
+
+			DB_addNetworkProfile(ShmOCPP20Data->SetNetworkProfile.configurationSlot, (char*)json_object_get_string(json_object_object_get(SetNetworkProfile, "connectionData")));
 		}
 	}
 	json_object_put(SetNetworkProfile);
@@ -13820,20 +14041,24 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 				{
 					sprintf((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue, "%s", json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(SetVariables, "setVariableData"), idx), "attributeValue")));
 
+					strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_UnknownComponent]);
 					for(uint8_t idx_var=0;idx_var<CtrlrVariable_CNT;idx_var++)
 					{
-						if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, (char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].component.name) != NULL) &&
+						if((strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].component.name, (char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name) != NULL) &&
 						   (strlen((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.instance)>0?(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].component.instance, (char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.instance) != NULL):TRUE) &&
-						   (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, (char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variable.name) != NULL) &&
+						   (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variable.name, (char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name) != NULL) &&
 						   (strlen((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.instance)>0?(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variable.instance, (char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.instance) != NULL):TRUE))
 						{
-							strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Accepted]);
 							strcpy((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value, (char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue);
 							DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[idx_var]);
-						}
-						else
-						{
-							strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_UnknownComponent]);
+
+
+							if(((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "OCPPCommCtrlr") != NULL)) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "NetworkConfigurationPriority") != NULL))
+							{
+								strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_RebootRequired]);
+							}
+							else
+								strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Accepted]);
 						}
 					}
 				}
@@ -14883,6 +15108,7 @@ int initialConfigurationTable(void)
 	memset(&ShmOCPP20Data->ControllerComponentVariable[0], 0, ARRAY_SIZE(ShmOCPP20Data->ControllerComponentVariable));
 	DB_variableIsCreate();
 	DB_variableLoadFromDb();
+	DB_getNetworkProfileFromDb();
 
 	return 0;
 }
@@ -15135,9 +15361,7 @@ int GetOcppServerURL()
 	if((ShmSysConfigAndInfo->SysConfig.OcppServerURL != NULL) && (strcmp((const char *)ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") != 0) )
 	{
 		memcpy(urlStr, ShmSysConfigAndInfo->SysConfig.OcppServerURL, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppServerURL));
-#ifdef TEST_OCPP20
-		sprintf(urlStr, "ws://172.17.20.19:8080/"); // For test
-#endif
+
 		if(yuarel_parse(&url, urlStr) != -1)
 		{
 			sprintf(OcppProtocol, "%s", url.scheme);
@@ -15235,9 +15459,7 @@ int GetOcppPath()
 	{
 		strcpy(OcppPath,"");
 	}
-#ifdef TEST_OCPP20
-	sprintf(OcppPath,"/AWLU770001D1P0D19520001A0"); // For test
-#endif
+
 	return result;
 }
 
@@ -15539,7 +15761,7 @@ void InitialSystemValue(void)
 	gunTotalNumber=0;
 	SystemInitial = 0;
 	localversion=0;
-	BootNotificationInterval = 0;
+	BootNotificationInterval = 10;
 	authorizeRetryTimes = 0;
 	GunStatusInterval = 10;
 	TransactionMessageAttemptsValue = atoi((char *)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_MessageAttempts].variableAttribute[0].value);

+ 3 - 3
EVSE/Modularization/ocpp20/Module_OcppBackend20.c

@@ -27,7 +27,6 @@ static int TransactionQueueNum = 0;
 static int OfflineTransactionQueueNum = 0;  // Number of offline transactions
 static int OfflineTransaction = 0;
 static int IsUsing = FALSE;
-int defaultWaitingTime = 10; //10 second
 
 char OcppPath[160]={0};
 char OcppProtocol[10]={0},OcppHost[50]={0}, OcppTempPath[50]={0};
@@ -350,7 +349,6 @@ static struct lws_protocols protocols[] =
 	}
 };
 
-
 void* ConnectWsServer(void* data)  //int ConnectWsServer()
 {
 
@@ -374,6 +372,8 @@ void* ConnectWsServer(void* data)  //int ConnectWsServer()
 		context = NULL;
 	}
 
+	checkNetworkProfile();
+
 	memset(&ContextInfo, 0, sizeof(struct lws_context_creation_info));
 	if((GetOcppServerURL()==0) || (GetOcppPort() == 0) || (GetOcppPath()==0))
 	{
@@ -1154,7 +1154,7 @@ int main(void)
 		{
 			// Sign in
 			if((GetServerSign() == FALSE) &&
-			   ( ((GetBootNotificationInterval() != 0)  && ((time((time_t*)NULL)-startTime.bootNotification)>= GetBootNotificationInterval())) || ((time((time_t*)NULL)-startTime.bootNotification) >= defaultWaitingTime) ) )
+			   ((GetBootNotificationInterval() >= 0) && ((time((time_t*)NULL)-startTime.bootNotification)>= GetBootNotificationInterval())))
 			{
 				sendBootNotificationRequest();
 				startTime.bootNotification=time((time_t*)NULL);

+ 1 - 0
EVSE/Modularization/ocpp20/Module_OcppBackend20.h

@@ -106,6 +106,7 @@ extern int yuarel_parse_query(char *query, char delimiter, struct yuarel_param *
 
 
 extern void CheckSystemValue(void);
+extern void checkNetworkProfile(void);
 extern int FirstHeartBeatResponse(void);
 extern void OCPP_get_TableAuthlocalAllData(void);
 extern int TransactionMessageAttemptsGet(void);

+ 1 - 1
EVSE/Modularization/ocpp20/SystemLogMessage.c

@@ -51,7 +51,7 @@ int StoreOcppMsg(const char *fmt, ...)
 	tm=localtime(&CurrentTime);
 	gettimeofday(&tv, NULL); // get microseconds, 10^-6
 
-	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >>  /Storage/OCPP/[%04d.%02d]Ocpp20MessageLog",
+	sprintf(Buf,"echo -n \'[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\' >>  /Storage/OCPP/[%04d.%02d]Ocpp20MessageLog",
 			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
 			buffer,
 			tm->tm_year+1900,tm->tm_mon+1);

+ 2 - 2
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -16412,11 +16412,11 @@ void SetOcppVersion(uint8_t *version)
 	DEBUG_INFO("ocpp version: %s\n", version);
 	if(strstr((char*)version, "ocpp1.6") != NULL)
 	{
-		ShmSysConfigAndInfo->SysConfig.OcppRunningVer = OCPP_RUNNING_VERSION_16;
+		ShmSysConfigAndInfo->SysInfo.OcppRunningVer = OCPP_RUNNING_VERSION_16;
 	}
 	else if(strstr((char*)version, "ocpp2.0") != NULL)
 	{
-		ShmSysConfigAndInfo->SysConfig.OcppRunningVer = OCPP_RUNNING_VERSION_20;
+		ShmSysConfigAndInfo->SysInfo.OcppRunningVer = OCPP_RUNNING_VERSION_20;
 		system("pkill OcppBackend");
 	}
 }

+ 91 - 91
EVSE/Projects/AW-CCS/Apps/main.c

@@ -261,9 +261,9 @@ unsigned int isKernelSupportNAT()
 //======================================================
 void ocpp_process_start()
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 		system("/root/OcppBackend &");
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 		system("/root/OcppBackend20 &");
 }
 
@@ -271,11 +271,11 @@ uint8_t ocpp_get_connection_status()
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmOCPP16Data->OcppConnStatus;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmOCPP20Data->OcppConnStatus;
 	}
@@ -287,14 +287,14 @@ uint16_t ocpp_get_connection_timeout()
 {
 	uint16_t result = (TIMEOUT_SPEC_HANDSHAKING/1000);
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(strcmp((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData,"") != 0)
 		{
 			result = atoi((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData);
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(strcmp((char *)ShmOCPP20Data->ControllerComponentVariable[TxCtrlr_EVConnectionTimeOut].variableAttribute[0].value,"") != 0)
 		{
@@ -309,11 +309,11 @@ uint8_t ocpp_get_update_firmware_req()
 {
 	uint8_t result = NO;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmOCPP16Data->MsMsg.bits.UpdateFirmwareReq;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmOCPP20Data->MsMsg.bits.UpdateFirmwareReq;
 	}
@@ -325,11 +325,11 @@ uint8_t ocpp_get_reset_req()
 {
 	uint8_t result = NO;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmOCPP16Data->MsMsg.bits.ResetReq;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmOCPP20Data->MsMsg.bits.ResetReq;
 	}
@@ -339,7 +339,7 @@ uint8_t ocpp_get_reset_req()
 
 void ocpp_boot_info_sync()
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		memcpy((char*)ShmOCPP16Data->OcppServerURL, (char*)ShmSysConfigAndInfo->SysConfig.OcppServerURL, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppServerURL));
 		memcpy((char*)ShmOCPP16Data->ChargeBoxId, (char*)ShmSysConfigAndInfo->SysConfig.ChargeBoxId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ChargeBoxId));
@@ -351,7 +351,7 @@ void ocpp_boot_info_sync()
 		DEBUG_INFO("CpMeterSerialNumber: %s\n",ShmOCPP16Data->BootNotification.CpMeterSerialNumber);
 		DEBUG_INFO("CpMeterType: %s\n",ShmOCPP16Data->BootNotification.CpMeterType);
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		memcpy((char*)ShmOCPP20Data->OcppServerURL, (char*)ShmSysConfigAndInfo->SysConfig.OcppServerURL, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppServerURL));
 		memcpy((char*)ShmOCPP20Data->ChargeBoxId, (char*)ShmSysConfigAndInfo->SysConfig.ChargeBoxId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ChargeBoxId));
@@ -361,12 +361,12 @@ void ocpp_boot_info_sync()
 
 void ocpp_set_remotestart(uint8_t gun_index, uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq != status)
 			ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq = status;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CsMsg.bits[gun_index].RequestStartTransactionReq != status)
 			ShmOCPP20Data->CsMsg.bits[gun_index].RequestStartTransactionReq = status;
@@ -375,12 +375,12 @@ void ocpp_set_remotestart(uint8_t gun_index, uint8_t status)
 
 void ocpp_set_remotestop(uint8_t gun_index, uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq != status)
 			ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq = status;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CsMsg.bits[gun_index].RequestStopTransactionReq != status)
 			ShmOCPP20Data->CsMsg.bits[gun_index].RequestStopTransactionReq = status;
@@ -391,11 +391,11 @@ uint8_t ocpp_get_remotestart(uint8_t gun_index)
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmOCPP20Data->CsMsg.bits[gun_index].RequestStartTransactionReq;
 	}
@@ -405,11 +405,11 @@ uint8_t ocpp_get_remotestart(uint8_t gun_index)
 
 void ocpp_copy_userid_from_remotestart(uint8_t gun_index)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, ARRAY_SIZE(ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag));
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP20Data->RequestStartTransaction[gun_index].idToken.idToken, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
 	}
@@ -419,11 +419,11 @@ uint8_t ocpp_get_remotestop(uint8_t gun_index)
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmOCPP20Data->CsMsg.bits[gun_index].RequestStopTransactionReq;
 	}
@@ -433,7 +433,7 @@ uint8_t ocpp_get_remotestop(uint8_t gun_index)
 
 void ocpp_set_auth_req(uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->SpMsg.bits.AuthorizeReq != status)
 		{
@@ -443,7 +443,7 @@ void ocpp_set_auth_req(uint8_t status)
 			ShmOCPP16Data->SpMsg.bits.AuthorizeReq = status;
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->SpMsg.bits.AuthorizeReq != status)
 		{
@@ -459,11 +459,11 @@ uint8_t ocpp_get_auth_req()
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmOCPP16Data->SpMsg.bits.AuthorizeReq;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmOCPP20Data->SpMsg.bits.AuthorizeReq;
 	}
@@ -473,12 +473,12 @@ uint8_t ocpp_get_auth_req()
 
 void ocpp_set_auth_conf(uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf != status)
 			ShmOCPP16Data->SpMsg.bits.AuthorizeConf = status;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->SpMsg.bits.AuthorizeConf != status)
 			ShmOCPP20Data->SpMsg.bits.AuthorizeConf = status;
@@ -489,11 +489,11 @@ uint8_t ocpp_get_auth_conf()
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmOCPP16Data->SpMsg.bits.AuthorizeConf;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmOCPP20Data->SpMsg.bits.AuthorizeConf;
 	}
@@ -505,12 +505,12 @@ uint8_t ocpp_get_auth_result()
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0))
 			result = PASS;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0))
 			result = PASS;
@@ -523,11 +523,11 @@ uint8_t ocpp_get_unlocker_req(uint8_t gun_index)
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor;
 	}
@@ -537,12 +537,12 @@ uint8_t ocpp_get_unlocker_req(uint8_t gun_index)
 
 void ocpp_set_unlocker_req(uint8_t gun_index, uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor != status)
 			ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor = status;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor != status)
 			ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor = status;
@@ -551,12 +551,12 @@ void ocpp_set_unlocker_req(uint8_t gun_index, uint8_t status)
 
 void ocpp_set_starttransaction_req(uint8_t gun_index, uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionReq != status)
 			ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionReq = status;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq != status)
 			ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = status;
@@ -565,12 +565,12 @@ void ocpp_set_starttransaction_req(uint8_t gun_index, uint8_t status)
 
 void ocpp_set_starttransaction_conf(uint8_t gun_index, uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionConf != status)
 			ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionConf = status;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventConf != status)
 			ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventConf = status;
@@ -579,12 +579,12 @@ void ocpp_set_starttransaction_conf(uint8_t gun_index, uint8_t status)
 
 void ocpp_set_stoptransaction_req(uint8_t gun_index, uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq != status)
 			ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq = status;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq != status)
 			ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = status;
@@ -593,14 +593,14 @@ void ocpp_set_stoptransaction_req(uint8_t gun_index, uint8_t status)
 
 void ocpp_set_stoptransaction_conf(uint8_t gun_index, uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionConf != status)
 		{
 			ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionConf = status;
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventConf != status)
 		{
@@ -611,11 +611,11 @@ void ocpp_set_stoptransaction_conf(uint8_t gun_index, uint8_t status)
 
 void ocpp_copy_userid_to_starttransaction(uint8_t gun_index)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		memcpy((char*)ShmOCPP16Data->StartTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StartTransaction[gun_index].IdTag));
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		memcpy((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId));
 	}
@@ -625,11 +625,11 @@ uint8_t ocpp_get_smartcharging_profileId(uint8_t gun_index)
 {
 	uint8_t result = 0;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfileId;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmOCPP20Data->SmartChargingProfile[gun_index].id;
 	}
@@ -639,11 +639,11 @@ uint8_t ocpp_get_smartcharging_profileId(uint8_t gun_index)
 
 void ocpp_reset_smartcharging_profileId(uint8_t gun_index)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfileId = 0;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		ShmOCPP20Data->SmartChargingProfile[gun_index].id = 0;
 	}
@@ -653,11 +653,11 @@ uint8_t ocpp_get_profile_req(uint8_t gun_index)
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq;
 	}
@@ -667,12 +667,12 @@ uint8_t ocpp_get_profile_req(uint8_t gun_index)
 
 void ocpp_set_profile_req(uint8_t gun_index, uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq != status)
 			ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq = status;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq != status)
 			ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq = status;
@@ -683,11 +683,11 @@ uint8_t ocpp_get_profile_conf(uint8_t gun_index)
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileConf;
 	}
@@ -697,12 +697,12 @@ uint8_t ocpp_get_profile_conf(uint8_t gun_index)
 
 void ocpp_set_profile_conf(uint8_t gun_index, uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf != status)
 			ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf = status;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileConf != status)
 			ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileConf = status;
@@ -713,12 +713,12 @@ uint8_t ocpp_get_StopTransactionOnEVSideDisconnect()
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(strcmp((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnEVSideDisconnect].ItemData, "TRUE") == 0)
 			result = ON;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(strcmp((char *)ShmOCPP20Data->ControllerComponentVariable[TxCtrlr_StopTxOnEVSideDisconnect].variableAttribute[0].value, "TRUE") == 0)
 			result = ON;
@@ -731,11 +731,11 @@ uint8_t ocpp_get_cancelreservation_req(uint8_t gun_index)
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		result = ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationReq;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		result = ShmOCPP20Data->CsMsg.bits[gun_index].CancelReservationReq;
 	}
@@ -745,7 +745,7 @@ uint8_t ocpp_get_cancelreservation_req(uint8_t gun_index)
 
 void ocpp_set_cancelreservation_req(uint8_t gun_index, uint8_t status)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationReq != status)
 			ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationReq = status;
@@ -753,7 +753,7 @@ void ocpp_set_cancelreservation_req(uint8_t gun_index, uint8_t status)
 		if(ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationReq == OFF)
 			ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationConf = ON;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CsMsg.bits[gun_index].CancelReservationReq != status)
 			ShmOCPP20Data->CsMsg.bits[gun_index].CancelReservationReq = status;
@@ -767,12 +767,12 @@ uint8_t ocpp_compare_reserve_id_with_user(uint8_t gun_index)
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(strcmp((char*)ShmSysConfigAndInfo->SysConfig.UserId, (char*)ShmOCPP16Data->ReserveNow[gun_index].IdTag) == 0)
 			result = ON;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(strcmp((char*)ShmSysConfigAndInfo->SysConfig.UserId, (char*)ShmOCPP20Data->ReserveNow[gun_index].idToken.idToken) == 0)
 			result = ON;
@@ -785,7 +785,7 @@ uint8_t ocpp_compare_reserve_id_with_remote_user(uint8_t gun_index)
 {
 	uint8_t result = OFF;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(strcmp((char*)ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, (char*)ShmOCPP16Data->ReserveNow[gun_index].IdTag) == 0)
 		{
@@ -793,7 +793,7 @@ uint8_t ocpp_compare_reserve_id_with_remote_user(uint8_t gun_index)
 			memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, ARRAY_SIZE(ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag));
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(strcmp((char*)ShmOCPP20Data->RequestStartTransaction[gun_index].idToken.idToken, (char*)ShmOCPP20Data->ReserveNow[gun_index].idToken.idToken) == 0)
 		{
@@ -2588,7 +2588,7 @@ int isReservationExpired(unsigned char gun_index)
 	struct tm expiredDate;
 	struct timeb expiredTime;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(sscanf((char*)ShmOCPP16Data->ReserveNow[gun_index].ExpiryDate, "%4d-%2d-%2dT%2d:%2d:%2d", &expiredDate.tm_year, &expiredDate.tm_mon, &expiredDate.tm_mday, &expiredDate.tm_hour, &expiredDate.tm_min, &expiredDate.tm_sec) == 6)
 		{
@@ -2608,7 +2608,7 @@ int isReservationExpired(unsigned char gun_index)
 			result = YES;
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(sscanf((char*)ShmOCPP20Data->ReserveNow[gun_index].expiryDateTime, "%4d-%2d-%2dT%2d:%2d:%2d", &expiredDate.tm_year, &expiredDate.tm_mon, &expiredDate.tm_mday, &expiredDate.tm_hour, &expiredDate.tm_min, &expiredDate.tm_sec) == 6)
 		{
@@ -2641,7 +2641,7 @@ int isProfileValid(uint8_t gun_index)
 	struct tm tmFrom, tmTo;
 	struct timeb tbFrom, tbTo;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if((sscanf((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ValidFrom, "%4d-%2d-%2dT%2d:%2d:%2d", &tmFrom.tm_year, &tmFrom.tm_mon, &tmFrom.tm_mday, &tmFrom.tm_hour, &tmFrom.tm_min, &tmFrom.tm_sec) == 6) &&
 		   (sscanf((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ValidTo, "%4d-%2d-%2dT%2d:%2d:%2d", &tmTo.tm_year, &tmTo.tm_mon, &tmTo.tm_mday, &tmTo.tm_hour, &tmTo.tm_min, &tmTo.tm_sec) == 6))
@@ -2666,7 +2666,7 @@ int isProfileValid(uint8_t gun_index)
 			DEBUG_WARN("ValidFrom or ValidTo date parsing error.\n");
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if((sscanf((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].validFrom, "%4d-%2d-%2dT%2d:%2d:%2d", &tmFrom.tm_year, &tmFrom.tm_mon, &tmFrom.tm_mday, &tmFrom.tm_hour, &tmFrom.tm_min, &tmFrom.tm_sec) == 6) &&
 		   (sscanf((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].validTo, "%4d-%2d-%2dT%2d:%2d:%2d", &tmTo.tm_year, &tmTo.tm_mon, &tmTo.tm_mday, &tmTo.tm_hour, &tmTo.tm_min, &tmTo.tm_sec) == 6))
@@ -2701,7 +2701,7 @@ int getScheduleStart(int gun_index)
 	struct tm tmScheduleStart;;
 	struct timeb tbScheduleStart;
 
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if((sscanf((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.StartSchedule, "%4d-%2d-%2dT%2d:%2d:%2d", &tmScheduleStart.tm_year, &tmScheduleStart.tm_mon, &tmScheduleStart.tm_mday, &tmScheduleStart.tm_hour, &tmScheduleStart.tm_min, &tmScheduleStart.tm_sec) == 6))
 		{
@@ -2718,7 +2718,7 @@ int getScheduleStart(int gun_index)
 			DEBUG_WARN("Schedule start date parsing error.\n");
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if((sscanf((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].chargingSchedule[0].startSchedule, "%4d-%2d-%2dT%2d:%2d:%2d", &tmScheduleStart.tm_year, &tmScheduleStart.tm_mon, &tmScheduleStart.tm_mday, &tmScheduleStart.tm_hour, &tmScheduleStart.tm_min, &tmScheduleStart.tm_sec) == 6))
 		{
@@ -2867,7 +2867,7 @@ void checkTask()
 
 	if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") != 0)
 	{
-		if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+		if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 		{
 			if(system("pidof -s OcppBackend > /dev/null") != 0)
 			{
@@ -2875,7 +2875,7 @@ void checkTask()
 				ocpp_process_start();
 			}
 		}
-		else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+		else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 		{
 			if(system("pidof -s OcppBackend20 > /dev/null") != 0)
 			{
@@ -2942,7 +2942,7 @@ void checkConnectionTimeout()
 
 void checkReset()
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->MsMsg.bits.ResetReq)
 		{
@@ -2970,7 +2970,7 @@ void checkReset()
 			}
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->MsMsg.bits.ResetReq)
 		{
@@ -2981,7 +2981,7 @@ void checkReset()
 				sprintf((char*)ShmOCPP16Data->Reset.ResponseStatus, "Accepted");
 				ShmOCPP20Data->MsMsg.bits.ResetConf = ON;
 
-				if(strcmp((char*)ShmOCPP20Data->Reset.type, "Hard") == 0)
+				if(strcmp((char*)ShmOCPP20Data->Reset.type, "Immediate") == 0)
 				{
 					system("sync");
 					sleep(5);
@@ -3002,7 +3002,7 @@ void checkReset()
 
 void checkReservation(uint8_t gun_index)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CsMsg.bits[gun_index].ReserveNowReq)
 		{
@@ -3016,7 +3016,7 @@ void checkReservation(uint8_t gun_index)
 			ShmOCPP16Data->CsMsg.bits[gun_index].ReserveNowConf = ON;
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CsMsg.bits[gun_index].ReserveNowReq)
 		{
@@ -3034,7 +3034,7 @@ void checkReservation(uint8_t gun_index)
 
 void checkUnlocker(uint8_t gun_index)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CsMsg.bits[gun_index].UnlockConnectorReq == ON)
 		{
@@ -3046,7 +3046,7 @@ void checkUnlocker(uint8_t gun_index)
 			ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor = ON;
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CsMsg.bits[gun_index].UnlockConnectorReq == ON)
 		{
@@ -3062,7 +3062,7 @@ void checkUnlocker(uint8_t gun_index)
 
 void checkAvailability(uint8_t gun_index)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->CsMsg.bits[gun_index].ChangeAvailabilityReq)
 		{
@@ -3080,7 +3080,7 @@ void checkAvailability(uint8_t gun_index)
 			ShmOCPP16Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = OFF;
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->CsMsg.bits[gun_index].ChangeAvailabilityReq)
 		{
@@ -3102,7 +3102,7 @@ void checkAvailability(uint8_t gun_index)
 
 void checkChargingProfileLimit(uint8_t gun_index)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if((ocpp_get_smartcharging_profileId(gun_index) > 0) &&
 		   (ocpp_get_profile_req(gun_index) != ON)	&&
@@ -3151,7 +3151,7 @@ void checkChargingProfileLimit(uint8_t gun_index)
 			ShmCharger->gun_info[gun_index].targetCurrent = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
 		}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if((ocpp_get_smartcharging_profileId(gun_index) > 0) &&
 		   (ocpp_get_profile_req(gun_index) != ON)	&&
@@ -3204,7 +3204,7 @@ void checkChargingProfileLimit(uint8_t gun_index)
 
 void checkStopReason(uint8_t gun_index)
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->MsMsg.bits.ResetReq)
 		{
@@ -3239,7 +3239,7 @@ void checkStopReason(uint8_t gun_index)
 		ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption = (ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/100);
 		ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq = ON;
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(ShmOCPP20Data->MsMsg.bits.ResetReq)
 		{
@@ -3278,7 +3278,7 @@ void checkStopReason(uint8_t gun_index)
 
 void checkRemoteUpgradeStatus()
 {
-	if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(strcmp((char*)ShmOCPP16Data->FirmwareStatusNotification.Status, "DownloadFailed")==0)
 		{
@@ -3315,7 +3315,7 @@ void checkRemoteUpgradeStatus()
 		else
 		{}
 	}
-	else if(ShmSysConfigAndInfo->SysConfig.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		if(strcmp((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "DownloadFailed")==0)
 		{

+ 9 - 1
EVSE/Projects/define.h

@@ -435,7 +435,6 @@ struct SysConfigData
 	unsigned int 			Checksum;					//4 bytes checksum
 	struct LED				LedInfo;					// LED configuration info
 	unsigned char			ShowInformation;
-	unsigned char           OcppRunningVer;             // 0: 1.6J      1:2.0
 };
 
 struct ChargingInfoData
@@ -709,6 +708,7 @@ typedef union
 struct SysInfoData
 {
 	/**************System***************/
+	unsigned char OcppRunningVer;			// 0: 1.6J      1:2.0
 	unsigned char BootingStatus;			// 0 : booting, 1 : Initializing Complete.
 	unsigned char AuthorizeFlag;			// 0 : None, 1 : Authorizing
 	unsigned char FactoryConfiguration;	//0: normal, 1: trigger, charger will return the configuration to factory default if trigger
@@ -5355,6 +5355,13 @@ struct UpdateFirmware_20
 	unsigned char guid[37];											// Save guid from server request
 };
 
+struct NetworkConnectionProfile_20
+{
+	unsigned int slot;
+	unsigned char retryCount;
+	struct NetworkConnectionProfileType connectionData;
+};
+
 struct OCPP20Data
 {
 	unsigned char 							OcppServerURL[512];		//http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
@@ -5363,6 +5370,7 @@ struct OCPP20Data
 	unsigned int 							Timeout_Secs;
 	unsigned short 							Ping_Pong_Interval;
 	struct ReportDataType                   ControllerComponentVariable[CtrlrVariable_CNT];
+	struct NetworkConnectionProfile_20		NetworkConnectionProfile[10];
 
 	union
 	{