Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrated libocpp patch #28

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,9 @@ void ChargePoint::remove_network_connection_profiles_below_actual_security_profi
}

void ChargePoint::handle_message(const EnhancedMessage<v201::MessageType>& message) {
EVLOG_info << "Handle_message called: " << message.message;
const auto& json_message = message.message;
EVLOG_info << "json_message called: " << json_message;
switch (message.messageType) {
case MessageType::BootNotificationResponse:
this->handle_boot_notification_response(json_message);
Expand Down Expand Up @@ -1261,6 +1263,11 @@ void ChargePoint::handle_message(const EnhancedMessage<v201::MessageType>& messa
case MessageType::CustomerInformation:
this->handle_customer_information_req(json_message);
break;
case MessageType::SetChargingProfile:
{
this->handle_set_charging_profile_req(json_message);
break;
}
default:
if (message.messageTypeId == MessageTypeId::CALL) {
const auto call_error = CallError(message.uniqueId, "NotImplemented", "", json({}));
Expand Down Expand Up @@ -3061,6 +3068,7 @@ void ChargePoint::handle_heartbeat_response(CallResult<HeartbeatResponse> call)
// Functional Block K: Smart Charging
void ChargePoint::handle_set_charging_profile_req(Call<SetChargingProfileRequest> call) {
SetChargingProfileResponse response;
EVLOG_info << "Received SetChargingProfile: " << call.msg << "\nwith messageId: " << call.uniqueId;
auto validity = this->smart_charging_handler->validate_profile(call.msg.chargingProfile, call.msg.evseId);

if (validity != ProfileValidationResultEnum::Valid) {
Expand All @@ -3071,6 +3079,7 @@ void ChargePoint::handle_set_charging_profile_req(Call<SetChargingProfileRequest
this->callbacks.signal_set_charging_profiles_callback.value()();
}
}
EVLOG_info << "Received profile validity: " << validity << "setting response to " << response;
ocpp::CallResult<SetChargingProfileResponse> call_result(response, call.uniqueId);
this->send<SetChargingProfileResponse>(call_result);
}
Expand Down