Skip to content

Commit

Permalink
Remote unlock connector: Implement
Browse files Browse the repository at this point in the history
Signed-off-by: Maaike Zijderveld, Alfen <[email protected]>
  • Loading branch information
maaikez committed Jul 11, 2023
1 parent 58e6bc4 commit 9aa5765
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/ocpp/v201/charge_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <ocpp/v201/messages/TransactionEvent.hpp>
#include <ocpp/v201/messages/TriggerMessage.hpp>
#include <ocpp/v201/messages/GetLog.hpp>
#include <ocpp/v201/messages/UnlockConnector.hpp>

namespace ocpp {
namespace v201 {
Expand All @@ -42,6 +43,7 @@ struct Callbacks {
std::function<void(const int32_t evse_id)> pause_charging_callback;
std::function<void(const ChangeAvailabilityRequest& request)> change_availability_callback;
std::function<GetLogResponse(const GetLogRequest& request)> get_log_request_callback;
std::function<UnlockConnectorResponse(const int32_t evse_id, const int32_t connecor_id)> unlock_connector_callback;
};

/// \brief Class implements OCPP2.0.1 Charging Station
Expand Down Expand Up @@ -136,6 +138,9 @@ class ChargePoint : ocpp::ChargingStationBase {
void handle_start_transaction_event_response(CallResult<TransactionEventResponse> call_result,
const int32_t evse_id);

// Function Block F: Remote transaction control
void handle_unlock_connector(Call<UnlockConnectorRequest> call);

// Functional Block G: Availability
void handle_change_availability_req(Call<ChangeAvailabilityRequest> call);

Expand Down
7 changes: 7 additions & 0 deletions lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,13 @@ void ChargePoint::handle_start_transaction_event_response(CallResult<Transaction
}
}

void ChargePoint::handle_unlock_connector(Call<UnlockConnectorRequest> call) {
const UnlockConnectorRequest& msg = call.msg;
const UnlockConnectorResponse unlock_response = callbacks.unlock_connector_callback(msg.evseId, msg.connectorId);
ocpp::CallResult<UnlockConnectorResponse> call_result(unlock_response, call.uniqueId);
this->send<UnlockConnectorResponse>(call_result);
}

void ChargePoint::handle_change_availability_req(Call<ChangeAvailabilityRequest> call) {
const auto msg = call.msg;
ChangeAvailabilityResponse response;
Expand Down

0 comments on commit 9aa5765

Please sign in to comment.