|
@@ -812,13 +812,13 @@ uint8_t ocpp_get_auth_result(uint8_t isValidParent, ...)
|
|
|
{
|
|
|
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;
|
|
|
+ result = PASS;
|
|
|
}
|
|
|
else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
{
|
|
|
if(((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->ControllerComponentVariable[AuthCtrlr_MasterPassGroupId].variableAttribute[0].value) != 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;
|
|
|
+ result = PASS;
|
|
|
}
|
|
|
break;
|
|
|
case SYS_MODE_CHARGING:
|
|
@@ -827,28 +827,28 @@ uint8_t ocpp_get_auth_result(uint8_t isValidParent, ...)
|
|
|
{
|
|
|
if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) &&
|
|
|
(strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag, (char*)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ParentIdTag)==0))
|
|
|
- result = PASS;
|
|
|
+ result = PASS;
|
|
|
}
|
|
|
else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
{
|
|
|
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) ||
|
|
|
(strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken, (char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_MasterPassGroupId].variableAttribute[0].value) == 0)))
|
|
|
- result = PASS;
|
|
|
+ result = PASS;
|
|
|
}
|
|
|
break;
|
|
|
case SYS_MODE_RESERVATION:
|
|
|
if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
{
|
|
|
- if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==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;
|
|
|
+ result = PASS;
|
|
|
}
|
|
|
else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
{
|
|
|
- if((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==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;
|
|
|
+ result = PASS;
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -3392,7 +3392,6 @@ int upgrade_check()
|
|
|
int isMatchStartUser(unsigned char gun_index)
|
|
|
{
|
|
|
uint8_t tmpUser[32];
|
|
|
- uint8_t isPrintLogOut = OFF;
|
|
|
|
|
|
if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
|
|
|
{
|
|
@@ -3435,14 +3434,10 @@ int isMatchStartUser(unsigned char gun_index)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(isPrintLogOut == OFF)
|
|
|
- {
|
|
|
- DEBUG_INFO("==== isMatchStartUser ==== \n");
|
|
|
- DEBUG_INFO("tmpUser : %s \n", tmpUser);
|
|
|
- DEBUG_INFO("StartUserId : %s \n", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
|
|
|
- DEBUG_INFO("========================== \n");
|
|
|
- isPrintLogOut = ON;
|
|
|
- }
|
|
|
+ //DEBUG_INFO("==== isMatchStartUser ==== \n");
|
|
|
+ //DEBUG_INFO("tmpUser : %s \n", tmpUser);
|
|
|
+ //DEBUG_INFO("StartUserId : %s \n", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
|
|
|
+ //DEBUG_INFO("========================== \n");
|
|
|
|
|
|
return ((strcmp((char*)tmpUser, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId)==0)?YES:NO);
|
|
|
}
|
|
@@ -3450,7 +3445,6 @@ int isMatchStartUser(unsigned char gun_index)
|
|
|
int isMatchPresentUser()
|
|
|
{
|
|
|
uint8_t tmpUser[32];
|
|
|
- uint8_t isPrintLogOut = OFF;
|
|
|
|
|
|
if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
|
|
|
{
|
|
@@ -3493,14 +3487,10 @@ int isMatchPresentUser()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(isPrintLogOut == OFF)
|
|
|
- {
|
|
|
- DEBUG_INFO("==== isMatchPresentUser ==== \n");
|
|
|
- DEBUG_INFO("tmpUser : %s \n", tmpUser);
|
|
|
- DEBUG_INFO("UserId : %s \n", ShmSysConfigAndInfo->SysConfig.UserId);
|
|
|
- DEBUG_INFO("============================ \n");
|
|
|
- isPrintLogOut = ON;
|
|
|
- }
|
|
|
+ //DEBUG_INFO("==== isMatchPresentUser ==== \n");
|
|
|
+ //DEBUG_INFO("tmpUser : %s \n", tmpUser);
|
|
|
+ //DEBUG_INFO("UserId : %s \n", ShmSysConfigAndInfo->SysConfig.UserId);
|
|
|
+ //DEBUG_INFO("============================ \n");
|
|
|
|
|
|
return ((strcmp((char*)tmpUser, (char*)ShmSysConfigAndInfo->SysConfig.UserId)==0)?YES:NO);
|
|
|
}
|
|
@@ -5168,15 +5158,29 @@ void checkRfidAuthrize()
|
|
|
for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
|
|
|
{
|
|
|
if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_RESERVATION) &&
|
|
|
- (strcmp((char*)ShmSysConfigAndInfo->SysConfig.UserId, (char*)ShmOCPP16Data->ReserveNow[gun_index].IdTag) != 0))
|
|
|
+ (ocpp_compare_reserve_id_with_user(gun_index) != YES) &&
|
|
|
+ (ocpp_get_auth_result(YES, gun_index) != PASS))
|
|
|
{
|
|
|
- sleep(1);
|
|
|
- ShmCharger->gun_info[gun_index].resultAuthorization = UNVALIDATED_RFID;
|
|
|
isStartByWrongReservation = YES;
|
|
|
+ ShmCharger->gun_info[gun_index].resultAuthorization = UNVALIDATED_RFID;
|
|
|
|
|
|
- DEBUG_INFO("Not match: UserId = [%s] / Reserve IdTag = [%s] \n", ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP16Data->ReserveNow[ShmCharger->gun_selectd].IdTag);
|
|
|
+ DEBUG_INFO("================================================== \n");
|
|
|
+ DEBUG_INFO("UserId: [ %s ]\n", ShmSysConfigAndInfo->SysConfig.UserId);
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("Gun-%d IdTag: [ %s ]\n", gun_index, ShmOCPP16Data->ReserveNow[gun_index].IdTag);
|
|
|
+ DEBUG_INFO("Authorize response ParentIdTag: [ %s ]. \n", ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag);
|
|
|
+ DEBUG_INFO("Gun-%d Reserve ParentIdTag: [ %s ]. \n", gun_index, ShmOCPP16Data->ReserveNow[gun_index].ParentIdTag);
|
|
|
+ }
|
|
|
+ else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("Gun-%d idToken: [ %s ]\n", gun_index, ShmOCPP20Data->ReserveNow[gun_index].idToken.idToken);
|
|
|
+ DEBUG_INFO("Authorize response groupIdToken idToken: [ %s ]\n", ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken);
|
|
|
+ DEBUG_INFO("Gun-%d Reserve groupIdToken idToken: [ %s]\n", ShmOCPP20Data->ReserveNow[gun_index].groupIdToken.idToken);
|
|
|
+ }
|
|
|
+ DEBUG_INFO("================================================== \n");
|
|
|
DEBUG_INFO("Authorize fail.\n");
|
|
|
- setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
|
|
|
+ setSpeaker(ON, SPEAKER_INTERVAL_3COUNT);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -5246,7 +5250,7 @@ void checkRfidAuthrize()
|
|
|
if(isStartByWrongReservation != YES)
|
|
|
DEBUG_INFO("Connector action detect timeout.\n");
|
|
|
else
|
|
|
- DEBUG_INFO("User Id and reservation IdTag is not match. \n");
|
|
|
+ DEBUG_INFO("Start by wrong reservation user. \n");
|
|
|
|
|
|
ShmCharger->isAuthrizing = FALSE;
|
|
|
ShmCharger->isGetAuthResult = TRUE;
|
|
@@ -5492,7 +5496,8 @@ int main(void)
|
|
|
(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_MAINTAIN) ||
|
|
|
(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_CHARGING) ||
|
|
|
(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_TERMINATING) ||
|
|
|
- (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_COMPLETE))
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_COMPLETE) ||
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_RESERVATION))
|
|
|
{
|
|
|
refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
|
|
|
refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
|
|
@@ -6620,7 +6625,7 @@ int main(void)
|
|
|
// Unplug charging gun to Idle mode
|
|
|
if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A) && (ShmCharger->gun_info[gun_index].isGunPlugged == YES))
|
|
|
{
|
|
|
- DEBUG_INFO("The connector was connected to the EV before.\n");
|
|
|
+ DEBUG_INFO("Unplug the connector.\n");
|
|
|
//Cancel CCS task negotiating
|
|
|
ShmCharger->gun_info[gun_index].acCcsInfo.ChargingPermission = OFF;
|
|
|
ShmCharger->gun_info[gun_index].acCcsInfo.EVSENotification = NOTIFICATION_STOP;
|
|
@@ -7303,7 +7308,7 @@ int main(void)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- setLedMotion(gun_index,LED_ACTION_IDLE);
|
|
|
+ setLedMotion(gun_index,LED_ACTION_RESERVATION_MODE);
|
|
|
ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
|
|
|
DEBUG_INFO("It's not reserve user id.\n");
|
|
|
}
|
|
@@ -7312,7 +7317,8 @@ int main(void)
|
|
|
}
|
|
|
else if(ocpp_get_remotestart(gun_index))
|
|
|
{
|
|
|
- if(ocpp_compare_reserve_id_with_remote_user(gun_index) || ocpp_isAuthorizeRemoteStart())
|
|
|
+ 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;
|