|
@@ -832,6 +832,7 @@ static int FirstHeartBeat = 0;
|
|
|
static int FirmwareStatusNotificationStatus = FirmwareStatusEnumType_Idle; // Idle
|
|
|
static int LogStatusNotificationStatus = UploadLogStatusEnumType_Idle; // Idle
|
|
|
static char CurrentChargingProfileScheduleStr[30] = {0};
|
|
|
+static int isCancelUploadLog = FALSE;
|
|
|
|
|
|
//========================================
|
|
|
// OCPP status/previous related variables
|
|
@@ -850,6 +851,8 @@ static uint8_t DoPreviousConnectorPlugIn[(CONNECTOR_QUANTITY>0?CONNECTOR_QUANTIT
|
|
|
static int TransactionMessageAttemptsValue = 0;
|
|
|
static int TransactionMessageRetryIntervalValue = 0;
|
|
|
static struct AuthorizationData idTagQuery;
|
|
|
+static float periousPeriodicPowerConsumption[CONNECTOR_QUANTITY] = {0};
|
|
|
+static float periousClockPowerConsumption[CONNECTOR_QUANTITY] = {0};
|
|
|
|
|
|
//=============================================
|
|
|
// OCPP HeartBeat Response Not Receive Counts
|
|
@@ -1683,7 +1686,7 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Enabled].component.name, "AuthCacheCtrlr");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Enabled].variable.name, "Enabled");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Enabled].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_boolean]);
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Enabled].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Enabled].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Actual]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Enabled].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Enabled].variableAttribute[0].value, "FALSE");
|
|
|
DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Enabled]);
|
|
@@ -1691,7 +1694,7 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Available].component.name, "AuthCacheCtrlr");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Available].variable.name, "Available");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Available].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_boolean]);
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Available].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Available].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Actual]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Available].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadOnly]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Available].variableAttribute[0].value, "TRUE");
|
|
|
DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Available]);
|
|
@@ -1700,7 +1703,7 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_LifeTime].variable.name, "LifeTime");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_LifeTime].variableCharacteristics.unit, "Seconds");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_LifeTime].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_integer]);
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_LifeTime].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_LifeTime].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Actual]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_LifeTime].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_LifeTime].variableAttribute[0].value, "TRUE");
|
|
|
DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_LifeTime]);
|
|
@@ -1709,7 +1712,7 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Storage].variable.name, "Storage");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Storage].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_integer]);
|
|
|
ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Storage].variableCharacteristics.maxLimit = (1024*10);
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Storage].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Storage].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Actual]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Storage].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Storage].variableAttribute[0].value, "TRUE");
|
|
|
DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Storage]);
|
|
@@ -1717,7 +1720,7 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Policy].component.name, "AuthCacheCtrlr");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Policy].variable.name, "Policy");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Policy].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_OptionList]);
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Policy].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Policy].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Actual]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Policy].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Policy].variableAttribute[0].value, "LRU,LFU");
|
|
|
DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[AuthCacheCtrlr_Policy]);
|
|
@@ -6449,20 +6452,65 @@ int ProcessShareMemory()
|
|
|
{
|
|
|
gunTotalNumber += 1;
|
|
|
gunType[gun_index] = GUN_TYPE_DO;
|
|
|
+ for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == gun_index)
|
|
|
+ {
|
|
|
+ periousPeriodicPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PowerConsumption;
|
|
|
+ periousClockPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PowerConsumption;
|
|
|
+ DEBUG_INFO("Gun-%02d PowerConsumption: %.3f\n", gun_index, ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PowerConsumption);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
switch(modelnameInfo.ParsingInfo[gun_index].GunType)
|
|
|
{
|
|
|
case Gun_Type_Chademo:
|
|
|
DEBUG_INFO("Gun-%02d type: Cabinet CHAdeMO\n", gun_index);
|
|
|
+ for(int index = 0; index < CHAdeMO_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)
|
|
|
+ {
|
|
|
+ periousPeriodicPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PowerConsumption;
|
|
|
+ periousClockPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PowerConsumption;
|
|
|
+ DEBUG_INFO("Gun-%02d PowerConsumption: %.3f\n", gun_index, ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PowerConsumption);
|
|
|
+ }
|
|
|
+ }
|
|
|
break;
|
|
|
case Gun_Type_CCS_2:
|
|
|
DEBUG_INFO("Gun-%02d type: Cabinet CCS\n", gun_index);
|
|
|
+ for (int index = 0; index < CCS_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)
|
|
|
+ {
|
|
|
+ periousPeriodicPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PowerConsumption;
|
|
|
+ periousClockPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PowerConsumption;
|
|
|
+ DEBUG_INFO("Gun-%02d PowerConsumption: %.3f\n", gun_index, ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PowerConsumption);
|
|
|
+ }
|
|
|
+ }
|
|
|
break;
|
|
|
case Gun_Type_GB:
|
|
|
DEBUG_INFO("Gun-%02d type: Cabinet GBT\n", gun_index);
|
|
|
+ for (int index = 0; index < GB_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)
|
|
|
+ {
|
|
|
+ periousPeriodicPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PowerConsumption;
|
|
|
+ periousClockPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PowerConsumption;
|
|
|
+ DEBUG_INFO("Gun-%02d PowerConsumption: %.3f\n", gun_index, ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PowerConsumption);
|
|
|
+ }
|
|
|
+ }
|
|
|
break;
|
|
|
case Gun_Type_AC:
|
|
|
DEBUG_INFO("Gun-%02d type: Cabinet AC\n", gun_index);
|
|
|
+ for (int index = 0; index < AC_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)
|
|
|
+ {
|
|
|
+ periousPeriodicPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PowerConsumption;
|
|
|
+ periousClockPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PowerConsumption;
|
|
|
+ DEBUG_INFO("Gun-%02d PowerConsumption: %.3f\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PowerConsumption);
|
|
|
+ }
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
DEBUG_WARN("Gun-%02d type: Cabinet unknown\n", gun_index);
|
|
@@ -7419,7 +7467,7 @@ void CheckSystemValue(void)
|
|
|
if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != SYS_MODE_AUTHORIZING)
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
|
|
|
|
|
|
- if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus >= SYS_MODE_PREPARING) &&
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
|
|
|
(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
{
|
|
|
ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
@@ -8496,7 +8544,21 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
|
|
|
{
|
|
|
- ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ((uint32_t)(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargedEnergy*100))/100.0;
|
|
|
+ //ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ((uint32_t)(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargedEnergy*100))/100.0;
|
|
|
+ if(dataType == ReadingContextEnumType_Sample_Clock)
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PowerConsumption - periousClockPowerConsumption[gun_index]);
|
|
|
+ periousClockPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PowerConsumption;
|
|
|
+ }
|
|
|
+ else if(dataType == ReadingContextEnumType_Sample_Periodic)
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PowerConsumption - periousPeriodicPowerConsumption[gun_index]);
|
|
|
+ periousPeriodicPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PowerConsumption;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = 0;
|
|
|
+ }
|
|
|
}
|
|
|
} // END OF FOR CHAdeMO_QUANTITY
|
|
|
|
|
@@ -8517,7 +8579,21 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
|
|
|
{
|
|
|
- ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ((uint32_t)(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargedEnergy*100))/100.0;
|
|
|
+ //ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ((uint32_t)(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargedEnergy*100))/100.0;
|
|
|
+ if(dataType == ReadingContextEnumType_Sample_Clock)
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PowerConsumption - periousClockPowerConsumption[gun_index]);
|
|
|
+ periousClockPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PowerConsumption;
|
|
|
+ }
|
|
|
+ else if(dataType == ReadingContextEnumType_Sample_Periodic)
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PowerConsumption - periousPeriodicPowerConsumption[gun_index]);
|
|
|
+ periousPeriodicPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PowerConsumption;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = 0;
|
|
|
+ }
|
|
|
}
|
|
|
} // END OF CCS_QUANTITY
|
|
|
|
|
@@ -8538,7 +8614,21 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
|
|
|
{
|
|
|
- ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ((uint32_t)(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargedEnergy*100))/100.0;
|
|
|
+ //ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ((uint32_t)(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargedEnergy*100))/100.0;
|
|
|
+ if(dataType == ReadingContextEnumType_Sample_Clock)
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PowerConsumption - periousClockPowerConsumption[gun_index]);
|
|
|
+ periousClockPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PowerConsumption;
|
|
|
+ }
|
|
|
+ else if(dataType == ReadingContextEnumType_Sample_Periodic)
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PowerConsumption - periousPeriodicPowerConsumption[gun_index]);
|
|
|
+ periousPeriodicPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PowerConsumption;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = 0;
|
|
|
+ }
|
|
|
}
|
|
|
} // END OF GB_QUANTITY
|
|
|
|
|
@@ -8552,7 +8642,21 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
|
|
|
{
|
|
|
- ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ((uint32_t)(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargedEnergy*100))/100.0;
|
|
|
+ //ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ((uint32_t)(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargedEnergy*100))/100.0;
|
|
|
+ if(dataType == ReadingContextEnumType_Sample_Clock)
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PowerConsumption - periousClockPowerConsumption[gun_index]);
|
|
|
+ periousClockPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PowerConsumption;
|
|
|
+ }
|
|
|
+ else if(dataType == ReadingContextEnumType_Sample_Periodic)
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PowerConsumption - periousPeriodicPowerConsumption[gun_index]);
|
|
|
+ periousPeriodicPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PowerConsumption;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = 0;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -8573,7 +8677,21 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
|
|
|
{
|
|
|
- ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ((uint32_t)(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargedEnergy*100))/100.0;
|
|
|
+ //ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ((uint32_t)(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargedEnergy*100))/100.0;
|
|
|
+ if(dataType == ReadingContextEnumType_Sample_Clock)
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PowerConsumption - periousClockPowerConsumption[gun_index]);
|
|
|
+ periousClockPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PowerConsumption;
|
|
|
+ }
|
|
|
+ else if(dataType == ReadingContextEnumType_Sample_Periodic)
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PowerConsumption - periousPeriodicPowerConsumption[gun_index]);
|
|
|
+ periousPeriodicPowerConsumption[gun_index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PowerConsumption;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = 0;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -9300,7 +9418,7 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
|
|
|
else
|
|
|
{
|
|
|
if(FirstHeartBeat)
|
|
|
- LWS_Send(queuedata +2);
|
|
|
+ LWS_Send(queuedata);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -9711,7 +9829,7 @@ int sendNotifyReportRequest()
|
|
|
json_object_object_add(variableCharacteristics, "maxLimit", json_object_new_double(ShmOCPP20Data->NotifyReport.reportData[idxReport].variableCharacteristics.maxLimit));
|
|
|
json_object_object_add(variableCharacteristics, "supportsMonitoring", json_object_new_boolean(ShmOCPP20Data->NotifyReport.reportData[idxReport].variableCharacteristics.supportsMonitoring));
|
|
|
json_object_object_add(reportData, "variableCharacteristics",variableCharacteristics);
|
|
|
- DEBUG_INFO("+++++++++++++++++++-->VariableName: %s\n", ShmOCPP20Data->NotifyReport.reportData[idxReport].variable.name);
|
|
|
+
|
|
|
for(int idxAttr=0;idxAttr<ARRAY_SIZE(ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute);idxAttr++)
|
|
|
{
|
|
|
if(strlen((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].value) > 0)
|
|
@@ -9725,27 +9843,6 @@ int sendNotifyReportRequest()
|
|
|
|
|
|
json_object_array_add(variableAttributes, variableAttribute);
|
|
|
}
|
|
|
- /*else
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
- sprintf((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_WriteOnly]);
|
|
|
- sprintf((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].value, "%s", "0");
|
|
|
- json_object *variableAttribute = json_object_new_object();q1314qgrh
|
|
|
- //if(strlen((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].type)==0)
|
|
|
- DEBUG_INFO("AAAAAAAAAAAAAAAAA\n");
|
|
|
- json_object_object_add(variableAttribute, "type", json_object_new_string((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].type));
|
|
|
- DEBUG_INFO("BBBBBBBBBBBBBBBBBBB\n");
|
|
|
- json_object_object_add(variableAttribute, "value", json_object_new_string((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].value));
|
|
|
- DEBUG_INFO("CCCCCCCCCCCCCCCCCCCCC\n");
|
|
|
- json_object_object_add(variableAttribute, "mutability", json_object_new_string((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].mutability));
|
|
|
- DEBUG_INFO("DDDDDDDDDDDDDDDDDDDDDD\n");
|
|
|
- json_object_object_add(variableAttribute, "persistent", json_object_new_boolean(ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].persistent));
|
|
|
- DEBUG_INFO("EEEEEEEEEEEEEEEEEEE\n");
|
|
|
- json_object_object_add(variableAttribute, "constant", json_object_new_boolean(ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].constant));
|
|
|
- DEBUG_INFO("FFFFFFFFFFFFFFFFFFF\n");
|
|
|
- json_object_array_add(variableAttributes, variableAttribute);
|
|
|
- DEBUG_INFO("GGGGGGGGGGGGGGGGGGGGG\n");
|
|
|
- }*/
|
|
|
}
|
|
|
json_object_object_add(reportData, "variableAttribute", variableAttributes);
|
|
|
|
|
@@ -14789,6 +14886,12 @@ void* GetLogProcess(void* data)
|
|
|
}while((targetYear < (tmNow->tm_year+1900)) ||
|
|
|
((targetYear <= (tmNow->tm_year+1900)) && (targetMonth <= (tmNow->tm_mon+1))));
|
|
|
|
|
|
+ if(isCancelUploadLog)
|
|
|
+ {
|
|
|
+ isCancelUploadLog = FALSE;
|
|
|
+ pthread_exit(NULL);
|
|
|
+ }
|
|
|
+
|
|
|
sprintf(cmdBuf, "%s /Storage/ChargeLog/*.db", cmdBuf);
|
|
|
sprintf(cmdBuf, "%s /Storage/EventLog/*.db", cmdBuf);
|
|
|
system(cmdBuf);
|
|
@@ -14869,6 +14972,12 @@ void* GetLogProcess(void* data)
|
|
|
|
|
|
do
|
|
|
{
|
|
|
+ if(isCancelUploadLog)
|
|
|
+ {
|
|
|
+ isCancelUploadLog = FALSE;
|
|
|
+ ShmOCPP20Data->SpMsg.bits.LogStatusNotificationReq = OFF;
|
|
|
+ pthread_exit(NULL);
|
|
|
+ }
|
|
|
sprintf((char*)ShmOCPP20Data->LogStatusNotification.status, "%s", UploadLogStatusEnumTypeStr[UploadLogStatusEnumType_Uploading]);
|
|
|
ShmOCPP20Data->SpMsg.bits.LogStatusNotificationReq = ON;
|
|
|
sleep(3);
|
|
@@ -14923,6 +15032,12 @@ void* GetLogProcess(void* data)
|
|
|
|
|
|
do
|
|
|
{
|
|
|
+ if(isCancelUploadLog)
|
|
|
+ {
|
|
|
+ isCancelUploadLog = FALSE;
|
|
|
+ ShmOCPP20Data->SpMsg.bits.LogStatusNotificationReq = OFF;
|
|
|
+ pthread_exit(NULL);
|
|
|
+ }
|
|
|
sprintf((char*)ShmOCPP20Data->LogStatusNotification.status, "%s", UploadLogStatusEnumTypeStr[UploadLogStatusEnumType_Uploading]);
|
|
|
ShmOCPP20Data->SpMsg.bits.LogStatusNotificationReq = ON;
|
|
|
sleep(3);
|
|
@@ -14967,7 +15082,16 @@ int handleGetLogRequest(char *uuid, char *payload)
|
|
|
tm = localtime(&CurrentTime);
|
|
|
sprintf(fName ,"%s-%s-%04d%02d%02d%02d%02d%02d.zip", ShmSysConfigAndInfo->SysConfig.ModelName, ShmSysConfigAndInfo->SysConfig.SerialNumber, (tm->tm_year+1900), (tm->tm_mon+1),tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);
|
|
|
sprintf((char*)ShmOCPP20Data->GetLog.Response_filename, "%s", fName);
|
|
|
- sprintf((char*)ShmOCPP20Data->GetLog.Response_status, "%s", LogStatusEnumTypeStr[LogStatusEnumType_Accepted]);
|
|
|
+ if(interLock.isGetLogGoing)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP20Data->GetLog.Response_status, "%s", LogStatusEnumTypeStr[LogStatusEnumType_AcceptedCanceled]);
|
|
|
+ isCancelUploadLog = TRUE;
|
|
|
+ interLock.isGetLogGoing = OFF;
|
|
|
+ sleep(1);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ sprintf((char*)ShmOCPP20Data->GetLog.Response_status, "%s", LogStatusEnumTypeStr[LogStatusEnumType_Accepted]);
|
|
|
+
|
|
|
sendGetLogConfirmation(uuid);
|
|
|
|
|
|
|
|
@@ -14978,7 +15102,9 @@ int handleGetLogRequest(char *uuid, char *payload)
|
|
|
sleep(1);
|
|
|
}
|
|
|
else
|
|
|
+ {
|
|
|
DEBUG_WARN("Other GetDiagnostic request on going.\n");
|
|
|
+ }
|
|
|
|
|
|
return result;
|
|
|
}
|
|
@@ -18244,8 +18370,17 @@ int handleTriggerMessageRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
else if(strcmp((char*)ShmOCPP20Data->TriggerMessage.requestedMessage, MessageTriggerEnumTypeStr[MessageTriggerEnumType_BootNotification]) == 0 )
|
|
|
{
|
|
|
- if(DB_updateBootType(BootReasonEnumType_Triggered))
|
|
|
- server_sign = FALSE;
|
|
|
+ if(server_sign)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP20Data->TriggerMessage.Response_status, "%s",TriggerMessageStatusEnumTypeStr[TriggerMessageStatusEnumType_Rejected] );
|
|
|
+ sendTriggerMessageConfirmation(uuid);
|
|
|
+ return TRUE;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(DB_updateBootType(BootReasonEnumType_Triggered))
|
|
|
+ server_sign = FALSE;
|
|
|
+ }
|
|
|
}
|
|
|
else if(strcmp((char*)ShmOCPP20Data->TriggerMessage.requestedMessage, MessageTriggerEnumTypeStr[MessageTriggerEnumType_Heartbeat]) == 0 )
|
|
|
{
|