Răsfoiți Sursa

[Improve][Modularization][Module_OcppBackend]

2021.04.21 / Folus Wen

Actions:
1. After uploaded log file report DiagnosticsStatus_Idle to server.
2. Report StatusNotification to server don't consider connector state exchange logic.

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 ani în urmă
părinte
comite
28170519a5

+ 2 - 2
EVSE/Modularization/ocpp20/JsonParser.c

@@ -41,7 +41,7 @@ static char *requestNames[] = { "CancelReservation",
 								"Reset",
 								"SendLocalList",
 								"SetChargingProfile",
-								"SetDisplayMessage",
+								"SetDisplayMessages",
 								"SetMonitoringBase",
 								"SetMonitoringLevel",
 								"SetNetworkProfile",
@@ -135,7 +135,7 @@ static FunCallPtr funcalls[] = {handleCancelReservationRequest,
 								handleResetRequest,
 								handleSendLocalListRequest,
 								handleSetChargingProfileRequest,
-								handleSetDisplayMessageRequest,
+								handleSetDisplayMessagesRequest,
 								handleSetMonitoringBaseRequest,
 								handleSetMonitoringLevelRequest,
 								handleSetNetworkProfileRequest,

+ 59 - 11
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -5190,6 +5190,46 @@ void CheckSystemValue(void)
 		sendAuthorizeRequest(0);
 	}
 
+
+	if(isWebsocketSendable &&
+		   (server_sign == TRUE) &&
+		   (ShmOCPP20Data->GetMonitoringReport.requestId > 0))
+	{
+		for(uint8_t idxCriterion=0;idxCriterion<ARRAY_SIZE(ShmOCPP20Data->GetMonitoringReport.monitoringCriteria);idxCriterion++)
+		{
+			if(strcmp((char*)ShmOCPP20Data->GetMonitoringReport.monitoringCriteria[idxCriterion],  MonitoringCriterionEnumTypeStr[MonitoringCriterionEnumType_ThresholdMonitoring]) == 0)
+			{
+				/*
+				 * TODO:
+				 * 	1. Report component that are ThresholdMonitoring
+				 */
+			}
+			else if(strcmp((char*)ShmOCPP20Data->GetMonitoringReport.monitoringCriteria[idxCriterion], MonitoringCriterionEnumTypeStr[MonitoringCriterionEnumType_DeltaMonitoring]) == 0)
+			{
+				/*
+				 * TODO:
+				 * 	1. Report component that are DeltaMonitoring
+				 */
+			}
+			else if(strcmp((char*)ShmOCPP20Data->GetMonitoringReport.monitoringCriteria[idxCriterion], MonitoringCriterionEnumTypeStr[MonitoringCriterionEnumType_PeriodicMonitoring]) == 0)
+			{
+				/*
+				 * TODO:
+				 * 	1. Report component that are PeriodicMonitoring
+				 */
+			}
+			else
+			{
+				/*
+				 * TODO:
+				 * 	1. Process unknown criteria condition
+				 */
+			}
+		}
+
+		ShmOCPP20Data->GetMonitoringReport.requestId = 0;
+	}
+
 	if(isWebsocketSendable &&
 	   (server_sign == TRUE) &&
 	   (ShmOCPP20Data->GetReport.requestId > 0))
@@ -5339,15 +5379,24 @@ void CheckSystemValue(void)
 	{
 		if(strcmp((char*)ShmOCPP20Data->Get15118EVCertificate.action, CertificateActionEnumTypeStr[CertificateActionEnumType_Install]) == 0)
 		{
-
+			/*
+			 *	TODO:
+			 *		1.
+			 */
 		}
 		else if(strcmp((char*)ShmOCPP20Data->Get15118EVCertificate.action, CertificateActionEnumTypeStr[CertificateActionEnumType_Update]) == 0)
 		{
-
+			/*
+			 *	TODO:
+			 *		1.
+			 */
 		}
 		else
 		{
-
+			/*
+			 *	TODO:
+			 *		1.
+			 */
 		}
 
 		sendGet15118EVCertificateRequest();
@@ -5355,8 +5404,6 @@ void CheckSystemValue(void)
 	}
 
 
-
-
 	//===============================
 	// Each connector operation check
 	//===============================
@@ -9893,7 +9940,7 @@ int sendSetChargingProfileConfirmation(char *uuid, unsigned char gun_index)
 	return result;
 }
 
-int sendSetDisplayMessageConfirmation(char *uuid)
+int sendSetDisplayMessagesConfirmation(char *uuid)
 {
 	mtrace();
 	int result = FAIL;
@@ -12132,10 +12179,11 @@ int handleGetDisplayMessagesRequest(char *uuid, char *payload)
 			{
 				ShmOCPP20Data->GetDisplayMessages.id[idx] = json_object_get_int(json_object_array_get_idx(json_object_object_get(GetDisplayMessages, "id"), idx));
 			}
-			strcpy((char*)ShmOCPP20Data->GetInstalledCertificateIds.Response_status, GetDisplayMessagesStatusEnumTypeStr[GetDisplayMessagesStatusEnumType_Accepted]);
+			strcpy((char*)ShmOCPP20Data->GetDisplayMessages.Response_status, GetDisplayMessagesStatusEnumTypeStr[GetDisplayMessagesStatusEnumType_Accepted]);
+			ShmOCPP20Data->MsMsg.bits.GetDisplayMessagesReq = ON;
 		}
 		else
-			strcpy((char*)ShmOCPP20Data->GetInstalledCertificateIds.Response_status, GetDisplayMessagesStatusEnumTypeStr[GetDisplayMessagesStatusEnumType_Unknown]);
+			strcpy((char*)ShmOCPP20Data->GetDisplayMessages.Response_status, GetDisplayMessagesStatusEnumTypeStr[GetDisplayMessagesStatusEnumType_Unknown]);
 	}
 	json_object_put(GetDisplayMessages);
 
@@ -14449,7 +14497,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
 	return result;
 }
 
-int handleSetDisplayMessageRequest(char *uuid, char *payload)
+int handleSetDisplayMessagesRequest(char *uuid, char *payload)
 {
 	mtrace();
 	int result = FAIL;
@@ -14516,9 +14564,9 @@ int handleSetDisplayMessageRequest(char *uuid, char *payload)
 	json_object_put(SetDisplayMessage);
 
 	strcpy((char*)ShmOCPP20Data->SetDisplayMessage.Response_status, DisplayMessageStatusEnumTypeStr[DisplayMessageStatusEnumType_Accepted]);
-	sendSetMonitoringBaseConfirmation(uuid);
+	sendSetDisplayMessagesConfirmation(uuid);
 
-	// Anouce CSU there is display request come from server
+	// Announce CSU there is display request come from server
 	ShmOCPP20Data->MsMsg.bits.SetDisplayMessageReq = ON;
 
 	return result;

+ 3 - 3
EVSE/Modularization/ocpp20/MessageHandler.h

@@ -871,7 +871,7 @@ int sendDeleteCertificateConfirmation(char *uuid);
 int sendGetBaseReportConfirmation(char *uuid);
 int sendGetChargingProfilesConfirmation(char *uuid, unsigned char gun_index);
 int sendGetCompositeScheduleConfirmation(char *uuid,char *payload, int connectorIdInt,int nPeriod);
-int sendGetGetDisplayMessagesConfirmation(char *uuid);
+int sendGetDisplayMessagesConfirmation(char *uuid);
 int sendGetInstalledCertificateIdsConfirmation(char *uuid, unsigned char certQuantity);
 int sendGetLocalListVersionConfirmation(char *uuid);
 int sendGetLogConfirmation(char *uuid);
@@ -887,7 +887,7 @@ int sendReserveNowConfirmation(char *uuid, unsigned char gun_index);
 int sendResetConfirmation(char *uuid);
 int sendSendLocalListConfirmation(char *uuid);
 int sendSetChargingProfileConfirmation(char *uuid, unsigned char gun_index);
-int sendSetDisplayMessageConfirmation(char *uuid);
+int sendSetDisplayMessagesConfirmation(char *uuid);
 int sendSetMonitoringBaseConfirmation(char *uuid);
 int sendSetMonitoringLevelConfirmation(char *uuid);
 int sendSetNetworkProfileConfirmation(char *uuid);
@@ -937,7 +937,7 @@ int handleReserveNowRequest(char *uuid, char *payload);
 int handleResetRequest(char *uuid, char *payload);
 int handleSendLocalListRequest(char *uuid, char *payload);
 int handleSetChargingProfileRequest(char *uuid, char *payload);
-int handleSetDisplayMessageRequest(char *uuid, char *payload);
+int handleSetDisplayMessagesRequest(char *uuid, char *payload);
 int handleSetMonitoringBaseRequest(char *uuid, char *payload);
 int handleSetMonitoringLevelRequest(char *uuid, char *payload);
 int handleSetNetworkProfileRequest(char *uuid, char *payload);

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

@@ -4333,10 +4333,12 @@ S_FAULT                 =12
 	}
 
 	//it's option
-	if(strstr((char *)ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[currentStatus]) != NULL)
+	if((strstr((char *)ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[currentStatus]) != NULL) &&
+		!ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq)
 	{
 		isStateChanged = FALSE;
 	}
+	ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq = 0;
 
 	strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].Timestamp, buf);
 	strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].VendorId, (char*)ShmSysConfigAndInfo->SysConfig.chargePointVendor);
@@ -9061,8 +9063,10 @@ void* GetDiagnosticsProcess(void* data)
 	}
 
 end:
-	DiagnosticsStatusNotificationStatus = DIAGNOSTIC_STATUS_IDLE;
 	system("rm -f /mnt/*");
+	sleep(5);
+	sprintf((char*)ShmOCPP16Data->DiagnosticsStatusNotification.Status, "%s", DiagnosticsStatusStr[DiagnosticsStatus_Idle]);
+	ShmOCPP16Data->SpMsg.bits.DiagnosticsStatusNotificationReq = 1;
 	pthread_exit(NULL);
 }
 
@@ -11555,13 +11559,17 @@ int handleTriggerMessageRequest(char *uuid, char *payload)
 		{
 			if((connectorIdInt > 0) && ((connectorIdInt -1) < gunTotalNumber))
 			{
+				ShmOCPP16Data->CsMsg.bits[connectorIdInt-1].TriggerMessageReq = 1;
 				cpinitateMsg.bits[connectorIdInt -1].StatusNotificationReq = 1;
 			}
 		}
 		else
 		{
 			for(int idx=0;idx< gunTotalNumber;idx++)
+			{
+				ShmOCPP16Data->CsMsg.bits[idx].TriggerMessageReq = 1;
 				cpinitateMsg.bits[idx].StatusNotificationReq = 1;
+			}
 		}
 	}