2
2
// Copyright Pionix GmbH and Contributors to EVerest
3
3
4
4
#include < ocpp/common/constants.hpp>
5
+ #include < ocpp/common/incremental_counter.hpp>
5
6
#include < ocpp/common/types.hpp>
6
7
#include < ocpp/v201/charge_point.hpp>
7
8
#include < ocpp/v201/ctrlr_component_variables.hpp>
@@ -806,6 +807,21 @@ void ChargePoint::on_reservation_status(const int32_t reservation_id, const Rese
806
807
}
807
808
}
808
809
810
+ void ChargePoint::notify_event_req_connector_status_update (const int32_t evse_id, const int32_t connector_id,
811
+ const ConnectorStatusEnum status) {
812
+ ocpp::v201::EventData event_data;
813
+ const auto cv = ConnectorComponentVariables::get_component_variable (evse_id, connector_id,
814
+ ConnectorComponentVariables::AvailabilityState);
815
+ event_data.eventId = ocpp::IncrementalCounter::get ();
816
+ event_data.actualValue = conversions::connector_status_enum_to_string (status);
817
+ event_data.trigger = EventTriggerEnum::Delta;
818
+ event_data.variable = cv.variable .value ();
819
+ event_data.component = cv.component ;
820
+ event_data.timestamp = ocpp::DateTime ();
821
+ event_data.eventNotificationType = EventNotificationEnum::HardWiredNotification;
822
+ this ->notify_event_req ({event_data});
823
+ }
824
+
809
825
void ChargePoint::initialize (const std::map<int32_t , int32_t >& evse_connector_structure,
810
826
const std::string& message_log_path) {
811
827
this ->device_model ->check_integrity (evse_connector_structure);
@@ -818,7 +834,13 @@ void ChargePoint::initialize(const std::map<int32_t, int32_t>& evse_connector_st
818
834
this ->registration_status != RegistrationStatusEnum::Accepted) {
819
835
return false ;
820
836
} else {
821
- this ->status_notification_req (evse_id, connector_id, status, initiated_by_trigger_message);
837
+ if (this ->ocpp_version == OcppProtocolVersion::v201) {
838
+ // OCPP2.0.1: B01.FR.05
839
+ this ->status_notification_req (evse_id, connector_id, status, initiated_by_trigger_message);
840
+ } else {
841
+ // OCPP2.1: B01.FR.05
842
+ this ->notify_event_req_connector_status_update (evse_id, connector_id, status);
843
+ }
822
844
return true ;
823
845
}
824
846
});
0 commit comments