Skip to content

Commit

Permalink
refactor: rename charging profile callback variables for clarity Sign…
Browse files Browse the repository at this point in the history
…ed-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 <naser.rezayi.nr@gmail.com>
  • Loading branch information
thenaserov committed Feb 11, 2025
1 parent c86a8f2 commit f361b1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/ocpp/v16/charge_point_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class ChargePointImpl : ocpp::ChargingStationBase {
std::function<void(const ResetType& reset_type)> reset_callback;
std::function<void(const std::string& system_time)> set_system_time_callback;
std::function<void(const BootNotificationResponse& boot_notification_response)> boot_notification_response_callback;
std::function<void()> signal_set_charging_profiles_callback;
std::function<void()> charging_profiles_updated_callback;
std::function<void(bool is_connected)> connection_state_changed_callback;

std::function<GetLogResponse(const GetDiagnosticsRequest& request)> upload_diagnostics_callback;
Expand Down Expand Up @@ -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<void()>& callback);
void register_charging_profiles_updated_callback(const std::function<void()>& 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.
Expand Down
8 changes: 4 additions & 4 deletions lib/ocpp/v201/functional_blocks/smart_charging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ SmartCharging::SmartCharging(DeviceModel& device_model, EvseManagerInterface& ev
ConnectivityManagerInterface& connectivity_manager,
MessageDispatcherInterface<MessageType>& message_dispatcher,
DatabaseHandlerInterface& database_handler,
std::function<void()> set_charging_profiles_callback) :
std::function<void()> 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<MessageType>& message) {
Expand Down Expand Up @@ -661,7 +661,7 @@ void SmartCharging::handle_set_charging_profile_req(Call<SetChargingProfileReque
response = this->conform_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();
Expand Down Expand Up @@ -692,7 +692,7 @@ void SmartCharging::handle_clear_charging_profile_req(Call<ClearChargingProfileR
}

if (response.status == ClearChargingProfileStatusEnum::Accepted) {
this->set_charging_profiles_callback();
this->charging_profiles_updated_callback();
}

ocpp::CallResult<ClearChargingProfileResponse> call_result(response, call.uniqueId);
Expand Down

0 comments on commit f361b1f

Please sign in to comment.