|
@@ -975,49 +975,29 @@ uint8_t ocpp_get_auth_result(uint8_t isValidParent, ...)
|
|
|
case SYS_MODE_AUTHORIZING:
|
|
|
if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
{
|
|
|
- if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0))
|
|
|
+ if(((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId == -1) && (strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0)) ||
|
|
|
+ ((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId != -1) && ((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) && (strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag, (char*)ShmOCPP16Data->ReserveNow[gun_index].ParentIdTag)==0))))
|
|
|
result = PASS;
|
|
|
}
|
|
|
else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
{
|
|
|
- if((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0))
|
|
|
+ if(((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId == -1) && (strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0)) ||
|
|
|
+ ((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId != -1) && ((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0) && (strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken, (char*)ShmOCPP20Data->ReserveNow[gun_index].groupIdToken.idToken)==0))))
|
|
|
result = PASS;
|
|
|
}
|
|
|
-
|
|
|
break;
|
|
|
- case SYS_MODE_CHARGING:
|
|
|
- case SYS_MODE_TERMINATING:
|
|
|
+ default:
|
|
|
if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
{
|
|
|
- /*
|
|
|
- DEBUG_INFO("==========================================\n");
|
|
|
- DEBUG_INFO("=== OCPP GETTING AUTHORIZE RESULT 1.6 ====\n");
|
|
|
- DEBUG_INFO("==========================================\n");
|
|
|
- DEBUG_INFO("Authorize.ResponseIdTagInfo.ParentIdTag : %s \n", ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag);
|
|
|
- DEBUG_INFO("StartTransaction[%d].ResponseIdTagInfo.ParentIdTag : %s \n", gun_index ,ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ParentIdTag);
|
|
|
- */
|
|
|
-
|
|
|
- if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) &&
|
|
|
- (strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag, (char*)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ParentIdTag)==0))
|
|
|
+ if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) && (strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag, (char*)ShmOCPP16Data->ReserveNow[gun_index].ParentIdTag)==0))
|
|
|
result = PASS;
|
|
|
}
|
|
|
else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
{
|
|
|
- /*
|
|
|
- DEBUG_INFO("==========================================\n");
|
|
|
- DEBUG_INFO("=== OCPP GETTING AUTHORIZE RESULT 2.0 ====\n");
|
|
|
- DEBUG_INFO("==========================================\n");
|
|
|
- DEBUG_INFO("Authorize.Response_idTokenInfo.groupIdToken.idToken : %s \n", ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken);
|
|
|
- DEBUG_INFO("TransactionEvent[%d].Response_idTokenInfo.groupIdToken.idToken : %s \n", gun_index, ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.groupIdToken.idToken);
|
|
|
- */
|
|
|
-
|
|
|
- if((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0) &&
|
|
|
- (strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken, (char*)ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.groupIdToken.idToken)==0))
|
|
|
+ if((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0) && (strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken, (char*)ShmOCPP20Data->ReserveNow[gun_index].groupIdToken.idToken)==0))
|
|
|
result = PASS;
|
|
|
}
|
|
|
|
|
|
- break;
|
|
|
- default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -5897,7 +5877,7 @@ int main(void)
|
|
|
{
|
|
|
if(ocpp_get_auth_conf())
|
|
|
{
|
|
|
- if(ocpp_get_auth_result(gun_index))
|
|
|
+ if(ocpp_get_auth_result(YES, gun_index))
|
|
|
{
|
|
|
memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
|
|
|
|
|
@@ -5912,7 +5892,10 @@ int main(void)
|
|
|
setSpeaker(ON, SPEAKER_INTERVAL_3COUNT);
|
|
|
setLedMotion(gun_index, LED_ACTION_RFID_FAIL);
|
|
|
sleep(3);
|
|
|
- setChargerMode(gun_index, SYS_MODE_IDLE);
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId == -1)
|
|
|
+ setChargerMode(gun_index, SYS_MODE_IDLE);
|
|
|
+ else
|
|
|
+ setChargerMode(gun_index, SYS_MODE_RESERVATION);
|
|
|
}
|
|
|
|
|
|
ocpp_set_auth_conf(OFF);
|
|
@@ -5928,7 +5911,7 @@ int main(void)
|
|
|
(!ocpp_get_connection_status() && ((ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE) || (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_NOCHARGE))) ||
|
|
|
(!ocpp_get_connection_status() && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST) && (getDiffSecNow(startTime[0][TMR_IDX_AUTH]) > 2)))
|
|
|
{
|
|
|
- if(ocpp_get_auth_result(gun_index) ||
|
|
|
+ if(ocpp_get_auth_result(YES, gun_index) ||
|
|
|
(!ocpp_get_connection_status() && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)) ||
|
|
|
(!ocpp_get_connection_status() && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)))
|
|
|
{
|
|
@@ -6654,7 +6637,8 @@ int main(void)
|
|
|
{
|
|
|
if((ShmCharger->gun_info[gun_index].rfidReq == ON))
|
|
|
{
|
|
|
- if(ocpp_compare_reserve_id_with_user(gun_index))
|
|
|
+ if(ocpp_compare_reserve_id_with_user(gun_index) ||
|
|
|
+ ocpp_get_auth_result(YES, gun_index))
|
|
|
{
|
|
|
DEBUG_INFO("Start Method in reservation : RFID...\n");
|
|
|
DEBUG_INFO("Start request User Id : %s\n", ShmSysConfigAndInfo->SysConfig.UserId);
|
|
@@ -6673,14 +6657,16 @@ int main(void)
|
|
|
}
|
|
|
else if(ocpp_get_remotestart(gun_index))
|
|
|
{
|
|
|
- if(ocpp_compare_reserve_id_with_remote_user(gun_index))
|
|
|
+ if(ocpp_compare_reserve_id_with_remote_user(gun_index) || ocpp_isAuthorizeRemoteStart())
|
|
|
{
|
|
|
DEBUG_INFO("Start Method in reservation: BACKEND...\n");
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_BACKEND;
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_Central;
|
|
|
+ if(ocpp_isAuthorizeRemoteStart())
|
|
|
+ ocpp_copy_userid_from_remotestart(gun_index);
|
|
|
setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
|
|
|
}
|
|
|
- ocpp_set_remotestop(gun_index, OFF);
|
|
|
+ ocpp_set_remotestart(gun_index, OFF);
|
|
|
}
|
|
|
}
|
|
|
}
|