Skip to content

Commit

Permalink
Support change of a variable on the fly
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Rogach <[email protected]>
  • Loading branch information
jannejy committed May 1, 2024
1 parent 64e91c4 commit ded4812
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/ocpp/v201/charge_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ class ChargePointInterface {
/// \param tech_info additional info of the security event
virtual void on_security_event(const CiString<50>& event_type, const std::optional<CiString<255>>& tech_info) = 0;

/// \brief Event handler that will update the variable internally when it has been changed on the fly.
/// \param set_variable_data contains data of the variable to set
///
virtual void on_variable_changed(const SetVariableData& set_variable_data) = 0;

/// \brief Data transfer mechanism initiated by charger
/// \param vendorId
/// \param messageId
Expand Down Expand Up @@ -829,6 +834,8 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa

void on_security_event(const CiString<50>& event_type, const std::optional<CiString<255>>& tech_info) override;

void on_variable_changed(const SetVariableData& set_variable_data) override;

DataTransferResponse data_transfer_req(const CiString<255>& vendorId, const std::optional<CiString<50>>& messageId,
const std::optional<json>& data) override;

Expand Down
4 changes: 4 additions & 0 deletions lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,10 @@ void ChargePoint::on_security_event(const CiString<50>& event_type, const std::o
this->security_event_notification_req(event_type, tech_info, false, false);
}

void ChargePoint::on_variable_changed(const SetVariableData& set_variable_data) {
this->handle_variable_changed(set_variable_data);
}

bool ChargePoint::send(CallError call_error) {
this->message_queue->push(call_error);
return true;
Expand Down

0 comments on commit ded4812

Please sign in to comment.