Przeglądaj źródła

[Add][AW/AX][Modudle_Config]

2022.03.25 / Folus Wen

Actions:
1. Add ocpp security profile / maintain server url / maintain server security profile configuration item.

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 3 lat temu
rodzic
commit
22c770f26d

+ 59 - 1
EVSE/Projects/AW-CCS/Apps/Module_ConfigTools.c

@@ -373,11 +373,14 @@ int main(void)
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));
 			printf("\n ***** ocpp ***************************************");
 			printf("\n  ocppurl: OCPP backend server url.");
+			printf("\n  ocppsecurity: OCPP backend server security profile.");
 			printf("\n  mtserverurl: Maintain backend server url.");
 			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  maintainurl: Maintain server url.");
+			printf("\n  maintainsecurity: Maintain server security profile.");
 			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
@@ -424,6 +427,23 @@ int main(void)
 					DEBUG_INFO("Input maintain server url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
 				}
 			}
+			else if(strcmp(cmd, "ocppsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** ocppsecurity *******************************");
+				printf("\n  Current OCPP security profile: %d", ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input OCPP security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("OCPP security profile: %d.\n");
+			}
 			else if(strcmp(cmd, "cboxid") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
@@ -510,7 +530,45 @@ int main(void)
 				else
 					DEBUG_INFO("Local loading balance: Disable\n");
 			}
-}
+			else if(strcmp(cmd, "maintainurl") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				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.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input maintain url: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.MaintainServerURL));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input maintain url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
+				}
+			}
+			else if(strcmp(cmd, "maintainsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** maintainsecurity ****************************");
+				printf("\n  Current maintain security profile: %d", ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input maintain security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("Maintain security profile: %d.\n");
+			}
+		}
 		else if(strcmp(cmd, "network") == 0)
 		{
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));

+ 325 - 83
EVSE/Projects/AW-ChargeLab/Apps/Module_ConfigTools.c

@@ -22,12 +22,12 @@
 
 #include 	<unistd.h>
 #include 	<stdarg.h>
-#include    <stdio.h>      /*標準輸入輸出定義*/
-#include    <stdlib.h>     /*標準函數庫定義*/
-#include    <unistd.h>     /*Unix 標準函數定義*/
-#include    <fcntl.h>      /*檔控制定義*/
-#include    <termios.h>    /*PPSIX 終端控制定義*/
-#include    <errno.h>      /*錯誤號定義*/
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
 #include 	<errno.h>
 #include 	<string.h>
 #include	<time.h>
@@ -37,14 +37,11 @@
 #include	<stddef.h>
 #include	<stdint.h>
 #include 	"define.h"
+#include 	"main.h"
 
 //=================================
 // System basic sample constant
 //=================================
-#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-
 #define ARRAY_SIZE(A)					(sizeof(A) / sizeof(A[0]))
 #define PASS							1
 #define FAIL							-1
@@ -56,6 +53,8 @@
 
 struct SysConfigAndInfo			*ShmSysConfigAndInfo;
 struct StatusCodeData			*ShmStatusCodeData;
+struct OCPP16Data 				*ShmOCPP16Data;
+struct Charger					*ShmCharger;
 
 int StoreLogMsg(const char *fmt, ...)
 {
@@ -152,12 +151,12 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 
 
 		DEBUG_INFO("Erase /dev/mtd10.\n");
-		runShellCmd("flash_erase /dev/mtd10 0 12");
+		runShellCmd("flash_erase /dev/mtd10 0 0");
 		DEBUG_INFO("Write /dev/mtd10.\n");
 		runShellCmd("nandwrite -p /dev/mtd10 /mnt/EvseConfig.bin");
 
 		DEBUG_INFO("Erase /dev/mtd11.\n");
-		runShellCmd("flash_erase /dev/mtd11 0 12");
+		runShellCmd("flash_erase /dev/mtd11 0 0");
 		DEBUG_INFO("Write /dev/mtd11.\n");
 		runShellCmd("nandwrite -p /dev/mtd11 /mnt/EvseConfig.bin");
 
@@ -185,36 +184,60 @@ int InitShareMemory()
 	//Initial ShmSysConfigAndInfo
 	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
 	{
-		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
-		#endif
 		result = FAIL;
 	}
 	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
 	{
-		#ifdef SystemLogMessage
 		DEBUG_ERROR("[shmat ShmSysConfigAndInfo NG\n");
-		#endif
 		result = FAIL;
 	}
+	else
+	{}
 
 	//Initial ShmStatusCodeData
 	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
 	{
-		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
-		#endif
 		result = FAIL;
 	}
 	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
 	{
-		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
-		#endif
 		result = FAIL;
 	}
+	else
+	{}
 
-	return result;
+	//Initial ShmOCPP16Data
+   	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
+		result = FAIL;
+	}
+	else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
+		result = FAIL;
+	}
+	else
+	{}
+
+	//Initial ShmCharger
+   	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
+    {
+   		DEBUG_ERROR("shmget ShmCharger NG\n");
+   		result = FAIL;
+	}
+    else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmCharger NG\n");
+    	result = FAIL;
+   	}
+    else
+    {}
+
+   	return result;
 }
 
 int main(void)
@@ -235,7 +258,7 @@ int main(void)
 	}
 	else
 	{
-		DEBUG_INFO("InitShareMemory OK.\r\n");
+		DEBUG_INFO("InitShareMemory OK.\n");
 	}
 
 
@@ -243,7 +266,7 @@ int main(void)
 	{
 		system("clear");
 		memset(cmd, 0x00, ARRAY_SIZE(cmd));
-		printf("\n ===== main menu ===================================");
+		printf("\n ===== main menu ==================================");
 		printf("\n  system: system configuration menu.");
 		printf("\n  ocpp: ocpp configuration menu.");
 		printf("\n  network: netwok configuration menu.");
@@ -251,7 +274,7 @@ int main(void)
 		printf("\n  upgrade: trigger firmware upgrade.");
 		printf("\n  save: Save config.");
 		printf("\n  exit: Exit config tools.");
-		printf("\n =================================================");
+		printf("\n ==================================================");
 		printf("\n  Please input item name to config: ");
 		scanf("%s", &cmd[0]);
 
@@ -264,18 +287,18 @@ int main(void)
 			printf("\n  serialnumber: EVSE serial number.");
 			printf("\n  authentication: Authentication function.");
 			printf("\n  rfidendian: RFID read endian.");
-			printf("\n *************************************************");
+			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
 
 			if(strcmp(cmd, "modelname") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** modelname **********************************");
 				printf("\n  Current model name: %s", ShmSysConfigAndInfo->SysConfig.ModelName);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new model name.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -286,16 +309,17 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.ModelName[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.ModelName[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input model name: %s\n", ShmSysConfigAndInfo->SysConfig.ModelName);
 				}
 			}
 			else if(strcmp(cmd, "serialnumber") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** serialnumber *******************************");
 				printf("\n  Current serial number: %s", ShmSysConfigAndInfo->SysConfig.SerialNumber);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new serial number.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -306,58 +330,69 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.SerialNumber[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.SerialNumber[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input serial number: %s\n", ShmSysConfigAndInfo->SysConfig.SerialNumber);
 				}
 			}
 			else if(strcmp(cmd, "authentication") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** authentication *****************************");
+				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
 				printf("\n  0: Enable.");
 				printf("\n  1: Disable.");
-				printf("\n *************************************************");
-
-				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
+				printf("\n **************************************************");
 				printf("\n  Please input authentication mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.AuthorisationMode = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd):0);
+				if(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
+					DEBUG_INFO("Authentication: Disable\n");
+				else
+					DEBUG_INFO("Authentication: Enable\n");
 			}
 			else if(strcmp(cmd, "rfidendian") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** rfidendian *********************************");
+				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
 				printf("\n  0: Little endian.");
 				printf("\n  1: Big endian.");
-				printf("\n *************************************************");
-
-				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
+				printf("\n **************************************************");
 				printf("\n  Please input rfid endian mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd):0);
+				if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
+					DEBUG_INFO("Authentication: Little endian\n");
+				else
+					DEBUG_INFO("Authentication: Big endian\n");
 			}
 		}
 		else if(strcmp(cmd, "ocpp") == 0)
 		{
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));
-			printf("\n *************************************************");
+			printf("\n ***** ocpp ***************************************");
 			printf("\n  ocppurl: OCPP backend server url.");
+			printf("\n  ocppsecurity: OCPP backend server security profile.");
+			printf("\n  mtserverurl: Maintain backend server url.");
 			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 *************************************************");
+			printf("\n  maintainurl: Maintain server url.");
+			printf("\n  maintainsecurity: Maintain server security profile.");
+			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
 
 			if(strcmp(cmd, "ocppurl") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** ocppurl ************************************");
 				printf("\n  Current OCPP url: %s", ShmSysConfigAndInfo->SysConfig.OcppServerURL);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new ocpp url.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -368,16 +403,55 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.OcppServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppServerURL));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.OcppServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input ocpp url: %s\n", ShmSysConfigAndInfo->SysConfig.OcppServerURL);
 				}
 			}
+			if(strcmp(cmd, "mtserverurl") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				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.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input maintain server url: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.MaintainServerURL));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input maintain server url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
+				}
+			}
+			else if(strcmp(cmd, "ocppsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** ocppsecurity *******************************");
+				printf("\n  Current OCPP security profile: %d", ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input OCPP security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("OCPP security profile: %d.\n");
+			}
 			else if(strcmp(cmd, "cboxid") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** cboxid *************************************");
 				printf("\n  Current OCPP charger box id: %s", ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new charger box id.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -388,16 +462,17 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.ChargeBoxId[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ChargeBoxId));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input ocpp charger box id: %s\n", ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
 				}
 			}
 			else if(strcmp(cmd, "vender") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** vender *************************************");
 				printf("\n  Current OCPP vender: %s", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new charger box id.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -408,42 +483,96 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.chargePointVendor[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.chargePointVendor));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.chargePointVendor[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input ocpp vender: %s\n", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
 				}
 			}
 			else if(strcmp(cmd, "offlinepolicy") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** offlinepolicy ******************************");
+				printf("\n  Current off line policy: %d", ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
 				printf("\n  0: Local list.");
 				printf("\n  2: Free charging.");
 				printf("\n  3: Deny charging.");
-				printf("\n *************************************************");
-
-				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
+				printf("\n **************************************************");
 				printf("\n  Please input off line policy mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.OfflinePolicy = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				switch(ShmSysConfigAndInfo->SysConfig.OfflinePolicy)
+				{
+					case 0:
+						DEBUG_INFO("Off line policy: Local list.\n");
+						break;
+					case 2:
+						DEBUG_INFO("Off line policy: Free charging.\n");
+						break;
+					case 3:
+						DEBUG_INFO("Off line policy: Deny charging.\n");
+						break;
+				}
 			}
 			else if(strcmp(cmd, "localloadbalance") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** localloadbalance ***************************");
+				printf("\n  Current local loading balance: %d", ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging);
 				printf("\n  0: Disable.");
 				printf("\n  1: Enable.");
-				printf("\n *************************************************");
-
-				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging);
+				printf("\n **************************************************");
 				printf("\n  Please input local load balance mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging = ((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");
+			}
+			else if(strcmp(cmd, "maintainurl") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				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.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input maintain url: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.MaintainServerURL));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input maintain url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
+				}
+			}
+			else if(strcmp(cmd, "maintainsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** maintainsecurity ****************************");
+				printf("\n  Current maintain security profile: %d", ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input maintain security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("Maintain security profile: %d.\n");
 			}
 		}
 		else if(strcmp(cmd, "network") == 0)
 		{
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));
-			printf("\n *************************************************");
+			printf("\n ***** network *************************************");
 			printf("\n  ethdhcp: Ethernet DHCP client.");
 			printf("\n  wifimode: WiFi mode.");
 			printf("\n  wifidhcp: WiFi DHCP client.");
@@ -453,61 +582,79 @@ int main(void)
 			printf("\n  teleapn: Telecomm APN.");
 			printf("\n  teleid: Telecomm login id.");
 			printf("\n  telepwd: Telecomm login password.");
-			printf("\n *************************************************");
+			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
 
 			if(strcmp(cmd, "ethdhcp") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** ethdhcp ************************************");
+				printf("\n  Current ethernet dhcp mode: %d", ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient^1);
 				printf("\n  0: Disable.");
 				printf("\n  1: Enable.");
-				printf("\n *************************************************");
-
-				printf("\n  Current ethernet dhcp mode: %d", ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient^1);
+				printf("\n **************************************************");
 				printf("\n  Please input dhcp mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd)^1:0);
+				if(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient)
+					DEBUG_INFO("Ethernet dhcp client: Disable\n");
+				else
+					DEBUG_INFO("Ethernet dhcp client: Enable\n");
+
 			}
 			else if(strcmp(cmd, "wifimode") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** wifimode ***********************************");
+				printf("\n  Current WiFi mode: %d", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
 				printf("\n  0: Disable.");
 				printf("\n  1: Station.");
 				printf("\n  2: Access point.");
-				printf("\n *************************************************");
-
-				printf("\n  Current WiFi mode: %d", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
+				printf("\n **************************************************");
 				printf("\n  Please input WiFi mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode = ((0<=atoi(cmd))&&(atoi(cmd)<=2)?atoi(cmd):0);
+				switch(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode)
+				{
+					case 0:
+						DEBUG_INFO("Wifi mode: Disable.\n");
+						break;
+					case 1:
+						DEBUG_INFO("Wifi mode: Station.\n");
+						break;
+					case 2:
+						DEBUG_INFO("Wifi mode: AP.\n");
+						break;
+				}
 			}
 			else if(strcmp(cmd, "wifidhcp") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** wifidhcp ***********************************");
+				printf("\n  Current WiFi dhcp client mode: %d", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient^1);
 				printf("\n  0: Disable.");
 				printf("\n  1: Enable.");
-				printf("\n *************************************************");
-
-				printf("\n  Current WiFi dhcp client mode: %d", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient^1);
+				printf("\n **************************************************");
 				printf("\n  Please input WiFi mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd)^1:0);
+				if(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient)
+					DEBUG_INFO("Wifi dhcp client: Disable\n");
+				else
+					DEBUG_INFO("Wifi dhcp client: Enable\n");
 			}
 			else if(strcmp(cmd, "wificssid") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** wificssid **********************************");
 				printf("\n  Current WiFi client SSID: %s", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new WiFi client SSID.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -518,16 +665,17 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid[0], (char*)&cmd[0]);
+					DEBUG_INFO("Wifi client SSID: %s\n", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
 				}
 			}
 			else if(strcmp(cmd, "wificpasswd") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** wificpasswd ********************************");
 				printf("\n  Current WiFi client password: %s", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new WiFi client password.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -538,30 +686,35 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword[0], (char*)&cmd[0]);
+					DEBUG_INFO("Wifi client password: %s\n", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
 				}
 			}
 			else if(strcmp(cmd, "telemode") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** telemode ***********************************");
 				printf("\n  0: Disable.");
 				printf("\n  1: Enable.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 
 				printf("\n  Current telecomm mode: %d", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode^1);
 				printf("\n  Please input telecomm mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd)^1:0);
+				if(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode)
+					DEBUG_INFO("Wifi dhcp client: Disable\n");
+				else
+					DEBUG_INFO("Wifi dhcp client: Enable\n");
 			}
 			else if(strcmp(cmd, "teleapn") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** teleapn ************************************");
 				printf("\n  Current telecomm APN: %s", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new telecomm APN.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -572,16 +725,17 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn[0], (char*)&cmd[0]);
+					DEBUG_INFO("Telecomm APN: %s\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
 				}
 			}
 			else if(strcmp(cmd, "teleid") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** teleid *************************************");
 				printf("\n  Current telecomm login id: %s", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new telecomm login id.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -592,16 +746,17 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId[0], (char*)&cmd[0]);
+					DEBUG_INFO("Telecomm CHAP id: %s\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
 				}
 			}
 			else if(strcmp(cmd, "telepwd") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** telepwd ************************************");
 				printf("\n  Current telecomm login password: %s", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new telecomm login password.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -612,17 +767,21 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd[0], (char*)&cmd[0]);
+					DEBUG_INFO("Telecomm CHAP password: %s\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
 				}
 			}
 		}
 		else if(strcmp(cmd, "test") == 0)
 		{
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));
-			printf("\n ***** test menu ******************");
+			printf("\n ***** test menu **********************************");
 			printf("\n  start: EVSE start charging request.");
 			printf("\n  stop: EVSE stop charging request.");
+			printf("\n  auth: Authorize request.");
+			printf("\n  ccs: CCS flow status.");
+			printf("\n  alarm: Simulate alarm status.");
 			printf("\n  cancel: return to main menu.");
-			printf("\n *************************************************");
+			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
 
@@ -635,6 +794,7 @@ int main(void)
 				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
 				{
 					ShmSysConfigAndInfo->SysInfo.AcChargingData[atoi(cmd)-1].schedule.isTriggerStart = ON;
+					DEBUG_INFO("Test start gun-%d, start charging session.\n", atoi(cmd));
 				}
 				else
 				{
@@ -650,12 +810,91 @@ int main(void)
 				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
 				{
 					ShmSysConfigAndInfo->SysInfo.AcChargingData[atoi(cmd)-1].schedule.isTriggerStop = ON;
+					DEBUG_INFO("Test start gun-%d, stop charging session.\n", atoi(cmd));
+				}
+				else
+				{
+					printf("\n  Invalid input gun_index.");
+				}
+			}
+			else if(strcmp(cmd, "auth") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input idtag: ");
+				scanf("%s", &cmd[0]);
+
+				sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%s", cmd);
+				ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
+				DEBUG_INFO("Test authentication by %s.\n", ShmSysConfigAndInfo->SysConfig.UserId);
+			}
+			else if(strcmp(cmd, "ccs") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input gun index(1~2): ");
+				scanf("%s", &cmd[0]);
+
+				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
+				{
+					uint8_t gun_index = atoi(cmd)-1;
+					memset(cmd, 0x00, ARRAY_SIZE(cmd));
+					printf("\n ***** ccs ****************************************");
+					printf("\n  ccs_hs_status: CCS hand shake status.");
+					printf("\n  cancel: return to main menu.");
+					printf("\n **************************************************");
+					printf("\n  Please input operation item: ");
+					scanf("%s", &cmd[0]);
+
+					if(strcmp(cmd, "ccs_hs_status") == 0)
+					{
+						printf("\n ***** ccs_hs_status *******************************");
+						printf("\n  Current ccs_hs_status: %d", ShmCharger->gun_info[gun_index].ccsHandshakeState);
+						printf("\n  1: HANDSHAKE_DUTY_5.");
+						printf("\n  2: HANDSHAKE_DUTY_5_CHECK.");
+						printf("\n  3: HANDSHAKE_CCS.");
+						printf("\n  4: HANDSHAKE_CP_STATE_E.");
+						printf("\n  5: HANDSHAKE_SET_MAX_CURRENT.");
+						printf("\n  6: HANDSHAKE_BS_MODE.");
+						printf("\n  7: HANDSHAKE_HLC_MODE.");
+						printf("\n **************************************************");
+						printf("\n  Please input operation item: ");
+						scanf("%s", &cmd[0]);
+
+						if((0 < atoi(cmd)) && (atoi(cmd) < 9))
+						{
+							ShmCharger->gun_info[gun_index].ccsHandshakeState = atoi(cmd);
+							DEBUG_INFO("Gun-%d CCS hand shake state: %d.\n", gun_index, ShmCharger->gun_info[gun_index].ccsHandshakeState);
+						}
+						else
+							printf("\n  Invalid hand shake state.");
+					}
 				}
 				else
 				{
 					printf("\n  Invalid input gun_index.");
 				}
 			}
+			else if(strcmp(cmd, "alarm") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input gun index(1~2): ");
+				scanf("%s", &cmd[0]);
+
+				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
+				{
+					DEBUG_INFO("Alarm simulate gun-%d, OVP.\n", atoi(cmd));
+
+					while(1)
+					{
+						ShmCharger->gun_info[atoi(cmd)-1].systemAlarmCode.SystemAlarmCode |= ALARM_L1_OVER_VOLTAGE;
+						ShmCharger->gun_info[atoi(cmd)-1].primaryMcuAlarm.InputAlarmCode |= ALARM_L1_OVER_VOLTAGE;
+					}
+				}
+				else
+				{
+					printf("\n  Invalid input gun_index.");
+					sleep(1);
+				}
+			}
 			else if(strcmp(cmd, "cancel") == 0)
 			{}
 		}
@@ -664,7 +903,7 @@ int main(void)
 			printf("\n  Firmware upgrade trigger.");
 
 			ShmSysConfigAndInfo->SysInfo.FirmwareUpdate = ON;
-
+			DEBUG_INFO("Trigger firmware upgrade.\n");
 			sleep(2);
 		}
 		else if(strcmp(cmd, "save") == 0)
@@ -674,13 +913,16 @@ int main(void)
 				printf("\n  Write configuration fail.\r\n");
 			}
 			else
+			{
 				printf("\n  Write configuration OK.\r\n");
-
+				DEBUG_INFO("Save configuration.\n");
+			}
 			sleep(2);
 		}
 		else if(strcmp(cmd, "exit") == 0)
 		{
 			printf("\n  exit program.\n\n");
+			DEBUG_INFO("Exit configuration tools.\n");
 			return FAIL;
 		}
 	}

+ 133 - 5
EVSE/Projects/AW-Regular/Apps/Module_ConfigTools.c

@@ -373,10 +373,14 @@ int main(void)
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));
 			printf("\n ***** ocpp ***************************************");
 			printf("\n  ocppurl: OCPP backend server url.");
+			printf("\n  ocppsecurity: OCPP backend server security profile.");
+			printf("\n  mtserverurl: Maintain backend server url.");
 			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  maintainurl: Maintain server url.");
+			printf("\n  maintainsecurity: Maintain server security profile.");
 			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
@@ -402,6 +406,44 @@ int main(void)
 					DEBUG_INFO("Input ocpp url: %s\n", ShmSysConfigAndInfo->SysConfig.OcppServerURL);
 				}
 			}
+			if(strcmp(cmd, "mtserverurl") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				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.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input maintain server url: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.MaintainServerURL));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input maintain server url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
+				}
+			}
+			else if(strcmp(cmd, "ocppsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** ocppsecurity *******************************");
+				printf("\n  Current OCPP security profile: %d", ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input OCPP security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("OCPP security profile: %d.\n");
+			}
 			else if(strcmp(cmd, "cboxid") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
@@ -488,7 +530,45 @@ int main(void)
 				else
 					DEBUG_INFO("Local loading balance: Disable\n");
 			}
-}
+			else if(strcmp(cmd, "maintainurl") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				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.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input maintain url: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.MaintainServerURL));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input maintain url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
+				}
+			}
+			else if(strcmp(cmd, "maintainsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** maintainsecurity ****************************");
+				printf("\n  Current maintain security profile: %d", ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input maintain security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("Maintain security profile: %d.\n");
+			}
+		}
 		else if(strcmp(cmd, "network") == 0)
 		{
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));
@@ -698,6 +778,7 @@ int main(void)
 			printf("\n  start: EVSE start charging request.");
 			printf("\n  stop: EVSE stop charging request.");
 			printf("\n  auth: Authorize request.");
+			printf("\n  ccs: CCS flow status.");
 			printf("\n  alarm: Simulate alarm status.");
 			printf("\n  cancel: return to main menu.");
 			printf("\n **************************************************");
@@ -746,6 +827,52 @@ int main(void)
 				ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
 				DEBUG_INFO("Test authentication by %s.\n", ShmSysConfigAndInfo->SysConfig.UserId);
 			}
+			else if(strcmp(cmd, "ccs") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input gun index(1~2): ");
+				scanf("%s", &cmd[0]);
+
+				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
+				{
+					uint8_t gun_index = atoi(cmd)-1;
+					memset(cmd, 0x00, ARRAY_SIZE(cmd));
+					printf("\n ***** ccs ****************************************");
+					printf("\n  ccs_hs_status: CCS hand shake status.");
+					printf("\n  cancel: return to main menu.");
+					printf("\n **************************************************");
+					printf("\n  Please input operation item: ");
+					scanf("%s", &cmd[0]);
+
+					if(strcmp(cmd, "ccs_hs_status") == 0)
+					{
+						printf("\n ***** ccs_hs_status *******************************");
+						printf("\n  Current ccs_hs_status: %d", ShmCharger->gun_info[gun_index].ccsHandshakeState);
+						printf("\n  1: HANDSHAKE_DUTY_5.");
+						printf("\n  2: HANDSHAKE_DUTY_5_CHECK.");
+						printf("\n  3: HANDSHAKE_CCS.");
+						printf("\n  4: HANDSHAKE_CP_STATE_E.");
+						printf("\n  5: HANDSHAKE_SET_MAX_CURRENT.");
+						printf("\n  6: HANDSHAKE_BS_MODE.");
+						printf("\n  7: HANDSHAKE_HLC_MODE.");
+						printf("\n **************************************************");
+						printf("\n  Please input operation item: ");
+						scanf("%s", &cmd[0]);
+
+						if((0 < atoi(cmd)) && (atoi(cmd) < 9))
+						{
+							ShmCharger->gun_info[gun_index].ccsHandshakeState = atoi(cmd);
+							DEBUG_INFO("Gun-%d CCS hand shake state: %d.\n", gun_index, ShmCharger->gun_info[gun_index].ccsHandshakeState);
+						}
+						else
+							printf("\n  Invalid hand shake state.");
+					}
+				}
+				else
+				{
+					printf("\n  Invalid input gun_index.");
+				}
+			}
 			else if(strcmp(cmd, "alarm") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
@@ -753,19 +880,20 @@ int main(void)
 				scanf("%s", &cmd[0]);
 
 				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
-				{					
+				{
 					DEBUG_INFO("Alarm simulate gun-%d, OVP.\n", atoi(cmd));
+
 					while(1)
 					{
-						ShmCharger->gun_info[atoi(cmd)-1].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_VOLTAGE;
-						ShmCharger->gun_info[atoi(cmd)-1].primaryMcuAlarm.InputAlarmCode |= ALARM_OVER_VOLTAGE;
+						ShmCharger->gun_info[atoi(cmd)-1].systemAlarmCode.SystemAlarmCode |= ALARM_L1_OVER_VOLTAGE;
+						ShmCharger->gun_info[atoi(cmd)-1].primaryMcuAlarm.InputAlarmCode |= ALARM_L1_OVER_VOLTAGE;
 					}
 				}
 				else
 				{
 					printf("\n  Invalid input gun_index.");
 					sleep(1);
-				}				
+				}
 			}
 			else if(strcmp(cmd, "cancel") == 0)
 			{}

+ 59 - 1
EVSE/Projects/AX80/Apps/Module_ConfigTools.c

@@ -373,11 +373,14 @@ int main(void)
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));
 			printf("\n ***** ocpp ***************************************");
 			printf("\n  ocppurl: OCPP backend server url.");
+			printf("\n  ocppsecurity: OCPP backend server security profile.");
 			printf("\n  mtserverurl: Maintain backend server url.");
 			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  maintainurl: Maintain server url.");
+			printf("\n  maintainsecurity: Maintain server security profile.");
 			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
@@ -424,6 +427,23 @@ int main(void)
 					DEBUG_INFO("Input maintain server url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
 				}
 			}
+			else if(strcmp(cmd, "ocppsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** ocppsecurity *******************************");
+				printf("\n  Current OCPP security profile: %d", ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input OCPP security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("OCPP security profile: %d.\n");
+			}
 			else if(strcmp(cmd, "cboxid") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
@@ -510,7 +530,45 @@ int main(void)
 				else
 					DEBUG_INFO("Local loading balance: Disable\n");
 			}
-}
+			else if(strcmp(cmd, "maintainurl") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				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.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input maintain url: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.MaintainServerURL));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input maintain url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
+				}
+			}
+			else if(strcmp(cmd, "maintainsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** maintainsecurity ****************************");
+				printf("\n  Current maintain security profile: %d", ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input maintain security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("Maintain security profile: %d.\n");
+			}
+		}
 		else if(strcmp(cmd, "network") == 0)
 		{
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));

+ 325 - 83
EVSE/Projects/Noodoe/Apps/Module_ConfigTools.c

@@ -22,12 +22,12 @@
 
 #include 	<unistd.h>
 #include 	<stdarg.h>
-#include    <stdio.h>      /*標準輸入輸出定義*/
-#include    <stdlib.h>     /*標準函數庫定義*/
-#include    <unistd.h>     /*Unix 標準函數定義*/
-#include    <fcntl.h>      /*檔控制定義*/
-#include    <termios.h>    /*PPSIX 終端控制定義*/
-#include    <errno.h>      /*錯誤號定義*/
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
 #include 	<errno.h>
 #include 	<string.h>
 #include	<time.h>
@@ -37,14 +37,11 @@
 #include	<stddef.h>
 #include	<stdint.h>
 #include 	"define.h"
+#include 	"main.h"
 
 //=================================
 // System basic sample constant
 //=================================
-#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-
 #define ARRAY_SIZE(A)					(sizeof(A) / sizeof(A[0]))
 #define PASS							1
 #define FAIL							-1
@@ -56,6 +53,8 @@
 
 struct SysConfigAndInfo			*ShmSysConfigAndInfo;
 struct StatusCodeData			*ShmStatusCodeData;
+struct OCPP16Data 				*ShmOCPP16Data;
+struct Charger					*ShmCharger;
 
 int StoreLogMsg(const char *fmt, ...)
 {
@@ -152,12 +151,12 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 
 
 		DEBUG_INFO("Erase /dev/mtd10.\n");
-		runShellCmd("flash_erase /dev/mtd10 0 12");
+		runShellCmd("flash_erase /dev/mtd10 0 0");
 		DEBUG_INFO("Write /dev/mtd10.\n");
 		runShellCmd("nandwrite -p /dev/mtd10 /mnt/EvseConfig.bin");
 
 		DEBUG_INFO("Erase /dev/mtd11.\n");
-		runShellCmd("flash_erase /dev/mtd11 0 12");
+		runShellCmd("flash_erase /dev/mtd11 0 0");
 		DEBUG_INFO("Write /dev/mtd11.\n");
 		runShellCmd("nandwrite -p /dev/mtd11 /mnt/EvseConfig.bin");
 
@@ -185,36 +184,60 @@ int InitShareMemory()
 	//Initial ShmSysConfigAndInfo
 	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
 	{
-		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
-		#endif
 		result = FAIL;
 	}
 	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
 	{
-		#ifdef SystemLogMessage
 		DEBUG_ERROR("[shmat ShmSysConfigAndInfo NG\n");
-		#endif
 		result = FAIL;
 	}
+	else
+	{}
 
 	//Initial ShmStatusCodeData
 	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
 	{
-		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
-		#endif
 		result = FAIL;
 	}
 	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
 	{
-		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
-		#endif
 		result = FAIL;
 	}
+	else
+	{}
 
-	return result;
+	//Initial ShmOCPP16Data
+   	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
+		result = FAIL;
+	}
+	else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
+		result = FAIL;
+	}
+	else
+	{}
+
+	//Initial ShmCharger
+   	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
+    {
+   		DEBUG_ERROR("shmget ShmCharger NG\n");
+   		result = FAIL;
+	}
+    else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmCharger NG\n");
+    	result = FAIL;
+   	}
+    else
+    {}
+
+   	return result;
 }
 
 int main(void)
@@ -235,7 +258,7 @@ int main(void)
 	}
 	else
 	{
-		DEBUG_INFO("InitShareMemory OK.\r\n");
+		DEBUG_INFO("InitShareMemory OK.\n");
 	}
 
 
@@ -243,7 +266,7 @@ int main(void)
 	{
 		system("clear");
 		memset(cmd, 0x00, ARRAY_SIZE(cmd));
-		printf("\n ===== main menu ===================================");
+		printf("\n ===== main menu ==================================");
 		printf("\n  system: system configuration menu.");
 		printf("\n  ocpp: ocpp configuration menu.");
 		printf("\n  network: netwok configuration menu.");
@@ -251,7 +274,7 @@ int main(void)
 		printf("\n  upgrade: trigger firmware upgrade.");
 		printf("\n  save: Save config.");
 		printf("\n  exit: Exit config tools.");
-		printf("\n =================================================");
+		printf("\n ==================================================");
 		printf("\n  Please input item name to config: ");
 		scanf("%s", &cmd[0]);
 
@@ -264,18 +287,18 @@ int main(void)
 			printf("\n  serialnumber: EVSE serial number.");
 			printf("\n  authentication: Authentication function.");
 			printf("\n  rfidendian: RFID read endian.");
-			printf("\n *************************************************");
+			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
 
 			if(strcmp(cmd, "modelname") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** modelname **********************************");
 				printf("\n  Current model name: %s", ShmSysConfigAndInfo->SysConfig.ModelName);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new model name.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -286,16 +309,17 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.ModelName[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.ModelName[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input model name: %s\n", ShmSysConfigAndInfo->SysConfig.ModelName);
 				}
 			}
 			else if(strcmp(cmd, "serialnumber") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** serialnumber *******************************");
 				printf("\n  Current serial number: %s", ShmSysConfigAndInfo->SysConfig.SerialNumber);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new serial number.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -306,58 +330,69 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.SerialNumber[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.SerialNumber[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input serial number: %s\n", ShmSysConfigAndInfo->SysConfig.SerialNumber);
 				}
 			}
 			else if(strcmp(cmd, "authentication") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** authentication *****************************");
+				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
 				printf("\n  0: Enable.");
 				printf("\n  1: Disable.");
-				printf("\n *************************************************");
-
-				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
+				printf("\n **************************************************");
 				printf("\n  Please input authentication mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.AuthorisationMode = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd):0);
+				if(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
+					DEBUG_INFO("Authentication: Disable\n");
+				else
+					DEBUG_INFO("Authentication: Enable\n");
 			}
 			else if(strcmp(cmd, "rfidendian") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** rfidendian *********************************");
+				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
 				printf("\n  0: Little endian.");
 				printf("\n  1: Big endian.");
-				printf("\n *************************************************");
-
-				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
+				printf("\n **************************************************");
 				printf("\n  Please input rfid endian mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd):0);
+				if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
+					DEBUG_INFO("Authentication: Little endian\n");
+				else
+					DEBUG_INFO("Authentication: Big endian\n");
 			}
 		}
 		else if(strcmp(cmd, "ocpp") == 0)
 		{
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));
-			printf("\n *************************************************");
+			printf("\n ***** ocpp ***************************************");
 			printf("\n  ocppurl: OCPP backend server url.");
+			printf("\n  ocppsecurity: OCPP backend server security profile.");
+			printf("\n  mtserverurl: Maintain backend server url.");
 			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 *************************************************");
+			printf("\n  maintainurl: Maintain server url.");
+			printf("\n  maintainsecurity: Maintain server security profile.");
+			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
 
 			if(strcmp(cmd, "ocppurl") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** ocppurl ************************************");
 				printf("\n  Current OCPP url: %s", ShmSysConfigAndInfo->SysConfig.OcppServerURL);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new ocpp url.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -368,16 +403,55 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.OcppServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppServerURL));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.OcppServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input ocpp url: %s\n", ShmSysConfigAndInfo->SysConfig.OcppServerURL);
 				}
 			}
+			if(strcmp(cmd, "mtserverurl") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				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.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input maintain server url: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.MaintainServerURL));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input maintain server url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
+				}
+			}
+			else if(strcmp(cmd, "ocppsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** ocppsecurity *******************************");
+				printf("\n  Current OCPP security profile: %d", ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input OCPP security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("OCPP security profile: %d.\n");
+			}
 			else if(strcmp(cmd, "cboxid") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** cboxid *************************************");
 				printf("\n  Current OCPP charger box id: %s", ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new charger box id.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -388,16 +462,17 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.ChargeBoxId[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ChargeBoxId));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input ocpp charger box id: %s\n", ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
 				}
 			}
 			else if(strcmp(cmd, "vender") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** vender *************************************");
 				printf("\n  Current OCPP vender: %s", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new charger box id.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -408,42 +483,96 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.chargePointVendor[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.chargePointVendor));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.chargePointVendor[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input ocpp vender: %s\n", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
 				}
 			}
 			else if(strcmp(cmd, "offlinepolicy") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** offlinepolicy ******************************");
+				printf("\n  Current off line policy: %d", ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
 				printf("\n  0: Local list.");
 				printf("\n  2: Free charging.");
 				printf("\n  3: Deny charging.");
-				printf("\n *************************************************");
-
-				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
+				printf("\n **************************************************");
 				printf("\n  Please input off line policy mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.OfflinePolicy = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				switch(ShmSysConfigAndInfo->SysConfig.OfflinePolicy)
+				{
+					case 0:
+						DEBUG_INFO("Off line policy: Local list.\n");
+						break;
+					case 2:
+						DEBUG_INFO("Off line policy: Free charging.\n");
+						break;
+					case 3:
+						DEBUG_INFO("Off line policy: Deny charging.\n");
+						break;
+				}
 			}
 			else if(strcmp(cmd, "localloadbalance") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** localloadbalance ***************************");
+				printf("\n  Current local loading balance: %d", ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging);
 				printf("\n  0: Disable.");
 				printf("\n  1: Enable.");
-				printf("\n *************************************************");
-
-				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging);
+				printf("\n **************************************************");
 				printf("\n  Please input local load balance mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging = ((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");
+			}
+			else if(strcmp(cmd, "maintainurl") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				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.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input maintain url: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.MaintainServerURL));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input maintain url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
+				}
+			}
+			else if(strcmp(cmd, "maintainsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** maintainsecurity ****************************");
+				printf("\n  Current maintain security profile: %d", ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input maintain security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("Maintain security profile: %d.\n");
 			}
 		}
 		else if(strcmp(cmd, "network") == 0)
 		{
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));
-			printf("\n *************************************************");
+			printf("\n ***** network *************************************");
 			printf("\n  ethdhcp: Ethernet DHCP client.");
 			printf("\n  wifimode: WiFi mode.");
 			printf("\n  wifidhcp: WiFi DHCP client.");
@@ -453,61 +582,79 @@ int main(void)
 			printf("\n  teleapn: Telecomm APN.");
 			printf("\n  teleid: Telecomm login id.");
 			printf("\n  telepwd: Telecomm login password.");
-			printf("\n *************************************************");
+			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
 
 			if(strcmp(cmd, "ethdhcp") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** ethdhcp ************************************");
+				printf("\n  Current ethernet dhcp mode: %d", ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient^1);
 				printf("\n  0: Disable.");
 				printf("\n  1: Enable.");
-				printf("\n *************************************************");
-
-				printf("\n  Current ethernet dhcp mode: %d", ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient^1);
+				printf("\n **************************************************");
 				printf("\n  Please input dhcp mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd)^1:0);
+				if(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient)
+					DEBUG_INFO("Ethernet dhcp client: Disable\n");
+				else
+					DEBUG_INFO("Ethernet dhcp client: Enable\n");
+
 			}
 			else if(strcmp(cmd, "wifimode") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** wifimode ***********************************");
+				printf("\n  Current WiFi mode: %d", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
 				printf("\n  0: Disable.");
 				printf("\n  1: Station.");
 				printf("\n  2: Access point.");
-				printf("\n *************************************************");
-
-				printf("\n  Current WiFi mode: %d", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
+				printf("\n **************************************************");
 				printf("\n  Please input WiFi mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode = ((0<=atoi(cmd))&&(atoi(cmd)<=2)?atoi(cmd):0);
+				switch(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode)
+				{
+					case 0:
+						DEBUG_INFO("Wifi mode: Disable.\n");
+						break;
+					case 1:
+						DEBUG_INFO("Wifi mode: Station.\n");
+						break;
+					case 2:
+						DEBUG_INFO("Wifi mode: AP.\n");
+						break;
+				}
 			}
 			else if(strcmp(cmd, "wifidhcp") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** wifidhcp ***********************************");
+				printf("\n  Current WiFi dhcp client mode: %d", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient^1);
 				printf("\n  0: Disable.");
 				printf("\n  1: Enable.");
-				printf("\n *************************************************");
-
-				printf("\n  Current WiFi dhcp client mode: %d", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient^1);
+				printf("\n **************************************************");
 				printf("\n  Please input WiFi mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd)^1:0);
+				if(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient)
+					DEBUG_INFO("Wifi dhcp client: Disable\n");
+				else
+					DEBUG_INFO("Wifi dhcp client: Enable\n");
 			}
 			else if(strcmp(cmd, "wificssid") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** wificssid **********************************");
 				printf("\n  Current WiFi client SSID: %s", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new WiFi client SSID.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -518,16 +665,17 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid[0], (char*)&cmd[0]);
+					DEBUG_INFO("Wifi client SSID: %s\n", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
 				}
 			}
 			else if(strcmp(cmd, "wificpasswd") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** wificpasswd ********************************");
 				printf("\n  Current WiFi client password: %s", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new WiFi client password.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -538,30 +686,35 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword[0], (char*)&cmd[0]);
+					DEBUG_INFO("Wifi client password: %s\n", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
 				}
 			}
 			else if(strcmp(cmd, "telemode") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** telemode ***********************************");
 				printf("\n  0: Disable.");
 				printf("\n  1: Enable.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 
 				printf("\n  Current telecomm mode: %d", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode^1);
 				printf("\n  Please input telecomm mode: ");
 				scanf("%s", &cmd[0]);
 
 				ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd)^1:0);
+				if(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode)
+					DEBUG_INFO("Wifi dhcp client: Disable\n");
+				else
+					DEBUG_INFO("Wifi dhcp client: Enable\n");
 			}
 			else if(strcmp(cmd, "teleapn") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** teleapn ************************************");
 				printf("\n  Current telecomm APN: %s", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new telecomm APN.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -572,16 +725,17 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn[0], (char*)&cmd[0]);
+					DEBUG_INFO("Telecomm APN: %s\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
 				}
 			}
 			else if(strcmp(cmd, "teleid") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** teleid *************************************");
 				printf("\n  Current telecomm login id: %s", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new telecomm login id.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -592,16 +746,17 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId[0], (char*)&cmd[0]);
+					DEBUG_INFO("Telecomm CHAP id: %s\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
 				}
 			}
 			else if(strcmp(cmd, "telepwd") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
-				printf("\n *************************************************");
+				printf("\n ***** telepwd ************************************");
 				printf("\n  Current telecomm login password: %s", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
 				printf("\n  0: Keep current config.");
 				printf("\n  1: Input new telecomm login password.");
-				printf("\n *************************************************");
+				printf("\n **************************************************");
 				printf("\n  Please input operation item: ");
 				scanf("%s", &cmd[0]);
 
@@ -612,17 +767,21 @@ int main(void)
 
 					memset(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd));
 					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd[0], (char*)&cmd[0]);
+					DEBUG_INFO("Telecomm CHAP password: %s\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
 				}
 			}
 		}
 		else if(strcmp(cmd, "test") == 0)
 		{
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));
-			printf("\n ***** test menu ******************");
+			printf("\n ***** test menu **********************************");
 			printf("\n  start: EVSE start charging request.");
 			printf("\n  stop: EVSE stop charging request.");
+			printf("\n  auth: Authorize request.");
+			printf("\n  ccs: CCS flow status.");
+			printf("\n  alarm: Simulate alarm status.");
 			printf("\n  cancel: return to main menu.");
-			printf("\n *************************************************");
+			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
 
@@ -635,6 +794,7 @@ int main(void)
 				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
 				{
 					ShmSysConfigAndInfo->SysInfo.AcChargingData[atoi(cmd)-1].schedule.isTriggerStart = ON;
+					DEBUG_INFO("Test start gun-%d, start charging session.\n", atoi(cmd));
 				}
 				else
 				{
@@ -650,12 +810,91 @@ int main(void)
 				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
 				{
 					ShmSysConfigAndInfo->SysInfo.AcChargingData[atoi(cmd)-1].schedule.isTriggerStop = ON;
+					DEBUG_INFO("Test start gun-%d, stop charging session.\n", atoi(cmd));
+				}
+				else
+				{
+					printf("\n  Invalid input gun_index.");
+				}
+			}
+			else if(strcmp(cmd, "auth") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input idtag: ");
+				scanf("%s", &cmd[0]);
+
+				sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%s", cmd);
+				ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
+				DEBUG_INFO("Test authentication by %s.\n", ShmSysConfigAndInfo->SysConfig.UserId);
+			}
+			else if(strcmp(cmd, "ccs") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input gun index(1~2): ");
+				scanf("%s", &cmd[0]);
+
+				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
+				{
+					uint8_t gun_index = atoi(cmd)-1;
+					memset(cmd, 0x00, ARRAY_SIZE(cmd));
+					printf("\n ***** ccs ****************************************");
+					printf("\n  ccs_hs_status: CCS hand shake status.");
+					printf("\n  cancel: return to main menu.");
+					printf("\n **************************************************");
+					printf("\n  Please input operation item: ");
+					scanf("%s", &cmd[0]);
+
+					if(strcmp(cmd, "ccs_hs_status") == 0)
+					{
+						printf("\n ***** ccs_hs_status *******************************");
+						printf("\n  Current ccs_hs_status: %d", ShmCharger->gun_info[gun_index].ccsHandshakeState);
+						printf("\n  1: HANDSHAKE_DUTY_5.");
+						printf("\n  2: HANDSHAKE_DUTY_5_CHECK.");
+						printf("\n  3: HANDSHAKE_CCS.");
+						printf("\n  4: HANDSHAKE_CP_STATE_E.");
+						printf("\n  5: HANDSHAKE_SET_MAX_CURRENT.");
+						printf("\n  6: HANDSHAKE_BS_MODE.");
+						printf("\n  7: HANDSHAKE_HLC_MODE.");
+						printf("\n **************************************************");
+						printf("\n  Please input operation item: ");
+						scanf("%s", &cmd[0]);
+
+						if((0 < atoi(cmd)) && (atoi(cmd) < 9))
+						{
+							ShmCharger->gun_info[gun_index].ccsHandshakeState = atoi(cmd);
+							DEBUG_INFO("Gun-%d CCS hand shake state: %d.\n", gun_index, ShmCharger->gun_info[gun_index].ccsHandshakeState);
+						}
+						else
+							printf("\n  Invalid hand shake state.");
+					}
 				}
 				else
 				{
 					printf("\n  Invalid input gun_index.");
 				}
 			}
+			else if(strcmp(cmd, "alarm") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input gun index(1~2): ");
+				scanf("%s", &cmd[0]);
+
+				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
+				{
+					DEBUG_INFO("Alarm simulate gun-%d, OVP.\n", atoi(cmd));
+
+					while(1)
+					{
+						ShmCharger->gun_info[atoi(cmd)-1].systemAlarmCode.SystemAlarmCode |= ALARM_L1_OVER_VOLTAGE;
+						ShmCharger->gun_info[atoi(cmd)-1].primaryMcuAlarm.InputAlarmCode |= ALARM_L1_OVER_VOLTAGE;
+					}
+				}
+				else
+				{
+					printf("\n  Invalid input gun_index.");
+					sleep(1);
+				}
+			}
 			else if(strcmp(cmd, "cancel") == 0)
 			{}
 		}
@@ -664,7 +903,7 @@ int main(void)
 			printf("\n  Firmware upgrade trigger.");
 
 			ShmSysConfigAndInfo->SysInfo.FirmwareUpdate = ON;
-
+			DEBUG_INFO("Trigger firmware upgrade.\n");
 			sleep(2);
 		}
 		else if(strcmp(cmd, "save") == 0)
@@ -674,13 +913,16 @@ int main(void)
 				printf("\n  Write configuration fail.\r\n");
 			}
 			else
+			{
 				printf("\n  Write configuration OK.\r\n");
-
+				DEBUG_INFO("Save configuration.\n");
+			}
 			sleep(2);
 		}
 		else if(strcmp(cmd, "exit") == 0)
 		{
 			printf("\n  exit program.\n\n");
+			DEBUG_INFO("Exit configuration tools.\n");
 			return FAIL;
 		}
 	}

+ 59 - 1
EVSE/Projects/NoodoeAX/Apps/Module_ConfigTools.c

@@ -373,11 +373,14 @@ int main(void)
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));
 			printf("\n ***** ocpp ***************************************");
 			printf("\n  ocppurl: OCPP backend server url.");
+			printf("\n  ocppsecurity: OCPP backend server security profile.");
 			printf("\n  mtserverurl: Maintain backend server url.");
 			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  maintainurl: Maintain server url.");
+			printf("\n  maintainsecurity: Maintain server security profile.");
 			printf("\n **************************************************");
 			printf("\n  Please input operation item: ");
 			scanf("%s", &cmd[0]);
@@ -424,6 +427,23 @@ int main(void)
 					DEBUG_INFO("Input maintain server url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
 				}
 			}
+			else if(strcmp(cmd, "ocppsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** ocppsecurity *******************************");
+				printf("\n  Current OCPP security profile: %d", ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input OCPP security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("OCPP security profile: %d.\n");
+			}
 			else if(strcmp(cmd, "cboxid") == 0)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
@@ -510,7 +530,45 @@ int main(void)
 				else
 					DEBUG_INFO("Local loading balance: Disable\n");
 			}
-}
+			else if(strcmp(cmd, "maintainurl") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				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.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input maintain url: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.MaintainServerURL));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input maintain url: %s\n", ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
+				}
+			}
+			else if(strcmp(cmd, "maintainsecurity") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** maintainsecurity ****************************");
+				printf("\n  Current maintain security profile: %d", ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile);
+				printf("\n  0: Profile-0.");
+				printf("\n  1: Profile-1.");
+				printf("\n  2: Profile-2.");
+				printf("\n  3: Profile-3.");
+				printf("\n **************************************************");
+				printf("\n  Please input maintain security profile: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				DEBUG_INFO("Maintain security profile: %d.\n");
+			}
+		}
 		else if(strcmp(cmd, "network") == 0)
 		{
 			memset(cmd, 0x00, ARRAY_SIZE(cmd));