|
@@ -6699,7 +6699,7 @@ void CheckSystemValue(void)
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
|
|
|
|
|
|
if((SystemInitial == 0) &&
|
|
|
- (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_PREPARING) &&
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
|
|
|
(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
{
|
|
|
ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
@@ -6753,7 +6753,7 @@ void CheckSystemValue(void)
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
|
|
|
|
|
|
if((SystemInitial == 0) &&
|
|
|
- (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus >= SYS_MODE_PREPARING) &&
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
|
|
|
(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
{
|
|
|
ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
@@ -6806,7 +6806,7 @@ void CheckSystemValue(void)
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
|
|
|
|
|
|
if((SystemInitial == 0) &&
|
|
|
- (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus >= SYS_MODE_PREPARING) &&
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
|
|
|
(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
{
|
|
|
ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
@@ -6852,7 +6852,7 @@ void CheckSystemValue(void)
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
|
|
|
|
|
|
if((SystemInitial == 0) &&
|
|
|
- (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus >= SYS_MODE_PREPARING) &&
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus >= SYS_MODE_CHARGING) &&
|
|
|
(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
{
|
|
|
ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
@@ -6904,7 +6904,7 @@ void CheckSystemValue(void)
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
|
|
|
|
|
|
if((SystemInitial == 0) &&
|
|
|
- (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus >= SYS_MODE_PREPARING) &&
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
|
|
|
(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
{
|
|
|
ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
|
|
@@ -9984,10 +9984,6 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
|
|
|
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]);
|
|
|
|
|
@@ -10100,10 +10096,6 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
|
|
|
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]);
|
|
|
|
|
@@ -10215,10 +10207,6 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.GbChargingData[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]);
|
|
|
|
|
@@ -10323,10 +10311,6 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.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]);
|
|
|
|
|
@@ -10437,10 +10421,6 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_IDLE) //SYS_MODE_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]);
|
|
|
|
|
@@ -10546,7 +10526,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
if(ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.timeSpentCharging > 0)
|
|
|
json_object_object_add(transactionInfo, "timeSpentCharging", json_object_new_int(ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.timeSpentCharging));
|
|
|
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason) > 0)
|
|
|
+ if((strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason) > 0) && (strstr((char*)ShmOCPP20Data->TransactionEvent[gun_index].eventType, TransactionEventEnumTypeStr[TransactionEventEnumType_Ended]) != NULL))
|
|
|
json_object_object_add(transactionInfo, "stoppedReason", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason));
|
|
|
|
|
|
if(ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.remoteStartId > 0)
|
|
@@ -10637,6 +10617,9 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
{
|
|
|
OCPP_insert_transaction_msg(NO, message);
|
|
|
memset(&ShmOCPP20Data->SessionTarget[gun_index], 0x00, sizeof(struct StructSessionTarget));
|
|
|
+ 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));
|
|
|
}
|
|
|
|
|
|
return result;
|
|
@@ -16997,9 +16980,6 @@ int handleSetVariablesRequest(char *uuid, char *payload)
|
|
|
(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variable.name, (char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name) != NULL) &&
|
|
|
(strlen((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.instance)>0?(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variable.instance, (char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.instance) != NULL):TRUE))
|
|
|
{
|
|
|
- strcpy((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value, (char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue);
|
|
|
- DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[idx_var]);
|
|
|
-
|
|
|
|
|
|
if(((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "OCPPCommCtrlr") != NULL)) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "NetworkConfigurationPriority") != NULL))
|
|
|
{
|
|
@@ -17008,9 +16988,20 @@ int handleSetVariablesRequest(char *uuid, char *payload)
|
|
|
else
|
|
|
strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Accepted]);
|
|
|
|
|
|
+ if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "OCPPCommCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "WebSocketPingInterval") != NULL))
|
|
|
+ {
|
|
|
+ if((0 < atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value)) && (atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value) < 10) )
|
|
|
+ strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_OutOfRange]);
|
|
|
+ }
|
|
|
+
|
|
|
if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "OCPPCommCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "HeartbeatInterval") != NULL))
|
|
|
{
|
|
|
- HeartBeatWaitTime = (atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value)<5) ? 5 : atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value);
|
|
|
+ if((atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value) < (int)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit) )
|
|
|
+ {
|
|
|
+ strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_OutOfRange]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ HeartBeatWaitTime = atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value);
|
|
|
}
|
|
|
|
|
|
if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "SecurityCtrlr") != NULL) &&
|
|
@@ -17022,12 +17013,18 @@ int handleSetVariablesRequest(char *uuid, char *payload)
|
|
|
|
|
|
if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "AlignedDataCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "Interval") != NULL))
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value, "%d", (atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value)<ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit) ? (int)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit : atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value));
|
|
|
+ if((0 < atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value)) && (atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value) < (int)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit) )
|
|
|
+ {
|
|
|
+ strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_OutOfRange]);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "SampledDataCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "TxUpdatedInterval") != NULL))
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value, "%d", (atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value)<ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit) ? (int)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit : atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value));
|
|
|
+ if((0 < atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value)) && (atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value) < (int)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit) )
|
|
|
+ {
|
|
|
+ strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_OutOfRange]);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "ChargingStation") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "FreeVend") != NULL))
|
|
@@ -17040,6 +17037,14 @@ int handleSetVariablesRequest(char *uuid, char *payload)
|
|
|
ShmSysConfigAndInfo->SysConfig.AuthorisationMode =((strstr((char*)tmp, "true") != NULL)? 1 : 0);
|
|
|
StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ if((strstr((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Accepted]) != NULL) ||
|
|
|
+ (strstr((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_RebootRequired]) != NULL))
|
|
|
+ {
|
|
|
+ strcpy((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value, (char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue);
|
|
|
+ DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[idx_var]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|