Skip to content

Commit

Permalink
ChargePoint: add support for SecurityEventNotification `FirmwareUpdat…
Browse files Browse the repository at this point in the history
…ed` after reboot (#747)

* ChargePoint: add support for SecurityEventNotification `FirmwareUpdated` after reboot

It was being reported as ResetOrReboot.

This addition is to fulfil requirement L01.FR.31 when the firmware requires
a reboot after installation. The case without reboot is handled in
on_firmware_update_status_notification().

Signed-off-by: Moritz Barsnick <[email protected]>

* ChargePoint: refactor

Add a re-usable string for the firmware version.

Signed-off-by: Moritz Barsnick <[email protected]>

---------

Signed-off-by: Moritz Barsnick <[email protected]>
  • Loading branch information
barsnick authored Sep 23, 2024
1 parent 10ff71f commit 2647ee4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ void ChargePoint::start(BootReasonEnum bootreason) {
this->load_charging_profiles();
this->connectivity_manager->start();

const std::string firmware_version =
this->device_model->get_value<std::string>(ControllerComponentVariables::FirmwareVersion);

if (this->bootreason == BootReasonEnum::RemoteReset) {
this->security_event_notification_req(
CiString<50>(ocpp::security_events::RESET_OR_REBOOT),
Expand All @@ -222,15 +225,16 @@ void ChargePoint::start(BootReasonEnum bootreason) {
CiString<50>(ocpp::security_events::RESET_OR_REBOOT),
std::optional<CiString<255>>("Charging Station rebooted due to a scheduled reset!"), true, true);
} else if (this->bootreason == BootReasonEnum::PowerUp) {
std::string startup_message = "Charging Station powered up! Firmware version: ";
startup_message.append(
this->device_model->get_value<std::string>(ControllerComponentVariables::FirmwareVersion));
std::string startup_message = "Charging Station powered up! Firmware version: " + firmware_version;
this->security_event_notification_req(CiString<50>(ocpp::security_events::STARTUP_OF_THE_DEVICE),
std::optional<CiString<255>>(startup_message), true, true);
} else if (this->bootreason == BootReasonEnum::FirmwareUpdate) {
std::string startup_message =
"Charging station reboot after firmware update. Firmware version: " + firmware_version;
this->security_event_notification_req(CiString<50>(ocpp::security_events::FIRMWARE_UPDATED),
std::optional<CiString<255>>(startup_message), true, true);
} else {
std::string startup_message = "Charging station reset or reboot. Firmware version: ";
startup_message.append(
this->device_model->get_value<std::string>(ControllerComponentVariables::FirmwareVersion));
std::string startup_message = "Charging station reset or reboot. Firmware version: " + firmware_version;
this->security_event_notification_req(CiString<50>(ocpp::security_events::RESET_OR_REBOOT),
std::optional<CiString<255>>(startup_message), true, true);
}
Expand Down

0 comments on commit 2647ee4

Please sign in to comment.