Эх сурвалжийг харах

2022-11-11/Jerry Wang
[OCPP 1.6]
Action:
1. Fix the queue mapping problem which cause the transactionId of queued messages always be 0.

File:
1. EVSE/Modularization/ocppfiles/Module_OcppBackend.c
--> Action 1

Jerry Wang 2 жил өмнө
parent
commit
e68df08d26

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

@@ -991,40 +991,41 @@ int sentqueue()
 				{
 					if(strstr(action, "StartTransaction") != NULL)
 					{
-						if(hashmap_operation(HASH_OP_GET, guid, key_value) == TRUE)
+						char idtag[21]={0};
+						char timestamp[36]={0};
+						int meterStart=0;
+						int reservationId=-1;
+						if(json_object_object_get(objPayload, "idTag") != NULL)
 						{
-							//DEBUG_INFO("\n 1. sent queue guid=%s\n",guid);
+							sprintf(idtag, "%s", json_object_get_string(json_object_object_get(objPayload, "idTag")));
 						}
-						else
+
+						if(json_object_object_get(objPayload, "meterStart") != NULL)
 						{
-							char idtag[21]={0};
-							char timestamp[36]={0};
-							int meterStart=0;
-							int reservationId=-1;
-							sprintf(hashData, "StartTransaction,%d", (connectorId-1));
-							hashmap_operation(HASH_OP_ADD, guid, hashData);
+							meterStart = json_object_get_int(json_object_object_get(objPayload, "meterStart"));
+						}
 
-							if(json_object_object_get(objPayload, "idTag") != NULL)
-							{
-								sprintf(idtag, "%s", json_object_get_string(json_object_object_get(objPayload, "idTag")));
-							}
+						if(json_object_object_get(objPayload, "reservationId") != NULL)
+						{
+							reservationId = json_object_get_int(json_object_object_get(objPayload, "reservationId"));
+						}
 
-							if(json_object_object_get(objPayload, "meterStart") != NULL)
-							{
-								meterStart = json_object_get_int(json_object_object_get(objPayload, "meterStart"));
-							}
+						if(json_object_object_get(objPayload, "timestamp") != NULL)
+						{
+							sprintf(timestamp, "%s", json_object_get_string(json_object_object_get(objPayload, "timestamp")));
+						}
 
-							if(json_object_object_get(objPayload, "reservationId") != NULL)
-							{
-								reservationId = json_object_get_int(json_object_object_get(objPayload, "reservationId"));
-							}
+						FillStartTransaction(connectorId, (unsigned char*)idtag, meterStart, reservationId, (unsigned char*)timestamp);
 
-							if(json_object_object_get(objPayload, "timestamp") != NULL)
-							{
-								sprintf(timestamp, "%s", json_object_get_string(json_object_object_get(objPayload, "timestamp")));
-							}
 
-							FillStartTransaction(connectorId, (unsigned char*)idtag, meterStart, reservationId, (unsigned char*)timestamp);
+						if(hashmap_operation(HASH_OP_GET, guid, key_value) == TRUE)
+						{
+							//DEBUG_INFO("\n 1. sent queue guid=%s\n",guid);
+						}
+						else
+						{
+							sprintf(hashData, "StartTransaction,%d", (connectorId-1));
+							hashmap_operation(HASH_OP_ADD, guid, hashData);
 							//DEBUG_INFO("\n 2. sent queue guid=%s\n",guid);
 						}
 
@@ -1364,7 +1365,7 @@ int main(void)
 	queueOpInfo.TransactionMessageResend = 0;
 
 	DEBUG_INFO("Module_OcppBackend task initialization...\n");
-	DEBUG_INFO("Git update date: 2022/09/28 \n");
+	DEBUG_INFO("Git update date: 2022/11/11 \n");
 	//lws_set_log_level(LLL_PARSER | LLL_HEADER | LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_INFO | LLL_DEBUG | LLL_EXT | LLL_CLIENT | LLL_LATENCY  , NULL);
 
 	if(ProcessShareMemory()== FAIL)