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