Browse Source

[Improve][Modularization][Module_OcppBackend / Module_OcppBackend20]

2021.04.01 / Folus Wen

Actions:
1. Call sendStatusNotification() only sign in success.

Files:
1. As follow commit history

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

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 4 years ago
parent
commit
9078c6b44d

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

@@ -5495,7 +5495,7 @@ void CheckSystemValue(void)
 
 		}
 
-		if(isWebsocketSendable &&
+		if(isWebsocketSendable && (server_sign == TRUE) &&
 		   (cpinitateMsg.bits[gun_index].StatusNotificationReq == ON) &&
 		   ((time((time_t*)NULL)-clientTime.StatusNotification[gun_index]) > 5) )
 		{
@@ -15801,6 +15801,7 @@ int TransactionMessageRetryIntervalGet(void)
 
 int httpDownLoadFile(char *location, char *path, char *filename,char *url)
 {
+	int result = TRUE;
 	char rmFileCmd[100]={0};
     char FilePath[100]={0};
 	char ftpbuf[200];
@@ -15826,15 +15827,16 @@ int httpDownLoadFile(char *location, char *path, char *filename,char *url)
 	if(systemresult != 0)
 	{
 		DEBUG_INFO("http DownLoad error!\n");
-		return FALSE;
+		result = FALSE;
 	}
-
 	system("pkill ping");
-	return TRUE;
+
+	return result;
 }
 
 int ftpDownLoadFile(char *location, char *user, char *password, int port, char *path, char *filename,char *url)
 {
+	int result = TRUE;
 	char rmFileCmd[100]={0};
 	char FilePath[100]={0};
 	char ftpbuf[200];
@@ -15862,12 +15864,11 @@ int ftpDownLoadFile(char *location, char *user, char *password, int port, char *
 	if(systemresult != 0)
 	{
 		printf("wget error!\n");
-		return FALSE;
+		result = FALSE;
 	}
-
 	system("pkill ping");
-	return TRUE;
 
+	return result;
 }
 
 int httpUploadFile(char *location, char *path, char *filename,char *url)

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

@@ -2750,7 +2750,7 @@ void CheckSystemValue(void)
 			}// END
 		}
 
-		if(isWebsocketSendable &&
+		if(isWebsocketSendable && (server_sign == TRUE) &&
 			(
 				(statusModeChage[gun_index] == TRUE) ||
 				//((time((time_t*)NULL)-clientTime.StatusNotification[gun_index]) > (server_cycle_Status + (GunStatusInterval*gun_index))) ||
@@ -3597,6 +3597,7 @@ int sendStatusNotificationRequest(int gun_index)
 	char tempdata[65]={0};
 	int tempIndex = 0;
 
+	DEBUG_INFO("sendStatusNotificationRequest...\n");
 	gettimeofday(&tmnow, NULL);
 
 	time_t t;
@@ -14928,6 +14929,7 @@ int ParseHeader(int sock)
 
 int httpDownLoadFile(char *location, char *path, char *filename,char *url)
 {
+	int result = TRUE;
 	char rmFileCmd[100]={0};
     char FilePath[100]={0};
 	char ftpbuf[200];
@@ -14953,15 +14955,16 @@ int httpDownLoadFile(char *location, char *path, char *filename,char *url)
 	if(systemresult != 0)
 	{
 		DEBUG_INFO("http DownLoad error!\n");
-		return FALSE;
+		result = FALSE;
 	}
 	system("pkill ping");
 
-	return TRUE;
+	return result;
 }
 
 int ftpDownLoadFile(char *location, char *user, char *password, int port, char *path, char *filename,char *url)
 {
+	int result = TRUE;
 	char rmFileCmd[100]={0};
 	char FilePath[100]={0};
 	char ftpbuf[200];
@@ -14989,12 +14992,11 @@ int ftpDownLoadFile(char *location, char *user, char *password, int port, char *
 	if(systemresult != 0)
 	{
 		printf("wget error!\n");
-		return FALSE;
+		result = FALSE;
 	}
-
 	system("pkill ping");
-	return TRUE;
 
+	return result;
 }
 
 int httpUploadFile(char *location, char *path, char *filename,char *url)