|
@@ -553,6 +553,28 @@ uint16_t ocpp_get_connection_timeout()
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+uint16_t ocpp_get_authorize_timeout()
|
|
|
+{
|
|
|
+ uint16_t result = TIMEOUT_SPEC_AUTH;
|
|
|
+
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
+ {
|
|
|
+ if(strcmp((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData,"") != 0)
|
|
|
+ {
|
|
|
+ result = atoi((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
+ {
|
|
|
+ if(strcmp((char *)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_AuthorizeTimeout].variableAttribute[0].value,"") != 0)
|
|
|
+ {
|
|
|
+ result = atoi((char *)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_AuthorizeTimeout].variableAttribute[0].value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
uint8_t ocpp_get_update_firmware_req()
|
|
|
{
|
|
|
uint8_t result = NO;
|
|
@@ -3239,7 +3261,7 @@ int Initialization(uint8_t gun_index)
|
|
|
|
|
|
ShmCharger->gun_info[gun_index].isOperactive = DB_Get_Operactive(localDb, gun_index);
|
|
|
ShmCharger->gun_info[gun_index].Ptb_Meter_Parameters.PtbMeterPermissionStatus = DB_Get_Meter_Permission(localDb, gun_index);
|
|
|
-
|
|
|
+
|
|
|
// Check is ccs Enable/Disable to open ccs power.
|
|
|
if(ShmCharger->isCcsEnable == ON)
|
|
|
{
|
|
@@ -4638,23 +4660,93 @@ void checkConnectionTimeout()
|
|
|
{
|
|
|
if((system("pidof -s OcppBackend > /dev/null") != 0) && (system("pidof -s OcppBackend20 > /dev/null") != 0))
|
|
|
{
|
|
|
- ShmCharger->timeoutSpec.Present_Timeout_Spec = TIMEOUT_SPEC_HANDSHAKING;
|
|
|
- //DEBUG_INFO("Handshaking timeout specification follow by initial setting : %d s \n", TIMEOUT_SPEC_HANDSHAKING);
|
|
|
+ if(ShmCharger->timeoutSpec.Present_Timeout_Spec != TIMEOUT_SPEC_HANDSHAKING)
|
|
|
+ {
|
|
|
+ ShmCharger->timeoutSpec.Present_Timeout_Spec = TIMEOUT_SPEC_HANDSHAKING;
|
|
|
+ DEBUG_INFO("[ConnectionTimeOut] Configuration by default: [%d] \n", ShmCharger->timeoutSpec.Present_Timeout_Spec);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(ShmCharger->timeoutSpec.Setting_Timeout_Spec != ocpp_get_connection_timeout())
|
|
|
+ {
|
|
|
+ ShmCharger->timeoutSpec.Setting_Timeout_Spec = ocpp_get_connection_timeout();
|
|
|
+ DEBUG_INFO("[ConnectionTimeOut] Receive timeout specification: [%d] \n", ShmCharger->timeoutSpec.Setting_Timeout_Spec);
|
|
|
+
|
|
|
+ if(ShmCharger->timeoutSpec.Setting_Timeout_Spec >= (TIMEOUT_SPEC_BS_HLC_HANDSHAKE+10))
|
|
|
+ {
|
|
|
+ DEBUG_INFO("[ConnectionTimeOut] Valid value: [%d] \n", ShmCharger->timeoutSpec.Setting_Timeout_Spec);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DEBUG_INFO("[ConnectionTimeOut] Invalid value: [%d] \n", ShmCharger->timeoutSpec.Setting_Timeout_Spec);
|
|
|
+ DEBUG_INFO("[ConnectionTimeOut] Present timeout specification: [%d] \n", ShmCharger->timeoutSpec.Present_Timeout_Spec);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ShmCharger->timeoutSpec.Setting_Timeout_Spec >= (TIMEOUT_SPEC_BS_HLC_HANDSHAKE+10))
|
|
|
+ {
|
|
|
+ if(ShmCharger->timeoutSpec.Setting_Timeout_Spec != ShmCharger->timeoutSpec.Present_Timeout_Spec)
|
|
|
+ {
|
|
|
+ ShmCharger->timeoutSpec.Present_Timeout_Spec = ShmCharger->timeoutSpec.Setting_Timeout_Spec;
|
|
|
+ DEBUG_INFO("[ConnectionTimeOut] Configuration by OCPP: [%d] \n", ShmCharger->timeoutSpec.Present_Timeout_Spec);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(ShmCharger->timeoutSpec.Present_Timeout_Spec != TIMEOUT_SPEC_HANDSHAKING)
|
|
|
+ {
|
|
|
+ ShmCharger->timeoutSpec.Present_Timeout_Spec = TIMEOUT_SPEC_HANDSHAKING;
|
|
|
+ DEBUG_INFO("[ConnectionTimeOut] Configuration by default: [%d] \n", ShmCharger->timeoutSpec.Present_Timeout_Spec);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void checkAuthorizeTimeout()
|
|
|
+{
|
|
|
+ if((system("pidof -s OcppBackend > /dev/null") != 0) && (system("pidof -s OcppBackend20 > /dev/null") != 0))
|
|
|
+ {
|
|
|
+ if(ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec != TIMEOUT_SPEC_AUTH)
|
|
|
+ {
|
|
|
+ ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec = TIMEOUT_SPEC_AUTH;
|
|
|
+ DEBUG_INFO("[AuthorizeTimeout] Configuration by default: [%d] \n", ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ShmCharger->timeoutSpec.Setting_Timeout_Spec = ocpp_get_connection_timeout();
|
|
|
- if((ShmCharger->timeoutSpec.Setting_Timeout_Spec) < TIMEOUT_SPEC_BS_HLC_HANDSHAKE)
|
|
|
+ if(ShmCharger->timeoutSpec.Setting_Authorize_Timeout_Spec != ocpp_get_authorize_timeout())
|
|
|
+ {
|
|
|
+ ShmCharger->timeoutSpec.Setting_Authorize_Timeout_Spec = ocpp_get_authorize_timeout();
|
|
|
+ DEBUG_INFO("[AuthorizeTimeout] Receive timeout specification: [%d] \n", ShmCharger->timeoutSpec.Setting_Authorize_Timeout_Spec);
|
|
|
+
|
|
|
+ if((ShmCharger->timeoutSpec.Setting_Authorize_Timeout_Spec >= 10) && (ShmCharger->timeoutSpec.Setting_Authorize_Timeout_Spec <= 300))
|
|
|
+ {
|
|
|
+ DEBUG_INFO("[AuthorizeTimeout] Valid value: [%d] \n", ShmCharger->timeoutSpec.Setting_Authorize_Timeout_Spec);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DEBUG_INFO("[AuthorizeTimeout] Invalid value: [%d] \n", ShmCharger->timeoutSpec.Setting_Authorize_Timeout_Spec);
|
|
|
+ DEBUG_INFO("[AuthorizeTimeout] Present timeout specification: [%d] \n", ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if((ShmCharger->timeoutSpec.Setting_Authorize_Timeout_Spec >= 10) && (ShmCharger->timeoutSpec.Setting_Authorize_Timeout_Spec <= 300))
|
|
|
{
|
|
|
- ShmCharger->timeoutSpec.Present_Timeout_Spec = (TIMEOUT_SPEC_BS_HLC_HANDSHAKE+10);
|
|
|
- //DEBUG_INFO("Handshaking timeout specification follow by OCPP Configuration : Fail. Value can't be zero or less than zero.\n.");
|
|
|
+ if(ShmCharger->timeoutSpec.Setting_Authorize_Timeout_Spec != ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec)
|
|
|
+ {
|
|
|
+ ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec = ShmCharger->timeoutSpec.Setting_Authorize_Timeout_Spec;
|
|
|
+ DEBUG_INFO("[AuthorizeTimeout] Configuration by OCPP: [%d] \n", ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ShmCharger->timeoutSpec.Present_Timeout_Spec = ShmCharger->timeoutSpec.Setting_Timeout_Spec;
|
|
|
- //DEBUG_INFO("Handshaking timeout specification follow by OCPP Configuration : Pass...\n.");
|
|
|
+ if(ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec != TIMEOUT_SPEC_AUTH)
|
|
|
+ {
|
|
|
+ ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec = TIMEOUT_SPEC_AUTH;
|
|
|
+ DEBUG_INFO("[AuthorizeTimeout] Configuration by default: [%d] \n", ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec);
|
|
|
+ }
|
|
|
}
|
|
|
- //DEBUG_INFO("Handshaking timeout specification follow by OCPP Configuration : %s s \n.",ShmOCPP16Data->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -5392,12 +5484,12 @@ void checkHandshakeCountdown(uint8_t gun_index)
|
|
|
if(ShmCharger->gun_info[ShmCharger->gun_selectd].isHandshakeTimerRefresh == YES)
|
|
|
refreshStartTimer(&startTime[0][TMR_IDX_GUN_DETECT]);
|
|
|
else
|
|
|
- ShmCharger->timeoutSpec.Handshake_Timeout = ((ocpp_get_connection_timeout()) - (getDiffSecNow(startTime[0][TMR_IDX_GUN_DETECT])));
|
|
|
+ ShmCharger->timeoutSpec.Handshake_Timeout = (ShmCharger->timeoutSpec.Present_Timeout_Spec - (getDiffSecNow(startTime[0][TMR_IDX_GUN_DETECT])));
|
|
|
|
|
|
if(!ShmCharger->isAuthrizing)
|
|
|
{
|
|
|
if(ocpp_get_isRemoteStartWait())
|
|
|
- ShmCharger->timeoutSpec.Handshake_Timeout = ((ocpp_get_connection_timeout()) - (getDiffSecNow(startTime[0][TMR_IDX_GUN_DETECT])));
|
|
|
+ ShmCharger->timeoutSpec.Handshake_Timeout = (ShmCharger->timeoutSpec.Present_Timeout_Spec - (getDiffSecNow(startTime[0][TMR_IDX_GUN_DETECT])));
|
|
|
else
|
|
|
refreshStartTimer(&startTime[0][TMR_IDX_GUN_DETECT]);
|
|
|
}
|
|
@@ -5408,7 +5500,7 @@ void checkHandshakeCountdown(uint8_t gun_index)
|
|
|
if(ShmCharger->gun_info[ShmCharger->gun_selectd].isHandshakeTimerRefresh == YES)
|
|
|
refreshStartTimer(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
|
|
|
else
|
|
|
- ShmCharger->timeoutSpec.Handshake_Timeout = ((ocpp_get_connection_timeout()) - getDiffSecNow(startTime[gun_index][TMR_IDX_HANDSHAKING]));
|
|
|
+ ShmCharger->timeoutSpec.Handshake_Timeout = (ShmCharger->timeoutSpec.Present_Timeout_Spec - getDiffSecNow(startTime[gun_index][TMR_IDX_HANDSHAKING]));
|
|
|
|
|
|
break;
|
|
|
case SYS_MODE_RESERVATION:
|
|
@@ -5416,7 +5508,7 @@ void checkHandshakeCountdown(uint8_t gun_index)
|
|
|
if(ShmCharger->gun_info[ShmCharger->gun_selectd].isHandshakeTimerRefresh == YES)
|
|
|
refreshStartTimer(&startTime[0][TMR_IDX_GUN_DETECT]);
|
|
|
else
|
|
|
- ShmCharger->timeoutSpec.Handshake_Timeout = ((ocpp_get_connection_timeout()) - (getDiffSecNow(startTime[0][TMR_IDX_GUN_DETECT])));
|
|
|
+ ShmCharger->timeoutSpec.Handshake_Timeout = (ShmCharger->timeoutSpec.Present_Timeout_Spec - (getDiffSecNow(startTime[0][TMR_IDX_GUN_DETECT])));
|
|
|
|
|
|
break;
|
|
|
}
|
|
@@ -5526,7 +5618,7 @@ void checkRfidAuthrize()
|
|
|
else
|
|
|
{
|
|
|
// Wait authorize result
|
|
|
- if(!ocpp_get_auth_conf() && (getDiffSecNow(startTime[0][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH))
|
|
|
+ if(!ocpp_get_auth_conf() && (getDiffSecNow(startTime[0][TMR_IDX_AUTH]) > ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec))
|
|
|
{
|
|
|
// Authorization timeout process.
|
|
|
DEBUG_WARN("Authorize timeout !!!\n");
|
|
@@ -5603,7 +5695,7 @@ void checkRfidAuthrize()
|
|
|
for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
|
|
|
checkHandshakeCountdown(gun_index);
|
|
|
|
|
|
- if((getDiffSecNow(startTime[0][TMR_IDX_GUN_DETECT]) < (ocpp_get_connection_timeout())) && (isStartByWrongReservation != YES))
|
|
|
+ if((getDiffSecNow(startTime[0][TMR_IDX_GUN_DETECT]) < ShmCharger->timeoutSpec.Present_Timeout_Spec) && (isStartByWrongReservation != YES))
|
|
|
{
|
|
|
if(GetCardSerialNumber() != FAIL)
|
|
|
{
|
|
@@ -5793,7 +5885,7 @@ void processEndOfChargingForPtbMeter(uint8_t gun_index)
|
|
|
if((getDiffSecNow(startTime[gun_index][TMR_IDX_PTB_METER_MESSAGE]) >= 6) && (getDiffSecNow(startTime[gun_index][TMR_IDX_PTB_METER_MESSAGE]) <= 9))
|
|
|
{
|
|
|
ShmCharger->gun_info[gun_index].isGetPtbMeterMessage = ON;
|
|
|
-
|
|
|
+
|
|
|
// After 6 seconds Relay off & PWM off (specifcation)
|
|
|
setRelay(gun_index, OFF);
|
|
|
setRequest(gun_index, OFF);
|
|
@@ -5967,12 +6059,16 @@ int main(void)
|
|
|
// Check task processing
|
|
|
//==============================================
|
|
|
if(ShmSysConfigAndInfo->SysInfo.AcChargingData[0].SystemStatus != SYS_MODE_BOOTING)
|
|
|
+ {
|
|
|
+ // Check task processing
|
|
|
checkTask();
|
|
|
|
|
|
- //==============================================
|
|
|
- // Check connection timeout specification
|
|
|
- //==============================================
|
|
|
- checkConnectionTimeout();
|
|
|
+ // Check connection timeout specification
|
|
|
+ checkConnectionTimeout();
|
|
|
+
|
|
|
+ // Check authorize timeout specification
|
|
|
+ checkAuthorizeTimeout();
|
|
|
+ }
|
|
|
|
|
|
refreshStartTimer(&startTime[0][TMR_IDX_CHECK_TASK]);
|
|
|
}
|
|
@@ -6407,7 +6503,7 @@ int main(void)
|
|
|
{
|
|
|
ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = ON;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// Firmware version
|
|
|
get_firmware_version(gun_index);
|
|
|
|
|
@@ -6525,7 +6621,7 @@ int main(void)
|
|
|
(ShmSysConfigAndInfo->SysConfig.ModelName[2]=='W')
|
|
|
?3:1);
|
|
|
*/
|
|
|
-
|
|
|
+
|
|
|
if((ShmSysConfigAndInfo->SysConfig.ModelName[2]=='Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='D') || (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='W'))
|
|
|
{
|
|
|
// The dip switch 1: one phase 0: three phases
|
|
@@ -6818,7 +6914,7 @@ int main(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(getDiffSecNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH)
|
|
|
+ if(getDiffSecNow(startTime[gun_index][TMR_IDX_AUTH]) > ShmCharger->timeoutSpec.Present_Authorize_Timeout_Spec)
|
|
|
{
|
|
|
// Authorization timeout process.
|
|
|
setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
|