From f361b1ff10c6e5fd9f4c24b09c1c76c819a4c876 Mon Sep 17 00:00:00 2001 From: thenaserov Date: Sat, 8 Feb 2025 21:13:07 +0330 Subject: [PATCH] refactor: rename charging profile callback variables for clarity Signed-off-by: Naser Rezaei naser.rezayi.nr@gmail.com - Renamed and to to better reflect their purpose. - Updated all related comments in Doxygen and code to align with the new naming convention. - The new name clarifies that the callback is triggered whenever charging profiles are updated, not just when they are set. Signed-off-by: thenaserov --- include/ocpp/v16/charge_point_impl.hpp | 4 ++-- lib/ocpp/v201/functional_blocks/smart_charging.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/ocpp/v16/charge_point_impl.hpp b/include/ocpp/v16/charge_point_impl.hpp index 000c246fe..67830c91d 100644 --- a/include/ocpp/v16/charge_point_impl.hpp +++ b/include/ocpp/v16/charge_point_impl.hpp @@ -162,7 +162,7 @@ class ChargePointImpl : ocpp::ChargingStationBase { std::function reset_callback; std::function set_system_time_callback; std::function boot_notification_response_callback; - std::function signal_set_charging_profiles_callback; + std::function charging_profiles_updated_callback; std::function connection_state_changed_callback; std::function upload_diagnostics_callback; @@ -805,7 +805,7 @@ class ChargePointImpl : ocpp::ChargingStationBase { /// and was accepted. The registered callback could make use of the get_all_composite_charging_schedules in order to /// retrieve the ChargingProfiles that have been set by the CSMS. /// \param callback - void register_signal_set_charging_profiles_callback(const std::function& callback); + void register_charging_profiles_updated_callback(const std::function& callback); /// \brief registers a \p callback function that can be used when the connection state to CSMS changes. The /// connection_state_changed_callback is called when chargepoint has connected to or disconnected from the CSMS. diff --git a/lib/ocpp/v201/functional_blocks/smart_charging.cpp b/lib/ocpp/v201/functional_blocks/smart_charging.cpp index b7dd250a1..9d92538a9 100644 --- a/lib/ocpp/v201/functional_blocks/smart_charging.cpp +++ b/lib/ocpp/v201/functional_blocks/smart_charging.cpp @@ -122,13 +122,13 @@ SmartCharging::SmartCharging(DeviceModel& device_model, EvseManagerInterface& ev ConnectivityManagerInterface& connectivity_manager, MessageDispatcherInterface& message_dispatcher, DatabaseHandlerInterface& database_handler, - std::function set_charging_profiles_callback) : + std::function charging_profiles_updated_callback) : device_model(device_model), evse_manager(evse_manager), connectivity_manager(connectivity_manager), message_dispatcher(message_dispatcher), database_handler(database_handler), - set_charging_profiles_callback(set_charging_profiles_callback) { + charging_profiles_updated_callback(charging_profiles_updated_callback) { } void SmartCharging::handle_message(const ocpp::EnhancedMessage& message) { @@ -661,7 +661,7 @@ void SmartCharging::handle_set_charging_profile_req(Callconform_validate_and_add_profile(msg.chargingProfile, msg.evseId); if (response.status == ChargingProfileStatusEnum::Accepted) { EVLOG_debug << "Accepting SetChargingProfileRequest"; - this->set_charging_profiles_callback(); + this->charging_profiles_updated_callback(); } else { EVLOG_debug << "Rejecting SetChargingProfileRequest:\n reasonCode: " << response.statusInfo->reasonCode.get() << "\nadditionalInfo: " << response.statusInfo->additionalInfo->get(); @@ -692,7 +692,7 @@ void SmartCharging::handle_clear_charging_profile_req(Callset_charging_profiles_callback(); + this->charging_profiles_updated_callback(); } ocpp::CallResult call_result(response, call.uniqueId);