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

[Improve][Modularization][Module_OcppBackend / Module_OcppBackend20]

2021.07.01 / Folus Wen

Actions:
1. Variable array up size when process GetDiagnistics & UpdateFirmware message.

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 жил өмнө
parent
commit
3a6fad8373

+ 10 - 7
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -8512,6 +8512,7 @@ S_FAULT                 =12
 	}
 	else
 	{
+		cpinitateMsg.bits[gun_index].StatusNotificationReq = 0;
 		result = PASS;
 	}
 
@@ -11932,6 +11933,8 @@ int handleDataTransferRequest(char *uuid, char *payload)
 		else if(strstr((char*)ShmOCPP20Data->DataTransfer[0].messageId, "ID_Tmate") != NULL)
 		{
 			system("/usr/bin/run_tmate_restart.sh &");
+
+			strcpy((char*)ShmOCPP20Data->DataTransfer[0].Response_status, DataTransferStatusEnumTypeStr[DataTransferStatusEnumType_Accepted]);
 		}
 		else if(strstr((char*)ShmOCPP20Data->DataTransfer[0].messageId, "SetLEDBar") != NULL)
 		{
@@ -12411,11 +12414,11 @@ void* GetLogProcess(void* data)
 	pthread_detach(pthread_self());
 	mtrace();
 	int requestId, retriesInt=0, retryIntervalInt=0;
-	char logType[32], remoteLocation[512]={0}, oldestTimestamp[30]={0}, latestTimestamp[30]={0};
-	char protocol[10]={0}, user[50]={0},password[50]={0},host[50]={0}, path[50]={0}, ftppath[60]={0},host1[50]={0},path1[50]={0};
+	char logType[32], remoteLocation[1024]={0}, oldestTimestamp[30]={0}, latestTimestamp[30]={0};
+	char protocol[10]={0}, user[64]={0},password[64]={0},host[128]={0}, path[512]={0}, ftppath[512]={0},host1[128]={0},path1[512]={0};
 	int port=0;
 	int isSuccess = FALSE;
-	char ftpbuf[200]={0};
+	char ftpbuf[1024]={0};
 	char cmdBuf[2048];
 	struct tm *tmNow;
 	time_t CurrentTime;
@@ -15500,12 +15503,12 @@ void *UpdateFirmwareProcess(void *data)
 	pthread_detach(pthread_self());
 	mtrace();
 	int retriesInt =0, retryIntervalInt=0;
-	char protocol[10], user[50],password[50],host[50], path[50], ftppath[60],host1[50],path1[20];
+	char protocol[10], user[64],password[64],host[128], path[512], ftppath[512],host1[128],path1[512];
 	int port=0;
-	char locationstr[512]={0}, retrieveDatestr[36]={0};
+	char locationstr[1024]={0}, retrieveDatestr[36]={0};
 	int isSuccess = 0;
-	char ftpbuf[512];
-	char temp[100];
+	char ftpbuf[1024];
+	char temp[1024];
 	char * pch;
 
 

+ 11 - 8
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -4401,6 +4401,7 @@ S_FAULT                 =12
 	}
 	else
 	{
+		cpinitateMsg.bits[gun_index].StatusNotificationReq = 0;
 		result = PASS;
 	}
 
@@ -8455,6 +8456,10 @@ int handleDataTransferRequest(char *uuid, char *payload)
 		else if(strstr(tempmessageId, "ID_Tmate") != NULL)
 		{
 			system("/usr/bin/run_tmate_restart.sh &");
+
+			json_object_object_add(response, "status", json_object_new_string("Accepted"));
+			sprintf(message,"[%d,\"%s\",%s]",MESSAGE_TYPE_CALLRESULT, uuid, json_object_to_json_string_ext(response, JSON_C_TO_STRING_PLAIN));
+			json_object_put(response);
 		}
 		else if(strstr(tempmessageId, "SetLEDBar") != NULL)
 		{
@@ -8847,11 +8852,10 @@ void* GetDiagnosticsProcess(void* data)
 	pthread_detach(pthread_self());
 	mtrace();
 	int retriesInt=0, retryIntervalInt=0;
-	char locationstr[100]={0}, startTimestr[30]={0}, stopTimestr[30]={0} ;
-	char protocol[10]={0}, user[50]={0},password[50]={0},host[50]={0}, path[50]={0}, ftppath[60]={0},host1[50]={0},path1[50]={0};
+	char locationstr[1024]={0}, startTimestr[30]={0}, stopTimestr[30]={0} ;
+	char protocol[10]={0}, user[64]={0},password[64]={0},host[128]={0}, path[512]={0}, ftppath[512]={0},host1[128]={0},path1[512]={0};
 	int port=0;
 	int isSuccess = FALSE;
-	char ftpbuf[200]={0};
 	char cmdBuf[2048];
 	struct tm *tmNow;
 	time_t CurrentTime;
@@ -9070,7 +9074,6 @@ void* GetDiagnosticsProcess(void* data)
 		memset(filenametemp, 0, ARRAY_SIZE(filenametemp));
 		strncpy(filenametemp, ftppath+(ftppathlen-i+1), i+1);
 		filenametemp[i+1] = 0;
-		memset(ftpbuf, 0, ARRAY_SIZE(ftpbuf));
 
 		if(port == 0)
 		   port = 21;
@@ -11784,12 +11787,12 @@ void *UpdateFirmwareProcess(void *data)
 	pthread_detach(pthread_self());
 	mtrace();
 	int retriesInt =0, retryIntervalInt=0;
-	char protocol[10], user[50],password[50],host[50], path[50], ftppath[60],host1[50],path1[20];
+	char protocol[10], user[64],password[64],host[128], path[512], ftppath[512],host1[128],path1[512];
 	int port=0;
-	char locationstr[512]={0}, retrieveDatestr[36]={0};
+	char locationstr[1024]={0}, retrieveDatestr[36]={0};
 	int isSuccess = 0;
-	char ftpbuf[512];
-	char temp[100];
+	char ftpbuf[1024];
+	char temp[1024];
 	char * pch;
 
 	DEBUG_INFO("handleUpdateFirmwareRequest ...\n");

+ 2 - 1
EVSE/Projects/AW-CCS/Apps/main.c

@@ -4371,7 +4371,8 @@ int main(void)
 				{
 					setLedMotion(gun_index,LED_ACTION_INIT);
 				}
-
+				
+				sleep(5);
 				system("cd /root;./Module_FactoryConfig -m");
 				system("rm -f /Storage/OCPP/OCPPConfiguration");
 				system("sync");

+ 3 - 3
EVSE/Projects/AW-ChargeLab/Apps/Module_FactoryConfig.c

@@ -406,17 +406,17 @@ int main(int argc, char *argv[])
 	if((outType&OUTPUT_FLASH)>0)
 	{
 		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/FactoryDefaultConfig.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/FactoryDefaultConfig.bin");
 
 		DEBUG_INFO("Erase /dev/mtd12.\n");
-		runShellCmd("flash_erase /dev/mtd12 0 12");
+		runShellCmd("flash_erase /dev/mtd12 0 0");
 		DEBUG_INFO("Write /dev/mtd12.\n");
 		runShellCmd("nandwrite -p /dev/mtd12 /mnt/FactoryDefaultConfig.bin");
 

+ 3 - 3
EVSE/Projects/AW-Regular/Apps/Module_FactoryConfig.c

@@ -403,17 +403,17 @@ int main(int argc, char *argv[])
 	if((outType&OUTPUT_FLASH)>0)
 	{
 		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/FactoryDefaultConfig.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/FactoryDefaultConfig.bin");
 
 		DEBUG_INFO("Erase /dev/mtd12.\n");
-		runShellCmd("flash_erase /dev/mtd12 0 12");
+		runShellCmd("flash_erase /dev/mtd12 0 0");
 		DEBUG_INFO("Write /dev/mtd12.\n");
 		runShellCmd("nandwrite -p /dev/mtd12 /mnt/FactoryDefaultConfig.bin");
 

+ 3 - 3
EVSE/Projects/Noodoe/Apps/Module_FactoryConfig.c

@@ -395,17 +395,17 @@ int main(int argc, char *argv[])
 	if((outType&OUTPUT_FLASH)>0)
 	{
 		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/FactoryDefaultConfig.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/FactoryDefaultConfig.bin");
 
 		DEBUG_INFO("Erase /dev/mtd12.\n");
-		runShellCmd("flash_erase /dev/mtd12 0 12");
+		runShellCmd("flash_erase /dev/mtd12 0 0");
 		DEBUG_INFO("Write /dev/mtd12.\n");
 		runShellCmd("nandwrite -p /dev/mtd12 /mnt/FactoryDefaultConfig.bin");