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

[Improve][Modularization][Module_OcppBackend]

2021.01.20 / Folus Wen

Actions:
1. Set OcppConnStatus to false when change "SecurityProfile" configuration key.
2. Call lws_service() wehn OcppConnStatus is true.

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

+ 2 - 23
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -4820,27 +4820,6 @@ int ProcessShareMemory()
 }
 
 //---------------------common routine---------------------------//
-int isOFFline(void)
-{
-	if(ShmSysConfigAndInfo->SysInfo.InternetConn == 0)
-	{
-		if(TempMeterValueInterval >=  2  )
-		{
-			TempMeterValueInterval = 0;
-			return TRUE;
-		}
-		else
-		{
-			TempMeterValueInterval = TempMeterValueInterval+ 1;
-			return FALSE;
-		}
-	}
-	else
-	{
-		return FALSE;
-	}
-}
-
 void checkNetworkProfile(void)
 {
 	uint8_t isGetProfile = FALSE;
@@ -15898,7 +15877,7 @@ void LWS_Send(char * str)
 	//=====================================================
 	// Check InternetConn 0: disconnected, 1: connected
 	//====================================================
-	if(ShmSysConfigAndInfo->SysInfo.InternetConn == 0)
+	if(GetOcppConnStatus() == 0)
 	{
 		DEBUG_INFO("offline  now !!!\n");
 		return;
@@ -15920,7 +15899,7 @@ void LWS_SendNow(char * str)
 	//=====================================================
 	// Check InternetConn 0: disconnected, 1: connected
 	//====================================================
-	if(ShmSysConfigAndInfo->SysInfo.InternetConn == 0)
+	if(GetOcppConnStatus() == 0)
 	{
 		DEBUG_INFO("offline  now !!!\n");
 		return;

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

@@ -2223,27 +2223,6 @@ int ProcessShareMemory()
 }
 
 //---------------------common routine---------------------------//
-int isOFFline(void)
-{
-	if(ShmSysConfigAndInfo->SysInfo.InternetConn == 0)
-	{
-		if(TempMeterValueInterval >=  2  )
-		{
-			TempMeterValueInterval = 0;
-			return TRUE;
-		}
-		else
-		{
-			TempMeterValueInterval = TempMeterValueInterval+ 1;
-			return FALSE;
-		}
-	}
-	else
-	{
-		return FALSE;
-	}
-}
-
 //---------------------------------------------
 //  new:
 //  enum SYSTEM_STATUS
@@ -2805,8 +2784,7 @@ void CheckSystemValue(void)
 		}
 
 		// Sample period MeterValue
-		if(/*(server_sign == TRUE) &&(isOFFline() == TRUE) ||*/
-		   (((time((time_t*)NULL) - clientTime.MeterValues[gun_index]) > (atoi((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValueSampleInterval].ItemData)- 1))))
+		if((((time((time_t*)NULL) - clientTime.MeterValues[gun_index]) > (atoi((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValueSampleInterval].ItemData)- 1))))
 		{
 			//check Transaction active
 			if(gunType[gun_index] == 'J')
@@ -6830,7 +6808,7 @@ int handleChangeConfigurationRequest(char *uuid, char *payload)
 
 	if((strcmp(keystr,"SecurityProfile")==0)&&(strcmp(comfirmstr,"Accepted")==0))
 	{
-		ShmSysConfigAndInfo->SysInfo.InternetConn = 0;
+		SetOcppConnStatus(FALSE);
 	}
 
 	return result;

+ 1 - 1
EVSE/Modularization/ocppfiles/Module_OcppBackend.c

@@ -1533,7 +1533,7 @@ int main(void)
 		do
 		{
 			lws_service(context, 0);//timeout_ms
-		}while((SendBufLen>0) && (context!=NULL) && GetInternetConn());
+		}while((SendBufLen>0) && (context!=NULL) && GetOcppConnStatus());
 		usleep(100000);
 	}
 	pthread_join(tid_ProcQueue, NULL);

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

@@ -1640,8 +1640,7 @@ void InitEthernet()
 
 			if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet &&
 			   ((ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 0) || ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi) &&
-			   ((ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled == 0) || ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi) &&
-			   (ocpp_get_connection_status() != PASS))
+			   ((ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled == 0) || ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi))
 			{
 				ShmSysConfigAndInfo->SysInfo.InternetConn = OFF;
 			}