|
@@ -788,7 +788,7 @@ static int localversion=0;
|
|
|
//===============================
|
|
|
// Variable Version
|
|
|
//===============================
|
|
|
-static int variableVersion=1;
|
|
|
+static int variableVersion=2;
|
|
|
|
|
|
//===============================
|
|
|
// OCPP sign variable
|
|
@@ -870,14 +870,14 @@ typedef union
|
|
|
struct
|
|
|
{
|
|
|
//CsMsgValue[0]
|
|
|
- unsigned char StatusNotificationReq:1; //bit 0,
|
|
|
- unsigned char StatusNotificationConf:1; //bit 1,
|
|
|
- unsigned char TriggerMeterValueReq:1; //bit 2,
|
|
|
- unsigned char TransactionEventReq:1; //bit 3,
|
|
|
- unsigned char SampleMeterReq:1; //bit 4,
|
|
|
- unsigned char ClockAlignMeterReq:1; //bit 5,
|
|
|
- unsigned char TriggerStatusNotificationReq:1; //bit 6,
|
|
|
- unsigned char isOnCharging:1; //bit7
|
|
|
+ unsigned char StatusNotificationReq:1; //bit 0,
|
|
|
+ unsigned char StatusNotificationConf:1; //bit 1,
|
|
|
+ unsigned char TriggerMeterValueReq:1; //bit 2,
|
|
|
+ unsigned char SampleMeterReq:1; //bit 3,
|
|
|
+ unsigned char ClockAlignMeterReq:1; //bit 4,
|
|
|
+ unsigned char TriggerStatusNotificationReq:1; //bit 5,
|
|
|
+ unsigned char isOnCharging:1; //bit6,
|
|
|
+ unsigned char :1; //bit7
|
|
|
}bits[CONNECTOR_QUANTITY];
|
|
|
}CpinitiateMsg;
|
|
|
|
|
@@ -1463,9 +1463,21 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
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,Current.Offered,Power.Offered");
|
|
|
+ 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,Current.Offered");
|
|
|
+ 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");
|
|
@@ -1501,9 +1513,18 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_TxEndedMeasurands].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_TxEndedMeasurands].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadOnly]);
|
|
|
if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_TxEndedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SoC");
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_TxEndedMeasurands].variableAttribute[0].value, "Current.Import,"
|
|
|
+ "Energy.Active.Import.Register,"
|
|
|
+ "Energy.Active.Import.Interval,"
|
|
|
+ "Power.Active.Import,"
|
|
|
+ "Voltage,"
|
|
|
+ "SoC");
|
|
|
else
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_TxEndedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage");
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_TxEndedMeasurands].variableAttribute[0].value, "Current.Import,"
|
|
|
+ "Energy.Active.Import.Register,"
|
|
|
+ "Energy.Active.Import.Interval,"
|
|
|
+ "Power.Active.Import,"
|
|
|
+ "Voltage");
|
|
|
DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_TxEndedMeasurands]);
|
|
|
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_TxEndedInterval].component.name, "AlignedDataCtrlr");
|
|
@@ -2191,9 +2212,18 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxEndedMeasurands].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxEndedMeasurands].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
|
|
|
if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxEndedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SoC");
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxEndedMeasurands].variableAttribute[0].value, "Current.Import,"
|
|
|
+ "Energy.Active.Import.Register,"
|
|
|
+ "Energy.Active.Import.Interval,"
|
|
|
+ "Power.Active.Import,"
|
|
|
+ "Voltage,"
|
|
|
+ "SoC");
|
|
|
else
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxEndedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Interval,Power.Active.Import,Voltage");
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxEndedMeasurands].variableAttribute[0].value, "Current.Import,"
|
|
|
+ "Energy.Active.Import.Register,"
|
|
|
+ "Energy.Active.Import.Interval,"
|
|
|
+ "Power.Active.Import,"
|
|
|
+ "Voltage");
|
|
|
|
|
|
DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxEndedMeasurands]);
|
|
|
|
|
@@ -2222,9 +2252,21 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
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,Current.Offered,Power.Offered");
|
|
|
+ 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,Current.Offered");
|
|
|
+ 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");
|
|
@@ -6253,29 +6295,6 @@ void CheckSystemValue(void)
|
|
|
ShmOCPP20Data->CsMsg.bits[gun_index].DataTransferReq = OFF;
|
|
|
}
|
|
|
|
|
|
- //==============================================
|
|
|
- // Charger start transaction
|
|
|
- //==============================================
|
|
|
- /*
|
|
|
- if((ShmOCPP20Data->CpMsg.bits[gun_index].StartTransactionReq == ON))
|
|
|
- {
|
|
|
- ShmOCPP20Data->CpMsg.bits[gun_index].StartTransactionReq = OFF;
|
|
|
- sendStartTransactionRequest(gun_index);
|
|
|
- clientTime.StartTransaction = time((time_t*)NULL);
|
|
|
- clientTime.MeterValues[gun_index] = time((time_t*)NULL);
|
|
|
- }*/
|
|
|
-
|
|
|
- //==============================================
|
|
|
- // Charger stop transaction
|
|
|
- //==============================================
|
|
|
- /*
|
|
|
- if(((ShmOCPP20Data->CpMsg.bits[gun_index].StopTransactionReq == ON)))
|
|
|
- {
|
|
|
- ShmOCPP20Data->CpMsg.bits[gun_index].StopTransactionReq =OFF;
|
|
|
- sendStopTransactionRequest(gun_index);
|
|
|
- clientTime.StopTransaction = time((time_t*)NULL);
|
|
|
- }*/
|
|
|
-
|
|
|
//==============================================
|
|
|
// Charger status notification & Transaction event report
|
|
|
//==============================================
|
|
@@ -6307,7 +6326,7 @@ void CheckSystemValue(void)
|
|
|
(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_PREPARING) &&
|
|
|
(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
{
|
|
|
- cpinitateMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
}
|
|
|
|
|
|
if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex) && ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_COMPLETE) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_IDLE))) // complete
|
|
@@ -6361,7 +6380,7 @@ void CheckSystemValue(void)
|
|
|
(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus >= SYS_MODE_PREPARING) &&
|
|
|
(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
{
|
|
|
- cpinitateMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
}
|
|
|
|
|
|
if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex) && ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_COMPLETE) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus <= SYS_MODE_IDLE))) // complete
|
|
@@ -6414,7 +6433,7 @@ void CheckSystemValue(void)
|
|
|
(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus >= SYS_MODE_PREPARING) &&
|
|
|
(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
{
|
|
|
- cpinitateMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
}
|
|
|
|
|
|
if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex) && ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_COMPLETE) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus <= SYS_MODE_IDLE))) // complete
|
|
@@ -6460,7 +6479,7 @@ void CheckSystemValue(void)
|
|
|
(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus >= SYS_MODE_PREPARING) &&
|
|
|
(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
{
|
|
|
- cpinitateMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
}
|
|
|
|
|
|
if((ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex) && ((ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_COMPLETE) || (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus <= SYS_MODE_IDLE))) // complete
|
|
@@ -6512,7 +6531,7 @@ void CheckSystemValue(void)
|
|
|
(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus >= SYS_MODE_PREPARING) &&
|
|
|
(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
{
|
|
|
- cpinitateMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
}
|
|
|
|
|
|
if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex) && ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_COMPLETE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus <= SYS_MODE_IDLE))) // complete
|
|
@@ -6564,12 +6583,12 @@ void CheckSystemValue(void)
|
|
|
//==============================================
|
|
|
// CSU transaction event
|
|
|
//==============================================
|
|
|
- if(cpinitateMsg.bits[gun_index].TransactionEventReq == ON)
|
|
|
+ if(ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq == ON)
|
|
|
{
|
|
|
sendTransactionEventRequest(gun_index);
|
|
|
- cpinitateMsg.bits[gun_index].TransactionEventReq = OFF;
|
|
|
- storeTempStopTransaction(gun_index);
|
|
|
- memset(&ShmOCPP20Data->TransactionEvent[gun_index].meterValue[0], 0x00, sizeof(struct MeterValueType));
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = OFF;
|
|
|
+ //storeTempStopTransaction(gun_index);
|
|
|
+ //memset(&ShmOCPP20Data->TransactionEvent[gun_index].meterValue[0], 0x00, sizeof(struct MeterValueType));
|
|
|
}
|
|
|
|
|
|
//==============================================
|
|
@@ -8456,7 +8475,7 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
|
|
|
{
|
|
|
// Transaction meter value send by TransactionEvent message
|
|
|
memcpy(&ShmOCPP20Data->TransactionEvent[gun_index].meterValue[0], &ShmOCPP20Data->MeterValues[gun_index].meterValue[0], sizeof(struct MeterValueType));
|
|
|
- cpinitateMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
|
|
|
|
result = PASS;
|
|
|
}
|
|
@@ -9620,7 +9639,6 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
random_uuid((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].StartUserId);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.type, "%s", IdTokenEnumTypeStr[ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].StartIdType]);
|
|
|
- storeTempStopTransaction(gun_index);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
}
|
|
|
else
|
|
@@ -9633,6 +9651,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
}
|
|
|
else if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
{
|
|
|
+ storeTempStopTransaction(gun_index);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
@@ -9736,7 +9755,6 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
random_uuid((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].StartUserId);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.type, "%s", IdTokenEnumTypeStr[ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].StartIdType]);
|
|
|
- storeTempStopTransaction(gun_index);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
}
|
|
|
else
|
|
@@ -9749,6 +9767,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
}
|
|
|
else if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
{
|
|
|
+ storeTempStopTransaction(gun_index);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
@@ -9851,7 +9870,6 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
random_uuid((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.GbChargingData[index].StartUserId);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.type, "%s", IdTokenEnumTypeStr[ShmSysConfigAndInfo->SysInfo.GbChargingData[index].StartIdType]);
|
|
|
- storeTempStopTransaction(gun_index);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
}
|
|
|
else
|
|
@@ -9864,6 +9882,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
}
|
|
|
else if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
{
|
|
|
+ storeTempStopTransaction(gun_index);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
@@ -9959,7 +9978,6 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
random_uuid((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.StartUserId);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.type, "%s", IdTokenEnumTypeStr[ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.StartIdType]);
|
|
|
- storeTempStopTransaction(gun_index);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
}
|
|
|
else
|
|
@@ -9972,6 +9990,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
}
|
|
|
else if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
{
|
|
|
+ storeTempStopTransaction(gun_index);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
@@ -10073,7 +10092,6 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
random_uuid((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.AcChargingData[index].StartUserId);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.type, "%s", IdTokenEnumTypeStr[ShmSysConfigAndInfo->SysInfo.AcChargingData[index].StartIdType]);
|
|
|
- storeTempStopTransaction(gun_index);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
}
|
|
|
else
|
|
@@ -10086,6 +10104,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
}
|
|
|
else if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
{
|
|
|
+ storeTempStopTransaction(gun_index);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
@@ -10184,34 +10203,38 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
for(int idxSample=0;idxSample<ARRAY_SIZE(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue);idxSample++)
|
|
|
{
|
|
|
if((strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context) > 0) &&
|
|
|
- ((strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase) > 0) || (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand, MeasurandEnumTypeStr[MeasurandEnumType_SoC]) == 0)))
|
|
|
+ ((strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase) > 0) || (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand, MeasurandEnumTypeStr[MeasurandEnumType_SoC]) == 0) || (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Offered]) == 0) || (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Power_Offered]) == 0)))
|
|
|
{
|
|
|
- json_object *sampledValue = json_object_new_object();
|
|
|
+ if(((strstr((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, TransactionEventEnumTypeStr[TransactionEventEnumType_Ended]) != NULL) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxEndedMeasurands].variableAttribute[0].value, (char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand) != NULL)) ||
|
|
|
+ (strstr((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, TransactionEventEnumTypeStr[TransactionEventEnumType_Ended]) == NULL))
|
|
|
+ {
|
|
|
+ json_object *sampledValue = json_object_new_object();
|
|
|
|
|
|
- json_object_object_add(sampledValue, "value", json_object_new_double(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].value));
|
|
|
+ json_object_object_add(sampledValue, "value", json_object_new_double(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].value));
|
|
|
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context) > 0)
|
|
|
- json_object_object_add(sampledValue, "context", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context));
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context) > 0)
|
|
|
+ json_object_object_add(sampledValue, "context", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context));
|
|
|
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand) > 0)
|
|
|
- json_object_object_add(sampledValue, "measurand", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand));
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand) > 0)
|
|
|
+ json_object_object_add(sampledValue, "measurand", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand));
|
|
|
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase) > 0)
|
|
|
- json_object_object_add(sampledValue, "phase", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase));
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase) > 0)
|
|
|
+ json_object_object_add(sampledValue, "phase", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase));
|
|
|
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].location) > 0)
|
|
|
- json_object_object_add(sampledValue, "location", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].location));
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].location) > 0)
|
|
|
+ json_object_object_add(sampledValue, "location", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].location));
|
|
|
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint) > 0)
|
|
|
- {
|
|
|
- json_object *unitOfMeasure = json_object_new_object();
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint) > 0)
|
|
|
+ {
|
|
|
+ json_object *unitOfMeasure = json_object_new_object();
|
|
|
|
|
|
- json_object_object_add(unitOfMeasure, "unit", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint));
|
|
|
- json_object_object_add(unitOfMeasure, "multiplier", json_object_new_int(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.multiplier));
|
|
|
- json_object_object_add(sampledValue, "unitOfMeasure", unitOfMeasure);
|
|
|
- }
|
|
|
+ json_object_object_add(unitOfMeasure, "unit", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint));
|
|
|
+ json_object_object_add(unitOfMeasure, "multiplier", json_object_new_int(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.multiplier));
|
|
|
+ json_object_object_add(sampledValue, "unitOfMeasure", unitOfMeasure);
|
|
|
+ }
|
|
|
|
|
|
- json_object_array_add(sampledValues, sampledValue);
|
|
|
+ json_object_array_add(sampledValues, sampledValue);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
json_object_object_add(meterValue, "sampledValue", sampledValues);
|
|
@@ -16638,13 +16661,13 @@ int handleTriggerMessageRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
if((connectorIdInt > 0) && ((connectorIdInt -1) < gunTotalNumber))
|
|
|
{
|
|
|
- cpinitateMsg.bits[connectorIdInt -1].TransactionEventReq = ON;
|
|
|
+ ShmOCPP20Data->CpMsg.bits[connectorIdInt -1].TransactionEventReq = ON;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
for(int idx=0;idx< gunTotalNumber;idx++)
|
|
|
- cpinitateMsg.bits[idx].TransactionEventReq = ON;
|
|
|
+ ShmOCPP20Data->CpMsg.bits[idx].TransactionEventReq = ON;
|
|
|
}
|
|
|
}
|
|
|
else if(strcmp((char*)ShmOCPP20Data->TriggerMessage.requestedMessage, MessageTriggerEnumTypeStr[MessageTriggerEnumType_SignCombinedCertificate]) == 0 )
|
|
@@ -17624,7 +17647,6 @@ void handleTransactionEvenResponse(char *payload, int gun_index)
|
|
|
}
|
|
|
json_object_put(TransactionEven);
|
|
|
|
|
|
- ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = OFF;
|
|
|
ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventConf = ON;
|
|
|
}
|
|
|
|
|
@@ -17963,7 +17985,6 @@ void storeTempStopTransaction(int gun_index)
|
|
|
char TempStopTransaction[256];
|
|
|
char message[1024*20]={0};
|
|
|
char guid[37]={0};
|
|
|
- uint8_t tempIndex;
|
|
|
json_object *TransactionEvent = json_object_new_object();
|
|
|
json_object *transactionInfo = json_object_new_object();
|
|
|
json_object *idToken = json_object_new_object();
|
|
@@ -17973,293 +17994,14 @@ void storeTempStopTransaction(int gun_index)
|
|
|
|
|
|
DEBUG_INFO("storeTempStopTransaction...\n");
|
|
|
|
|
|
- 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))
|
|
|
- {
|
|
|
- getNowDatetime(ShmOCPP20Data->TransactionEvent[gun_index].timestamp);
|
|
|
-
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].offline = (!ShmOCPP20Data->OcppConnStatus?TRUE:FALSE);
|
|
|
-
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].evse.id = (gun_index + 1);
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].evse.connectorId = (gun_index + 1);
|
|
|
-
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_IDLE)//S_IDLE
|
|
|
- {
|
|
|
- memset(&ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo, 0x00, sizeof(struct TransactionType));
|
|
|
- memset(&ShmOCPP20Data->TransactionEvent[gun_index].idToken, 0x00, sizeof(struct IdTokenType));
|
|
|
- memset(&ShmOCPP20Data->TransactionEvent[gun_index].meterValue, 0x00, sizeof(struct MeterValueType));
|
|
|
-
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Idle]);
|
|
|
-
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn == ON) // //0: unplug, 1: Plug-in
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_CablePluggedIn]);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_EVCommunicationLost]);
|
|
|
- }
|
|
|
- }
|
|
|
- else if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_AUTHORIZING)//S_IDLE
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Idle]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_Authorized]);
|
|
|
- }
|
|
|
- else if ( ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_PREPARING)&&( ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_PREPARE_FOR_EVSE)) ||
|
|
|
- ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0) && ( ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1) )
|
|
|
- ) //S_PRECHARGE
|
|
|
- {
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId) == 0)
|
|
|
- {
|
|
|
- random_uuid((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].StartUserId);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.type, "%s", ShmOCPP20Data->Authorize.idToken.type);
|
|
|
- }
|
|
|
-
|
|
|
- if(ShmOCPP20Data->TransactionEvent[gun_index].eventType[0] == '\0')
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
- else
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_EVConnected]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
- }
|
|
|
- else if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
- }
|
|
|
- else if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_COMPLETE) //S_COMPLETE
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Ended]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
- }
|
|
|
- else if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_TERMINATING) // S_TERMINATING ---> SuspendedEV
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_SuspendedEV]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
- }
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_MAINTAIN)|| (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_UPDATE)) // ---> Unavailable
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_SuspendedEVSE]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_AbnormalCondition]);
|
|
|
- }
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_FAULT)|| (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_ALARM)) //S_ALARM,S_FAULT ---> Faulted
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_SuspendedEVSE]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_AbnormalCondition]);
|
|
|
- }
|
|
|
- else if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_RESERVATION) // ---> Reserved
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_SuspendedEVSE]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_AbnormalCondition]);
|
|
|
- }
|
|
|
- } //end of the same index
|
|
|
-
|
|
|
- }//end of for CHAdeMO_QUANTITY
|
|
|
+ getNowDatetime(ShmOCPP20Data->TransactionEvent[gun_index].timestamp);
|
|
|
+ ShmOCPP20Data->TransactionEvent[gun_index].offline = (!ShmOCPP20Data->OcppConnStatus?TRUE:FALSE);
|
|
|
+ ShmOCPP20Data->TransactionEvent[gun_index].evse.id = (gun_index + 1);
|
|
|
+ ShmOCPP20Data->TransactionEvent[gun_index].evse.connectorId = (gun_index + 1);
|
|
|
|
|
|
- }
|
|
|
- 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)
|
|
|
- {
|
|
|
- getNowDatetime(ShmOCPP20Data->TransactionEvent[gun_index].timestamp);
|
|
|
-
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].offline = (!ShmOCPP20Data->OcppConnStatus?TRUE:FALSE);
|
|
|
-
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].evse.id = (gun_index + 1);
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].evse.connectorId = (gun_index + 1);
|
|
|
-
|
|
|
- if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_IDLE) //S_IDLE
|
|
|
- {
|
|
|
- memset(&ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo, 0x00, sizeof(struct TransactionType));
|
|
|
- memset(&ShmOCPP20Data->TransactionEvent[gun_index].idToken, 0x00, sizeof(struct IdTokenType));
|
|
|
- memset(&ShmOCPP20Data->TransactionEvent[gun_index].meterValue, 0x00, sizeof(struct MeterValueType));
|
|
|
-
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Idle]);
|
|
|
-
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn == ON) //0: unplug, 1: Plug-in
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_CablePluggedIn]);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_EVCommunicationLost]);
|
|
|
- }
|
|
|
- }
|
|
|
- else if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_AUTHORIZING)//S_IDLE
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Idle]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_Authorized]);
|
|
|
- }
|
|
|
- else if ( ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus >= SYS_MODE_PREPARING)&&( ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus <= SYS_MODE_PREPARE_FOR_EVSE)) ||
|
|
|
- ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0) && ( ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1) )
|
|
|
- ) //S_PRECHARGE
|
|
|
- {
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId) == 0)
|
|
|
- {
|
|
|
- random_uuid((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].StartUserId);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.type, "%s", ShmOCPP20Data->Authorize.idToken.type);
|
|
|
- }
|
|
|
-
|
|
|
- if(ShmOCPP20Data->TransactionEvent[gun_index].eventType[0] == '\0')
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
- else
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_EVConnected]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
- }
|
|
|
- else if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
- }
|
|
|
- else if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_COMPLETE) //S_COMPLETE
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Ended]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
- }
|
|
|
- else if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_TERMINATING) // S_TERMINATING ---> SuspendedEV
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_SuspendedEV]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
- }
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_MAINTAIN)|| (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_UPDATE)) // ---> Unavailable
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_SuspendedEVSE]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_AbnormalCondition]);
|
|
|
- }
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_FAULT)|| (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_ALARM)) //S_ALARM,S_FAULT ---> Faulted
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_SuspendedEVSE]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_AbnormalCondition]);
|
|
|
- }
|
|
|
- else if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_RESERVATION) // ---> Reserved
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_SuspendedEVSE]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_AbnormalCondition]);
|
|
|
- }
|
|
|
- } //end of the same index
|
|
|
-
|
|
|
- } // end of for 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)
|
|
|
- {
|
|
|
- getNowDatetime(ShmOCPP20Data->TransactionEvent[gun_index].timestamp);
|
|
|
-
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].offline = (!ShmOCPP20Data->OcppConnStatus?TRUE:FALSE);
|
|
|
-
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].evse.id = (gun_index + 1);
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].evse.connectorId = (gun_index + 1);
|
|
|
-
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Ended]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
- } //end of the same index
|
|
|
-
|
|
|
- } // end of for 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)
|
|
|
- {
|
|
|
- getNowDatetime(ShmOCPP20Data->TransactionEvent[gun_index].timestamp);
|
|
|
-
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].offline = (!ShmOCPP20Data->OcppConnStatus?TRUE:FALSE);
|
|
|
-
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].evse.id = (gun_index + 1);
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].evse.connectorId = (gun_index + 1);
|
|
|
-
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Ended]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
- } //end of the same index
|
|
|
- }
|
|
|
- }
|
|
|
- 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)
|
|
|
- {
|
|
|
- getNowDatetime(ShmOCPP20Data->TransactionEvent[gun_index].timestamp);
|
|
|
-
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].offline = (!ShmOCPP20Data->OcppConnStatus?TRUE:FALSE);
|
|
|
-
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].evse.id = (gun_index + 1);
|
|
|
- ShmOCPP20Data->TransactionEvent[gun_index].evse.connectorId = (gun_index + 1);
|
|
|
-
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Ended]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
- }//end of the same index
|
|
|
- }//end of for AC_QUANTITY
|
|
|
- }
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Ended]);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_SuspendedEVSE]);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_AbnormalCondition]);
|
|
|
|
|
|
// Message
|
|
|
json_object_object_add(TransactionEvent, "eventType", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType));
|
|
@@ -18317,34 +18059,37 @@ void storeTempStopTransaction(int gun_index)
|
|
|
for(int idxSample=0;idxSample<ARRAY_SIZE(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue);idxSample++)
|
|
|
{
|
|
|
if((strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context) > 0) &&
|
|
|
- ((strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase) > 0) || (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand, MeasurandEnumTypeStr[MeasurandEnumType_SoC]) == 0)))
|
|
|
+ ((strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase) > 0) || (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand, MeasurandEnumTypeStr[MeasurandEnumType_SoC]) == 0) || (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Offered]) == 0) || (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Power_Offered]) == 0)))
|
|
|
{
|
|
|
- json_object *sampledValue = json_object_new_object();
|
|
|
+ if(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxEndedMeasurands].variableAttribute[0].value, (char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand) != NULL)
|
|
|
+ {
|
|
|
+ json_object *sampledValue = json_object_new_object();
|
|
|
|
|
|
- json_object_object_add(sampledValue, "value", json_object_new_double(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].value));
|
|
|
+ json_object_object_add(sampledValue, "value", json_object_new_double(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].value));
|
|
|
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context) > 0)
|
|
|
- json_object_object_add(sampledValue, "context", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context));
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context) > 0)
|
|
|
+ json_object_object_add(sampledValue, "context", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context));
|
|
|
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand) > 0)
|
|
|
- json_object_object_add(sampledValue, "measurand", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand));
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand) > 0)
|
|
|
+ json_object_object_add(sampledValue, "measurand", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand));
|
|
|
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase) > 0)
|
|
|
- json_object_object_add(sampledValue, "phase", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase));
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase) > 0)
|
|
|
+ json_object_object_add(sampledValue, "phase", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase));
|
|
|
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].location) > 0)
|
|
|
- json_object_object_add(sampledValue, "location", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].location));
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].location) > 0)
|
|
|
+ json_object_object_add(sampledValue, "location", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].location));
|
|
|
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint) > 0)
|
|
|
- {
|
|
|
- json_object *unitOfMeasure = json_object_new_object();
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint) > 0)
|
|
|
+ {
|
|
|
+ json_object *unitOfMeasure = json_object_new_object();
|
|
|
|
|
|
- json_object_object_add(unitOfMeasure, "unit", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint));
|
|
|
- json_object_object_add(unitOfMeasure, "multiplier", json_object_new_int(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.multiplier));
|
|
|
- json_object_object_add(sampledValue, "unitOfMeasure", unitOfMeasure);
|
|
|
- }
|
|
|
+ json_object_object_add(unitOfMeasure, "unit", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint));
|
|
|
+ json_object_object_add(unitOfMeasure, "multiplier", json_object_new_int(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.multiplier));
|
|
|
+ json_object_object_add(sampledValue, "unitOfMeasure", unitOfMeasure);
|
|
|
+ }
|
|
|
|
|
|
- json_object_array_add(sampledValues, sampledValue);
|
|
|
+ json_object_array_add(sampledValues, sampledValue);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
json_object_object_add(meterValue, "sampledValue", sampledValues);
|