|
@@ -4448,7 +4448,7 @@ void CheckSystemValue(void)
|
|
|
}
|
|
|
|
|
|
// Sample period MeterValue
|
|
|
- if(((getDiffSecNow(clientTime.MeterValues[gun_index]) > ((atoi((const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValueSampleInterval].ItemData))>5?(atoi((const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValueSampleInterval].ItemData)- 1):5))))
|
|
|
+ if(((getDiffSecNow(clientTime.MeterValues[gun_index]) >= ((atoi((const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValueSampleInterval].ItemData))>5?(atoi((const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValueSampleInterval].ItemData)- 1):5))))
|
|
|
{
|
|
|
//check Transaction active
|
|
|
if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
|
|
@@ -11427,7 +11427,7 @@ int handleRemoteStartRequest(char *uuid, char *payload)
|
|
|
&& (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != SYS_MODE_PREPARE_FOR_EV ) //S_PREPARING_FOR_EV
|
|
|
&& (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != SYS_MODE_PREPARE_FOR_EVSE )) // S_PREPARING_FOR_EVSE
|
|
|
{
|
|
|
- DEBUG_WARN("CHAdeMO connector not allow start cause busy.\n.");
|
|
|
+ DEBUG_WARN("CHAdeMO connector not allow start cause busy.\n");
|
|
|
strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Rejected]);
|
|
|
goto end;
|
|
|
}
|
|
@@ -11473,7 +11473,7 @@ int handleRemoteStartRequest(char *uuid, char *payload)
|
|
|
&& (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != SYS_MODE_PREPARE_FOR_EV) //S_PREPARING_FOR_EV
|
|
|
&& (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != SYS_MODE_PREPARE_FOR_EVSE)) // S_PREPARING_FOR_EVSE
|
|
|
{
|
|
|
- DEBUG_WARN("CCS connector not allow start cause busy.\n.");
|
|
|
+ DEBUG_WARN("CCS connector not allow start cause busy.\n");
|
|
|
strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Rejected]);
|
|
|
goto end;
|
|
|
}
|
|
@@ -11520,7 +11520,7 @@ int handleRemoteStartRequest(char *uuid, char *payload)
|
|
|
&& (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != SYS_MODE_PREPARE_FOR_EV) //S_PREPARING_FOR_EV
|
|
|
&& (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != SYS_MODE_PREPARE_FOR_EVSE)) // S_PREPARING_FOR_EVSE
|
|
|
{
|
|
|
- DEBUG_WARN("GBT connector not allow start cause busy.\n.");
|
|
|
+ DEBUG_WARN("GBT connector not allow start cause busy.\n");
|
|
|
strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Rejected]);
|
|
|
goto end;
|
|
|
}
|
|
@@ -11561,7 +11561,7 @@ int handleRemoteStartRequest(char *uuid, char *payload)
|
|
|
&& (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus != SYS_MODE_PREPARE_FOR_EV) //S_PREPARING_FOR_EV
|
|
|
&& (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus != SYS_MODE_PREPARE_FOR_EVSE)) // S_PREPARING_FOR_EVSE
|
|
|
{
|
|
|
- DEBUG_WARN("Dispenser connector not allow start cause busy.\n.");
|
|
|
+ DEBUG_WARN("Dispenser connector not allow start cause busy.\n");
|
|
|
strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Rejected]);
|
|
|
goto end;
|
|
|
}
|
|
@@ -11610,7 +11610,7 @@ int handleRemoteStartRequest(char *uuid, char *payload)
|
|
|
&& (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != SYS_MODE_PREPARE_FOR_EV) //S_PREPARING_FOR_EV
|
|
|
&& (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != SYS_MODE_PREPARE_FOR_EVSE)) // S_PREPARING_FOR_EVSE
|
|
|
{
|
|
|
- DEBUG_WARN("AC connector not allow start cause busy.\n.");
|
|
|
+ DEBUG_WARN("AC connector not allow start cause busy.\n");
|
|
|
strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Rejected]);
|
|
|
goto end;
|
|
|
}
|
|
@@ -11635,7 +11635,7 @@ int handleRemoteStartRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- DEBUG_WARN("Profile purpose not TxProfile.\n.");
|
|
|
+ DEBUG_WARN("Profile purpose not TxProfile.\n");
|
|
|
strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Rejected]);
|
|
|
goto end;
|
|
|
}
|
|
@@ -11653,31 +11653,49 @@ int handleRemoteStartRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- DEBUG_WARN("Start wait connector link to EV in %s seconds.\n.", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData);
|
|
|
-
|
|
|
- if(ShmOCPP16DataPH->RemoteStartTransaction[0].ChargingProfile.ChargingProfileId > -1)
|
|
|
+ uint8_t isHasIdleConnector = FALSE;
|
|
|
+ for(uint8_t gun_index=0;gun_index<gunTotalNumber;gun_index++)
|
|
|
{
|
|
|
- if(strcmp((char*)ShmOCPP16DataPH->RemoteStartTransaction[0].ChargingProfile.ChargingProfilePurpose, ChargingProfilePurposeTypeStr[TxProfile]) == 0)
|
|
|
+ if(!cpinitateMsg.bits[gun_index].isOnCharging)
|
|
|
{
|
|
|
- // Save profile to file
|
|
|
- sprintf(cmdBuf, "rm -f /Storage/OCPP_PH/TxProfile_Tmp.json");
|
|
|
- system(cmdBuf);
|
|
|
-
|
|
|
- sprintf(cmdBuf, "/Storage/OCPP_PH/TxProfile_Tmp.json");
|
|
|
- fp = fopen(cmdBuf, "w");
|
|
|
- fprintf(fp, "{\"connectorId\":0,\"csChargingProfiles\":%s}\n", json_object_to_json_string_ext(json_object_object_get(RemoteStartTransaction, "chargingProfile"), JSON_C_TO_STRING_PLAIN));
|
|
|
- fclose(fp);
|
|
|
-
|
|
|
- refreshStartTimer(&clientTime.RemoteStartWait);
|
|
|
- ShmOCPP16DataPH->MsMsg.bits.isRemoteStartWaitReq = 1;
|
|
|
- strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Accepted]);
|
|
|
+ isHasIdleConnector = TRUE;
|
|
|
+ break;
|
|
|
}
|
|
|
- else
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isHasIdleConnector == TRUE)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("Start wait connector link to EV in %s seconds.\n", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData);
|
|
|
+
|
|
|
+ if(ShmOCPP16DataPH->RemoteStartTransaction[0].ChargingProfile.ChargingProfileId > -1)
|
|
|
{
|
|
|
- DEBUG_WARN("Profile purpose not TxProfile.\n.");
|
|
|
- strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Rejected]);
|
|
|
+ if(strcmp((char*)ShmOCPP16DataPH->RemoteStartTransaction[0].ChargingProfile.ChargingProfilePurpose, ChargingProfilePurposeTypeStr[TxProfile]) == 0)
|
|
|
+ {
|
|
|
+ // Save profile to file
|
|
|
+ sprintf(cmdBuf, "rm -f /Storage/OCPP_PH/TxProfile_Tmp.json");
|
|
|
+ system(cmdBuf);
|
|
|
+
|
|
|
+ sprintf(cmdBuf, "/Storage/OCPP_PH/TxProfile_Tmp.json");
|
|
|
+ fp = fopen(cmdBuf, "w");
|
|
|
+ fprintf(fp, "{\"connectorId\":0,\"csChargingProfiles\":%s}\n", json_object_to_json_string_ext(json_object_object_get(RemoteStartTransaction, "chargingProfile"), JSON_C_TO_STRING_PLAIN));
|
|
|
+ fclose(fp);
|
|
|
+
|
|
|
+ refreshStartTimer(&clientTime.RemoteStartWait);
|
|
|
+ ShmOCPP16DataPH->MsMsg.bits.isRemoteStartWaitReq = 1;
|
|
|
+ strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Accepted]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DEBUG_WARN("Profile purpose not TxProfile.\n");
|
|
|
+ strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Rejected]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DEBUG_INFO("There is not any connector is idle.\n");
|
|
|
+ strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Rejected]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -14340,6 +14358,7 @@ void handleMeterValuesResponse(char *payload, int gun_index)
|
|
|
{
|
|
|
mtrace();
|
|
|
DEBUG_INFO("handleMeterValuesResponse...\n");
|
|
|
+ isQueueSendable = 1;
|
|
|
}
|
|
|
|
|
|
void handleStartTransactionResponse(char *payload, int gun_index)
|
|
@@ -14369,6 +14388,7 @@ void handleStartTransactionResponse(char *payload, int gun_index)
|
|
|
}
|
|
|
json_object_put(StartTransaction);
|
|
|
|
|
|
+ isQueueSendable = 1;
|
|
|
ShmOCPP16DataPH->CpMsg.bits[gun_index].StartTransactionConf = 1;
|
|
|
ShmOCPP16DataPH->CpMsg.bits[gun_index].StartTransactionReq = 0;
|
|
|
|
|
@@ -14441,7 +14461,7 @@ void handleStopTransactionnResponse(char *payload, int gun_index)
|
|
|
}
|
|
|
json_object_put(StopTransaction);
|
|
|
|
|
|
-
|
|
|
+ isQueueSendable = 1;
|
|
|
ShmOCPP16DataPH->CpMsg.bits[gun_index].StopTransactionConf = 1;
|
|
|
ShmOCPP16DataPH->CpMsg.bits[gun_index].StopTransactionReq = 0;
|
|
|
|