Skip to content

Commit a558664

Browse files
committed
Merge branch 'main' into feature/ocpp2.1-public-draft-messages
Signed-off-by: Piet Gömpel <pietgoempel@gmail.com>
2 parents 9c9c481 + d1af3e2 commit a558664

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

include/ocpp/v201/charge_point.hpp

+7-8
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ class ChargePointInterface {
195195
on_charging_state_changed(const uint32_t evse_id, const ChargingStateEnum charging_state,
196196
const TriggerReasonEnum trigger_reason = TriggerReasonEnum::ChargingStateChanged) = 0;
197197

198+
/// \brief Gets the transaction id for a certain \p evse_id if there is an active transaction
199+
/// \param evse_id The evse to get the transaction for
200+
/// \return The transaction id if a transaction is active, otherwise nullopt
201+
virtual std::optional<std::string> get_evse_transaction_id(int32_t evse_id) = 0;
202+
198203
/// \brief Event handler that can be called to trigger a NotifyEvent.req with the given \p events
199204
/// \param events
200205
virtual void on_event(const std::vector<EventData>& events) = 0;
@@ -402,14 +407,6 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa
402407

403408
void message_callback(const std::string& message);
404409

405-
///
406-
/// \brief Check if the connector exists on the given evse id.
407-
/// \param evse_id The evse id to check for.
408-
/// \param connector_type The connector type.
409-
/// \return False if evse id does not exist or evse does not have the given connector type.
410-
///
411-
bool does_connector_exist(const uint32_t evse_id, std::optional<CiString<20>> connector_type);
412-
413410
/// \brief Get the value optional offline flag
414411
/// \return true if the charge point is offline. std::nullopt if it is online;
415412
bool is_offline();
@@ -561,6 +558,8 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa
561558
const uint32_t evse_id, const ChargingStateEnum charging_state,
562559
const TriggerReasonEnum trigger_reason = TriggerReasonEnum::ChargingStateChanged) override;
563560

561+
std::optional<std::string> get_evse_transaction_id(int32_t evse_id) override;
562+
564563
AuthorizeResponse validate_token(const IdToken id_token, const std::optional<CiString<10000>>& certificate,
565564
const std::optional<std::vector<OCSPRequestData>>& ocsp_request_data) override;
566565

lib/ocpp/v201/charge_point.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,16 @@ bool ChargePoint::on_charging_state_changed(const uint32_t evse_id, const Chargi
336336
return true;
337337
}
338338

339+
std::optional<std::string> ChargePoint::get_evse_transaction_id(int32_t evse_id) {
340+
const auto& tx = this->evse_manager->get_evse(evse_id).get_transaction();
341+
342+
if (tx != nullptr) {
343+
return tx->transactionId.get();
344+
}
345+
346+
return std::nullopt;
347+
}
348+
339349
AuthorizeResponse ChargePoint::validate_token(const IdToken id_token, const std::optional<CiString<10000>>& certificate,
340350
const std::optional<std::vector<OCSPRequestData>>& ocsp_request_data) {
341351
return this->authorization->validate_token(id_token, certificate, ocsp_request_data);

0 commit comments

Comments
 (0)