Bladeren bron

2022-06-23/Jerry Wang
[OCPP 2.0.1]

Action:
1. Fix sending twice 'stopped' TransactionEvent problem.
2. Add logic to avoid putting null or unnecessary item in GetVariables and SetVariables response message.
3. Add logic to process boolean value to uppercase in SetVariables function.
4. Add checking AuthCtrlr.Enable value logic in SetVariables function.
5. Change the reconnect timing in SetVariables function.
6. Fix add authorization cache logic in handling response of Authorize.
7. Improve checking PingPong timeout logic.

File:
1. EVSE/Modularization/ocpp20/MessageHandler.c
--> Action 1-6
2. EVSE/Modularization/ocpp20/Module_OcppBackend20.c
--> Action 7

Jerry Wang 2 jaren geleden
bovenliggende
commit
93245dbcfa
2 gewijzigde bestanden met toevoegingen van 94 en 27 verwijderingen
  1. 91 25
      EVSE/Modularization/ocpp20/MessageHandler.c
  2. 3 2
      EVSE/Modularization/ocpp20/Module_OcppBackend20.c

+ 91 - 25
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -1630,7 +1630,7 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_Enabled].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_boolean]);
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_Enabled].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Actual]);
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_Enabled].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_Enabled].variableAttribute[0].value, "FALSE");
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_Enabled].variableAttribute[0].value, ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_ENABLE?"TRUE":"FALSE");
 		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_Enabled]);
 
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_AdditionalInfoItemsPerMessage].component.name, "AlignedDataCtrlr");
@@ -7276,7 +7276,8 @@ void CheckSystemValue(void)
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
 
 						if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
-						   (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
+						   (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_COMPLETE) &&
+						   (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != AcPreviousSystemStatus[index]))
 						{
 							ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
 						}
@@ -7329,7 +7330,8 @@ void CheckSystemValue(void)
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
 
 						if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
-						   (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
+						   (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus <= SYS_MODE_COMPLETE) &&
+						   (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != AcPreviousSystemStatus[index]))
 						{
 							ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
 						}
@@ -7381,7 +7383,8 @@ void CheckSystemValue(void)
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
 
 						if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
-						   (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
+						   (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus <= SYS_MODE_COMPLETE) &&
+						   (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != AcPreviousSystemStatus[index]))
 						{
 							ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
 						}
@@ -7426,7 +7429,8 @@ void CheckSystemValue(void)
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
 
 						if((ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus >= SYS_MODE_CHARGING) &&
-						   (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus <= SYS_MODE_COMPLETE))
+						   (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus <= SYS_MODE_COMPLETE) &&
+						   (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus != AcPreviousSystemStatus[index]))
 						{
 							ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
 						}
@@ -7479,7 +7483,8 @@ void CheckSystemValue(void)
 							cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
 
 						if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
-						   (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
+						   (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus <= SYS_MODE_COMPLETE) &&
+						   (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != AcPreviousSystemStatus[index]))
 						{
 							ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
 						}
@@ -7808,7 +7813,7 @@ int sendAuthorizeRequest(int gun_index)
 	memset(&(ShmOCPP20Data->Authorize.Response_idTokenInfo),0,sizeof(struct IdTokenInfoType));
 
 	//Local Authorize
-	if	((strcmp((const char *)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_OfflineTxForUnknownIdEnabled].variableAttribute[0].value, "TRUE")==0) && (ShmOCPP20Data->OcppConnStatus == 0))
+	if((strcmp((const char *)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_OfflineTxForUnknownIdEnabled].variableAttribute[0].value, "TRUE")==0) && (ShmOCPP20Data->OcppConnStatus == 0))
 	{
 		DEBUG_INFO("Allow OfflineTx UnknownId Pass !!!!\n");
 		strcpy((char *)ShmOCPP20Data->Authorize.Response_idTokenInfo.cacheExpiryDateTime, "");
@@ -10262,8 +10267,8 @@ S_FAULT                 =12
 					memset(&ShmOCPP20Data->TransactionEvent[gun_index].idToken, 0x00, sizeof(struct IdTokenType));
 					memset(&ShmOCPP20Data->TransactionEvent[gun_index].meterValue, 0x00, sizeof(struct MeterValueType));
 				}
-				else if ( ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_AUTHORIZING)&&( ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_PREPARE_FOR_EVSE)) ||
-				          ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0) && ( ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1) )
+				else if ( ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus >= SYS_MODE_AUTHORIZING)&&( ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus <= SYS_MODE_PREPARE_FOR_EVSE)) ||
+				          ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0) && ( ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1) )
 						) //S_PRECHARGE
 				{
 					currentStatus = ConnectorStatusEnumType_Occupied; //OCPP Status: Preparing
@@ -10328,8 +10333,8 @@ S_FAULT                 =12
 					memset(&ShmOCPP20Data->TransactionEvent[gun_index].idToken, 0x00, sizeof(struct IdTokenType));
 					memset(&ShmOCPP20Data->TransactionEvent[gun_index].meterValue, 0x00, sizeof(struct MeterValueType));
 				}
-				else if ( ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_AUTHORIZING)&&( ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_PREPARE_FOR_EVSE)) ||
-				          ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0) && ( ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1) )
+				else if ( ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus >= SYS_MODE_AUTHORIZING)&&( ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus <= SYS_MODE_PREPARE_FOR_EVSE)) ||
+				          ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0) && ( ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1) )
 						) //S_PRECHARGE
 				{
 					currentStatus = ConnectorStatusEnumType_Occupied; //OCPP Status: Preparing
@@ -11303,7 +11308,6 @@ int sendTransactionEventRequest(int gun_index)
 	{
 		result = PASS;
 	}
-
 	queue_operation(QUEUE_OPERATION_ADD, guid, message);
 	if(strstr((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, TransactionEventEnumTypeStr[TransactionEventEnumType_Started]) != NULL)
 		OCPP_insert_transaction_msg(YES, message);
@@ -11906,9 +11910,12 @@ int sendGetVariablesConfirmation(char *uuid, unsigned char variableQuantity)
 		if(strlen((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeValue) > 0)
 			json_object_object_add(variableResult, "attributeValue", json_object_new_string((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeValue));
 
-		json_object_object_add(evse, "id", json_object_new_int(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.evse.id));
-		json_object_object_add(evse, "connectorId", json_object_new_int(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.evse.connectorId));
-		json_object_object_add(component, "evse", evse);
+		if(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.evse.id > 0)
+		{
+			json_object_object_add(evse, "id", json_object_new_int(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.evse.id));
+			json_object_object_add(evse, "connectorId", json_object_new_int(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.evse.connectorId));
+			json_object_object_add(component, "evse", evse);
+		}
 		json_object_object_add(component, "name", json_object_new_string((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.name));
 		if(strlen((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.instance) > 0)
 			json_object_object_add(component, "instance", json_object_new_string((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.instance));
@@ -12276,15 +12283,20 @@ int sendSetVariableConfirmation(char *uuid, unsigned char variableQuantity)
 		json_object_object_add(variableResult, "attributeType", json_object_new_string((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeType));
 		json_object_object_add(variableResult, "attributeStatus", json_object_new_string((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus));
 
-		json_object_object_add(evse, "id", json_object_new_int(ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].component.evse.id));
-		json_object_object_add(evse, "connectorId", json_object_new_int(ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].component.evse.connectorId));
-		json_object_object_add(component, "evse", evse);
+		if(ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].component.evse.id > 0)
+		{
+			json_object_object_add(evse, "id", json_object_new_int(ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].component.evse.id));
+			json_object_object_add(evse, "connectorId", json_object_new_int(ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].component.evse.connectorId));
+			json_object_object_add(component, "evse", evse);
+		}
 		json_object_object_add(component, "name", json_object_new_string((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].component.name));
-		json_object_object_add(component, "instance", json_object_new_string((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].component.instance));
+		if(strlen((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].component.instance) > 0)
+			json_object_object_add(component, "instance", json_object_new_string((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].component.instance));
 		json_object_object_add(variableResult, "component", component);
 
 		json_object_object_add(variable, "name", json_object_new_string((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].variable.name));
-		json_object_object_add(variable, "instance", json_object_new_string((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].variable.instance));
+		if(strlen((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].variable.instance)>0)
+			json_object_object_add(variable, "instance", json_object_new_string((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].variable.instance));
 		json_object_object_add(variableResult, "variable", variable);
 
 		json_object_array_add(setVariableResults, variableResult);
@@ -18064,8 +18076,9 @@ int handleSetVariableMonitoringRequest(char *uuid, char *payload)
 int handleSetVariablesRequest(char *uuid, char *payload)
 {
 	mtrace();
-	int result = FAIL;
-	int isUnknownComponent = TRUE;
+	uint8_t result = FAIL;
+	uint8_t isUnknownComponent = TRUE;
+	uint8_t isNeedReconnect = FALSE;
 	json_object *SetVariables;
 
 	DEBUG_INFO("handleSetVariablesRequest...\n");
@@ -18148,6 +18161,20 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 						{
 							isUnknownComponent = FALSE;
 
+							// To make sure all boolean value is in uppercase
+							if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue,"true") != NULL) ||
+							   (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue,"True") != NULL) ||
+							   (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue,"TRUE") != NULL))
+							{
+								strcpy((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue,"TRUE");
+							}
+							else if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue,"false") != NULL) ||
+									(strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue,"False") != NULL) ||
+									(strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue,"FALSE") != NULL))
+							{
+								strcpy((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue,"FALSE");
+							}
+
 							if((strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].type, (char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeType) == NULL) &&
 							   (json_object_object_get(json_object_array_get_idx(json_object_object_get(SetVariables, "setVariableData"), idx), "attributeType") != NULL))
 							{
@@ -18161,6 +18188,34 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 								break;
 							}
 
+							if(((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "AuthCtrlr") != NULL)) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "Enabled") != NULL))
+							{
+								char tmp[ARRAY_SIZE(ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue)];
+
+								for(int tmpidx=0;tmpidx<ARRAY_SIZE(tmp);tmpidx++)
+									tmp[idx] = tolower(ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue[tmpidx]);
+								if((strstr((char*)tmp, "true") != NULL) || (strstr((char*)tmp, "false") != NULL))
+								{
+									strcpy((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue,(strstr((char*)tmp, "true") != NULL)? "TRUE" : "FALSE");
+									strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Accepted]);
+
+									if(strstr((char*)tmp, "true") != NULL)
+									{
+										ShmSysConfigAndInfo->SysConfig.AuthorisationMode = AUTH_MODE_ENABLE;
+									}
+									else
+									{
+										ShmSysConfigAndInfo->SysConfig.AuthorisationMode = AUTH_MODE_DISABLE;
+									}
+									StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
+								}
+								else
+								{
+									strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Rejected]);
+									break;
+								}
+							}
+
 							if(((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "OCPPCommCtrlr") != NULL)) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "NetworkConfigurationPriority") != NULL))
 							{
 								strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_RebootRequired]);
@@ -18198,6 +18253,11 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 									strcpy((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue,(strstr((char*)tmp, "true") != NULL)? "TRUE" : "FALSE");
 									strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Accepted]);
 								}
+								else
+								{
+									strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Rejected]);
+									break;
+								}
 							}
 
 							if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "OCPPCommCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "StatusNotificationInterval") != NULL))
@@ -18213,8 +18273,9 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 							if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "SecurityCtrlr") != NULL) &&
 							   ((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "SecurityProfile") != NULL) || (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "BasicAuthPassword") != NULL)))
 							{
+								isNeedReconnect = TRUE;
 								StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
-								SetOcppConnStatus(FALSE);
+								//SetOcppConnStatus(FALSE);
 							}
 
 							if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "AlignedDataCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "Interval") != NULL))
@@ -18302,6 +18363,11 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 		}
 
 		sendSetVariableConfirmation(uuid, json_object_array_length(json_object_object_get(SetVariables, "setVariableData")));
+
+		if(isNeedReconnect)
+		{
+			SetOcppConnStatus(FALSE);
+		}
 	}
 	json_object_put(SetVariables);
 
@@ -19014,8 +19080,8 @@ void handleAuthorizeResponse(char *payload, int gun_index)
 
 	//Update idTag information to authorization cache if supported
 	if((strcmp((const char *)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Enabled].variableAttribute[0].value, "TRUE") == 0) &&
-	   (strlen((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken) > 0) &&
-	   (strlen((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.cacheExpiryDateTime) >0) &&
+	   /*(strlen((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken) > 0) &&
+	   (strlen((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.cacheExpiryDateTime) >0) &&*/
 	   strstr((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, AuthorizationStatusEnumTypeStr[AuthorizationStatusEnumType_Accepted]) != NULL)
 	{
 		DB_addLocalCache(&ShmOCPP20Data->Authorize.idToken, &ShmOCPP20Data->Authorize.Response_idTokenInfo);

+ 3 - 2
EVSE/Modularization/ocpp20/Module_OcppBackend20.c

@@ -188,6 +188,7 @@ static int OCPP20Callback(struct lws *wsi, enum lws_callback_reasons reason, voi
 						DEBUG_ERROR("lws_add_http_header_by_token : WSI_TOKEN_HTTP_AUTHORIZATION\n");
 						return -1;
 					}
+					DEBUG_OCPPMESSAGE_INFO("SecurityProfile: %d\n", GetOcppSecurityProfile());
 					DEBUG_OCPPMESSAGE_INFO("Authorization: %s\n", buf);
 
 					break;
@@ -414,7 +415,7 @@ void* ConnectWsServer(void* data)  //int ConnectWsServer()
 	ContextInfo.uid = -1;
 	if(use_ssl)
 	{
-		ContextInfo.options |= LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT ;
+		ContextInfo.options |= LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
 	}
 
 	ContextInfo.protocols = protocols;
@@ -979,7 +980,7 @@ void* processWatchdog()
 			system("killall OcppBackend20");
 		}
 
-		if((0 < GetWebSocketPingInterval()) && ((GetWebSocketPingInterval()+5) <= getDiffSecNow(startTime.pingOn)) && (wsi_client != NULL) && (GetServerSign() == TRUE))
+		if((0 < GetWebSocketPingInterval()) && (0 < counterPingSend) && ((GetWebSocketPingInterval()+5) <= getDiffSecNow(startTime.pingOn)) && (wsi_client != NULL) && (GetServerSign() == TRUE))
 		{
 			DEBUG_WARN("Pong packet receive timeout.\n");
 			//system("killall OcppBackend20");