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>
@@ -1065,6 +1066,21 @@ void ChargePoint::on_reservation_status(const int32_t reservation_id, const Rese
1065
1066
}
1066
1067
}
1067
1068
1069
+ void ChargePoint::notify_event_req_connector_status_update (const int32_t evse_id, const int32_t connector_id,
1070
+ const ConnectorStatusEnum status) {
1071
+ ocpp::v201::EventData event_data;
1072
+ const auto cv = ConnectorComponentVariables::get_component_variable (evse_id, connector_id,
1073
+ ConnectorComponentVariables::AvailabilityState);
1074
+ event_data.eventId = ocpp::IncrementalCounter::get ();
1075
+ event_data.actualValue = conversions::connector_status_enum_to_string (status);
1076
+ event_data.trigger = EventTriggerEnum::Delta;
1077
+ event_data.variable = cv.variable .value ();
1078
+ event_data.component = cv.component ;
1079
+ event_data.timestamp = ocpp::DateTime ();
1080
+ event_data.eventNotificationType = EventNotificationEnum::HardWiredNotification;
1081
+ this ->notify_event_req ({event_data});
1082
+ }
1083
+
1068
1084
void ChargePoint::initialize (const std::map<int32_t , int32_t >& evse_connector_structure,
1069
1085
const std::string& message_log_path) {
1070
1086
this ->device_model ->check_integrity (evse_connector_structure);
@@ -1077,7 +1093,13 @@ void ChargePoint::initialize(const std::map<int32_t, int32_t>& evse_connector_st
1077
1093
this ->registration_status != RegistrationStatusEnum::Accepted) {
1078
1094
return false ;
1079
1095
} else {
1080
- this ->status_notification_req (evse_id, connector_id, status, initiated_by_trigger_message);
1096
+ if (this ->ocpp_version == OcppProtocolVersion::v201) {
1097
+ // OCPP2.0.1: B01.FR.05
1098
+ this ->status_notification_req (evse_id, connector_id, status, initiated_by_trigger_message);
1099
+ } else {
1100
+ // OCPP2.1: B01.FR.05
1101
+ this ->notify_event_req_connector_status_update (evse_id, connector_id, status);
1102
+ }
1081
1103
return true ;
1082
1104
}
1083
1105
});
0 commit comments