1#![allow(unused_imports, clippy::doc_markdown, clippy::struct_excessive_bools)]
7#![allow(
8 clippy::too_many_lines,
9 clippy::too_many_arguments,
10 clippy::wildcard_imports
11)]
12#![allow(clippy::match_same_arms, clippy::fn_params_excessive_bools)]
13
14use alloc::string::String;
15use alloc::vec::Vec;
16
17use serde::{Deserialize, Serialize};
18
19use super::messages::*;
20use crate::decode::{DecodeError, DecodeOptions};
21use crate::message::{MessageKind, Origin};
22use crate::validate::{Validate, ValidationPath, Violations};
23use serde_json::value::RawValue;
24
25#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
29#[non_exhaustive]
30pub enum Action {
31 AFRRSignal,
33 AdjustPeriodicEventStream,
35 Authorize,
37 BatterySwap,
39 BootNotification,
41 CancelReservation,
43 CertificateSigned,
45 ChangeAvailability,
47 ChangeTransactionTariff,
49 ClearCache,
51 ClearChargingProfile,
53 ClearDERControl,
55 ClearDisplayMessage,
57 ClearTariffs,
59 ClearVariableMonitoring,
61 ClearedChargingLimit,
63 ClosePeriodicEventStream,
65 CostUpdated,
67 CustomerInformation,
69 DataTransfer,
71 DeleteCertificate,
73 FirmwareStatusNotification,
75 Get15118EVCertificate,
77 GetBaseReport,
79 GetCertificateChainStatus,
81 GetCertificateStatus,
83 GetChargingProfiles,
85 GetCompositeSchedule,
87 GetDERControl,
89 GetDisplayMessages,
91 GetInstalledCertificateIds,
93 GetLocalListVersion,
95 GetLog,
97 GetMonitoringReport,
99 GetPeriodicEventStream,
101 GetReport,
103 GetTariffs,
105 GetTransactionStatus,
107 GetVariables,
109 Heartbeat,
111 InstallCertificate,
113 LogStatusNotification,
115 MeterValues,
117 NotifyAllowedEnergyTransfer,
119 NotifyChargingLimit,
121 NotifyCustomerInformation,
123 NotifyDERAlarm,
125 NotifyDERStartStop,
127 NotifyDisplayMessages,
129 NotifyEVChargingNeeds,
131 NotifyEVChargingSchedule,
133 NotifyEvent,
135 NotifyMonitoringReport,
137 NotifyPeriodicEventStream,
139 NotifyPriorityCharging,
141 NotifyReport,
143 NotifySettlement,
145 NotifyWebPaymentStarted,
147 OpenPeriodicEventStream,
149 PublishFirmware,
151 PublishFirmwareStatusNotification,
153 PullDynamicScheduleUpdate,
155 ReportChargingProfiles,
157 ReportDERControl,
159 RequestBatterySwap,
161 RequestStartTransaction,
163 RequestStopTransaction,
165 ReservationStatusUpdate,
167 ReserveNow,
169 Reset,
171 SecurityEventNotification,
173 SendLocalList,
175 SetChargingProfile,
177 SetDERControl,
179 SetDefaultTariff,
181 SetDisplayMessage,
183 SetMonitoringBase,
185 SetMonitoringLevel,
187 SetNetworkProfile,
189 SetVariableMonitoring,
191 SetVariables,
193 SignCertificate,
195 StatusNotification,
197 TransactionEvent,
199 TriggerMessage,
201 UnlockConnector,
203 UnpublishFirmware,
205 UpdateDynamicSchedule,
207 UpdateFirmware,
209 UsePriorityCharging,
211 VatNumberValidation,
213}
214
215impl Action {
216 pub const ALL: &'static [Action] = &[
218 Action::AFRRSignal,
219 Action::AdjustPeriodicEventStream,
220 Action::Authorize,
221 Action::BatterySwap,
222 Action::BootNotification,
223 Action::CancelReservation,
224 Action::CertificateSigned,
225 Action::ChangeAvailability,
226 Action::ChangeTransactionTariff,
227 Action::ClearCache,
228 Action::ClearChargingProfile,
229 Action::ClearDERControl,
230 Action::ClearDisplayMessage,
231 Action::ClearTariffs,
232 Action::ClearVariableMonitoring,
233 Action::ClearedChargingLimit,
234 Action::ClosePeriodicEventStream,
235 Action::CostUpdated,
236 Action::CustomerInformation,
237 Action::DataTransfer,
238 Action::DeleteCertificate,
239 Action::FirmwareStatusNotification,
240 Action::Get15118EVCertificate,
241 Action::GetBaseReport,
242 Action::GetCertificateChainStatus,
243 Action::GetCertificateStatus,
244 Action::GetChargingProfiles,
245 Action::GetCompositeSchedule,
246 Action::GetDERControl,
247 Action::GetDisplayMessages,
248 Action::GetInstalledCertificateIds,
249 Action::GetLocalListVersion,
250 Action::GetLog,
251 Action::GetMonitoringReport,
252 Action::GetPeriodicEventStream,
253 Action::GetReport,
254 Action::GetTariffs,
255 Action::GetTransactionStatus,
256 Action::GetVariables,
257 Action::Heartbeat,
258 Action::InstallCertificate,
259 Action::LogStatusNotification,
260 Action::MeterValues,
261 Action::NotifyAllowedEnergyTransfer,
262 Action::NotifyChargingLimit,
263 Action::NotifyCustomerInformation,
264 Action::NotifyDERAlarm,
265 Action::NotifyDERStartStop,
266 Action::NotifyDisplayMessages,
267 Action::NotifyEVChargingNeeds,
268 Action::NotifyEVChargingSchedule,
269 Action::NotifyEvent,
270 Action::NotifyMonitoringReport,
271 Action::NotifyPeriodicEventStream,
272 Action::NotifyPriorityCharging,
273 Action::NotifyReport,
274 Action::NotifySettlement,
275 Action::NotifyWebPaymentStarted,
276 Action::OpenPeriodicEventStream,
277 Action::PublishFirmware,
278 Action::PublishFirmwareStatusNotification,
279 Action::PullDynamicScheduleUpdate,
280 Action::ReportChargingProfiles,
281 Action::ReportDERControl,
282 Action::RequestBatterySwap,
283 Action::RequestStartTransaction,
284 Action::RequestStopTransaction,
285 Action::ReservationStatusUpdate,
286 Action::ReserveNow,
287 Action::Reset,
288 Action::SecurityEventNotification,
289 Action::SendLocalList,
290 Action::SetChargingProfile,
291 Action::SetDERControl,
292 Action::SetDefaultTariff,
293 Action::SetDisplayMessage,
294 Action::SetMonitoringBase,
295 Action::SetMonitoringLevel,
296 Action::SetNetworkProfile,
297 Action::SetVariableMonitoring,
298 Action::SetVariables,
299 Action::SignCertificate,
300 Action::StatusNotification,
301 Action::TransactionEvent,
302 Action::TriggerMessage,
303 Action::UnlockConnector,
304 Action::UnpublishFirmware,
305 Action::UpdateDynamicSchedule,
306 Action::UpdateFirmware,
307 Action::UsePriorityCharging,
308 Action::VatNumberValidation,
309 ];
310
311 #[must_use]
313 pub const fn as_str(self) -> &'static str {
314 match self {
315 Action::AFRRSignal => "AFRRSignal",
316 Action::AdjustPeriodicEventStream => "AdjustPeriodicEventStream",
317 Action::Authorize => "Authorize",
318 Action::BatterySwap => "BatterySwap",
319 Action::BootNotification => "BootNotification",
320 Action::CancelReservation => "CancelReservation",
321 Action::CertificateSigned => "CertificateSigned",
322 Action::ChangeAvailability => "ChangeAvailability",
323 Action::ChangeTransactionTariff => "ChangeTransactionTariff",
324 Action::ClearCache => "ClearCache",
325 Action::ClearChargingProfile => "ClearChargingProfile",
326 Action::ClearDERControl => "ClearDERControl",
327 Action::ClearDisplayMessage => "ClearDisplayMessage",
328 Action::ClearTariffs => "ClearTariffs",
329 Action::ClearVariableMonitoring => "ClearVariableMonitoring",
330 Action::ClearedChargingLimit => "ClearedChargingLimit",
331 Action::ClosePeriodicEventStream => "ClosePeriodicEventStream",
332 Action::CostUpdated => "CostUpdated",
333 Action::CustomerInformation => "CustomerInformation",
334 Action::DataTransfer => "DataTransfer",
335 Action::DeleteCertificate => "DeleteCertificate",
336 Action::FirmwareStatusNotification => "FirmwareStatusNotification",
337 Action::Get15118EVCertificate => "Get15118EVCertificate",
338 Action::GetBaseReport => "GetBaseReport",
339 Action::GetCertificateChainStatus => "GetCertificateChainStatus",
340 Action::GetCertificateStatus => "GetCertificateStatus",
341 Action::GetChargingProfiles => "GetChargingProfiles",
342 Action::GetCompositeSchedule => "GetCompositeSchedule",
343 Action::GetDERControl => "GetDERControl",
344 Action::GetDisplayMessages => "GetDisplayMessages",
345 Action::GetInstalledCertificateIds => "GetInstalledCertificateIds",
346 Action::GetLocalListVersion => "GetLocalListVersion",
347 Action::GetLog => "GetLog",
348 Action::GetMonitoringReport => "GetMonitoringReport",
349 Action::GetPeriodicEventStream => "GetPeriodicEventStream",
350 Action::GetReport => "GetReport",
351 Action::GetTariffs => "GetTariffs",
352 Action::GetTransactionStatus => "GetTransactionStatus",
353 Action::GetVariables => "GetVariables",
354 Action::Heartbeat => "Heartbeat",
355 Action::InstallCertificate => "InstallCertificate",
356 Action::LogStatusNotification => "LogStatusNotification",
357 Action::MeterValues => "MeterValues",
358 Action::NotifyAllowedEnergyTransfer => "NotifyAllowedEnergyTransfer",
359 Action::NotifyChargingLimit => "NotifyChargingLimit",
360 Action::NotifyCustomerInformation => "NotifyCustomerInformation",
361 Action::NotifyDERAlarm => "NotifyDERAlarm",
362 Action::NotifyDERStartStop => "NotifyDERStartStop",
363 Action::NotifyDisplayMessages => "NotifyDisplayMessages",
364 Action::NotifyEVChargingNeeds => "NotifyEVChargingNeeds",
365 Action::NotifyEVChargingSchedule => "NotifyEVChargingSchedule",
366 Action::NotifyEvent => "NotifyEvent",
367 Action::NotifyMonitoringReport => "NotifyMonitoringReport",
368 Action::NotifyPeriodicEventStream => "NotifyPeriodicEventStream",
369 Action::NotifyPriorityCharging => "NotifyPriorityCharging",
370 Action::NotifyReport => "NotifyReport",
371 Action::NotifySettlement => "NotifySettlement",
372 Action::NotifyWebPaymentStarted => "NotifyWebPaymentStarted",
373 Action::OpenPeriodicEventStream => "OpenPeriodicEventStream",
374 Action::PublishFirmware => "PublishFirmware",
375 Action::PublishFirmwareStatusNotification => "PublishFirmwareStatusNotification",
376 Action::PullDynamicScheduleUpdate => "PullDynamicScheduleUpdate",
377 Action::ReportChargingProfiles => "ReportChargingProfiles",
378 Action::ReportDERControl => "ReportDERControl",
379 Action::RequestBatterySwap => "RequestBatterySwap",
380 Action::RequestStartTransaction => "RequestStartTransaction",
381 Action::RequestStopTransaction => "RequestStopTransaction",
382 Action::ReservationStatusUpdate => "ReservationStatusUpdate",
383 Action::ReserveNow => "ReserveNow",
384 Action::Reset => "Reset",
385 Action::SecurityEventNotification => "SecurityEventNotification",
386 Action::SendLocalList => "SendLocalList",
387 Action::SetChargingProfile => "SetChargingProfile",
388 Action::SetDERControl => "SetDERControl",
389 Action::SetDefaultTariff => "SetDefaultTariff",
390 Action::SetDisplayMessage => "SetDisplayMessage",
391 Action::SetMonitoringBase => "SetMonitoringBase",
392 Action::SetMonitoringLevel => "SetMonitoringLevel",
393 Action::SetNetworkProfile => "SetNetworkProfile",
394 Action::SetVariableMonitoring => "SetVariableMonitoring",
395 Action::SetVariables => "SetVariables",
396 Action::SignCertificate => "SignCertificate",
397 Action::StatusNotification => "StatusNotification",
398 Action::TransactionEvent => "TransactionEvent",
399 Action::TriggerMessage => "TriggerMessage",
400 Action::UnlockConnector => "UnlockConnector",
401 Action::UnpublishFirmware => "UnpublishFirmware",
402 Action::UpdateDynamicSchedule => "UpdateDynamicSchedule",
403 Action::UpdateFirmware => "UpdateFirmware",
404 Action::UsePriorityCharging => "UsePriorityCharging",
405 Action::VatNumberValidation => "VatNumberValidation",
406 }
407 }
408
409 #[must_use]
411 pub fn from_wire(name: &str) -> Option<Self> {
412 Some(match name {
413 "AFRRSignal" => Action::AFRRSignal,
414 "AdjustPeriodicEventStream" => Action::AdjustPeriodicEventStream,
415 "Authorize" => Action::Authorize,
416 "BatterySwap" => Action::BatterySwap,
417 "BootNotification" => Action::BootNotification,
418 "CancelReservation" => Action::CancelReservation,
419 "CertificateSigned" => Action::CertificateSigned,
420 "ChangeAvailability" => Action::ChangeAvailability,
421 "ChangeTransactionTariff" => Action::ChangeTransactionTariff,
422 "ClearCache" => Action::ClearCache,
423 "ClearChargingProfile" => Action::ClearChargingProfile,
424 "ClearDERControl" => Action::ClearDERControl,
425 "ClearDisplayMessage" => Action::ClearDisplayMessage,
426 "ClearTariffs" => Action::ClearTariffs,
427 "ClearVariableMonitoring" => Action::ClearVariableMonitoring,
428 "ClearedChargingLimit" => Action::ClearedChargingLimit,
429 "ClosePeriodicEventStream" => Action::ClosePeriodicEventStream,
430 "CostUpdated" => Action::CostUpdated,
431 "CustomerInformation" => Action::CustomerInformation,
432 "DataTransfer" => Action::DataTransfer,
433 "DeleteCertificate" => Action::DeleteCertificate,
434 "FirmwareStatusNotification" => Action::FirmwareStatusNotification,
435 "Get15118EVCertificate" => Action::Get15118EVCertificate,
436 "GetBaseReport" => Action::GetBaseReport,
437 "GetCertificateChainStatus" => Action::GetCertificateChainStatus,
438 "GetCertificateStatus" => Action::GetCertificateStatus,
439 "GetChargingProfiles" => Action::GetChargingProfiles,
440 "GetCompositeSchedule" => Action::GetCompositeSchedule,
441 "GetDERControl" => Action::GetDERControl,
442 "GetDisplayMessages" => Action::GetDisplayMessages,
443 "GetInstalledCertificateIds" => Action::GetInstalledCertificateIds,
444 "GetLocalListVersion" => Action::GetLocalListVersion,
445 "GetLog" => Action::GetLog,
446 "GetMonitoringReport" => Action::GetMonitoringReport,
447 "GetPeriodicEventStream" => Action::GetPeriodicEventStream,
448 "GetReport" => Action::GetReport,
449 "GetTariffs" => Action::GetTariffs,
450 "GetTransactionStatus" => Action::GetTransactionStatus,
451 "GetVariables" => Action::GetVariables,
452 "Heartbeat" => Action::Heartbeat,
453 "InstallCertificate" => Action::InstallCertificate,
454 "LogStatusNotification" => Action::LogStatusNotification,
455 "MeterValues" => Action::MeterValues,
456 "NotifyAllowedEnergyTransfer" => Action::NotifyAllowedEnergyTransfer,
457 "NotifyChargingLimit" => Action::NotifyChargingLimit,
458 "NotifyCustomerInformation" => Action::NotifyCustomerInformation,
459 "NotifyDERAlarm" => Action::NotifyDERAlarm,
460 "NotifyDERStartStop" => Action::NotifyDERStartStop,
461 "NotifyDisplayMessages" => Action::NotifyDisplayMessages,
462 "NotifyEVChargingNeeds" => Action::NotifyEVChargingNeeds,
463 "NotifyEVChargingSchedule" => Action::NotifyEVChargingSchedule,
464 "NotifyEvent" => Action::NotifyEvent,
465 "NotifyMonitoringReport" => Action::NotifyMonitoringReport,
466 "NotifyPeriodicEventStream" => Action::NotifyPeriodicEventStream,
467 "NotifyPriorityCharging" => Action::NotifyPriorityCharging,
468 "NotifyReport" => Action::NotifyReport,
469 "NotifySettlement" => Action::NotifySettlement,
470 "NotifyWebPaymentStarted" => Action::NotifyWebPaymentStarted,
471 "OpenPeriodicEventStream" => Action::OpenPeriodicEventStream,
472 "PublishFirmware" => Action::PublishFirmware,
473 "PublishFirmwareStatusNotification" => Action::PublishFirmwareStatusNotification,
474 "PullDynamicScheduleUpdate" => Action::PullDynamicScheduleUpdate,
475 "ReportChargingProfiles" => Action::ReportChargingProfiles,
476 "ReportDERControl" => Action::ReportDERControl,
477 "RequestBatterySwap" => Action::RequestBatterySwap,
478 "RequestStartTransaction" => Action::RequestStartTransaction,
479 "RequestStopTransaction" => Action::RequestStopTransaction,
480 "ReservationStatusUpdate" => Action::ReservationStatusUpdate,
481 "ReserveNow" => Action::ReserveNow,
482 "Reset" => Action::Reset,
483 "SecurityEventNotification" => Action::SecurityEventNotification,
484 "SendLocalList" => Action::SendLocalList,
485 "SetChargingProfile" => Action::SetChargingProfile,
486 "SetDERControl" => Action::SetDERControl,
487 "SetDefaultTariff" => Action::SetDefaultTariff,
488 "SetDisplayMessage" => Action::SetDisplayMessage,
489 "SetMonitoringBase" => Action::SetMonitoringBase,
490 "SetMonitoringLevel" => Action::SetMonitoringLevel,
491 "SetNetworkProfile" => Action::SetNetworkProfile,
492 "SetVariableMonitoring" => Action::SetVariableMonitoring,
493 "SetVariables" => Action::SetVariables,
494 "SignCertificate" => Action::SignCertificate,
495 "StatusNotification" => Action::StatusNotification,
496 "TransactionEvent" => Action::TransactionEvent,
497 "TriggerMessage" => Action::TriggerMessage,
498 "UnlockConnector" => Action::UnlockConnector,
499 "UnpublishFirmware" => Action::UnpublishFirmware,
500 "UpdateDynamicSchedule" => Action::UpdateDynamicSchedule,
501 "UpdateFirmware" => Action::UpdateFirmware,
502 "UsePriorityCharging" => Action::UsePriorityCharging,
503 "VatNumberValidation" => Action::VatNumberValidation,
504 _ => return None,
505 })
506 }
507
508 #[must_use]
510 pub const fn kind(self) -> MessageKind {
511 match self {
512 Action::NotifyPeriodicEventStream => MessageKind::Send,
513 _ => MessageKind::Call,
514 }
515 }
516
517 #[must_use]
519 pub const fn origin(self) -> Origin {
520 match self {
521 Action::AFRRSignal => Origin::Csms,
522 Action::AdjustPeriodicEventStream => Origin::Csms,
523 Action::Authorize => Origin::ChargingStation,
524 Action::BatterySwap => Origin::ChargingStation,
525 Action::BootNotification => Origin::ChargingStation,
526 Action::CancelReservation => Origin::Csms,
527 Action::CertificateSigned => Origin::Csms,
528 Action::ChangeAvailability => Origin::Csms,
529 Action::ChangeTransactionTariff => Origin::Csms,
530 Action::ClearCache => Origin::Csms,
531 Action::ClearChargingProfile => Origin::Csms,
532 Action::ClearDERControl => Origin::Csms,
533 Action::ClearDisplayMessage => Origin::Csms,
534 Action::ClearTariffs => Origin::Csms,
535 Action::ClearVariableMonitoring => Origin::Csms,
536 Action::ClearedChargingLimit => Origin::ChargingStation,
537 Action::ClosePeriodicEventStream => Origin::ChargingStation,
538 Action::CostUpdated => Origin::Csms,
539 Action::CustomerInformation => Origin::Csms,
540 Action::DataTransfer => Origin::Both,
541 Action::DeleteCertificate => Origin::Csms,
542 Action::FirmwareStatusNotification => Origin::ChargingStation,
543 Action::Get15118EVCertificate => Origin::ChargingStation,
544 Action::GetBaseReport => Origin::Csms,
545 Action::GetCertificateChainStatus => Origin::ChargingStation,
546 Action::GetCertificateStatus => Origin::ChargingStation,
547 Action::GetChargingProfiles => Origin::Csms,
548 Action::GetCompositeSchedule => Origin::Csms,
549 Action::GetDERControl => Origin::Csms,
550 Action::GetDisplayMessages => Origin::Csms,
551 Action::GetInstalledCertificateIds => Origin::Csms,
552 Action::GetLocalListVersion => Origin::Csms,
553 Action::GetLog => Origin::Csms,
554 Action::GetMonitoringReport => Origin::Csms,
555 Action::GetPeriodicEventStream => Origin::Csms,
556 Action::GetReport => Origin::Csms,
557 Action::GetTariffs => Origin::Csms,
558 Action::GetTransactionStatus => Origin::Csms,
559 Action::GetVariables => Origin::Csms,
560 Action::Heartbeat => Origin::ChargingStation,
561 Action::InstallCertificate => Origin::Csms,
562 Action::LogStatusNotification => Origin::ChargingStation,
563 Action::MeterValues => Origin::ChargingStation,
564 Action::NotifyAllowedEnergyTransfer => Origin::Csms,
565 Action::NotifyChargingLimit => Origin::ChargingStation,
566 Action::NotifyCustomerInformation => Origin::ChargingStation,
567 Action::NotifyDERAlarm => Origin::ChargingStation,
568 Action::NotifyDERStartStop => Origin::ChargingStation,
569 Action::NotifyDisplayMessages => Origin::ChargingStation,
570 Action::NotifyEVChargingNeeds => Origin::ChargingStation,
571 Action::NotifyEVChargingSchedule => Origin::ChargingStation,
572 Action::NotifyEvent => Origin::ChargingStation,
573 Action::NotifyMonitoringReport => Origin::ChargingStation,
574 Action::NotifyPeriodicEventStream => Origin::ChargingStation,
575 Action::NotifyPriorityCharging => Origin::ChargingStation,
576 Action::NotifyReport => Origin::ChargingStation,
577 Action::NotifySettlement => Origin::ChargingStation,
578 Action::NotifyWebPaymentStarted => Origin::Csms,
579 Action::OpenPeriodicEventStream => Origin::ChargingStation,
580 Action::PublishFirmware => Origin::Csms,
581 Action::PublishFirmwareStatusNotification => Origin::ChargingStation,
582 Action::PullDynamicScheduleUpdate => Origin::ChargingStation,
583 Action::ReportChargingProfiles => Origin::ChargingStation,
584 Action::ReportDERControl => Origin::ChargingStation,
585 Action::RequestBatterySwap => Origin::Csms,
586 Action::RequestStartTransaction => Origin::Csms,
587 Action::RequestStopTransaction => Origin::Csms,
588 Action::ReservationStatusUpdate => Origin::ChargingStation,
589 Action::ReserveNow => Origin::Csms,
590 Action::Reset => Origin::Csms,
591 Action::SecurityEventNotification => Origin::ChargingStation,
592 Action::SendLocalList => Origin::Csms,
593 Action::SetChargingProfile => Origin::Csms,
594 Action::SetDERControl => Origin::Csms,
595 Action::SetDefaultTariff => Origin::Csms,
596 Action::SetDisplayMessage => Origin::Csms,
597 Action::SetMonitoringBase => Origin::Csms,
598 Action::SetMonitoringLevel => Origin::Csms,
599 Action::SetNetworkProfile => Origin::Csms,
600 Action::SetVariableMonitoring => Origin::Csms,
601 Action::SetVariables => Origin::Csms,
602 Action::SignCertificate => Origin::ChargingStation,
603 Action::StatusNotification => Origin::ChargingStation,
604 Action::TransactionEvent => Origin::ChargingStation,
605 Action::TriggerMessage => Origin::Csms,
606 Action::UnlockConnector => Origin::Csms,
607 Action::UnpublishFirmware => Origin::Csms,
608 Action::UpdateDynamicSchedule => Origin::Csms,
609 Action::UpdateFirmware => Origin::Csms,
610 Action::UsePriorityCharging => Origin::Csms,
611 Action::VatNumberValidation => Origin::ChargingStation,
612 }
613 }
614
615 #[must_use]
617 pub const fn block(self) -> &'static str {
618 match self {
619 Action::AFRRSignal => "Q",
620 Action::AdjustPeriodicEventStream => "N",
621 Action::Authorize => "C",
622 Action::BatterySwap => "S",
623 Action::BootNotification => "B",
624 Action::CancelReservation => "H",
625 Action::CertificateSigned => "A",
626 Action::ChangeAvailability => "G",
627 Action::ChangeTransactionTariff => "I",
628 Action::ClearCache => "C",
629 Action::ClearChargingProfile => "K",
630 Action::ClearDERControl => "R",
631 Action::ClearDisplayMessage => "O",
632 Action::ClearTariffs => "I",
633 Action::ClearVariableMonitoring => "N",
634 Action::ClearedChargingLimit => "K",
635 Action::ClosePeriodicEventStream => "N",
636 Action::CostUpdated => "I",
637 Action::CustomerInformation => "N",
638 Action::DataTransfer => "P",
639 Action::DeleteCertificate => "M",
640 Action::FirmwareStatusNotification => "L",
641 Action::Get15118EVCertificate => "M",
642 Action::GetBaseReport => "B",
643 Action::GetCertificateChainStatus => "M",
644 Action::GetCertificateStatus => "M",
645 Action::GetChargingProfiles => "K",
646 Action::GetCompositeSchedule => "K",
647 Action::GetDERControl => "R",
648 Action::GetDisplayMessages => "O",
649 Action::GetInstalledCertificateIds => "M",
650 Action::GetLocalListVersion => "D",
651 Action::GetLog => "N",
652 Action::GetMonitoringReport => "N",
653 Action::GetPeriodicEventStream => "N",
654 Action::GetReport => "B",
655 Action::GetTariffs => "I",
656 Action::GetTransactionStatus => "E",
657 Action::GetVariables => "B",
658 Action::Heartbeat => "G",
659 Action::InstallCertificate => "M",
660 Action::LogStatusNotification => "N",
661 Action::MeterValues => "J",
662 Action::NotifyAllowedEnergyTransfer => "Q",
663 Action::NotifyChargingLimit => "K",
664 Action::NotifyCustomerInformation => "N",
665 Action::NotifyDERAlarm => "R",
666 Action::NotifyDERStartStop => "R",
667 Action::NotifyDisplayMessages => "O",
668 Action::NotifyEVChargingNeeds => "K",
669 Action::NotifyEVChargingSchedule => "K",
670 Action::NotifyEvent => "N",
671 Action::NotifyMonitoringReport => "N",
672 Action::NotifyPeriodicEventStream => "N",
673 Action::NotifyPriorityCharging => "K",
674 Action::NotifyReport => "B",
675 Action::NotifySettlement => "C",
676 Action::NotifyWebPaymentStarted => "C",
677 Action::OpenPeriodicEventStream => "N",
678 Action::PublishFirmware => "L",
679 Action::PublishFirmwareStatusNotification => "L",
680 Action::PullDynamicScheduleUpdate => "K",
681 Action::ReportChargingProfiles => "K",
682 Action::ReportDERControl => "R",
683 Action::RequestBatterySwap => "S",
684 Action::RequestStartTransaction => "F",
685 Action::RequestStopTransaction => "F",
686 Action::ReservationStatusUpdate => "H",
687 Action::ReserveNow => "H",
688 Action::Reset => "B",
689 Action::SecurityEventNotification => "A",
690 Action::SendLocalList => "D",
691 Action::SetChargingProfile => "K",
692 Action::SetDERControl => "R",
693 Action::SetDefaultTariff => "I",
694 Action::SetDisplayMessage => "O",
695 Action::SetMonitoringBase => "N",
696 Action::SetMonitoringLevel => "N",
697 Action::SetNetworkProfile => "B",
698 Action::SetVariableMonitoring => "N",
699 Action::SetVariables => "B",
700 Action::SignCertificate => "A",
701 Action::StatusNotification => "G",
702 Action::TransactionEvent => "E",
703 Action::TriggerMessage => "F",
704 Action::UnlockConnector => "F",
705 Action::UnpublishFirmware => "L",
706 Action::UpdateDynamicSchedule => "K",
707 Action::UpdateFirmware => "L",
708 Action::UsePriorityCharging => "K",
709 Action::VatNumberValidation => "C",
710 }
711 }
712}
713
714impl crate::message::ActionName for Action {
715 fn all() -> &'static [Self] {
716 Self::ALL
717 }
718 fn as_str(&self) -> &'static str {
719 Action::as_str(*self)
720 }
721 fn from_wire(name: &str) -> Option<Self> {
722 Action::from_wire(name)
723 }
724 fn kind(&self) -> MessageKind {
725 Action::kind(*self)
726 }
727 fn origin(&self) -> Origin {
728 Action::origin(*self)
729 }
730 fn block(&self) -> &'static str {
731 Action::block(*self)
732 }
733}
734
735impl core::fmt::Display for Action {
736 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
737 f.write_str(self.as_str())
738 }
739}
740
741impl core::str::FromStr for Action {
742 type Err = crate::message::UnknownAction;
743 fn from_str(s: &str) -> Result<Self, Self::Err> {
744 Self::from_wire(s).ok_or(crate::message::UnknownAction)
745 }
746}
747
748impl Serialize for Action {
749 fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
750 ser.serialize_str(self.as_str())
751 }
752}
753
754impl<'de> Deserialize<'de> for Action {
755 fn deserialize<D: serde::Deserializer<'de>>(de: D) -> Result<Self, D::Error> {
756 let s = <&str as Deserialize>::deserialize(de)?;
757 Self::from_wire(s).ok_or_else(|| serde::de::Error::custom("unknown OCPP action"))
758 }
759}
760
761impl Action {
762 #[must_use]
766 pub const fn has_response(self) -> bool {
767 matches!(self.kind(), MessageKind::Call)
768 }
769}
770
771pub fn transcode_request(
777 action: Action,
778 payload: &RawValue,
779 options: &DecodeOptions,
780) -> Result<alloc::boxed::Box<RawValue>, DecodeError> {
781 match action {
782 Action::AFRRSignal => crate::decode::transcode::<AFRRSignalRequest>(payload, options),
783 Action::AdjustPeriodicEventStream => {
784 crate::decode::transcode::<AdjustPeriodicEventStreamRequest>(payload, options)
785 }
786 Action::Authorize => crate::decode::transcode::<AuthorizeRequest>(payload, options),
787 Action::BatterySwap => crate::decode::transcode::<BatterySwapRequest>(payload, options),
788 Action::BootNotification => {
789 crate::decode::transcode::<BootNotificationRequest>(payload, options)
790 }
791 Action::CancelReservation => {
792 crate::decode::transcode::<CancelReservationRequest>(payload, options)
793 }
794 Action::CertificateSigned => {
795 crate::decode::transcode::<CertificateSignedRequest>(payload, options)
796 }
797 Action::ChangeAvailability => {
798 crate::decode::transcode::<ChangeAvailabilityRequest>(payload, options)
799 }
800 Action::ChangeTransactionTariff => {
801 crate::decode::transcode::<ChangeTransactionTariffRequest>(payload, options)
802 }
803 Action::ClearCache => crate::decode::transcode::<ClearCacheRequest>(payload, options),
804 Action::ClearChargingProfile => {
805 crate::decode::transcode::<ClearChargingProfileRequest>(payload, options)
806 }
807 Action::ClearDERControl => {
808 crate::decode::transcode::<ClearDERControlRequest>(payload, options)
809 }
810 Action::ClearDisplayMessage => {
811 crate::decode::transcode::<ClearDisplayMessageRequest>(payload, options)
812 }
813 Action::ClearTariffs => crate::decode::transcode::<ClearTariffsRequest>(payload, options),
814 Action::ClearVariableMonitoring => {
815 crate::decode::transcode::<ClearVariableMonitoringRequest>(payload, options)
816 }
817 Action::ClearedChargingLimit => {
818 crate::decode::transcode::<ClearedChargingLimitRequest>(payload, options)
819 }
820 Action::ClosePeriodicEventStream => {
821 crate::decode::transcode::<ClosePeriodicEventStreamRequest>(payload, options)
822 }
823 Action::CostUpdated => crate::decode::transcode::<CostUpdatedRequest>(payload, options),
824 Action::CustomerInformation => {
825 crate::decode::transcode::<CustomerInformationRequest>(payload, options)
826 }
827 Action::DataTransfer => crate::decode::transcode::<DataTransferRequest>(payload, options),
828 Action::DeleteCertificate => {
829 crate::decode::transcode::<DeleteCertificateRequest>(payload, options)
830 }
831 Action::FirmwareStatusNotification => {
832 crate::decode::transcode::<FirmwareStatusNotificationRequest>(payload, options)
833 }
834 Action::Get15118EVCertificate => {
835 crate::decode::transcode::<Get15118EVCertificateRequest>(payload, options)
836 }
837 Action::GetBaseReport => crate::decode::transcode::<GetBaseReportRequest>(payload, options),
838 Action::GetCertificateChainStatus => {
839 crate::decode::transcode::<GetCertificateChainStatusRequest>(payload, options)
840 }
841 Action::GetCertificateStatus => {
842 crate::decode::transcode::<GetCertificateStatusRequest>(payload, options)
843 }
844 Action::GetChargingProfiles => {
845 crate::decode::transcode::<GetChargingProfilesRequest>(payload, options)
846 }
847 Action::GetCompositeSchedule => {
848 crate::decode::transcode::<GetCompositeScheduleRequest>(payload, options)
849 }
850 Action::GetDERControl => crate::decode::transcode::<GetDERControlRequest>(payload, options),
851 Action::GetDisplayMessages => {
852 crate::decode::transcode::<GetDisplayMessagesRequest>(payload, options)
853 }
854 Action::GetInstalledCertificateIds => {
855 crate::decode::transcode::<GetInstalledCertificateIdsRequest>(payload, options)
856 }
857 Action::GetLocalListVersion => {
858 crate::decode::transcode::<GetLocalListVersionRequest>(payload, options)
859 }
860 Action::GetLog => crate::decode::transcode::<GetLogRequest>(payload, options),
861 Action::GetMonitoringReport => {
862 crate::decode::transcode::<GetMonitoringReportRequest>(payload, options)
863 }
864 Action::GetPeriodicEventStream => {
865 crate::decode::transcode::<GetPeriodicEventStreamRequest>(payload, options)
866 }
867 Action::GetReport => crate::decode::transcode::<GetReportRequest>(payload, options),
868 Action::GetTariffs => crate::decode::transcode::<GetTariffsRequest>(payload, options),
869 Action::GetTransactionStatus => {
870 crate::decode::transcode::<GetTransactionStatusRequest>(payload, options)
871 }
872 Action::GetVariables => crate::decode::transcode::<GetVariablesRequest>(payload, options),
873 Action::Heartbeat => crate::decode::transcode::<HeartbeatRequest>(payload, options),
874 Action::InstallCertificate => {
875 crate::decode::transcode::<InstallCertificateRequest>(payload, options)
876 }
877 Action::LogStatusNotification => {
878 crate::decode::transcode::<LogStatusNotificationRequest>(payload, options)
879 }
880 Action::MeterValues => crate::decode::transcode::<MeterValuesRequest>(payload, options),
881 Action::NotifyAllowedEnergyTransfer => {
882 crate::decode::transcode::<NotifyAllowedEnergyTransferRequest>(payload, options)
883 }
884 Action::NotifyChargingLimit => {
885 crate::decode::transcode::<NotifyChargingLimitRequest>(payload, options)
886 }
887 Action::NotifyCustomerInformation => {
888 crate::decode::transcode::<NotifyCustomerInformationRequest>(payload, options)
889 }
890 Action::NotifyDERAlarm => {
891 crate::decode::transcode::<NotifyDERAlarmRequest>(payload, options)
892 }
893 Action::NotifyDERStartStop => {
894 crate::decode::transcode::<NotifyDERStartStopRequest>(payload, options)
895 }
896 Action::NotifyDisplayMessages => {
897 crate::decode::transcode::<NotifyDisplayMessagesRequest>(payload, options)
898 }
899 Action::NotifyEVChargingNeeds => {
900 crate::decode::transcode::<NotifyEVChargingNeedsRequest>(payload, options)
901 }
902 Action::NotifyEVChargingSchedule => {
903 crate::decode::transcode::<NotifyEVChargingScheduleRequest>(payload, options)
904 }
905 Action::NotifyEvent => crate::decode::transcode::<NotifyEventRequest>(payload, options),
906 Action::NotifyMonitoringReport => {
907 crate::decode::transcode::<NotifyMonitoringReportRequest>(payload, options)
908 }
909 Action::NotifyPeriodicEventStream => {
910 crate::decode::transcode::<NotifyPeriodicEventStreamRequest>(payload, options)
911 }
912 Action::NotifyPriorityCharging => {
913 crate::decode::transcode::<NotifyPriorityChargingRequest>(payload, options)
914 }
915 Action::NotifyReport => crate::decode::transcode::<NotifyReportRequest>(payload, options),
916 Action::NotifySettlement => {
917 crate::decode::transcode::<NotifySettlementRequest>(payload, options)
918 }
919 Action::NotifyWebPaymentStarted => {
920 crate::decode::transcode::<NotifyWebPaymentStartedRequest>(payload, options)
921 }
922 Action::OpenPeriodicEventStream => {
923 crate::decode::transcode::<OpenPeriodicEventStreamRequest>(payload, options)
924 }
925 Action::PublishFirmware => {
926 crate::decode::transcode::<PublishFirmwareRequest>(payload, options)
927 }
928 Action::PublishFirmwareStatusNotification => {
929 crate::decode::transcode::<PublishFirmwareStatusNotificationRequest>(payload, options)
930 }
931 Action::PullDynamicScheduleUpdate => {
932 crate::decode::transcode::<PullDynamicScheduleUpdateRequest>(payload, options)
933 }
934 Action::ReportChargingProfiles => {
935 crate::decode::transcode::<ReportChargingProfilesRequest>(payload, options)
936 }
937 Action::ReportDERControl => {
938 crate::decode::transcode::<ReportDERControlRequest>(payload, options)
939 }
940 Action::RequestBatterySwap => {
941 crate::decode::transcode::<RequestBatterySwapRequest>(payload, options)
942 }
943 Action::RequestStartTransaction => {
944 crate::decode::transcode::<RequestStartTransactionRequest>(payload, options)
945 }
946 Action::RequestStopTransaction => {
947 crate::decode::transcode::<RequestStopTransactionRequest>(payload, options)
948 }
949 Action::ReservationStatusUpdate => {
950 crate::decode::transcode::<ReservationStatusUpdateRequest>(payload, options)
951 }
952 Action::ReserveNow => crate::decode::transcode::<ReserveNowRequest>(payload, options),
953 Action::Reset => crate::decode::transcode::<ResetRequest>(payload, options),
954 Action::SecurityEventNotification => {
955 crate::decode::transcode::<SecurityEventNotificationRequest>(payload, options)
956 }
957 Action::SendLocalList => crate::decode::transcode::<SendLocalListRequest>(payload, options),
958 Action::SetChargingProfile => {
959 crate::decode::transcode::<SetChargingProfileRequest>(payload, options)
960 }
961 Action::SetDERControl => crate::decode::transcode::<SetDERControlRequest>(payload, options),
962 Action::SetDefaultTariff => {
963 crate::decode::transcode::<SetDefaultTariffRequest>(payload, options)
964 }
965 Action::SetDisplayMessage => {
966 crate::decode::transcode::<SetDisplayMessageRequest>(payload, options)
967 }
968 Action::SetMonitoringBase => {
969 crate::decode::transcode::<SetMonitoringBaseRequest>(payload, options)
970 }
971 Action::SetMonitoringLevel => {
972 crate::decode::transcode::<SetMonitoringLevelRequest>(payload, options)
973 }
974 Action::SetNetworkProfile => {
975 crate::decode::transcode::<SetNetworkProfileRequest>(payload, options)
976 }
977 Action::SetVariableMonitoring => {
978 crate::decode::transcode::<SetVariableMonitoringRequest>(payload, options)
979 }
980 Action::SetVariables => crate::decode::transcode::<SetVariablesRequest>(payload, options),
981 Action::SignCertificate => {
982 crate::decode::transcode::<SignCertificateRequest>(payload, options)
983 }
984 Action::StatusNotification => {
985 crate::decode::transcode::<StatusNotificationRequest>(payload, options)
986 }
987 Action::TransactionEvent => {
988 crate::decode::transcode::<TransactionEventRequest>(payload, options)
989 }
990 Action::TriggerMessage => {
991 crate::decode::transcode::<TriggerMessageRequest>(payload, options)
992 }
993 Action::UnlockConnector => {
994 crate::decode::transcode::<UnlockConnectorRequest>(payload, options)
995 }
996 Action::UnpublishFirmware => {
997 crate::decode::transcode::<UnpublishFirmwareRequest>(payload, options)
998 }
999 Action::UpdateDynamicSchedule => {
1000 crate::decode::transcode::<UpdateDynamicScheduleRequest>(payload, options)
1001 }
1002 Action::UpdateFirmware => {
1003 crate::decode::transcode::<UpdateFirmwareRequest>(payload, options)
1004 }
1005 Action::UsePriorityCharging => {
1006 crate::decode::transcode::<UsePriorityChargingRequest>(payload, options)
1007 }
1008 Action::VatNumberValidation => {
1009 crate::decode::transcode::<VatNumberValidationRequest>(payload, options)
1010 }
1011 }
1012}
1013
1014pub fn transcode_response(
1018 action: Action,
1019 payload: &RawValue,
1020 options: &DecodeOptions,
1021) -> Result<alloc::boxed::Box<RawValue>, DecodeError> {
1022 match action {
1023 Action::AFRRSignal => crate::decode::transcode::<AFRRSignalResponse>(payload, options),
1024 Action::AdjustPeriodicEventStream => {
1025 crate::decode::transcode::<AdjustPeriodicEventStreamResponse>(payload, options)
1026 }
1027 Action::Authorize => crate::decode::transcode::<AuthorizeResponse>(payload, options),
1028 Action::BatterySwap => crate::decode::transcode::<BatterySwapResponse>(payload, options),
1029 Action::BootNotification => {
1030 crate::decode::transcode::<BootNotificationResponse>(payload, options)
1031 }
1032 Action::CancelReservation => {
1033 crate::decode::transcode::<CancelReservationResponse>(payload, options)
1034 }
1035 Action::CertificateSigned => {
1036 crate::decode::transcode::<CertificateSignedResponse>(payload, options)
1037 }
1038 Action::ChangeAvailability => {
1039 crate::decode::transcode::<ChangeAvailabilityResponse>(payload, options)
1040 }
1041 Action::ChangeTransactionTariff => {
1042 crate::decode::transcode::<ChangeTransactionTariffResponse>(payload, options)
1043 }
1044 Action::ClearCache => crate::decode::transcode::<ClearCacheResponse>(payload, options),
1045 Action::ClearChargingProfile => {
1046 crate::decode::transcode::<ClearChargingProfileResponse>(payload, options)
1047 }
1048 Action::ClearDERControl => {
1049 crate::decode::transcode::<ClearDERControlResponse>(payload, options)
1050 }
1051 Action::ClearDisplayMessage => {
1052 crate::decode::transcode::<ClearDisplayMessageResponse>(payload, options)
1053 }
1054 Action::ClearTariffs => crate::decode::transcode::<ClearTariffsResponse>(payload, options),
1055 Action::ClearVariableMonitoring => {
1056 crate::decode::transcode::<ClearVariableMonitoringResponse>(payload, options)
1057 }
1058 Action::ClearedChargingLimit => {
1059 crate::decode::transcode::<ClearedChargingLimitResponse>(payload, options)
1060 }
1061 Action::ClosePeriodicEventStream => {
1062 crate::decode::transcode::<ClosePeriodicEventStreamResponse>(payload, options)
1063 }
1064 Action::CostUpdated => crate::decode::transcode::<CostUpdatedResponse>(payload, options),
1065 Action::CustomerInformation => {
1066 crate::decode::transcode::<CustomerInformationResponse>(payload, options)
1067 }
1068 Action::DataTransfer => crate::decode::transcode::<DataTransferResponse>(payload, options),
1069 Action::DeleteCertificate => {
1070 crate::decode::transcode::<DeleteCertificateResponse>(payload, options)
1071 }
1072 Action::FirmwareStatusNotification => {
1073 crate::decode::transcode::<FirmwareStatusNotificationResponse>(payload, options)
1074 }
1075 Action::Get15118EVCertificate => {
1076 crate::decode::transcode::<Get15118EVCertificateResponse>(payload, options)
1077 }
1078 Action::GetBaseReport => {
1079 crate::decode::transcode::<GetBaseReportResponse>(payload, options)
1080 }
1081 Action::GetCertificateChainStatus => {
1082 crate::decode::transcode::<GetCertificateChainStatusResponse>(payload, options)
1083 }
1084 Action::GetCertificateStatus => {
1085 crate::decode::transcode::<GetCertificateStatusResponse>(payload, options)
1086 }
1087 Action::GetChargingProfiles => {
1088 crate::decode::transcode::<GetChargingProfilesResponse>(payload, options)
1089 }
1090 Action::GetCompositeSchedule => {
1091 crate::decode::transcode::<GetCompositeScheduleResponse>(payload, options)
1092 }
1093 Action::GetDERControl => {
1094 crate::decode::transcode::<GetDERControlResponse>(payload, options)
1095 }
1096 Action::GetDisplayMessages => {
1097 crate::decode::transcode::<GetDisplayMessagesResponse>(payload, options)
1098 }
1099 Action::GetInstalledCertificateIds => {
1100 crate::decode::transcode::<GetInstalledCertificateIdsResponse>(payload, options)
1101 }
1102 Action::GetLocalListVersion => {
1103 crate::decode::transcode::<GetLocalListVersionResponse>(payload, options)
1104 }
1105 Action::GetLog => crate::decode::transcode::<GetLogResponse>(payload, options),
1106 Action::GetMonitoringReport => {
1107 crate::decode::transcode::<GetMonitoringReportResponse>(payload, options)
1108 }
1109 Action::GetPeriodicEventStream => {
1110 crate::decode::transcode::<GetPeriodicEventStreamResponse>(payload, options)
1111 }
1112 Action::GetReport => crate::decode::transcode::<GetReportResponse>(payload, options),
1113 Action::GetTariffs => crate::decode::transcode::<GetTariffsResponse>(payload, options),
1114 Action::GetTransactionStatus => {
1115 crate::decode::transcode::<GetTransactionStatusResponse>(payload, options)
1116 }
1117 Action::GetVariables => crate::decode::transcode::<GetVariablesResponse>(payload, options),
1118 Action::Heartbeat => crate::decode::transcode::<HeartbeatResponse>(payload, options),
1119 Action::InstallCertificate => {
1120 crate::decode::transcode::<InstallCertificateResponse>(payload, options)
1121 }
1122 Action::LogStatusNotification => {
1123 crate::decode::transcode::<LogStatusNotificationResponse>(payload, options)
1124 }
1125 Action::MeterValues => crate::decode::transcode::<MeterValuesResponse>(payload, options),
1126 Action::NotifyAllowedEnergyTransfer => {
1127 crate::decode::transcode::<NotifyAllowedEnergyTransferResponse>(payload, options)
1128 }
1129 Action::NotifyChargingLimit => {
1130 crate::decode::transcode::<NotifyChargingLimitResponse>(payload, options)
1131 }
1132 Action::NotifyCustomerInformation => {
1133 crate::decode::transcode::<NotifyCustomerInformationResponse>(payload, options)
1134 }
1135 Action::NotifyDERAlarm => {
1136 crate::decode::transcode::<NotifyDERAlarmResponse>(payload, options)
1137 }
1138 Action::NotifyDERStartStop => {
1139 crate::decode::transcode::<NotifyDERStartStopResponse>(payload, options)
1140 }
1141 Action::NotifyDisplayMessages => {
1142 crate::decode::transcode::<NotifyDisplayMessagesResponse>(payload, options)
1143 }
1144 Action::NotifyEVChargingNeeds => {
1145 crate::decode::transcode::<NotifyEVChargingNeedsResponse>(payload, options)
1146 }
1147 Action::NotifyEVChargingSchedule => {
1148 crate::decode::transcode::<NotifyEVChargingScheduleResponse>(payload, options)
1149 }
1150 Action::NotifyEvent => crate::decode::transcode::<NotifyEventResponse>(payload, options),
1151 Action::NotifyMonitoringReport => {
1152 crate::decode::transcode::<NotifyMonitoringReportResponse>(payload, options)
1153 }
1154 Action::NotifyPeriodicEventStream => {
1155 Err(DecodeError::unsupported_action("NotifyPeriodicEventStream"))
1156 }
1157 Action::NotifyPriorityCharging => {
1158 crate::decode::transcode::<NotifyPriorityChargingResponse>(payload, options)
1159 }
1160 Action::NotifyReport => crate::decode::transcode::<NotifyReportResponse>(payload, options),
1161 Action::NotifySettlement => {
1162 crate::decode::transcode::<NotifySettlementResponse>(payload, options)
1163 }
1164 Action::NotifyWebPaymentStarted => {
1165 crate::decode::transcode::<NotifyWebPaymentStartedResponse>(payload, options)
1166 }
1167 Action::OpenPeriodicEventStream => {
1168 crate::decode::transcode::<OpenPeriodicEventStreamResponse>(payload, options)
1169 }
1170 Action::PublishFirmware => {
1171 crate::decode::transcode::<PublishFirmwareResponse>(payload, options)
1172 }
1173 Action::PublishFirmwareStatusNotification => {
1174 crate::decode::transcode::<PublishFirmwareStatusNotificationResponse>(payload, options)
1175 }
1176 Action::PullDynamicScheduleUpdate => {
1177 crate::decode::transcode::<PullDynamicScheduleUpdateResponse>(payload, options)
1178 }
1179 Action::ReportChargingProfiles => {
1180 crate::decode::transcode::<ReportChargingProfilesResponse>(payload, options)
1181 }
1182 Action::ReportDERControl => {
1183 crate::decode::transcode::<ReportDERControlResponse>(payload, options)
1184 }
1185 Action::RequestBatterySwap => {
1186 crate::decode::transcode::<RequestBatterySwapResponse>(payload, options)
1187 }
1188 Action::RequestStartTransaction => {
1189 crate::decode::transcode::<RequestStartTransactionResponse>(payload, options)
1190 }
1191 Action::RequestStopTransaction => {
1192 crate::decode::transcode::<RequestStopTransactionResponse>(payload, options)
1193 }
1194 Action::ReservationStatusUpdate => {
1195 crate::decode::transcode::<ReservationStatusUpdateResponse>(payload, options)
1196 }
1197 Action::ReserveNow => crate::decode::transcode::<ReserveNowResponse>(payload, options),
1198 Action::Reset => crate::decode::transcode::<ResetResponse>(payload, options),
1199 Action::SecurityEventNotification => {
1200 crate::decode::transcode::<SecurityEventNotificationResponse>(payload, options)
1201 }
1202 Action::SendLocalList => {
1203 crate::decode::transcode::<SendLocalListResponse>(payload, options)
1204 }
1205 Action::SetChargingProfile => {
1206 crate::decode::transcode::<SetChargingProfileResponse>(payload, options)
1207 }
1208 Action::SetDERControl => {
1209 crate::decode::transcode::<SetDERControlResponse>(payload, options)
1210 }
1211 Action::SetDefaultTariff => {
1212 crate::decode::transcode::<SetDefaultTariffResponse>(payload, options)
1213 }
1214 Action::SetDisplayMessage => {
1215 crate::decode::transcode::<SetDisplayMessageResponse>(payload, options)
1216 }
1217 Action::SetMonitoringBase => {
1218 crate::decode::transcode::<SetMonitoringBaseResponse>(payload, options)
1219 }
1220 Action::SetMonitoringLevel => {
1221 crate::decode::transcode::<SetMonitoringLevelResponse>(payload, options)
1222 }
1223 Action::SetNetworkProfile => {
1224 crate::decode::transcode::<SetNetworkProfileResponse>(payload, options)
1225 }
1226 Action::SetVariableMonitoring => {
1227 crate::decode::transcode::<SetVariableMonitoringResponse>(payload, options)
1228 }
1229 Action::SetVariables => crate::decode::transcode::<SetVariablesResponse>(payload, options),
1230 Action::SignCertificate => {
1231 crate::decode::transcode::<SignCertificateResponse>(payload, options)
1232 }
1233 Action::StatusNotification => {
1234 crate::decode::transcode::<StatusNotificationResponse>(payload, options)
1235 }
1236 Action::TransactionEvent => {
1237 crate::decode::transcode::<TransactionEventResponse>(payload, options)
1238 }
1239 Action::TriggerMessage => {
1240 crate::decode::transcode::<TriggerMessageResponse>(payload, options)
1241 }
1242 Action::UnlockConnector => {
1243 crate::decode::transcode::<UnlockConnectorResponse>(payload, options)
1244 }
1245 Action::UnpublishFirmware => {
1246 crate::decode::transcode::<UnpublishFirmwareResponse>(payload, options)
1247 }
1248 Action::UpdateDynamicSchedule => {
1249 crate::decode::transcode::<UpdateDynamicScheduleResponse>(payload, options)
1250 }
1251 Action::UpdateFirmware => {
1252 crate::decode::transcode::<UpdateFirmwareResponse>(payload, options)
1253 }
1254 Action::UsePriorityCharging => {
1255 crate::decode::transcode::<UsePriorityChargingResponse>(payload, options)
1256 }
1257 Action::VatNumberValidation => {
1258 crate::decode::transcode::<VatNumberValidationResponse>(payload, options)
1259 }
1260 }
1261}
1262
1263#[derive(Clone, Debug, PartialEq)]
1265#[non_exhaustive]
1266#[allow(clippy::large_enum_variant)]
1267pub enum CsRequest {
1268 Authorize(AuthorizeRequest),
1270 BatterySwap(BatterySwapRequest),
1272 BootNotification(BootNotificationRequest),
1274 ClearedChargingLimit(ClearedChargingLimitRequest),
1276 ClosePeriodicEventStream(ClosePeriodicEventStreamRequest),
1278 DataTransfer(DataTransferRequest),
1280 FirmwareStatusNotification(FirmwareStatusNotificationRequest),
1282 Get15118EVCertificate(Get15118EVCertificateRequest),
1284 GetCertificateChainStatus(GetCertificateChainStatusRequest),
1286 GetCertificateStatus(GetCertificateStatusRequest),
1288 Heartbeat(HeartbeatRequest),
1290 LogStatusNotification(LogStatusNotificationRequest),
1292 MeterValues(MeterValuesRequest),
1294 NotifyChargingLimit(NotifyChargingLimitRequest),
1296 NotifyCustomerInformation(NotifyCustomerInformationRequest),
1298 NotifyDERAlarm(NotifyDERAlarmRequest),
1300 NotifyDERStartStop(NotifyDERStartStopRequest),
1302 NotifyDisplayMessages(NotifyDisplayMessagesRequest),
1304 NotifyEVChargingNeeds(NotifyEVChargingNeedsRequest),
1306 NotifyEVChargingSchedule(NotifyEVChargingScheduleRequest),
1308 NotifyEvent(NotifyEventRequest),
1310 NotifyMonitoringReport(NotifyMonitoringReportRequest),
1312 NotifyPeriodicEventStream(NotifyPeriodicEventStreamRequest),
1314 NotifyPriorityCharging(NotifyPriorityChargingRequest),
1316 NotifyReport(NotifyReportRequest),
1318 NotifySettlement(NotifySettlementRequest),
1320 OpenPeriodicEventStream(OpenPeriodicEventStreamRequest),
1322 PublishFirmwareStatusNotification(PublishFirmwareStatusNotificationRequest),
1324 PullDynamicScheduleUpdate(PullDynamicScheduleUpdateRequest),
1326 ReportChargingProfiles(ReportChargingProfilesRequest),
1328 ReportDERControl(ReportDERControlRequest),
1330 ReservationStatusUpdate(ReservationStatusUpdateRequest),
1332 SecurityEventNotification(SecurityEventNotificationRequest),
1334 SignCertificate(SignCertificateRequest),
1336 StatusNotification(StatusNotificationRequest),
1338 TransactionEvent(TransactionEventRequest),
1340 VatNumberValidation(VatNumberValidationRequest),
1342}
1343
1344impl CsRequest {
1345 #[must_use]
1347 pub const fn action(&self) -> Action {
1348 match self {
1349 Self::Authorize(_) => Action::Authorize,
1350 Self::BatterySwap(_) => Action::BatterySwap,
1351 Self::BootNotification(_) => Action::BootNotification,
1352 Self::ClearedChargingLimit(_) => Action::ClearedChargingLimit,
1353 Self::ClosePeriodicEventStream(_) => Action::ClosePeriodicEventStream,
1354 Self::DataTransfer(_) => Action::DataTransfer,
1355 Self::FirmwareStatusNotification(_) => Action::FirmwareStatusNotification,
1356 Self::Get15118EVCertificate(_) => Action::Get15118EVCertificate,
1357 Self::GetCertificateChainStatus(_) => Action::GetCertificateChainStatus,
1358 Self::GetCertificateStatus(_) => Action::GetCertificateStatus,
1359 Self::Heartbeat(_) => Action::Heartbeat,
1360 Self::LogStatusNotification(_) => Action::LogStatusNotification,
1361 Self::MeterValues(_) => Action::MeterValues,
1362 Self::NotifyChargingLimit(_) => Action::NotifyChargingLimit,
1363 Self::NotifyCustomerInformation(_) => Action::NotifyCustomerInformation,
1364 Self::NotifyDERAlarm(_) => Action::NotifyDERAlarm,
1365 Self::NotifyDERStartStop(_) => Action::NotifyDERStartStop,
1366 Self::NotifyDisplayMessages(_) => Action::NotifyDisplayMessages,
1367 Self::NotifyEVChargingNeeds(_) => Action::NotifyEVChargingNeeds,
1368 Self::NotifyEVChargingSchedule(_) => Action::NotifyEVChargingSchedule,
1369 Self::NotifyEvent(_) => Action::NotifyEvent,
1370 Self::NotifyMonitoringReport(_) => Action::NotifyMonitoringReport,
1371 Self::NotifyPeriodicEventStream(_) => Action::NotifyPeriodicEventStream,
1372 Self::NotifyPriorityCharging(_) => Action::NotifyPriorityCharging,
1373 Self::NotifyReport(_) => Action::NotifyReport,
1374 Self::NotifySettlement(_) => Action::NotifySettlement,
1375 Self::OpenPeriodicEventStream(_) => Action::OpenPeriodicEventStream,
1376 Self::PublishFirmwareStatusNotification(_) => Action::PublishFirmwareStatusNotification,
1377 Self::PullDynamicScheduleUpdate(_) => Action::PullDynamicScheduleUpdate,
1378 Self::ReportChargingProfiles(_) => Action::ReportChargingProfiles,
1379 Self::ReportDERControl(_) => Action::ReportDERControl,
1380 Self::ReservationStatusUpdate(_) => Action::ReservationStatusUpdate,
1381 Self::SecurityEventNotification(_) => Action::SecurityEventNotification,
1382 Self::SignCertificate(_) => Action::SignCertificate,
1383 Self::StatusNotification(_) => Action::StatusNotification,
1384 Self::TransactionEvent(_) => Action::TransactionEvent,
1385 Self::VatNumberValidation(_) => Action::VatNumberValidation,
1386 }
1387 }
1388
1389 pub fn decode(
1392 action: Action,
1393 payload: &RawValue,
1394 options: &DecodeOptions,
1395 ) -> Result<Self, DecodeError> {
1396 Ok(match action {
1397 Action::Authorize => Self::Authorize(
1398 crate::decode::decode_payload::<AuthorizeRequest>(payload, options)?,
1399 ),
1400 Action::BatterySwap => Self::BatterySwap(crate::decode::decode_payload::<
1401 BatterySwapRequest,
1402 >(payload, options)?),
1403 Action::BootNotification => Self::BootNotification(crate::decode::decode_payload::<
1404 BootNotificationRequest,
1405 >(payload, options)?),
1406 Action::ClearedChargingLimit => {
1407 Self::ClearedChargingLimit(crate::decode::decode_payload::<
1408 ClearedChargingLimitRequest,
1409 >(payload, options)?)
1410 }
1411 Action::ClosePeriodicEventStream => {
1412 Self::ClosePeriodicEventStream(crate::decode::decode_payload::<
1413 ClosePeriodicEventStreamRequest,
1414 >(payload, options)?)
1415 }
1416 Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
1417 DataTransferRequest,
1418 >(payload, options)?),
1419 Action::FirmwareStatusNotification => {
1420 Self::FirmwareStatusNotification(crate::decode::decode_payload::<
1421 FirmwareStatusNotificationRequest,
1422 >(payload, options)?)
1423 }
1424 Action::Get15118EVCertificate => {
1425 Self::Get15118EVCertificate(crate::decode::decode_payload::<
1426 Get15118EVCertificateRequest,
1427 >(payload, options)?)
1428 }
1429 Action::GetCertificateChainStatus => {
1430 Self::GetCertificateChainStatus(crate::decode::decode_payload::<
1431 GetCertificateChainStatusRequest,
1432 >(payload, options)?)
1433 }
1434 Action::GetCertificateStatus => {
1435 Self::GetCertificateStatus(crate::decode::decode_payload::<
1436 GetCertificateStatusRequest,
1437 >(payload, options)?)
1438 }
1439 Action::Heartbeat => Self::Heartbeat(
1440 crate::decode::decode_payload::<HeartbeatRequest>(payload, options)?,
1441 ),
1442 Action::LogStatusNotification => {
1443 Self::LogStatusNotification(crate::decode::decode_payload::<
1444 LogStatusNotificationRequest,
1445 >(payload, options)?)
1446 }
1447 Action::MeterValues => Self::MeterValues(crate::decode::decode_payload::<
1448 MeterValuesRequest,
1449 >(payload, options)?),
1450 Action::NotifyChargingLimit => {
1451 Self::NotifyChargingLimit(crate::decode::decode_payload::<
1452 NotifyChargingLimitRequest,
1453 >(payload, options)?)
1454 }
1455 Action::NotifyCustomerInformation => {
1456 Self::NotifyCustomerInformation(crate::decode::decode_payload::<
1457 NotifyCustomerInformationRequest,
1458 >(payload, options)?)
1459 }
1460 Action::NotifyDERAlarm => Self::NotifyDERAlarm(crate::decode::decode_payload::<
1461 NotifyDERAlarmRequest,
1462 >(payload, options)?),
1463 Action::NotifyDERStartStop => Self::NotifyDERStartStop(
1464 crate::decode::decode_payload::<NotifyDERStartStopRequest>(payload, options)?,
1465 ),
1466 Action::NotifyDisplayMessages => {
1467 Self::NotifyDisplayMessages(crate::decode::decode_payload::<
1468 NotifyDisplayMessagesRequest,
1469 >(payload, options)?)
1470 }
1471 Action::NotifyEVChargingNeeds => {
1472 Self::NotifyEVChargingNeeds(crate::decode::decode_payload::<
1473 NotifyEVChargingNeedsRequest,
1474 >(payload, options)?)
1475 }
1476 Action::NotifyEVChargingSchedule => {
1477 Self::NotifyEVChargingSchedule(crate::decode::decode_payload::<
1478 NotifyEVChargingScheduleRequest,
1479 >(payload, options)?)
1480 }
1481 Action::NotifyEvent => Self::NotifyEvent(crate::decode::decode_payload::<
1482 NotifyEventRequest,
1483 >(payload, options)?),
1484 Action::NotifyMonitoringReport => {
1485 Self::NotifyMonitoringReport(crate::decode::decode_payload::<
1486 NotifyMonitoringReportRequest,
1487 >(payload, options)?)
1488 }
1489 Action::NotifyPeriodicEventStream => {
1490 Self::NotifyPeriodicEventStream(crate::decode::decode_payload::<
1491 NotifyPeriodicEventStreamRequest,
1492 >(payload, options)?)
1493 }
1494 Action::NotifyPriorityCharging => {
1495 Self::NotifyPriorityCharging(crate::decode::decode_payload::<
1496 NotifyPriorityChargingRequest,
1497 >(payload, options)?)
1498 }
1499 Action::NotifyReport => Self::NotifyReport(crate::decode::decode_payload::<
1500 NotifyReportRequest,
1501 >(payload, options)?),
1502 Action::NotifySettlement => Self::NotifySettlement(crate::decode::decode_payload::<
1503 NotifySettlementRequest,
1504 >(payload, options)?),
1505 Action::OpenPeriodicEventStream => {
1506 Self::OpenPeriodicEventStream(crate::decode::decode_payload::<
1507 OpenPeriodicEventStreamRequest,
1508 >(payload, options)?)
1509 }
1510 Action::PublishFirmwareStatusNotification => {
1511 Self::PublishFirmwareStatusNotification(crate::decode::decode_payload::<
1512 PublishFirmwareStatusNotificationRequest,
1513 >(payload, options)?)
1514 }
1515 Action::PullDynamicScheduleUpdate => {
1516 Self::PullDynamicScheduleUpdate(crate::decode::decode_payload::<
1517 PullDynamicScheduleUpdateRequest,
1518 >(payload, options)?)
1519 }
1520 Action::ReportChargingProfiles => {
1521 Self::ReportChargingProfiles(crate::decode::decode_payload::<
1522 ReportChargingProfilesRequest,
1523 >(payload, options)?)
1524 }
1525 Action::ReportDERControl => Self::ReportDERControl(crate::decode::decode_payload::<
1526 ReportDERControlRequest,
1527 >(payload, options)?),
1528 Action::ReservationStatusUpdate => {
1529 Self::ReservationStatusUpdate(crate::decode::decode_payload::<
1530 ReservationStatusUpdateRequest,
1531 >(payload, options)?)
1532 }
1533 Action::SecurityEventNotification => {
1534 Self::SecurityEventNotification(crate::decode::decode_payload::<
1535 SecurityEventNotificationRequest,
1536 >(payload, options)?)
1537 }
1538 Action::SignCertificate => Self::SignCertificate(crate::decode::decode_payload::<
1539 SignCertificateRequest,
1540 >(payload, options)?),
1541 Action::StatusNotification => Self::StatusNotification(
1542 crate::decode::decode_payload::<StatusNotificationRequest>(payload, options)?,
1543 ),
1544 Action::TransactionEvent => Self::TransactionEvent(crate::decode::decode_payload::<
1545 TransactionEventRequest,
1546 >(payload, options)?),
1547 Action::VatNumberValidation => {
1548 Self::VatNumberValidation(crate::decode::decode_payload::<
1549 VatNumberValidationRequest,
1550 >(payload, options)?)
1551 }
1552 other => return Err(DecodeError::unsupported_action(other.as_str())),
1553 })
1554 }
1555
1556 pub fn decode_reporting(
1559 action: Action,
1560 payload: &RawValue,
1561 options: &DecodeOptions,
1562 ) -> Result<crate::decode::Decoded<Self>, DecodeError> {
1563 Ok(match action {
1564 Action::Authorize => {
1565 crate::decode::decode_payload_reporting::<AuthorizeRequest>(payload, options)?
1566 .map(Self::Authorize)
1567 }
1568 Action::BatterySwap => {
1569 crate::decode::decode_payload_reporting::<BatterySwapRequest>(payload, options)?
1570 .map(Self::BatterySwap)
1571 }
1572 Action::BootNotification => crate::decode::decode_payload_reporting::<
1573 BootNotificationRequest,
1574 >(payload, options)?
1575 .map(Self::BootNotification),
1576 Action::ClearedChargingLimit => crate::decode::decode_payload_reporting::<
1577 ClearedChargingLimitRequest,
1578 >(payload, options)?
1579 .map(Self::ClearedChargingLimit),
1580 Action::ClosePeriodicEventStream => crate::decode::decode_payload_reporting::<
1581 ClosePeriodicEventStreamRequest,
1582 >(payload, options)?
1583 .map(Self::ClosePeriodicEventStream),
1584 Action::DataTransfer => {
1585 crate::decode::decode_payload_reporting::<DataTransferRequest>(payload, options)?
1586 .map(Self::DataTransfer)
1587 }
1588 Action::FirmwareStatusNotification => crate::decode::decode_payload_reporting::<
1589 FirmwareStatusNotificationRequest,
1590 >(payload, options)?
1591 .map(Self::FirmwareStatusNotification),
1592 Action::Get15118EVCertificate => crate::decode::decode_payload_reporting::<
1593 Get15118EVCertificateRequest,
1594 >(payload, options)?
1595 .map(Self::Get15118EVCertificate),
1596 Action::GetCertificateChainStatus => crate::decode::decode_payload_reporting::<
1597 GetCertificateChainStatusRequest,
1598 >(payload, options)?
1599 .map(Self::GetCertificateChainStatus),
1600 Action::GetCertificateStatus => crate::decode::decode_payload_reporting::<
1601 GetCertificateStatusRequest,
1602 >(payload, options)?
1603 .map(Self::GetCertificateStatus),
1604 Action::Heartbeat => {
1605 crate::decode::decode_payload_reporting::<HeartbeatRequest>(payload, options)?
1606 .map(Self::Heartbeat)
1607 }
1608 Action::LogStatusNotification => crate::decode::decode_payload_reporting::<
1609 LogStatusNotificationRequest,
1610 >(payload, options)?
1611 .map(Self::LogStatusNotification),
1612 Action::MeterValues => {
1613 crate::decode::decode_payload_reporting::<MeterValuesRequest>(payload, options)?
1614 .map(Self::MeterValues)
1615 }
1616 Action::NotifyChargingLimit => crate::decode::decode_payload_reporting::<
1617 NotifyChargingLimitRequest,
1618 >(payload, options)?
1619 .map(Self::NotifyChargingLimit),
1620 Action::NotifyCustomerInformation => crate::decode::decode_payload_reporting::<
1621 NotifyCustomerInformationRequest,
1622 >(payload, options)?
1623 .map(Self::NotifyCustomerInformation),
1624 Action::NotifyDERAlarm => {
1625 crate::decode::decode_payload_reporting::<NotifyDERAlarmRequest>(payload, options)?
1626 .map(Self::NotifyDERAlarm)
1627 }
1628 Action::NotifyDERStartStop => crate::decode::decode_payload_reporting::<
1629 NotifyDERStartStopRequest,
1630 >(payload, options)?
1631 .map(Self::NotifyDERStartStop),
1632 Action::NotifyDisplayMessages => crate::decode::decode_payload_reporting::<
1633 NotifyDisplayMessagesRequest,
1634 >(payload, options)?
1635 .map(Self::NotifyDisplayMessages),
1636 Action::NotifyEVChargingNeeds => crate::decode::decode_payload_reporting::<
1637 NotifyEVChargingNeedsRequest,
1638 >(payload, options)?
1639 .map(Self::NotifyEVChargingNeeds),
1640 Action::NotifyEVChargingSchedule => crate::decode::decode_payload_reporting::<
1641 NotifyEVChargingScheduleRequest,
1642 >(payload, options)?
1643 .map(Self::NotifyEVChargingSchedule),
1644 Action::NotifyEvent => {
1645 crate::decode::decode_payload_reporting::<NotifyEventRequest>(payload, options)?
1646 .map(Self::NotifyEvent)
1647 }
1648 Action::NotifyMonitoringReport => crate::decode::decode_payload_reporting::<
1649 NotifyMonitoringReportRequest,
1650 >(payload, options)?
1651 .map(Self::NotifyMonitoringReport),
1652 Action::NotifyPeriodicEventStream => crate::decode::decode_payload_reporting::<
1653 NotifyPeriodicEventStreamRequest,
1654 >(payload, options)?
1655 .map(Self::NotifyPeriodicEventStream),
1656 Action::NotifyPriorityCharging => crate::decode::decode_payload_reporting::<
1657 NotifyPriorityChargingRequest,
1658 >(payload, options)?
1659 .map(Self::NotifyPriorityCharging),
1660 Action::NotifyReport => {
1661 crate::decode::decode_payload_reporting::<NotifyReportRequest>(payload, options)?
1662 .map(Self::NotifyReport)
1663 }
1664 Action::NotifySettlement => crate::decode::decode_payload_reporting::<
1665 NotifySettlementRequest,
1666 >(payload, options)?
1667 .map(Self::NotifySettlement),
1668 Action::OpenPeriodicEventStream => crate::decode::decode_payload_reporting::<
1669 OpenPeriodicEventStreamRequest,
1670 >(payload, options)?
1671 .map(Self::OpenPeriodicEventStream),
1672 Action::PublishFirmwareStatusNotification => crate::decode::decode_payload_reporting::<
1673 PublishFirmwareStatusNotificationRequest,
1674 >(payload, options)?
1675 .map(Self::PublishFirmwareStatusNotification),
1676 Action::PullDynamicScheduleUpdate => crate::decode::decode_payload_reporting::<
1677 PullDynamicScheduleUpdateRequest,
1678 >(payload, options)?
1679 .map(Self::PullDynamicScheduleUpdate),
1680 Action::ReportChargingProfiles => crate::decode::decode_payload_reporting::<
1681 ReportChargingProfilesRequest,
1682 >(payload, options)?
1683 .map(Self::ReportChargingProfiles),
1684 Action::ReportDERControl => crate::decode::decode_payload_reporting::<
1685 ReportDERControlRequest,
1686 >(payload, options)?
1687 .map(Self::ReportDERControl),
1688 Action::ReservationStatusUpdate => crate::decode::decode_payload_reporting::<
1689 ReservationStatusUpdateRequest,
1690 >(payload, options)?
1691 .map(Self::ReservationStatusUpdate),
1692 Action::SecurityEventNotification => crate::decode::decode_payload_reporting::<
1693 SecurityEventNotificationRequest,
1694 >(payload, options)?
1695 .map(Self::SecurityEventNotification),
1696 Action::SignCertificate => {
1697 crate::decode::decode_payload_reporting::<SignCertificateRequest>(payload, options)?
1698 .map(Self::SignCertificate)
1699 }
1700 Action::StatusNotification => crate::decode::decode_payload_reporting::<
1701 StatusNotificationRequest,
1702 >(payload, options)?
1703 .map(Self::StatusNotification),
1704 Action::TransactionEvent => crate::decode::decode_payload_reporting::<
1705 TransactionEventRequest,
1706 >(payload, options)?
1707 .map(Self::TransactionEvent),
1708 Action::VatNumberValidation => crate::decode::decode_payload_reporting::<
1709 VatNumberValidationRequest,
1710 >(payload, options)?
1711 .map(Self::VatNumberValidation),
1712 other => return Err(DecodeError::unsupported_action(other.as_str())),
1713 })
1714 }
1715
1716 pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
1718 match self {
1719 Self::Authorize(p) => serde_json::to_string(p),
1720 Self::BatterySwap(p) => serde_json::to_string(p),
1721 Self::BootNotification(p) => serde_json::to_string(p),
1722 Self::ClearedChargingLimit(p) => serde_json::to_string(p),
1723 Self::ClosePeriodicEventStream(p) => serde_json::to_string(p),
1724 Self::DataTransfer(p) => serde_json::to_string(p),
1725 Self::FirmwareStatusNotification(p) => serde_json::to_string(p),
1726 Self::Get15118EVCertificate(p) => serde_json::to_string(p),
1727 Self::GetCertificateChainStatus(p) => serde_json::to_string(p),
1728 Self::GetCertificateStatus(p) => serde_json::to_string(p),
1729 Self::Heartbeat(p) => serde_json::to_string(p),
1730 Self::LogStatusNotification(p) => serde_json::to_string(p),
1731 Self::MeterValues(p) => serde_json::to_string(p),
1732 Self::NotifyChargingLimit(p) => serde_json::to_string(p),
1733 Self::NotifyCustomerInformation(p) => serde_json::to_string(p),
1734 Self::NotifyDERAlarm(p) => serde_json::to_string(p),
1735 Self::NotifyDERStartStop(p) => serde_json::to_string(p),
1736 Self::NotifyDisplayMessages(p) => serde_json::to_string(p),
1737 Self::NotifyEVChargingNeeds(p) => serde_json::to_string(p),
1738 Self::NotifyEVChargingSchedule(p) => serde_json::to_string(p),
1739 Self::NotifyEvent(p) => serde_json::to_string(p),
1740 Self::NotifyMonitoringReport(p) => serde_json::to_string(p),
1741 Self::NotifyPeriodicEventStream(p) => serde_json::to_string(p),
1742 Self::NotifyPriorityCharging(p) => serde_json::to_string(p),
1743 Self::NotifyReport(p) => serde_json::to_string(p),
1744 Self::NotifySettlement(p) => serde_json::to_string(p),
1745 Self::OpenPeriodicEventStream(p) => serde_json::to_string(p),
1746 Self::PublishFirmwareStatusNotification(p) => serde_json::to_string(p),
1747 Self::PullDynamicScheduleUpdate(p) => serde_json::to_string(p),
1748 Self::ReportChargingProfiles(p) => serde_json::to_string(p),
1749 Self::ReportDERControl(p) => serde_json::to_string(p),
1750 Self::ReservationStatusUpdate(p) => serde_json::to_string(p),
1751 Self::SecurityEventNotification(p) => serde_json::to_string(p),
1752 Self::SignCertificate(p) => serde_json::to_string(p),
1753 Self::StatusNotification(p) => serde_json::to_string(p),
1754 Self::TransactionEvent(p) => serde_json::to_string(p),
1755 Self::VatNumberValidation(p) => serde_json::to_string(p),
1756 }
1757 }
1758}
1759
1760impl Validate for CsRequest {
1761 fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1762 match self {
1763 Self::Authorize(p) => p.validate_at(path, out),
1764 Self::BatterySwap(p) => p.validate_at(path, out),
1765 Self::BootNotification(p) => p.validate_at(path, out),
1766 Self::ClearedChargingLimit(p) => p.validate_at(path, out),
1767 Self::ClosePeriodicEventStream(p) => p.validate_at(path, out),
1768 Self::DataTransfer(p) => p.validate_at(path, out),
1769 Self::FirmwareStatusNotification(p) => p.validate_at(path, out),
1770 Self::Get15118EVCertificate(p) => p.validate_at(path, out),
1771 Self::GetCertificateChainStatus(p) => p.validate_at(path, out),
1772 Self::GetCertificateStatus(p) => p.validate_at(path, out),
1773 Self::Heartbeat(p) => p.validate_at(path, out),
1774 Self::LogStatusNotification(p) => p.validate_at(path, out),
1775 Self::MeterValues(p) => p.validate_at(path, out),
1776 Self::NotifyChargingLimit(p) => p.validate_at(path, out),
1777 Self::NotifyCustomerInformation(p) => p.validate_at(path, out),
1778 Self::NotifyDERAlarm(p) => p.validate_at(path, out),
1779 Self::NotifyDERStartStop(p) => p.validate_at(path, out),
1780 Self::NotifyDisplayMessages(p) => p.validate_at(path, out),
1781 Self::NotifyEVChargingNeeds(p) => p.validate_at(path, out),
1782 Self::NotifyEVChargingSchedule(p) => p.validate_at(path, out),
1783 Self::NotifyEvent(p) => p.validate_at(path, out),
1784 Self::NotifyMonitoringReport(p) => p.validate_at(path, out),
1785 Self::NotifyPeriodicEventStream(p) => p.validate_at(path, out),
1786 Self::NotifyPriorityCharging(p) => p.validate_at(path, out),
1787 Self::NotifyReport(p) => p.validate_at(path, out),
1788 Self::NotifySettlement(p) => p.validate_at(path, out),
1789 Self::OpenPeriodicEventStream(p) => p.validate_at(path, out),
1790 Self::PublishFirmwareStatusNotification(p) => p.validate_at(path, out),
1791 Self::PullDynamicScheduleUpdate(p) => p.validate_at(path, out),
1792 Self::ReportChargingProfiles(p) => p.validate_at(path, out),
1793 Self::ReportDERControl(p) => p.validate_at(path, out),
1794 Self::ReservationStatusUpdate(p) => p.validate_at(path, out),
1795 Self::SecurityEventNotification(p) => p.validate_at(path, out),
1796 Self::SignCertificate(p) => p.validate_at(path, out),
1797 Self::StatusNotification(p) => p.validate_at(path, out),
1798 Self::TransactionEvent(p) => p.validate_at(path, out),
1799 Self::VatNumberValidation(p) => p.validate_at(path, out),
1800 }
1801 }
1802}
1803
1804impl serde::Serialize for CsRequest {
1805 fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
1806 match self {
1807 Self::Authorize(p) => p.serialize(ser),
1808 Self::BatterySwap(p) => p.serialize(ser),
1809 Self::BootNotification(p) => p.serialize(ser),
1810 Self::ClearedChargingLimit(p) => p.serialize(ser),
1811 Self::ClosePeriodicEventStream(p) => p.serialize(ser),
1812 Self::DataTransfer(p) => p.serialize(ser),
1813 Self::FirmwareStatusNotification(p) => p.serialize(ser),
1814 Self::Get15118EVCertificate(p) => p.serialize(ser),
1815 Self::GetCertificateChainStatus(p) => p.serialize(ser),
1816 Self::GetCertificateStatus(p) => p.serialize(ser),
1817 Self::Heartbeat(p) => p.serialize(ser),
1818 Self::LogStatusNotification(p) => p.serialize(ser),
1819 Self::MeterValues(p) => p.serialize(ser),
1820 Self::NotifyChargingLimit(p) => p.serialize(ser),
1821 Self::NotifyCustomerInformation(p) => p.serialize(ser),
1822 Self::NotifyDERAlarm(p) => p.serialize(ser),
1823 Self::NotifyDERStartStop(p) => p.serialize(ser),
1824 Self::NotifyDisplayMessages(p) => p.serialize(ser),
1825 Self::NotifyEVChargingNeeds(p) => p.serialize(ser),
1826 Self::NotifyEVChargingSchedule(p) => p.serialize(ser),
1827 Self::NotifyEvent(p) => p.serialize(ser),
1828 Self::NotifyMonitoringReport(p) => p.serialize(ser),
1829 Self::NotifyPeriodicEventStream(p) => p.serialize(ser),
1830 Self::NotifyPriorityCharging(p) => p.serialize(ser),
1831 Self::NotifyReport(p) => p.serialize(ser),
1832 Self::NotifySettlement(p) => p.serialize(ser),
1833 Self::OpenPeriodicEventStream(p) => p.serialize(ser),
1834 Self::PublishFirmwareStatusNotification(p) => p.serialize(ser),
1835 Self::PullDynamicScheduleUpdate(p) => p.serialize(ser),
1836 Self::ReportChargingProfiles(p) => p.serialize(ser),
1837 Self::ReportDERControl(p) => p.serialize(ser),
1838 Self::ReservationStatusUpdate(p) => p.serialize(ser),
1839 Self::SecurityEventNotification(p) => p.serialize(ser),
1840 Self::SignCertificate(p) => p.serialize(ser),
1841 Self::StatusNotification(p) => p.serialize(ser),
1842 Self::TransactionEvent(p) => p.serialize(ser),
1843 Self::VatNumberValidation(p) => p.serialize(ser),
1844 }
1845 }
1846}
1847
1848impl crate::message::Sealed for CsRequest {}
1849
1850impl crate::message::DecodeRequest for CsRequest {
1851 type Action = Action;
1852
1853 fn decode_reporting(
1854 action: Action,
1855 payload: &RawValue,
1856 options: &DecodeOptions,
1857 ) -> Result<crate::decode::Decoded<Self>, DecodeError> {
1858 CsRequest::decode_reporting(action, payload, options)
1859 }
1860}
1861
1862#[derive(Clone, Debug, PartialEq)]
1866#[non_exhaustive]
1867#[allow(clippy::large_enum_variant)]
1868pub enum CsResponse {
1869 Authorize(AuthorizeResponse),
1871 BatterySwap(BatterySwapResponse),
1873 BootNotification(BootNotificationResponse),
1875 ClearedChargingLimit(ClearedChargingLimitResponse),
1877 ClosePeriodicEventStream(ClosePeriodicEventStreamResponse),
1879 DataTransfer(DataTransferResponse),
1881 FirmwareStatusNotification(FirmwareStatusNotificationResponse),
1883 Get15118EVCertificate(Get15118EVCertificateResponse),
1885 GetCertificateChainStatus(GetCertificateChainStatusResponse),
1887 GetCertificateStatus(GetCertificateStatusResponse),
1889 Heartbeat(HeartbeatResponse),
1891 LogStatusNotification(LogStatusNotificationResponse),
1893 MeterValues(MeterValuesResponse),
1895 NotifyChargingLimit(NotifyChargingLimitResponse),
1897 NotifyCustomerInformation(NotifyCustomerInformationResponse),
1899 NotifyDERAlarm(NotifyDERAlarmResponse),
1901 NotifyDERStartStop(NotifyDERStartStopResponse),
1903 NotifyDisplayMessages(NotifyDisplayMessagesResponse),
1905 NotifyEVChargingNeeds(NotifyEVChargingNeedsResponse),
1907 NotifyEVChargingSchedule(NotifyEVChargingScheduleResponse),
1909 NotifyEvent(NotifyEventResponse),
1911 NotifyMonitoringReport(NotifyMonitoringReportResponse),
1913 NotifyPriorityCharging(NotifyPriorityChargingResponse),
1915 NotifyReport(NotifyReportResponse),
1917 NotifySettlement(NotifySettlementResponse),
1919 OpenPeriodicEventStream(OpenPeriodicEventStreamResponse),
1921 PublishFirmwareStatusNotification(PublishFirmwareStatusNotificationResponse),
1923 PullDynamicScheduleUpdate(PullDynamicScheduleUpdateResponse),
1925 ReportChargingProfiles(ReportChargingProfilesResponse),
1927 ReportDERControl(ReportDERControlResponse),
1929 ReservationStatusUpdate(ReservationStatusUpdateResponse),
1931 SecurityEventNotification(SecurityEventNotificationResponse),
1933 SignCertificate(SignCertificateResponse),
1935 StatusNotification(StatusNotificationResponse),
1937 TransactionEvent(TransactionEventResponse),
1939 VatNumberValidation(VatNumberValidationResponse),
1941}
1942
1943impl CsResponse {
1944 #[must_use]
1946 pub const fn action(&self) -> Action {
1947 match self {
1948 Self::Authorize(_) => Action::Authorize,
1949 Self::BatterySwap(_) => Action::BatterySwap,
1950 Self::BootNotification(_) => Action::BootNotification,
1951 Self::ClearedChargingLimit(_) => Action::ClearedChargingLimit,
1952 Self::ClosePeriodicEventStream(_) => Action::ClosePeriodicEventStream,
1953 Self::DataTransfer(_) => Action::DataTransfer,
1954 Self::FirmwareStatusNotification(_) => Action::FirmwareStatusNotification,
1955 Self::Get15118EVCertificate(_) => Action::Get15118EVCertificate,
1956 Self::GetCertificateChainStatus(_) => Action::GetCertificateChainStatus,
1957 Self::GetCertificateStatus(_) => Action::GetCertificateStatus,
1958 Self::Heartbeat(_) => Action::Heartbeat,
1959 Self::LogStatusNotification(_) => Action::LogStatusNotification,
1960 Self::MeterValues(_) => Action::MeterValues,
1961 Self::NotifyChargingLimit(_) => Action::NotifyChargingLimit,
1962 Self::NotifyCustomerInformation(_) => Action::NotifyCustomerInformation,
1963 Self::NotifyDERAlarm(_) => Action::NotifyDERAlarm,
1964 Self::NotifyDERStartStop(_) => Action::NotifyDERStartStop,
1965 Self::NotifyDisplayMessages(_) => Action::NotifyDisplayMessages,
1966 Self::NotifyEVChargingNeeds(_) => Action::NotifyEVChargingNeeds,
1967 Self::NotifyEVChargingSchedule(_) => Action::NotifyEVChargingSchedule,
1968 Self::NotifyEvent(_) => Action::NotifyEvent,
1969 Self::NotifyMonitoringReport(_) => Action::NotifyMonitoringReport,
1970 Self::NotifyPriorityCharging(_) => Action::NotifyPriorityCharging,
1971 Self::NotifyReport(_) => Action::NotifyReport,
1972 Self::NotifySettlement(_) => Action::NotifySettlement,
1973 Self::OpenPeriodicEventStream(_) => Action::OpenPeriodicEventStream,
1974 Self::PublishFirmwareStatusNotification(_) => Action::PublishFirmwareStatusNotification,
1975 Self::PullDynamicScheduleUpdate(_) => Action::PullDynamicScheduleUpdate,
1976 Self::ReportChargingProfiles(_) => Action::ReportChargingProfiles,
1977 Self::ReportDERControl(_) => Action::ReportDERControl,
1978 Self::ReservationStatusUpdate(_) => Action::ReservationStatusUpdate,
1979 Self::SecurityEventNotification(_) => Action::SecurityEventNotification,
1980 Self::SignCertificate(_) => Action::SignCertificate,
1981 Self::StatusNotification(_) => Action::StatusNotification,
1982 Self::TransactionEvent(_) => Action::TransactionEvent,
1983 Self::VatNumberValidation(_) => Action::VatNumberValidation,
1984 }
1985 }
1986
1987 pub fn decode(
1990 action: Action,
1991 payload: &RawValue,
1992 options: &DecodeOptions,
1993 ) -> Result<Self, DecodeError> {
1994 Ok(match action {
1995 Action::Authorize => Self::Authorize(
1996 crate::decode::decode_payload::<AuthorizeResponse>(payload, options)?,
1997 ),
1998 Action::BatterySwap => Self::BatterySwap(crate::decode::decode_payload::<
1999 BatterySwapResponse,
2000 >(payload, options)?),
2001 Action::BootNotification => Self::BootNotification(crate::decode::decode_payload::<
2002 BootNotificationResponse,
2003 >(payload, options)?),
2004 Action::ClearedChargingLimit => {
2005 Self::ClearedChargingLimit(crate::decode::decode_payload::<
2006 ClearedChargingLimitResponse,
2007 >(payload, options)?)
2008 }
2009 Action::ClosePeriodicEventStream => {
2010 Self::ClosePeriodicEventStream(crate::decode::decode_payload::<
2011 ClosePeriodicEventStreamResponse,
2012 >(payload, options)?)
2013 }
2014 Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
2015 DataTransferResponse,
2016 >(payload, options)?),
2017 Action::FirmwareStatusNotification => {
2018 Self::FirmwareStatusNotification(crate::decode::decode_payload::<
2019 FirmwareStatusNotificationResponse,
2020 >(payload, options)?)
2021 }
2022 Action::Get15118EVCertificate => {
2023 Self::Get15118EVCertificate(crate::decode::decode_payload::<
2024 Get15118EVCertificateResponse,
2025 >(payload, options)?)
2026 }
2027 Action::GetCertificateChainStatus => {
2028 Self::GetCertificateChainStatus(crate::decode::decode_payload::<
2029 GetCertificateChainStatusResponse,
2030 >(payload, options)?)
2031 }
2032 Action::GetCertificateStatus => {
2033 Self::GetCertificateStatus(crate::decode::decode_payload::<
2034 GetCertificateStatusResponse,
2035 >(payload, options)?)
2036 }
2037 Action::Heartbeat => Self::Heartbeat(
2038 crate::decode::decode_payload::<HeartbeatResponse>(payload, options)?,
2039 ),
2040 Action::LogStatusNotification => {
2041 Self::LogStatusNotification(crate::decode::decode_payload::<
2042 LogStatusNotificationResponse,
2043 >(payload, options)?)
2044 }
2045 Action::MeterValues => Self::MeterValues(crate::decode::decode_payload::<
2046 MeterValuesResponse,
2047 >(payload, options)?),
2048 Action::NotifyChargingLimit => {
2049 Self::NotifyChargingLimit(crate::decode::decode_payload::<
2050 NotifyChargingLimitResponse,
2051 >(payload, options)?)
2052 }
2053 Action::NotifyCustomerInformation => {
2054 Self::NotifyCustomerInformation(crate::decode::decode_payload::<
2055 NotifyCustomerInformationResponse,
2056 >(payload, options)?)
2057 }
2058 Action::NotifyDERAlarm => Self::NotifyDERAlarm(crate::decode::decode_payload::<
2059 NotifyDERAlarmResponse,
2060 >(payload, options)?),
2061 Action::NotifyDERStartStop => Self::NotifyDERStartStop(
2062 crate::decode::decode_payload::<NotifyDERStartStopResponse>(payload, options)?,
2063 ),
2064 Action::NotifyDisplayMessages => {
2065 Self::NotifyDisplayMessages(crate::decode::decode_payload::<
2066 NotifyDisplayMessagesResponse,
2067 >(payload, options)?)
2068 }
2069 Action::NotifyEVChargingNeeds => {
2070 Self::NotifyEVChargingNeeds(crate::decode::decode_payload::<
2071 NotifyEVChargingNeedsResponse,
2072 >(payload, options)?)
2073 }
2074 Action::NotifyEVChargingSchedule => {
2075 Self::NotifyEVChargingSchedule(crate::decode::decode_payload::<
2076 NotifyEVChargingScheduleResponse,
2077 >(payload, options)?)
2078 }
2079 Action::NotifyEvent => Self::NotifyEvent(crate::decode::decode_payload::<
2080 NotifyEventResponse,
2081 >(payload, options)?),
2082 Action::NotifyMonitoringReport => {
2083 Self::NotifyMonitoringReport(crate::decode::decode_payload::<
2084 NotifyMonitoringReportResponse,
2085 >(payload, options)?)
2086 }
2087 Action::NotifyPriorityCharging => {
2088 Self::NotifyPriorityCharging(crate::decode::decode_payload::<
2089 NotifyPriorityChargingResponse,
2090 >(payload, options)?)
2091 }
2092 Action::NotifyReport => Self::NotifyReport(crate::decode::decode_payload::<
2093 NotifyReportResponse,
2094 >(payload, options)?),
2095 Action::NotifySettlement => Self::NotifySettlement(crate::decode::decode_payload::<
2096 NotifySettlementResponse,
2097 >(payload, options)?),
2098 Action::OpenPeriodicEventStream => {
2099 Self::OpenPeriodicEventStream(crate::decode::decode_payload::<
2100 OpenPeriodicEventStreamResponse,
2101 >(payload, options)?)
2102 }
2103 Action::PublishFirmwareStatusNotification => {
2104 Self::PublishFirmwareStatusNotification(crate::decode::decode_payload::<
2105 PublishFirmwareStatusNotificationResponse,
2106 >(payload, options)?)
2107 }
2108 Action::PullDynamicScheduleUpdate => {
2109 Self::PullDynamicScheduleUpdate(crate::decode::decode_payload::<
2110 PullDynamicScheduleUpdateResponse,
2111 >(payload, options)?)
2112 }
2113 Action::ReportChargingProfiles => {
2114 Self::ReportChargingProfiles(crate::decode::decode_payload::<
2115 ReportChargingProfilesResponse,
2116 >(payload, options)?)
2117 }
2118 Action::ReportDERControl => Self::ReportDERControl(crate::decode::decode_payload::<
2119 ReportDERControlResponse,
2120 >(payload, options)?),
2121 Action::ReservationStatusUpdate => {
2122 Self::ReservationStatusUpdate(crate::decode::decode_payload::<
2123 ReservationStatusUpdateResponse,
2124 >(payload, options)?)
2125 }
2126 Action::SecurityEventNotification => {
2127 Self::SecurityEventNotification(crate::decode::decode_payload::<
2128 SecurityEventNotificationResponse,
2129 >(payload, options)?)
2130 }
2131 Action::SignCertificate => Self::SignCertificate(crate::decode::decode_payload::<
2132 SignCertificateResponse,
2133 >(payload, options)?),
2134 Action::StatusNotification => Self::StatusNotification(
2135 crate::decode::decode_payload::<StatusNotificationResponse>(payload, options)?,
2136 ),
2137 Action::TransactionEvent => Self::TransactionEvent(crate::decode::decode_payload::<
2138 TransactionEventResponse,
2139 >(payload, options)?),
2140 Action::VatNumberValidation => {
2141 Self::VatNumberValidation(crate::decode::decode_payload::<
2142 VatNumberValidationResponse,
2143 >(payload, options)?)
2144 }
2145 other => return Err(DecodeError::unsupported_action(other.as_str())),
2146 })
2147 }
2148
2149 pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
2151 match self {
2152 Self::Authorize(p) => serde_json::to_string(p),
2153 Self::BatterySwap(p) => serde_json::to_string(p),
2154 Self::BootNotification(p) => serde_json::to_string(p),
2155 Self::ClearedChargingLimit(p) => serde_json::to_string(p),
2156 Self::ClosePeriodicEventStream(p) => serde_json::to_string(p),
2157 Self::DataTransfer(p) => serde_json::to_string(p),
2158 Self::FirmwareStatusNotification(p) => serde_json::to_string(p),
2159 Self::Get15118EVCertificate(p) => serde_json::to_string(p),
2160 Self::GetCertificateChainStatus(p) => serde_json::to_string(p),
2161 Self::GetCertificateStatus(p) => serde_json::to_string(p),
2162 Self::Heartbeat(p) => serde_json::to_string(p),
2163 Self::LogStatusNotification(p) => serde_json::to_string(p),
2164 Self::MeterValues(p) => serde_json::to_string(p),
2165 Self::NotifyChargingLimit(p) => serde_json::to_string(p),
2166 Self::NotifyCustomerInformation(p) => serde_json::to_string(p),
2167 Self::NotifyDERAlarm(p) => serde_json::to_string(p),
2168 Self::NotifyDERStartStop(p) => serde_json::to_string(p),
2169 Self::NotifyDisplayMessages(p) => serde_json::to_string(p),
2170 Self::NotifyEVChargingNeeds(p) => serde_json::to_string(p),
2171 Self::NotifyEVChargingSchedule(p) => serde_json::to_string(p),
2172 Self::NotifyEvent(p) => serde_json::to_string(p),
2173 Self::NotifyMonitoringReport(p) => serde_json::to_string(p),
2174 Self::NotifyPriorityCharging(p) => serde_json::to_string(p),
2175 Self::NotifyReport(p) => serde_json::to_string(p),
2176 Self::NotifySettlement(p) => serde_json::to_string(p),
2177 Self::OpenPeriodicEventStream(p) => serde_json::to_string(p),
2178 Self::PublishFirmwareStatusNotification(p) => serde_json::to_string(p),
2179 Self::PullDynamicScheduleUpdate(p) => serde_json::to_string(p),
2180 Self::ReportChargingProfiles(p) => serde_json::to_string(p),
2181 Self::ReportDERControl(p) => serde_json::to_string(p),
2182 Self::ReservationStatusUpdate(p) => serde_json::to_string(p),
2183 Self::SecurityEventNotification(p) => serde_json::to_string(p),
2184 Self::SignCertificate(p) => serde_json::to_string(p),
2185 Self::StatusNotification(p) => serde_json::to_string(p),
2186 Self::TransactionEvent(p) => serde_json::to_string(p),
2187 Self::VatNumberValidation(p) => serde_json::to_string(p),
2188 }
2189 }
2190}
2191
2192impl Validate for CsResponse {
2193 fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2194 match self {
2195 Self::Authorize(p) => p.validate_at(path, out),
2196 Self::BatterySwap(p) => p.validate_at(path, out),
2197 Self::BootNotification(p) => p.validate_at(path, out),
2198 Self::ClearedChargingLimit(p) => p.validate_at(path, out),
2199 Self::ClosePeriodicEventStream(p) => p.validate_at(path, out),
2200 Self::DataTransfer(p) => p.validate_at(path, out),
2201 Self::FirmwareStatusNotification(p) => p.validate_at(path, out),
2202 Self::Get15118EVCertificate(p) => p.validate_at(path, out),
2203 Self::GetCertificateChainStatus(p) => p.validate_at(path, out),
2204 Self::GetCertificateStatus(p) => p.validate_at(path, out),
2205 Self::Heartbeat(p) => p.validate_at(path, out),
2206 Self::LogStatusNotification(p) => p.validate_at(path, out),
2207 Self::MeterValues(p) => p.validate_at(path, out),
2208 Self::NotifyChargingLimit(p) => p.validate_at(path, out),
2209 Self::NotifyCustomerInformation(p) => p.validate_at(path, out),
2210 Self::NotifyDERAlarm(p) => p.validate_at(path, out),
2211 Self::NotifyDERStartStop(p) => p.validate_at(path, out),
2212 Self::NotifyDisplayMessages(p) => p.validate_at(path, out),
2213 Self::NotifyEVChargingNeeds(p) => p.validate_at(path, out),
2214 Self::NotifyEVChargingSchedule(p) => p.validate_at(path, out),
2215 Self::NotifyEvent(p) => p.validate_at(path, out),
2216 Self::NotifyMonitoringReport(p) => p.validate_at(path, out),
2217 Self::NotifyPriorityCharging(p) => p.validate_at(path, out),
2218 Self::NotifyReport(p) => p.validate_at(path, out),
2219 Self::NotifySettlement(p) => p.validate_at(path, out),
2220 Self::OpenPeriodicEventStream(p) => p.validate_at(path, out),
2221 Self::PublishFirmwareStatusNotification(p) => p.validate_at(path, out),
2222 Self::PullDynamicScheduleUpdate(p) => p.validate_at(path, out),
2223 Self::ReportChargingProfiles(p) => p.validate_at(path, out),
2224 Self::ReportDERControl(p) => p.validate_at(path, out),
2225 Self::ReservationStatusUpdate(p) => p.validate_at(path, out),
2226 Self::SecurityEventNotification(p) => p.validate_at(path, out),
2227 Self::SignCertificate(p) => p.validate_at(path, out),
2228 Self::StatusNotification(p) => p.validate_at(path, out),
2229 Self::TransactionEvent(p) => p.validate_at(path, out),
2230 Self::VatNumberValidation(p) => p.validate_at(path, out),
2231 }
2232 }
2233}
2234
2235impl serde::Serialize for CsResponse {
2236 fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
2237 match self {
2238 Self::Authorize(p) => p.serialize(ser),
2239 Self::BatterySwap(p) => p.serialize(ser),
2240 Self::BootNotification(p) => p.serialize(ser),
2241 Self::ClearedChargingLimit(p) => p.serialize(ser),
2242 Self::ClosePeriodicEventStream(p) => p.serialize(ser),
2243 Self::DataTransfer(p) => p.serialize(ser),
2244 Self::FirmwareStatusNotification(p) => p.serialize(ser),
2245 Self::Get15118EVCertificate(p) => p.serialize(ser),
2246 Self::GetCertificateChainStatus(p) => p.serialize(ser),
2247 Self::GetCertificateStatus(p) => p.serialize(ser),
2248 Self::Heartbeat(p) => p.serialize(ser),
2249 Self::LogStatusNotification(p) => p.serialize(ser),
2250 Self::MeterValues(p) => p.serialize(ser),
2251 Self::NotifyChargingLimit(p) => p.serialize(ser),
2252 Self::NotifyCustomerInformation(p) => p.serialize(ser),
2253 Self::NotifyDERAlarm(p) => p.serialize(ser),
2254 Self::NotifyDERStartStop(p) => p.serialize(ser),
2255 Self::NotifyDisplayMessages(p) => p.serialize(ser),
2256 Self::NotifyEVChargingNeeds(p) => p.serialize(ser),
2257 Self::NotifyEVChargingSchedule(p) => p.serialize(ser),
2258 Self::NotifyEvent(p) => p.serialize(ser),
2259 Self::NotifyMonitoringReport(p) => p.serialize(ser),
2260 Self::NotifyPriorityCharging(p) => p.serialize(ser),
2261 Self::NotifyReport(p) => p.serialize(ser),
2262 Self::NotifySettlement(p) => p.serialize(ser),
2263 Self::OpenPeriodicEventStream(p) => p.serialize(ser),
2264 Self::PublishFirmwareStatusNotification(p) => p.serialize(ser),
2265 Self::PullDynamicScheduleUpdate(p) => p.serialize(ser),
2266 Self::ReportChargingProfiles(p) => p.serialize(ser),
2267 Self::ReportDERControl(p) => p.serialize(ser),
2268 Self::ReservationStatusUpdate(p) => p.serialize(ser),
2269 Self::SecurityEventNotification(p) => p.serialize(ser),
2270 Self::SignCertificate(p) => p.serialize(ser),
2271 Self::StatusNotification(p) => p.serialize(ser),
2272 Self::TransactionEvent(p) => p.serialize(ser),
2273 Self::VatNumberValidation(p) => p.serialize(ser),
2274 }
2275 }
2276}
2277
2278#[derive(Clone, Debug, PartialEq)]
2280#[non_exhaustive]
2281#[allow(clippy::large_enum_variant)]
2282pub enum CsmsRequest {
2283 AFRRSignal(AFRRSignalRequest),
2285 AdjustPeriodicEventStream(AdjustPeriodicEventStreamRequest),
2287 CancelReservation(CancelReservationRequest),
2289 CertificateSigned(CertificateSignedRequest),
2291 ChangeAvailability(ChangeAvailabilityRequest),
2293 ChangeTransactionTariff(ChangeTransactionTariffRequest),
2295 ClearCache(ClearCacheRequest),
2297 ClearChargingProfile(ClearChargingProfileRequest),
2299 ClearDERControl(ClearDERControlRequest),
2301 ClearDisplayMessage(ClearDisplayMessageRequest),
2303 ClearTariffs(ClearTariffsRequest),
2305 ClearVariableMonitoring(ClearVariableMonitoringRequest),
2307 CostUpdated(CostUpdatedRequest),
2309 CustomerInformation(CustomerInformationRequest),
2311 DataTransfer(DataTransferRequest),
2313 DeleteCertificate(DeleteCertificateRequest),
2315 GetBaseReport(GetBaseReportRequest),
2317 GetChargingProfiles(GetChargingProfilesRequest),
2319 GetCompositeSchedule(GetCompositeScheduleRequest),
2321 GetDERControl(GetDERControlRequest),
2323 GetDisplayMessages(GetDisplayMessagesRequest),
2325 GetInstalledCertificateIds(GetInstalledCertificateIdsRequest),
2327 GetLocalListVersion(GetLocalListVersionRequest),
2329 GetLog(GetLogRequest),
2331 GetMonitoringReport(GetMonitoringReportRequest),
2333 GetPeriodicEventStream(GetPeriodicEventStreamRequest),
2335 GetReport(GetReportRequest),
2337 GetTariffs(GetTariffsRequest),
2339 GetTransactionStatus(GetTransactionStatusRequest),
2341 GetVariables(GetVariablesRequest),
2343 InstallCertificate(InstallCertificateRequest),
2345 NotifyAllowedEnergyTransfer(NotifyAllowedEnergyTransferRequest),
2347 NotifyWebPaymentStarted(NotifyWebPaymentStartedRequest),
2349 PublishFirmware(PublishFirmwareRequest),
2351 RequestBatterySwap(RequestBatterySwapRequest),
2353 RequestStartTransaction(RequestStartTransactionRequest),
2355 RequestStopTransaction(RequestStopTransactionRequest),
2357 ReserveNow(ReserveNowRequest),
2359 Reset(ResetRequest),
2361 SendLocalList(SendLocalListRequest),
2363 SetChargingProfile(SetChargingProfileRequest),
2365 SetDERControl(SetDERControlRequest),
2367 SetDefaultTariff(SetDefaultTariffRequest),
2369 SetDisplayMessage(SetDisplayMessageRequest),
2371 SetMonitoringBase(SetMonitoringBaseRequest),
2373 SetMonitoringLevel(SetMonitoringLevelRequest),
2375 SetNetworkProfile(SetNetworkProfileRequest),
2377 SetVariableMonitoring(SetVariableMonitoringRequest),
2379 SetVariables(SetVariablesRequest),
2381 TriggerMessage(TriggerMessageRequest),
2383 UnlockConnector(UnlockConnectorRequest),
2385 UnpublishFirmware(UnpublishFirmwareRequest),
2387 UpdateDynamicSchedule(UpdateDynamicScheduleRequest),
2389 UpdateFirmware(UpdateFirmwareRequest),
2391 UsePriorityCharging(UsePriorityChargingRequest),
2393}
2394
2395impl CsmsRequest {
2396 #[must_use]
2398 pub const fn action(&self) -> Action {
2399 match self {
2400 Self::AFRRSignal(_) => Action::AFRRSignal,
2401 Self::AdjustPeriodicEventStream(_) => Action::AdjustPeriodicEventStream,
2402 Self::CancelReservation(_) => Action::CancelReservation,
2403 Self::CertificateSigned(_) => Action::CertificateSigned,
2404 Self::ChangeAvailability(_) => Action::ChangeAvailability,
2405 Self::ChangeTransactionTariff(_) => Action::ChangeTransactionTariff,
2406 Self::ClearCache(_) => Action::ClearCache,
2407 Self::ClearChargingProfile(_) => Action::ClearChargingProfile,
2408 Self::ClearDERControl(_) => Action::ClearDERControl,
2409 Self::ClearDisplayMessage(_) => Action::ClearDisplayMessage,
2410 Self::ClearTariffs(_) => Action::ClearTariffs,
2411 Self::ClearVariableMonitoring(_) => Action::ClearVariableMonitoring,
2412 Self::CostUpdated(_) => Action::CostUpdated,
2413 Self::CustomerInformation(_) => Action::CustomerInformation,
2414 Self::DataTransfer(_) => Action::DataTransfer,
2415 Self::DeleteCertificate(_) => Action::DeleteCertificate,
2416 Self::GetBaseReport(_) => Action::GetBaseReport,
2417 Self::GetChargingProfiles(_) => Action::GetChargingProfiles,
2418 Self::GetCompositeSchedule(_) => Action::GetCompositeSchedule,
2419 Self::GetDERControl(_) => Action::GetDERControl,
2420 Self::GetDisplayMessages(_) => Action::GetDisplayMessages,
2421 Self::GetInstalledCertificateIds(_) => Action::GetInstalledCertificateIds,
2422 Self::GetLocalListVersion(_) => Action::GetLocalListVersion,
2423 Self::GetLog(_) => Action::GetLog,
2424 Self::GetMonitoringReport(_) => Action::GetMonitoringReport,
2425 Self::GetPeriodicEventStream(_) => Action::GetPeriodicEventStream,
2426 Self::GetReport(_) => Action::GetReport,
2427 Self::GetTariffs(_) => Action::GetTariffs,
2428 Self::GetTransactionStatus(_) => Action::GetTransactionStatus,
2429 Self::GetVariables(_) => Action::GetVariables,
2430 Self::InstallCertificate(_) => Action::InstallCertificate,
2431 Self::NotifyAllowedEnergyTransfer(_) => Action::NotifyAllowedEnergyTransfer,
2432 Self::NotifyWebPaymentStarted(_) => Action::NotifyWebPaymentStarted,
2433 Self::PublishFirmware(_) => Action::PublishFirmware,
2434 Self::RequestBatterySwap(_) => Action::RequestBatterySwap,
2435 Self::RequestStartTransaction(_) => Action::RequestStartTransaction,
2436 Self::RequestStopTransaction(_) => Action::RequestStopTransaction,
2437 Self::ReserveNow(_) => Action::ReserveNow,
2438 Self::Reset(_) => Action::Reset,
2439 Self::SendLocalList(_) => Action::SendLocalList,
2440 Self::SetChargingProfile(_) => Action::SetChargingProfile,
2441 Self::SetDERControl(_) => Action::SetDERControl,
2442 Self::SetDefaultTariff(_) => Action::SetDefaultTariff,
2443 Self::SetDisplayMessage(_) => Action::SetDisplayMessage,
2444 Self::SetMonitoringBase(_) => Action::SetMonitoringBase,
2445 Self::SetMonitoringLevel(_) => Action::SetMonitoringLevel,
2446 Self::SetNetworkProfile(_) => Action::SetNetworkProfile,
2447 Self::SetVariableMonitoring(_) => Action::SetVariableMonitoring,
2448 Self::SetVariables(_) => Action::SetVariables,
2449 Self::TriggerMessage(_) => Action::TriggerMessage,
2450 Self::UnlockConnector(_) => Action::UnlockConnector,
2451 Self::UnpublishFirmware(_) => Action::UnpublishFirmware,
2452 Self::UpdateDynamicSchedule(_) => Action::UpdateDynamicSchedule,
2453 Self::UpdateFirmware(_) => Action::UpdateFirmware,
2454 Self::UsePriorityCharging(_) => Action::UsePriorityCharging,
2455 }
2456 }
2457
2458 pub fn decode(
2461 action: Action,
2462 payload: &RawValue,
2463 options: &DecodeOptions,
2464 ) -> Result<Self, DecodeError> {
2465 Ok(match action {
2466 Action::AFRRSignal => Self::AFRRSignal(crate::decode::decode_payload::<
2467 AFRRSignalRequest,
2468 >(payload, options)?),
2469 Action::AdjustPeriodicEventStream => {
2470 Self::AdjustPeriodicEventStream(crate::decode::decode_payload::<
2471 AdjustPeriodicEventStreamRequest,
2472 >(payload, options)?)
2473 }
2474 Action::CancelReservation => Self::CancelReservation(crate::decode::decode_payload::<
2475 CancelReservationRequest,
2476 >(payload, options)?),
2477 Action::CertificateSigned => Self::CertificateSigned(crate::decode::decode_payload::<
2478 CertificateSignedRequest,
2479 >(payload, options)?),
2480 Action::ChangeAvailability => Self::ChangeAvailability(
2481 crate::decode::decode_payload::<ChangeAvailabilityRequest>(payload, options)?,
2482 ),
2483 Action::ChangeTransactionTariff => {
2484 Self::ChangeTransactionTariff(crate::decode::decode_payload::<
2485 ChangeTransactionTariffRequest,
2486 >(payload, options)?)
2487 }
2488 Action::ClearCache => Self::ClearCache(crate::decode::decode_payload::<
2489 ClearCacheRequest,
2490 >(payload, options)?),
2491 Action::ClearChargingProfile => {
2492 Self::ClearChargingProfile(crate::decode::decode_payload::<
2493 ClearChargingProfileRequest,
2494 >(payload, options)?)
2495 }
2496 Action::ClearDERControl => Self::ClearDERControl(crate::decode::decode_payload::<
2497 ClearDERControlRequest,
2498 >(payload, options)?),
2499 Action::ClearDisplayMessage => {
2500 Self::ClearDisplayMessage(crate::decode::decode_payload::<
2501 ClearDisplayMessageRequest,
2502 >(payload, options)?)
2503 }
2504 Action::ClearTariffs => Self::ClearTariffs(crate::decode::decode_payload::<
2505 ClearTariffsRequest,
2506 >(payload, options)?),
2507 Action::ClearVariableMonitoring => {
2508 Self::ClearVariableMonitoring(crate::decode::decode_payload::<
2509 ClearVariableMonitoringRequest,
2510 >(payload, options)?)
2511 }
2512 Action::CostUpdated => Self::CostUpdated(crate::decode::decode_payload::<
2513 CostUpdatedRequest,
2514 >(payload, options)?),
2515 Action::CustomerInformation => {
2516 Self::CustomerInformation(crate::decode::decode_payload::<
2517 CustomerInformationRequest,
2518 >(payload, options)?)
2519 }
2520 Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
2521 DataTransferRequest,
2522 >(payload, options)?),
2523 Action::DeleteCertificate => Self::DeleteCertificate(crate::decode::decode_payload::<
2524 DeleteCertificateRequest,
2525 >(payload, options)?),
2526 Action::GetBaseReport => Self::GetBaseReport(crate::decode::decode_payload::<
2527 GetBaseReportRequest,
2528 >(payload, options)?),
2529 Action::GetChargingProfiles => {
2530 Self::GetChargingProfiles(crate::decode::decode_payload::<
2531 GetChargingProfilesRequest,
2532 >(payload, options)?)
2533 }
2534 Action::GetCompositeSchedule => {
2535 Self::GetCompositeSchedule(crate::decode::decode_payload::<
2536 GetCompositeScheduleRequest,
2537 >(payload, options)?)
2538 }
2539 Action::GetDERControl => Self::GetDERControl(crate::decode::decode_payload::<
2540 GetDERControlRequest,
2541 >(payload, options)?),
2542 Action::GetDisplayMessages => Self::GetDisplayMessages(
2543 crate::decode::decode_payload::<GetDisplayMessagesRequest>(payload, options)?,
2544 ),
2545 Action::GetInstalledCertificateIds => {
2546 Self::GetInstalledCertificateIds(crate::decode::decode_payload::<
2547 GetInstalledCertificateIdsRequest,
2548 >(payload, options)?)
2549 }
2550 Action::GetLocalListVersion => {
2551 Self::GetLocalListVersion(crate::decode::decode_payload::<
2552 GetLocalListVersionRequest,
2553 >(payload, options)?)
2554 }
2555 Action::GetLog => Self::GetLog(crate::decode::decode_payload::<GetLogRequest>(
2556 payload, options,
2557 )?),
2558 Action::GetMonitoringReport => {
2559 Self::GetMonitoringReport(crate::decode::decode_payload::<
2560 GetMonitoringReportRequest,
2561 >(payload, options)?)
2562 }
2563 Action::GetPeriodicEventStream => {
2564 Self::GetPeriodicEventStream(crate::decode::decode_payload::<
2565 GetPeriodicEventStreamRequest,
2566 >(payload, options)?)
2567 }
2568 Action::GetReport => Self::GetReport(
2569 crate::decode::decode_payload::<GetReportRequest>(payload, options)?,
2570 ),
2571 Action::GetTariffs => Self::GetTariffs(crate::decode::decode_payload::<
2572 GetTariffsRequest,
2573 >(payload, options)?),
2574 Action::GetTransactionStatus => {
2575 Self::GetTransactionStatus(crate::decode::decode_payload::<
2576 GetTransactionStatusRequest,
2577 >(payload, options)?)
2578 }
2579 Action::GetVariables => Self::GetVariables(crate::decode::decode_payload::<
2580 GetVariablesRequest,
2581 >(payload, options)?),
2582 Action::InstallCertificate => Self::InstallCertificate(
2583 crate::decode::decode_payload::<InstallCertificateRequest>(payload, options)?,
2584 ),
2585 Action::NotifyAllowedEnergyTransfer => {
2586 Self::NotifyAllowedEnergyTransfer(crate::decode::decode_payload::<
2587 NotifyAllowedEnergyTransferRequest,
2588 >(payload, options)?)
2589 }
2590 Action::NotifyWebPaymentStarted => {
2591 Self::NotifyWebPaymentStarted(crate::decode::decode_payload::<
2592 NotifyWebPaymentStartedRequest,
2593 >(payload, options)?)
2594 }
2595 Action::PublishFirmware => Self::PublishFirmware(crate::decode::decode_payload::<
2596 PublishFirmwareRequest,
2597 >(payload, options)?),
2598 Action::RequestBatterySwap => Self::RequestBatterySwap(
2599 crate::decode::decode_payload::<RequestBatterySwapRequest>(payload, options)?,
2600 ),
2601 Action::RequestStartTransaction => {
2602 Self::RequestStartTransaction(crate::decode::decode_payload::<
2603 RequestStartTransactionRequest,
2604 >(payload, options)?)
2605 }
2606 Action::RequestStopTransaction => {
2607 Self::RequestStopTransaction(crate::decode::decode_payload::<
2608 RequestStopTransactionRequest,
2609 >(payload, options)?)
2610 }
2611 Action::ReserveNow => Self::ReserveNow(crate::decode::decode_payload::<
2612 ReserveNowRequest,
2613 >(payload, options)?),
2614 Action::Reset => Self::Reset(crate::decode::decode_payload::<ResetRequest>(
2615 payload, options,
2616 )?),
2617 Action::SendLocalList => Self::SendLocalList(crate::decode::decode_payload::<
2618 SendLocalListRequest,
2619 >(payload, options)?),
2620 Action::SetChargingProfile => Self::SetChargingProfile(
2621 crate::decode::decode_payload::<SetChargingProfileRequest>(payload, options)?,
2622 ),
2623 Action::SetDERControl => Self::SetDERControl(crate::decode::decode_payload::<
2624 SetDERControlRequest,
2625 >(payload, options)?),
2626 Action::SetDefaultTariff => Self::SetDefaultTariff(crate::decode::decode_payload::<
2627 SetDefaultTariffRequest,
2628 >(payload, options)?),
2629 Action::SetDisplayMessage => Self::SetDisplayMessage(crate::decode::decode_payload::<
2630 SetDisplayMessageRequest,
2631 >(payload, options)?),
2632 Action::SetMonitoringBase => Self::SetMonitoringBase(crate::decode::decode_payload::<
2633 SetMonitoringBaseRequest,
2634 >(payload, options)?),
2635 Action::SetMonitoringLevel => Self::SetMonitoringLevel(
2636 crate::decode::decode_payload::<SetMonitoringLevelRequest>(payload, options)?,
2637 ),
2638 Action::SetNetworkProfile => Self::SetNetworkProfile(crate::decode::decode_payload::<
2639 SetNetworkProfileRequest,
2640 >(payload, options)?),
2641 Action::SetVariableMonitoring => {
2642 Self::SetVariableMonitoring(crate::decode::decode_payload::<
2643 SetVariableMonitoringRequest,
2644 >(payload, options)?)
2645 }
2646 Action::SetVariables => Self::SetVariables(crate::decode::decode_payload::<
2647 SetVariablesRequest,
2648 >(payload, options)?),
2649 Action::TriggerMessage => Self::TriggerMessage(crate::decode::decode_payload::<
2650 TriggerMessageRequest,
2651 >(payload, options)?),
2652 Action::UnlockConnector => Self::UnlockConnector(crate::decode::decode_payload::<
2653 UnlockConnectorRequest,
2654 >(payload, options)?),
2655 Action::UnpublishFirmware => Self::UnpublishFirmware(crate::decode::decode_payload::<
2656 UnpublishFirmwareRequest,
2657 >(payload, options)?),
2658 Action::UpdateDynamicSchedule => {
2659 Self::UpdateDynamicSchedule(crate::decode::decode_payload::<
2660 UpdateDynamicScheduleRequest,
2661 >(payload, options)?)
2662 }
2663 Action::UpdateFirmware => Self::UpdateFirmware(crate::decode::decode_payload::<
2664 UpdateFirmwareRequest,
2665 >(payload, options)?),
2666 Action::UsePriorityCharging => {
2667 Self::UsePriorityCharging(crate::decode::decode_payload::<
2668 UsePriorityChargingRequest,
2669 >(payload, options)?)
2670 }
2671 other => return Err(DecodeError::unsupported_action(other.as_str())),
2672 })
2673 }
2674
2675 pub fn decode_reporting(
2678 action: Action,
2679 payload: &RawValue,
2680 options: &DecodeOptions,
2681 ) -> Result<crate::decode::Decoded<Self>, DecodeError> {
2682 Ok(match action {
2683 Action::AFRRSignal => {
2684 crate::decode::decode_payload_reporting::<AFRRSignalRequest>(payload, options)?
2685 .map(Self::AFRRSignal)
2686 }
2687 Action::AdjustPeriodicEventStream => crate::decode::decode_payload_reporting::<
2688 AdjustPeriodicEventStreamRequest,
2689 >(payload, options)?
2690 .map(Self::AdjustPeriodicEventStream),
2691 Action::CancelReservation => crate::decode::decode_payload_reporting::<
2692 CancelReservationRequest,
2693 >(payload, options)?
2694 .map(Self::CancelReservation),
2695 Action::CertificateSigned => crate::decode::decode_payload_reporting::<
2696 CertificateSignedRequest,
2697 >(payload, options)?
2698 .map(Self::CertificateSigned),
2699 Action::ChangeAvailability => crate::decode::decode_payload_reporting::<
2700 ChangeAvailabilityRequest,
2701 >(payload, options)?
2702 .map(Self::ChangeAvailability),
2703 Action::ChangeTransactionTariff => crate::decode::decode_payload_reporting::<
2704 ChangeTransactionTariffRequest,
2705 >(payload, options)?
2706 .map(Self::ChangeTransactionTariff),
2707 Action::ClearCache => {
2708 crate::decode::decode_payload_reporting::<ClearCacheRequest>(payload, options)?
2709 .map(Self::ClearCache)
2710 }
2711 Action::ClearChargingProfile => crate::decode::decode_payload_reporting::<
2712 ClearChargingProfileRequest,
2713 >(payload, options)?
2714 .map(Self::ClearChargingProfile),
2715 Action::ClearDERControl => {
2716 crate::decode::decode_payload_reporting::<ClearDERControlRequest>(payload, options)?
2717 .map(Self::ClearDERControl)
2718 }
2719 Action::ClearDisplayMessage => crate::decode::decode_payload_reporting::<
2720 ClearDisplayMessageRequest,
2721 >(payload, options)?
2722 .map(Self::ClearDisplayMessage),
2723 Action::ClearTariffs => {
2724 crate::decode::decode_payload_reporting::<ClearTariffsRequest>(payload, options)?
2725 .map(Self::ClearTariffs)
2726 }
2727 Action::ClearVariableMonitoring => crate::decode::decode_payload_reporting::<
2728 ClearVariableMonitoringRequest,
2729 >(payload, options)?
2730 .map(Self::ClearVariableMonitoring),
2731 Action::CostUpdated => {
2732 crate::decode::decode_payload_reporting::<CostUpdatedRequest>(payload, options)?
2733 .map(Self::CostUpdated)
2734 }
2735 Action::CustomerInformation => crate::decode::decode_payload_reporting::<
2736 CustomerInformationRequest,
2737 >(payload, options)?
2738 .map(Self::CustomerInformation),
2739 Action::DataTransfer => {
2740 crate::decode::decode_payload_reporting::<DataTransferRequest>(payload, options)?
2741 .map(Self::DataTransfer)
2742 }
2743 Action::DeleteCertificate => crate::decode::decode_payload_reporting::<
2744 DeleteCertificateRequest,
2745 >(payload, options)?
2746 .map(Self::DeleteCertificate),
2747 Action::GetBaseReport => {
2748 crate::decode::decode_payload_reporting::<GetBaseReportRequest>(payload, options)?
2749 .map(Self::GetBaseReport)
2750 }
2751 Action::GetChargingProfiles => crate::decode::decode_payload_reporting::<
2752 GetChargingProfilesRequest,
2753 >(payload, options)?
2754 .map(Self::GetChargingProfiles),
2755 Action::GetCompositeSchedule => crate::decode::decode_payload_reporting::<
2756 GetCompositeScheduleRequest,
2757 >(payload, options)?
2758 .map(Self::GetCompositeSchedule),
2759 Action::GetDERControl => {
2760 crate::decode::decode_payload_reporting::<GetDERControlRequest>(payload, options)?
2761 .map(Self::GetDERControl)
2762 }
2763 Action::GetDisplayMessages => crate::decode::decode_payload_reporting::<
2764 GetDisplayMessagesRequest,
2765 >(payload, options)?
2766 .map(Self::GetDisplayMessages),
2767 Action::GetInstalledCertificateIds => crate::decode::decode_payload_reporting::<
2768 GetInstalledCertificateIdsRequest,
2769 >(payload, options)?
2770 .map(Self::GetInstalledCertificateIds),
2771 Action::GetLocalListVersion => crate::decode::decode_payload_reporting::<
2772 GetLocalListVersionRequest,
2773 >(payload, options)?
2774 .map(Self::GetLocalListVersion),
2775 Action::GetLog => {
2776 crate::decode::decode_payload_reporting::<GetLogRequest>(payload, options)?
2777 .map(Self::GetLog)
2778 }
2779 Action::GetMonitoringReport => crate::decode::decode_payload_reporting::<
2780 GetMonitoringReportRequest,
2781 >(payload, options)?
2782 .map(Self::GetMonitoringReport),
2783 Action::GetPeriodicEventStream => crate::decode::decode_payload_reporting::<
2784 GetPeriodicEventStreamRequest,
2785 >(payload, options)?
2786 .map(Self::GetPeriodicEventStream),
2787 Action::GetReport => {
2788 crate::decode::decode_payload_reporting::<GetReportRequest>(payload, options)?
2789 .map(Self::GetReport)
2790 }
2791 Action::GetTariffs => {
2792 crate::decode::decode_payload_reporting::<GetTariffsRequest>(payload, options)?
2793 .map(Self::GetTariffs)
2794 }
2795 Action::GetTransactionStatus => crate::decode::decode_payload_reporting::<
2796 GetTransactionStatusRequest,
2797 >(payload, options)?
2798 .map(Self::GetTransactionStatus),
2799 Action::GetVariables => {
2800 crate::decode::decode_payload_reporting::<GetVariablesRequest>(payload, options)?
2801 .map(Self::GetVariables)
2802 }
2803 Action::InstallCertificate => crate::decode::decode_payload_reporting::<
2804 InstallCertificateRequest,
2805 >(payload, options)?
2806 .map(Self::InstallCertificate),
2807 Action::NotifyAllowedEnergyTransfer => crate::decode::decode_payload_reporting::<
2808 NotifyAllowedEnergyTransferRequest,
2809 >(payload, options)?
2810 .map(Self::NotifyAllowedEnergyTransfer),
2811 Action::NotifyWebPaymentStarted => crate::decode::decode_payload_reporting::<
2812 NotifyWebPaymentStartedRequest,
2813 >(payload, options)?
2814 .map(Self::NotifyWebPaymentStarted),
2815 Action::PublishFirmware => {
2816 crate::decode::decode_payload_reporting::<PublishFirmwareRequest>(payload, options)?
2817 .map(Self::PublishFirmware)
2818 }
2819 Action::RequestBatterySwap => crate::decode::decode_payload_reporting::<
2820 RequestBatterySwapRequest,
2821 >(payload, options)?
2822 .map(Self::RequestBatterySwap),
2823 Action::RequestStartTransaction => crate::decode::decode_payload_reporting::<
2824 RequestStartTransactionRequest,
2825 >(payload, options)?
2826 .map(Self::RequestStartTransaction),
2827 Action::RequestStopTransaction => crate::decode::decode_payload_reporting::<
2828 RequestStopTransactionRequest,
2829 >(payload, options)?
2830 .map(Self::RequestStopTransaction),
2831 Action::ReserveNow => {
2832 crate::decode::decode_payload_reporting::<ReserveNowRequest>(payload, options)?
2833 .map(Self::ReserveNow)
2834 }
2835 Action::Reset => {
2836 crate::decode::decode_payload_reporting::<ResetRequest>(payload, options)?
2837 .map(Self::Reset)
2838 }
2839 Action::SendLocalList => {
2840 crate::decode::decode_payload_reporting::<SendLocalListRequest>(payload, options)?
2841 .map(Self::SendLocalList)
2842 }
2843 Action::SetChargingProfile => crate::decode::decode_payload_reporting::<
2844 SetChargingProfileRequest,
2845 >(payload, options)?
2846 .map(Self::SetChargingProfile),
2847 Action::SetDERControl => {
2848 crate::decode::decode_payload_reporting::<SetDERControlRequest>(payload, options)?
2849 .map(Self::SetDERControl)
2850 }
2851 Action::SetDefaultTariff => crate::decode::decode_payload_reporting::<
2852 SetDefaultTariffRequest,
2853 >(payload, options)?
2854 .map(Self::SetDefaultTariff),
2855 Action::SetDisplayMessage => crate::decode::decode_payload_reporting::<
2856 SetDisplayMessageRequest,
2857 >(payload, options)?
2858 .map(Self::SetDisplayMessage),
2859 Action::SetMonitoringBase => crate::decode::decode_payload_reporting::<
2860 SetMonitoringBaseRequest,
2861 >(payload, options)?
2862 .map(Self::SetMonitoringBase),
2863 Action::SetMonitoringLevel => crate::decode::decode_payload_reporting::<
2864 SetMonitoringLevelRequest,
2865 >(payload, options)?
2866 .map(Self::SetMonitoringLevel),
2867 Action::SetNetworkProfile => crate::decode::decode_payload_reporting::<
2868 SetNetworkProfileRequest,
2869 >(payload, options)?
2870 .map(Self::SetNetworkProfile),
2871 Action::SetVariableMonitoring => crate::decode::decode_payload_reporting::<
2872 SetVariableMonitoringRequest,
2873 >(payload, options)?
2874 .map(Self::SetVariableMonitoring),
2875 Action::SetVariables => {
2876 crate::decode::decode_payload_reporting::<SetVariablesRequest>(payload, options)?
2877 .map(Self::SetVariables)
2878 }
2879 Action::TriggerMessage => {
2880 crate::decode::decode_payload_reporting::<TriggerMessageRequest>(payload, options)?
2881 .map(Self::TriggerMessage)
2882 }
2883 Action::UnlockConnector => {
2884 crate::decode::decode_payload_reporting::<UnlockConnectorRequest>(payload, options)?
2885 .map(Self::UnlockConnector)
2886 }
2887 Action::UnpublishFirmware => crate::decode::decode_payload_reporting::<
2888 UnpublishFirmwareRequest,
2889 >(payload, options)?
2890 .map(Self::UnpublishFirmware),
2891 Action::UpdateDynamicSchedule => crate::decode::decode_payload_reporting::<
2892 UpdateDynamicScheduleRequest,
2893 >(payload, options)?
2894 .map(Self::UpdateDynamicSchedule),
2895 Action::UpdateFirmware => {
2896 crate::decode::decode_payload_reporting::<UpdateFirmwareRequest>(payload, options)?
2897 .map(Self::UpdateFirmware)
2898 }
2899 Action::UsePriorityCharging => crate::decode::decode_payload_reporting::<
2900 UsePriorityChargingRequest,
2901 >(payload, options)?
2902 .map(Self::UsePriorityCharging),
2903 other => return Err(DecodeError::unsupported_action(other.as_str())),
2904 })
2905 }
2906
2907 pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
2909 match self {
2910 Self::AFRRSignal(p) => serde_json::to_string(p),
2911 Self::AdjustPeriodicEventStream(p) => serde_json::to_string(p),
2912 Self::CancelReservation(p) => serde_json::to_string(p),
2913 Self::CertificateSigned(p) => serde_json::to_string(p),
2914 Self::ChangeAvailability(p) => serde_json::to_string(p),
2915 Self::ChangeTransactionTariff(p) => serde_json::to_string(p),
2916 Self::ClearCache(p) => serde_json::to_string(p),
2917 Self::ClearChargingProfile(p) => serde_json::to_string(p),
2918 Self::ClearDERControl(p) => serde_json::to_string(p),
2919 Self::ClearDisplayMessage(p) => serde_json::to_string(p),
2920 Self::ClearTariffs(p) => serde_json::to_string(p),
2921 Self::ClearVariableMonitoring(p) => serde_json::to_string(p),
2922 Self::CostUpdated(p) => serde_json::to_string(p),
2923 Self::CustomerInformation(p) => serde_json::to_string(p),
2924 Self::DataTransfer(p) => serde_json::to_string(p),
2925 Self::DeleteCertificate(p) => serde_json::to_string(p),
2926 Self::GetBaseReport(p) => serde_json::to_string(p),
2927 Self::GetChargingProfiles(p) => serde_json::to_string(p),
2928 Self::GetCompositeSchedule(p) => serde_json::to_string(p),
2929 Self::GetDERControl(p) => serde_json::to_string(p),
2930 Self::GetDisplayMessages(p) => serde_json::to_string(p),
2931 Self::GetInstalledCertificateIds(p) => serde_json::to_string(p),
2932 Self::GetLocalListVersion(p) => serde_json::to_string(p),
2933 Self::GetLog(p) => serde_json::to_string(p),
2934 Self::GetMonitoringReport(p) => serde_json::to_string(p),
2935 Self::GetPeriodicEventStream(p) => serde_json::to_string(p),
2936 Self::GetReport(p) => serde_json::to_string(p),
2937 Self::GetTariffs(p) => serde_json::to_string(p),
2938 Self::GetTransactionStatus(p) => serde_json::to_string(p),
2939 Self::GetVariables(p) => serde_json::to_string(p),
2940 Self::InstallCertificate(p) => serde_json::to_string(p),
2941 Self::NotifyAllowedEnergyTransfer(p) => serde_json::to_string(p),
2942 Self::NotifyWebPaymentStarted(p) => serde_json::to_string(p),
2943 Self::PublishFirmware(p) => serde_json::to_string(p),
2944 Self::RequestBatterySwap(p) => serde_json::to_string(p),
2945 Self::RequestStartTransaction(p) => serde_json::to_string(p),
2946 Self::RequestStopTransaction(p) => serde_json::to_string(p),
2947 Self::ReserveNow(p) => serde_json::to_string(p),
2948 Self::Reset(p) => serde_json::to_string(p),
2949 Self::SendLocalList(p) => serde_json::to_string(p),
2950 Self::SetChargingProfile(p) => serde_json::to_string(p),
2951 Self::SetDERControl(p) => serde_json::to_string(p),
2952 Self::SetDefaultTariff(p) => serde_json::to_string(p),
2953 Self::SetDisplayMessage(p) => serde_json::to_string(p),
2954 Self::SetMonitoringBase(p) => serde_json::to_string(p),
2955 Self::SetMonitoringLevel(p) => serde_json::to_string(p),
2956 Self::SetNetworkProfile(p) => serde_json::to_string(p),
2957 Self::SetVariableMonitoring(p) => serde_json::to_string(p),
2958 Self::SetVariables(p) => serde_json::to_string(p),
2959 Self::TriggerMessage(p) => serde_json::to_string(p),
2960 Self::UnlockConnector(p) => serde_json::to_string(p),
2961 Self::UnpublishFirmware(p) => serde_json::to_string(p),
2962 Self::UpdateDynamicSchedule(p) => serde_json::to_string(p),
2963 Self::UpdateFirmware(p) => serde_json::to_string(p),
2964 Self::UsePriorityCharging(p) => serde_json::to_string(p),
2965 }
2966 }
2967}
2968
2969impl Validate for CsmsRequest {
2970 fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2971 match self {
2972 Self::AFRRSignal(p) => p.validate_at(path, out),
2973 Self::AdjustPeriodicEventStream(p) => p.validate_at(path, out),
2974 Self::CancelReservation(p) => p.validate_at(path, out),
2975 Self::CertificateSigned(p) => p.validate_at(path, out),
2976 Self::ChangeAvailability(p) => p.validate_at(path, out),
2977 Self::ChangeTransactionTariff(p) => p.validate_at(path, out),
2978 Self::ClearCache(p) => p.validate_at(path, out),
2979 Self::ClearChargingProfile(p) => p.validate_at(path, out),
2980 Self::ClearDERControl(p) => p.validate_at(path, out),
2981 Self::ClearDisplayMessage(p) => p.validate_at(path, out),
2982 Self::ClearTariffs(p) => p.validate_at(path, out),
2983 Self::ClearVariableMonitoring(p) => p.validate_at(path, out),
2984 Self::CostUpdated(p) => p.validate_at(path, out),
2985 Self::CustomerInformation(p) => p.validate_at(path, out),
2986 Self::DataTransfer(p) => p.validate_at(path, out),
2987 Self::DeleteCertificate(p) => p.validate_at(path, out),
2988 Self::GetBaseReport(p) => p.validate_at(path, out),
2989 Self::GetChargingProfiles(p) => p.validate_at(path, out),
2990 Self::GetCompositeSchedule(p) => p.validate_at(path, out),
2991 Self::GetDERControl(p) => p.validate_at(path, out),
2992 Self::GetDisplayMessages(p) => p.validate_at(path, out),
2993 Self::GetInstalledCertificateIds(p) => p.validate_at(path, out),
2994 Self::GetLocalListVersion(p) => p.validate_at(path, out),
2995 Self::GetLog(p) => p.validate_at(path, out),
2996 Self::GetMonitoringReport(p) => p.validate_at(path, out),
2997 Self::GetPeriodicEventStream(p) => p.validate_at(path, out),
2998 Self::GetReport(p) => p.validate_at(path, out),
2999 Self::GetTariffs(p) => p.validate_at(path, out),
3000 Self::GetTransactionStatus(p) => p.validate_at(path, out),
3001 Self::GetVariables(p) => p.validate_at(path, out),
3002 Self::InstallCertificate(p) => p.validate_at(path, out),
3003 Self::NotifyAllowedEnergyTransfer(p) => p.validate_at(path, out),
3004 Self::NotifyWebPaymentStarted(p) => p.validate_at(path, out),
3005 Self::PublishFirmware(p) => p.validate_at(path, out),
3006 Self::RequestBatterySwap(p) => p.validate_at(path, out),
3007 Self::RequestStartTransaction(p) => p.validate_at(path, out),
3008 Self::RequestStopTransaction(p) => p.validate_at(path, out),
3009 Self::ReserveNow(p) => p.validate_at(path, out),
3010 Self::Reset(p) => p.validate_at(path, out),
3011 Self::SendLocalList(p) => p.validate_at(path, out),
3012 Self::SetChargingProfile(p) => p.validate_at(path, out),
3013 Self::SetDERControl(p) => p.validate_at(path, out),
3014 Self::SetDefaultTariff(p) => p.validate_at(path, out),
3015 Self::SetDisplayMessage(p) => p.validate_at(path, out),
3016 Self::SetMonitoringBase(p) => p.validate_at(path, out),
3017 Self::SetMonitoringLevel(p) => p.validate_at(path, out),
3018 Self::SetNetworkProfile(p) => p.validate_at(path, out),
3019 Self::SetVariableMonitoring(p) => p.validate_at(path, out),
3020 Self::SetVariables(p) => p.validate_at(path, out),
3021 Self::TriggerMessage(p) => p.validate_at(path, out),
3022 Self::UnlockConnector(p) => p.validate_at(path, out),
3023 Self::UnpublishFirmware(p) => p.validate_at(path, out),
3024 Self::UpdateDynamicSchedule(p) => p.validate_at(path, out),
3025 Self::UpdateFirmware(p) => p.validate_at(path, out),
3026 Self::UsePriorityCharging(p) => p.validate_at(path, out),
3027 }
3028 }
3029}
3030
3031impl serde::Serialize for CsmsRequest {
3032 fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
3033 match self {
3034 Self::AFRRSignal(p) => p.serialize(ser),
3035 Self::AdjustPeriodicEventStream(p) => p.serialize(ser),
3036 Self::CancelReservation(p) => p.serialize(ser),
3037 Self::CertificateSigned(p) => p.serialize(ser),
3038 Self::ChangeAvailability(p) => p.serialize(ser),
3039 Self::ChangeTransactionTariff(p) => p.serialize(ser),
3040 Self::ClearCache(p) => p.serialize(ser),
3041 Self::ClearChargingProfile(p) => p.serialize(ser),
3042 Self::ClearDERControl(p) => p.serialize(ser),
3043 Self::ClearDisplayMessage(p) => p.serialize(ser),
3044 Self::ClearTariffs(p) => p.serialize(ser),
3045 Self::ClearVariableMonitoring(p) => p.serialize(ser),
3046 Self::CostUpdated(p) => p.serialize(ser),
3047 Self::CustomerInformation(p) => p.serialize(ser),
3048 Self::DataTransfer(p) => p.serialize(ser),
3049 Self::DeleteCertificate(p) => p.serialize(ser),
3050 Self::GetBaseReport(p) => p.serialize(ser),
3051 Self::GetChargingProfiles(p) => p.serialize(ser),
3052 Self::GetCompositeSchedule(p) => p.serialize(ser),
3053 Self::GetDERControl(p) => p.serialize(ser),
3054 Self::GetDisplayMessages(p) => p.serialize(ser),
3055 Self::GetInstalledCertificateIds(p) => p.serialize(ser),
3056 Self::GetLocalListVersion(p) => p.serialize(ser),
3057 Self::GetLog(p) => p.serialize(ser),
3058 Self::GetMonitoringReport(p) => p.serialize(ser),
3059 Self::GetPeriodicEventStream(p) => p.serialize(ser),
3060 Self::GetReport(p) => p.serialize(ser),
3061 Self::GetTariffs(p) => p.serialize(ser),
3062 Self::GetTransactionStatus(p) => p.serialize(ser),
3063 Self::GetVariables(p) => p.serialize(ser),
3064 Self::InstallCertificate(p) => p.serialize(ser),
3065 Self::NotifyAllowedEnergyTransfer(p) => p.serialize(ser),
3066 Self::NotifyWebPaymentStarted(p) => p.serialize(ser),
3067 Self::PublishFirmware(p) => p.serialize(ser),
3068 Self::RequestBatterySwap(p) => p.serialize(ser),
3069 Self::RequestStartTransaction(p) => p.serialize(ser),
3070 Self::RequestStopTransaction(p) => p.serialize(ser),
3071 Self::ReserveNow(p) => p.serialize(ser),
3072 Self::Reset(p) => p.serialize(ser),
3073 Self::SendLocalList(p) => p.serialize(ser),
3074 Self::SetChargingProfile(p) => p.serialize(ser),
3075 Self::SetDERControl(p) => p.serialize(ser),
3076 Self::SetDefaultTariff(p) => p.serialize(ser),
3077 Self::SetDisplayMessage(p) => p.serialize(ser),
3078 Self::SetMonitoringBase(p) => p.serialize(ser),
3079 Self::SetMonitoringLevel(p) => p.serialize(ser),
3080 Self::SetNetworkProfile(p) => p.serialize(ser),
3081 Self::SetVariableMonitoring(p) => p.serialize(ser),
3082 Self::SetVariables(p) => p.serialize(ser),
3083 Self::TriggerMessage(p) => p.serialize(ser),
3084 Self::UnlockConnector(p) => p.serialize(ser),
3085 Self::UnpublishFirmware(p) => p.serialize(ser),
3086 Self::UpdateDynamicSchedule(p) => p.serialize(ser),
3087 Self::UpdateFirmware(p) => p.serialize(ser),
3088 Self::UsePriorityCharging(p) => p.serialize(ser),
3089 }
3090 }
3091}
3092
3093impl crate::message::Sealed for CsmsRequest {}
3094
3095impl crate::message::DecodeRequest for CsmsRequest {
3096 type Action = Action;
3097
3098 fn decode_reporting(
3099 action: Action,
3100 payload: &RawValue,
3101 options: &DecodeOptions,
3102 ) -> Result<crate::decode::Decoded<Self>, DecodeError> {
3103 CsmsRequest::decode_reporting(action, payload, options)
3104 }
3105}
3106
3107#[derive(Clone, Debug, PartialEq)]
3109#[non_exhaustive]
3110#[allow(clippy::large_enum_variant)]
3111pub enum CsmsResponse {
3112 AFRRSignal(AFRRSignalResponse),
3114 AdjustPeriodicEventStream(AdjustPeriodicEventStreamResponse),
3116 CancelReservation(CancelReservationResponse),
3118 CertificateSigned(CertificateSignedResponse),
3120 ChangeAvailability(ChangeAvailabilityResponse),
3122 ChangeTransactionTariff(ChangeTransactionTariffResponse),
3124 ClearCache(ClearCacheResponse),
3126 ClearChargingProfile(ClearChargingProfileResponse),
3128 ClearDERControl(ClearDERControlResponse),
3130 ClearDisplayMessage(ClearDisplayMessageResponse),
3132 ClearTariffs(ClearTariffsResponse),
3134 ClearVariableMonitoring(ClearVariableMonitoringResponse),
3136 CostUpdated(CostUpdatedResponse),
3138 CustomerInformation(CustomerInformationResponse),
3140 DataTransfer(DataTransferResponse),
3142 DeleteCertificate(DeleteCertificateResponse),
3144 GetBaseReport(GetBaseReportResponse),
3146 GetChargingProfiles(GetChargingProfilesResponse),
3148 GetCompositeSchedule(GetCompositeScheduleResponse),
3150 GetDERControl(GetDERControlResponse),
3152 GetDisplayMessages(GetDisplayMessagesResponse),
3154 GetInstalledCertificateIds(GetInstalledCertificateIdsResponse),
3156 GetLocalListVersion(GetLocalListVersionResponse),
3158 GetLog(GetLogResponse),
3160 GetMonitoringReport(GetMonitoringReportResponse),
3162 GetPeriodicEventStream(GetPeriodicEventStreamResponse),
3164 GetReport(GetReportResponse),
3166 GetTariffs(GetTariffsResponse),
3168 GetTransactionStatus(GetTransactionStatusResponse),
3170 GetVariables(GetVariablesResponse),
3172 InstallCertificate(InstallCertificateResponse),
3174 NotifyAllowedEnergyTransfer(NotifyAllowedEnergyTransferResponse),
3176 NotifyWebPaymentStarted(NotifyWebPaymentStartedResponse),
3178 PublishFirmware(PublishFirmwareResponse),
3180 RequestBatterySwap(RequestBatterySwapResponse),
3182 RequestStartTransaction(RequestStartTransactionResponse),
3184 RequestStopTransaction(RequestStopTransactionResponse),
3186 ReserveNow(ReserveNowResponse),
3188 Reset(ResetResponse),
3190 SendLocalList(SendLocalListResponse),
3192 SetChargingProfile(SetChargingProfileResponse),
3194 SetDERControl(SetDERControlResponse),
3196 SetDefaultTariff(SetDefaultTariffResponse),
3198 SetDisplayMessage(SetDisplayMessageResponse),
3200 SetMonitoringBase(SetMonitoringBaseResponse),
3202 SetMonitoringLevel(SetMonitoringLevelResponse),
3204 SetNetworkProfile(SetNetworkProfileResponse),
3206 SetVariableMonitoring(SetVariableMonitoringResponse),
3208 SetVariables(SetVariablesResponse),
3210 TriggerMessage(TriggerMessageResponse),
3212 UnlockConnector(UnlockConnectorResponse),
3214 UnpublishFirmware(UnpublishFirmwareResponse),
3216 UpdateDynamicSchedule(UpdateDynamicScheduleResponse),
3218 UpdateFirmware(UpdateFirmwareResponse),
3220 UsePriorityCharging(UsePriorityChargingResponse),
3222}
3223
3224impl CsmsResponse {
3225 #[must_use]
3227 pub const fn action(&self) -> Action {
3228 match self {
3229 Self::AFRRSignal(_) => Action::AFRRSignal,
3230 Self::AdjustPeriodicEventStream(_) => Action::AdjustPeriodicEventStream,
3231 Self::CancelReservation(_) => Action::CancelReservation,
3232 Self::CertificateSigned(_) => Action::CertificateSigned,
3233 Self::ChangeAvailability(_) => Action::ChangeAvailability,
3234 Self::ChangeTransactionTariff(_) => Action::ChangeTransactionTariff,
3235 Self::ClearCache(_) => Action::ClearCache,
3236 Self::ClearChargingProfile(_) => Action::ClearChargingProfile,
3237 Self::ClearDERControl(_) => Action::ClearDERControl,
3238 Self::ClearDisplayMessage(_) => Action::ClearDisplayMessage,
3239 Self::ClearTariffs(_) => Action::ClearTariffs,
3240 Self::ClearVariableMonitoring(_) => Action::ClearVariableMonitoring,
3241 Self::CostUpdated(_) => Action::CostUpdated,
3242 Self::CustomerInformation(_) => Action::CustomerInformation,
3243 Self::DataTransfer(_) => Action::DataTransfer,
3244 Self::DeleteCertificate(_) => Action::DeleteCertificate,
3245 Self::GetBaseReport(_) => Action::GetBaseReport,
3246 Self::GetChargingProfiles(_) => Action::GetChargingProfiles,
3247 Self::GetCompositeSchedule(_) => Action::GetCompositeSchedule,
3248 Self::GetDERControl(_) => Action::GetDERControl,
3249 Self::GetDisplayMessages(_) => Action::GetDisplayMessages,
3250 Self::GetInstalledCertificateIds(_) => Action::GetInstalledCertificateIds,
3251 Self::GetLocalListVersion(_) => Action::GetLocalListVersion,
3252 Self::GetLog(_) => Action::GetLog,
3253 Self::GetMonitoringReport(_) => Action::GetMonitoringReport,
3254 Self::GetPeriodicEventStream(_) => Action::GetPeriodicEventStream,
3255 Self::GetReport(_) => Action::GetReport,
3256 Self::GetTariffs(_) => Action::GetTariffs,
3257 Self::GetTransactionStatus(_) => Action::GetTransactionStatus,
3258 Self::GetVariables(_) => Action::GetVariables,
3259 Self::InstallCertificate(_) => Action::InstallCertificate,
3260 Self::NotifyAllowedEnergyTransfer(_) => Action::NotifyAllowedEnergyTransfer,
3261 Self::NotifyWebPaymentStarted(_) => Action::NotifyWebPaymentStarted,
3262 Self::PublishFirmware(_) => Action::PublishFirmware,
3263 Self::RequestBatterySwap(_) => Action::RequestBatterySwap,
3264 Self::RequestStartTransaction(_) => Action::RequestStartTransaction,
3265 Self::RequestStopTransaction(_) => Action::RequestStopTransaction,
3266 Self::ReserveNow(_) => Action::ReserveNow,
3267 Self::Reset(_) => Action::Reset,
3268 Self::SendLocalList(_) => Action::SendLocalList,
3269 Self::SetChargingProfile(_) => Action::SetChargingProfile,
3270 Self::SetDERControl(_) => Action::SetDERControl,
3271 Self::SetDefaultTariff(_) => Action::SetDefaultTariff,
3272 Self::SetDisplayMessage(_) => Action::SetDisplayMessage,
3273 Self::SetMonitoringBase(_) => Action::SetMonitoringBase,
3274 Self::SetMonitoringLevel(_) => Action::SetMonitoringLevel,
3275 Self::SetNetworkProfile(_) => Action::SetNetworkProfile,
3276 Self::SetVariableMonitoring(_) => Action::SetVariableMonitoring,
3277 Self::SetVariables(_) => Action::SetVariables,
3278 Self::TriggerMessage(_) => Action::TriggerMessage,
3279 Self::UnlockConnector(_) => Action::UnlockConnector,
3280 Self::UnpublishFirmware(_) => Action::UnpublishFirmware,
3281 Self::UpdateDynamicSchedule(_) => Action::UpdateDynamicSchedule,
3282 Self::UpdateFirmware(_) => Action::UpdateFirmware,
3283 Self::UsePriorityCharging(_) => Action::UsePriorityCharging,
3284 }
3285 }
3286
3287 pub fn decode(
3290 action: Action,
3291 payload: &RawValue,
3292 options: &DecodeOptions,
3293 ) -> Result<Self, DecodeError> {
3294 Ok(match action {
3295 Action::AFRRSignal => Self::AFRRSignal(crate::decode::decode_payload::<
3296 AFRRSignalResponse,
3297 >(payload, options)?),
3298 Action::AdjustPeriodicEventStream => {
3299 Self::AdjustPeriodicEventStream(crate::decode::decode_payload::<
3300 AdjustPeriodicEventStreamResponse,
3301 >(payload, options)?)
3302 }
3303 Action::CancelReservation => Self::CancelReservation(crate::decode::decode_payload::<
3304 CancelReservationResponse,
3305 >(payload, options)?),
3306 Action::CertificateSigned => Self::CertificateSigned(crate::decode::decode_payload::<
3307 CertificateSignedResponse,
3308 >(payload, options)?),
3309 Action::ChangeAvailability => Self::ChangeAvailability(
3310 crate::decode::decode_payload::<ChangeAvailabilityResponse>(payload, options)?,
3311 ),
3312 Action::ChangeTransactionTariff => {
3313 Self::ChangeTransactionTariff(crate::decode::decode_payload::<
3314 ChangeTransactionTariffResponse,
3315 >(payload, options)?)
3316 }
3317 Action::ClearCache => Self::ClearCache(crate::decode::decode_payload::<
3318 ClearCacheResponse,
3319 >(payload, options)?),
3320 Action::ClearChargingProfile => {
3321 Self::ClearChargingProfile(crate::decode::decode_payload::<
3322 ClearChargingProfileResponse,
3323 >(payload, options)?)
3324 }
3325 Action::ClearDERControl => Self::ClearDERControl(crate::decode::decode_payload::<
3326 ClearDERControlResponse,
3327 >(payload, options)?),
3328 Action::ClearDisplayMessage => {
3329 Self::ClearDisplayMessage(crate::decode::decode_payload::<
3330 ClearDisplayMessageResponse,
3331 >(payload, options)?)
3332 }
3333 Action::ClearTariffs => Self::ClearTariffs(crate::decode::decode_payload::<
3334 ClearTariffsResponse,
3335 >(payload, options)?),
3336 Action::ClearVariableMonitoring => {
3337 Self::ClearVariableMonitoring(crate::decode::decode_payload::<
3338 ClearVariableMonitoringResponse,
3339 >(payload, options)?)
3340 }
3341 Action::CostUpdated => Self::CostUpdated(crate::decode::decode_payload::<
3342 CostUpdatedResponse,
3343 >(payload, options)?),
3344 Action::CustomerInformation => {
3345 Self::CustomerInformation(crate::decode::decode_payload::<
3346 CustomerInformationResponse,
3347 >(payload, options)?)
3348 }
3349 Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
3350 DataTransferResponse,
3351 >(payload, options)?),
3352 Action::DeleteCertificate => Self::DeleteCertificate(crate::decode::decode_payload::<
3353 DeleteCertificateResponse,
3354 >(payload, options)?),
3355 Action::GetBaseReport => Self::GetBaseReport(crate::decode::decode_payload::<
3356 GetBaseReportResponse,
3357 >(payload, options)?),
3358 Action::GetChargingProfiles => {
3359 Self::GetChargingProfiles(crate::decode::decode_payload::<
3360 GetChargingProfilesResponse,
3361 >(payload, options)?)
3362 }
3363 Action::GetCompositeSchedule => {
3364 Self::GetCompositeSchedule(crate::decode::decode_payload::<
3365 GetCompositeScheduleResponse,
3366 >(payload, options)?)
3367 }
3368 Action::GetDERControl => Self::GetDERControl(crate::decode::decode_payload::<
3369 GetDERControlResponse,
3370 >(payload, options)?),
3371 Action::GetDisplayMessages => Self::GetDisplayMessages(
3372 crate::decode::decode_payload::<GetDisplayMessagesResponse>(payload, options)?,
3373 ),
3374 Action::GetInstalledCertificateIds => {
3375 Self::GetInstalledCertificateIds(crate::decode::decode_payload::<
3376 GetInstalledCertificateIdsResponse,
3377 >(payload, options)?)
3378 }
3379 Action::GetLocalListVersion => {
3380 Self::GetLocalListVersion(crate::decode::decode_payload::<
3381 GetLocalListVersionResponse,
3382 >(payload, options)?)
3383 }
3384 Action::GetLog => Self::GetLog(crate::decode::decode_payload::<GetLogResponse>(
3385 payload, options,
3386 )?),
3387 Action::GetMonitoringReport => {
3388 Self::GetMonitoringReport(crate::decode::decode_payload::<
3389 GetMonitoringReportResponse,
3390 >(payload, options)?)
3391 }
3392 Action::GetPeriodicEventStream => {
3393 Self::GetPeriodicEventStream(crate::decode::decode_payload::<
3394 GetPeriodicEventStreamResponse,
3395 >(payload, options)?)
3396 }
3397 Action::GetReport => Self::GetReport(
3398 crate::decode::decode_payload::<GetReportResponse>(payload, options)?,
3399 ),
3400 Action::GetTariffs => Self::GetTariffs(crate::decode::decode_payload::<
3401 GetTariffsResponse,
3402 >(payload, options)?),
3403 Action::GetTransactionStatus => {
3404 Self::GetTransactionStatus(crate::decode::decode_payload::<
3405 GetTransactionStatusResponse,
3406 >(payload, options)?)
3407 }
3408 Action::GetVariables => Self::GetVariables(crate::decode::decode_payload::<
3409 GetVariablesResponse,
3410 >(payload, options)?),
3411 Action::InstallCertificate => Self::InstallCertificate(
3412 crate::decode::decode_payload::<InstallCertificateResponse>(payload, options)?,
3413 ),
3414 Action::NotifyAllowedEnergyTransfer => {
3415 Self::NotifyAllowedEnergyTransfer(crate::decode::decode_payload::<
3416 NotifyAllowedEnergyTransferResponse,
3417 >(payload, options)?)
3418 }
3419 Action::NotifyWebPaymentStarted => {
3420 Self::NotifyWebPaymentStarted(crate::decode::decode_payload::<
3421 NotifyWebPaymentStartedResponse,
3422 >(payload, options)?)
3423 }
3424 Action::PublishFirmware => Self::PublishFirmware(crate::decode::decode_payload::<
3425 PublishFirmwareResponse,
3426 >(payload, options)?),
3427 Action::RequestBatterySwap => Self::RequestBatterySwap(
3428 crate::decode::decode_payload::<RequestBatterySwapResponse>(payload, options)?,
3429 ),
3430 Action::RequestStartTransaction => {
3431 Self::RequestStartTransaction(crate::decode::decode_payload::<
3432 RequestStartTransactionResponse,
3433 >(payload, options)?)
3434 }
3435 Action::RequestStopTransaction => {
3436 Self::RequestStopTransaction(crate::decode::decode_payload::<
3437 RequestStopTransactionResponse,
3438 >(payload, options)?)
3439 }
3440 Action::ReserveNow => Self::ReserveNow(crate::decode::decode_payload::<
3441 ReserveNowResponse,
3442 >(payload, options)?),
3443 Action::Reset => Self::Reset(crate::decode::decode_payload::<ResetResponse>(
3444 payload, options,
3445 )?),
3446 Action::SendLocalList => Self::SendLocalList(crate::decode::decode_payload::<
3447 SendLocalListResponse,
3448 >(payload, options)?),
3449 Action::SetChargingProfile => Self::SetChargingProfile(
3450 crate::decode::decode_payload::<SetChargingProfileResponse>(payload, options)?,
3451 ),
3452 Action::SetDERControl => Self::SetDERControl(crate::decode::decode_payload::<
3453 SetDERControlResponse,
3454 >(payload, options)?),
3455 Action::SetDefaultTariff => Self::SetDefaultTariff(crate::decode::decode_payload::<
3456 SetDefaultTariffResponse,
3457 >(payload, options)?),
3458 Action::SetDisplayMessage => Self::SetDisplayMessage(crate::decode::decode_payload::<
3459 SetDisplayMessageResponse,
3460 >(payload, options)?),
3461 Action::SetMonitoringBase => Self::SetMonitoringBase(crate::decode::decode_payload::<
3462 SetMonitoringBaseResponse,
3463 >(payload, options)?),
3464 Action::SetMonitoringLevel => Self::SetMonitoringLevel(
3465 crate::decode::decode_payload::<SetMonitoringLevelResponse>(payload, options)?,
3466 ),
3467 Action::SetNetworkProfile => Self::SetNetworkProfile(crate::decode::decode_payload::<
3468 SetNetworkProfileResponse,
3469 >(payload, options)?),
3470 Action::SetVariableMonitoring => {
3471 Self::SetVariableMonitoring(crate::decode::decode_payload::<
3472 SetVariableMonitoringResponse,
3473 >(payload, options)?)
3474 }
3475 Action::SetVariables => Self::SetVariables(crate::decode::decode_payload::<
3476 SetVariablesResponse,
3477 >(payload, options)?),
3478 Action::TriggerMessage => Self::TriggerMessage(crate::decode::decode_payload::<
3479 TriggerMessageResponse,
3480 >(payload, options)?),
3481 Action::UnlockConnector => Self::UnlockConnector(crate::decode::decode_payload::<
3482 UnlockConnectorResponse,
3483 >(payload, options)?),
3484 Action::UnpublishFirmware => Self::UnpublishFirmware(crate::decode::decode_payload::<
3485 UnpublishFirmwareResponse,
3486 >(payload, options)?),
3487 Action::UpdateDynamicSchedule => {
3488 Self::UpdateDynamicSchedule(crate::decode::decode_payload::<
3489 UpdateDynamicScheduleResponse,
3490 >(payload, options)?)
3491 }
3492 Action::UpdateFirmware => Self::UpdateFirmware(crate::decode::decode_payload::<
3493 UpdateFirmwareResponse,
3494 >(payload, options)?),
3495 Action::UsePriorityCharging => {
3496 Self::UsePriorityCharging(crate::decode::decode_payload::<
3497 UsePriorityChargingResponse,
3498 >(payload, options)?)
3499 }
3500 other => return Err(DecodeError::unsupported_action(other.as_str())),
3501 })
3502 }
3503
3504 pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
3506 match self {
3507 Self::AFRRSignal(p) => serde_json::to_string(p),
3508 Self::AdjustPeriodicEventStream(p) => serde_json::to_string(p),
3509 Self::CancelReservation(p) => serde_json::to_string(p),
3510 Self::CertificateSigned(p) => serde_json::to_string(p),
3511 Self::ChangeAvailability(p) => serde_json::to_string(p),
3512 Self::ChangeTransactionTariff(p) => serde_json::to_string(p),
3513 Self::ClearCache(p) => serde_json::to_string(p),
3514 Self::ClearChargingProfile(p) => serde_json::to_string(p),
3515 Self::ClearDERControl(p) => serde_json::to_string(p),
3516 Self::ClearDisplayMessage(p) => serde_json::to_string(p),
3517 Self::ClearTariffs(p) => serde_json::to_string(p),
3518 Self::ClearVariableMonitoring(p) => serde_json::to_string(p),
3519 Self::CostUpdated(p) => serde_json::to_string(p),
3520 Self::CustomerInformation(p) => serde_json::to_string(p),
3521 Self::DataTransfer(p) => serde_json::to_string(p),
3522 Self::DeleteCertificate(p) => serde_json::to_string(p),
3523 Self::GetBaseReport(p) => serde_json::to_string(p),
3524 Self::GetChargingProfiles(p) => serde_json::to_string(p),
3525 Self::GetCompositeSchedule(p) => serde_json::to_string(p),
3526 Self::GetDERControl(p) => serde_json::to_string(p),
3527 Self::GetDisplayMessages(p) => serde_json::to_string(p),
3528 Self::GetInstalledCertificateIds(p) => serde_json::to_string(p),
3529 Self::GetLocalListVersion(p) => serde_json::to_string(p),
3530 Self::GetLog(p) => serde_json::to_string(p),
3531 Self::GetMonitoringReport(p) => serde_json::to_string(p),
3532 Self::GetPeriodicEventStream(p) => serde_json::to_string(p),
3533 Self::GetReport(p) => serde_json::to_string(p),
3534 Self::GetTariffs(p) => serde_json::to_string(p),
3535 Self::GetTransactionStatus(p) => serde_json::to_string(p),
3536 Self::GetVariables(p) => serde_json::to_string(p),
3537 Self::InstallCertificate(p) => serde_json::to_string(p),
3538 Self::NotifyAllowedEnergyTransfer(p) => serde_json::to_string(p),
3539 Self::NotifyWebPaymentStarted(p) => serde_json::to_string(p),
3540 Self::PublishFirmware(p) => serde_json::to_string(p),
3541 Self::RequestBatterySwap(p) => serde_json::to_string(p),
3542 Self::RequestStartTransaction(p) => serde_json::to_string(p),
3543 Self::RequestStopTransaction(p) => serde_json::to_string(p),
3544 Self::ReserveNow(p) => serde_json::to_string(p),
3545 Self::Reset(p) => serde_json::to_string(p),
3546 Self::SendLocalList(p) => serde_json::to_string(p),
3547 Self::SetChargingProfile(p) => serde_json::to_string(p),
3548 Self::SetDERControl(p) => serde_json::to_string(p),
3549 Self::SetDefaultTariff(p) => serde_json::to_string(p),
3550 Self::SetDisplayMessage(p) => serde_json::to_string(p),
3551 Self::SetMonitoringBase(p) => serde_json::to_string(p),
3552 Self::SetMonitoringLevel(p) => serde_json::to_string(p),
3553 Self::SetNetworkProfile(p) => serde_json::to_string(p),
3554 Self::SetVariableMonitoring(p) => serde_json::to_string(p),
3555 Self::SetVariables(p) => serde_json::to_string(p),
3556 Self::TriggerMessage(p) => serde_json::to_string(p),
3557 Self::UnlockConnector(p) => serde_json::to_string(p),
3558 Self::UnpublishFirmware(p) => serde_json::to_string(p),
3559 Self::UpdateDynamicSchedule(p) => serde_json::to_string(p),
3560 Self::UpdateFirmware(p) => serde_json::to_string(p),
3561 Self::UsePriorityCharging(p) => serde_json::to_string(p),
3562 }
3563 }
3564}
3565
3566impl Validate for CsmsResponse {
3567 fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3568 match self {
3569 Self::AFRRSignal(p) => p.validate_at(path, out),
3570 Self::AdjustPeriodicEventStream(p) => p.validate_at(path, out),
3571 Self::CancelReservation(p) => p.validate_at(path, out),
3572 Self::CertificateSigned(p) => p.validate_at(path, out),
3573 Self::ChangeAvailability(p) => p.validate_at(path, out),
3574 Self::ChangeTransactionTariff(p) => p.validate_at(path, out),
3575 Self::ClearCache(p) => p.validate_at(path, out),
3576 Self::ClearChargingProfile(p) => p.validate_at(path, out),
3577 Self::ClearDERControl(p) => p.validate_at(path, out),
3578 Self::ClearDisplayMessage(p) => p.validate_at(path, out),
3579 Self::ClearTariffs(p) => p.validate_at(path, out),
3580 Self::ClearVariableMonitoring(p) => p.validate_at(path, out),
3581 Self::CostUpdated(p) => p.validate_at(path, out),
3582 Self::CustomerInformation(p) => p.validate_at(path, out),
3583 Self::DataTransfer(p) => p.validate_at(path, out),
3584 Self::DeleteCertificate(p) => p.validate_at(path, out),
3585 Self::GetBaseReport(p) => p.validate_at(path, out),
3586 Self::GetChargingProfiles(p) => p.validate_at(path, out),
3587 Self::GetCompositeSchedule(p) => p.validate_at(path, out),
3588 Self::GetDERControl(p) => p.validate_at(path, out),
3589 Self::GetDisplayMessages(p) => p.validate_at(path, out),
3590 Self::GetInstalledCertificateIds(p) => p.validate_at(path, out),
3591 Self::GetLocalListVersion(p) => p.validate_at(path, out),
3592 Self::GetLog(p) => p.validate_at(path, out),
3593 Self::GetMonitoringReport(p) => p.validate_at(path, out),
3594 Self::GetPeriodicEventStream(p) => p.validate_at(path, out),
3595 Self::GetReport(p) => p.validate_at(path, out),
3596 Self::GetTariffs(p) => p.validate_at(path, out),
3597 Self::GetTransactionStatus(p) => p.validate_at(path, out),
3598 Self::GetVariables(p) => p.validate_at(path, out),
3599 Self::InstallCertificate(p) => p.validate_at(path, out),
3600 Self::NotifyAllowedEnergyTransfer(p) => p.validate_at(path, out),
3601 Self::NotifyWebPaymentStarted(p) => p.validate_at(path, out),
3602 Self::PublishFirmware(p) => p.validate_at(path, out),
3603 Self::RequestBatterySwap(p) => p.validate_at(path, out),
3604 Self::RequestStartTransaction(p) => p.validate_at(path, out),
3605 Self::RequestStopTransaction(p) => p.validate_at(path, out),
3606 Self::ReserveNow(p) => p.validate_at(path, out),
3607 Self::Reset(p) => p.validate_at(path, out),
3608 Self::SendLocalList(p) => p.validate_at(path, out),
3609 Self::SetChargingProfile(p) => p.validate_at(path, out),
3610 Self::SetDERControl(p) => p.validate_at(path, out),
3611 Self::SetDefaultTariff(p) => p.validate_at(path, out),
3612 Self::SetDisplayMessage(p) => p.validate_at(path, out),
3613 Self::SetMonitoringBase(p) => p.validate_at(path, out),
3614 Self::SetMonitoringLevel(p) => p.validate_at(path, out),
3615 Self::SetNetworkProfile(p) => p.validate_at(path, out),
3616 Self::SetVariableMonitoring(p) => p.validate_at(path, out),
3617 Self::SetVariables(p) => p.validate_at(path, out),
3618 Self::TriggerMessage(p) => p.validate_at(path, out),
3619 Self::UnlockConnector(p) => p.validate_at(path, out),
3620 Self::UnpublishFirmware(p) => p.validate_at(path, out),
3621 Self::UpdateDynamicSchedule(p) => p.validate_at(path, out),
3622 Self::UpdateFirmware(p) => p.validate_at(path, out),
3623 Self::UsePriorityCharging(p) => p.validate_at(path, out),
3624 }
3625 }
3626}
3627
3628impl serde::Serialize for CsmsResponse {
3629 fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
3630 match self {
3631 Self::AFRRSignal(p) => p.serialize(ser),
3632 Self::AdjustPeriodicEventStream(p) => p.serialize(ser),
3633 Self::CancelReservation(p) => p.serialize(ser),
3634 Self::CertificateSigned(p) => p.serialize(ser),
3635 Self::ChangeAvailability(p) => p.serialize(ser),
3636 Self::ChangeTransactionTariff(p) => p.serialize(ser),
3637 Self::ClearCache(p) => p.serialize(ser),
3638 Self::ClearChargingProfile(p) => p.serialize(ser),
3639 Self::ClearDERControl(p) => p.serialize(ser),
3640 Self::ClearDisplayMessage(p) => p.serialize(ser),
3641 Self::ClearTariffs(p) => p.serialize(ser),
3642 Self::ClearVariableMonitoring(p) => p.serialize(ser),
3643 Self::CostUpdated(p) => p.serialize(ser),
3644 Self::CustomerInformation(p) => p.serialize(ser),
3645 Self::DataTransfer(p) => p.serialize(ser),
3646 Self::DeleteCertificate(p) => p.serialize(ser),
3647 Self::GetBaseReport(p) => p.serialize(ser),
3648 Self::GetChargingProfiles(p) => p.serialize(ser),
3649 Self::GetCompositeSchedule(p) => p.serialize(ser),
3650 Self::GetDERControl(p) => p.serialize(ser),
3651 Self::GetDisplayMessages(p) => p.serialize(ser),
3652 Self::GetInstalledCertificateIds(p) => p.serialize(ser),
3653 Self::GetLocalListVersion(p) => p.serialize(ser),
3654 Self::GetLog(p) => p.serialize(ser),
3655 Self::GetMonitoringReport(p) => p.serialize(ser),
3656 Self::GetPeriodicEventStream(p) => p.serialize(ser),
3657 Self::GetReport(p) => p.serialize(ser),
3658 Self::GetTariffs(p) => p.serialize(ser),
3659 Self::GetTransactionStatus(p) => p.serialize(ser),
3660 Self::GetVariables(p) => p.serialize(ser),
3661 Self::InstallCertificate(p) => p.serialize(ser),
3662 Self::NotifyAllowedEnergyTransfer(p) => p.serialize(ser),
3663 Self::NotifyWebPaymentStarted(p) => p.serialize(ser),
3664 Self::PublishFirmware(p) => p.serialize(ser),
3665 Self::RequestBatterySwap(p) => p.serialize(ser),
3666 Self::RequestStartTransaction(p) => p.serialize(ser),
3667 Self::RequestStopTransaction(p) => p.serialize(ser),
3668 Self::ReserveNow(p) => p.serialize(ser),
3669 Self::Reset(p) => p.serialize(ser),
3670 Self::SendLocalList(p) => p.serialize(ser),
3671 Self::SetChargingProfile(p) => p.serialize(ser),
3672 Self::SetDERControl(p) => p.serialize(ser),
3673 Self::SetDefaultTariff(p) => p.serialize(ser),
3674 Self::SetDisplayMessage(p) => p.serialize(ser),
3675 Self::SetMonitoringBase(p) => p.serialize(ser),
3676 Self::SetMonitoringLevel(p) => p.serialize(ser),
3677 Self::SetNetworkProfile(p) => p.serialize(ser),
3678 Self::SetVariableMonitoring(p) => p.serialize(ser),
3679 Self::SetVariables(p) => p.serialize(ser),
3680 Self::TriggerMessage(p) => p.serialize(ser),
3681 Self::UnlockConnector(p) => p.serialize(ser),
3682 Self::UnpublishFirmware(p) => p.serialize(ser),
3683 Self::UpdateDynamicSchedule(p) => p.serialize(ser),
3684 Self::UpdateFirmware(p) => p.serialize(ser),
3685 Self::UsePriorityCharging(p) => p.serialize(ser),
3686 }
3687 }
3688}