瀏覽代碼

2022-03-02/Jerry Wang
Action:
1. Modify clock-aligned meterValue timestamp to show the interval startTime(previous sampled time).

File:
1. EVSE/Modularization/ocppfiles/MessageHandler.c
--> Action 1
2. EVSE/Modularization/ocppph/MessageHandler.c
--> Action 1

Jerry Wang 3 年之前
父節點
當前提交
50504e0fb5
共有 2 個文件被更改,包括 28 次插入3 次删除
  1. 14 1
      EVSE/Modularization/ocppfiles/MessageHandler.c
  2. 14 2
      EVSE/Modularization/ocppph/MessageHandler.c

+ 14 - 1
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -7182,7 +7182,20 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	t = time(NULL);
 	/*UTC time and date*/
 	tm = gmtime(&t);
-	strftime(buf,28,"%Y-%m-%dT%H:%M:%SZ", tm);
+
+	if(dataType == ReadingContext_Sample_Clock)
+	{
+		struct tm *tmTarget;
+		struct timeb tbTarget;
+		tbTarget.time = mktime(tm);
+		tbTarget.time -= (atoi((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[ClockAlignedDataInterval].ItemData));
+		tmTarget = gmtime(&tbTarget.time);
+		strftime(buf,28,"%Y-%m-%dT%H:%M:%SZ", tmTarget);
+	}
+	else
+	{
+		strftime(buf,28,"%Y-%m-%dT%H:%M:%SZ", tm);
+	}
 	strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].TimeStamp, buf);
 
 	//DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.ModelName[0]=%c\n", ShmSysConfigAndInfo->SysConfig.ModelName[0]);

+ 14 - 2
EVSE/Modularization/ocppph/MessageHandler.c

@@ -6715,7 +6715,20 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	t = time(NULL);
 	/*UTC time and date*/
 	tm = gmtime(&t);
-	strftime(buf,28,"%Y-%m-%dT%H:%M:%SZ", tm);
+
+	if(dataType == ReadingContext_Sample_Clock)
+	{
+		struct tm *tmTarget;
+		struct timeb tbTarget;
+		tbTarget.time = mktime(tm);
+		tbTarget.time -= (atoi((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ClockAlignedDataInterval].ItemData));
+		tmTarget = gmtime(&tbTarget.time);
+		strftime(buf,28,"%Y-%m-%dT%H:%M:%SZ", tmTarget);
+	}
+	else
+	{
+		strftime(buf,28,"%Y-%m-%dT%H:%M:%SZ", tm);
+	}
 	strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].TimeStamp, buf);
 
 	//DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.ModelName[0]=%c\n", ShmSysConfigAndInfo->SysConfig.ModelName[0]);
@@ -14769,7 +14782,6 @@ void handleBootNotificationResponse(char *payload, int gun_index)
 	}
 	else if(strcmp(statusStr, RegistrationStatusStr[RegistrationStatus_Pending]) == 0)
 	{
-		BootNotificationInterval = intervalInt;
 		server_pending = TRUE;
 	}
 	//syncDateTimeRTC(ShmOCPP16DataPH->BootNotification.ResponseCurrentTime);