Skip to content

Commit

Permalink
Review comment: change parameters of reserve now callback.
Browse files Browse the repository at this point in the history
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
  • Loading branch information
maaikez committed Nov 8, 2024
1 parent 27bcebb commit dbdf07a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 2 additions & 5 deletions include/ocpp/v201/charge_point_callbacks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <ocpp/v201/messages/GetDisplayMessages.hpp>
#include <ocpp/v201/messages/GetLog.hpp>
#include <ocpp/v201/messages/RequestStartTransaction.hpp>
#include <ocpp/v201/messages/ReserveNow.hpp>
#include <ocpp/v201/messages/SetDisplayMessage.hpp>
#include <ocpp/v201/messages/TransactionEvent.hpp>
#include <ocpp/v201/messages/UnlockConnector.hpp>
Expand Down Expand Up @@ -153,11 +154,7 @@ struct Callbacks {
set_running_cost_callback;

/// \brief Callback function is called when a reservation request is received from the CSMS
std::optional<std::function<ReserveNowStatusEnum(
const int32_t id, const ocpp::DateTime& expiry_date_time, const IdToken& id_token,
const std::optional<ConnectorEnum> connector_type, const std::optional<uint32_t> evse_id,
const std::optional<IdToken>& group_id_token)>>
reserve_now_callback;
std::optional<std::function<ReserveNowStatusEnum(const ReserveNowRequest& request)>> reserve_now_callback;
/// \brief Callback function is called when a cancel reservation request is received from the CSMS
std::optional<std::function<bool(const int32_t reservationId)>> cancel_reservation_callback;
};
Expand Down
6 changes: 2 additions & 4 deletions lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3416,10 +3416,8 @@ void ChargePoint::handle_reserve_now_request(Call<ReserveNowRequest> call) {
// should be overwritten.

// Call reserve now callback and wait for the response.
ReserveNowRequest reservation_request = call.msg;
response.status = this->callbacks.reserve_now_callback.value()(
reservation_request.id, reservation_request.expiryDateTime, reservation_request.idToken,
reservation_request.connectorType, reservation_request.evseId, reservation_request.groupIdToken);
const ReserveNowRequest reservation_request = call.msg;
response.status = this->callbacks.reserve_now_callback.value()(reservation_request);

// Reply with the response from the callback.
const ocpp::CallResult<ReserveNowResponse> call_result(response, call.uniqueId);
Expand Down

0 comments on commit dbdf07a

Please sign in to comment.