Skip to main content

ocpp_client/ocpp_2_1/
actions.rs

1use crate::action::{Action, SendAction};
2use crate::error::ClientError;
3use crate::ocpp_2_1::OCPP2_1Client;
4use crate::ocpp_2_1::error::OCPP2_1Error;
5use core::future::Future;
6use ocpp_types::v21::{
7    AFRRSignalRequest, AFRRSignalResponse, AdjustPeriodicEventStreamRequest,
8    AdjustPeriodicEventStreamResponse, AuthorizeRequest, AuthorizeResponse, BatterySwapRequest,
9    BatterySwapResponse, BootNotificationRequest, BootNotificationResponse,
10    CancelReservationRequest, CancelReservationResponse, CertificateSignedRequest,
11    CertificateSignedResponse, ChangeAvailabilityRequest, ChangeAvailabilityResponse,
12    ChangeTransactionTariffRequest, ChangeTransactionTariffResponse, ClearCacheRequest,
13    ClearCacheResponse, ClearChargingProfileRequest, ClearChargingProfileResponse,
14    ClearDERControlRequest, ClearDERControlResponse, ClearDisplayMessageRequest,
15    ClearDisplayMessageResponse, ClearTariffsRequest, ClearTariffsResponse,
16    ClearVariableMonitoringRequest, ClearVariableMonitoringResponse, ClearedChargingLimitRequest,
17    ClearedChargingLimitResponse, ClosePeriodicEventStreamRequest,
18    ClosePeriodicEventStreamResponse, CostUpdatedRequest, CostUpdatedResponse,
19    CustomerInformationRequest, CustomerInformationResponse, DataTransferRequest,
20    DataTransferResponse, DeleteCertificateRequest, DeleteCertificateResponse,
21    FirmwareStatusNotificationRequest, FirmwareStatusNotificationResponse,
22    Get15118EVCertificateRequest, Get15118EVCertificateResponse, GetBaseReportRequest,
23    GetBaseReportResponse, GetCertificateChainStatusRequest, GetCertificateChainStatusResponse,
24    GetCertificateStatusRequest, GetCertificateStatusResponse, GetChargingProfilesRequest,
25    GetChargingProfilesResponse, GetCompositeScheduleRequest, GetCompositeScheduleResponse,
26    GetDERControlRequest, GetDERControlResponse, GetDisplayMessagesRequest,
27    GetDisplayMessagesResponse, GetInstalledCertificateIdsRequest,
28    GetInstalledCertificateIdsResponse, GetLocalListVersionRequest, GetLocalListVersionResponse,
29    GetLogRequest, GetLogResponse, GetMonitoringReportRequest, GetMonitoringReportResponse,
30    GetPeriodicEventStreamRequest, GetPeriodicEventStreamResponse, GetReportRequest,
31    GetReportResponse, GetTariffsRequest, GetTariffsResponse, GetTransactionStatusRequest,
32    GetTransactionStatusResponse, GetVariablesRequest, GetVariablesResponse, HeartbeatRequest,
33    HeartbeatResponse, InstallCertificateRequest, InstallCertificateResponse,
34    LogStatusNotificationRequest, LogStatusNotificationResponse, MeterValuesRequest,
35    MeterValuesResponse, NotifyAllowedEnergyTransferRequest, NotifyAllowedEnergyTransferResponse,
36    NotifyChargingLimitRequest, NotifyChargingLimitResponse, NotifyCustomerInformationRequest,
37    NotifyCustomerInformationResponse, NotifyDERAlarmRequest, NotifyDERAlarmResponse,
38    NotifyDERStartStopRequest, NotifyDERStartStopResponse, NotifyDisplayMessagesRequest,
39    NotifyDisplayMessagesResponse, NotifyEVChargingNeedsRequest, NotifyEVChargingNeedsResponse,
40    NotifyEVChargingScheduleRequest, NotifyEVChargingScheduleResponse, NotifyEventRequest,
41    NotifyEventResponse, NotifyMonitoringReportRequest, NotifyMonitoringReportResponse,
42    NotifyPeriodicEventStream, NotifyPriorityChargingRequest, NotifyPriorityChargingResponse,
43    NotifyReportRequest, NotifyReportResponse, NotifySettlementRequest, NotifySettlementResponse,
44    NotifyWebPaymentStartedRequest, NotifyWebPaymentStartedResponse,
45    OpenPeriodicEventStreamRequest, OpenPeriodicEventStreamResponse, PublishFirmwareRequest,
46    PublishFirmwareResponse, PublishFirmwareStatusNotificationRequest,
47    PublishFirmwareStatusNotificationResponse, PullDynamicScheduleUpdateRequest,
48    PullDynamicScheduleUpdateResponse, ReportChargingProfilesRequest,
49    ReportChargingProfilesResponse, ReportDERControlRequest, ReportDERControlResponse,
50    RequestBatterySwapRequest, RequestBatterySwapResponse, RequestStartTransactionRequest,
51    RequestStartTransactionResponse, RequestStopTransactionRequest, RequestStopTransactionResponse,
52    ReservationStatusUpdateRequest, ReservationStatusUpdateResponse, ReserveNowRequest,
53    ReserveNowResponse, ResetRequest, ResetResponse, SecurityEventNotificationRequest,
54    SecurityEventNotificationResponse, SendLocalListRequest, SendLocalListResponse,
55    SetChargingProfileRequest, SetChargingProfileResponse, SetDERControlRequest,
56    SetDERControlResponse, SetDefaultTariffRequest, SetDefaultTariffResponse,
57    SetDisplayMessageRequest, SetDisplayMessageResponse, SetMonitoringBaseRequest,
58    SetMonitoringBaseResponse, SetMonitoringLevelRequest, SetMonitoringLevelResponse,
59    SetNetworkProfileRequest, SetNetworkProfileResponse, SetVariableMonitoringRequest,
60    SetVariableMonitoringResponse, SetVariablesRequest, SetVariablesResponse,
61    SignCertificateRequest, SignCertificateResponse, StatusNotificationRequest,
62    StatusNotificationResponse, TransactionEventRequest, TransactionEventResponse,
63    TriggerMessageRequest, TriggerMessageResponse, UnlockConnectorRequest, UnlockConnectorResponse,
64    UnpublishFirmwareRequest, UnpublishFirmwareResponse, UpdateDynamicScheduleRequest,
65    UpdateDynamicScheduleResponse, UpdateFirmwareRequest, UpdateFirmwareResponse,
66    UsePriorityChargingRequest, UsePriorityChargingResponse, VatNumberValidationRequest,
67    VatNumberValidationResponse,
68};
69
70/// Same pattern as `ocpp_2_0_1_action!` (see `src/ocpp_2_0_1/actions.rs`): one marker type
71/// implementing [`Action`] plus `send_x`/`on_x`/`wait_for_x` convenience methods on
72/// [`OCPP2_1Client`], generated from one macro line per action.
73macro_rules! ocpp_2_1_action {
74    ($name:ident, $req:ty, $res:ty, $action:literal, $send:ident, $on:ident, $wait_for:ident) => {
75        #[doc = concat!("Marker type for the `", $action, "` action.")]
76        pub struct $name;
77
78        impl Action for $name {
79            const NAME: &'static str = $action;
80            type Request = $req;
81            type Response = $res;
82        }
83
84        impl OCPP2_1Client {
85            pub async fn $send(&self, request: $req) -> Result<$res, ClientError<OCPP2_1Error>> {
86                self.call::<$name>(request).await
87            }
88
89            pub async fn $on<F, FF>(&self, callback: F)
90            where
91                F: FnMut($req, Self) -> FF + Send + Sync + 'static,
92                FF: Future<Output = Result<$res, OCPP2_1Error>> + Send,
93            {
94                self.on::<$name, F, FF>(callback).await
95            }
96
97            #[cfg(feature = "test")]
98            pub async fn $wait_for<F, FF>(
99                &self,
100                callback: F,
101            ) -> Result<$req, ClientError<OCPP2_1Error>>
102            where
103                F: FnMut($req, Self) -> FF + Send + Sync + 'static,
104                FF: Future<Output = Result<$res, OCPP2_1Error>> + Send,
105            {
106                self.wait_for::<$name, F, FF>(callback).await
107            }
108        }
109    };
110}
111
112/// Like `ocpp_2_1_action!`, but for OCPP-J 2.1's `SEND` (fire-and-forget) message type
113/// instead of a CALL/CALLRESULT pair: `$payload` is a single struct (e.g.
114/// `NotifyPeriodicEventStream`), not a Request/Response pair, and the generated `$on` callback
115/// returns nothing, since the spec forbids replying to a `SEND`.
116macro_rules! ocpp_2_1_send_action {
117    ($name:ident, $payload:ty, $action:literal, $send:ident, $on:ident) => {
118        #[doc = concat!("Marker type for the `", $action, "` SEND message.")]
119        pub struct $name;
120
121        impl SendAction for $name {
122            const NAME: &'static str = $action;
123            type Payload = $payload;
124        }
125
126        impl OCPP2_1Client {
127            pub async fn $send(&self, payload: $payload) -> Result<(), ClientError<OCPP2_1Error>> {
128                self.send_notification::<$name>(payload).await
129            }
130
131            pub async fn $on<F, FF>(&self, callback: F)
132            where
133                F: FnMut($payload, Self) -> FF + Send + Sync + 'static,
134                FF: Future<Output = ()> + Send,
135            {
136                self.on_notification::<$name, F, FF>(callback).await
137            }
138        }
139    };
140}
141
142ocpp_2_1_action!(
143    AdjustPeriodicEventStream,
144    AdjustPeriodicEventStreamRequest,
145    AdjustPeriodicEventStreamResponse,
146    "AdjustPeriodicEventStream",
147    send_adjust_periodic_event_stream,
148    on_adjust_periodic_event_stream,
149    wait_for_adjust_periodic_event_stream
150);
151ocpp_2_1_action!(
152    AFRRSignal,
153    AFRRSignalRequest,
154    AFRRSignalResponse,
155    "AFRRSignal",
156    send_afrr_signal,
157    on_afrr_signal,
158    wait_for_afrr_signal
159);
160ocpp_2_1_action!(
161    Authorize,
162    AuthorizeRequest,
163    AuthorizeResponse,
164    "Authorize",
165    send_authorize,
166    on_authorize,
167    wait_for_authorize
168);
169ocpp_2_1_action!(
170    BatterySwap,
171    BatterySwapRequest,
172    BatterySwapResponse,
173    "BatterySwap",
174    send_battery_swap,
175    on_battery_swap,
176    wait_for_battery_swap
177);
178ocpp_2_1_action!(
179    BootNotification,
180    BootNotificationRequest,
181    BootNotificationResponse,
182    "BootNotification",
183    send_boot_notification,
184    on_boot_notification,
185    wait_for_boot_notification
186);
187ocpp_2_1_action!(
188    CancelReservation,
189    CancelReservationRequest,
190    CancelReservationResponse,
191    "CancelReservation",
192    send_cancel_reservation,
193    on_cancel_reservation,
194    wait_for_cancel_reservation
195);
196ocpp_2_1_action!(
197    CertificateSigned,
198    CertificateSignedRequest,
199    CertificateSignedResponse,
200    "CertificateSigned",
201    send_certificate_signed,
202    on_certificate_signed,
203    wait_for_certificate_signed
204);
205ocpp_2_1_action!(
206    ChangeAvailability,
207    ChangeAvailabilityRequest,
208    ChangeAvailabilityResponse,
209    "ChangeAvailability",
210    send_change_availability,
211    on_change_availability,
212    wait_for_change_availability
213);
214ocpp_2_1_action!(
215    ChangeTransactionTariff,
216    ChangeTransactionTariffRequest,
217    ChangeTransactionTariffResponse,
218    "ChangeTransactionTariff",
219    send_change_transaction_tariff,
220    on_change_transaction_tariff,
221    wait_for_change_transaction_tariff
222);
223ocpp_2_1_action!(
224    ClearCache,
225    ClearCacheRequest,
226    ClearCacheResponse,
227    "ClearCache",
228    send_clear_cache,
229    on_clear_cache,
230    wait_for_clear_cache
231);
232ocpp_2_1_action!(
233    ClearChargingProfile,
234    ClearChargingProfileRequest,
235    ClearChargingProfileResponse,
236    "ClearChargingProfile",
237    send_clear_charging_profile,
238    on_clear_charging_profile,
239    wait_for_clear_charging_profile
240);
241ocpp_2_1_action!(
242    ClearDERControl,
243    ClearDERControlRequest,
244    ClearDERControlResponse,
245    "ClearDERControl",
246    send_clear_der_control,
247    on_clear_der_control,
248    wait_for_clear_der_control
249);
250ocpp_2_1_action!(
251    ClearDisplayMessage,
252    ClearDisplayMessageRequest,
253    ClearDisplayMessageResponse,
254    "ClearDisplayMessage",
255    send_clear_display_message,
256    on_clear_display_message,
257    wait_for_clear_display_message
258);
259ocpp_2_1_action!(
260    ClearTariffs,
261    ClearTariffsRequest,
262    ClearTariffsResponse,
263    "ClearTariffs",
264    send_clear_tariffs,
265    on_clear_tariffs,
266    wait_for_clear_tariffs
267);
268ocpp_2_1_action!(
269    ClearVariableMonitoring,
270    ClearVariableMonitoringRequest,
271    ClearVariableMonitoringResponse,
272    "ClearVariableMonitoring",
273    send_clear_variable_monitoring,
274    on_clear_variable_monitoring,
275    wait_for_clear_variable_monitoring
276);
277ocpp_2_1_action!(
278    ClearedChargingLimit,
279    ClearedChargingLimitRequest,
280    ClearedChargingLimitResponse,
281    "ClearedChargingLimit",
282    send_cleared_charging_limit,
283    on_cleared_charging_limit,
284    wait_for_cleared_charging_limit
285);
286ocpp_2_1_action!(
287    ClosePeriodicEventStream,
288    ClosePeriodicEventStreamRequest,
289    ClosePeriodicEventStreamResponse,
290    "ClosePeriodicEventStream",
291    send_close_periodic_event_stream,
292    on_close_periodic_event_stream,
293    wait_for_close_periodic_event_stream
294);
295ocpp_2_1_action!(
296    CostUpdated,
297    CostUpdatedRequest,
298    CostUpdatedResponse,
299    "CostUpdated",
300    send_cost_updated,
301    on_cost_updated,
302    wait_for_cost_updated
303);
304ocpp_2_1_action!(
305    CustomerInformation,
306    CustomerInformationRequest,
307    CustomerInformationResponse,
308    "CustomerInformation",
309    send_customer_information,
310    on_customer_information,
311    wait_for_customer_information
312);
313ocpp_2_1_action!(
314    DataTransfer,
315    DataTransferRequest,
316    DataTransferResponse,
317    "DataTransfer",
318    send_data_transfer,
319    on_data_transfer,
320    wait_for_data_transfer
321);
322ocpp_2_1_action!(
323    DeleteCertificate,
324    DeleteCertificateRequest,
325    DeleteCertificateResponse,
326    "DeleteCertificate",
327    send_delete_certificate,
328    on_delete_certificate,
329    wait_for_delete_certificate
330);
331ocpp_2_1_action!(
332    FirmwareStatusNotification,
333    FirmwareStatusNotificationRequest,
334    FirmwareStatusNotificationResponse,
335    "FirmwareStatusNotification",
336    send_firmware_status_notification,
337    on_firmware_status_notification,
338    wait_for_firmware_status_notification
339);
340ocpp_2_1_action!(
341    Get15118EVCertificate,
342    Get15118EVCertificateRequest,
343    Get15118EVCertificateResponse,
344    "Get15118EVCertificate",
345    send_get_15118_ev_certificate,
346    on_get_15118_ev_certificate,
347    wait_for_get_15118_ev_certificate
348);
349ocpp_2_1_action!(
350    GetBaseReport,
351    GetBaseReportRequest,
352    GetBaseReportResponse,
353    "GetBaseReport",
354    send_get_base_report,
355    on_get_base_report,
356    wait_for_get_base_report
357);
358ocpp_2_1_action!(
359    GetCertificateChainStatus,
360    GetCertificateChainStatusRequest,
361    GetCertificateChainStatusResponse,
362    "GetCertificateChainStatus",
363    send_get_certificate_chain_status,
364    on_get_certificate_chain_status,
365    wait_for_get_certificate_chain_status
366);
367ocpp_2_1_action!(
368    GetCertificateStatus,
369    GetCertificateStatusRequest,
370    GetCertificateStatusResponse,
371    "GetCertificateStatus",
372    send_get_certificate_status,
373    on_get_certificate_status,
374    wait_for_get_certificate_status
375);
376ocpp_2_1_action!(
377    GetChargingProfiles,
378    GetChargingProfilesRequest,
379    GetChargingProfilesResponse,
380    "GetChargingProfiles",
381    send_get_charging_profiles,
382    on_get_charging_profiles,
383    wait_for_get_charging_profiles
384);
385ocpp_2_1_action!(
386    GetCompositeSchedule,
387    GetCompositeScheduleRequest,
388    GetCompositeScheduleResponse,
389    "GetCompositeSchedule",
390    send_get_composite_schedule,
391    on_get_composite_schedule,
392    wait_for_get_composite_schedule
393);
394ocpp_2_1_action!(
395    GetDERControl,
396    GetDERControlRequest,
397    GetDERControlResponse,
398    "GetDERControl",
399    send_get_der_control,
400    on_get_der_control,
401    wait_for_get_der_control
402);
403ocpp_2_1_action!(
404    GetDisplayMessages,
405    GetDisplayMessagesRequest,
406    GetDisplayMessagesResponse,
407    "GetDisplayMessages",
408    send_get_display_messages,
409    on_get_display_messages,
410    wait_for_get_display_messages
411);
412ocpp_2_1_action!(
413    GetInstalledCertificateIds,
414    GetInstalledCertificateIdsRequest,
415    GetInstalledCertificateIdsResponse,
416    "GetInstalledCertificateIds",
417    send_get_installed_certificate_ids,
418    on_get_installed_certificate_ids,
419    wait_for_get_installed_certificate_ids
420);
421ocpp_2_1_action!(
422    GetLocalListVersion,
423    GetLocalListVersionRequest,
424    GetLocalListVersionResponse,
425    "GetLocalListVersion",
426    send_get_local_list_version,
427    on_get_local_list_version,
428    wait_for_get_local_list_version
429);
430ocpp_2_1_action!(
431    GetLog,
432    GetLogRequest,
433    GetLogResponse,
434    "GetLog",
435    send_get_log,
436    on_get_log,
437    wait_for_get_log
438);
439ocpp_2_1_action!(
440    GetMonitoringReport,
441    GetMonitoringReportRequest,
442    GetMonitoringReportResponse,
443    "GetMonitoringReport",
444    send_get_monitoring_report,
445    on_get_monitoring_report,
446    wait_for_get_monitoring_report
447);
448ocpp_2_1_action!(
449    GetPeriodicEventStream,
450    GetPeriodicEventStreamRequest,
451    GetPeriodicEventStreamResponse,
452    "GetPeriodicEventStream",
453    send_get_periodic_event_stream,
454    on_get_periodic_event_stream,
455    wait_for_get_periodic_event_stream
456);
457ocpp_2_1_action!(
458    GetReport,
459    GetReportRequest,
460    GetReportResponse,
461    "GetReport",
462    send_get_report,
463    on_get_report,
464    wait_for_get_report
465);
466ocpp_2_1_action!(
467    GetTariffs,
468    GetTariffsRequest,
469    GetTariffsResponse,
470    "GetTariffs",
471    send_get_tariffs,
472    on_get_tariffs,
473    wait_for_get_tariffs
474);
475ocpp_2_1_action!(
476    GetTransactionStatus,
477    GetTransactionStatusRequest,
478    GetTransactionStatusResponse,
479    "GetTransactionStatus",
480    send_get_transaction_status,
481    on_get_transaction_status,
482    wait_for_get_transaction_status
483);
484ocpp_2_1_action!(
485    GetVariables,
486    GetVariablesRequest,
487    GetVariablesResponse,
488    "GetVariables",
489    send_get_variables,
490    on_get_variables,
491    wait_for_get_variables
492);
493ocpp_2_1_action!(
494    Heartbeat,
495    HeartbeatRequest,
496    HeartbeatResponse,
497    "Heartbeat",
498    send_heartbeat,
499    on_heartbeat,
500    wait_for_heartbeat
501);
502ocpp_2_1_action!(
503    InstallCertificate,
504    InstallCertificateRequest,
505    InstallCertificateResponse,
506    "InstallCertificate",
507    send_install_certificate,
508    on_install_certificate,
509    wait_for_install_certificate
510);
511ocpp_2_1_action!(
512    LogStatusNotification,
513    LogStatusNotificationRequest,
514    LogStatusNotificationResponse,
515    "LogStatusNotification",
516    send_log_status_notification,
517    on_log_status_notification,
518    wait_for_log_status_notification
519);
520ocpp_2_1_action!(
521    MeterValues,
522    MeterValuesRequest,
523    MeterValuesResponse,
524    "MeterValues",
525    send_meter_values,
526    on_meter_values,
527    wait_for_meter_values
528);
529ocpp_2_1_action!(
530    NotifyAllowedEnergyTransfer,
531    NotifyAllowedEnergyTransferRequest,
532    NotifyAllowedEnergyTransferResponse,
533    "NotifyAllowedEnergyTransfer",
534    send_notify_allowed_energy_transfer,
535    on_notify_allowed_energy_transfer,
536    wait_for_notify_allowed_energy_transfer
537);
538ocpp_2_1_action!(
539    NotifyChargingLimit,
540    NotifyChargingLimitRequest,
541    NotifyChargingLimitResponse,
542    "NotifyChargingLimit",
543    send_notify_charging_limit,
544    on_notify_charging_limit,
545    wait_for_notify_charging_limit
546);
547ocpp_2_1_action!(
548    NotifyCustomerInformation,
549    NotifyCustomerInformationRequest,
550    NotifyCustomerInformationResponse,
551    "NotifyCustomerInformation",
552    send_notify_customer_information,
553    on_notify_customer_information,
554    wait_for_notify_customer_information
555);
556ocpp_2_1_action!(
557    NotifyDERAlarm,
558    NotifyDERAlarmRequest,
559    NotifyDERAlarmResponse,
560    "NotifyDERAlarm",
561    send_notify_der_alarm,
562    on_notify_der_alarm,
563    wait_for_notify_der_alarm
564);
565ocpp_2_1_action!(
566    NotifyDERStartStop,
567    NotifyDERStartStopRequest,
568    NotifyDERStartStopResponse,
569    "NotifyDERStartStop",
570    send_notify_der_start_stop,
571    on_notify_der_start_stop,
572    wait_for_notify_der_start_stop
573);
574ocpp_2_1_action!(
575    NotifyDisplayMessages,
576    NotifyDisplayMessagesRequest,
577    NotifyDisplayMessagesResponse,
578    "NotifyDisplayMessages",
579    send_notify_display_messages,
580    on_notify_display_messages,
581    wait_for_notify_display_messages
582);
583ocpp_2_1_action!(
584    NotifyEVChargingNeeds,
585    NotifyEVChargingNeedsRequest,
586    NotifyEVChargingNeedsResponse,
587    "NotifyEVChargingNeeds",
588    send_notify_ev_charging_needs,
589    on_notify_ev_charging_needs,
590    wait_for_notify_ev_charging_needs
591);
592ocpp_2_1_action!(
593    NotifyEVChargingSchedule,
594    NotifyEVChargingScheduleRequest,
595    NotifyEVChargingScheduleResponse,
596    "NotifyEVChargingSchedule",
597    send_notify_ev_charging_schedule,
598    on_notify_ev_charging_schedule,
599    wait_for_notify_ev_charging_schedule
600);
601ocpp_2_1_action!(
602    NotifyEvent,
603    NotifyEventRequest,
604    NotifyEventResponse,
605    "NotifyEvent",
606    send_notify_event,
607    on_notify_event,
608    wait_for_notify_event
609);
610ocpp_2_1_action!(
611    NotifyMonitoringReport,
612    NotifyMonitoringReportRequest,
613    NotifyMonitoringReportResponse,
614    "NotifyMonitoringReport",
615    send_notify_monitoring_report,
616    on_notify_monitoring_report,
617    wait_for_notify_monitoring_report
618);
619ocpp_2_1_action!(
620    NotifyReport,
621    NotifyReportRequest,
622    NotifyReportResponse,
623    "NotifyReport",
624    send_notify_report,
625    on_notify_report,
626    wait_for_notify_report
627);
628// `NotifyPeriodicEventStream` is genuinely SEND-only in the OCPP-J 2.1 spec (no CALLRESULT) -
629// `ocpp_types` models it as one struct, not a Request/Response pair, unlike every other action
630// here. Wired up as a real `SEND` (message type 6) via `ocpp_2_1_send_action!`/
631// `Client::send_notification`/`Client::on_notification` - see `src/client.rs`. The marker type
632// is suffixed `Action` to avoid colliding with the imported `NotifyPeriodicEventStream` message
633// type.
634ocpp_2_1_send_action!(
635    NotifyPeriodicEventStreamAction,
636    NotifyPeriodicEventStream,
637    "NotifyPeriodicEventStream",
638    send_notify_periodic_event_stream,
639    on_notify_periodic_event_stream
640);
641ocpp_2_1_action!(
642    NotifyPriorityCharging,
643    NotifyPriorityChargingRequest,
644    NotifyPriorityChargingResponse,
645    "NotifyPriorityCharging",
646    send_notify_priority_charging,
647    on_notify_priority_charging,
648    wait_for_notify_priority_charging
649);
650ocpp_2_1_action!(
651    NotifySettlement,
652    NotifySettlementRequest,
653    NotifySettlementResponse,
654    "NotifySettlement",
655    send_notify_settlement,
656    on_notify_settlement,
657    wait_for_notify_settlement
658);
659ocpp_2_1_action!(
660    NotifyWebPaymentStarted,
661    NotifyWebPaymentStartedRequest,
662    NotifyWebPaymentStartedResponse,
663    "NotifyWebPaymentStarted",
664    send_notify_web_payment_started,
665    on_notify_web_payment_started,
666    wait_for_notify_web_payment_started
667);
668ocpp_2_1_action!(
669    OpenPeriodicEventStream,
670    OpenPeriodicEventStreamRequest,
671    OpenPeriodicEventStreamResponse,
672    "OpenPeriodicEventStream",
673    send_open_periodic_event_stream,
674    on_open_periodic_event_stream,
675    wait_for_open_periodic_event_stream
676);
677ocpp_2_1_action!(
678    PublishFirmware,
679    PublishFirmwareRequest,
680    PublishFirmwareResponse,
681    "PublishFirmware",
682    send_publish_firmware,
683    on_publish_firmware,
684    wait_for_publish_firmware
685);
686ocpp_2_1_action!(
687    PublishFirmwareStatusNotification,
688    PublishFirmwareStatusNotificationRequest,
689    PublishFirmwareStatusNotificationResponse,
690    "PublishFirmwareStatusNotification",
691    send_publish_firmware_status_notification,
692    on_publish_firmware_status_notification,
693    wait_for_publish_firmware_status_notification
694);
695ocpp_2_1_action!(
696    PullDynamicScheduleUpdate,
697    PullDynamicScheduleUpdateRequest,
698    PullDynamicScheduleUpdateResponse,
699    "PullDynamicScheduleUpdate",
700    send_pull_dynamic_schedule_update,
701    on_pull_dynamic_schedule_update,
702    wait_for_pull_dynamic_schedule_update
703);
704ocpp_2_1_action!(
705    ReportChargingProfiles,
706    ReportChargingProfilesRequest,
707    ReportChargingProfilesResponse,
708    "ReportChargingProfiles",
709    send_report_charging_profiles,
710    on_report_charging_profiles,
711    wait_for_report_charging_profiles
712);
713ocpp_2_1_action!(
714    ReportDERControl,
715    ReportDERControlRequest,
716    ReportDERControlResponse,
717    "ReportDERControl",
718    send_report_der_control,
719    on_report_der_control,
720    wait_for_report_der_control
721);
722ocpp_2_1_action!(
723    RequestBatterySwap,
724    RequestBatterySwapRequest,
725    RequestBatterySwapResponse,
726    "RequestBatterySwap",
727    send_request_battery_swap,
728    on_request_battery_swap,
729    wait_for_request_battery_swap
730);
731ocpp_2_1_action!(
732    RequestStartTransaction,
733    RequestStartTransactionRequest,
734    RequestStartTransactionResponse,
735    "RequestStartTransaction",
736    send_request_start_transaction,
737    on_request_start_transaction,
738    wait_for_request_start_transaction
739);
740ocpp_2_1_action!(
741    RequestStopTransaction,
742    RequestStopTransactionRequest,
743    RequestStopTransactionResponse,
744    "RequestStopTransaction",
745    send_request_stop_transaction,
746    on_request_stop_transaction,
747    wait_for_request_stop_transaction
748);
749ocpp_2_1_action!(
750    ReservationStatusUpdate,
751    ReservationStatusUpdateRequest,
752    ReservationStatusUpdateResponse,
753    "ReservationStatusUpdate",
754    send_reservation_status_update,
755    on_reservation_status_update,
756    wait_for_reservation_status_update
757);
758ocpp_2_1_action!(
759    ReserveNow,
760    ReserveNowRequest,
761    ReserveNowResponse,
762    "ReserveNow",
763    send_reserve_now,
764    on_reserve_now,
765    wait_for_reserve_now
766);
767ocpp_2_1_action!(
768    Reset,
769    ResetRequest,
770    ResetResponse,
771    "Reset",
772    send_reset,
773    on_reset,
774    wait_for_reset
775);
776ocpp_2_1_action!(
777    SecurityEventNotification,
778    SecurityEventNotificationRequest,
779    SecurityEventNotificationResponse,
780    "SecurityEventNotification",
781    send_security_event_notification,
782    on_security_event_notification,
783    wait_for_security_event_notification
784);
785ocpp_2_1_action!(
786    SendLocalList,
787    SendLocalListRequest,
788    SendLocalListResponse,
789    "SendLocalList",
790    send_send_local_list,
791    on_send_local_list,
792    wait_for_send_local_list
793);
794ocpp_2_1_action!(
795    SetChargingProfile,
796    SetChargingProfileRequest,
797    SetChargingProfileResponse,
798    "SetChargingProfile",
799    send_set_charging_profile,
800    on_set_charging_profile,
801    wait_for_set_charging_profile
802);
803ocpp_2_1_action!(
804    SetDefaultTariff,
805    SetDefaultTariffRequest,
806    SetDefaultTariffResponse,
807    "SetDefaultTariff",
808    send_set_default_tariff,
809    on_set_default_tariff,
810    wait_for_set_default_tariff
811);
812ocpp_2_1_action!(
813    SetDERControl,
814    SetDERControlRequest,
815    SetDERControlResponse,
816    "SetDERControl",
817    send_set_der_control,
818    on_set_der_control,
819    wait_for_set_der_control
820);
821ocpp_2_1_action!(
822    SetDisplayMessage,
823    SetDisplayMessageRequest,
824    SetDisplayMessageResponse,
825    "SetDisplayMessage",
826    send_set_display_message,
827    on_set_display_message,
828    wait_for_set_display_message
829);
830ocpp_2_1_action!(
831    SetMonitoringBase,
832    SetMonitoringBaseRequest,
833    SetMonitoringBaseResponse,
834    "SetMonitoringBase",
835    send_set_monitoring_base,
836    on_set_monitoring_base,
837    wait_for_set_monitoring_base
838);
839ocpp_2_1_action!(
840    SetMonitoringLevel,
841    SetMonitoringLevelRequest,
842    SetMonitoringLevelResponse,
843    "SetMonitoringLevel",
844    send_set_monitoring_level,
845    on_set_monitoring_level,
846    wait_for_set_monitoring_level
847);
848ocpp_2_1_action!(
849    SetNetworkProfile,
850    SetNetworkProfileRequest,
851    SetNetworkProfileResponse,
852    "SetNetworkProfile",
853    send_set_network_profile,
854    on_set_network_profile,
855    wait_for_set_network_profile
856);
857ocpp_2_1_action!(
858    SetVariableMonitoring,
859    SetVariableMonitoringRequest,
860    SetVariableMonitoringResponse,
861    "SetVariableMonitoring",
862    send_set_variable_monitoring,
863    on_set_variable_monitoring,
864    wait_for_set_variable_monitoring
865);
866ocpp_2_1_action!(
867    SetVariables,
868    SetVariablesRequest,
869    SetVariablesResponse,
870    "SetVariables",
871    send_set_variables,
872    on_set_variables,
873    wait_for_set_variables
874);
875ocpp_2_1_action!(
876    SignCertificate,
877    SignCertificateRequest,
878    SignCertificateResponse,
879    "SignCertificate",
880    send_sign_certificate,
881    on_sign_certificate,
882    wait_for_sign_certificate
883);
884ocpp_2_1_action!(
885    StatusNotification,
886    StatusNotificationRequest,
887    StatusNotificationResponse,
888    "StatusNotification",
889    send_status_notification,
890    on_status_notification,
891    wait_for_status_notification
892);
893ocpp_2_1_action!(
894    TransactionEvent,
895    TransactionEventRequest,
896    TransactionEventResponse,
897    "TransactionEvent",
898    send_transaction_event,
899    on_transaction_event,
900    wait_for_transaction_event
901);
902ocpp_2_1_action!(
903    TriggerMessage,
904    TriggerMessageRequest,
905    TriggerMessageResponse,
906    "TriggerMessage",
907    send_trigger_message,
908    on_trigger_message,
909    wait_for_trigger_message
910);
911ocpp_2_1_action!(
912    UnlockConnector,
913    UnlockConnectorRequest,
914    UnlockConnectorResponse,
915    "UnlockConnector",
916    send_unlock_connector,
917    on_unlock_connector,
918    wait_for_unlock_connector
919);
920ocpp_2_1_action!(
921    UnpublishFirmware,
922    UnpublishFirmwareRequest,
923    UnpublishFirmwareResponse,
924    "UnpublishFirmware",
925    send_unpublish_firmware,
926    on_unpublish_firmware,
927    wait_for_unpublish_firmware
928);
929ocpp_2_1_action!(
930    UpdateDynamicSchedule,
931    UpdateDynamicScheduleRequest,
932    UpdateDynamicScheduleResponse,
933    "UpdateDynamicSchedule",
934    send_update_dynamic_schedule,
935    on_update_dynamic_schedule,
936    wait_for_update_dynamic_schedule
937);
938ocpp_2_1_action!(
939    UpdateFirmware,
940    UpdateFirmwareRequest,
941    UpdateFirmwareResponse,
942    "UpdateFirmware",
943    send_update_firmware,
944    on_update_firmware,
945    wait_for_update_firmware
946);
947ocpp_2_1_action!(
948    UsePriorityCharging,
949    UsePriorityChargingRequest,
950    UsePriorityChargingResponse,
951    "UsePriorityCharging",
952    send_use_priority_charging,
953    on_use_priority_charging,
954    wait_for_use_priority_charging
955);
956ocpp_2_1_action!(
957    VatNumberValidation,
958    VatNumberValidationRequest,
959    VatNumberValidationResponse,
960    "VatNumberValidation",
961    send_vat_number_validation,
962    on_vat_number_validation,
963    wait_for_vat_number_validation
964);