Skip to content

Commit

Permalink
fix: correct declaration and reformat
Browse files Browse the repository at this point in the history
Signed-off-by: Xin Xu <[email protected]>
  • Loading branch information
shingoxx222 committed Nov 13, 2024
1 parent 09b548e commit e8dfc99
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
1 change: 0 additions & 1 deletion include/ocpp/v201/charge_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,6 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa
/// If \param persist is set to true, the change will be persisted across a reboot
void execute_change_availability_request(ChangeAvailabilityRequest request, bool persist);


/// \brief Helper function to determine if a certificate installation should be rejected
/// \param cert_type is the certificate type to be checked
/// \return true if it should be rejected
Expand Down
38 changes: 20 additions & 18 deletions lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3588,25 +3588,27 @@ void ChargePoint::handle_get_installed_certificate_ids_req(Call<GetInstalledCert
this->send<GetInstalledCertificateIdsResponse>(call_result);
}

void ChargePoint::should_reject_certificate_install(InstallCertificateUseEnum cert_type) const {
const int security_profile = this->device_model->get_value<int>(ControllerComponentVariables::SecurityProfile);

if (security_profile > 1) {
return false;
}
switch (cert_type) {
case InstallCertificateUseEnum::CSMSRootCertificate:
return !this->device_model
.get_optional_value<bool>(ControllerComponentVariables::AllowCSMSRootCertificateInstallWhenLowSecurityProfile)
bool ChargePoint::should_reject_certificate_install(InstallCertificateUseEnum cert_type) const {
const int security_profile = this->device_model->get_value<int>(ControllerComponentVariables::SecurityProfile);

if (security_profile > 1) {
return false;
}
switch (cert_type) {
case InstallCertificateUseEnum::CSMSRootCertificate:
return !this->device_model
.get_optional_value<bool>(
ControllerComponentVariables::AllowCSMSRootCertificateInstallWhenLowSecurityProfile)
.value_or(true);

case InstallCertificateUseEnum::ManufacturerRootCertificate:
return !this->device_model
.get_optional_value<bool>(ControllerComponentVariables::AllowManufacturerRootCertificateInstallWhenLowSecurityProfile)
.value_or(true);
default:
return false;
}

case InstallCertificateUseEnum::ManufacturerRootCertificate:
return !this->device_model
.get_optional_value<bool>(
ControllerComponentVariables::AllowManufacturerRootCertificateInstallWhenLowSecurityProfile)
.value_or(true);
default:
return false;
}
}

void ChargePoint::handle_install_certificate_req(Call<InstallCertificateRequest> call) {
Expand Down

0 comments on commit e8dfc99

Please sign in to comment.