|
4 | 4 | #include <ocpp/v201/functional_blocks/diagnostics.hpp>
|
5 | 5 |
|
6 | 6 | #include <ocpp/common/constants.hpp>
|
| 7 | +#include <ocpp/common/incremental_counter.hpp> |
| 8 | + |
7 | 9 | #include <ocpp/v201/connectivity_manager.hpp>
|
8 | 10 | #include <ocpp/v201/ctrlr_component_variables.hpp>
|
9 | 11 | #include <ocpp/v201/device_model.hpp>
|
@@ -81,6 +83,21 @@ void Diagnostics::notify_event_req(const std::vector<EventData>& events) {
|
81 | 83 | this->message_dispatcher.dispatch_call(call);
|
82 | 84 | }
|
83 | 85 |
|
| 86 | +void Diagnostics::notify_event_req_connector_status_update(const int32_t evse_id, const int32_t connector_id, |
| 87 | + const ConnectorStatusEnum status) { |
| 88 | + ocpp::v201::EventData event_data; |
| 89 | + const auto cv = ConnectorComponentVariables::get_component_variable(evse_id, connector_id, |
| 90 | + ConnectorComponentVariables::AvailabilityState); |
| 91 | + event_data.eventId = ocpp::IncrementalCounter::get(); |
| 92 | + event_data.actualValue = conversions::connector_status_enum_to_string(status); |
| 93 | + event_data.trigger = EventTriggerEnum::Delta; |
| 94 | + event_data.variable = cv.variable.value(); |
| 95 | + event_data.component = cv.component; |
| 96 | + event_data.timestamp = ocpp::DateTime(); |
| 97 | + event_data.eventNotificationType = EventNotificationEnum::HardWiredNotification; |
| 98 | + this->notify_event_req({event_data}); |
| 99 | +} |
| 100 | + |
84 | 101 | void Diagnostics::stop_monitoring() {
|
85 | 102 | monitoring_updater.stop_monitoring();
|
86 | 103 | }
|
|
0 commit comments