Przeglądaj źródła

2022-03-30/Jerry Wang
Action:
1. Use reconnect method to place killing task method when pong packet timeout.
2. Set the FirmwareStatusNotification.Status to IDLE during the task initialization.
3. Modify 'tempdata' array size to 1024 in handleDataTransferRequest function.
4. Modify 'description' and 'price' array size to 1024 in StrcutRunningCost, StrcutFinalCost and StrcutSetUserPrice.

File:
1. EVSE/Modularization/ocppfile/Module_OcppBackend.c
--> Action 1
2. EVSE/Modularization/ocppfile/MessageHandler.c
--> Action 2,3
3. EVSE/Modularization/ocppph/Module_OcppBackend20.c
--> Action 1
4. EVSE/Modularization/ocppph/MessageHandler.c
--> Action 2,3
5. EVSE/Modularization/ocpp20/Module_OcppBackend.c
--> Action 1
6. EVSE/Projects/define.h
--> Action 4

Jerry Wang 3 lat temu
rodzic
commit
72aff080d8

+ 4 - 1
EVSE/Modularization/ocpp20/Module_OcppBackend20.c

@@ -981,7 +981,10 @@ void* processWatchdog()
 		if((0 < GetWebSocketPingInterval()) && ((GetWebSocketPingInterval()+5) <= getDiffSecNow(startTime.pingOn)) && (wsi_client != NULL) && (GetServerSign() == TRUE))
 		{
 			DEBUG_WARN("Pong packet receive timeout.\n");
-			system("killall OcppBackend20");
+			//system("killall OcppBackend20");
+			lws_context_destroy(context);
+			ConnectionEstablished = 0;
+			context = NULL;
 		}
 
 		usleep(500000);

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

@@ -4428,6 +4428,7 @@ int InitShareMemory()
 	ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey = staticResponseConfigurationKeyArray;
 	ShmOCPP16Data->GetConfiguration.ResponseUnknownKey = staticResponseUnknownKey;
 	ShmOCPP16Data->SendLocalList.LocalAuthorizationList = staticLocalAuthorizationList;
+	sprintf((char*)ShmOCPP16Data->FirmwareStatusNotification.Status, "%s",FirmwareStatusStr[FirmwareStatus_Idle]);
 
 	//offline MeterValue Interval
 	TempMeterValueInterval = 0;
@@ -10689,7 +10690,7 @@ int handleDataTransferRequest(char *uuid, char *payload)
 	int result = FAIL;
 	char tempvendorId[255]={0};
 	char tempmessageId[50]={0};
-	char tempdata[512]={0};
+	char tempdata[1024]={0};
 	char message[2048]={0};
 
 	DEBUG_INFO("handleDataTransferRequest...\n");

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

@@ -1282,7 +1282,10 @@ void* processWatchdog()
 		if((0 < GetWebSocketPingInterval()) && ((GetWebSocketPingInterval()+5) <= getDiffSecNow(startTime.pingOn)) && (wsi_client != NULL) && (GetServerSign() == TRUE))
 		{
 			DEBUG_WARN("Pong packet receive timeout.\n");
-			system("killall OcppBackend");
+			//system("killall OcppBackend");
+			lws_context_destroy(context);
+			ConnectionEstablished = 0;
+			context = NULL;
 		}
 
 		usleep(500000);

+ 2 - 1
EVSE/Modularization/ocppph/MessageHandler.c

@@ -3946,6 +3946,7 @@ int InitShareMemory()
 	ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey = staticResponseConfigurationKeyArray;
 	ShmOCPP16DataPH->GetConfiguration.ResponseUnknownKey = staticResponseUnknownKey;
 	ShmOCPP16DataPH->SendLocalList.LocalAuthorizationList = staticLocalAuthorizationList;
+	sprintf((char*)ShmOCPP16DataPH->FirmwareStatusNotification.Status, "%s",FirmwareStatusStr[FirmwareStatus_Idle]);
 
 	//offline MeterValue Interval
 	TempMeterValueInterval = 0;
@@ -10227,7 +10228,7 @@ int handleDataTransferRequest(char *uuid, char *payload)
 	int result = FAIL;
 	char tempvendorId[255]={0};
 	char tempmessageId[50]={0};
-	char tempdata[512]={0};
+	char tempdata[1024]={0};
 	char message[2048]={0};
 
 	DEBUG_INFO("handleDataTransferRequest...\n");

+ 4 - 1
EVSE/Modularization/ocppph/Module_OcppBackend.c

@@ -1281,7 +1281,10 @@ void* processWatchdog()
 		if((0 < GetWebSocketPingInterval()) && ((GetWebSocketPingInterval()+5) <= getDiffSecNow(startTime.pingOn)) && (wsi_client != NULL) && (GetServerSign() == TRUE))
 		{
 			DEBUG_WARN("Pong packet receive timeout.\n");
-			system("killall OcppBackendPH");
+			//system("killall OcppBackendPH");
+			lws_context_destroy(context);
+			ConnectionEstablished = 0;
+			context = NULL;
 		}
 
 

+ 3 - 3
EVSE/Projects/define.h

@@ -4403,7 +4403,7 @@ struct OCPP16ConfigurationTable
 struct StrcutSetUserPrice
 {
     unsigned char   idToken[21];
-    unsigned char   price[256];
+    unsigned char   price[1024];
 };
 
 struct ChargingPrice
@@ -4447,13 +4447,13 @@ struct StrcutRunningCost
     struct IdlePrice        idlePrice;              // (optional) Price components while not charging. Optional if no idle fee is charged.
     struct NextPeriod       nextPeriod;             // (optional) Pricing for next period
     struct Triggers         triggerMeterValue;      // (optional) Triggers to request a new meter value. Optional if no idle fee charged.
-    unsigned char           description[256];       // Compatible California pricing V1.0
+    unsigned char           description[1024];       // Compatible California pricing V1.0
 };
 
 struct StrcutFinalCost
 {
     int             txId;
-    unsigned char   description[256];
+    unsigned char   description[1024];
 };
 
 struct StructCost