@@ -28,6 +28,7 @@ ChargePointImpl::ChargePointImpl(const std::string& config, const fs::path& shar
28
28
ocpp::ChargingStationBase(evse_security, security_configuration),
29
29
boot_notification_callerror(false ),
30
30
initialized(false ),
31
+ bootreason(BootReasonEnum::PowerUp),
31
32
connection_state(ChargePointConnectionState::Disconnected),
32
33
registration_status(RegistrationStatus::Pending),
33
34
diagnostics_status(DiagnosticsStatus::Idle),
@@ -789,7 +790,8 @@ void ChargePointImpl::send_meter_value(int32_t connector, MeterValue meter_value
789
790
this ->send <MeterValuesRequest>(call, initiated_by_trigger_message);
790
791
}
791
792
792
- bool ChargePointImpl::start (const std::map<int , ChargePointStatus>& connector_status_map) {
793
+ bool ChargePointImpl::start (const std::map<int , ChargePointStatus>& connector_status_map, BootReasonEnum bootreason) {
794
+ this ->bootreason = bootreason;
793
795
this ->init_state_machine (connector_status_map);
794
796
this ->init_websocket ();
795
797
this ->websocket ->connect ();
@@ -800,15 +802,15 @@ bool ChargePointImpl::start(const std::map<int, ChargePointStatus>& connector_st
800
802
return true ;
801
803
}
802
804
803
- bool ChargePointImpl::restart (const std::map<int , ChargePointStatus>& connector_status_map) {
805
+ bool ChargePointImpl::restart (const std::map<int , ChargePointStatus>& connector_status_map, BootReasonEnum bootreason ) {
804
806
if (this ->stopped ) {
805
807
EVLOG_info << " Restarting OCPP Chargepoint" ;
806
808
this ->database_handler ->open_db_connection (this ->configuration ->getNumberOfConnectors ());
807
809
// instantiating new message queue on restart
808
810
this ->message_queue = this ->create_message_queue ();
809
811
this ->initialized = true ;
810
812
811
- return this ->start (connector_status_map);
813
+ return this ->start (connector_status_map, bootreason );
812
814
} else {
813
815
EVLOG_warning << " Attempting to restart Chargepoint while it has not been stopped before" ;
814
816
return false ;
@@ -1013,6 +1015,7 @@ void ChargePointImpl::message_callback(const std::string& message) {
1013
1015
auto call_error = CallError (MessageId (json_message.at (MESSAGE_ID).get <std::string>()), " FormationViolation" ,
1014
1016
e.what (), json ({}, true ));
1015
1017
this ->send (call_error);
1018
+ this ->securityEventNotification (ocpp::security_events::INVALIDMESSAGES, message, true );
1016
1019
}
1017
1020
}
1018
1021
}
@@ -1198,6 +1201,19 @@ void ChargePointImpl::handleBootNotificationResponse(ocpp::CallResult<BootNotifi
1198
1201
this ->ocsp_request_timer ->timeout (INITIAL_CERTIFICATE_REQUESTS_DELAY);
1199
1202
}
1200
1203
1204
+ if (this ->bootreason == BootReasonEnum::RemoteReset) {
1205
+ this ->securityEventNotification (
1206
+ CiString<50 >(ocpp::security_events::RESET_OR_REBOOT),
1207
+ " Charging Station rebooted due to requested remote reset!" , true );
1208
+ } else if (this ->bootreason == BootReasonEnum::ScheduledReset) {
1209
+ this ->securityEventNotification (
1210
+ CiString<50 >(ocpp::security_events::RESET_OR_REBOOT),
1211
+ " Charging Station rebooted due to a scheduled reset!" , true );
1212
+ } else if (this ->bootreason == BootReasonEnum::PowerUp) {
1213
+ this ->securityEventNotification (CiString<50 >(ocpp::security_events::STARTUP_OF_THE_DEVICE),
1214
+ " The Charge Point has booted" , true );
1215
+ }
1216
+
1201
1217
this ->stop_pending_transactions ();
1202
1218
1203
1219
break ;
@@ -2229,7 +2245,7 @@ void ChargePointImpl::handleCertificateSignedRequest(ocpp::Call<CertificateSigne
2229
2245
this ->send <CertificateSignedResponse>(call_result);
2230
2246
2231
2247
if (response.status == CertificateSignedStatusEnumType::Rejected) {
2232
- this ->securityEventNotification (" InvalidChargePointCertificate " ,
2248
+ this ->securityEventNotification (ocpp::security_events::INVALIDCHARGINGSTATIONCERTIFICATE ,
2233
2249
ocpp::conversions::install_certificate_result_to_string (result), true );
2234
2250
}
2235
2251
@@ -2312,7 +2328,7 @@ void ChargePointImpl::handleInstallCertificateRequest(ocpp::Call<InstallCertific
2312
2328
this ->send <InstallCertificateResponse>(call_result);
2313
2329
2314
2330
if (response.status == InstallCertificateStatusEnumType::Rejected) {
2315
- this ->securityEventNotification (" InvalidCentralSystemCertificate " ,
2331
+ this ->securityEventNotification (ocpp::security_events::INVALIDCSMSCERTIFICATE ,
2316
2332
ocpp::conversions::install_certificate_result_to_string (result), true );
2317
2333
}
2318
2334
}
@@ -2348,7 +2364,7 @@ void ChargePointImpl::handleSignedUpdateFirmware(ocpp::Call<SignedUpdateFirmware
2348
2364
}
2349
2365
2350
2366
if (response.status == UpdateFirmwareStatusEnumType::InvalidCertificate) {
2351
- this ->securityEventNotification (" InvalidFirmwareSigningCertificate " , " Certificate is invalid." , true );
2367
+ this ->securityEventNotification (ocpp::security_events::INVALIDFIRMWARESIGNINGCERTIFICATE , " Certificate is invalid." , true );
2352
2368
}
2353
2369
}
2354
2370
@@ -2413,7 +2429,7 @@ void ChargePointImpl::signed_firmware_update_status_notification(FirmwareStatusE
2413
2429
this ->send <SignedFirmwareStatusNotificationRequest>(call, initiated_by_trigger_message);
2414
2430
2415
2431
if (status == FirmwareStatusEnumType::InvalidSignature) {
2416
- this ->securityEventNotification (" InvalidFirmwareSignature " , " " , true );
2432
+ this ->securityEventNotification (ocpp::security_events::INVALIDFIRMWARESIGNATURE , " " , true );
2417
2433
}
2418
2434
2419
2435
if (this ->firmware_update_is_pending ) {
@@ -2957,7 +2973,7 @@ void ChargePointImpl::handle_data_transfer_pnc_certificate_signed(Call<DataTrans
2957
2973
this ->send <DataTransferResponse>(call_result);
2958
2974
2959
2975
if (certificate_response.status == CertificateSignedStatusEnumType::Rejected) {
2960
- this ->securityEventNotification (" InvalidChargePointCertificate " , tech_info, true );
2976
+ this ->securityEventNotification (ocpp::security_events::INVALIDCHARGINGSTATIONCERTIFICATE , tech_info, true );
2961
2977
}
2962
2978
} catch (const json::exception & e) {
2963
2979
EVLOG_warning << " Could not parse data of DataTransfer message CertificateSigned.req: " << e.what ();
@@ -3424,6 +3440,10 @@ void ChargePointImpl::on_firmware_update_status_notification(int32_t request_id,
3424
3440
} catch (const std::out_of_range& e) {
3425
3441
EVLOG_debug << " Could not convert incoming FirmwareStatusNotification to OCPP type" ;
3426
3442
}
3443
+
3444
+ if (firmware_update_status == FirmwareStatusNotification::Installed) {
3445
+ this ->securityEventNotification (ocpp::security_events::FIRMWARE_UPDATED, " Firmware update was installed" , true );
3446
+ }
3427
3447
}
3428
3448
3429
3449
void ChargePointImpl::diagnostic_status_notification (DiagnosticsStatus status) {
0 commit comments