Skip to content

Commit

Permalink
Adjust certificate hash data conversion (#227)
Browse files Browse the repository at this point in the history
- Adjust  adjust handle_get_installed_certificate_ids_req;  to use ref.
- in CertificateHashDataChain ignore empty childCertificateHashData lists

Signed-off-by: Fabian Klemm <[email protected]>
  • Loading branch information
klemmpnx authored Oct 25, 2023
1 parent 47a89bd commit 9805829
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ocpp/common/evse_security.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ ocpp::v201::CertificateHashDataChain to_ocpp_v201(ocpp::CertificateHashDataChain
ocpp::v201::CertificateHashDataChain lhs;
lhs.certificateType = to_ocpp_v201(other.certificateType);
lhs.certificateHashData = to_ocpp_v201(other.certificateHashData);
if (other.childCertificateHashData.has_value()) {
if (other.childCertificateHashData.has_value() && !other.childCertificateHashData.value().empty()) {
std::vector<ocpp::v201::CertificateHashDataType> v;
for (const auto& certificate_hash_data : other.childCertificateHashData.value()) {
v.push_back(to_ocpp_v201(certificate_hash_data));
Expand Down
2 changes: 1 addition & 1 deletion lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2027,7 +2027,7 @@ void ChargePoint::handle_get_installed_certificate_ids_req(Call<GetInstalledCert

// convert the common type back to the v201 type(s) for the response
std::vector<CertificateHashDataChain> certificate_hash_data_chain_v201;
for (const auto certificate_hash_data_chain_entry : certificate_hash_data_chains) {
for (const auto& certificate_hash_data_chain_entry : certificate_hash_data_chains) {
certificate_hash_data_chain_v201.push_back(
ocpp::evse_security_conversions::to_ocpp_v201(certificate_hash_data_chain_entry));
}
Expand Down

0 comments on commit 9805829

Please sign in to comment.