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