Ver Fonte

[Add][Modularization][Module_OcppBackend]

2021.04.15 / Folus Wen

Actions:
1. define.h add security message related variable to share memory.
2. OCPP 1.6 security message implement.
2. StatusNotification improve duplicate state message to server issue.

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 há 4 anos atrás
pai
commit
eac08165d5

+ 4 - 3
EVSE/Modularization/ocpp20/JsonParser.c

@@ -274,6 +274,7 @@ void ReceivedMessage(void *in, size_t len)
 
 int CallHandler(char *uuid, char *str1,char *payload)
 {
+	int result = FAIL;
 	int CallHandlerNumber = 0;
     int CallHandlerIndex = (ARRAY_SIZE(requestNames)-1);
     int (*callfptr)(char *uuid,char *payload);
@@ -296,12 +297,12 @@ int CallHandler(char *uuid, char *str1,char *payload)
 	if ( callfptr )
 	{
 		callfptr(uuid, payload);
-		callfptr = NULL;
-		return PASS;
+		result = PASS;
 	}
 
 	callfptr = NULL;
-	return FAIL;
+
+	return result;
 }
 
 void CallResultHandler(char *str1, char *payload, int gun_index)

+ 1 - 1
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -7912,7 +7912,7 @@ int sendSecurityEventNotificationRequest()
 
 	json_object_object_add(SecurityEventNotification, "type", json_object_new_string((char*)ShmOCPP20Data->SecurityEventNotification.type));
 	json_object_object_add(SecurityEventNotification, "timestamp", json_object_new_string((char*)ShmOCPP20Data->SecurityEventNotification.timestamp));
-	json_object_object_add(SecurityEventNotification, "techInfo", json_object_new_string((char*)ShmOCPP20Data->SecurityEventNotification.techinfo));
+	json_object_object_add(SecurityEventNotification, "techInfo", json_object_new_string((char*)ShmOCPP20Data->SecurityEventNotification.techInfo));
 
 	random_uuid(guid);
 	sprintf(message,"[%d,\"%s\",\"%s\",%s]",MESSAGE_TYPE_CALL, guid, "SecurityEventNotification", json_object_to_json_string_ext(SecurityEventNotification, JSON_C_TO_STRING_PLAIN));

+ 27 - 6
EVSE/Modularization/ocppfiles/JsonParser.c

@@ -30,6 +30,13 @@ static char *requestNames[] = { "CancelReservation",
 								"TriggerMessage",
 								"UnlockConnector",
 								"UpdateFirmware",
+								"CertificateSigned",
+								"DeleteCertificate",
+								"ExtendedTriggerMessage",
+								"GetInstalledCertificateIds",
+								"GetLog",
+								"InstallCertificate",
+								"SignedUpdateFirmware",
 								"Unknown"};
 
 static char *responseNames[] = {"Authorize",
@@ -41,7 +48,11 @@ static char *responseNames[] = {"Authorize",
 								"MeterValues",
 								"StartTransaction",
 								"StatusNotification",
-								"StopTransaction" };
+								"StopTransaction",
+								"LogStatusNotification",
+								"SecurityEventNotification",
+								"SignCertificate",
+								"SignedFirmwareStatusNotification"};
 
 static FunPtr funs[] = {handleAuthorizeResponse,
 						handleBootNotificationResponse,
@@ -52,7 +63,11 @@ static FunPtr funs[] = {handleAuthorizeResponse,
 						handleMeterValuesResponse,
 						handleStartTransactionResponse,
 						handleStatusNotificationResponse,
-						handleStopTransactionnResponse };
+						handleStopTransactionnResponse,
+						handleLogStatusNotificationResponse,
+						handleSecurityEventNotificationResponse,
+						handleSignCertificateResponse,
+						handleSignedFirmwareStatusNotificationResponse};
 
 static FunCallPtr funcalls[] = {handleCancelReservationRequest,
 								handleChangeAvailabilityRequest,
@@ -73,9 +88,15 @@ static FunCallPtr funcalls[] = {handleCancelReservationRequest,
 								handleTriggerMessageRequest,
 								handleUnlockConnectorRequest,
 								handleUpdateFirmwareRequest,
+								handleCertificateSignedRequest,
+								handleDeleteCertificateRequest,
+								handleExtendedTriggerMessageRequest,
+								handleGetInstalledCertificateIdsRequest,
+								handleGetLogRequest,
+								handleInstallCertificateRequest,
+								handleSignedUpdateFirmwareRequest,
 								handleUnknownRequest};
 
-
 static FunCallErrorPtr funcallerror[] = {	handleError	};
 
 //==========================================
@@ -203,6 +224,7 @@ void ReceivedMessage(void *in, size_t len)
 
 int CallHandler(char *uuid, char *str1,char *payload)
 {
+	int result = FAIL;
 	int CallHandlerNumber = 0;
     int CallHandlerIndex = (ARRAY_SIZE(requestNames)-1);
     int (*callfptr)(char *uuid,char *payload);
@@ -225,12 +247,11 @@ int CallHandler(char *uuid, char *str1,char *payload)
 	if ( callfptr )
 	{
 		callfptr(uuid, payload);
-		callfptr = NULL;
-		return PASS;
+		result = PASS;
 	}
 
 	callfptr = NULL;
-	return FAIL;
+	return result;
 }
 
 void CallResultHandler(char *str1, char *payload, int gun_index)

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

@@ -3979,6 +3979,7 @@ int sendStatusNotificationRequest(int gun_index)
 	char buf[28];//, usec_buf[6];
 	char tempdata[65]={0};
 	int tempIndex = 0;
+	uint8_t isStateChanged = TRUE;
 
 	DEBUG_INFO("sendStatusNotificationRequest...\n");
 	gettimeofday(&tmnow, NULL);
@@ -4319,6 +4320,11 @@ S_FAULT                 =12
 	}
 
 	//it's option
+	if(strstr((char *)ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[currentStatus]) != NULL)
+	{
+		isStateChanged = FALSE;
+	}
+
 	strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].Timestamp, buf);
 	strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].VendorId, (char*)ShmSysConfigAndInfo->SysConfig.chargePointVendor);
 	strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[currentStatus]);
@@ -4336,7 +4342,7 @@ S_FAULT                 =12
 					, ShmOCPP16Data->StatusNotification[gun_index].VendorId
 					, ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode);
 
-	if((server_sign == TRUE))
+	if((server_sign == TRUE) && isStateChanged)
 	{
 		LWS_Send(message);
 
@@ -6215,6 +6221,133 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	return result;
 }
 
+int sendLogStatusNotificationRequest(char *status)
+{
+	mtrace();
+	int result = PASS;
+	char message[4096]={0};
+	char guid[37]={0};
+	char tempdata[128]={0};
+	json_object *LogStatusNotification = json_object_new_object();
+
+	DEBUG_INFO("sendLogStatusNotificationRequest...\n");
+	ShmOCPP16Data->LogStatusNotification.requestId = ShmOCPP16Data->GetLog.requestId;
+	sprintf((char *)ShmOCPP16Data->LogStatusNotification.status,"%s",(const char *)status);
+
+	json_object_object_add(LogStatusNotification, "status", json_object_new_string((char*)ShmOCPP16Data->LogStatusNotification.status));
+	json_object_object_add(LogStatusNotification, "requestId", json_object_new_int(ShmOCPP16Data->LogStatusNotification.requestId));
+
+	random_uuid(guid);
+	sprintf(message,"[%d,\"%s\",\"LogStatusNotification\",%s]",MESSAGE_TYPE_CALL, guid, json_object_to_json_string_ext(LogStatusNotification, JSON_C_TO_STRING_PLAIN));
+	json_object_put(LogStatusNotification);
+	LWS_SendNow(message);
+
+	sprintf(tempdata, "LogStatusNotification,%d", 0);
+
+	if(hashmap_operation(HASH_OP_ADD, guid, tempdata) == PASS)
+	{
+		result = PASS;
+	}
+
+	ShmOCPP16Data->SpMsg.bits.LogStatusNotificationReq = 0;
+	ShmOCPP16Data->SpMsg.bits.LogStatusNotificationConf = 0;
+
+	return result;
+}
+
+int sendSecurityEventNotificationRequest(int gun_index)
+{
+	mtrace();
+	int result = PASS;
+	char message[4096]={0};
+	char guid[37]={0};
+	char tempdata[128]={0};
+	json_object *SecurityEventNotification = json_object_new_object();
+	DEBUG_INFO("sendSecurityEventNotificationRequest...\n");
+
+	json_object_object_add(SecurityEventNotification, "type", json_object_new_string((char*)ShmOCPP16Data->SecurityEventNotification.type));
+	json_object_object_add(SecurityEventNotification, "timestamp", json_object_new_string((char*)ShmOCPP16Data->SecurityEventNotification.timestamp));
+	json_object_object_add(SecurityEventNotification, "techInfo", json_object_new_string((char*)ShmOCPP16Data->SecurityEventNotification.techInfo));
+
+	random_uuid(guid);
+	sprintf(message,"[%d,\"%s\",\"%s\",%s]",MESSAGE_TYPE_CALL, guid, "SecurityEventNotification", json_object_to_json_string_ext(SecurityEventNotification, JSON_C_TO_STRING_PLAIN));
+	json_object_put(SecurityEventNotification);
+	LWS_Send(message);
+
+	sprintf(tempdata, "SecurityEventNotification,0");
+	if(hashmap_operation(HASH_OP_ADD, guid, tempdata) == PASS)
+	{
+		result = PASS;
+	}
+
+	ShmOCPP16Data->SpMsg.bits.SecurityEventNotificationReq = 0;
+	ShmOCPP16Data->SpMsg.bits.SecurityEventNotificationConf = 0;
+
+	return result;
+}
+
+int sendSignCertificateRequest(int gun_index)
+{
+	mtrace();
+	int result = PASS;
+	char message[4096]={0};
+	char guid[37]={0};
+	char tempdata[128]={0};
+	json_object *SignCertificate = json_object_new_object();
+	DEBUG_INFO("sendSignCertificateRequest...\n");
+
+	json_object_object_add(SignCertificate, "csr", json_object_new_string((char*)ShmOCPP16Data->SignCertificate.csr));
+
+	random_uuid(guid);
+	sprintf(message,"[%d,\"%s\",\"%s\",%s]",MESSAGE_TYPE_CALL, guid, "SignCertificate", json_object_to_json_string_ext(SignCertificate, JSON_C_TO_STRING_PLAIN));
+	json_object_put(SignCertificate);
+	LWS_Send(message);
+
+	sprintf(tempdata, "SignCertificate,0");
+	if(hashmap_operation(HASH_OP_ADD, guid, tempdata) == PASS)
+	{
+		result = PASS;
+	}
+	ShmOCPP16Data->SpMsg.bits.SignCertificateReq = 0;
+	ShmOCPP16Data->SpMsg.bits.SignCertificateConf = 0;
+
+	return result;
+}
+
+int sendSignedFirmwareStatusNotificationRequest(char *status)
+{
+	mtrace();
+	int result = PASS;
+	char message[110]={0};
+	char guid[37]={0};
+	char tempdata[65]={0};
+	json_object *FirmwareStatusNotification = json_object_new_object();
+	DEBUG_INFO("sendSignedFirmwareStatusNotificationRequest...\n");
+
+	sprintf((char *)ShmOCPP16Data->SignedFirmwareStatusNotification.status , "%s", (const char *)status);
+	ShmOCPP16Data->SignedFirmwareStatusNotification.requestId = ShmOCPP16Data->SignedUpdateFirmware.requestId;
+
+	json_object_object_add(FirmwareStatusNotification, "status", json_object_new_string((char*)ShmOCPP16Data->SignedFirmwareStatusNotification.status));
+	json_object_object_add(FirmwareStatusNotification, "requestId", json_object_new_int(ShmOCPP16Data->SignedFirmwareStatusNotification.requestId));
+
+	random_uuid(guid);
+	sprintf(message,"[%d,\"%s\",\"FirmwareStatusNotification\",%s]",MESSAGE_TYPE_CALL, guid, json_object_to_json_string_ext(FirmwareStatusNotification, JSON_C_TO_STRING_PLAIN));
+	json_object_put(FirmwareStatusNotification);
+	LWS_SendNow(message);
+
+	sprintf(tempdata, "FirmwareStatusNotification,%d", 0);
+
+	if(hashmap_operation(HASH_OP_ADD, guid, tempdata) == PASS)
+	{
+		result = PASS;
+	}
+
+	ShmOCPP16Data->SpMsg.bits.SignedFirmwareStatusNotificationReq = 0;
+	ShmOCPP16Data->SpMsg.bits.SignedFirmwareStatusNotificationConf = 0;
+
+	return result;
+}
+
 //==========================================
 // send confirm routine
 //==========================================
@@ -6647,21 +6780,197 @@ int sendUpdateFirmwareConfirmation(char *uuid)
 	return result;
 }
 
-int sendUnknownConfirmation(char *uuid)
+int sendCertificateSignedConfirmation(char *uuid)
 {
 	mtrace();
-	int result = FAIL;
+	int result = PASS;
+	char message[4096]={0};
+	json_object *CertificateSigned = json_object_new_object();
+
+	DEBUG_INFO("sendCertificateSignedConfirmation...\n");
+
+	json_object_object_add(CertificateSigned, "status", json_object_new_string((char*)ShmOCPP16Data->CertificateSigned.Response_status));
+
+	sprintf(message,"[%d,\"%s\",%s]"
+								,MESSAGE_TYPE_CALLRESULT
+								,uuid
+								,json_object_to_json_string_ext(CertificateSigned, JSON_C_TO_STRING_PLAIN));
+
+	json_object_put(CertificateSigned);
+	LWS_Send(message);
+
+	return result;
+}
+
+int sendDeleteCertificateConfirmation(char *uuid)
+{
+	mtrace();
+	int result = PASS;
+	char message[4096]={0};
+	json_object *DeleteCertificate = json_object_new_object();
+
+	DEBUG_INFO("sendDeleteCertificateConfirmation...\n");
+
+	json_object_object_add(DeleteCertificate, "status", json_object_new_string((char*)ShmOCPP16Data->DeleteCertificate.Response_status));
+
+	sprintf(message,"[%d,\"%s\",%s]"
+								,MESSAGE_TYPE_CALLRESULT
+								,uuid
+								,json_object_to_json_string_ext(DeleteCertificate, JSON_C_TO_STRING_PLAIN));
+
+	json_object_put(DeleteCertificate);
+	LWS_Send(message);
+
+	return result;
+}
+
+int sendExtendedTriggerMessageConfirmation(char *uuid)
+{
+	mtrace();
+	int result = PASS;
+	char message[4096]={0};
+	json_object *ExtendedTriggerMessage = json_object_new_object();
+
+	DEBUG_INFO("sendExtendedTriggerMessageConfirmation...\n");
+
+	json_object_object_add(ExtendedTriggerMessage, "status", json_object_new_string((char*)ShmOCPP16Data->ExtendedTriggerMessage.Response_status));
+
+	sprintf(message,"[%d,\"%s\",%s]"
+								,MESSAGE_TYPE_CALLRESULT
+								,uuid
+								,json_object_to_json_string_ext(ExtendedTriggerMessage, JSON_C_TO_STRING_PLAIN));
+
+	json_object_put(ExtendedTriggerMessage);
+	LWS_Send(message);
 
+	return result;
+}
+
+int sendGetInstalledCertificateIdsConfirmation(char *uuid)
+{
+	mtrace();
+	int result = PASS;
+	char message[4096]={0};
+	json_object *GetInstalledCertificateIds = json_object_new_object();
+	json_object *certificateHashDataDatas = json_object_new_array();
+
+	DEBUG_INFO("sendGetInstalledCertificateIdsConfirmation...\n");
+
+	json_object_object_add(GetInstalledCertificateIds, "status", json_object_new_string((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_status));
+
+	if(strlen((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData[0].hashAlgorithm) > 0)
+	{
+		for(int idx=0;idx<ARRAY_SIZE(ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData);idx++)
+		{
+			json_object *certificateHashData = json_object_new_object();
+
+			json_object_object_add(certificateHashData, "hashAlgorithm", json_object_new_string((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData[idx].hashAlgorithm));
+			json_object_object_add(certificateHashData, "issuerNameHash", json_object_new_string((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData[idx].issuerNameHash));
+			json_object_object_add(certificateHashData, "issuerKeyHash", json_object_new_string((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData[idx].issuerKeyHash));
+			json_object_object_add(certificateHashData, "serialNumber", json_object_new_string((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData[idx].serialNumber));
+
+			json_object_array_add(certificateHashDataDatas, certificateHashData);
+		}
+		json_object_object_add(GetInstalledCertificateIds , "certificateHashData", certificateHashDataDatas);
+	}
+	else
+	{
+		json_object_put(certificateHashDataDatas);
+	}
+
+	sprintf(message,"[%d,\"%s\",%s]"
+								,MESSAGE_TYPE_CALLRESULT
+								,uuid
+								,json_object_to_json_string_ext(GetInstalledCertificateIds, JSON_C_TO_STRING_PLAIN));
+
+	json_object_put(GetInstalledCertificateIds);
+	LWS_Send(message);
+
+	return result;
+}
+
+int sendGetLogConfirmation(char *uuid)
+{
+	mtrace();
+	int result = PASS;
+	char message[4096]={0};
+	json_object *GetLog = json_object_new_object();
+
+	DEBUG_INFO("sendGetLogConfirmation...\n");
+
+	json_object_object_add(GetLog, "status", json_object_new_string((char*)ShmOCPP16Data->GetLog.Response_status));
+
+	if(strlen((char*)ShmOCPP16Data->GetLog.Response_filename) > 0)
+		json_object_object_add(GetLog, "filename", json_object_new_string((char*)ShmOCPP16Data->GetLog.Response_filename));
+
+	sprintf(message,"[%d,\"%s\",%s]"
+								,MESSAGE_TYPE_CALLRESULT
+								,uuid
+								,json_object_to_json_string_ext(GetLog, JSON_C_TO_STRING_PLAIN));
+
+	json_object_put(GetLog);
+	LWS_Send(message);
+
+	return result;
+}
+
+int sendInstallCertificateConfirmation(char *uuid)
+{
+	mtrace();
+	int result = PASS;
+	char message[4096]={0};
+	json_object *InstallCertificate = json_object_new_object();
+
+	DEBUG_INFO("sendInstallCertificateConfirmation...\n");
+
+	json_object_object_add(InstallCertificate, "status", json_object_new_string((char*)ShmOCPP16Data->InstallCertificate.Response_status));
+
+	sprintf(message,"[%d,\"%s\",%s]"
+								,MESSAGE_TYPE_CALLRESULT
+								,uuid
+								,json_object_to_json_string_ext(InstallCertificate, JSON_C_TO_STRING_PLAIN));
+
+	json_object_put(InstallCertificate);
+	LWS_Send(message);
+
+	return result;
+}
+
+int sendSignedUpdateFirmwareConfirmation(char *uuid)
+{
+	mtrace();
+	int result = PASS;
+	char message[4096]={0};
+	json_object *SignedUpdateFirmware = json_object_new_object();
+
+	DEBUG_INFO("sendSignedUpdateFirmwareConfirmation...\n");
+
+	json_object_object_add(SignedUpdateFirmware, "status", json_object_new_string((char*)ShmOCPP16Data->SignedUpdateFirmware.Response_status));
+
+	sprintf(message,"[%d,\"%s\",%s]"
+								,MESSAGE_TYPE_CALLRESULT
+								,uuid
+								,json_object_to_json_string_ext(SignedUpdateFirmware, JSON_C_TO_STRING_PLAIN));
+
+	json_object_put(SignedUpdateFirmware);
+	LWS_Send(message);
+
+	return result;
+}
+
+int sendUnknownConfirmation(char *uuid)
+{
+	mtrace();
+	int result = PASS;
 	char message[256]={0};
 
-	//[ 3, "ba1cbd49-2a76-493a-8f76-fa23e7606532", { "status": "Unlocked" } ]
 	DEBUG_INFO("sendUnknownConfirmation...\n");
 	sprintf(message,"[%d,\"%s\",\"NotImplemented\",\"Requested Action is not known by receiver\",{}]", MESSAGE_TYPE_CALLERROR, uuid);
 	LWS_Send(message);
-	result = TRUE;
 
 	return result;
 }
+
 //==========================================
 // Handle server request routine  Start
 //==========================================
@@ -11568,10 +11877,268 @@ void *UpdateFirmwareProcess(void *data)
 
 }
 
+int handleCertificateSignedRequest(char *uuid, char *payload)
+{
+	mtrace();
+	int result = PASS;
+	json_object *CertificateSigned;
+
+	DEBUG_INFO("handleCertificateSignedRequest...\n");
+	CertificateSigned = json_tokener_parse(payload);
+	if(!is_error(CertificateSigned))
+	{
+		sprintf((char*)ShmOCPP16Data->CertificateSigned.certificateChain, "%s", json_object_get_string(json_object_object_get(CertificateSigned, "certificateChain")));
+
+		/*
+		 *	TODO: CertificateSigned process
+		 */
+		ShmOCPP16Data->MsMsg.bits.CertificateSignedReq = 1;
+		DEBUG_INFO("certificateChain: %s\n", ShmOCPP16Data->CertificateSigned.certificateChain);
+
+		sprintf((char*)ShmOCPP16Data->CertificateSigned.Response_status, "Rejected");
+		sendCertificateSignedConfirmation(uuid);
+	}
+	json_object_put(CertificateSigned);
+
+	return result;
+}
+
+int handleDeleteCertificateRequest(char *uuid, char *payload)
+{
+	mtrace();
+	int result = PASS;
+	json_object *DeleteCertificate;
+
+	DEBUG_INFO("handleDeleteCertificateRequest...\n");
+	DeleteCertificate = json_tokener_parse(payload);
+	if(!is_error(DeleteCertificate))
+	{
+		sprintf((char*)ShmOCPP16Data->DeleteCertificate.certificateHashData.hashAlgorithm, "%s", json_object_get_string(json_object_object_get(json_object_object_get(DeleteCertificate, "certificateHashData"), "hashAlgorithm")));
+		sprintf((char*)ShmOCPP16Data->DeleteCertificate.certificateHashData.issuerNameHash, "%s", json_object_get_string(json_object_object_get(json_object_object_get(DeleteCertificate, "certificateHashData"), "issuerNameHash")));
+		sprintf((char*)ShmOCPP16Data->DeleteCertificate.certificateHashData.issuerKeyHash, "%s", json_object_get_string(json_object_object_get(json_object_object_get(DeleteCertificate, "certificateHashData"), "issuerKeyHash")));
+		sprintf((char*)ShmOCPP16Data->DeleteCertificate.certificateHashData.serialNumber, "%s", json_object_get_string(json_object_object_get(json_object_object_get(DeleteCertificate, "certificateHashData"), "serialNumber")));
+
+		/*
+		 *	TODO: Delete certificateSigned process
+		 */
+		ShmOCPP16Data->MsMsg.bits.DeleteCertificateReq = 1;
+		DEBUG_INFO("hashAlgorithm: %s\n", ShmOCPP16Data->DeleteCertificate.certificateHashData.hashAlgorithm);
+		DEBUG_INFO("issuerNameHash: %s\n", ShmOCPP16Data->DeleteCertificate.certificateHashData.issuerNameHash);
+		DEBUG_INFO("issuerKeyHash: %s\n", ShmOCPP16Data->DeleteCertificate.certificateHashData.issuerKeyHash);
+		DEBUG_INFO("serialNumber: %s\n", ShmOCPP16Data->DeleteCertificate.certificateHashData.serialNumber);
+
+		sprintf((char*)ShmOCPP16Data->DeleteCertificate.Response_status, "NotFound");
+		sendDeleteCertificateConfirmation(uuid);
+	}
+	json_object_put(DeleteCertificate);
+
+	return result;
+}
+
+int handleExtendedTriggerMessageRequest(char *uuid, char *payload)
+{
+	mtrace();
+	int result = PASS;
+	json_object *ExtendedTriggerMessage;
+
+	DEBUG_INFO("handleExtendedTriggerMessageRequest...\n");
+	ExtendedTriggerMessage = json_tokener_parse(payload);
+	if(!is_error(ExtendedTriggerMessage))
+	{
+		sprintf((char*)ShmOCPP16Data->ExtendedTriggerMessage.requestedMessage, "%s", json_object_get_string(json_object_object_get(ExtendedTriggerMessage, "requestedMessage")));
+
+		if(json_object_object_get(ExtendedTriggerMessage, "connectorId") != NULL)
+		{
+			ShmOCPP16Data->ExtendedTriggerMessage.connectorId = json_object_get_int(json_object_object_get(ExtendedTriggerMessage, "connectorId"));
+		}
+		else
+		{
+			ShmOCPP16Data->ExtendedTriggerMessage.connectorId = -1;
+		}
+
+		/*
+		 *	TODO: Trigger message process
+		 */
+		ShmOCPP16Data->MsMsg.bits.ExtendedTriggerMessageReq = 1;
+
+		DEBUG_INFO("requestedMessage: %s\n", ShmOCPP16Data->ExtendedTriggerMessage.requestedMessage);
+		DEBUG_INFO("connectorIdInt: %d\n", ShmOCPP16Data->ExtendedTriggerMessage.connectorId);
+
+		sprintf((char*)ShmOCPP16Data->ExtendedTriggerMessage.Response_status, "NotImplemented");
+		sendExtendedTriggerMessageConfirmation(uuid);
+	}
+	json_object_put(ExtendedTriggerMessage);
+
+	return result;
+}
+
+int handleGetInstalledCertificateIdsRequest(char *uuid, char *payload)
+{
+	mtrace();
+	int result = PASS;
+	json_object *GetInstalledCertificateIds;
+
+	DEBUG_INFO("handleGetInstalledCertificateIdsRequest...\n");
+	GetInstalledCertificateIds = json_tokener_parse(payload);
+	if(!is_error(GetInstalledCertificateIds))
+	{
+		sprintf((char*)ShmOCPP16Data->GetInstalledCertificateIds.certificateType, "%s", json_object_get_string(json_object_object_get(GetInstalledCertificateIds, "certificateType")));
+
+		/*
+		 *	TODO: Return installed certificate process
+		 */
+		ShmOCPP16Data->MsMsg.bits.GetInstalledCertificateIdsReq = 1;
+		DEBUG_INFO("requestedMessage: %s\n", (char*)ShmOCPP16Data->GetInstalledCertificateIds.certificateType);
+
+		memset(ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData, 0x00, ARRAY_SIZE(ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData)*sizeof(struct CertificateHashDataType));
+		sprintf((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_status, "NotFound");
+		sendGetInstalledCertificateIdsConfirmation(uuid);
+	}
+	json_object_put(GetInstalledCertificateIds);
+
+	return result;
+}
+
+int handleGetLogRequest(char *uuid, char *payload)
+{
+	mtrace();
+	int result = PASS;
+	json_object *GetLog;
+
+	DEBUG_INFO("handleGetLogRequest...\n");
+	GetLog = json_tokener_parse(payload);
+	if(!is_error(GetLog))
+	{
+		sprintf((char*)ShmOCPP16Data->GetLog.logType, "%s", json_object_get_string(json_object_object_get(GetLog, "logType")));
+		ShmOCPP16Data->GetLog.requestId = json_object_get_int(json_object_object_get(GetLog, "requestId"));
+
+		if(json_object_object_get(GetLog, "retries") != NULL)
+		{
+			ShmOCPP16Data->GetLog.retries = json_object_get_int(json_object_object_get(GetLog, "retries"));
+		}
+
+		if(json_object_object_get(GetLog, "retryInterval") != NULL)
+		{
+			ShmOCPP16Data->GetLog.retryInterval = json_object_get_int(json_object_object_get(GetLog, "retryInterval"));
+		}
+
+		sprintf((char*)ShmOCPP16Data->GetLog.log.remoteLocation, "%s", json_object_get_string(json_object_object_get(json_object_object_get(GetLog, "log"), "remoteLocation")));
+
+		if(json_object_object_get(json_object_object_get(GetLog, "log"), "oldestTimestamp") != NULL)
+		{
+			sprintf((char*)ShmOCPP16Data->GetLog.log.oldestTimestamp, "%s", json_object_get_string(json_object_object_get(json_object_object_get(GetLog, "log"), "oldestTimestamp")));
+		}
+
+		if(json_object_object_get(json_object_object_get(GetLog, "log"), "latestTimestamp") != NULL)
+		{
+			sprintf((char*)ShmOCPP16Data->GetLog.log.latestTimestamp, "%s", json_object_get_string(json_object_object_get(json_object_object_get(GetLog, "log"), "latestTimestamp")));
+		}
+
+		/*
+		 *	TODO: Upload log process
+		 */
+		ShmOCPP16Data->MsMsg.bits.GetLogReq = 1;
+		DEBUG_INFO("logType: %s\n", ShmOCPP16Data->GetLog.logType);
+		DEBUG_INFO("requestId: %d\n", ShmOCPP16Data->GetLog.requestId);
+		DEBUG_INFO("retries: %d\n", ShmOCPP16Data->GetLog.retries);
+		DEBUG_INFO("retryInterval: %d\n", ShmOCPP16Data->GetLog.retryInterval);
+		DEBUG_INFO("remoteLocation: %s\n", ShmOCPP16Data->GetLog.log.remoteLocation);
+		DEBUG_INFO("oldestTimestamp: %s\n", ShmOCPP16Data->GetLog.log.oldestTimestamp);
+		DEBUG_INFO("latestTimestamp: %s\n", ShmOCPP16Data->GetLog.log.latestTimestamp);
+		sprintf((char*)ShmOCPP16Data->GetLog.Response_status, "Rejected");
+		sendGetLogConfirmation(uuid);
+	}
+	json_object_put(GetLog);
+
+	return result;
+}
+
+int handleInstallCertificateRequest(char *uuid, char *payload)
+{
+	mtrace();
+	int result = PASS;
+	json_object *InstallCertificate;
+
+	DEBUG_INFO("handleInstallCertificateRequest...\n");
+	InstallCertificate = json_tokener_parse(payload);
+	if(!is_error(InstallCertificate))
+	{
+		sprintf((char*)ShmOCPP16Data->InstallCertificate.certificateType, "%s", json_object_get_string(json_object_object_get(InstallCertificate, "certificateType")));
+		sprintf((char*)ShmOCPP16Data->InstallCertificate.certificate, "%s", json_object_get_string(json_object_object_get(InstallCertificate, "certificate")));
+
+		/*
+		 * 	TODO:	Install certificate process
+		 */
+		ShmOCPP16Data->MsMsg.bits.InstallCertificateReq = 1;
+		DEBUG_INFO("certificateType: %s\n", (char*)ShmOCPP16Data->InstallCertificate.certificateType);
+		DEBUG_INFO("certificate: %s\n", (char*)ShmOCPP16Data->InstallCertificate.certificate);
+
+		sprintf((char*)ShmOCPP16Data->InstallCertificate.Response_status, "Rejected");
+		sendInstallCertificateConfirmation(uuid);
+	}
+	json_object_put(InstallCertificate);
+
+	return result;
+}
+
+int handleSignedUpdateFirmwareRequest(char *uuid, char *payload)
+{
+	mtrace();
+	int result = PASS;
+	json_object *SignedUpdateFirmware;
+
+	DEBUG_INFO("handleSignedUpdateFirmwareRequest...\n");
+	SignedUpdateFirmware = json_tokener_parse(payload);
+	if(!is_error(SignedUpdateFirmware))
+	{
+		if(json_object_object_get(SignedUpdateFirmware, "retries") != NULL)
+		{
+			ShmOCPP16Data->SignedUpdateFirmware.retries = json_object_get_int(json_object_object_get(SignedUpdateFirmware, "retries"));
+		}
+
+		if(json_object_object_get(SignedUpdateFirmware, "retryInterval") != NULL)
+		{
+			ShmOCPP16Data->SignedUpdateFirmware.retryInterval = json_object_get_int(json_object_object_get(SignedUpdateFirmware, "retryInterval"));
+		}
+
+		ShmOCPP16Data->SignedUpdateFirmware.requestId = json_object_get_int(json_object_object_get(SignedUpdateFirmware, "requestId"));
+
+		sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.firmware.location, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "location")));
+		sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.firmware.retrieveDateTime, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "retrieveDateTime")));
+
+		if(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "installDateTime") != NULL)
+		{
+			sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.firmware.installDateTime, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "installDateTime")));
+		}
+
+		sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.firmware.signingCertificate, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "signingCertificate")));
+		sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.firmware.signature, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "signature")));
+
+		/*
+		 * 	TODO:	Upgrade firmware process
+		 */
+		ShmOCPP16Data->MsMsg.bits.SignedUpdateFirmwareReq = 1;
+		DEBUG_INFO("retries: %d\n", ShmOCPP16Data->SignedUpdateFirmware.retries);
+		DEBUG_INFO("retryInterval: %d\n", ShmOCPP16Data->SignedUpdateFirmware.retryInterval);
+		DEBUG_INFO("requestId: %d\n", ShmOCPP16Data->SignedUpdateFirmware.requestId);
+		DEBUG_INFO("location: %s\n", ShmOCPP16Data->SignedUpdateFirmware.firmware.location);
+		DEBUG_INFO("retrieveDateTime: %s\n", ShmOCPP16Data->SignedUpdateFirmware.firmware.retrieveDateTime);
+		DEBUG_INFO("installDateTime: %s\n", ShmOCPP16Data->SignedUpdateFirmware.firmware.installDateTime);
+		DEBUG_INFO("signingCertificate: %s\n", ShmOCPP16Data->SignedUpdateFirmware.firmware.signingCertificate);
+		DEBUG_INFO("signature: %s\n", ShmOCPP16Data->SignedUpdateFirmware.firmware.signature);
+
+		sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.Response_status, "Rejected");
+		sendInstallCertificateConfirmation(uuid);
+	}
+	json_object_put(SignedUpdateFirmware);
+
+	return result;
+}
+
 int handleUnknownRequest(char *uuid, char *payload)
 {
 	mtrace();
-	int result = FAIL;
+	int result = PASS;
 	DEBUG_INFO("handleUnknownRequest...\n");
 
 	sendUnknownConfirmation(uuid);
@@ -11579,6 +12146,7 @@ int handleUnknownRequest(char *uuid, char *payload)
 
 	return result;
 }
+
 //==========================================
 // Handle server response routine
 //==========================================
@@ -11862,6 +12430,44 @@ void handleStopTransactionnResponse(char *payload, int gun_index)
 	DEBUG_INFO("idTagInfo-status: %s\n", ShmOCPP16Data->StopTransaction[gun_index].ResponseIdTagInfo.Status);
 }
 
+void handleLogStatusNotificationResponse(char *payload, int gun_index)
+{
+	mtrace();
+	DEBUG_INFO("handleLogStatusNotificationResponse...\n");
+	ShmOCPP16Data->SpMsg.bits.LogStatusNotificationConf = 1;
+}
+
+void handleSecurityEventNotificationResponse(char *payload, int gun_index)
+{
+	mtrace();
+	DEBUG_INFO("handleSecurityEventNotificationResponse...\n");
+	ShmOCPP16Data->SpMsg.bits.SecurityEventNotificationConf = 1;
+}
+
+void handleSignCertificateResponse(char *payload, int gun_index)
+{
+	mtrace();
+	DEBUG_INFO("handleSignCertificateResponse...\n");
+	json_object *SignCertificate;
+	SignCertificate = json_tokener_parse(payload);
+
+	if(!is_error(SignCertificate))
+	{
+		sprintf((char*)ShmOCPP16Data->SignCertificate.Response_status, "%s", json_object_get_string(json_object_object_get(SignCertificate, "status")));
+		DEBUG_INFO("status: %s\n", ShmOCPP16Data->SignCertificate.Response_status);
+	}
+	json_object_put(SignCertificate);
+
+	ShmOCPP16Data->SpMsg.bits.SignCertificateConf = 1;
+}
+
+void handleSignedFirmwareStatusNotificationResponse(char *payload, int gun_index)
+{
+	mtrace();
+	DEBUG_INFO("handleSignedFirmwareStatusNotificationResponse...\n");
+	ShmOCPP16Data->SpMsg.bits.SignedFirmwareStatusNotificationConf = 1;
+}
+
 //==========================================
 // Handle Error routine
 //==========================================

+ 26 - 0
EVSE/Modularization/ocppfiles/MessageHandler.h

@@ -460,6 +460,11 @@ int sendStatusNotificationRequest(int gun_index);
 int sendStopTransactionRequest(int gun_index);
 int sendMeterValuesRequest(int gun_index, ReadingContext dataType);
 
+int sendLogStatusNotificationRequest(char *status);
+int sendSecurityEventNotificationRequest(int gun_index);
+int sendSignCertificateRequest(int gun_index);
+int sendSignedFirmwareStatusNotificationRequest(char *status);
+
 //==========================================
 // send confirm routine
 //==========================================
@@ -482,6 +487,15 @@ int sendSetChargingProfileConfirmation(char *uuid,char *payload);
 int sendTriggerMessageConfirmation(char *uuid,char *payload);
 int sendUnlockConnectorConfirmation(char *uuid,char *payload);
 int sendUpdateFirmwareConfirmation(char *uuid);
+
+int sendCertificateSignedConfirmation(char *uuid);
+int sendDeleteCertificateConfirmation(char *uuid);
+int sendExtendedTriggerMessageConfirmation(char *uuid);
+int sendGetInstalledCertificateIdsConfirmation(char *uuid);
+int sendGetLogConfirmation(char *uuid);
+int sendInstallCertificateConfirmation(char *uuid);
+int sendSignedUpdateFirmwareConfirmation(char *uuid);
+
 int sendUnknownConfirmation(char *uuid);
 
 //==========================================
@@ -511,7 +525,15 @@ int handleSetChargingProfileRequest(char *uuid, char *payload);
 int handleTriggerMessageRequest(char *uuid, char *payload);
 int handleUnlockConnectorRequest(char *uuid, char *payload);
 int handleUpdateFirmwareRequest(char *uuid, char *payload);
+int handleCertificateSignedRequest(char *uuid, char *payload);
+int handleDeleteCertificateRequest(char *uuid, char *payload);
+int handleExtendedTriggerMessageRequest(char *uuid, char *payload);
+int handleGetInstalledCertificateIdsRequest(char *uuid, char *payload);
+int handleGetLogRequest(char *uuid, char *payload);
+int handleInstallCertificateRequest(char *uuid, char *payload);
+int handleSignedUpdateFirmwareRequest(char *uuid, char *payload);
 int handleUnknownRequest(char *uuid, char *payload);
+
 void handleAuthorizeResponse(char *payload, int gun_index);
 void handleBootNotificationResponse(char *payload, int gun_index);
 void handleDataTransferResponse(char *payload, int gun_index);
@@ -522,6 +544,10 @@ void handleMeterValuesResponse(char *payload, int gun_index);
 void handleStartTransactionResponse(char *payload, int gun_index);
 void handleStatusNotificationResponse(char *payload, int gun_index);
 void handleStopTransactionnResponse(char *payload, int gun_index);
+void handleLogStatusNotificationResponse(char *payload, int gun_index);
+void handleSecurityEventNotificationResponse(char *payload, int gun_index);
+void handleSignCertificateResponse(char *payload, int gun_index);
+void handleSignedFirmwareStatusNotificationResponse(char *payload, int gun_index);
 
 //==========================================
 // Handle Error routine

+ 197 - 82
EVSE/Projects/define.h

@@ -4228,6 +4228,108 @@ struct StructCost
     struct StrcutRunningFinalCost   FinalCost[CONNECTOR_QUANTITY];
 };
 
+struct CertificateHashDataType
+{
+	unsigned char hashAlgorithm[8];								// Required. Used algorithms for the hashes provided.
+	unsigned char issuerNameHash[129];							// Required. hashed value of the IssuerName.
+	unsigned char issuerKeyHash[129];							// Required. Hashed value of the issuers public key
+	unsigned char serialNumber[41];								// Required. The serial number of the certificate.
+};
+
+struct LogParametersType
+{
+	unsigned char remoteLocation[513];								// Required. The URL of the location at the remote system where the log should be stored.
+	unsigned char oldestTimestamp[28];								// Optional. This contains the date and time of the oldest logging information to include in the diagnostics.
+	unsigned char latestTimestamp[28];								// Optional. This contains the date and time of the latest logging information to include in the diagnostics.
+};
+
+struct FirmwareType
+{
+	unsigned char location[513];									// Required. URI defining the origin of the firmware.
+	unsigned char retrieveDateTime[28];								// Required. Date and time at which the firmware shall be retrieved.
+	unsigned char installDateTime[28];								// Optional. Date and time at which the firmware shall be installed.
+	unsigned char signingCertificate[5501];							// Optional. Certificate with which the firmware was signed. X.509 certificate, first DER encoded into binary, and then Base64 encoded.
+	unsigned char signature[801];									// Optional. Base64 encoded firmware signature.
+};
+
+struct StructCertificateSigned
+{
+	unsigned char certificateChain[10001];
+	unsigned char Response_status[16];
+};
+
+struct StructDeleteCertificate
+{
+	struct CertificateHashDataType certificateHashData;
+	unsigned char Response_status[16];
+};
+
+struct StructExtendedTrigger
+{
+	unsigned char requestedMessage[32];
+	int connectorId;
+	unsigned char Response_status[16];
+};
+
+struct StructGetInstalledCertificateIds
+{
+	unsigned char certificateType[32];
+	unsigned char Response_status[16];
+	struct CertificateHashDataType Response_certificateHashData[3];
+};
+
+struct StructGetLog
+{
+	unsigned char logType[16];
+	int requestId;
+	int retries;
+	int retryInterval;
+	struct LogParametersType log;
+	unsigned char Response_status[16];
+	unsigned char Response_filename[256];
+};
+
+struct StructInstallCertificate
+{
+	unsigned char certificateType[32];
+	unsigned char certificate[5501];
+	unsigned char Response_status[16];
+};
+
+struct StructSignedUpdateFirmware
+{
+	int retries;
+	int retryInterval;
+	int requestId;
+	struct FirmwareType firmware;
+	unsigned char Response_status[16];
+};
+
+struct StructLogStatusNotification
+{
+	unsigned char status[32];
+	int requestId;
+};
+
+struct StructSecurityEventNotification
+{
+	unsigned char type[51];
+	unsigned char timestamp[28];
+	unsigned char techInfo[256];
+};
+
+struct StructSignCertificate
+{
+	unsigned char csr[5501];
+	unsigned char Response_status[16];
+};
+
+struct StructSignedFirmwareStatusNotification
+{
+	unsigned char status[32];
+	int requestId;
+};
+
 struct OCPP16Data
 {
     unsigned char                           OcppServerURL[512];     //http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
@@ -4256,18 +4358,27 @@ struct OCPP16Data
     union
     {
         //Operations Initiated by Sequence Point
-        unsigned char SpMsgValue[1];
+        unsigned char SpMsgValue[2];
         struct
         {
             //SpMsgValue[0]
-            unsigned char BootNotificationReq :1;               //bit 0,
-            unsigned char BootNotificationConf :1;              //bit 1,
-            unsigned char AuthorizeReq :1;                      //bit 2,
-            unsigned char AuthorizeConf :1;                     //bit 3,
-            unsigned char DiagnosticsStatusNotificationReq :1;  //bit 4,
-            unsigned char DiagnosticsStatusNotificationConf :1; //bit 5,
-            unsigned char FirmwareStatusNotificationReq :1;     //bit 6,
-            unsigned char FirmwareStatusNotificationConf :1;    //bit 7,
+            unsigned char BootNotificationReq :1;               	//bit 0,
+            unsigned char BootNotificationConf :1;              	//bit 1,
+            unsigned char AuthorizeReq :1;                      	//bit 2,
+            unsigned char AuthorizeConf :1;                     	//bit 3,
+            unsigned char DiagnosticsStatusNotificationReq :1;  	//bit 4,
+            unsigned char DiagnosticsStatusNotificationConf :1; 	//bit 5,
+            unsigned char FirmwareStatusNotificationReq :1;     	//bit 6,
+            unsigned char FirmwareStatusNotificationConf :1;   	 	//bit 7,
+            //SpMsgValue[1]
+            unsigned char LogStatusNotificationReq :1;              //bit 0,
+			unsigned char LogStatusNotificationConf :1;             //bit 1,
+			unsigned char SecurityEventNotificationReq :1;          //bit 2,
+			unsigned char SecurityEventNotificationConf :1;         //bit 3,
+			unsigned char SignCertificateReq :1;  					//bit 4,
+			unsigned char SignCertificateConf :1; 					//bit 5,
+			unsigned char SignedFirmwareStatusNotificationReq :1;   //bit 6,
+			unsigned char SignedFirmwareStatusNotificationConf :1;	//bit 7,
         } bits;
     } SpMsg;
 
@@ -4309,27 +4420,44 @@ struct OCPP16Data
     union
     {
         //Operations Initiated by Main System
-        unsigned char MsMsgValue[2];
+        unsigned char MsMsgValue[4];
         struct
         {
             //CsMsgValue[0]
-            unsigned char ChangeConfigurationReq :1;    //bit 0,
-            unsigned char ChangeConfigurationConf :1;   //bit 1,
-            unsigned char ClearCacheReq :1;             //bit 2,
-            unsigned char ClearCacheConf :1;            //bit 3,
-            unsigned char GetConfigurationReq :1;       //bit 4,
-            unsigned char GetConfigurationConf :1;      //bit 5,
-            unsigned char UpdateFirmwareReq :1;         //bit 6,
-            unsigned char UpdateFirmwareConf :1;        //bit 7,
+            unsigned char ChangeConfigurationReq :1;    			//bit 0,
+            unsigned char ChangeConfigurationConf :1;   			//bit 1,
+            unsigned char ClearCacheReq :1;             			//bit 2,
+            unsigned char ClearCacheConf :1;            			//bit 3,
+            unsigned char GetConfigurationReq :1;       			//bit 4,
+            unsigned char GetConfigurationConf :1;      			//bit 5,
+            unsigned char UpdateFirmwareReq :1;         			//bit 6,
+            unsigned char UpdateFirmwareConf :1;        			//bit 7,
             //CsMsgValue[1]
-            unsigned char GetDiagnosticsReq :1;         //bit 0,
-            unsigned char GetDiagnosticsConf :1;        //bit 1,
-            unsigned char GetLocalListVersionReq :1;    //bit 2,
-            unsigned char GetLocalListVersionConf :1;   //bit 3,
-            unsigned char ResetReq :1;                  //bit 4,
-            unsigned char ResetConf :1;                 //bit 5,
-            unsigned char SendLocalListReq :1;          //bit 6,
-            unsigned char SendLocalListConf :1;         //bit 7,
+            unsigned char GetDiagnosticsReq :1;         			//bit 0,
+            unsigned char GetDiagnosticsConf :1;        			//bit 1,
+            unsigned char GetLocalListVersionReq :1;   				//bit 2,
+            unsigned char GetLocalListVersionConf :1;   			//bit 3,
+            unsigned char ResetReq :1;                  			//bit 4,
+            unsigned char ResetConf :1;                 			//bit 5,
+            unsigned char SendLocalListReq :1;         				//bit 6,
+            unsigned char SendLocalListConf :1;         			//bit 7,
+            //CsMsgValue[2]
+            unsigned char CertificateSignedReq :1;					//bit 0
+            unsigned char CertificateSignedConf :1;					//bit 1
+            unsigned char DeleteCertificateReq :1;					//bit 2
+            unsigned char DeleteCertificateConf :1;					//bit 3
+            unsigned char ExtendedTriggerMessageReq :1;				//bit 4
+            unsigned char ExtendedTriggerMessageConf :1;			//bit 5
+            unsigned char GetInstalledCertificateIdsReq :1;			//bit 6
+            unsigned char GetInstalledCertificateIdsConf :1;		//bit 7
+            //CsMsgValue[3]
+            unsigned char GetLogReq :1;								//bit 0
+            unsigned char GetLogConf :1;							//bit 1
+            unsigned char InstallCertificateReq :1;					//bit 2
+            unsigned char InstallCertificateConf :1;				//bit 3
+            unsigned char SignedUpdateFirmwareReq :1;				//bit 4
+            unsigned char SignedUpdateFirmwareConf :1;				//bit 5
+            unsigned char :2;										//bit 6 & 7
         } bits;
     } MsMsg;
 
@@ -4346,37 +4474,48 @@ struct OCPP16Data
         } bits[CONNECTOR_QUANTITY];
     }CSUMsg;
 
-    struct StructBootNotification               BootNotification;
-    struct StructHeartbeat                      Heartbeat;
-    struct StructAuthorize                      Authorize;
-    struct StructStartTransaction               StartTransaction[CONNECTOR_QUANTITY];
-    struct StructStopTransaction                StopTransaction[CONNECTOR_QUANTITY];
-    struct StructStatusNotification             StatusNotification[CONNECTOR_QUANTITY];
-    struct StructCancelReservation              CancelReservation[CONNECTOR_QUANTITY];
-    struct StructChangeAvailability             ChangeAvailability[CONNECTOR_QUANTITY];
-    struct StructChangeConfiguration            ChangeConfiguration;
-    struct StructClearCache                     ClearCache;
-    struct StructClearChargingProfile           ClearChargingProfile[CONNECTOR_QUANTITY];
-    struct StructDataTransfer                   DataTransfer[CONNECTOR_QUANTITY];
-    struct StructDiagnosticsStatusNotification  DiagnosticsStatusNotification;
-    struct StructFirmwareStatusNotification     FirmwareStatusNotification;
-    struct StructGetCompositeSchedule           GetCompositeSchedule[CONNECTOR_QUANTITY];
-    struct StructGetConfiguration               GetConfiguration;
-    struct StructGetDiagnostics                 GetDiagnostics;
-    struct StructGetLocalListVersion            GetLocalListVersion;
-    struct StructMeterValues                    MeterValues[CONNECTOR_QUANTITY];
-    struct StructRemoteStartTransaction         RemoteStartTransaction[CONNECTOR_QUANTITY];
-    struct StructRemoteStopTransaction          RemoteStopTransaction[CONNECTOR_QUANTITY];
-    struct StructReserveNow                     ReserveNow[CONNECTOR_QUANTITY];
-    struct StructReset                          Reset;
-    struct StructSendLocalList                  SendLocalList;
-    struct StructSetChargingProfile             SetChargingProfile[CONNECTOR_QUANTITY];
-    struct StructTriggerMessage                 TriggerMessage[CONNECTOR_QUANTITY];
-    struct StructUnlockConnector                UnlockConnector[CONNECTOR_QUANTITY];
-    struct StructUpdateFirmware                 UpdateFirmware;
-    struct OCPP16ConfigurationTable             ConfigurationTable;
-    struct StructChargingProfile                SmartChargingProfile[CONNECTOR_QUANTITY];
-    struct StructCost                           Cost;
+    struct StructBootNotification               	BootNotification;
+    struct StructHeartbeat                     	 	Heartbeat;
+    struct StructAuthorize                      	Authorize;
+    struct StructStartTransaction               	StartTransaction[CONNECTOR_QUANTITY];
+    struct StructStopTransaction                	StopTransaction[CONNECTOR_QUANTITY];
+    struct StructStatusNotification             	StatusNotification[CONNECTOR_QUANTITY];
+    struct StructCancelReservation              	CancelReservation[CONNECTOR_QUANTITY];
+    struct StructChangeAvailability             	ChangeAvailability[CONNECTOR_QUANTITY];
+    struct StructChangeConfiguration            	ChangeConfiguration;
+    struct StructClearCache                     	ClearCache;
+    struct StructClearChargingProfile           	ClearChargingProfile[CONNECTOR_QUANTITY];
+    struct StructDataTransfer                   	DataTransfer[CONNECTOR_QUANTITY];
+    struct StructDiagnosticsStatusNotification  	DiagnosticsStatusNotification;
+    struct StructFirmwareStatusNotification     	FirmwareStatusNotification;
+    struct StructGetCompositeSchedule           	GetCompositeSchedule[CONNECTOR_QUANTITY];
+    struct StructGetConfiguration               	GetConfiguration;
+    struct StructGetDiagnostics                 	GetDiagnostics;
+    struct StructGetLocalListVersion            	GetLocalListVersion;
+    struct StructMeterValues                    	MeterValues[CONNECTOR_QUANTITY];
+    struct StructRemoteStartTransaction         	RemoteStartTransaction[CONNECTOR_QUANTITY];
+    struct StructRemoteStopTransaction          	RemoteStopTransaction[CONNECTOR_QUANTITY];
+    struct StructReserveNow                     	ReserveNow[CONNECTOR_QUANTITY];
+    struct StructReset                          	Reset;
+    struct StructSendLocalList                  	SendLocalList;
+    struct StructSetChargingProfile            		SetChargingProfile[CONNECTOR_QUANTITY];
+    struct StructTriggerMessage                 	TriggerMessage[CONNECTOR_QUANTITY];
+    struct StructUnlockConnector                	UnlockConnector[CONNECTOR_QUANTITY];
+    struct StructUpdateFirmware                 	UpdateFirmware;
+    struct OCPP16ConfigurationTable             	ConfigurationTable;
+    struct StructChargingProfile                	SmartChargingProfile[CONNECTOR_QUANTITY];
+    struct StructCost                           	Cost;
+    struct StructCertificateSigned					CertificateSigned;
+    struct StructDeleteCertificate					DeleteCertificate;
+    struct StructExtendedTrigger					ExtendedTriggerMessage;
+    struct StructGetInstalledCertificateIds			GetInstalledCertificateIds;
+    struct StructGetLog								GetLog;
+    struct StructInstallCertificate					InstallCertificate;
+    struct StructSignedUpdateFirmware				SignedUpdateFirmware;
+    struct StructLogStatusNotification				LogStatusNotification;
+    struct StructSecurityEventNotification			SecurityEventNotification;
+    struct StructSignCertificate					SignCertificate;
+    struct StructSignedFirmwareStatusNotification 	SignedFirmwareStatusNotification;
 };
 
 
@@ -4601,14 +4740,6 @@ struct AuthorizationData
 	struct IdTokenType idToken;									// Required. This contains the identifier which needs to be stored for authorization.
 };
 
-struct CertificateHashDataType
-{
-	unsigned char hashAlgorithm[8];								// Required. Used algorithms for the hashes provided.
-	unsigned char issuerNameHash[128];							// Required. hashed value of the IssuerName.
-	unsigned char issuerKeyHash[128];							// Required. Hashed value of the issuers public key
-	unsigned char serialNumber[40];								// Required. The serial number of the certificate.
-};
-
 struct CertificateHashDataChainType
 {
 	unsigned char certificateType[32];							// Required. Indicates the type of the requested certificate(s).
@@ -4799,15 +4930,6 @@ struct EventDataType
 	struct VariableType variable;									// Required. Variable for which event is notified.
 };
 
-struct FirmwareType
-{
-	unsigned char location[512];									// Required. URI defining the origin of the firmware.
-	unsigned char retrieveDateTime[28];								// Required. Date and time at which the firmware shall be retrieved.
-	unsigned char installDateTime[28];								// Optional. Date and time at which the firmware shall be installed.
-	unsigned char signingCertificate[5500];							// Optional. Certificate with which the firmware was signed. X.509 certificate, first DER encoded into binary, and then Base64 encoded.
-	unsigned char signature[800];									// Optional. Base64 encoded firmware signature.
-};
-
 struct GetVariableDataType
 {
 	unsigned char attributeType[8];									// Optional. Attribute type for which value is requested. When absent, default Actual is assumed.
@@ -4824,13 +4946,6 @@ struct GetVariableResultType
 	struct VariableType variable;									// Required. Variable for which the attribute value is requested.
 };
 
-struct LogParametersType
-{
-	unsigned char remoteLocation[512];								// Required. The URL of the location at the remote system where the log should be stored.
-	unsigned char oldestTimestamp[28];								// Optional. This contains the date and time of the oldest logging information to include in the diagnostics.
-	unsigned char latestTimestamp[28];								// Optional. This contains the date and time of the latest logging information to include in the diagnostics.
-};
-
 struct MessageInfoType
 {
 	unsigned int id;												// Required. Master resource identifier, unique within an exchange context. It is defined within the OCPP context as a positive Integer value (greater or equal to zero).
@@ -5361,7 +5476,7 @@ struct SecurityEventNotification_20
 {
 	unsigned char type[50];											// Required. Type of the security event. This value should be taken from the Security events list.
 	unsigned char timestamp[28];									// Required. Date and time at which the event occurred.
-	unsigned char techinfo[255];									// Optional. Additional information about the occurred security event.
+	unsigned char techInfo[255];									// Optional. Additional information about the occurred security event.
 };
 
 struct SendLocalList_20