소스 검색

[Improve][Modularization][Module_OcppBackend / Module_OcppBackend20]

2021.09.10 / Folus Wen

Actions:
1. define.h change key name QueueOffLineStartTransactionMessage to QueueOffLineMeterValues.
2. Module_OcppBackend transaction related MeterValues save to queue depend on key QueueOffLineMeterValues setting.
3. Module_OcppBackend20 fix RequestStartTransaction & RequestStopTransaction namd.
4. Module_OcppBackend20 buffer related file name change to OCPP 2.0.1 naming.
5. Module_OcppBackend20 ID_FirmwareVersion logic fix.
6. Module_OcppBackend20 RequestStartTransaction logic fix.
7. Module_OcppBackend20 update firmware logic fix.

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 년 전
부모
커밋
6b1678366e

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

@@ -35,8 +35,8 @@ static char *requestNames[] = { "CancelReservation",
 								"GetVariables",
 								"InstallCertificate",
 								"PublishFirmware",
-								"RemoteStartTransaction",
-								"RemoteStopTransaction",
+								"RequestStartTransaction",
+								"RequestStopTransaction",
 								"ReserveNow",
 								"Reset",
 								"SendLocalList",
@@ -129,8 +129,8 @@ static FunCallPtr funcalls[] = {handleCancelReservationRequest,
 								handleGetVariablesRequest,
 								handleInstallCertificateRequest,
 								handlePublishFirmwareRequest,
-								handleRemoteStartTransactionRequest,
-								handleRemoteStopTransactionRequest,
+								handleRequestStartTransactionRequest,
+								handleRequestStopTransactionRequest,
 								handleReserveNowRequest,
 								handleResetRequest,
 								handleSendLocalListRequest,

+ 97 - 229
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -9512,7 +9512,7 @@ int sendTransactionEventRequest(int gun_index)
 	json_object *evse = json_object_new_object();
 	json_object *meterValues = json_object_new_array();
 	char TempStopTransaction[256];
-	sprintf(TempStopTransaction, "/Storage/OCPP/TempStopTransaction_%d", (gun_index+1));
+	sprintf(TempStopTransaction, "/Storage/OCPP/TempStopTransaction20_%d", (gun_index+1));
 
 	DEBUG_INFO("sendTransactionEventRequest...\n");
 
@@ -12868,9 +12868,7 @@ void createFirmwareVersionByDataTransfer(void)
 		json_object_object_add(FirmwareDataTransfer, "TelcomModemFwRev", json_object_new_string((char*)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSoftwareVer));
 	}
 
-	sprintf((char*)ShmOCPP20Data->DataTransfer[0].vendorId, "%s", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
-	sprintf((char*)ShmOCPP20Data->DataTransfer[0].messageId, "ID_FirmwareVersion");
-	sprintf((char*)ShmOCPP20Data->DataTransfer[0].data, json_object_to_json_string_ext(FirmwareDataTransfer, JSON_C_TO_STRING_PLAIN));
+	sprintf((char*)ShmOCPP20Data->DataTransfer[0].Response_data, json_object_to_json_string_ext(FirmwareDataTransfer, JSON_C_TO_STRING_PLAIN));
 
 	json_object_put(FirmwareDataTransfer);
 }
@@ -14225,28 +14223,28 @@ int handlePublishFirmwareRequest(char *uuid, char *payload)
 	return result;
 }
 
-int handleRemoteStartTransactionRequest(char *uuid, char *payload)
+int handleRequestStartTransactionRequest(char *uuid, char *payload)
 {
 	mtrace();
 	int result = FAIL;
 	int8_t gun_index = -1;
 	uint8_t isPeriodOverMax = FALSE;
 	uint8_t isProfileOverMax = FALSE;
-	uint8_t isConnectorMismatch = FALSE;
 	uint8_t isTxProfile = TRUE;
 	uint8_t existProfileQuantity = 0;
 	uint8_t filename[128]={0};
 	uint8_t word[2048]={0};
+	char cmdBuf[128];
 	FILE *filePtr;
 	json_object *RemoteStartTransaction;
 
-	DEBUG_INFO("handleRemoteStartTransactionRequest...\n");
+	DEBUG_INFO("handleRequestStartTransactionRequest...\n");
 	RemoteStartTransaction = json_tokener_parse(payload);
 	if(!is_error(RemoteStartTransaction))
 	{
 		if(json_object_object_get(RemoteStartTransaction, "evseId") != NULL)
 		{
-			gun_index = (json_object_get_int(json_object_object_get(RemoteStartTransaction, "evseId"))>0)?(json_object_get_int(json_object_object_get(RemoteStartTransaction, "evseId"))-1):-1;
+			gun_index = ((0 < json_object_get_int(json_object_object_get(RemoteStartTransaction, "evseId"))) && (json_object_get_int(json_object_object_get(RemoteStartTransaction, "evseId"))<=gunTotalNumber))?(json_object_get_int(json_object_object_get(RemoteStartTransaction, "evseId"))-1):-1;
 		}
 		else
 		{
@@ -14302,217 +14300,62 @@ int handleRemoteStartTransactionRequest(char *uuid, char *payload)
 			if(json_object_object_get(RemoteStartTransaction, "chargingProfile") != NULL)
 			{
 				// Check periods is over max configuration
-				if(json_object_array_length(json_object_object_get(json_object_object_get(json_object_object_get(RemoteStartTransaction, "chargingProfile"), "chargingSchedule"), "chargingSchedulePeriod")) > 10)
+				if(json_object_array_length(json_object_object_get(json_object_object_get(json_object_object_get(RemoteStartTransaction, "chargingProfile"), "chargingSchedule"), "chargingSchedulePeriod")) > atoi((char*)ShmOCPP20Data->ControllerComponentVariable[SmartChargingCtrlr_PeriodsPerSchedule].variableAttribute[0].value))
 				{
 					isPeriodOverMax = TRUE;
 				}
 
-				// Check periods is over max configuration
+				// Check profile purpose is TxProfile
 				if(strstr(json_object_get_string(json_object_object_get(json_object_object_get(RemoteStartTransaction, "chargingProfile"), "chargingProfilePurpose")), ChargingProfilePurposeEnumTypeStr[ChargingProfilePurposeEnumType_TxProfile]) != NULL)
 				{
-					if(gun_index >= 0)
-						sprintf((char*)filename, "/Storage/OCPP/TxProfile_%d_OCPP20.json", (gun_index+1));
-					else
-						isConnectorMismatch = TRUE;
+					sprintf((char*)filename, "/Storage/OCPP/TxProfile_%d_OCPP20.json", (gun_index+1));
 
-					if(!isConnectorMismatch)
+					filePtr = fopen((char*)filename, "r");
+					if (!filePtr)
 					{
-						filePtr = fopen((char*)filename, "r");
-						if (!filePtr)
-						{
-							DEBUG_INFO("%s not exist, create it.\n", filename);
-							filePtr = fopen((char*)filename, "w+");
-						}
-						else
+						DEBUG_INFO("%s not exist, create it.\n", filename);
+						filePtr = fopen((char*)filename, "w+");
+					}
+					else
+					{
+						//Check Charging Profile Count
+						while(fscanf(filePtr, "%s", word) != EOF)
 						{
-							//Check Charging Profile Count
-							while(fscanf(filePtr, "%s", word) != EOF)
+							//DEBUG_INFO("word=%s\n",word);
+							if(strstr((char*)word, "chargingProfileId")!= NULL)
 							{
-								//DEBUG_INFO("word=%s\n",word);
-								if(strstr((char*)word, "chargingProfileId")!= NULL)
-								{
-									existProfileQuantity += 1;
-								}
+								existProfileQuantity += 1;
 							}
 						}
-						fclose(filePtr);
 					}
+					fclose(filePtr);
 				}
 				else
 				{
 					isTxProfile = FALSE;
 				}
 
-				if(existProfileQuantity > 3)
+				if(existProfileQuantity >= atoi((char*)ShmOCPP20Data->ControllerComponentVariable[SmartChargingCtrlr_Entries].variableAttribute[0].value))
 					isProfileOverMax = TRUE;
 			}
 		}
 
-
 		// Profile replace or add info
-		if((gun_index >= 0) && !isPeriodOverMax && !isProfileOverMax && !isConnectorMismatch && isTxProfile)
+		if((gun_index >= 0) && !isPeriodOverMax && !isProfileOverMax && isTxProfile)
 		{
-			FILE *infile;
-			FILE *outfile;
-			char tmpProfileName[32];
-			char rmFileCmd[128];
-			char tempchargingProfilePurposeStr[30]={0};
-			int tempconnectorIdInt=0, tempchargingProfileIdInt=0, tempstackLevelInt=0;
-
-			sprintf((char*)tmpProfileName, "/Storage/OCPP/tmpProfileRemote");
-			infile = fopen ((char*)filename, "r");
-			outfile = fopen ((char*)tmpProfileName, "w");
-
-			int d = fgetc(infile);
-			rewind(infile);
-
-			if(d == EOF)
-			{
-				// Profile is empty
-				fprintf(outfile,"%s\n", payload);
-
-				fclose(infile);
-				fclose(outfile);
-
-				sprintf(rmFileCmd,"rm -f %s",filename);
-				system(rmFileCmd);
-
-				rename((char*)tmpProfileName, (char*)filename);
-			}
-			else
+			if(strlen((char*)filename) > 0)
 			{
-				// Profile is not empty
-				char buf[2048]={0};
-				int ChargingProfileAdded = FALSE;
-
-				while (fgets(buf, sizeof(buf), infile) != NULL)
-				{
-					buf[strlen(buf) - 1] = '\0'; // eat the newline fgets() stores
-
-					json_object *tmpChargingProfile;
-					tmpChargingProfile = json_tokener_parse(buf);
-					if(!is_error(tmpChargingProfile))
-					{
-						if(json_object_object_get(tmpChargingProfile, "evseId") != NULL)
-						{
-							tempconnectorIdInt = json_object_get_int(json_object_object_get(tmpChargingProfile, "evseId") );
-						}
-
-						if(json_object_object_get(tmpChargingProfile, "csChargingProfiles") != NULL)
-						{
-							if(json_object_object_get(json_object_object_get(tmpChargingProfile, "csChargingProfiles"), "chargingProfileId") != NULL)
-							{
-								tempchargingProfileIdInt = json_object_get_int(json_object_object_get(json_object_object_get(tmpChargingProfile, "csChargingProfiles"), "chargingProfileId"));
-							}
-
-							if(json_object_object_get(json_object_object_get(tmpChargingProfile, "csChargingProfiles"), "stackLevel") != NULL)
-							{
-								tempstackLevelInt = json_object_get_int(json_object_object_get(json_object_object_get(tmpChargingProfile, "csChargingProfiles"), "stackLevel"));
-							}
-
-							if(json_object_object_get(json_object_object_get(tmpChargingProfile, "csChargingProfiles"), "chargingProfilePurpose") != NULL)
-							{
-								strcpy(tempchargingProfilePurposeStr, json_object_get_string(json_object_object_get(json_object_object_get(tmpChargingProfile, "csChargingProfiles"), "chargingProfilePurpose")));
-							}
-						}
-					}
-					json_object_put(tmpChargingProfile);
-
-					if((tempconnectorIdInt == (gun_index+1)) &&
-					   (tempchargingProfileIdInt == json_object_get_int(json_object_object_get(json_object_object_get(RemoteStartTransaction, "csChargingProfiles"), "chargingProfileId"))))
-					{
-						if((tempstackLevelInt == json_object_get_int(json_object_object_get(json_object_object_get(RemoteStartTransaction, "csChargingProfiles"), "stackLevel"))) &&
-						   (strcmp(tempchargingProfilePurposeStr, json_object_get_string(json_object_object_get(json_object_object_get(RemoteStartTransaction, "csChargingProfiles"), "chargingProfilePurpose"))) == 0))
-						{
-							if(ChargingProfileAdded == FALSE)
-							{
-								fprintf(outfile,"%s\n",payload);
-								ChargingProfileAdded = TRUE;
-							}
-						}
-						else
-						{
-							if(tempstackLevelInt < json_object_get_int(json_object_object_get(json_object_object_get(RemoteStartTransaction, "csChargingProfiles"), "stackLevel")))
-							{
-								if(ChargingProfileAdded == FALSE)
-								{
-									fprintf(outfile,"%s\n",buf);
-									fprintf(outfile,"%s\n",payload);
-									ChargingProfileAdded = TRUE;
-								}
-								else
-								{
-									fprintf(outfile,"%s\n",buf);
-								}
-							}
-							else
-							{
-								if(ChargingProfileAdded == FALSE)
-								{
-									fprintf(outfile,"%s\n",buf);
-									fprintf(outfile,"%s\n",payload);
-									ChargingProfileAdded = TRUE;
-								}
-								else
-								{
-									fprintf(outfile,"%s\n",buf);
-								}
-							}
-						}
-					}
-					else
-					{
-						if(tempchargingProfileIdInt < json_object_get_int(json_object_object_get(json_object_object_get(RemoteStartTransaction, "csChargingProfiles"), "chargingProfileId")))
-						{
-							if(ChargingProfileAdded == FALSE)
-							{
-								fprintf(outfile,"%s\n",buf);
-								fprintf(outfile,"%s\n",payload);
-								ChargingProfileAdded = TRUE;
-							}
-							else
-							{
-								fprintf(outfile,"%s\n",buf);
-							}
-						}
-						else if(tempstackLevelInt < json_object_get_int(json_object_object_get(json_object_object_get(RemoteStartTransaction, "csChargingProfiles"), "stackLevel")))
-						{
-							if(ChargingProfileAdded == FALSE)
-							{
-								fprintf(outfile,"%s\n",buf);
-								fprintf(outfile,"%s\n",payload);
-								ChargingProfileAdded = TRUE;
-							}
-							else
-							{
-								fprintf(outfile,"%s\n",buf);
-							}
-						}
-						else
-						{
-							if(ChargingProfileAdded == FALSE)
-							{
-								fprintf(outfile,"%s\n",buf);
-								fprintf(outfile,"%s\n",payload);
-								ChargingProfileAdded = TRUE;
-							}
-							else
-							{
-								fprintf(outfile,"%s\n",buf);
-							}
-						}
-					}
-				} // end of while loop
-
-				fclose(infile);
-				fclose(outfile);
-
-				sprintf(rmFileCmd,"rm -f %s",filename);
-				system(rmFileCmd);
+				// Save profile to file
+				sprintf(cmdBuf, "rm -f /Storage/OCPP/TxProfile_%d_OCPP20.json", (gun_index+1));
+				system(cmdBuf);
 
-				rename((char*)tmpProfileName, (char*)filename);
+				sprintf((char*)filename, "/Storage/OCPP/TxProfile_%d_OCPP20.json.json",  (gun_index+1));
+				filePtr = fopen((char*)filename, "w");
+				fprintf(filePtr, "{\"connectorId\":%d,\"csChargingProfiles\":%s}\n", (gun_index+1), json_object_to_json_string_ext(json_object_object_get(RemoteStartTransaction, "chargingProfile"), JSON_C_TO_STRING_PLAIN));
+				fclose(filePtr);
 			}
 
+			ShmOCPP20Data->CsMsg.bits[gun_index].RequestStartTransactionReq = ON;
 			sprintf((char*)ShmOCPP20Data->RequestStartTransaction[gun_index].Response_status, "%s", RequestStartStopStatusEnumTypeStr[RequestStartStopStatusEnumType_Accepted] );
 			random_uuid((char*)ShmOCPP20Data->RequestStartTransaction[gun_index].Response_transactionId);
 			result = PASS;
@@ -14522,9 +14365,6 @@ int handleRemoteStartTransactionRequest(char *uuid, char *payload)
 			if(gun_index < 0)
 				DEBUG_WARN("Connector id is wrong.\n");
 
-			if(isConnectorMismatch)
-				DEBUG_WARN("Connector id is mismatch.\n");
-
 			if(isPeriodOverMax)
 				DEBUG_WARN("Profile periods quantity is over spec.\n");
 
@@ -14544,7 +14384,7 @@ int handleRemoteStartTransactionRequest(char *uuid, char *payload)
 	return result;
 }
 
-int handleRemoteStopTransactionRequest(char *uuid, char *payload)
+int handleRequestStopTransactionRequest(char *uuid, char *payload)
 {
 	mtrace();
 	int result = FAIL;
@@ -14555,7 +14395,7 @@ int handleRemoteStopTransactionRequest(char *uuid, char *payload)
 	int transactionIdIsNULL= TRUE;
 	json_object *RemoteStopTransaction;
 
-	DEBUG_INFO("handleRemoteStopTransactionRequest...\n");
+	DEBUG_INFO("handleRequestStopTransactionRequest...\n");
 
 	if(server_pending == TRUE)
 	{
@@ -15411,7 +15251,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
 		if(json_object_object_get(SetChargingProfile, "chargingProfile") != NULL)
 		{
 			// Check periods is over max configuration
-			if(json_object_array_length(json_object_object_get(json_object_object_get(json_object_object_get(SetChargingProfile, "chargingProfile"), "chargingSchedule"), "chargingSchedulePeriod")) > 10)
+			if(json_object_array_length(json_object_object_get(json_object_object_get(json_object_object_get(SetChargingProfile, "chargingProfile"), "chargingSchedule"), "chargingSchedulePeriod")) > atoi((char*)ShmOCPP20Data->ControllerComponentVariable[SmartChargingCtrlr_PeriodsPerSchedule].variableAttribute[0].value))
 			{
 				isPeriodOverMax = TRUE;
 			}
@@ -15514,7 +15354,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
 
 			}
 
-			if(existProfileQuantity > 3)
+			if(existProfileQuantity >= atoi((char*)ShmOCPP20Data->ControllerComponentVariable[SmartChargingCtrlr_Entries].variableAttribute[0].value))
 				isProfileOverMax = TRUE;
 		}
 
@@ -16278,6 +16118,11 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 								StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
 								SetOcppConnStatus(FALSE);
 							}
+
+							if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "OCPPCommCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "HeartbeatInterval") != NULL))
+							{
+								HeartBeatWaitTime = (atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value)<10) ? 10 : atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value);
+							}
 						}
 					}
 				}
@@ -16371,6 +16216,7 @@ int handleTriggerMessageRequest(char *uuid, char *payload)
 		   ((FirmwareStatusNotificationStatus != FirmwareStatusEnumType_Downloading) && (FirmwareStatusNotificationStatus != FirmwareStatusEnumType_Downloaded) && (FirmwareStatusNotificationStatus != FirmwareStatusEnumType_Idle) && (FirmwareStatusNotificationStatus != FirmwareStatusEnumType_Installing)))
 		{
 			FirmwareStatusNotificationStatus = FirmwareStatusEnumType_Idle;
+			sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s", FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_Idle]);
 		}
 
 		ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
@@ -16539,7 +16385,6 @@ int handleUnlockConnectorRequest(char *uuid, char *payload)
 				{
 					//stop Transaction
 					ShmOCPP20Data->CsMsg.bits[connectorIdInt-1].UnlockConnectorReq = ON;
-
 				}
 			}
 		}
@@ -16612,11 +16457,9 @@ int handleUnlockConnectorRequest(char *uuid, char *payload)
 				if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex ) && ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_CHARGING) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_IDLE) ))
 				{
 					ShmOCPP20Data->CsMsg.bits[connectorIdInt-1].UnlockConnectorReq = ON;
-
 				}
 			}
 		}
-
 		ShmOCPP20Data->UnlockConnector[connectorIdInt-1].connectorId = connectorIdInt;
 		strcpy((char *)ShmOCPP20Data->UnlockConnector[connectorIdInt-1].guid, uuid);
 		result = TRUE;
@@ -16624,8 +16467,7 @@ int handleUnlockConnectorRequest(char *uuid, char *payload)
 	}
 
 end:
-	//json_object_put(obj);  --- remove temporally
-	sendUnlockConnectorConfirmation(uuid, connectorIdInt-1);
+	ShmOCPP20Data->CsMsg.bits[connectorIdInt-1].UnlockConnectorConf = ON;
 	return result;
 }
 
@@ -16664,37 +16506,52 @@ void *UpdateFirmwareProcess(void *data)
 {
 	pthread_detach(pthread_self());
 	mtrace();
-	int retriesInt =0, retryIntervalInt=0;
 	char protocol[10], user[64],password[64],host[128], path[512], ftppath[512],host1[128],path1[512];
 	int port=0;
-	char locationstr[1024]={0}, retrieveDatestr[36]={0};
 	int isSuccess = 0;
 	char ftpbuf[1024];
 	char temp[1024];
 	char * pch;
 
 
-	DEBUG_INFO("handleUpdateFirmwareRequest ...\n");
+	DEBUG_INFO("handleUpdateFirmwareRequest...\n");
 	json_object *UpdateFirmware;
 	UpdateFirmware = json_tokener_parse(UpdateFirmwarepayloadData);
 	if(!is_error(UpdateFirmware))
 	{
 		// Required data
-		if(json_object_object_get(UpdateFirmware, "location") != NULL)
-			sprintf((char*)locationstr, "%s", json_object_get_string(json_object_object_get(UpdateFirmware, "location")));
+		if(json_object_object_get(UpdateFirmware, "requestId"))
+		{
+			ShmOCPP20Data->UpdateFirmware.requestId = json_object_get_int(json_object_object_get(UpdateFirmware, "requestId"));
+		}
+
+		if(json_object_object_get(UpdateFirmware, "firmware"))
+		{
+			if(json_object_object_get(json_object_object_get(UpdateFirmware, "firmware"), "location") != NULL)
+				sprintf((char*)ShmOCPP20Data->UpdateFirmware.firmware.location, "%s", json_object_get_string(json_object_object_get(json_object_object_get(UpdateFirmware, "firmware"), "location")));
+
+			if(json_object_object_get(json_object_object_get(UpdateFirmware, "firmware"), "retrieveDate") != NULL)
+				sprintf((char*)ShmOCPP20Data->UpdateFirmware.firmware.retrieveDateTime, "%s", json_object_get_string(json_object_object_get(json_object_object_get(UpdateFirmware, "firmware"), "retrieveDate")));
+
+			if(json_object_object_get(json_object_object_get(UpdateFirmware, "firmware"), "installDateTime") != NULL)
+				sprintf((char*)ShmOCPP20Data->UpdateFirmware.firmware.location, "%s", json_object_get_string(json_object_object_get(json_object_object_get(UpdateFirmware, "firmware"), "installDateTime")));
 
-		if(json_object_object_get(UpdateFirmware, "retrieveDate") != NULL)
-			sprintf((char*)retrieveDatestr, "%s", json_object_get_string(json_object_object_get(UpdateFirmware, "retrieveDate")));
+			if(json_object_object_get(json_object_object_get(UpdateFirmware, "firmware"), "signingCertificate") != NULL)
+				sprintf((char*)ShmOCPP20Data->UpdateFirmware.firmware.location, "%s", json_object_get_string(json_object_object_get(json_object_object_get(UpdateFirmware, "firmware"), "signingCertificate")));
+
+			if(json_object_object_get(json_object_object_get(UpdateFirmware, "firmware"), "signature") != NULL)
+				sprintf((char*)ShmOCPP20Data->UpdateFirmware.firmware.location, "%s", json_object_get_string(json_object_object_get(json_object_object_get(UpdateFirmware, "firmware"), "signature")));
+		}
 
 		// Optional data
 		if(json_object_object_get(UpdateFirmware, "retries"))
 		{
-			retriesInt = json_object_get_int(json_object_object_get(UpdateFirmware, "retries"));
+			ShmOCPP20Data->UpdateFirmware.retries = json_object_get_int(json_object_object_get(UpdateFirmware, "retries"));
 		}
 
 		if(json_object_object_get(UpdateFirmware, "retryInterval"))
 		{
-			retryIntervalInt = json_object_get_int(json_object_object_get(UpdateFirmware, "retryInterval"));
+			ShmOCPP20Data->UpdateFirmware.retryInterval = json_object_get_int(json_object_object_get(UpdateFirmware, "retryInterval"));
 		}
 	}
 	json_object_put(UpdateFirmware);
@@ -16703,23 +16560,24 @@ void *UpdateFirmwareProcess(void *data)
 	memset(path, 0, ARRAY_SIZE(path));
 
 	// Wait retrieveData
-	if(strlen(retrieveDatestr) > 10)
+	if(strlen((char*)ShmOCPP20Data->UpdateFirmware.firmware.retrieveDateTime) > 10)
 	{
+		ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
 		sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s", FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_DownloadScheduled]);
 		ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
 		do
 		{
 			sleep(1);
-		}while(!isOvertNow((uint8_t*)retrieveDatestr));
+		}while(!isOvertNow(ShmOCPP20Data->UpdateFirmware.firmware.retrieveDateTime));
 	}
 
 	system("rm -f /mnt/*");
-	if(strncmp(locationstr,"http", 4) == 0)
+	if(strncmp((char*)ShmOCPP20Data->UpdateFirmware.firmware.location,"http", 4) == 0)
 	{
-		sscanf(locationstr,"%[^:]:%*2[/]%[^/]/%199[^\n]", protocol, host, path);
+		sscanf((char*)ShmOCPP20Data->UpdateFirmware.firmware.location,"%[^:]:%*2[/]%[^/]/%199[^\n]", protocol, host, path);
 
 		sprintf(ftppath,"/%s", path);
-		DEBUG_INFO("locationstr: %s\n", locationstr);
+		DEBUG_INFO("locationstr: %s\n", ShmOCPP20Data->UpdateFirmware.firmware.location);
 		DEBUG_INFO("protocol: %s\n",protocol);
 		DEBUG_INFO("host: %s\n",host);
 		DEBUG_INFO("path: %s\n",path);
@@ -16745,33 +16603,37 @@ void *UpdateFirmwareProcess(void *data)
 
 		do
 		{
+			ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
 			sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s", FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_Downloading]);
 			ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
 			sleep(3);
 
-			isSuccess = httpDownLoadFile(host, ftppath, filenametemp, locationstr);
+			isSuccess = httpDownLoadFile(host, ftppath, filenametemp, (char*)ShmOCPP20Data->UpdateFirmware.firmware.location);
 			if(!isSuccess)
 			{
+				ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
 				sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s", FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_DownloadFailed]);
 				ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
-				if(retriesInt>0)sleep(retryIntervalInt);else sleep(1);
+				if(ShmOCPP20Data->UpdateFirmware.retries>0)sleep(ShmOCPP20Data->UpdateFirmware.retryInterval);else sleep(1);
+				ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
 				sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s",FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_Idle]);
 				ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
 			}
 			else
 			{
+				ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
 				sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s", FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_Downloaded]);
 				ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
 			}
-			retriesInt--;
-		}while((isSuccess == 0)&&(retriesInt >= 0));
+			ShmOCPP20Data->UpdateFirmware.retries--;
+		}while((isSuccess == 0)&&(ShmOCPP20Data->UpdateFirmware.retries >= 0));
 	}
-    else if(strncmp(locationstr,"ftp", 3) == 0) // ftp
+    else if(strncmp((char*)ShmOCPP20Data->UpdateFirmware.firmware.location,"ftp", 3) == 0)
 	{
     	memset(ftpbuf, 0, ARRAY_SIZE(ftpbuf));
     	memset(temp, 0, ARRAY_SIZE(temp));
 
-    	strcpy(ftpbuf, locationstr);
+    	strcpy(ftpbuf, (char*)ShmOCPP20Data->UpdateFirmware.firmware.location);
     	int ftppathlen=strlen(ftpbuf);
     	int i=1;
     	char filenametemp[50];
@@ -16816,35 +16678,41 @@ void *UpdateFirmwareProcess(void *data)
 
 		do
 		{
+			ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
 			sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s", FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_Downloading]);
 			ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
 			sleep(3);
 
-			isSuccess = ftpDownLoadFile(host1, user, password, port, ftppath, filenametemp, locationstr);
+			isSuccess = ftpDownLoadFile(host1, user, password, port, ftppath, filenametemp, (char*)ShmOCPP20Data->UpdateFirmware.firmware.location);
 			if(!isSuccess)
 			{
 				//BulldogUtil.sleepMs(interval*1000);
 				DEBUG_INFO("Update firmware request and download file fail.\n");
+				ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
 				sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s", FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_DownloadFailed]);
 				ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
-				if(retriesInt>0)sleep(retryIntervalInt);else sleep(1);
+				if(ShmOCPP20Data->UpdateFirmware.retries>0)sleep(ShmOCPP20Data->UpdateFirmware.retryInterval);else sleep(1);
+				ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
 				sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s",FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_Idle]);
 				ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
 			}
 			else
 			{
+				ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
 				sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s", FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_Downloaded]);
 				ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
 
 			}
-			retriesInt--;
-		}while((!isSuccess)&&(retriesInt >= 0));
+			ShmOCPP20Data->UpdateFirmware.retries--;
+		}while((!isSuccess)&&(ShmOCPP20Data->UpdateFirmware.retries >= 0));
 	}
     else
     {
+    	ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
 		sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s", FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_DownloadFailed]);
 		ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
 		sleep(1);
+		ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
 		sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "%s",FirmwareStatusEnumTypeStr[FirmwareStatusEnumType_Idle]);
 		ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
     }
@@ -17739,7 +17607,7 @@ void storeTempStopTransaction(int gun_index)
 	json_object *idToken = json_object_new_object();
 	json_object *evse = json_object_new_object();
 	json_object *meterValues = json_object_new_array();
-	sprintf(TempStopTransaction, "/Storage/OCPP/TempStopTransaction_%d", (gun_index+1));
+	sprintf(TempStopTransaction, "/Storage/OCPP/TempStopTransaction20_%d", (gun_index+1));
 
 	DEBUG_INFO("storeTempStopTransaction...\n");
 
@@ -18174,12 +18042,12 @@ void checkTempStopTransaction(int gun_index)
 	char guid[37]={0};
 	char tempdata[65]={0};
 	char TempStopTransaction[256];
-	sprintf(TempStopTransaction, "/Storage/OCPP/TempStopTransaction_%d", (gun_index+1));
+	sprintf(TempStopTransaction, "/Storage/OCPP/TempStopTransaction20_%d", (gun_index+1));
 
 	fptr1 = fopen(TempStopTransaction, "r");
 	if (!fptr1)
 	{
-		//DEBUG_INFO("TempStopTransaction_%d not found or unable to open the input file!\n", (gun_index+1));
+		//DEBUG_INFO("TempStopTransaction20_%d not found or unable to open the input file!\n", (gun_index+1));
 	    return ;
 	}
 

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

@@ -931,8 +931,8 @@ int handleGetTransactionStatusRequest(char *uuid, char *payload);
 int handleGetVariablesRequest(char *uuid, char *payload);
 int handleInstallCertificateRequest(char *uuid, char *payload);
 int handlePublishFirmwareRequest(char *uuid, char *payload);
-int handleRemoteStartTransactionRequest(char *uuid, char *payload);
-int handleRemoteStopTransactionRequest(char *uuid, char *payload);
+int handleRequestStartTransactionRequest(char *uuid, char *payload);
+int handleRequestStopTransactionRequest(char *uuid, char *payload);
 int handleReserveNowRequest(char *uuid, char *payload);
 int handleResetRequest(char *uuid, char *payload);
 int handleSendLocalListRequest(char *uuid, char *payload);

+ 30 - 31
EVSE/Modularization/ocpp20/Module_OcppBackend20.c

@@ -470,7 +470,7 @@ int isQueueOverSize()
 	uint32_t file_size;
 	uint8_t result = FALSE;
 
-	fp = fopen("/Storage/OCPP/TransactionRelatedQueue" , "r");
+	fp = fopen("/Storage/OCPP/TransactionRelatedQueue20" , "r");
 	if(fp != NULL)
 	{
 		fseek(fp, 0L, SEEK_END);
@@ -515,18 +515,18 @@ int showfront(char *uuid, char *data)
 
 	memset(rmFileCmd, 0, ARRAY_SIZE(rmFileCmd));
 
-	if((access("/Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
+	if((access("/Storage/OCPP/TransactionRelatedQueue20",F_OK))!=-1)
 	{
-		//DEBUG_INFO("TransactionRelatedQueue exist.\n");
+		//DEBUG_INFO("TransactionRelatedQueue20 exist.\n");
 	}
 	else
 	{
-		//DEBUG_INFO("TransactionRelatedQueue not exist\n");
-		FILE *log = fopen("/Storage/OCPP/TransactionRelatedQueue", "w+");
+		//DEBUG_INFO("TransactionRelatedQueue20 not exist\n");
+		FILE *log = fopen("/Storage/OCPP/TransactionRelatedQueue20", "w+");
 
 		if(log == NULL)
 		{
-			DEBUG_INFO("Can't Create File TransactionRelatedQueue \n");
+			DEBUG_INFO("Can't Create File TransactionRelatedQueue20 \n");
 			return FALSE;
 		}
 		else
@@ -537,9 +537,9 @@ int showfront(char *uuid, char *data)
 
 
 	/* opening file for reading */
-	fp = fopen("/Storage/OCPP/TransactionRelatedQueue" , "r");
+	fp = fopen("/Storage/OCPP/TransactionRelatedQueue20" , "r");
 	if(fp == NULL) {
-		DEBUG_INFO("Error opening TransactionRelatedQueue file");
+		DEBUG_INFO("Error opening TransactionRelatedQueue20 file");
 		return FALSE;
 	}
 
@@ -551,7 +551,7 @@ int showfront(char *uuid, char *data)
 			DEBUG_INFO("It is a blank line");
 			fclose(fp);
 			memset(rmFileCmd, 0, ARRAY_SIZE(rmFileCmd));
-			sprintf(rmFileCmd,"rm -f %s","/Storage/OCPP/TransactionRelatedQueue");
+			sprintf(rmFileCmd,"rm -f %s","/Storage/OCPP/TransactionRelatedQueue20");
 			system(rmFileCmd);
 			result = FALSE;
 
@@ -611,18 +611,18 @@ int addq(char *uuid, char *data)
 
 	memset(rmFileCmd, 0, ARRAY_SIZE(rmFileCmd));
 
-	if((access("/Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
+	if((access("/Storage/OCPP/TransactionRelatedQueue20",F_OK))!=-1)
 	{
-		//DEBUG_INFO("TransactionRelatedQueue exist.\n");
+		//DEBUG_INFO("TransactionRelatedQueue20 exist.\n");
 	}
 	else
 	{
-		//DEBUG_INFO("TransactionRelatedQueue not exist\n");
-		FILE *log = fopen("/Storage/OCPP/TransactionRelatedQueue", "w+");
+		//DEBUG_INFO("TransactionRelatedQueue20 not exist\n");
+		FILE *log = fopen("/Storage/OCPP/TransactionRelatedQueue20", "w+");
 
 		if(log == NULL)
 		{
-			//DEBUG_INFO("Can't Create File TransactionRelatedQueue \n");
+			//DEBUG_INFO("Can't Create File TransactionRelatedQueue20 \n");
 			return FALSE;
 		}
 		else
@@ -632,7 +632,7 @@ int addq(char *uuid, char *data)
 	}
 
 	// open file for writing
-	outfile = fopen ("/Storage/OCPP/TransactionRelatedQueue", "a");
+	outfile = fopen ("/Storage/OCPP/TransactionRelatedQueue20", "a");
 	DEBUG_INFO("data = %s\n",data);
 	fputs(data, outfile);
 	fputs("\n", outfile);
@@ -674,14 +674,14 @@ int delq()
 
 	memset(rmFileCmd, 0, ARRAY_SIZE(rmFileCmd));
 
-	if((access("/Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
+	if((access("/Storage/OCPP/TransactionRelatedQueue20",F_OK))!=-1)
 	{
-		//DEBUG_INFO("TransactionRelatedQueue exist.\n");
+		//DEBUG_INFO("TransactionRelatedQueue20 exist.\n");
 	}
 	else
 	{
-		//DEBUG_INFO("TransactionRelatedQueue not exist\n");
-		FILE *log = fopen("/Storage/OCPP/TransactionRelatedQueue", "w+");
+		//DEBUG_INFO("TransactionRelatedQueue20 not exist\n");
+		FILE *log = fopen("/Storage/OCPP/TransactionRelatedQueue20", "w+");
 
 		if(log == NULL)
 		{
@@ -695,8 +695,7 @@ int delq()
 	}
 
 	// open file for writing
-	strcpy(filename, "/Storage/OCPP/TransactionRelatedQueue");
-	infile = fopen ("/Storage/OCPP/TransactionRelatedQueue", "r");
+	infile = fopen ("/Storage/OCPP/TransactionRelatedQueue20", "r");
 	outfile = fopen (tempfile, "w");
 
 	/*检测到文件结束标识返回1,否则返回0。*/
@@ -708,7 +707,7 @@ int delq()
 
 	if(c == EOF)
 	{
-		//DEBUG_INFO("TransactionRelatedQueue is  NULL\n");
+		//DEBUG_INFO("TransactionRelatedQueue20 is  NULL\n");
 
 		fclose(infile);
 		fclose(outfile);
@@ -753,11 +752,11 @@ int delq()
 
 		if(resultRename == 0)
 		{
-			//DEBUG_INFO("TransactionRelatedQueue file renamed successfully");
+			//DEBUG_INFO("TransactionRelatedQueue20 file renamed successfully");
 		}
 		else
 		{
-			//DEBUG_INFO("Error: unable to rename the TransactionRelatedQueue file");
+			//DEBUG_INFO("Error: unable to rename the TransactionRelatedQueue20 file");
 		}
 
 		DEBUG_INFO("delq() end\n");
@@ -786,14 +785,14 @@ int showqueue()
 
 	memset(rmFileCmd, 0, ARRAY_SIZE(rmFileCmd));
 
-	if((access("/Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
+	if((access("/Storage/OCPP/TransactionRelatedQueue20",F_OK))!=-1)
 	{
-		//DEBUG_INFO("TransactionRelatedQueue exist.\n");
+		//DEBUG_INFO("TransactionRelatedQueue20 exist.\n");
 	}
 	else
 	{
-		//DEBUG_INFO("TransactionRelatedQueue not exist\n");
-		FILE *log = fopen("/Storage/OCPP/TransactionRelatedQueue", "w+");
+		//DEBUG_INFO("TransactionRelatedQueue20 not exist\n");
+		FILE *log = fopen("/Storage/OCPP/TransactionRelatedQueue20", "w+");
 
 		if(log == NULL)
 		{
@@ -806,11 +805,11 @@ int showqueue()
 		}
 	}
 
-	FILE *fp = fopen("/Storage/OCPP/TransactionRelatedQueue", "r");
+	FILE *fp = fopen("/Storage/OCPP/TransactionRelatedQueue20", "r");
 	char line[QUEUE_MESSAGE_LENGTH]={0};
 	// check if file exist (and you can open it) or not
 	if (fp == NULL) {
-		DEBUG_INFO("can open file TransactionRelatedQueue!");
+		DEBUG_INFO("can open file TransactionRelatedQueue20!");
 	  return FALSE;
 	}
 
@@ -850,7 +849,7 @@ int sentqueue(){
 	}
 
 	/* opening file for reading */
-	fp = fopen("/Storage/OCPP/TransactionRelatedQueue" , "r");
+	fp = fopen("/Storage/OCPP/TransactionRelatedQueue20" , "r");
 	if(fp == NULL)
 	{
 		DEBUG_ERROR("Error opening file");

+ 27 - 28
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -7434,7 +7434,7 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 
 	if((dataType != ReadingContext_Trigger) &&
 	   (dataType != ReadingContext_Sample_Clock) &&
-	   (ShmOCPP16Data->MeterValues[gun_index].TransactionId != -1))
+	   ((ShmOCPP16Data->MeterValues[gun_index].TransactionId != -1) || (strstr((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData, "TRUE"))))
 		queue_operation(QUEUE_OPERATION_ADD, guid, queuedata );
 	else
 	{
@@ -14062,7 +14062,7 @@ int initialConfigurationTable(void)
 	char sstr[256]={0};
 	int c = 0;
 	char *loc;
-	int	confVersion = 7;
+	int	confVersion = 8;
 
 	DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
 	//start_t = clock();
@@ -14366,12 +14366,12 @@ int initialConfigurationTable(void)
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","WebSocketPingInterval", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[WebSocketPingInterval].ItemData);
 
-		// QueueOffLineStartTransactionMessage
-		ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemAccessibility = 1;
-		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemName, "QueueOffLineStartTransactionMessage");
-		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData, "TRUE" );
+		// QueueOffLineMeterValues
+		ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemName, "QueueOffLineMeterValues");
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData, "FALSE" );
 
-		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","QueueOffLineStartTransactionMessage", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData);
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","QueueOffLineMeterValues", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData);
 
 		// AuthorizationKey
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemAccessibility = 1;
@@ -14796,10 +14796,10 @@ int initialConfigurationTable(void)
 					 sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[WebSocketPingInterval].ItemData, "%d", atoi(valuestr) );
 				}
 
-				if(strcmp(keystr, "QueueOffLineStartTransactionMessage") == 0)
+				if(strcmp(keystr, "QueueOffLineMeterValues") == 0)
 				{
-					 ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
-					 sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData, "%s", valuestr);
+					 ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					 sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData, "%s", valuestr);
 				}
 
 				if(strcmp(keystr, "AuthorizationKey") == 0)
@@ -15256,14 +15256,14 @@ void StoreConfigurationTable(void)
 
 	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","WebSocketPingInterval", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[WebSocketPingInterval].ItemData);
 
-	// QueueOffLineStartTransactionMessage
+	// QueueOffLineMeterValues
 	/*
-	ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemAccessibility = 0;
-	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemName, "QueueOffLineStartTransactionMessage");
-	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData, "TRUE" );
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemAccessibility = 0;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemName, "QueueOffLineMeterValues");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData, "TRUE" );
 	*/
 
-	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","QueueOffLineStartTransactionMessage", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData);
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","QueueOffLineMeterValues", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData);
 
 	// AuthorizationKey
 	/*
@@ -16061,21 +16061,21 @@ void getKeyValue(char *keyReq)
 
 	      }
 
-	      if(isEmpty ||  strcmp(keyReq, "QueueOffLineStartTransactionMessage") == 0 )
+	      if(isEmpty ||  strcmp(keyReq, "QueueOffLineMeterValues") == 0 )
 		  {
-			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_QueueOffLineStartTransactionMessage].Item, "QueueOffLineStartTransactionMessage");
-			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineStartTransactionMessage].Key, "QueueOffLineStartTransactionMessage");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_QueueOffLineMeterValues].Item, "QueueOffLineMeterValues");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineMeterValues].Key, "QueueOffLineMeterValues");
 
-			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemAccessibility == 1)
+			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemAccessibility == 1)
 			  {
-				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineStartTransactionMessage].ReadOnly, "0"/*"FALSE"*/);
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineMeterValues].ReadOnly, "0"/*"FALSE"*/);
 			  }
 			  else
 			  {
-				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineStartTransactionMessage].ReadOnly, "1"/*"TRUE"*/);
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineMeterValues].ReadOnly, "1"/*"TRUE"*/);
 			  }
 
-			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineStartTransactionMessage].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData );
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineMeterValues].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData );
 			  isKnowKey = TRUE;
 		  }
 
@@ -17208,17 +17208,17 @@ int setKeyValue(char *key, char *value)
     	}
     }
 
-    if(strcmp(key, "QueueOffLineStartTransactionMessage") == 0)
+    if(strcmp(key, "QueueOffLineMeterValues") == 0)
     {
-    	if(ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemAccessibility == 1)
+    	if(ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemAccessibility == 1)
 		{
 			strcpy(str, (const char*)value);
 			for(int i = 0; str[i]; i++)
 			{
 			   str[i] = tolower(str[i]);
 			}
-			//Charger.QueueOffLineStartTransactionMessage = (value.toLowerCase().equals("true")?true:false);
-			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
+
+			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
 			isSuccess = ConfigurationStatus_Accepted;
 		}
 		else
@@ -17299,7 +17299,7 @@ int setKeyValue(char *key, char *value)
 			{
 			   str[i] = tolower(str[i]);
 			}
-			//Charger.QueueOffLineStartTransactionMessage = (value.toLowerCase().equals("true")?true:false);
+
 			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
 			isSuccess = ConfigurationStatus_Accepted;
 		}
@@ -17319,7 +17319,6 @@ int setKeyValue(char *key, char *value)
 			{
 			   str[i] = tolower(str[i]);
 			}
-			//Charger.QueueOffLineStartTransactionMessage = (value.toLowerCase().equals("true")?true:false);
 			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
 			isSuccess = ConfigurationStatus_Accepted;
 		}

+ 1 - 1
EVSE/Modularization/ocppfiles/MessageHandler.h

@@ -386,7 +386,7 @@ enum GetConfigurationKey {
 	GetConfiguration_TransactionMessageRetryInterval,
 	GetConfiguration_UnlockConnectorOnEVSideDisconnect,
 	GetConfiguration_WebSocketPingInterval,
-	GetConfiguration_QueueOffLineStartTransactionMessage,
+	GetConfiguration_QueueOffLineMeterValues,
 	GetConfiguration_AuthorizationKey,
 	GetConfiguration_SecurityProfile,
 	GetConfiguration_DefaultPrice,

+ 28 - 28
EVSE/Modularization/ocppph/MessageHandler.c

@@ -7158,7 +7158,7 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 
 	if((dataType != ReadingContext_Trigger) &&
 	   (dataType != ReadingContext_Sample_Clock) &&
-	   (ShmOCPP16DataPH->MeterValues[gun_index].TransactionId != -1))
+	   ((ShmOCPP16DataPH->MeterValues[gun_index].TransactionId != -1) || (strstr((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData, "TRUE"))))
 		queue_operation(QUEUE_OPERATION_ADD, guid, queuedata );
 	else
 	{
@@ -13792,7 +13792,7 @@ int initialConfigurationTable(void)
 	char sstr[256]={0};
 	int c = 0;
 	char *loc;
-	int	confVersion = 3;
+	int	confVersion = 8;
 
 	DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
 	//start_t = clock();
@@ -14096,12 +14096,12 @@ int initialConfigurationTable(void)
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","WebSocketPingInterval", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WebSocketPingInterval].ItemData);
 
-		// QueueOffLineStartTransactionMessage
-		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemAccessibility = 1;
-		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemName, "QueueOffLineStartTransactionMessage");
-		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData, "TRUE" );
+		// QueueOffLineMeterValues
+		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemName, "QueueOffLineMeterValues");
+		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData, "FALSE" );
 
-		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","QueueOffLineStartTransactionMessage", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData);
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","QueueOffLineMeterValues", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData);
 
 		// AuthorizationKey
 		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizationKey].ItemAccessibility = 1;
@@ -14505,10 +14505,10 @@ int initialConfigurationTable(void)
 					 sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WebSocketPingInterval].ItemData, "%d", atoi(valuestr) );
 				}
 
-				if(strcmp(keystr, "QueueOffLineStartTransactionMessage") == 0)
+				if(strcmp(keystr, "QueueOffLineMeterValues") == 0)
 				{
-					 ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
-					 sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData, "%s", valuestr);
+					 ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+					 sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData, "%s", valuestr);
 				}
 
 				if(strcmp(keystr, "AuthorizationKey") == 0)
@@ -14948,14 +14948,14 @@ void StoreConfigurationTable(void)
 
 	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","WebSocketPingInterval", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WebSocketPingInterval].ItemData);
 
-	// QueueOffLineStartTransactionMessage
+	// QueueOffLineMeterValues
 	/*
-	ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemAccessibility = 0;
-	strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemName, "QueueOffLineStartTransactionMessage");
-	strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData, "TRUE" );
+	ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemAccessibility = 0;
+	strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemName, "QueueOffLineMeterValues");
+	strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData, "TRUE" );
 	*/
 
-	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","QueueOffLineStartTransactionMessage", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData);
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","QueueOffLineMeterValues", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData);
 
 	// AuthorizationKey
 	/*
@@ -15726,21 +15726,21 @@ void getKeyValue(char *keyReq)
 
 	      }
 
-	      if(isEmpty ||  strcmp(keyReq, "QueueOffLineStartTransactionMessage") == 0 )
+	      if(isEmpty ||  strcmp(keyReq, "QueueOffLineMeterValues") == 0 )
 		  {
-			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_QueueOffLineStartTransactionMessage].Item, "QueueOffLineStartTransactionMessage");
-			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineStartTransactionMessage].Key, "QueueOffLineStartTransactionMessage");
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_QueueOffLineMeterValues].Item, "QueueOffLineMeterValues");
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineMeterValues].Key, "QueueOffLineMeterValues");
 
-			  if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemAccessibility == 1)
+			  if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemAccessibility == 1)
 			  {
-				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineStartTransactionMessage].ReadOnly, "0"/*"FALSE"*/);
+				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineMeterValues].ReadOnly, "0"/*"FALSE"*/);
 			  }
 			  else
 			  {
-				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineStartTransactionMessage].ReadOnly, "1"/*"TRUE"*/);
+				  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineMeterValues].ReadOnly, "1"/*"TRUE"*/);
 			  }
 
-			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineStartTransactionMessage].Value, (const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData );
+			  strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_QueueOffLineMeterValues].Value, (const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData );
 			  isKnowKey = TRUE;
 		  }
 
@@ -16819,17 +16819,17 @@ int setKeyValue(char *key, char *value)
     	}
     }
 
-    if(strcmp(key, "QueueOffLineStartTransactionMessage") == 0)
+    if(strcmp(key, "QueueOffLineMeterValues") == 0)
     {
-    	if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemAccessibility == 1)
+    	if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemAccessibility == 1)
 		{
 			strcpy(str, (const char*)value);
 			for(int i = 0; str[i]; i++)
 			{
 			   str[i] = tolower(str[i]);
 			}
-			//Charger.QueueOffLineStartTransactionMessage = (value.toLowerCase().equals("true")?true:false);
-			sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineStartTransactionMessage].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
+
+			sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[QueueOffLineMeterValues].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
 			isSuccess = ConfigurationStatus_Accepted;
 		}
 		else
@@ -16908,7 +16908,7 @@ int setKeyValue(char *key, char *value)
 			{
 			   str[i] = tolower(str[i]);
 			}
-			//Charger.QueueOffLineStartTransactionMessage = (value.toLowerCase().equals("true")?true:false);
+
 			sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
 			isSuccess = ConfigurationStatus_Accepted;
 		}
@@ -16928,7 +16928,7 @@ int setKeyValue(char *key, char *value)
 			{
 			   str[i] = tolower(str[i]);
 			}
-			//Charger.QueueOffLineStartTransactionMessage = (value.toLowerCase().equals("true")?true:false);
+
 			sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
 			isSuccess = ConfigurationStatus_Accepted;
 		}

+ 1 - 1
EVSE/Modularization/ocppph/MessageHandler.h

@@ -386,7 +386,7 @@ enum GetConfigurationKey {
 	GetConfiguration_TransactionMessageRetryInterval,
 	GetConfiguration_UnlockConnectorOnEVSideDisconnect,
 	GetConfiguration_WebSocketPingInterval,
-	GetConfiguration_QueueOffLineStartTransactionMessage,
+	GetConfiguration_QueueOffLineMeterValues,
 	GetConfiguration_AuthorizationKey,
 	GetConfiguration_SecurityProfile,
 	GetConfiguration_DefaultPrice,

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

@@ -3942,7 +3942,7 @@ void checkUnlocker(uint8_t gun_index)
 		{
 			ShmOCPP20Data->CsMsg.bits[gun_index].UnlockConnectorReq = OFF;
 
-			sprintf((char*)ShmOCPP20Data->UnlockConnector[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].Response_status, "NotSupported");
+			sprintf((char*)ShmOCPP20Data->UnlockConnector[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].Response_status, "UnlockFailed");
 			ShmOCPP20Data->CsMsg.bits[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].UnlockConnectorConf = ON;
 
 			ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor = ON;

+ 1 - 1
EVSE/Projects/define.h

@@ -287,7 +287,7 @@ enum CoreProfile {
 	 TransactionMessageRetryInterval,
 	 UnlockConnectorOnEVSideDisconnect,
 	 WebSocketPingInterval,
-	 QueueOffLineStartTransactionMessage,
+	 QueueOffLineMeterValues,
 	 AuthorizationKey,
 	 SecurityProfile,
      DefaultPrice,