From 8853dbf3af7209a8e83d86d11caaa8781f07d0eb Mon Sep 17 00:00:00 2001 From: Kai-Uwe Hermann Date: Thu, 17 Aug 2023 16:41:57 +0200 Subject: [PATCH] clang-format Signed-off-by: Kai-Uwe Hermann --- include/ocpp/v201/charge_point.hpp | 3 ++- lib/ocpp/v201/charge_point.cpp | 27 ++++++++++----------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/include/ocpp/v201/charge_point.hpp b/include/ocpp/v201/charge_point.hpp index 8687a0526..06096fbb8 100644 --- a/include/ocpp/v201/charge_point.hpp +++ b/include/ocpp/v201/charge_point.hpp @@ -299,7 +299,8 @@ class ChargePoint : ocpp::ChargingStationBase { /// \param signed_meter_value void on_transaction_finished(const int32_t evse_id, const DateTime& timestamp, const MeterValue& meter_stop, const ReasonEnum reason, const std::optional& id_token, - const std::optional& signed_meter_value, const ChargingStateEnum charging_state); + const std::optional& signed_meter_value, + const ChargingStateEnum charging_state); /// \brief Event handler that should be called when a session has finished /// \param evse_id diff --git a/lib/ocpp/v201/charge_point.cpp b/lib/ocpp/v201/charge_point.cpp index c537c7792..942a3503b 100644 --- a/lib/ocpp/v201/charge_point.cpp +++ b/lib/ocpp/v201/charge_point.cpp @@ -230,14 +230,10 @@ bool ChargePoint::on_charging_state_changed(const uint32_t evse_id, ChargingStat this->evses.at(static_cast(evse_id))->get_transaction(); if (transaction != nullptr) { transaction->chargingState = charging_state; - this->transaction_event_req( - TransactionEventEnum::Updated, DateTime(), - transaction->get_transaction(), - TriggerReasonEnum::ChargingStateChanged, - transaction->get_seq_no(), std::nullopt, - this->evses.at(static_cast(evse_id))->get_evse_info(), - std::nullopt, std::nullopt, std::nullopt, std::nullopt, - std::nullopt); + this->transaction_event_req(TransactionEventEnum::Updated, DateTime(), transaction->get_transaction(), + TriggerReasonEnum::ChargingStateChanged, transaction->get_seq_no(), + std::nullopt, this->evses.at(static_cast(evse_id))->get_evse_info(), + std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt); return true; } else { EVLOG_warning << "Can not change charging state: no transaction for evse id " << evse_id; @@ -852,27 +848,24 @@ void ChargePoint::transaction_event_req(const TransactionEventEnum& event_type, ocpp::Call call(req, this->message_queue->createMessageId()); - // Check if id token is in the remote start map, because when a remote - // start request is done, the first transaction event request should - // always contain trigger reason 'RemoteStart'. + // Check if id token is in the remote start map, because when a remote + // start request is done, the first transaction event request should + // always contain trigger reason 'RemoteStart'. auto it = std::find_if( remote_start_id_per_evse.begin(), remote_start_id_per_evse.end(), [&id_token, &evse](const std::pair>& remote_start_per_evse) { - if (id_token.has_value() && - remote_start_per_evse.second.first.idToken == id_token.value().idToken) { + if (id_token.has_value() && remote_start_per_evse.second.first.idToken == id_token.value().idToken) { if (remote_start_per_evse.first == 0) { return true; } - if (evse.has_value() && - evse.value().id == remote_start_per_evse.first) { + if (evse.has_value() && evse.value().id == remote_start_per_evse.first) { return true; } } return false; - } - ); + }); if (it != remote_start_id_per_evse.end()) { // Found remote start. Set remote start id and the trigger reason.