Przeglądaj źródła

Merge branch 'AW-Regular' of https://git.phihong.com.tw:30000/System_Integration/CSU3_AM335x into AW-Regular

8009 3 lat temu
rodzic
commit
0bd785a7b4

+ 786 - 458
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -1439,13 +1439,13 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].component.name, "AlignedDataCtrlr");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variable.name, "Measurands");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_MemberList]);
-		ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableCharacteristics.maxLimit = 10;
+		ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableCharacteristics.maxLimit = 20;
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadOnly]);
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC");
+			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered");
 		else
-			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage");
+			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered");
 		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands]);
 
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].component.name, "AlignedDataCtrlr");
@@ -2190,13 +2190,13 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].component.name, "SampledDataCtrlr");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variable.name, "TxUpdatedMeasurands");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_MemberList]);
-		ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableCharacteristics.maxLimit = 10;
+		ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableCharacteristics.maxLimit = 0;
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC");
+			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered");
 		else
-			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage");
+			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered");
 		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands]);
 
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].component.name, "SampledDataCtrlr");
@@ -3353,18 +3353,98 @@ int getStartStop(uint8_t *start, uint8_t *stop)
 int isOvertNow(uint8_t *start)
 {
 	int result = NO;
+	struct ParsingResult
+	{
+		int result;
+		int scanedElement;
+		int year;
+		int month;
+		int mday;
+		int hour;
+		int min;
+		int sec;
+		int tz_hour;
+		int tz_min;
+		float minSec;
+	}parsingResult;
+
 	struct tm tmStart;
 	struct timeb tbStart;
 
-	if((sscanf((char*)start, "%4d-%2d-%2dT%2d:%2d:%2d", &tmStart.tm_year, &tmStart.tm_mon, &tmStart.tm_mday, &tmStart.tm_hour, &tmStart.tm_min, &tmStart.tm_sec) == 6))
+	if(strstr((char*)start, ".") != NULL)
 	{
-		//DEBUG_INFO("Start: %d-%d-%d %d:%d:%d\n", tmStart.tm_year, tmStart.tm_mon, tmStart.tm_mday, tmStart.tm_hour, tmStart.tm_min, tmStart.tm_sec);
-
-		tmStart.tm_year -= 1900;
-		tmStart.tm_mon -= 1;
+		// Original data with mini second
+		if(strstr((char*)start, "Z") != NULL)
+		{
+			// Original data with Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%fZ",
+																&parsingResult.year,
+																&parsingResult.month,
+																&parsingResult.mday,
+																&parsingResult.hour,
+																&parsingResult.min,
+																&parsingResult.sec,
+																&parsingResult.minSec);
+		}
+		else
+		{
+			// Original data without Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%f%d:%d",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec,
+												&parsingResult.minSec,
+												&parsingResult.tz_hour,
+												&parsingResult.tz_min);
+		}
+	}
+	else
+	{
+		// Original data without mini second
+		if(strstr((char*)start, "Z") != NULL)
+		{
+			// Original data with Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%dZ",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec);
+		}
+		else
+		{
+			// Original data without Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d%d:%d",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec,
+												&parsingResult.tz_hour,
+												&parsingResult.tz_min);
+		}
+	}
+
+	if(parsingResult.scanedElement >= 6)
+	{
+		tmStart.tm_year = parsingResult.year - 1900;
+		tmStart.tm_mon = parsingResult.month - 1;
+		tmStart.tm_mday = parsingResult.mday;
+		tmStart.tm_hour = parsingResult.hour;
+		tmStart.tm_min = parsingResult.min;
+		tmStart.tm_sec = parsingResult.sec;
+		tmStart.tm_gmtoff = 0;
 		tbStart.time = mktime(&tmStart);
+		tbStart.timezone = 0;
 		tbStart.millitm = 0;
 
+		tbStart.time -= (parsingResult.tz_hour*3600) + (parsingResult.tz_min*60*(parsingResult.tz_hour>=0?1:-1));
+
 		if(DiffTimebWithNowSec(tbStart) <= 0)
 			result = NO;
 		else
@@ -7243,6 +7323,7 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 	DEBUG_INFO("sendMeterValuesRequest...\n");
 
 	memset(queuedata, 0, ARRAY_SIZE(queuedata));
+	memset(&ShmOCPP20Data->MeterValues[gun_index], 0, sizeof(struct MeterValues_20));
 	//set value
 	ShmOCPP20Data->MeterValues[gun_index].evseId = gun_index + 1; // gun start from 1~
 
@@ -7263,118 +7344,240 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 
 	//idx_sample=0;
 	//********************************(1)Current.Import L1************************************************/
-	//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
-	if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingCurrent;
+				}
+			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+			for (int index = 0; index < CCS_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingCurrent;
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingCurrent;
+				}
 			}
-		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_CCS)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < CCS_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+			for (int index = 0; index < GB_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingCurrent;
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingCurrent;
+				}
 			}
-		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_GBT)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
 			tempIndex = gun_index;
-		}
 
-		for (int index = 0; index < GB_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingCurrent;
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingCurrent;
+				}
 			}
-		}
-
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_DO)
-	{
-		tempIndex = gun_index;
 
-		for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else
 		{
-			if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingCurrent;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrent;
+				}
 			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
 		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].unitOfMeasure.uint , "A");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].unitOfMeasure.multiplier = 0;
 	}
-	else
+
+	//idx_sample=1;
+	//********************************(2)Energy.Active.Import.Register ************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Register]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Register]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			tempIndex = 2;
+				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+				{
+					tempIndex = ((gun_index==2) ? 1: 0);
+				}
+				else
+				{
+					tempIndex = gun_index;
+				}
+
+				for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PowerConsumption;
+					}
+				}
+
+				strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
 		{
-			tempIndex = gun_index;
+				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+				{
+					tempIndex = ((gun_index==2) ? 1: 0);
+				}
+				else
+				{
+					tempIndex = gun_index;
+				}
+
+				for (int index = 0; index < CCS_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PowerConsumption;
+					}
+				}
+
+				strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
+		{
+				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+				{
+					tempIndex = ((gun_index==2) ? 1: 0);
+				}
+				else
+				{
+					tempIndex = gun_index;
+				}
 
-		for (int index = 0; index < AC_QUANTITY; index++)
+				for (int index = 0; index < GB_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PowerConsumption;
+					}
+				}
+
+				strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
-			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrent;
-			}
+
+				tempIndex = gun_index;
+
+				for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PowerConsumption;
+					}
+				}
+
+				strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
+		else
+		{
+				if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+				{
+					tempIndex = 2;
+				}
+				else
+				{
+					tempIndex = gun_index;
+				}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
-	}
+				for (int index = 0; index < AC_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PowerConsumption;
+					}
+				}
 
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].unitOfMeasure.uint , "A");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].unitOfMeasure.multiplier = 0;
+				strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
+		}
 
-	//idx_sample=1;
-	//********************************(2)Energy.Active.Import.Register ************************************************/
-	//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Register]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].unitOfMeasure.uint , "kWh");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.multiplier = 0;
+	}
 
-	if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+	//idx_sample=2;
+	//****************************************************(3)Energy.Active.Import.Interval*********************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Interval]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Interval]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+		{
 			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
 			{
 				tempIndex = ((gun_index==2) ? 1: 0);
@@ -7388,14 +7591,14 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PowerConsumption;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargedEnergy;
 				}
-			}
+			} // END OF FOR CHAdeMO_QUANTITY
 
-			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_CCS)
-	{
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
+		{
 			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
 			{
 				tempIndex = ((gun_index==2) ? 1: 0);
@@ -7409,14 +7612,14 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PowerConsumption;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargedEnergy;
 				}
-			}
+			} // END OF CCS_QUANTITY
 
-			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_GBT)
-	{
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
+		{
 			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
 			{
 				tempIndex = ((gun_index==2) ? 1: 0);
@@ -7430,29 +7633,28 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PowerConsumption;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargedEnergy;
 				}
-			}
-
-			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_DO)
-	{
+			} // END OF GB_QUANTITY
 
+			 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
+		{
 			tempIndex = gun_index;
 
 			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PowerConsumption;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargedEnergy;
 				}
 			}
 
-			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else
-	{
+			 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else
+		{
 			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
 			{
 				tempIndex = 2;
@@ -7466,533 +7668,659 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PowerConsumption;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargedEnergy;
 				}
-			}
+			 }
 
-			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
-	}
-
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Register]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].unitOfMeasure.uint , "kWh");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.multiplier = 0;
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
+		}
 
-	//idx_sample=2;
-	//****************************************************(3)Energy.Active.Import.Interval*********************************************/
-	//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Interval]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.uint , "kWh");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.multiplier = 0;
+	}
 
-	if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+	//idx_sample=3;
+	//********************************(4)Power.Active.Import************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Power_Active_Import]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Power_Active_Import]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingPower;
+				}
+			} // END OF FOR
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+			for (int index = 0; index < CCS_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargedEnergy;
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingPower;
+				}
 			}
-		} // END OF FOR CHAdeMO_QUANTITY
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_CCS)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < CCS_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+			for (int index = 0; index < GB_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargedEnergy;
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower;
+				}
 			}
-		} // END OF CCS_QUANTITY
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_GBT)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
 			tempIndex = gun_index;
-		}
 
-		for (int index = 0; index < GB_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargedEnergy;
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingPower;
+				}
 			}
-		} // END OF GB_QUANTITY
 
-		 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_DO)
-	{
-		tempIndex = gun_index;
-
-		for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else
 		{
-			if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargedEnergy;
+				tempIndex = gun_index;
 			}
+
+			for (int index = 0; index < AC_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingPower;
+				}
+			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
 		}
 
-		 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Power_Active_Import]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].unitOfMeasure.uint , "kW");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].unitOfMeasure.multiplier = 0;
 	}
-	else
+
+	//idx_sample=4;
+	//***********************************************(5)VOLTAGE L1******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
-		}
-		else
+		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargedEnergy;
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+				 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingVoltage;
+				}
 			}
-		 }
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
-	}
+			 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Interval]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.uint , "kWh");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.multiplier = 0;
+			for (int index = 0; index < CCS_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+				 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingVoltage;
+				}
+			}
 
-	//idx_sample=3;
-	//********************************(4)Power.Active.Import************************************************/
-	//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
-	if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+			for (int index = 0; index < GB_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingPower;
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+				 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingVoltage;
+				}
 			}
-		} // END OF FOR
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_CCS)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
 			tempIndex = gun_index;
-		}
 
-		for (int index = 0; index < CCS_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingPower;
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+				 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingVoltage;
+				}
 			}
-		}
 
-		 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_GBT)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
 		else
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < GB_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-			     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
-			    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltage;
+				}
 			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
 		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].unitOfMeasure.uint , "V");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].unitOfMeasure.multiplier = 0;
 	}
-	else if(gunType[gun_index] == GUN_TYPE_DO)
-	{
-		tempIndex = gun_index;
 
-		for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+	//***********************************************(6)SOC******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_SoC]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_SoC]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
+	{
+		if((gunType[gun_index] == GUN_TYPE_CHAdeMO)||(gunType[gun_index] == GUN_TYPE_CCS)||(gunType[gun_index] == GUN_TYPE_GBT)||(gunType[gun_index] == GUN_TYPE_DO))
 		{
-			if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+			if((ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0') && (gunType[gun_index] != GUN_TYPE_DO))
 			{
-			     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
-			    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingPower;
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
 			}
-		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
-		}
-		else
-		{
-			tempIndex = gun_index;
-		}
+			if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+			{
+				//tempIndex = ((gun_index==2) ? 1: 0);
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].EvBatterySoc;
+					}
+				}
+			}
+			else if(gunType[gun_index] == GUN_TYPE_CCS)
 			{
-			    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingPower;
+				//tempIndex = ((gun_index==2) ? 1: 0);
+
+				for (int index = 0; index < CCS_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].EvBatterySoc;
+					}
+				}
+
 			}
-		}
+			else if(gunType[gun_index] == GUN_TYPE_GBT)
+			{
+				//tempIndex = ((gun_index==2) ? 1: 0);
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
-	}
+				for (int index = 0; index < GB_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+					{
+						 ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].EvBatterySoc;
+					}
+				}
 
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Power_Active_Import]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].unitOfMeasure.uint , "kW");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].unitOfMeasure.multiplier = 0;
+			}
+			else if(gunType[gun_index] == GUN_TYPE_DO)
+			{
+				//tempIndex = ((gun_index==2) ? 1: 0);
 
-	//idx_sample=4;
-	//***********************************************(5)VOLTAGE L1******************************************************/
-	//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
-	if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
-		}
-		else
-		{
-			tempIndex = gun_index;
-		}
+				for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+					{
+						 ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.EvBatterySoc;
+					}
+				}
 
-		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
-			{
-			 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingVoltage;
 			}
-		}
 
-		 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].context, ReadingContextEnumTypeStr[dataType]);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].measurand, MeasurandEnumTypeStr[MeasurandEnumType_SoC]);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].location, LocationEnumTypeStr[LocationEnumType_EV]);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].unitOfMeasure.uint , "Percent");
+			ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].unitOfMeasure.multiplier = 0;
+		}
 	}
-	else if(gunType[gun_index] == GUN_TYPE_CCS)
+
+
+	//********************************(7)Current.Import L2************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
-		}
-		else
+		// Only for AC 3 phase
+		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < CCS_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-			 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingVoltage;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrentL2;
+				}
 			}
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].phase, PhaseEnumTypeStr[PhaseEnumType_L2_N]);
 		}
-
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].unitOfMeasure.uint , "A");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].unitOfMeasure.multiplier = 0;
 	}
-	else if(gunType[gun_index] == GUN_TYPE_GBT)
+
+	//********************************(8)Current.Import L3************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
-		}
-		else
+		// Only for AC 3 phase
+		if( (gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < GB_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-			 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingVoltage;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrentL3;
+				}
 			}
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].unitOfMeasure.uint , "A");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].unitOfMeasure.multiplier = 0;
 	}
-	else if(gunType[gun_index] == GUN_TYPE_DO)
-	{
-		tempIndex = gun_index;
 
-		for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+
+	//***********************************************(9)VOLTAGE L2******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
+	{
+		if( (gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
 		{
-			if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-			 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingVoltage;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltageL2;
+				}
 			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].phase, PhaseEnumTypeStr[PhaseEnumType_L2_N]);
 		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].unitOfMeasure.uint , "V");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].unitOfMeasure.multiplier = 0;
 	}
-	else
+
+	//***********************************************(10)VOLTAGE L3******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
-		}
-		else
+		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltage;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltageL3;
+				}
 			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].unitOfMeasure.uint , "V");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].unitOfMeasure.multiplier = 0;
 	}
 
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].unitOfMeasure.uint , "V");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].unitOfMeasure.multiplier = 0;
-
-
-	//***********************************************(6)SOC******************************************************/
-	if((gunType[gun_index] == GUN_TYPE_CHAdeMO)||(gunType[gun_index] == GUN_TYPE_CCS)||(gunType[gun_index] == GUN_TYPE_GBT)||(gunType[gun_index] == GUN_TYPE_DO))
+	//***********************************************(11)Current.Offered******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Offered]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Offered]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if((ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0') && (gunType[gun_index] != GUN_TYPE_DO))
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
-		}
-		else
-		{
-			tempIndex = gun_index;
-		}
-
+		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
 		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			//tempIndex = ((gun_index==2) ? 1: 0);
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
 			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].EvBatterySoc;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingCurrent/10);
 				}
-			}
+			} // END OF FOR
 		}
 		else if(gunType[gun_index] == GUN_TYPE_CCS)
 		{
-			//tempIndex = ((gun_index==2) ? 1: 0);
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
 			for (int index = 0; index < CCS_QUANTITY; index++)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].EvBatterySoc;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingCurrent/10);
 				}
 			}
-
 		}
 		else if(gunType[gun_index] == GUN_TYPE_GBT)
 		{
-			//tempIndex = ((gun_index==2) ? 1: 0);
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
 			for (int index = 0; index < GB_QUANTITY; index++)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
 				{
-					 ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].EvBatterySoc;
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingCurrent/10);;
 				}
 			}
-
 		}
 		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
-			//tempIndex = ((gun_index==2) ? 1: 0);
+			tempIndex = gun_index;
 
 			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
 				{
-					 ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.EvBatterySoc;
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingCurrent/10);;
 				}
 			}
-
-		}
-
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].context, ReadingContextEnumTypeStr[dataType]);
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].measurand, MeasurandEnumTypeStr[MeasurandEnumType_SoC]);
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].location, LocationEnumTypeStr[LocationEnumType_EV]);
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].unitOfMeasure.uint , "Percent");
-		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].unitOfMeasure.multiplier = 0;
-	}
-
-	//********************************(7)Current.Import L2************************************************/
-	// Only for AC 3 phase
-	if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
 		}
 		else
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrentL2;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+				    uint16_t currentOffer;
+					if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+					{
+						currentOffer = ShmSysConfigAndInfo->SysConfig.RatingCurrent;
+					}
+					else
+					{
+						currentOffer = ((ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent>ShmSysConfigAndInfo->SysConfig.RatingCurrent)?ShmSysConfigAndInfo->SysConfig.RatingCurrent:ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
+					}
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].value = currentOffer;
+				}
 			}
 		}
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].phase, PhaseEnumTypeStr[PhaseEnumType_L2_N]);
+
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Offered]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].unitOfMeasure.uint , "A");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].unitOfMeasure.multiplier = 0;
 	}
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].unitOfMeasure.uint , "A");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].unitOfMeasure.multiplier = 0;
 
-	//********************************(8)Current.Import L3************************************************/
-	// Only for AC 3 phase
-	if( (gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
+	//***********************************************(12)Power.Offered******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Power_Offered]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Power_Offered]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
-		}
-		else
-		{
-			tempIndex = gun_index;
-		}
-
-		for (int index = 0; index < AC_QUANTITY; index++)
+		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrentL3;
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
 			}
-		}
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].unitOfMeasure.uint , "A");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].unitOfMeasure.multiplier = 0;
 
-	//***********************************************(9)VOLTAGE L2******************************************************/
-	if( (gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingPower*10);
+				}
+			} // END OF FOR
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			for (int index = 0; index < CCS_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltageL2;
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingPower*10);
+				}
 			}
 		}
-
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].phase, PhaseEnumTypeStr[PhaseEnumType_L2_N]);
-	}
-
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].unitOfMeasure.uint , "V");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].unitOfMeasure.multiplier = 0;
-
-	//***********************************************(10)VOLTAGE L3******************************************************/
-	if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
 		{
-			tempIndex = 2;
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < GB_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingPower*10);
+				}
+			}
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
 			tempIndex = gun_index;
-		}
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltageL3;
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingPower*10);
+				}
 			}
 		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Power_Offered]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].unitOfMeasure.uint , "W");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].unitOfMeasure.multiplier = 0;
 	}
 
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].unitOfMeasure.uint , "V");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].unitOfMeasure.multiplier = 0;
-
 	// Message create ====================================================================================================
 	random_uuid(guid);
 

+ 346 - 47
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -573,23 +573,47 @@ int sendTTIAInfo(uint8_t gun_index)
 	// Start date time 6 bytes
 	if((sscanf((char*)ShmOCPP16Data->StartTransaction[gun_index].Timestamp, "%4d-%2d-%2dT%2d:%2d:%2d", &tmStart.tm_year, &tmStart.tm_mon, &tmStart.tm_mday, &tmStart.tm_hour, &tmStart.tm_min, &tmStart.tm_sec) == 6))
 	{
-		tx_buf[64] = (tmStart.tm_year-2000);
-		tx_buf[65] = tmStart.tm_mon;
-		tx_buf[66] = tmStart.tm_mday;
-		tx_buf[67] = tmStart.tm_hour;
-		tx_buf[68] = tmStart.tm_min;
-		tx_buf[69] = tmStart.tm_sec;
+		struct tm *tmTarget;
+		struct timeb tbTarget;
+
+		tmStart.tm_year -= 1900;
+		tmStart.tm_mon -= 1;
+		tmStart.tm_gmtoff = 0;
+		tbTarget.time = mktime(&tmStart);
+		tbTarget.timezone = 0;
+
+		tbTarget.time += (8*3600);
+		tmTarget = gmtime(&tbTarget.time);
+
+		tx_buf[64] = ((tmTarget->tm_year+1900)-2000);
+		tx_buf[65] = (tmTarget->tm_mon+1);
+		tx_buf[66] = tmTarget->tm_mday;
+		tx_buf[67] = tmTarget->tm_hour;
+		tx_buf[68] = tmTarget->tm_min;
+		tx_buf[69] = tmTarget->tm_sec;
 	}
 
 	// Stop date time 6 bytes
 	if((sscanf((char*)ShmOCPP16Data->StopTransaction[gun_index].Timestamp, "%4d-%2d-%2dT%2d:%2d:%2d", &tmEnd.tm_year, &tmEnd.tm_mon, &tmEnd.tm_mday, &tmEnd.tm_hour, &tmEnd.tm_min, &tmEnd.tm_sec) == 6))
 	{
-		tx_buf[70] = (tmEnd.tm_year-2000);
-		tx_buf[71] = tmEnd.tm_mon;
-		tx_buf[72] = tmEnd.tm_mday;
-		tx_buf[73] = tmEnd.tm_hour;
-		tx_buf[74] = tmEnd.tm_min;
-		tx_buf[75] = tmEnd.tm_sec;
+		struct tm *tmTarget;
+		struct timeb tbTarget;
+
+		tmEnd.tm_year -= 1900;
+		tmEnd.tm_mon -= 1;
+		tmEnd.tm_gmtoff = 0;
+		tbTarget.time = mktime(&tmEnd);
+		tbTarget.timezone = 0;
+
+		tbTarget.time += (8*3600);
+		tmTarget = gmtime(&tbTarget.time);
+
+		tx_buf[70] = ((tmTarget->tm_year+1900)-2000);
+		tx_buf[71] = (tmTarget->tm_mon+1);
+		tx_buf[72] = tmTarget->tm_mday;
+		tx_buf[73] = tmTarget->tm_hour;
+		tx_buf[74] = tmTarget->tm_min;
+		tx_buf[75] = tmTarget->tm_sec;
 	}
 
 	// Session energy 2 bytes
@@ -663,7 +687,8 @@ int sendTTIAInfo(uint8_t gun_index)
 				DEBUG_TTIA_INFO("Session end SOC: %d\n", socEnd);
 				DEBUG_TTIA_INFO("=========================================\n");
 				sn++;
-								result = PASS;
+
+				result = PASS;
 			}
 			else
 			{
@@ -1294,18 +1319,98 @@ int getStartStop(uint8_t *start, uint8_t *stop)
 int isOvertNow(uint8_t *start)
 {
 	int result = NO;
+	struct ParsingResult
+	{
+		int result;
+		int scanedElement;
+		int year;
+		int month;
+		int mday;
+		int hour;
+		int min;
+		int sec;
+		int tz_hour;
+		int tz_min;
+		float minSec;
+	}parsingResult;
+
 	struct tm tmStart;
 	struct timeb tbStart;
 
-	if((sscanf((char*)start, "%4d-%2d-%2dT%2d:%2d:%2d", &tmStart.tm_year, &tmStart.tm_mon, &tmStart.tm_mday, &tmStart.tm_hour, &tmStart.tm_min, &tmStart.tm_sec) == 6))
+	if(strstr((char*)start, ".") != NULL)
 	{
-		//DEBUG_INFO("Start: %d-%d-%d %d:%d:%d\n", tmStart.tm_year, tmStart.tm_mon, tmStart.tm_mday, tmStart.tm_hour, tmStart.tm_min, tmStart.tm_sec);
-
-		tmStart.tm_year -= 1900;
-		tmStart.tm_mon -= 1;
+		// Original data with mini second
+		if(strstr((char*)start, "Z") != NULL)
+		{
+			// Original data with Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%fZ",
+																&parsingResult.year,
+																&parsingResult.month,
+																&parsingResult.mday,
+																&parsingResult.hour,
+																&parsingResult.min,
+																&parsingResult.sec,
+																&parsingResult.minSec);
+		}
+		else
+		{
+			// Original data without Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%f%d:%d",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec,
+												&parsingResult.minSec,
+												&parsingResult.tz_hour,
+												&parsingResult.tz_min);
+		}
+	}
+	else
+	{
+		// Original data without mini second
+		if(strstr((char*)start, "Z") != NULL)
+		{
+			// Original data with Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%dZ",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec);
+		}
+		else
+		{
+			// Original data without Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d%d:%d",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec,
+												&parsingResult.tz_hour,
+												&parsingResult.tz_min);
+		}
+	}
+
+	if(parsingResult.scanedElement >= 6)
+	{
+		tmStart.tm_year = parsingResult.year - 1900;
+		tmStart.tm_mon = parsingResult.month - 1;
+		tmStart.tm_mday = parsingResult.mday;
+		tmStart.tm_hour = parsingResult.hour;
+		tmStart.tm_min = parsingResult.min;
+		tmStart.tm_sec = parsingResult.sec;
+		tmStart.tm_gmtoff = 0;
 		tbStart.time = mktime(&tmStart);
+		tbStart.timezone = 0;
 		tbStart.millitm = 0;
 
+		tbStart.time -= (parsingResult.tz_hour*3600) + (parsingResult.tz_min*60*(parsingResult.tz_hour>=0?1:-1));
+
 		if(DiffTimebWithNowSec(tbStart) <= 0)
 			result = NO;
 		else
@@ -6290,8 +6395,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	//DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.ModelName[0]=%c\n", ShmSysConfigAndInfo->SysConfig.ModelName[0]);
 
 	//********************************(1)Current.Import L1************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6402,8 +6507,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(2)Energy.Active.Import.Register ************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Energy.Active.Import.Register") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Energy.Active.Import.Register") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Energy_Active_Import_Register]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Energy_Active_Import_Register]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6515,8 +6620,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//****************************************************(3)Energy.Active.Import.Interval*********************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Energy.Active.Import.Interval") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Energy.Active.Import.Interval") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Energy_Active_Import_Interval]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Energy_Active_Import_Interval]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6627,8 +6732,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(4)Power.Active.Import************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Power.Active.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Power.Active.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Power_Active_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Power_Active_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
@@ -6741,8 +6846,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(5)VOLTAGE L1******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
@@ -6853,8 +6958,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(6)SOC******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "SOC") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "SOC") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[SoC]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[SoC]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_CHAdeMO)||(gunType[gun_index] == GUN_TYPE_CCS)||(gunType[gun_index] == GUN_TYPE_GBT)||(gunType[gun_index] == GUN_TYPE_DO))
@@ -6933,8 +7038,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(7)Current.Import L2************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		// Only for AC 3 phase
@@ -6966,8 +7071,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(8)Current.Import L3************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		// Only for AC 3 phase
@@ -6999,8 +7104,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(9)VOLTAGE L2******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='D')))
@@ -7033,8 +7138,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(10)VOLTAGE L3******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='D')))
@@ -7066,6 +7171,200 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[9].Unit,UnitOfMeasureStr[UnitOfMeasure_V]);
 	}
 
+	//***********************************************(11)Current.Offered******************************************************/
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Offered]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Offered]) != NULL)) ||
+	   (dataType == ReadingContext_Trigger))
+	{
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF FOR CHAdeMO_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CCS_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF CCS_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < GB_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF GB_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
+		{
+			tempIndex = gun_index;
+
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingCurrent/10));
+				}
+			}
+		}
+		else
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < AC_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					uint16_t currentOffer;
+					if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+					{
+						currentOffer = ShmSysConfigAndInfo->SysConfig.RatingCurrent;
+					}
+					else
+					{
+						currentOffer = ((ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent>ShmSysConfigAndInfo->SysConfig.RatingCurrent)?ShmSysConfigAndInfo->SysConfig.RatingCurrent:ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
+					}
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", currentOffer);
+				}
+			 }
+		}
+
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Context, ReadingContextStr[dataType]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Format, ValueFormatStr[Raw]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Measurand, MeasurandStr[Current_Offered]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Location, LocationStr[Location_Outlet]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Unit,UnitOfMeasureStr[UnitOfMeasure_A]);
+	}
+
+	//***********************************************(12)Power.Offered******************************************************/
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Power_Offered]) != NULL) && (gunType[gun_index] != GUN_TYPE_AC)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Power_Offered]) != NULL) && (gunType[gun_index] != GUN_TYPE_AC)) ||
+	   ((dataType == ReadingContext_Trigger) && (gunType[gun_index] != GUN_TYPE_AC)))
+	{
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF FOR CHAdeMO_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CCS_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF CCS_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < GB_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF GB_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
+		{
+			tempIndex = gun_index;
+
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingPower*10));
+				}
+			}
+		}
+
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Context, ReadingContextStr[dataType]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Format, ValueFormatStr[Raw]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Measurand, MeasurandStr[Power_Offered]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Location, LocationStr[Location_Outlet]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Unit,UnitOfMeasureStr[UnitOfMeasure_W]);
+	}
+
 	// Message create ====================================================================================================
 	if(TRUE)
 	{
@@ -13755,7 +14054,7 @@ int initialConfigurationTable(void)
 	char sstr[256]={0};
 	int c = 0;
 	char *loc;
-	int	confVersion = 6;
+	int	confVersion = 7;
 
 	DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
 	//start_t = clock();
@@ -13875,9 +14174,9 @@ int initialConfigurationTable(void)
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemName, "MeterValuesAlignedData");
 
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered" );
 		else
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesAlignedData", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData);
 
@@ -13885,9 +14184,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemName, "MeterValuesAlignedDataMaxLength");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "6" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "8" );
 		else
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "9" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "10" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesAlignedDataMaxLength", "true", ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData);
 
@@ -13896,9 +14195,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemAccessibility = 1;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemName, "MeterValuesSampledData");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered" );
 		else
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesSampledData", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData);
 
@@ -13907,9 +14206,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemName, "MeterValuesSampledDataMaxLength");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "6" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "8" );
 		else
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "9" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "10" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesSampledDataMaxLength", "true", ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData);
 

+ 307 - 33
EVSE/Modularization/ocppph/MessageHandler.c

@@ -1025,18 +1025,98 @@ int getStartStop(uint8_t *start, uint8_t *stop)
 int isOvertNow(uint8_t *start)
 {
 	int result = NO;
+	struct ParsingResult
+	{
+		int result;
+		int scanedElement;
+		int year;
+		int month;
+		int mday;
+		int hour;
+		int min;
+		int sec;
+		int tz_hour;
+		int tz_min;
+		float minSec;
+	}parsingResult;
+
 	struct tm tmStart;
 	struct timeb tbStart;
 
-	if((sscanf((char*)start, "%4d-%2d-%2dT%2d:%2d:%2d", &tmStart.tm_year, &tmStart.tm_mon, &tmStart.tm_mday, &tmStart.tm_hour, &tmStart.tm_min, &tmStart.tm_sec) == 6))
+	if(strstr((char*)start, ".") != NULL)
 	{
-		//DEBUG_INFO("Start: %d-%d-%d %d:%d:%d\n", tmStart.tm_year, tmStart.tm_mon, tmStart.tm_mday, tmStart.tm_hour, tmStart.tm_min, tmStart.tm_sec);
-
-		tmStart.tm_year -= 1900;
-		tmStart.tm_mon -= 1;
+		// Original data with mini second
+		if(strstr((char*)start, "Z") != NULL)
+		{
+			// Original data with Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%fZ",
+																&parsingResult.year,
+																&parsingResult.month,
+																&parsingResult.mday,
+																&parsingResult.hour,
+																&parsingResult.min,
+																&parsingResult.sec,
+																&parsingResult.minSec);
+		}
+		else
+		{
+			// Original data without Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%f%d:%d",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec,
+												&parsingResult.minSec,
+												&parsingResult.tz_hour,
+												&parsingResult.tz_min);
+		}
+	}
+	else
+	{
+		// Original data without mini second
+		if(strstr((char*)start, "Z") != NULL)
+		{
+			// Original data with Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%dZ",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec);
+		}
+		else
+		{
+			// Original data without Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d%d:%d",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec,
+												&parsingResult.tz_hour,
+												&parsingResult.tz_min);
+		}
+	}
+
+	if(parsingResult.scanedElement >= 6)
+	{
+		tmStart.tm_year = parsingResult.year - 1900;
+		tmStart.tm_mon = parsingResult.month - 1;
+		tmStart.tm_mday = parsingResult.mday;
+		tmStart.tm_hour = parsingResult.hour;
+		tmStart.tm_min = parsingResult.min;
+		tmStart.tm_sec = parsingResult.sec;
+		tmStart.tm_gmtoff = 0;
 		tbStart.time = mktime(&tmStart);
+		tbStart.timezone = 0;
 		tbStart.millitm = 0;
 
+		tbStart.time -= (parsingResult.tz_hour*3600) + (parsingResult.tz_min*60*(parsingResult.tz_hour>=0?1:-1));
+
 		if(DiffTimebWithNowSec(tbStart) <= 0)
 			result = NO;
 		else
@@ -6038,8 +6118,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	//DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.ModelName[0]=%c\n", ShmSysConfigAndInfo->SysConfig.ModelName[0]);
 
 	//********************************(1)Current.Import L1************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6150,8 +6230,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(2)Energy.Active.Import.Register ************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Energy.Active.Import.Register") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Energy.Active.Import.Register") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Energy_Active_Import_Register]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Energy_Active_Import_Register]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6263,8 +6343,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//****************************************************(3)Energy.Active.Import.Interval*********************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Energy.Active.Import.Interval") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Energy.Active.Import.Interval") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Energy_Active_Import_Interval]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Energy_Active_Import_Interval]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6375,8 +6455,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(4)Power.Active.Import************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Power.Active.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Power.Active.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Power_Active_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Power_Active_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
@@ -6489,8 +6569,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(5)VOLTAGE L1******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
@@ -6601,8 +6681,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(6)SOC******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "SOC") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "SOC") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[SoC]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[SoC]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_CHAdeMO)||(gunType[gun_index] == GUN_TYPE_CCS)||(gunType[gun_index] == GUN_TYPE_GBT)||(gunType[gun_index] == GUN_TYPE_DO))
@@ -6681,8 +6761,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(7)Current.Import L2************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		// Only for AC 3 phase
@@ -6714,8 +6794,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(8)Current.Import L3************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		// Only for AC 3 phase
@@ -6747,8 +6827,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(9)VOLTAGE L2******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='D')))
@@ -6781,8 +6861,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(10)VOLTAGE L3******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='D')))
@@ -6814,6 +6894,200 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[9].Unit,UnitOfMeasureStr[UnitOfMeasure_V]);
 	}
 
+	//***********************************************(11)Current.Offered******************************************************/
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Offered]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Offered]) != NULL)) ||
+	   (dataType == ReadingContext_Trigger))
+	{
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF FOR CHAdeMO_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CCS_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF CCS_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < GB_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF GB_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
+		{
+			tempIndex = gun_index;
+
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingCurrent/10));
+				}
+			}
+		}
+		else
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < AC_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					uint16_t currentOffer;
+					if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+					{
+						currentOffer = ShmSysConfigAndInfo->SysConfig.RatingCurrent;
+					}
+					else
+					{
+						currentOffer = ((ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent>ShmSysConfigAndInfo->SysConfig.RatingCurrent)?ShmSysConfigAndInfo->SysConfig.RatingCurrent:ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
+					}
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", currentOffer);
+				}
+			 }
+		}
+
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Context, ReadingContextStr[dataType]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Format, ValueFormatStr[Raw]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Measurand, MeasurandStr[Current_Offered]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Location, LocationStr[Location_Outlet]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Unit,UnitOfMeasureStr[UnitOfMeasure_A]);
+	}
+
+	//***********************************************(12)Power.Offered******************************************************/
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Power_Offered]) != NULL) && (gunType[gun_index] != GUN_TYPE_AC)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Power_Offered]) != NULL) && (gunType[gun_index] != GUN_TYPE_AC)) ||
+	   ((dataType == ReadingContext_Trigger) && (gunType[gun_index] != GUN_TYPE_AC)))
+	{
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF FOR CHAdeMO_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CCS_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF CCS_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < GB_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF GB_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
+		{
+			tempIndex = gun_index;
+
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingPower*10));
+				}
+			}
+		}
+
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Context, ReadingContextStr[dataType]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Format, ValueFormatStr[Raw]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Measurand, MeasurandStr[Power_Offered]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Location, LocationStr[Location_Outlet]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Unit,UnitOfMeasureStr[UnitOfMeasure_W]);
+	}
+
 	// Message create ====================================================================================================
 	if(TRUE)
 	{
@@ -13624,9 +13898,9 @@ int initialConfigurationTable(void)
 		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemName, "MeterValuesAlignedData");
 
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered" );
 		else
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesAlignedData", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData);
 
@@ -13634,9 +13908,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemName, "MeterValuesAlignedDataMaxLength");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "6" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "8" );
 		else
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "9" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "10" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesAlignedDataMaxLength", "true", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData);
 
@@ -13645,9 +13919,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemAccessibility = 1;
 		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemName, "MeterValuesSampledData");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered" );
 		else
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesSampledData", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData);
 
@@ -13656,9 +13930,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemName, "MeterValuesSampledDataMaxLength");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "6" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "8" );
 		else
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "9" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "10" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesSampledDataMaxLength", "true", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData);
 

+ 9 - 0
EVSE/Projects/AW-CCS/Apps/LCM/Module_LcmControl.c

@@ -731,6 +731,11 @@ void setWifi4GIcon()
 			}
 		}
 	}
+	else if(ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'E')
+	{
+		setDisplayValue(ICON_WIFI_CONNECTION, DISAPPEAR);
+		setDisplayValue(ICON_4G_CONNECTION, DISAPPEAR);
+	}
 	else
 	{
 		// SET 4G ICON STATUS ( ONLINE OR OFFLINE )
@@ -745,6 +750,8 @@ void setWifi4GIcon()
 
 					break;
 				case ENABLE_4G:
+					// Clean icon
+					setDisplayValue(ICON_4G_CONNECTION, DISAPPEAR);
 
 					if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi == ON)
 						setDisplayValue(ICON_WIFI_CONNECTION, TELECOM_OFFLINE);
@@ -769,6 +776,8 @@ void setWifi4GIcon()
 
 					break;
 				case WIFI_STATION:
+					// Clean icon
+					setDisplayValue(ICON_4G_CONNECTION, DISAPPEAR);
 
 					if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi == ON)
 						setDisplayValue(ICON_WIFI_CONNECTION, WIFI_OFFLINE);

+ 61 - 3
EVSE/Projects/AW-CCS/Apps/main.c

@@ -32,6 +32,7 @@
 #define TIMEOUT_SPEC_POWERSAVING_LCD			120000
 #define TIMEOUT_SPEC_POWERSAVING_RFID			120000
 #define TIMEOUT_SPEC_POWERSAVING_METER			120000
+#define TIMEOUT_SPEC_POWERSAVING_LED_STATUS		120000
 
 //==========================
 // GPIO constant define
@@ -3175,6 +3176,24 @@ void setLedMotion(unsigned char gun_index,unsigned char led_mode)
 		case LED_ACTION_INTERNET_DISCONNECT:
 			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_INTERNET_DISCONNECT;
 			break;
+		case LED_ACTION_RESTORE_SETTING:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_RESTORE_SETTING;
+			break;
+		case LED_ACTION_IDLE_BACKEND_CONNECTED:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_IDLE_BACKEND_CONNECTED;
+			break;
+		case LED_ACTION_IDLE_BACKEND_CONNECTED_SLEEP:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_IDLE_BACKEND_CONNECTED_SLEEP;
+			break;
+		case LED_ACTION_IDLE_BACKEND_DISCONNECTED:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_IDLE_BACKEND_DISCONNECTED;
+			break;
+		case LED_ACTION_IDLE_BACKEND_DISCONNECTED_SLEEP:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_IDLE_BACKEND_DISCONNECTED_SLEEP;
+			break;
+		case LED_ACTION_RESERVATION_MODE:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_RESERVATION_MODE;
+			break;
 	}
 }
 
@@ -4658,6 +4677,7 @@ int main(void)
 				ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
 				ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
 				ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
+				ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]);
 			}
 			else
 			{
@@ -4671,6 +4691,7 @@ int main(void)
 					ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
 					ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
 					ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
+					ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]);
 				}
 			}
 
@@ -4712,7 +4733,7 @@ int main(void)
 
 			if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_METER]) > TIMEOUT_SPEC_POWERSAVING_METER)
 			{
-				if(ShmCharger->gun_info[gun_index].isMeterOn )
+				if(ShmCharger->gun_info[gun_index].isMeterOn)
 				{
 					DEBUG_INFO("Meter into power saving...%d\n", DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_METER]));
 					ShmCharger->gun_info[gun_index].isMeterOn = OFF;
@@ -4720,12 +4741,29 @@ int main(void)
 			}
 			else
 			{
-				if(!ShmCharger->gun_info[gun_index].isMeterOn )
+				if(!ShmCharger->gun_info[gun_index].isMeterOn)
 				{
 					DEBUG_INFO("Meter exit power saving...%d\n", DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_METER]));
 					ShmCharger->gun_info[gun_index].isMeterOn = ON;
 				}
 			}
+			
+			if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]) > TIMEOUT_SPEC_POWERSAVING_LED_STATUS)
+			{
+				if(ShmCharger->gun_info[gun_index].isSleepOn == OFF)
+				{
+					DEBUG_INFO("LED status into power saving...%d\n", DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]));
+					ShmCharger->gun_info[gun_index].isSleepOn = ON;
+				}
+			}
+			else
+			{
+				if(ShmCharger->gun_info[gun_index].isSleepOn == ON)
+				{
+					DEBUG_INFO("LED status exit power saving...%d\n", DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]));
+					ShmCharger->gun_info[gun_index].isSleepOn = OFF;
+				}
+			}
 
 			//==========================================
 			// Synchronize current rating value from MCU
@@ -4830,6 +4868,7 @@ int main(void)
 						ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
 						ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
 						ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_STATE_B]);
+						ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]);
 					}
 
 					if(ShmCharger->gun_info[gun_index].mcuFlag.isReadFwVerPass &&
@@ -4892,6 +4931,9 @@ int main(void)
 
 						// Default LCM brightness to 100
 						ShmCharger->isLcdOn = ON;
+						
+						// Defaule led status to not sleep mode
+						ShmCharger->gun_info[gun_index].isSleepOn = OFF;
 
 						// If Web Server OPCC URL is empty kill Module_OcppBackend
 						if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0) || ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging)
@@ -4951,6 +4993,22 @@ int main(void)
 						if(ShmCharger->isCcsEnable)system("pkill Module_CCS");
 						DB_Check_Record_Buf(localDb, gun_index);
 					}
+					
+					// LED status in Idle mode
+					if(ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON)
+					{
+						if(ShmCharger->gun_info[gun_index].isSleepOn == OFF)
+							setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_CONNECTED);
+						else
+							setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_CONNECTED_SLEEP);
+					}
+					else
+					{
+						if(ShmCharger->gun_info[gun_index].isSleepOn == OFF)
+							setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_DISCONNECTED);
+						else
+							setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_DISCONNECTED_SLEEP);
+					}
 
 					if(((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B)) ||
 					   ((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)) ||
@@ -5953,7 +6011,7 @@ int main(void)
 				case SYS_MODE_RESERVATION:
 					if(isModeChange(gun_index))
 					{}
-					setLedMotion(gun_index,LED_ACTION_MAINTAIN);
+					setLedMotion(gun_index,LED_ACTION_RESERVATION_MODE);
 
 					if(isReservationExpired(gun_index))
 					{

+ 10 - 3
EVSE/Projects/AW-CCS/Apps/main.h

@@ -153,7 +153,13 @@ enum LED_ACTION
 	LED_RELAY_ON,
 	LED_RELAY_OFF,
 	LED_ACTION_HANDSHAKE_FAIL,
-	LED_ACTION_INTERNET_DISCONNECT
+	LED_ACTION_INTERNET_DISCONNECT,
+	LED_ACTION_RESTORE_SETTING,
+	LED_ACTION_IDLE_BACKEND_CONNECTED,
+	LED_ACTION_IDLE_BACKEND_CONNECTED_SLEEP,
+	LED_ACTION_IDLE_BACKEND_DISCONNECTED,
+	LED_ACTION_IDLE_BACKEND_DISCONNECTED_SLEEP,
+	LED_ACTION_RESERVATION_MODE
 };
 
 //===================================
@@ -222,7 +228,7 @@ enum TIMER_IDX
 	TMR_IDX_POWERSAVING_METER,
 	TMR_IDX_POWERSAVING_STATE_B,
 	TMR_IDX_CHECK_TASK,
-	TMR_IDX_12,
+	TMR_IDX_POWERSAVING_LED_STATUS,
 	TMR_IDX_13,
 	TMR_IDX_14,
 	TMR_IDX_15,
@@ -746,7 +752,8 @@ typedef struct GUN_INFO
 	uint16_t										isDoEvReadyOnce:1;
 	uint16_t										isChargerStopByCondition:1;
 	uint16_t										isMeterOn:1;
-	uint16_t										:3;
+	uint16_t										isSleepOn:1;
+	uint16_t										:2;
 }Gun_Info;
 
 struct Charger