Skip to content

Commit

Permalink
add/fix cp sign certificate behavior
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Klemm <[email protected]>
  • Loading branch information
klemmpnx committed Oct 31, 2023
1 parent bfe26d8 commit c2c2d71
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ void ChargePoint::handle_message(const EnhancedMessage<v201::MessageType>& messa
break;
case MessageType::TriggerMessage:
this->handle_trigger_message(json_message);
break;
case MessageType::SignCertificate:
this->handle_sign_certificate_response(json_message);
break;
Expand Down Expand Up @@ -1245,7 +1246,7 @@ void ChargePoint::sign_certificate_req(const ocpp::CertificateSigningUseEnum& ce
} else {
common =
this->device_model->get_optional_value<std::string>(ControllerComponentVariables::ChargeBoxSerialNumber);
this->device_model->get_optional_value<std::string>(
organization = this->device_model->get_optional_value<std::string>(
ControllerComponentVariables::ISO15118CtrlrOrganizationName);
country =
this->device_model->get_optional_value<std::string>(ControllerComponentVariables::ISO15118CtrlrCountryName);
Expand Down Expand Up @@ -1469,7 +1470,8 @@ void ChargePoint::handle_certificate_signed_req(Call<CertificateSignedRequest> c
this->send<CertificateSignedResponse>(call_result);

if (result != ocpp::InstallCertificateResult::Accepted) {
// TODO(piet): this->security_event_notification_req("InvalidChargingStationCertificate");
this->security_event_notification_req("InvalidChargingStationCertificate", std::optional<CiString<255>>{}, true,
true);
}

// reconnect with new certificate if valid and security profile is 3
Expand Down Expand Up @@ -2026,10 +2028,15 @@ void ChargePoint::handle_trigger_message(Call<TriggerMessageRequest> call) {
}
break;

case MessageTriggerEnum::SignChargingStationCertificate:
EVLOG_info << "got SignChargingStationCertificate";
response.status = TriggerMessageStatusEnum::Accepted;
break;
case MessageTriggerEnum::SignV2GCertificate:
response.status = TriggerMessageStatusEnum::Accepted;
break;
// TODO:
// PublishFirmwareStatusNotification
// SignChargingStationCertificate
// SignV2GCertificate
// SignCombinedCertificate

default:
Expand Down Expand Up @@ -2138,6 +2145,14 @@ void ChargePoint::handle_trigger_message(Call<TriggerMessageRequest> call) {
this->send<FirmwareStatusNotificationRequest>(call);
} break;

case MessageTriggerEnum::SignChargingStationCertificate: {
sign_certificate_req(ocpp::CertificateSigningUseEnum::ChargingStationCertificate);
} break;

case MessageTriggerEnum::SignV2GCertificate: {
sign_certificate_req(ocpp::CertificateSigningUseEnum::V2GCertificate);
} break;

default:
EVLOG_error << "Sent a TriggerMessageResponse::Accepted while not following up with a message";
break;
Expand Down

0 comments on commit c2c2d71

Please sign in to comment.