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::ChargingStation,
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 => "B",
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 => "I",
676 Action::NotifyWebPaymentStarted => "I",
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 => "I",
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 NotifyWebPaymentStarted(NotifyWebPaymentStartedRequest),
1322 OpenPeriodicEventStream(OpenPeriodicEventStreamRequest),
1324 PublishFirmwareStatusNotification(PublishFirmwareStatusNotificationRequest),
1326 PullDynamicScheduleUpdate(PullDynamicScheduleUpdateRequest),
1328 ReportChargingProfiles(ReportChargingProfilesRequest),
1330 ReportDERControl(ReportDERControlRequest),
1332 ReservationStatusUpdate(ReservationStatusUpdateRequest),
1334 SecurityEventNotification(SecurityEventNotificationRequest),
1336 SignCertificate(SignCertificateRequest),
1338 StatusNotification(StatusNotificationRequest),
1340 TransactionEvent(TransactionEventRequest),
1342 VatNumberValidation(VatNumberValidationRequest),
1344}
1345
1346impl CsRequest {
1347 #[must_use]
1349 pub const fn action(&self) -> Action {
1350 match self {
1351 Self::Authorize(_) => Action::Authorize,
1352 Self::BatterySwap(_) => Action::BatterySwap,
1353 Self::BootNotification(_) => Action::BootNotification,
1354 Self::ClearedChargingLimit(_) => Action::ClearedChargingLimit,
1355 Self::ClosePeriodicEventStream(_) => Action::ClosePeriodicEventStream,
1356 Self::DataTransfer(_) => Action::DataTransfer,
1357 Self::FirmwareStatusNotification(_) => Action::FirmwareStatusNotification,
1358 Self::Get15118EVCertificate(_) => Action::Get15118EVCertificate,
1359 Self::GetCertificateChainStatus(_) => Action::GetCertificateChainStatus,
1360 Self::GetCertificateStatus(_) => Action::GetCertificateStatus,
1361 Self::Heartbeat(_) => Action::Heartbeat,
1362 Self::LogStatusNotification(_) => Action::LogStatusNotification,
1363 Self::MeterValues(_) => Action::MeterValues,
1364 Self::NotifyChargingLimit(_) => Action::NotifyChargingLimit,
1365 Self::NotifyCustomerInformation(_) => Action::NotifyCustomerInformation,
1366 Self::NotifyDERAlarm(_) => Action::NotifyDERAlarm,
1367 Self::NotifyDERStartStop(_) => Action::NotifyDERStartStop,
1368 Self::NotifyDisplayMessages(_) => Action::NotifyDisplayMessages,
1369 Self::NotifyEVChargingNeeds(_) => Action::NotifyEVChargingNeeds,
1370 Self::NotifyEVChargingSchedule(_) => Action::NotifyEVChargingSchedule,
1371 Self::NotifyEvent(_) => Action::NotifyEvent,
1372 Self::NotifyMonitoringReport(_) => Action::NotifyMonitoringReport,
1373 Self::NotifyPeriodicEventStream(_) => Action::NotifyPeriodicEventStream,
1374 Self::NotifyPriorityCharging(_) => Action::NotifyPriorityCharging,
1375 Self::NotifyReport(_) => Action::NotifyReport,
1376 Self::NotifySettlement(_) => Action::NotifySettlement,
1377 Self::NotifyWebPaymentStarted(_) => Action::NotifyWebPaymentStarted,
1378 Self::OpenPeriodicEventStream(_) => Action::OpenPeriodicEventStream,
1379 Self::PublishFirmwareStatusNotification(_) => Action::PublishFirmwareStatusNotification,
1380 Self::PullDynamicScheduleUpdate(_) => Action::PullDynamicScheduleUpdate,
1381 Self::ReportChargingProfiles(_) => Action::ReportChargingProfiles,
1382 Self::ReportDERControl(_) => Action::ReportDERControl,
1383 Self::ReservationStatusUpdate(_) => Action::ReservationStatusUpdate,
1384 Self::SecurityEventNotification(_) => Action::SecurityEventNotification,
1385 Self::SignCertificate(_) => Action::SignCertificate,
1386 Self::StatusNotification(_) => Action::StatusNotification,
1387 Self::TransactionEvent(_) => Action::TransactionEvent,
1388 Self::VatNumberValidation(_) => Action::VatNumberValidation,
1389 }
1390 }
1391
1392 pub fn decode(
1395 action: Action,
1396 payload: &RawValue,
1397 options: &DecodeOptions,
1398 ) -> Result<Self, DecodeError> {
1399 Ok(match action {
1400 Action::Authorize => Self::Authorize(
1401 crate::decode::decode_payload::<AuthorizeRequest>(payload, options)?,
1402 ),
1403 Action::BatterySwap => Self::BatterySwap(crate::decode::decode_payload::<
1404 BatterySwapRequest,
1405 >(payload, options)?),
1406 Action::BootNotification => Self::BootNotification(crate::decode::decode_payload::<
1407 BootNotificationRequest,
1408 >(payload, options)?),
1409 Action::ClearedChargingLimit => {
1410 Self::ClearedChargingLimit(crate::decode::decode_payload::<
1411 ClearedChargingLimitRequest,
1412 >(payload, options)?)
1413 }
1414 Action::ClosePeriodicEventStream => {
1415 Self::ClosePeriodicEventStream(crate::decode::decode_payload::<
1416 ClosePeriodicEventStreamRequest,
1417 >(payload, options)?)
1418 }
1419 Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
1420 DataTransferRequest,
1421 >(payload, options)?),
1422 Action::FirmwareStatusNotification => {
1423 Self::FirmwareStatusNotification(crate::decode::decode_payload::<
1424 FirmwareStatusNotificationRequest,
1425 >(payload, options)?)
1426 }
1427 Action::Get15118EVCertificate => {
1428 Self::Get15118EVCertificate(crate::decode::decode_payload::<
1429 Get15118EVCertificateRequest,
1430 >(payload, options)?)
1431 }
1432 Action::GetCertificateChainStatus => {
1433 Self::GetCertificateChainStatus(crate::decode::decode_payload::<
1434 GetCertificateChainStatusRequest,
1435 >(payload, options)?)
1436 }
1437 Action::GetCertificateStatus => {
1438 Self::GetCertificateStatus(crate::decode::decode_payload::<
1439 GetCertificateStatusRequest,
1440 >(payload, options)?)
1441 }
1442 Action::Heartbeat => Self::Heartbeat(
1443 crate::decode::decode_payload::<HeartbeatRequest>(payload, options)?,
1444 ),
1445 Action::LogStatusNotification => {
1446 Self::LogStatusNotification(crate::decode::decode_payload::<
1447 LogStatusNotificationRequest,
1448 >(payload, options)?)
1449 }
1450 Action::MeterValues => Self::MeterValues(crate::decode::decode_payload::<
1451 MeterValuesRequest,
1452 >(payload, options)?),
1453 Action::NotifyChargingLimit => {
1454 Self::NotifyChargingLimit(crate::decode::decode_payload::<
1455 NotifyChargingLimitRequest,
1456 >(payload, options)?)
1457 }
1458 Action::NotifyCustomerInformation => {
1459 Self::NotifyCustomerInformation(crate::decode::decode_payload::<
1460 NotifyCustomerInformationRequest,
1461 >(payload, options)?)
1462 }
1463 Action::NotifyDERAlarm => Self::NotifyDERAlarm(crate::decode::decode_payload::<
1464 NotifyDERAlarmRequest,
1465 >(payload, options)?),
1466 Action::NotifyDERStartStop => Self::NotifyDERStartStop(
1467 crate::decode::decode_payload::<NotifyDERStartStopRequest>(payload, options)?,
1468 ),
1469 Action::NotifyDisplayMessages => {
1470 Self::NotifyDisplayMessages(crate::decode::decode_payload::<
1471 NotifyDisplayMessagesRequest,
1472 >(payload, options)?)
1473 }
1474 Action::NotifyEVChargingNeeds => {
1475 Self::NotifyEVChargingNeeds(crate::decode::decode_payload::<
1476 NotifyEVChargingNeedsRequest,
1477 >(payload, options)?)
1478 }
1479 Action::NotifyEVChargingSchedule => {
1480 Self::NotifyEVChargingSchedule(crate::decode::decode_payload::<
1481 NotifyEVChargingScheduleRequest,
1482 >(payload, options)?)
1483 }
1484 Action::NotifyEvent => Self::NotifyEvent(crate::decode::decode_payload::<
1485 NotifyEventRequest,
1486 >(payload, options)?),
1487 Action::NotifyMonitoringReport => {
1488 Self::NotifyMonitoringReport(crate::decode::decode_payload::<
1489 NotifyMonitoringReportRequest,
1490 >(payload, options)?)
1491 }
1492 Action::NotifyPeriodicEventStream => {
1493 Self::NotifyPeriodicEventStream(crate::decode::decode_payload::<
1494 NotifyPeriodicEventStreamRequest,
1495 >(payload, options)?)
1496 }
1497 Action::NotifyPriorityCharging => {
1498 Self::NotifyPriorityCharging(crate::decode::decode_payload::<
1499 NotifyPriorityChargingRequest,
1500 >(payload, options)?)
1501 }
1502 Action::NotifyReport => Self::NotifyReport(crate::decode::decode_payload::<
1503 NotifyReportRequest,
1504 >(payload, options)?),
1505 Action::NotifySettlement => Self::NotifySettlement(crate::decode::decode_payload::<
1506 NotifySettlementRequest,
1507 >(payload, options)?),
1508 Action::NotifyWebPaymentStarted => {
1509 Self::NotifyWebPaymentStarted(crate::decode::decode_payload::<
1510 NotifyWebPaymentStartedRequest,
1511 >(payload, options)?)
1512 }
1513 Action::OpenPeriodicEventStream => {
1514 Self::OpenPeriodicEventStream(crate::decode::decode_payload::<
1515 OpenPeriodicEventStreamRequest,
1516 >(payload, options)?)
1517 }
1518 Action::PublishFirmwareStatusNotification => {
1519 Self::PublishFirmwareStatusNotification(crate::decode::decode_payload::<
1520 PublishFirmwareStatusNotificationRequest,
1521 >(payload, options)?)
1522 }
1523 Action::PullDynamicScheduleUpdate => {
1524 Self::PullDynamicScheduleUpdate(crate::decode::decode_payload::<
1525 PullDynamicScheduleUpdateRequest,
1526 >(payload, options)?)
1527 }
1528 Action::ReportChargingProfiles => {
1529 Self::ReportChargingProfiles(crate::decode::decode_payload::<
1530 ReportChargingProfilesRequest,
1531 >(payload, options)?)
1532 }
1533 Action::ReportDERControl => Self::ReportDERControl(crate::decode::decode_payload::<
1534 ReportDERControlRequest,
1535 >(payload, options)?),
1536 Action::ReservationStatusUpdate => {
1537 Self::ReservationStatusUpdate(crate::decode::decode_payload::<
1538 ReservationStatusUpdateRequest,
1539 >(payload, options)?)
1540 }
1541 Action::SecurityEventNotification => {
1542 Self::SecurityEventNotification(crate::decode::decode_payload::<
1543 SecurityEventNotificationRequest,
1544 >(payload, options)?)
1545 }
1546 Action::SignCertificate => Self::SignCertificate(crate::decode::decode_payload::<
1547 SignCertificateRequest,
1548 >(payload, options)?),
1549 Action::StatusNotification => Self::StatusNotification(
1550 crate::decode::decode_payload::<StatusNotificationRequest>(payload, options)?,
1551 ),
1552 Action::TransactionEvent => Self::TransactionEvent(crate::decode::decode_payload::<
1553 TransactionEventRequest,
1554 >(payload, options)?),
1555 Action::VatNumberValidation => {
1556 Self::VatNumberValidation(crate::decode::decode_payload::<
1557 VatNumberValidationRequest,
1558 >(payload, options)?)
1559 }
1560 other => return Err(DecodeError::unsupported_action(other.as_str())),
1561 })
1562 }
1563
1564 pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
1566 match self {
1567 Self::Authorize(p) => serde_json::to_string(p),
1568 Self::BatterySwap(p) => serde_json::to_string(p),
1569 Self::BootNotification(p) => serde_json::to_string(p),
1570 Self::ClearedChargingLimit(p) => serde_json::to_string(p),
1571 Self::ClosePeriodicEventStream(p) => serde_json::to_string(p),
1572 Self::DataTransfer(p) => serde_json::to_string(p),
1573 Self::FirmwareStatusNotification(p) => serde_json::to_string(p),
1574 Self::Get15118EVCertificate(p) => serde_json::to_string(p),
1575 Self::GetCertificateChainStatus(p) => serde_json::to_string(p),
1576 Self::GetCertificateStatus(p) => serde_json::to_string(p),
1577 Self::Heartbeat(p) => serde_json::to_string(p),
1578 Self::LogStatusNotification(p) => serde_json::to_string(p),
1579 Self::MeterValues(p) => serde_json::to_string(p),
1580 Self::NotifyChargingLimit(p) => serde_json::to_string(p),
1581 Self::NotifyCustomerInformation(p) => serde_json::to_string(p),
1582 Self::NotifyDERAlarm(p) => serde_json::to_string(p),
1583 Self::NotifyDERStartStop(p) => serde_json::to_string(p),
1584 Self::NotifyDisplayMessages(p) => serde_json::to_string(p),
1585 Self::NotifyEVChargingNeeds(p) => serde_json::to_string(p),
1586 Self::NotifyEVChargingSchedule(p) => serde_json::to_string(p),
1587 Self::NotifyEvent(p) => serde_json::to_string(p),
1588 Self::NotifyMonitoringReport(p) => serde_json::to_string(p),
1589 Self::NotifyPeriodicEventStream(p) => serde_json::to_string(p),
1590 Self::NotifyPriorityCharging(p) => serde_json::to_string(p),
1591 Self::NotifyReport(p) => serde_json::to_string(p),
1592 Self::NotifySettlement(p) => serde_json::to_string(p),
1593 Self::NotifyWebPaymentStarted(p) => serde_json::to_string(p),
1594 Self::OpenPeriodicEventStream(p) => serde_json::to_string(p),
1595 Self::PublishFirmwareStatusNotification(p) => serde_json::to_string(p),
1596 Self::PullDynamicScheduleUpdate(p) => serde_json::to_string(p),
1597 Self::ReportChargingProfiles(p) => serde_json::to_string(p),
1598 Self::ReportDERControl(p) => serde_json::to_string(p),
1599 Self::ReservationStatusUpdate(p) => serde_json::to_string(p),
1600 Self::SecurityEventNotification(p) => serde_json::to_string(p),
1601 Self::SignCertificate(p) => serde_json::to_string(p),
1602 Self::StatusNotification(p) => serde_json::to_string(p),
1603 Self::TransactionEvent(p) => serde_json::to_string(p),
1604 Self::VatNumberValidation(p) => serde_json::to_string(p),
1605 }
1606 }
1607}
1608
1609impl Validate for CsRequest {
1610 fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1611 match self {
1612 Self::Authorize(p) => p.validate_at(path, out),
1613 Self::BatterySwap(p) => p.validate_at(path, out),
1614 Self::BootNotification(p) => p.validate_at(path, out),
1615 Self::ClearedChargingLimit(p) => p.validate_at(path, out),
1616 Self::ClosePeriodicEventStream(p) => p.validate_at(path, out),
1617 Self::DataTransfer(p) => p.validate_at(path, out),
1618 Self::FirmwareStatusNotification(p) => p.validate_at(path, out),
1619 Self::Get15118EVCertificate(p) => p.validate_at(path, out),
1620 Self::GetCertificateChainStatus(p) => p.validate_at(path, out),
1621 Self::GetCertificateStatus(p) => p.validate_at(path, out),
1622 Self::Heartbeat(p) => p.validate_at(path, out),
1623 Self::LogStatusNotification(p) => p.validate_at(path, out),
1624 Self::MeterValues(p) => p.validate_at(path, out),
1625 Self::NotifyChargingLimit(p) => p.validate_at(path, out),
1626 Self::NotifyCustomerInformation(p) => p.validate_at(path, out),
1627 Self::NotifyDERAlarm(p) => p.validate_at(path, out),
1628 Self::NotifyDERStartStop(p) => p.validate_at(path, out),
1629 Self::NotifyDisplayMessages(p) => p.validate_at(path, out),
1630 Self::NotifyEVChargingNeeds(p) => p.validate_at(path, out),
1631 Self::NotifyEVChargingSchedule(p) => p.validate_at(path, out),
1632 Self::NotifyEvent(p) => p.validate_at(path, out),
1633 Self::NotifyMonitoringReport(p) => p.validate_at(path, out),
1634 Self::NotifyPeriodicEventStream(p) => p.validate_at(path, out),
1635 Self::NotifyPriorityCharging(p) => p.validate_at(path, out),
1636 Self::NotifyReport(p) => p.validate_at(path, out),
1637 Self::NotifySettlement(p) => p.validate_at(path, out),
1638 Self::NotifyWebPaymentStarted(p) => p.validate_at(path, out),
1639 Self::OpenPeriodicEventStream(p) => p.validate_at(path, out),
1640 Self::PublishFirmwareStatusNotification(p) => p.validate_at(path, out),
1641 Self::PullDynamicScheduleUpdate(p) => p.validate_at(path, out),
1642 Self::ReportChargingProfiles(p) => p.validate_at(path, out),
1643 Self::ReportDERControl(p) => p.validate_at(path, out),
1644 Self::ReservationStatusUpdate(p) => p.validate_at(path, out),
1645 Self::SecurityEventNotification(p) => p.validate_at(path, out),
1646 Self::SignCertificate(p) => p.validate_at(path, out),
1647 Self::StatusNotification(p) => p.validate_at(path, out),
1648 Self::TransactionEvent(p) => p.validate_at(path, out),
1649 Self::VatNumberValidation(p) => p.validate_at(path, out),
1650 }
1651 }
1652}
1653
1654impl serde::Serialize for CsRequest {
1655 fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
1656 match self {
1657 Self::Authorize(p) => p.serialize(ser),
1658 Self::BatterySwap(p) => p.serialize(ser),
1659 Self::BootNotification(p) => p.serialize(ser),
1660 Self::ClearedChargingLimit(p) => p.serialize(ser),
1661 Self::ClosePeriodicEventStream(p) => p.serialize(ser),
1662 Self::DataTransfer(p) => p.serialize(ser),
1663 Self::FirmwareStatusNotification(p) => p.serialize(ser),
1664 Self::Get15118EVCertificate(p) => p.serialize(ser),
1665 Self::GetCertificateChainStatus(p) => p.serialize(ser),
1666 Self::GetCertificateStatus(p) => p.serialize(ser),
1667 Self::Heartbeat(p) => p.serialize(ser),
1668 Self::LogStatusNotification(p) => p.serialize(ser),
1669 Self::MeterValues(p) => p.serialize(ser),
1670 Self::NotifyChargingLimit(p) => p.serialize(ser),
1671 Self::NotifyCustomerInformation(p) => p.serialize(ser),
1672 Self::NotifyDERAlarm(p) => p.serialize(ser),
1673 Self::NotifyDERStartStop(p) => p.serialize(ser),
1674 Self::NotifyDisplayMessages(p) => p.serialize(ser),
1675 Self::NotifyEVChargingNeeds(p) => p.serialize(ser),
1676 Self::NotifyEVChargingSchedule(p) => p.serialize(ser),
1677 Self::NotifyEvent(p) => p.serialize(ser),
1678 Self::NotifyMonitoringReport(p) => p.serialize(ser),
1679 Self::NotifyPeriodicEventStream(p) => p.serialize(ser),
1680 Self::NotifyPriorityCharging(p) => p.serialize(ser),
1681 Self::NotifyReport(p) => p.serialize(ser),
1682 Self::NotifySettlement(p) => p.serialize(ser),
1683 Self::NotifyWebPaymentStarted(p) => p.serialize(ser),
1684 Self::OpenPeriodicEventStream(p) => p.serialize(ser),
1685 Self::PublishFirmwareStatusNotification(p) => p.serialize(ser),
1686 Self::PullDynamicScheduleUpdate(p) => p.serialize(ser),
1687 Self::ReportChargingProfiles(p) => p.serialize(ser),
1688 Self::ReportDERControl(p) => p.serialize(ser),
1689 Self::ReservationStatusUpdate(p) => p.serialize(ser),
1690 Self::SecurityEventNotification(p) => p.serialize(ser),
1691 Self::SignCertificate(p) => p.serialize(ser),
1692 Self::StatusNotification(p) => p.serialize(ser),
1693 Self::TransactionEvent(p) => p.serialize(ser),
1694 Self::VatNumberValidation(p) => p.serialize(ser),
1695 }
1696 }
1697}
1698
1699#[derive(Clone, Debug, PartialEq)]
1703#[non_exhaustive]
1704#[allow(clippy::large_enum_variant)]
1705pub enum CsResponse {
1706 Authorize(AuthorizeResponse),
1708 BatterySwap(BatterySwapResponse),
1710 BootNotification(BootNotificationResponse),
1712 ClearedChargingLimit(ClearedChargingLimitResponse),
1714 ClosePeriodicEventStream(ClosePeriodicEventStreamResponse),
1716 DataTransfer(DataTransferResponse),
1718 FirmwareStatusNotification(FirmwareStatusNotificationResponse),
1720 Get15118EVCertificate(Get15118EVCertificateResponse),
1722 GetCertificateChainStatus(GetCertificateChainStatusResponse),
1724 GetCertificateStatus(GetCertificateStatusResponse),
1726 Heartbeat(HeartbeatResponse),
1728 LogStatusNotification(LogStatusNotificationResponse),
1730 MeterValues(MeterValuesResponse),
1732 NotifyChargingLimit(NotifyChargingLimitResponse),
1734 NotifyCustomerInformation(NotifyCustomerInformationResponse),
1736 NotifyDERAlarm(NotifyDERAlarmResponse),
1738 NotifyDERStartStop(NotifyDERStartStopResponse),
1740 NotifyDisplayMessages(NotifyDisplayMessagesResponse),
1742 NotifyEVChargingNeeds(NotifyEVChargingNeedsResponse),
1744 NotifyEVChargingSchedule(NotifyEVChargingScheduleResponse),
1746 NotifyEvent(NotifyEventResponse),
1748 NotifyMonitoringReport(NotifyMonitoringReportResponse),
1750 NotifyPriorityCharging(NotifyPriorityChargingResponse),
1752 NotifyReport(NotifyReportResponse),
1754 NotifySettlement(NotifySettlementResponse),
1756 NotifyWebPaymentStarted(NotifyWebPaymentStartedResponse),
1758 OpenPeriodicEventStream(OpenPeriodicEventStreamResponse),
1760 PublishFirmwareStatusNotification(PublishFirmwareStatusNotificationResponse),
1762 PullDynamicScheduleUpdate(PullDynamicScheduleUpdateResponse),
1764 ReportChargingProfiles(ReportChargingProfilesResponse),
1766 ReportDERControl(ReportDERControlResponse),
1768 ReservationStatusUpdate(ReservationStatusUpdateResponse),
1770 SecurityEventNotification(SecurityEventNotificationResponse),
1772 SignCertificate(SignCertificateResponse),
1774 StatusNotification(StatusNotificationResponse),
1776 TransactionEvent(TransactionEventResponse),
1778 VatNumberValidation(VatNumberValidationResponse),
1780}
1781
1782impl CsResponse {
1783 #[must_use]
1785 pub const fn action(&self) -> Action {
1786 match self {
1787 Self::Authorize(_) => Action::Authorize,
1788 Self::BatterySwap(_) => Action::BatterySwap,
1789 Self::BootNotification(_) => Action::BootNotification,
1790 Self::ClearedChargingLimit(_) => Action::ClearedChargingLimit,
1791 Self::ClosePeriodicEventStream(_) => Action::ClosePeriodicEventStream,
1792 Self::DataTransfer(_) => Action::DataTransfer,
1793 Self::FirmwareStatusNotification(_) => Action::FirmwareStatusNotification,
1794 Self::Get15118EVCertificate(_) => Action::Get15118EVCertificate,
1795 Self::GetCertificateChainStatus(_) => Action::GetCertificateChainStatus,
1796 Self::GetCertificateStatus(_) => Action::GetCertificateStatus,
1797 Self::Heartbeat(_) => Action::Heartbeat,
1798 Self::LogStatusNotification(_) => Action::LogStatusNotification,
1799 Self::MeterValues(_) => Action::MeterValues,
1800 Self::NotifyChargingLimit(_) => Action::NotifyChargingLimit,
1801 Self::NotifyCustomerInformation(_) => Action::NotifyCustomerInformation,
1802 Self::NotifyDERAlarm(_) => Action::NotifyDERAlarm,
1803 Self::NotifyDERStartStop(_) => Action::NotifyDERStartStop,
1804 Self::NotifyDisplayMessages(_) => Action::NotifyDisplayMessages,
1805 Self::NotifyEVChargingNeeds(_) => Action::NotifyEVChargingNeeds,
1806 Self::NotifyEVChargingSchedule(_) => Action::NotifyEVChargingSchedule,
1807 Self::NotifyEvent(_) => Action::NotifyEvent,
1808 Self::NotifyMonitoringReport(_) => Action::NotifyMonitoringReport,
1809 Self::NotifyPriorityCharging(_) => Action::NotifyPriorityCharging,
1810 Self::NotifyReport(_) => Action::NotifyReport,
1811 Self::NotifySettlement(_) => Action::NotifySettlement,
1812 Self::NotifyWebPaymentStarted(_) => Action::NotifyWebPaymentStarted,
1813 Self::OpenPeriodicEventStream(_) => Action::OpenPeriodicEventStream,
1814 Self::PublishFirmwareStatusNotification(_) => Action::PublishFirmwareStatusNotification,
1815 Self::PullDynamicScheduleUpdate(_) => Action::PullDynamicScheduleUpdate,
1816 Self::ReportChargingProfiles(_) => Action::ReportChargingProfiles,
1817 Self::ReportDERControl(_) => Action::ReportDERControl,
1818 Self::ReservationStatusUpdate(_) => Action::ReservationStatusUpdate,
1819 Self::SecurityEventNotification(_) => Action::SecurityEventNotification,
1820 Self::SignCertificate(_) => Action::SignCertificate,
1821 Self::StatusNotification(_) => Action::StatusNotification,
1822 Self::TransactionEvent(_) => Action::TransactionEvent,
1823 Self::VatNumberValidation(_) => Action::VatNumberValidation,
1824 }
1825 }
1826
1827 pub fn decode(
1830 action: Action,
1831 payload: &RawValue,
1832 options: &DecodeOptions,
1833 ) -> Result<Self, DecodeError> {
1834 Ok(match action {
1835 Action::Authorize => Self::Authorize(
1836 crate::decode::decode_payload::<AuthorizeResponse>(payload, options)?,
1837 ),
1838 Action::BatterySwap => Self::BatterySwap(crate::decode::decode_payload::<
1839 BatterySwapResponse,
1840 >(payload, options)?),
1841 Action::BootNotification => Self::BootNotification(crate::decode::decode_payload::<
1842 BootNotificationResponse,
1843 >(payload, options)?),
1844 Action::ClearedChargingLimit => {
1845 Self::ClearedChargingLimit(crate::decode::decode_payload::<
1846 ClearedChargingLimitResponse,
1847 >(payload, options)?)
1848 }
1849 Action::ClosePeriodicEventStream => {
1850 Self::ClosePeriodicEventStream(crate::decode::decode_payload::<
1851 ClosePeriodicEventStreamResponse,
1852 >(payload, options)?)
1853 }
1854 Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
1855 DataTransferResponse,
1856 >(payload, options)?),
1857 Action::FirmwareStatusNotification => {
1858 Self::FirmwareStatusNotification(crate::decode::decode_payload::<
1859 FirmwareStatusNotificationResponse,
1860 >(payload, options)?)
1861 }
1862 Action::Get15118EVCertificate => {
1863 Self::Get15118EVCertificate(crate::decode::decode_payload::<
1864 Get15118EVCertificateResponse,
1865 >(payload, options)?)
1866 }
1867 Action::GetCertificateChainStatus => {
1868 Self::GetCertificateChainStatus(crate::decode::decode_payload::<
1869 GetCertificateChainStatusResponse,
1870 >(payload, options)?)
1871 }
1872 Action::GetCertificateStatus => {
1873 Self::GetCertificateStatus(crate::decode::decode_payload::<
1874 GetCertificateStatusResponse,
1875 >(payload, options)?)
1876 }
1877 Action::Heartbeat => Self::Heartbeat(
1878 crate::decode::decode_payload::<HeartbeatResponse>(payload, options)?,
1879 ),
1880 Action::LogStatusNotification => {
1881 Self::LogStatusNotification(crate::decode::decode_payload::<
1882 LogStatusNotificationResponse,
1883 >(payload, options)?)
1884 }
1885 Action::MeterValues => Self::MeterValues(crate::decode::decode_payload::<
1886 MeterValuesResponse,
1887 >(payload, options)?),
1888 Action::NotifyChargingLimit => {
1889 Self::NotifyChargingLimit(crate::decode::decode_payload::<
1890 NotifyChargingLimitResponse,
1891 >(payload, options)?)
1892 }
1893 Action::NotifyCustomerInformation => {
1894 Self::NotifyCustomerInformation(crate::decode::decode_payload::<
1895 NotifyCustomerInformationResponse,
1896 >(payload, options)?)
1897 }
1898 Action::NotifyDERAlarm => Self::NotifyDERAlarm(crate::decode::decode_payload::<
1899 NotifyDERAlarmResponse,
1900 >(payload, options)?),
1901 Action::NotifyDERStartStop => Self::NotifyDERStartStop(
1902 crate::decode::decode_payload::<NotifyDERStartStopResponse>(payload, options)?,
1903 ),
1904 Action::NotifyDisplayMessages => {
1905 Self::NotifyDisplayMessages(crate::decode::decode_payload::<
1906 NotifyDisplayMessagesResponse,
1907 >(payload, options)?)
1908 }
1909 Action::NotifyEVChargingNeeds => {
1910 Self::NotifyEVChargingNeeds(crate::decode::decode_payload::<
1911 NotifyEVChargingNeedsResponse,
1912 >(payload, options)?)
1913 }
1914 Action::NotifyEVChargingSchedule => {
1915 Self::NotifyEVChargingSchedule(crate::decode::decode_payload::<
1916 NotifyEVChargingScheduleResponse,
1917 >(payload, options)?)
1918 }
1919 Action::NotifyEvent => Self::NotifyEvent(crate::decode::decode_payload::<
1920 NotifyEventResponse,
1921 >(payload, options)?),
1922 Action::NotifyMonitoringReport => {
1923 Self::NotifyMonitoringReport(crate::decode::decode_payload::<
1924 NotifyMonitoringReportResponse,
1925 >(payload, options)?)
1926 }
1927 Action::NotifyPriorityCharging => {
1928 Self::NotifyPriorityCharging(crate::decode::decode_payload::<
1929 NotifyPriorityChargingResponse,
1930 >(payload, options)?)
1931 }
1932 Action::NotifyReport => Self::NotifyReport(crate::decode::decode_payload::<
1933 NotifyReportResponse,
1934 >(payload, options)?),
1935 Action::NotifySettlement => Self::NotifySettlement(crate::decode::decode_payload::<
1936 NotifySettlementResponse,
1937 >(payload, options)?),
1938 Action::NotifyWebPaymentStarted => {
1939 Self::NotifyWebPaymentStarted(crate::decode::decode_payload::<
1940 NotifyWebPaymentStartedResponse,
1941 >(payload, options)?)
1942 }
1943 Action::OpenPeriodicEventStream => {
1944 Self::OpenPeriodicEventStream(crate::decode::decode_payload::<
1945 OpenPeriodicEventStreamResponse,
1946 >(payload, options)?)
1947 }
1948 Action::PublishFirmwareStatusNotification => {
1949 Self::PublishFirmwareStatusNotification(crate::decode::decode_payload::<
1950 PublishFirmwareStatusNotificationResponse,
1951 >(payload, options)?)
1952 }
1953 Action::PullDynamicScheduleUpdate => {
1954 Self::PullDynamicScheduleUpdate(crate::decode::decode_payload::<
1955 PullDynamicScheduleUpdateResponse,
1956 >(payload, options)?)
1957 }
1958 Action::ReportChargingProfiles => {
1959 Self::ReportChargingProfiles(crate::decode::decode_payload::<
1960 ReportChargingProfilesResponse,
1961 >(payload, options)?)
1962 }
1963 Action::ReportDERControl => Self::ReportDERControl(crate::decode::decode_payload::<
1964 ReportDERControlResponse,
1965 >(payload, options)?),
1966 Action::ReservationStatusUpdate => {
1967 Self::ReservationStatusUpdate(crate::decode::decode_payload::<
1968 ReservationStatusUpdateResponse,
1969 >(payload, options)?)
1970 }
1971 Action::SecurityEventNotification => {
1972 Self::SecurityEventNotification(crate::decode::decode_payload::<
1973 SecurityEventNotificationResponse,
1974 >(payload, options)?)
1975 }
1976 Action::SignCertificate => Self::SignCertificate(crate::decode::decode_payload::<
1977 SignCertificateResponse,
1978 >(payload, options)?),
1979 Action::StatusNotification => Self::StatusNotification(
1980 crate::decode::decode_payload::<StatusNotificationResponse>(payload, options)?,
1981 ),
1982 Action::TransactionEvent => Self::TransactionEvent(crate::decode::decode_payload::<
1983 TransactionEventResponse,
1984 >(payload, options)?),
1985 Action::VatNumberValidation => {
1986 Self::VatNumberValidation(crate::decode::decode_payload::<
1987 VatNumberValidationResponse,
1988 >(payload, options)?)
1989 }
1990 other => return Err(DecodeError::unsupported_action(other.as_str())),
1991 })
1992 }
1993
1994 pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
1996 match self {
1997 Self::Authorize(p) => serde_json::to_string(p),
1998 Self::BatterySwap(p) => serde_json::to_string(p),
1999 Self::BootNotification(p) => serde_json::to_string(p),
2000 Self::ClearedChargingLimit(p) => serde_json::to_string(p),
2001 Self::ClosePeriodicEventStream(p) => serde_json::to_string(p),
2002 Self::DataTransfer(p) => serde_json::to_string(p),
2003 Self::FirmwareStatusNotification(p) => serde_json::to_string(p),
2004 Self::Get15118EVCertificate(p) => serde_json::to_string(p),
2005 Self::GetCertificateChainStatus(p) => serde_json::to_string(p),
2006 Self::GetCertificateStatus(p) => serde_json::to_string(p),
2007 Self::Heartbeat(p) => serde_json::to_string(p),
2008 Self::LogStatusNotification(p) => serde_json::to_string(p),
2009 Self::MeterValues(p) => serde_json::to_string(p),
2010 Self::NotifyChargingLimit(p) => serde_json::to_string(p),
2011 Self::NotifyCustomerInformation(p) => serde_json::to_string(p),
2012 Self::NotifyDERAlarm(p) => serde_json::to_string(p),
2013 Self::NotifyDERStartStop(p) => serde_json::to_string(p),
2014 Self::NotifyDisplayMessages(p) => serde_json::to_string(p),
2015 Self::NotifyEVChargingNeeds(p) => serde_json::to_string(p),
2016 Self::NotifyEVChargingSchedule(p) => serde_json::to_string(p),
2017 Self::NotifyEvent(p) => serde_json::to_string(p),
2018 Self::NotifyMonitoringReport(p) => serde_json::to_string(p),
2019 Self::NotifyPriorityCharging(p) => serde_json::to_string(p),
2020 Self::NotifyReport(p) => serde_json::to_string(p),
2021 Self::NotifySettlement(p) => serde_json::to_string(p),
2022 Self::NotifyWebPaymentStarted(p) => serde_json::to_string(p),
2023 Self::OpenPeriodicEventStream(p) => serde_json::to_string(p),
2024 Self::PublishFirmwareStatusNotification(p) => serde_json::to_string(p),
2025 Self::PullDynamicScheduleUpdate(p) => serde_json::to_string(p),
2026 Self::ReportChargingProfiles(p) => serde_json::to_string(p),
2027 Self::ReportDERControl(p) => serde_json::to_string(p),
2028 Self::ReservationStatusUpdate(p) => serde_json::to_string(p),
2029 Self::SecurityEventNotification(p) => serde_json::to_string(p),
2030 Self::SignCertificate(p) => serde_json::to_string(p),
2031 Self::StatusNotification(p) => serde_json::to_string(p),
2032 Self::TransactionEvent(p) => serde_json::to_string(p),
2033 Self::VatNumberValidation(p) => serde_json::to_string(p),
2034 }
2035 }
2036}
2037
2038impl Validate for CsResponse {
2039 fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2040 match self {
2041 Self::Authorize(p) => p.validate_at(path, out),
2042 Self::BatterySwap(p) => p.validate_at(path, out),
2043 Self::BootNotification(p) => p.validate_at(path, out),
2044 Self::ClearedChargingLimit(p) => p.validate_at(path, out),
2045 Self::ClosePeriodicEventStream(p) => p.validate_at(path, out),
2046 Self::DataTransfer(p) => p.validate_at(path, out),
2047 Self::FirmwareStatusNotification(p) => p.validate_at(path, out),
2048 Self::Get15118EVCertificate(p) => p.validate_at(path, out),
2049 Self::GetCertificateChainStatus(p) => p.validate_at(path, out),
2050 Self::GetCertificateStatus(p) => p.validate_at(path, out),
2051 Self::Heartbeat(p) => p.validate_at(path, out),
2052 Self::LogStatusNotification(p) => p.validate_at(path, out),
2053 Self::MeterValues(p) => p.validate_at(path, out),
2054 Self::NotifyChargingLimit(p) => p.validate_at(path, out),
2055 Self::NotifyCustomerInformation(p) => p.validate_at(path, out),
2056 Self::NotifyDERAlarm(p) => p.validate_at(path, out),
2057 Self::NotifyDERStartStop(p) => p.validate_at(path, out),
2058 Self::NotifyDisplayMessages(p) => p.validate_at(path, out),
2059 Self::NotifyEVChargingNeeds(p) => p.validate_at(path, out),
2060 Self::NotifyEVChargingSchedule(p) => p.validate_at(path, out),
2061 Self::NotifyEvent(p) => p.validate_at(path, out),
2062 Self::NotifyMonitoringReport(p) => p.validate_at(path, out),
2063 Self::NotifyPriorityCharging(p) => p.validate_at(path, out),
2064 Self::NotifyReport(p) => p.validate_at(path, out),
2065 Self::NotifySettlement(p) => p.validate_at(path, out),
2066 Self::NotifyWebPaymentStarted(p) => p.validate_at(path, out),
2067 Self::OpenPeriodicEventStream(p) => p.validate_at(path, out),
2068 Self::PublishFirmwareStatusNotification(p) => p.validate_at(path, out),
2069 Self::PullDynamicScheduleUpdate(p) => p.validate_at(path, out),
2070 Self::ReportChargingProfiles(p) => p.validate_at(path, out),
2071 Self::ReportDERControl(p) => p.validate_at(path, out),
2072 Self::ReservationStatusUpdate(p) => p.validate_at(path, out),
2073 Self::SecurityEventNotification(p) => p.validate_at(path, out),
2074 Self::SignCertificate(p) => p.validate_at(path, out),
2075 Self::StatusNotification(p) => p.validate_at(path, out),
2076 Self::TransactionEvent(p) => p.validate_at(path, out),
2077 Self::VatNumberValidation(p) => p.validate_at(path, out),
2078 }
2079 }
2080}
2081
2082impl serde::Serialize for CsResponse {
2083 fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
2084 match self {
2085 Self::Authorize(p) => p.serialize(ser),
2086 Self::BatterySwap(p) => p.serialize(ser),
2087 Self::BootNotification(p) => p.serialize(ser),
2088 Self::ClearedChargingLimit(p) => p.serialize(ser),
2089 Self::ClosePeriodicEventStream(p) => p.serialize(ser),
2090 Self::DataTransfer(p) => p.serialize(ser),
2091 Self::FirmwareStatusNotification(p) => p.serialize(ser),
2092 Self::Get15118EVCertificate(p) => p.serialize(ser),
2093 Self::GetCertificateChainStatus(p) => p.serialize(ser),
2094 Self::GetCertificateStatus(p) => p.serialize(ser),
2095 Self::Heartbeat(p) => p.serialize(ser),
2096 Self::LogStatusNotification(p) => p.serialize(ser),
2097 Self::MeterValues(p) => p.serialize(ser),
2098 Self::NotifyChargingLimit(p) => p.serialize(ser),
2099 Self::NotifyCustomerInformation(p) => p.serialize(ser),
2100 Self::NotifyDERAlarm(p) => p.serialize(ser),
2101 Self::NotifyDERStartStop(p) => p.serialize(ser),
2102 Self::NotifyDisplayMessages(p) => p.serialize(ser),
2103 Self::NotifyEVChargingNeeds(p) => p.serialize(ser),
2104 Self::NotifyEVChargingSchedule(p) => p.serialize(ser),
2105 Self::NotifyEvent(p) => p.serialize(ser),
2106 Self::NotifyMonitoringReport(p) => p.serialize(ser),
2107 Self::NotifyPriorityCharging(p) => p.serialize(ser),
2108 Self::NotifyReport(p) => p.serialize(ser),
2109 Self::NotifySettlement(p) => p.serialize(ser),
2110 Self::NotifyWebPaymentStarted(p) => p.serialize(ser),
2111 Self::OpenPeriodicEventStream(p) => p.serialize(ser),
2112 Self::PublishFirmwareStatusNotification(p) => p.serialize(ser),
2113 Self::PullDynamicScheduleUpdate(p) => p.serialize(ser),
2114 Self::ReportChargingProfiles(p) => p.serialize(ser),
2115 Self::ReportDERControl(p) => p.serialize(ser),
2116 Self::ReservationStatusUpdate(p) => p.serialize(ser),
2117 Self::SecurityEventNotification(p) => p.serialize(ser),
2118 Self::SignCertificate(p) => p.serialize(ser),
2119 Self::StatusNotification(p) => p.serialize(ser),
2120 Self::TransactionEvent(p) => p.serialize(ser),
2121 Self::VatNumberValidation(p) => p.serialize(ser),
2122 }
2123 }
2124}
2125
2126#[derive(Clone, Debug, PartialEq)]
2128#[non_exhaustive]
2129#[allow(clippy::large_enum_variant)]
2130pub enum CsmsRequest {
2131 AFRRSignal(AFRRSignalRequest),
2133 AdjustPeriodicEventStream(AdjustPeriodicEventStreamRequest),
2135 CancelReservation(CancelReservationRequest),
2137 CertificateSigned(CertificateSignedRequest),
2139 ChangeAvailability(ChangeAvailabilityRequest),
2141 ChangeTransactionTariff(ChangeTransactionTariffRequest),
2143 ClearCache(ClearCacheRequest),
2145 ClearChargingProfile(ClearChargingProfileRequest),
2147 ClearDERControl(ClearDERControlRequest),
2149 ClearDisplayMessage(ClearDisplayMessageRequest),
2151 ClearTariffs(ClearTariffsRequest),
2153 ClearVariableMonitoring(ClearVariableMonitoringRequest),
2155 CostUpdated(CostUpdatedRequest),
2157 CustomerInformation(CustomerInformationRequest),
2159 DataTransfer(DataTransferRequest),
2161 DeleteCertificate(DeleteCertificateRequest),
2163 GetBaseReport(GetBaseReportRequest),
2165 GetChargingProfiles(GetChargingProfilesRequest),
2167 GetCompositeSchedule(GetCompositeScheduleRequest),
2169 GetDERControl(GetDERControlRequest),
2171 GetDisplayMessages(GetDisplayMessagesRequest),
2173 GetInstalledCertificateIds(GetInstalledCertificateIdsRequest),
2175 GetLocalListVersion(GetLocalListVersionRequest),
2177 GetLog(GetLogRequest),
2179 GetMonitoringReport(GetMonitoringReportRequest),
2181 GetPeriodicEventStream(GetPeriodicEventStreamRequest),
2183 GetReport(GetReportRequest),
2185 GetTariffs(GetTariffsRequest),
2187 GetTransactionStatus(GetTransactionStatusRequest),
2189 GetVariables(GetVariablesRequest),
2191 InstallCertificate(InstallCertificateRequest),
2193 NotifyAllowedEnergyTransfer(NotifyAllowedEnergyTransferRequest),
2195 PublishFirmware(PublishFirmwareRequest),
2197 RequestBatterySwap(RequestBatterySwapRequest),
2199 RequestStartTransaction(RequestStartTransactionRequest),
2201 RequestStopTransaction(RequestStopTransactionRequest),
2203 ReserveNow(ReserveNowRequest),
2205 Reset(ResetRequest),
2207 SendLocalList(SendLocalListRequest),
2209 SetChargingProfile(SetChargingProfileRequest),
2211 SetDERControl(SetDERControlRequest),
2213 SetDefaultTariff(SetDefaultTariffRequest),
2215 SetDisplayMessage(SetDisplayMessageRequest),
2217 SetMonitoringBase(SetMonitoringBaseRequest),
2219 SetMonitoringLevel(SetMonitoringLevelRequest),
2221 SetNetworkProfile(SetNetworkProfileRequest),
2223 SetVariableMonitoring(SetVariableMonitoringRequest),
2225 SetVariables(SetVariablesRequest),
2227 TriggerMessage(TriggerMessageRequest),
2229 UnlockConnector(UnlockConnectorRequest),
2231 UnpublishFirmware(UnpublishFirmwareRequest),
2233 UpdateDynamicSchedule(UpdateDynamicScheduleRequest),
2235 UpdateFirmware(UpdateFirmwareRequest),
2237 UsePriorityCharging(UsePriorityChargingRequest),
2239}
2240
2241impl CsmsRequest {
2242 #[must_use]
2244 pub const fn action(&self) -> Action {
2245 match self {
2246 Self::AFRRSignal(_) => Action::AFRRSignal,
2247 Self::AdjustPeriodicEventStream(_) => Action::AdjustPeriodicEventStream,
2248 Self::CancelReservation(_) => Action::CancelReservation,
2249 Self::CertificateSigned(_) => Action::CertificateSigned,
2250 Self::ChangeAvailability(_) => Action::ChangeAvailability,
2251 Self::ChangeTransactionTariff(_) => Action::ChangeTransactionTariff,
2252 Self::ClearCache(_) => Action::ClearCache,
2253 Self::ClearChargingProfile(_) => Action::ClearChargingProfile,
2254 Self::ClearDERControl(_) => Action::ClearDERControl,
2255 Self::ClearDisplayMessage(_) => Action::ClearDisplayMessage,
2256 Self::ClearTariffs(_) => Action::ClearTariffs,
2257 Self::ClearVariableMonitoring(_) => Action::ClearVariableMonitoring,
2258 Self::CostUpdated(_) => Action::CostUpdated,
2259 Self::CustomerInformation(_) => Action::CustomerInformation,
2260 Self::DataTransfer(_) => Action::DataTransfer,
2261 Self::DeleteCertificate(_) => Action::DeleteCertificate,
2262 Self::GetBaseReport(_) => Action::GetBaseReport,
2263 Self::GetChargingProfiles(_) => Action::GetChargingProfiles,
2264 Self::GetCompositeSchedule(_) => Action::GetCompositeSchedule,
2265 Self::GetDERControl(_) => Action::GetDERControl,
2266 Self::GetDisplayMessages(_) => Action::GetDisplayMessages,
2267 Self::GetInstalledCertificateIds(_) => Action::GetInstalledCertificateIds,
2268 Self::GetLocalListVersion(_) => Action::GetLocalListVersion,
2269 Self::GetLog(_) => Action::GetLog,
2270 Self::GetMonitoringReport(_) => Action::GetMonitoringReport,
2271 Self::GetPeriodicEventStream(_) => Action::GetPeriodicEventStream,
2272 Self::GetReport(_) => Action::GetReport,
2273 Self::GetTariffs(_) => Action::GetTariffs,
2274 Self::GetTransactionStatus(_) => Action::GetTransactionStatus,
2275 Self::GetVariables(_) => Action::GetVariables,
2276 Self::InstallCertificate(_) => Action::InstallCertificate,
2277 Self::NotifyAllowedEnergyTransfer(_) => Action::NotifyAllowedEnergyTransfer,
2278 Self::PublishFirmware(_) => Action::PublishFirmware,
2279 Self::RequestBatterySwap(_) => Action::RequestBatterySwap,
2280 Self::RequestStartTransaction(_) => Action::RequestStartTransaction,
2281 Self::RequestStopTransaction(_) => Action::RequestStopTransaction,
2282 Self::ReserveNow(_) => Action::ReserveNow,
2283 Self::Reset(_) => Action::Reset,
2284 Self::SendLocalList(_) => Action::SendLocalList,
2285 Self::SetChargingProfile(_) => Action::SetChargingProfile,
2286 Self::SetDERControl(_) => Action::SetDERControl,
2287 Self::SetDefaultTariff(_) => Action::SetDefaultTariff,
2288 Self::SetDisplayMessage(_) => Action::SetDisplayMessage,
2289 Self::SetMonitoringBase(_) => Action::SetMonitoringBase,
2290 Self::SetMonitoringLevel(_) => Action::SetMonitoringLevel,
2291 Self::SetNetworkProfile(_) => Action::SetNetworkProfile,
2292 Self::SetVariableMonitoring(_) => Action::SetVariableMonitoring,
2293 Self::SetVariables(_) => Action::SetVariables,
2294 Self::TriggerMessage(_) => Action::TriggerMessage,
2295 Self::UnlockConnector(_) => Action::UnlockConnector,
2296 Self::UnpublishFirmware(_) => Action::UnpublishFirmware,
2297 Self::UpdateDynamicSchedule(_) => Action::UpdateDynamicSchedule,
2298 Self::UpdateFirmware(_) => Action::UpdateFirmware,
2299 Self::UsePriorityCharging(_) => Action::UsePriorityCharging,
2300 }
2301 }
2302
2303 pub fn decode(
2306 action: Action,
2307 payload: &RawValue,
2308 options: &DecodeOptions,
2309 ) -> Result<Self, DecodeError> {
2310 Ok(match action {
2311 Action::AFRRSignal => Self::AFRRSignal(crate::decode::decode_payload::<
2312 AFRRSignalRequest,
2313 >(payload, options)?),
2314 Action::AdjustPeriodicEventStream => {
2315 Self::AdjustPeriodicEventStream(crate::decode::decode_payload::<
2316 AdjustPeriodicEventStreamRequest,
2317 >(payload, options)?)
2318 }
2319 Action::CancelReservation => Self::CancelReservation(crate::decode::decode_payload::<
2320 CancelReservationRequest,
2321 >(payload, options)?),
2322 Action::CertificateSigned => Self::CertificateSigned(crate::decode::decode_payload::<
2323 CertificateSignedRequest,
2324 >(payload, options)?),
2325 Action::ChangeAvailability => Self::ChangeAvailability(
2326 crate::decode::decode_payload::<ChangeAvailabilityRequest>(payload, options)?,
2327 ),
2328 Action::ChangeTransactionTariff => {
2329 Self::ChangeTransactionTariff(crate::decode::decode_payload::<
2330 ChangeTransactionTariffRequest,
2331 >(payload, options)?)
2332 }
2333 Action::ClearCache => Self::ClearCache(crate::decode::decode_payload::<
2334 ClearCacheRequest,
2335 >(payload, options)?),
2336 Action::ClearChargingProfile => {
2337 Self::ClearChargingProfile(crate::decode::decode_payload::<
2338 ClearChargingProfileRequest,
2339 >(payload, options)?)
2340 }
2341 Action::ClearDERControl => Self::ClearDERControl(crate::decode::decode_payload::<
2342 ClearDERControlRequest,
2343 >(payload, options)?),
2344 Action::ClearDisplayMessage => {
2345 Self::ClearDisplayMessage(crate::decode::decode_payload::<
2346 ClearDisplayMessageRequest,
2347 >(payload, options)?)
2348 }
2349 Action::ClearTariffs => Self::ClearTariffs(crate::decode::decode_payload::<
2350 ClearTariffsRequest,
2351 >(payload, options)?),
2352 Action::ClearVariableMonitoring => {
2353 Self::ClearVariableMonitoring(crate::decode::decode_payload::<
2354 ClearVariableMonitoringRequest,
2355 >(payload, options)?)
2356 }
2357 Action::CostUpdated => Self::CostUpdated(crate::decode::decode_payload::<
2358 CostUpdatedRequest,
2359 >(payload, options)?),
2360 Action::CustomerInformation => {
2361 Self::CustomerInformation(crate::decode::decode_payload::<
2362 CustomerInformationRequest,
2363 >(payload, options)?)
2364 }
2365 Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
2366 DataTransferRequest,
2367 >(payload, options)?),
2368 Action::DeleteCertificate => Self::DeleteCertificate(crate::decode::decode_payload::<
2369 DeleteCertificateRequest,
2370 >(payload, options)?),
2371 Action::GetBaseReport => Self::GetBaseReport(crate::decode::decode_payload::<
2372 GetBaseReportRequest,
2373 >(payload, options)?),
2374 Action::GetChargingProfiles => {
2375 Self::GetChargingProfiles(crate::decode::decode_payload::<
2376 GetChargingProfilesRequest,
2377 >(payload, options)?)
2378 }
2379 Action::GetCompositeSchedule => {
2380 Self::GetCompositeSchedule(crate::decode::decode_payload::<
2381 GetCompositeScheduleRequest,
2382 >(payload, options)?)
2383 }
2384 Action::GetDERControl => Self::GetDERControl(crate::decode::decode_payload::<
2385 GetDERControlRequest,
2386 >(payload, options)?),
2387 Action::GetDisplayMessages => Self::GetDisplayMessages(
2388 crate::decode::decode_payload::<GetDisplayMessagesRequest>(payload, options)?,
2389 ),
2390 Action::GetInstalledCertificateIds => {
2391 Self::GetInstalledCertificateIds(crate::decode::decode_payload::<
2392 GetInstalledCertificateIdsRequest,
2393 >(payload, options)?)
2394 }
2395 Action::GetLocalListVersion => {
2396 Self::GetLocalListVersion(crate::decode::decode_payload::<
2397 GetLocalListVersionRequest,
2398 >(payload, options)?)
2399 }
2400 Action::GetLog => Self::GetLog(crate::decode::decode_payload::<GetLogRequest>(
2401 payload, options,
2402 )?),
2403 Action::GetMonitoringReport => {
2404 Self::GetMonitoringReport(crate::decode::decode_payload::<
2405 GetMonitoringReportRequest,
2406 >(payload, options)?)
2407 }
2408 Action::GetPeriodicEventStream => {
2409 Self::GetPeriodicEventStream(crate::decode::decode_payload::<
2410 GetPeriodicEventStreamRequest,
2411 >(payload, options)?)
2412 }
2413 Action::GetReport => Self::GetReport(
2414 crate::decode::decode_payload::<GetReportRequest>(payload, options)?,
2415 ),
2416 Action::GetTariffs => Self::GetTariffs(crate::decode::decode_payload::<
2417 GetTariffsRequest,
2418 >(payload, options)?),
2419 Action::GetTransactionStatus => {
2420 Self::GetTransactionStatus(crate::decode::decode_payload::<
2421 GetTransactionStatusRequest,
2422 >(payload, options)?)
2423 }
2424 Action::GetVariables => Self::GetVariables(crate::decode::decode_payload::<
2425 GetVariablesRequest,
2426 >(payload, options)?),
2427 Action::InstallCertificate => Self::InstallCertificate(
2428 crate::decode::decode_payload::<InstallCertificateRequest>(payload, options)?,
2429 ),
2430 Action::NotifyAllowedEnergyTransfer => {
2431 Self::NotifyAllowedEnergyTransfer(crate::decode::decode_payload::<
2432 NotifyAllowedEnergyTransferRequest,
2433 >(payload, options)?)
2434 }
2435 Action::PublishFirmware => Self::PublishFirmware(crate::decode::decode_payload::<
2436 PublishFirmwareRequest,
2437 >(payload, options)?),
2438 Action::RequestBatterySwap => Self::RequestBatterySwap(
2439 crate::decode::decode_payload::<RequestBatterySwapRequest>(payload, options)?,
2440 ),
2441 Action::RequestStartTransaction => {
2442 Self::RequestStartTransaction(crate::decode::decode_payload::<
2443 RequestStartTransactionRequest,
2444 >(payload, options)?)
2445 }
2446 Action::RequestStopTransaction => {
2447 Self::RequestStopTransaction(crate::decode::decode_payload::<
2448 RequestStopTransactionRequest,
2449 >(payload, options)?)
2450 }
2451 Action::ReserveNow => Self::ReserveNow(crate::decode::decode_payload::<
2452 ReserveNowRequest,
2453 >(payload, options)?),
2454 Action::Reset => Self::Reset(crate::decode::decode_payload::<ResetRequest>(
2455 payload, options,
2456 )?),
2457 Action::SendLocalList => Self::SendLocalList(crate::decode::decode_payload::<
2458 SendLocalListRequest,
2459 >(payload, options)?),
2460 Action::SetChargingProfile => Self::SetChargingProfile(
2461 crate::decode::decode_payload::<SetChargingProfileRequest>(payload, options)?,
2462 ),
2463 Action::SetDERControl => Self::SetDERControl(crate::decode::decode_payload::<
2464 SetDERControlRequest,
2465 >(payload, options)?),
2466 Action::SetDefaultTariff => Self::SetDefaultTariff(crate::decode::decode_payload::<
2467 SetDefaultTariffRequest,
2468 >(payload, options)?),
2469 Action::SetDisplayMessage => Self::SetDisplayMessage(crate::decode::decode_payload::<
2470 SetDisplayMessageRequest,
2471 >(payload, options)?),
2472 Action::SetMonitoringBase => Self::SetMonitoringBase(crate::decode::decode_payload::<
2473 SetMonitoringBaseRequest,
2474 >(payload, options)?),
2475 Action::SetMonitoringLevel => Self::SetMonitoringLevel(
2476 crate::decode::decode_payload::<SetMonitoringLevelRequest>(payload, options)?,
2477 ),
2478 Action::SetNetworkProfile => Self::SetNetworkProfile(crate::decode::decode_payload::<
2479 SetNetworkProfileRequest,
2480 >(payload, options)?),
2481 Action::SetVariableMonitoring => {
2482 Self::SetVariableMonitoring(crate::decode::decode_payload::<
2483 SetVariableMonitoringRequest,
2484 >(payload, options)?)
2485 }
2486 Action::SetVariables => Self::SetVariables(crate::decode::decode_payload::<
2487 SetVariablesRequest,
2488 >(payload, options)?),
2489 Action::TriggerMessage => Self::TriggerMessage(crate::decode::decode_payload::<
2490 TriggerMessageRequest,
2491 >(payload, options)?),
2492 Action::UnlockConnector => Self::UnlockConnector(crate::decode::decode_payload::<
2493 UnlockConnectorRequest,
2494 >(payload, options)?),
2495 Action::UnpublishFirmware => Self::UnpublishFirmware(crate::decode::decode_payload::<
2496 UnpublishFirmwareRequest,
2497 >(payload, options)?),
2498 Action::UpdateDynamicSchedule => {
2499 Self::UpdateDynamicSchedule(crate::decode::decode_payload::<
2500 UpdateDynamicScheduleRequest,
2501 >(payload, options)?)
2502 }
2503 Action::UpdateFirmware => Self::UpdateFirmware(crate::decode::decode_payload::<
2504 UpdateFirmwareRequest,
2505 >(payload, options)?),
2506 Action::UsePriorityCharging => {
2507 Self::UsePriorityCharging(crate::decode::decode_payload::<
2508 UsePriorityChargingRequest,
2509 >(payload, options)?)
2510 }
2511 other => return Err(DecodeError::unsupported_action(other.as_str())),
2512 })
2513 }
2514
2515 pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
2517 match self {
2518 Self::AFRRSignal(p) => serde_json::to_string(p),
2519 Self::AdjustPeriodicEventStream(p) => serde_json::to_string(p),
2520 Self::CancelReservation(p) => serde_json::to_string(p),
2521 Self::CertificateSigned(p) => serde_json::to_string(p),
2522 Self::ChangeAvailability(p) => serde_json::to_string(p),
2523 Self::ChangeTransactionTariff(p) => serde_json::to_string(p),
2524 Self::ClearCache(p) => serde_json::to_string(p),
2525 Self::ClearChargingProfile(p) => serde_json::to_string(p),
2526 Self::ClearDERControl(p) => serde_json::to_string(p),
2527 Self::ClearDisplayMessage(p) => serde_json::to_string(p),
2528 Self::ClearTariffs(p) => serde_json::to_string(p),
2529 Self::ClearVariableMonitoring(p) => serde_json::to_string(p),
2530 Self::CostUpdated(p) => serde_json::to_string(p),
2531 Self::CustomerInformation(p) => serde_json::to_string(p),
2532 Self::DataTransfer(p) => serde_json::to_string(p),
2533 Self::DeleteCertificate(p) => serde_json::to_string(p),
2534 Self::GetBaseReport(p) => serde_json::to_string(p),
2535 Self::GetChargingProfiles(p) => serde_json::to_string(p),
2536 Self::GetCompositeSchedule(p) => serde_json::to_string(p),
2537 Self::GetDERControl(p) => serde_json::to_string(p),
2538 Self::GetDisplayMessages(p) => serde_json::to_string(p),
2539 Self::GetInstalledCertificateIds(p) => serde_json::to_string(p),
2540 Self::GetLocalListVersion(p) => serde_json::to_string(p),
2541 Self::GetLog(p) => serde_json::to_string(p),
2542 Self::GetMonitoringReport(p) => serde_json::to_string(p),
2543 Self::GetPeriodicEventStream(p) => serde_json::to_string(p),
2544 Self::GetReport(p) => serde_json::to_string(p),
2545 Self::GetTariffs(p) => serde_json::to_string(p),
2546 Self::GetTransactionStatus(p) => serde_json::to_string(p),
2547 Self::GetVariables(p) => serde_json::to_string(p),
2548 Self::InstallCertificate(p) => serde_json::to_string(p),
2549 Self::NotifyAllowedEnergyTransfer(p) => serde_json::to_string(p),
2550 Self::PublishFirmware(p) => serde_json::to_string(p),
2551 Self::RequestBatterySwap(p) => serde_json::to_string(p),
2552 Self::RequestStartTransaction(p) => serde_json::to_string(p),
2553 Self::RequestStopTransaction(p) => serde_json::to_string(p),
2554 Self::ReserveNow(p) => serde_json::to_string(p),
2555 Self::Reset(p) => serde_json::to_string(p),
2556 Self::SendLocalList(p) => serde_json::to_string(p),
2557 Self::SetChargingProfile(p) => serde_json::to_string(p),
2558 Self::SetDERControl(p) => serde_json::to_string(p),
2559 Self::SetDefaultTariff(p) => serde_json::to_string(p),
2560 Self::SetDisplayMessage(p) => serde_json::to_string(p),
2561 Self::SetMonitoringBase(p) => serde_json::to_string(p),
2562 Self::SetMonitoringLevel(p) => serde_json::to_string(p),
2563 Self::SetNetworkProfile(p) => serde_json::to_string(p),
2564 Self::SetVariableMonitoring(p) => serde_json::to_string(p),
2565 Self::SetVariables(p) => serde_json::to_string(p),
2566 Self::TriggerMessage(p) => serde_json::to_string(p),
2567 Self::UnlockConnector(p) => serde_json::to_string(p),
2568 Self::UnpublishFirmware(p) => serde_json::to_string(p),
2569 Self::UpdateDynamicSchedule(p) => serde_json::to_string(p),
2570 Self::UpdateFirmware(p) => serde_json::to_string(p),
2571 Self::UsePriorityCharging(p) => serde_json::to_string(p),
2572 }
2573 }
2574}
2575
2576impl Validate for CsmsRequest {
2577 fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2578 match self {
2579 Self::AFRRSignal(p) => p.validate_at(path, out),
2580 Self::AdjustPeriodicEventStream(p) => p.validate_at(path, out),
2581 Self::CancelReservation(p) => p.validate_at(path, out),
2582 Self::CertificateSigned(p) => p.validate_at(path, out),
2583 Self::ChangeAvailability(p) => p.validate_at(path, out),
2584 Self::ChangeTransactionTariff(p) => p.validate_at(path, out),
2585 Self::ClearCache(p) => p.validate_at(path, out),
2586 Self::ClearChargingProfile(p) => p.validate_at(path, out),
2587 Self::ClearDERControl(p) => p.validate_at(path, out),
2588 Self::ClearDisplayMessage(p) => p.validate_at(path, out),
2589 Self::ClearTariffs(p) => p.validate_at(path, out),
2590 Self::ClearVariableMonitoring(p) => p.validate_at(path, out),
2591 Self::CostUpdated(p) => p.validate_at(path, out),
2592 Self::CustomerInformation(p) => p.validate_at(path, out),
2593 Self::DataTransfer(p) => p.validate_at(path, out),
2594 Self::DeleteCertificate(p) => p.validate_at(path, out),
2595 Self::GetBaseReport(p) => p.validate_at(path, out),
2596 Self::GetChargingProfiles(p) => p.validate_at(path, out),
2597 Self::GetCompositeSchedule(p) => p.validate_at(path, out),
2598 Self::GetDERControl(p) => p.validate_at(path, out),
2599 Self::GetDisplayMessages(p) => p.validate_at(path, out),
2600 Self::GetInstalledCertificateIds(p) => p.validate_at(path, out),
2601 Self::GetLocalListVersion(p) => p.validate_at(path, out),
2602 Self::GetLog(p) => p.validate_at(path, out),
2603 Self::GetMonitoringReport(p) => p.validate_at(path, out),
2604 Self::GetPeriodicEventStream(p) => p.validate_at(path, out),
2605 Self::GetReport(p) => p.validate_at(path, out),
2606 Self::GetTariffs(p) => p.validate_at(path, out),
2607 Self::GetTransactionStatus(p) => p.validate_at(path, out),
2608 Self::GetVariables(p) => p.validate_at(path, out),
2609 Self::InstallCertificate(p) => p.validate_at(path, out),
2610 Self::NotifyAllowedEnergyTransfer(p) => p.validate_at(path, out),
2611 Self::PublishFirmware(p) => p.validate_at(path, out),
2612 Self::RequestBatterySwap(p) => p.validate_at(path, out),
2613 Self::RequestStartTransaction(p) => p.validate_at(path, out),
2614 Self::RequestStopTransaction(p) => p.validate_at(path, out),
2615 Self::ReserveNow(p) => p.validate_at(path, out),
2616 Self::Reset(p) => p.validate_at(path, out),
2617 Self::SendLocalList(p) => p.validate_at(path, out),
2618 Self::SetChargingProfile(p) => p.validate_at(path, out),
2619 Self::SetDERControl(p) => p.validate_at(path, out),
2620 Self::SetDefaultTariff(p) => p.validate_at(path, out),
2621 Self::SetDisplayMessage(p) => p.validate_at(path, out),
2622 Self::SetMonitoringBase(p) => p.validate_at(path, out),
2623 Self::SetMonitoringLevel(p) => p.validate_at(path, out),
2624 Self::SetNetworkProfile(p) => p.validate_at(path, out),
2625 Self::SetVariableMonitoring(p) => p.validate_at(path, out),
2626 Self::SetVariables(p) => p.validate_at(path, out),
2627 Self::TriggerMessage(p) => p.validate_at(path, out),
2628 Self::UnlockConnector(p) => p.validate_at(path, out),
2629 Self::UnpublishFirmware(p) => p.validate_at(path, out),
2630 Self::UpdateDynamicSchedule(p) => p.validate_at(path, out),
2631 Self::UpdateFirmware(p) => p.validate_at(path, out),
2632 Self::UsePriorityCharging(p) => p.validate_at(path, out),
2633 }
2634 }
2635}
2636
2637impl serde::Serialize for CsmsRequest {
2638 fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
2639 match self {
2640 Self::AFRRSignal(p) => p.serialize(ser),
2641 Self::AdjustPeriodicEventStream(p) => p.serialize(ser),
2642 Self::CancelReservation(p) => p.serialize(ser),
2643 Self::CertificateSigned(p) => p.serialize(ser),
2644 Self::ChangeAvailability(p) => p.serialize(ser),
2645 Self::ChangeTransactionTariff(p) => p.serialize(ser),
2646 Self::ClearCache(p) => p.serialize(ser),
2647 Self::ClearChargingProfile(p) => p.serialize(ser),
2648 Self::ClearDERControl(p) => p.serialize(ser),
2649 Self::ClearDisplayMessage(p) => p.serialize(ser),
2650 Self::ClearTariffs(p) => p.serialize(ser),
2651 Self::ClearVariableMonitoring(p) => p.serialize(ser),
2652 Self::CostUpdated(p) => p.serialize(ser),
2653 Self::CustomerInformation(p) => p.serialize(ser),
2654 Self::DataTransfer(p) => p.serialize(ser),
2655 Self::DeleteCertificate(p) => p.serialize(ser),
2656 Self::GetBaseReport(p) => p.serialize(ser),
2657 Self::GetChargingProfiles(p) => p.serialize(ser),
2658 Self::GetCompositeSchedule(p) => p.serialize(ser),
2659 Self::GetDERControl(p) => p.serialize(ser),
2660 Self::GetDisplayMessages(p) => p.serialize(ser),
2661 Self::GetInstalledCertificateIds(p) => p.serialize(ser),
2662 Self::GetLocalListVersion(p) => p.serialize(ser),
2663 Self::GetLog(p) => p.serialize(ser),
2664 Self::GetMonitoringReport(p) => p.serialize(ser),
2665 Self::GetPeriodicEventStream(p) => p.serialize(ser),
2666 Self::GetReport(p) => p.serialize(ser),
2667 Self::GetTariffs(p) => p.serialize(ser),
2668 Self::GetTransactionStatus(p) => p.serialize(ser),
2669 Self::GetVariables(p) => p.serialize(ser),
2670 Self::InstallCertificate(p) => p.serialize(ser),
2671 Self::NotifyAllowedEnergyTransfer(p) => p.serialize(ser),
2672 Self::PublishFirmware(p) => p.serialize(ser),
2673 Self::RequestBatterySwap(p) => p.serialize(ser),
2674 Self::RequestStartTransaction(p) => p.serialize(ser),
2675 Self::RequestStopTransaction(p) => p.serialize(ser),
2676 Self::ReserveNow(p) => p.serialize(ser),
2677 Self::Reset(p) => p.serialize(ser),
2678 Self::SendLocalList(p) => p.serialize(ser),
2679 Self::SetChargingProfile(p) => p.serialize(ser),
2680 Self::SetDERControl(p) => p.serialize(ser),
2681 Self::SetDefaultTariff(p) => p.serialize(ser),
2682 Self::SetDisplayMessage(p) => p.serialize(ser),
2683 Self::SetMonitoringBase(p) => p.serialize(ser),
2684 Self::SetMonitoringLevel(p) => p.serialize(ser),
2685 Self::SetNetworkProfile(p) => p.serialize(ser),
2686 Self::SetVariableMonitoring(p) => p.serialize(ser),
2687 Self::SetVariables(p) => p.serialize(ser),
2688 Self::TriggerMessage(p) => p.serialize(ser),
2689 Self::UnlockConnector(p) => p.serialize(ser),
2690 Self::UnpublishFirmware(p) => p.serialize(ser),
2691 Self::UpdateDynamicSchedule(p) => p.serialize(ser),
2692 Self::UpdateFirmware(p) => p.serialize(ser),
2693 Self::UsePriorityCharging(p) => p.serialize(ser),
2694 }
2695 }
2696}
2697
2698#[derive(Clone, Debug, PartialEq)]
2700#[non_exhaustive]
2701#[allow(clippy::large_enum_variant)]
2702pub enum CsmsResponse {
2703 AFRRSignal(AFRRSignalResponse),
2705 AdjustPeriodicEventStream(AdjustPeriodicEventStreamResponse),
2707 CancelReservation(CancelReservationResponse),
2709 CertificateSigned(CertificateSignedResponse),
2711 ChangeAvailability(ChangeAvailabilityResponse),
2713 ChangeTransactionTariff(ChangeTransactionTariffResponse),
2715 ClearCache(ClearCacheResponse),
2717 ClearChargingProfile(ClearChargingProfileResponse),
2719 ClearDERControl(ClearDERControlResponse),
2721 ClearDisplayMessage(ClearDisplayMessageResponse),
2723 ClearTariffs(ClearTariffsResponse),
2725 ClearVariableMonitoring(ClearVariableMonitoringResponse),
2727 CostUpdated(CostUpdatedResponse),
2729 CustomerInformation(CustomerInformationResponse),
2731 DataTransfer(DataTransferResponse),
2733 DeleteCertificate(DeleteCertificateResponse),
2735 GetBaseReport(GetBaseReportResponse),
2737 GetChargingProfiles(GetChargingProfilesResponse),
2739 GetCompositeSchedule(GetCompositeScheduleResponse),
2741 GetDERControl(GetDERControlResponse),
2743 GetDisplayMessages(GetDisplayMessagesResponse),
2745 GetInstalledCertificateIds(GetInstalledCertificateIdsResponse),
2747 GetLocalListVersion(GetLocalListVersionResponse),
2749 GetLog(GetLogResponse),
2751 GetMonitoringReport(GetMonitoringReportResponse),
2753 GetPeriodicEventStream(GetPeriodicEventStreamResponse),
2755 GetReport(GetReportResponse),
2757 GetTariffs(GetTariffsResponse),
2759 GetTransactionStatus(GetTransactionStatusResponse),
2761 GetVariables(GetVariablesResponse),
2763 InstallCertificate(InstallCertificateResponse),
2765 NotifyAllowedEnergyTransfer(NotifyAllowedEnergyTransferResponse),
2767 PublishFirmware(PublishFirmwareResponse),
2769 RequestBatterySwap(RequestBatterySwapResponse),
2771 RequestStartTransaction(RequestStartTransactionResponse),
2773 RequestStopTransaction(RequestStopTransactionResponse),
2775 ReserveNow(ReserveNowResponse),
2777 Reset(ResetResponse),
2779 SendLocalList(SendLocalListResponse),
2781 SetChargingProfile(SetChargingProfileResponse),
2783 SetDERControl(SetDERControlResponse),
2785 SetDefaultTariff(SetDefaultTariffResponse),
2787 SetDisplayMessage(SetDisplayMessageResponse),
2789 SetMonitoringBase(SetMonitoringBaseResponse),
2791 SetMonitoringLevel(SetMonitoringLevelResponse),
2793 SetNetworkProfile(SetNetworkProfileResponse),
2795 SetVariableMonitoring(SetVariableMonitoringResponse),
2797 SetVariables(SetVariablesResponse),
2799 TriggerMessage(TriggerMessageResponse),
2801 UnlockConnector(UnlockConnectorResponse),
2803 UnpublishFirmware(UnpublishFirmwareResponse),
2805 UpdateDynamicSchedule(UpdateDynamicScheduleResponse),
2807 UpdateFirmware(UpdateFirmwareResponse),
2809 UsePriorityCharging(UsePriorityChargingResponse),
2811}
2812
2813impl CsmsResponse {
2814 #[must_use]
2816 pub const fn action(&self) -> Action {
2817 match self {
2818 Self::AFRRSignal(_) => Action::AFRRSignal,
2819 Self::AdjustPeriodicEventStream(_) => Action::AdjustPeriodicEventStream,
2820 Self::CancelReservation(_) => Action::CancelReservation,
2821 Self::CertificateSigned(_) => Action::CertificateSigned,
2822 Self::ChangeAvailability(_) => Action::ChangeAvailability,
2823 Self::ChangeTransactionTariff(_) => Action::ChangeTransactionTariff,
2824 Self::ClearCache(_) => Action::ClearCache,
2825 Self::ClearChargingProfile(_) => Action::ClearChargingProfile,
2826 Self::ClearDERControl(_) => Action::ClearDERControl,
2827 Self::ClearDisplayMessage(_) => Action::ClearDisplayMessage,
2828 Self::ClearTariffs(_) => Action::ClearTariffs,
2829 Self::ClearVariableMonitoring(_) => Action::ClearVariableMonitoring,
2830 Self::CostUpdated(_) => Action::CostUpdated,
2831 Self::CustomerInformation(_) => Action::CustomerInformation,
2832 Self::DataTransfer(_) => Action::DataTransfer,
2833 Self::DeleteCertificate(_) => Action::DeleteCertificate,
2834 Self::GetBaseReport(_) => Action::GetBaseReport,
2835 Self::GetChargingProfiles(_) => Action::GetChargingProfiles,
2836 Self::GetCompositeSchedule(_) => Action::GetCompositeSchedule,
2837 Self::GetDERControl(_) => Action::GetDERControl,
2838 Self::GetDisplayMessages(_) => Action::GetDisplayMessages,
2839 Self::GetInstalledCertificateIds(_) => Action::GetInstalledCertificateIds,
2840 Self::GetLocalListVersion(_) => Action::GetLocalListVersion,
2841 Self::GetLog(_) => Action::GetLog,
2842 Self::GetMonitoringReport(_) => Action::GetMonitoringReport,
2843 Self::GetPeriodicEventStream(_) => Action::GetPeriodicEventStream,
2844 Self::GetReport(_) => Action::GetReport,
2845 Self::GetTariffs(_) => Action::GetTariffs,
2846 Self::GetTransactionStatus(_) => Action::GetTransactionStatus,
2847 Self::GetVariables(_) => Action::GetVariables,
2848 Self::InstallCertificate(_) => Action::InstallCertificate,
2849 Self::NotifyAllowedEnergyTransfer(_) => Action::NotifyAllowedEnergyTransfer,
2850 Self::PublishFirmware(_) => Action::PublishFirmware,
2851 Self::RequestBatterySwap(_) => Action::RequestBatterySwap,
2852 Self::RequestStartTransaction(_) => Action::RequestStartTransaction,
2853 Self::RequestStopTransaction(_) => Action::RequestStopTransaction,
2854 Self::ReserveNow(_) => Action::ReserveNow,
2855 Self::Reset(_) => Action::Reset,
2856 Self::SendLocalList(_) => Action::SendLocalList,
2857 Self::SetChargingProfile(_) => Action::SetChargingProfile,
2858 Self::SetDERControl(_) => Action::SetDERControl,
2859 Self::SetDefaultTariff(_) => Action::SetDefaultTariff,
2860 Self::SetDisplayMessage(_) => Action::SetDisplayMessage,
2861 Self::SetMonitoringBase(_) => Action::SetMonitoringBase,
2862 Self::SetMonitoringLevel(_) => Action::SetMonitoringLevel,
2863 Self::SetNetworkProfile(_) => Action::SetNetworkProfile,
2864 Self::SetVariableMonitoring(_) => Action::SetVariableMonitoring,
2865 Self::SetVariables(_) => Action::SetVariables,
2866 Self::TriggerMessage(_) => Action::TriggerMessage,
2867 Self::UnlockConnector(_) => Action::UnlockConnector,
2868 Self::UnpublishFirmware(_) => Action::UnpublishFirmware,
2869 Self::UpdateDynamicSchedule(_) => Action::UpdateDynamicSchedule,
2870 Self::UpdateFirmware(_) => Action::UpdateFirmware,
2871 Self::UsePriorityCharging(_) => Action::UsePriorityCharging,
2872 }
2873 }
2874
2875 pub fn decode(
2878 action: Action,
2879 payload: &RawValue,
2880 options: &DecodeOptions,
2881 ) -> Result<Self, DecodeError> {
2882 Ok(match action {
2883 Action::AFRRSignal => Self::AFRRSignal(crate::decode::decode_payload::<
2884 AFRRSignalResponse,
2885 >(payload, options)?),
2886 Action::AdjustPeriodicEventStream => {
2887 Self::AdjustPeriodicEventStream(crate::decode::decode_payload::<
2888 AdjustPeriodicEventStreamResponse,
2889 >(payload, options)?)
2890 }
2891 Action::CancelReservation => Self::CancelReservation(crate::decode::decode_payload::<
2892 CancelReservationResponse,
2893 >(payload, options)?),
2894 Action::CertificateSigned => Self::CertificateSigned(crate::decode::decode_payload::<
2895 CertificateSignedResponse,
2896 >(payload, options)?),
2897 Action::ChangeAvailability => Self::ChangeAvailability(
2898 crate::decode::decode_payload::<ChangeAvailabilityResponse>(payload, options)?,
2899 ),
2900 Action::ChangeTransactionTariff => {
2901 Self::ChangeTransactionTariff(crate::decode::decode_payload::<
2902 ChangeTransactionTariffResponse,
2903 >(payload, options)?)
2904 }
2905 Action::ClearCache => Self::ClearCache(crate::decode::decode_payload::<
2906 ClearCacheResponse,
2907 >(payload, options)?),
2908 Action::ClearChargingProfile => {
2909 Self::ClearChargingProfile(crate::decode::decode_payload::<
2910 ClearChargingProfileResponse,
2911 >(payload, options)?)
2912 }
2913 Action::ClearDERControl => Self::ClearDERControl(crate::decode::decode_payload::<
2914 ClearDERControlResponse,
2915 >(payload, options)?),
2916 Action::ClearDisplayMessage => {
2917 Self::ClearDisplayMessage(crate::decode::decode_payload::<
2918 ClearDisplayMessageResponse,
2919 >(payload, options)?)
2920 }
2921 Action::ClearTariffs => Self::ClearTariffs(crate::decode::decode_payload::<
2922 ClearTariffsResponse,
2923 >(payload, options)?),
2924 Action::ClearVariableMonitoring => {
2925 Self::ClearVariableMonitoring(crate::decode::decode_payload::<
2926 ClearVariableMonitoringResponse,
2927 >(payload, options)?)
2928 }
2929 Action::CostUpdated => Self::CostUpdated(crate::decode::decode_payload::<
2930 CostUpdatedResponse,
2931 >(payload, options)?),
2932 Action::CustomerInformation => {
2933 Self::CustomerInformation(crate::decode::decode_payload::<
2934 CustomerInformationResponse,
2935 >(payload, options)?)
2936 }
2937 Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
2938 DataTransferResponse,
2939 >(payload, options)?),
2940 Action::DeleteCertificate => Self::DeleteCertificate(crate::decode::decode_payload::<
2941 DeleteCertificateResponse,
2942 >(payload, options)?),
2943 Action::GetBaseReport => Self::GetBaseReport(crate::decode::decode_payload::<
2944 GetBaseReportResponse,
2945 >(payload, options)?),
2946 Action::GetChargingProfiles => {
2947 Self::GetChargingProfiles(crate::decode::decode_payload::<
2948 GetChargingProfilesResponse,
2949 >(payload, options)?)
2950 }
2951 Action::GetCompositeSchedule => {
2952 Self::GetCompositeSchedule(crate::decode::decode_payload::<
2953 GetCompositeScheduleResponse,
2954 >(payload, options)?)
2955 }
2956 Action::GetDERControl => Self::GetDERControl(crate::decode::decode_payload::<
2957 GetDERControlResponse,
2958 >(payload, options)?),
2959 Action::GetDisplayMessages => Self::GetDisplayMessages(
2960 crate::decode::decode_payload::<GetDisplayMessagesResponse>(payload, options)?,
2961 ),
2962 Action::GetInstalledCertificateIds => {
2963 Self::GetInstalledCertificateIds(crate::decode::decode_payload::<
2964 GetInstalledCertificateIdsResponse,
2965 >(payload, options)?)
2966 }
2967 Action::GetLocalListVersion => {
2968 Self::GetLocalListVersion(crate::decode::decode_payload::<
2969 GetLocalListVersionResponse,
2970 >(payload, options)?)
2971 }
2972 Action::GetLog => Self::GetLog(crate::decode::decode_payload::<GetLogResponse>(
2973 payload, options,
2974 )?),
2975 Action::GetMonitoringReport => {
2976 Self::GetMonitoringReport(crate::decode::decode_payload::<
2977 GetMonitoringReportResponse,
2978 >(payload, options)?)
2979 }
2980 Action::GetPeriodicEventStream => {
2981 Self::GetPeriodicEventStream(crate::decode::decode_payload::<
2982 GetPeriodicEventStreamResponse,
2983 >(payload, options)?)
2984 }
2985 Action::GetReport => Self::GetReport(
2986 crate::decode::decode_payload::<GetReportResponse>(payload, options)?,
2987 ),
2988 Action::GetTariffs => Self::GetTariffs(crate::decode::decode_payload::<
2989 GetTariffsResponse,
2990 >(payload, options)?),
2991 Action::GetTransactionStatus => {
2992 Self::GetTransactionStatus(crate::decode::decode_payload::<
2993 GetTransactionStatusResponse,
2994 >(payload, options)?)
2995 }
2996 Action::GetVariables => Self::GetVariables(crate::decode::decode_payload::<
2997 GetVariablesResponse,
2998 >(payload, options)?),
2999 Action::InstallCertificate => Self::InstallCertificate(
3000 crate::decode::decode_payload::<InstallCertificateResponse>(payload, options)?,
3001 ),
3002 Action::NotifyAllowedEnergyTransfer => {
3003 Self::NotifyAllowedEnergyTransfer(crate::decode::decode_payload::<
3004 NotifyAllowedEnergyTransferResponse,
3005 >(payload, options)?)
3006 }
3007 Action::PublishFirmware => Self::PublishFirmware(crate::decode::decode_payload::<
3008 PublishFirmwareResponse,
3009 >(payload, options)?),
3010 Action::RequestBatterySwap => Self::RequestBatterySwap(
3011 crate::decode::decode_payload::<RequestBatterySwapResponse>(payload, options)?,
3012 ),
3013 Action::RequestStartTransaction => {
3014 Self::RequestStartTransaction(crate::decode::decode_payload::<
3015 RequestStartTransactionResponse,
3016 >(payload, options)?)
3017 }
3018 Action::RequestStopTransaction => {
3019 Self::RequestStopTransaction(crate::decode::decode_payload::<
3020 RequestStopTransactionResponse,
3021 >(payload, options)?)
3022 }
3023 Action::ReserveNow => Self::ReserveNow(crate::decode::decode_payload::<
3024 ReserveNowResponse,
3025 >(payload, options)?),
3026 Action::Reset => Self::Reset(crate::decode::decode_payload::<ResetResponse>(
3027 payload, options,
3028 )?),
3029 Action::SendLocalList => Self::SendLocalList(crate::decode::decode_payload::<
3030 SendLocalListResponse,
3031 >(payload, options)?),
3032 Action::SetChargingProfile => Self::SetChargingProfile(
3033 crate::decode::decode_payload::<SetChargingProfileResponse>(payload, options)?,
3034 ),
3035 Action::SetDERControl => Self::SetDERControl(crate::decode::decode_payload::<
3036 SetDERControlResponse,
3037 >(payload, options)?),
3038 Action::SetDefaultTariff => Self::SetDefaultTariff(crate::decode::decode_payload::<
3039 SetDefaultTariffResponse,
3040 >(payload, options)?),
3041 Action::SetDisplayMessage => Self::SetDisplayMessage(crate::decode::decode_payload::<
3042 SetDisplayMessageResponse,
3043 >(payload, options)?),
3044 Action::SetMonitoringBase => Self::SetMonitoringBase(crate::decode::decode_payload::<
3045 SetMonitoringBaseResponse,
3046 >(payload, options)?),
3047 Action::SetMonitoringLevel => Self::SetMonitoringLevel(
3048 crate::decode::decode_payload::<SetMonitoringLevelResponse>(payload, options)?,
3049 ),
3050 Action::SetNetworkProfile => Self::SetNetworkProfile(crate::decode::decode_payload::<
3051 SetNetworkProfileResponse,
3052 >(payload, options)?),
3053 Action::SetVariableMonitoring => {
3054 Self::SetVariableMonitoring(crate::decode::decode_payload::<
3055 SetVariableMonitoringResponse,
3056 >(payload, options)?)
3057 }
3058 Action::SetVariables => Self::SetVariables(crate::decode::decode_payload::<
3059 SetVariablesResponse,
3060 >(payload, options)?),
3061 Action::TriggerMessage => Self::TriggerMessage(crate::decode::decode_payload::<
3062 TriggerMessageResponse,
3063 >(payload, options)?),
3064 Action::UnlockConnector => Self::UnlockConnector(crate::decode::decode_payload::<
3065 UnlockConnectorResponse,
3066 >(payload, options)?),
3067 Action::UnpublishFirmware => Self::UnpublishFirmware(crate::decode::decode_payload::<
3068 UnpublishFirmwareResponse,
3069 >(payload, options)?),
3070 Action::UpdateDynamicSchedule => {
3071 Self::UpdateDynamicSchedule(crate::decode::decode_payload::<
3072 UpdateDynamicScheduleResponse,
3073 >(payload, options)?)
3074 }
3075 Action::UpdateFirmware => Self::UpdateFirmware(crate::decode::decode_payload::<
3076 UpdateFirmwareResponse,
3077 >(payload, options)?),
3078 Action::UsePriorityCharging => {
3079 Self::UsePriorityCharging(crate::decode::decode_payload::<
3080 UsePriorityChargingResponse,
3081 >(payload, options)?)
3082 }
3083 other => return Err(DecodeError::unsupported_action(other.as_str())),
3084 })
3085 }
3086
3087 pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
3089 match self {
3090 Self::AFRRSignal(p) => serde_json::to_string(p),
3091 Self::AdjustPeriodicEventStream(p) => serde_json::to_string(p),
3092 Self::CancelReservation(p) => serde_json::to_string(p),
3093 Self::CertificateSigned(p) => serde_json::to_string(p),
3094 Self::ChangeAvailability(p) => serde_json::to_string(p),
3095 Self::ChangeTransactionTariff(p) => serde_json::to_string(p),
3096 Self::ClearCache(p) => serde_json::to_string(p),
3097 Self::ClearChargingProfile(p) => serde_json::to_string(p),
3098 Self::ClearDERControl(p) => serde_json::to_string(p),
3099 Self::ClearDisplayMessage(p) => serde_json::to_string(p),
3100 Self::ClearTariffs(p) => serde_json::to_string(p),
3101 Self::ClearVariableMonitoring(p) => serde_json::to_string(p),
3102 Self::CostUpdated(p) => serde_json::to_string(p),
3103 Self::CustomerInformation(p) => serde_json::to_string(p),
3104 Self::DataTransfer(p) => serde_json::to_string(p),
3105 Self::DeleteCertificate(p) => serde_json::to_string(p),
3106 Self::GetBaseReport(p) => serde_json::to_string(p),
3107 Self::GetChargingProfiles(p) => serde_json::to_string(p),
3108 Self::GetCompositeSchedule(p) => serde_json::to_string(p),
3109 Self::GetDERControl(p) => serde_json::to_string(p),
3110 Self::GetDisplayMessages(p) => serde_json::to_string(p),
3111 Self::GetInstalledCertificateIds(p) => serde_json::to_string(p),
3112 Self::GetLocalListVersion(p) => serde_json::to_string(p),
3113 Self::GetLog(p) => serde_json::to_string(p),
3114 Self::GetMonitoringReport(p) => serde_json::to_string(p),
3115 Self::GetPeriodicEventStream(p) => serde_json::to_string(p),
3116 Self::GetReport(p) => serde_json::to_string(p),
3117 Self::GetTariffs(p) => serde_json::to_string(p),
3118 Self::GetTransactionStatus(p) => serde_json::to_string(p),
3119 Self::GetVariables(p) => serde_json::to_string(p),
3120 Self::InstallCertificate(p) => serde_json::to_string(p),
3121 Self::NotifyAllowedEnergyTransfer(p) => serde_json::to_string(p),
3122 Self::PublishFirmware(p) => serde_json::to_string(p),
3123 Self::RequestBatterySwap(p) => serde_json::to_string(p),
3124 Self::RequestStartTransaction(p) => serde_json::to_string(p),
3125 Self::RequestStopTransaction(p) => serde_json::to_string(p),
3126 Self::ReserveNow(p) => serde_json::to_string(p),
3127 Self::Reset(p) => serde_json::to_string(p),
3128 Self::SendLocalList(p) => serde_json::to_string(p),
3129 Self::SetChargingProfile(p) => serde_json::to_string(p),
3130 Self::SetDERControl(p) => serde_json::to_string(p),
3131 Self::SetDefaultTariff(p) => serde_json::to_string(p),
3132 Self::SetDisplayMessage(p) => serde_json::to_string(p),
3133 Self::SetMonitoringBase(p) => serde_json::to_string(p),
3134 Self::SetMonitoringLevel(p) => serde_json::to_string(p),
3135 Self::SetNetworkProfile(p) => serde_json::to_string(p),
3136 Self::SetVariableMonitoring(p) => serde_json::to_string(p),
3137 Self::SetVariables(p) => serde_json::to_string(p),
3138 Self::TriggerMessage(p) => serde_json::to_string(p),
3139 Self::UnlockConnector(p) => serde_json::to_string(p),
3140 Self::UnpublishFirmware(p) => serde_json::to_string(p),
3141 Self::UpdateDynamicSchedule(p) => serde_json::to_string(p),
3142 Self::UpdateFirmware(p) => serde_json::to_string(p),
3143 Self::UsePriorityCharging(p) => serde_json::to_string(p),
3144 }
3145 }
3146}
3147
3148impl Validate for CsmsResponse {
3149 fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3150 match self {
3151 Self::AFRRSignal(p) => p.validate_at(path, out),
3152 Self::AdjustPeriodicEventStream(p) => p.validate_at(path, out),
3153 Self::CancelReservation(p) => p.validate_at(path, out),
3154 Self::CertificateSigned(p) => p.validate_at(path, out),
3155 Self::ChangeAvailability(p) => p.validate_at(path, out),
3156 Self::ChangeTransactionTariff(p) => p.validate_at(path, out),
3157 Self::ClearCache(p) => p.validate_at(path, out),
3158 Self::ClearChargingProfile(p) => p.validate_at(path, out),
3159 Self::ClearDERControl(p) => p.validate_at(path, out),
3160 Self::ClearDisplayMessage(p) => p.validate_at(path, out),
3161 Self::ClearTariffs(p) => p.validate_at(path, out),
3162 Self::ClearVariableMonitoring(p) => p.validate_at(path, out),
3163 Self::CostUpdated(p) => p.validate_at(path, out),
3164 Self::CustomerInformation(p) => p.validate_at(path, out),
3165 Self::DataTransfer(p) => p.validate_at(path, out),
3166 Self::DeleteCertificate(p) => p.validate_at(path, out),
3167 Self::GetBaseReport(p) => p.validate_at(path, out),
3168 Self::GetChargingProfiles(p) => p.validate_at(path, out),
3169 Self::GetCompositeSchedule(p) => p.validate_at(path, out),
3170 Self::GetDERControl(p) => p.validate_at(path, out),
3171 Self::GetDisplayMessages(p) => p.validate_at(path, out),
3172 Self::GetInstalledCertificateIds(p) => p.validate_at(path, out),
3173 Self::GetLocalListVersion(p) => p.validate_at(path, out),
3174 Self::GetLog(p) => p.validate_at(path, out),
3175 Self::GetMonitoringReport(p) => p.validate_at(path, out),
3176 Self::GetPeriodicEventStream(p) => p.validate_at(path, out),
3177 Self::GetReport(p) => p.validate_at(path, out),
3178 Self::GetTariffs(p) => p.validate_at(path, out),
3179 Self::GetTransactionStatus(p) => p.validate_at(path, out),
3180 Self::GetVariables(p) => p.validate_at(path, out),
3181 Self::InstallCertificate(p) => p.validate_at(path, out),
3182 Self::NotifyAllowedEnergyTransfer(p) => p.validate_at(path, out),
3183 Self::PublishFirmware(p) => p.validate_at(path, out),
3184 Self::RequestBatterySwap(p) => p.validate_at(path, out),
3185 Self::RequestStartTransaction(p) => p.validate_at(path, out),
3186 Self::RequestStopTransaction(p) => p.validate_at(path, out),
3187 Self::ReserveNow(p) => p.validate_at(path, out),
3188 Self::Reset(p) => p.validate_at(path, out),
3189 Self::SendLocalList(p) => p.validate_at(path, out),
3190 Self::SetChargingProfile(p) => p.validate_at(path, out),
3191 Self::SetDERControl(p) => p.validate_at(path, out),
3192 Self::SetDefaultTariff(p) => p.validate_at(path, out),
3193 Self::SetDisplayMessage(p) => p.validate_at(path, out),
3194 Self::SetMonitoringBase(p) => p.validate_at(path, out),
3195 Self::SetMonitoringLevel(p) => p.validate_at(path, out),
3196 Self::SetNetworkProfile(p) => p.validate_at(path, out),
3197 Self::SetVariableMonitoring(p) => p.validate_at(path, out),
3198 Self::SetVariables(p) => p.validate_at(path, out),
3199 Self::TriggerMessage(p) => p.validate_at(path, out),
3200 Self::UnlockConnector(p) => p.validate_at(path, out),
3201 Self::UnpublishFirmware(p) => p.validate_at(path, out),
3202 Self::UpdateDynamicSchedule(p) => p.validate_at(path, out),
3203 Self::UpdateFirmware(p) => p.validate_at(path, out),
3204 Self::UsePriorityCharging(p) => p.validate_at(path, out),
3205 }
3206 }
3207}
3208
3209impl serde::Serialize for CsmsResponse {
3210 fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
3211 match self {
3212 Self::AFRRSignal(p) => p.serialize(ser),
3213 Self::AdjustPeriodicEventStream(p) => p.serialize(ser),
3214 Self::CancelReservation(p) => p.serialize(ser),
3215 Self::CertificateSigned(p) => p.serialize(ser),
3216 Self::ChangeAvailability(p) => p.serialize(ser),
3217 Self::ChangeTransactionTariff(p) => p.serialize(ser),
3218 Self::ClearCache(p) => p.serialize(ser),
3219 Self::ClearChargingProfile(p) => p.serialize(ser),
3220 Self::ClearDERControl(p) => p.serialize(ser),
3221 Self::ClearDisplayMessage(p) => p.serialize(ser),
3222 Self::ClearTariffs(p) => p.serialize(ser),
3223 Self::ClearVariableMonitoring(p) => p.serialize(ser),
3224 Self::CostUpdated(p) => p.serialize(ser),
3225 Self::CustomerInformation(p) => p.serialize(ser),
3226 Self::DataTransfer(p) => p.serialize(ser),
3227 Self::DeleteCertificate(p) => p.serialize(ser),
3228 Self::GetBaseReport(p) => p.serialize(ser),
3229 Self::GetChargingProfiles(p) => p.serialize(ser),
3230 Self::GetCompositeSchedule(p) => p.serialize(ser),
3231 Self::GetDERControl(p) => p.serialize(ser),
3232 Self::GetDisplayMessages(p) => p.serialize(ser),
3233 Self::GetInstalledCertificateIds(p) => p.serialize(ser),
3234 Self::GetLocalListVersion(p) => p.serialize(ser),
3235 Self::GetLog(p) => p.serialize(ser),
3236 Self::GetMonitoringReport(p) => p.serialize(ser),
3237 Self::GetPeriodicEventStream(p) => p.serialize(ser),
3238 Self::GetReport(p) => p.serialize(ser),
3239 Self::GetTariffs(p) => p.serialize(ser),
3240 Self::GetTransactionStatus(p) => p.serialize(ser),
3241 Self::GetVariables(p) => p.serialize(ser),
3242 Self::InstallCertificate(p) => p.serialize(ser),
3243 Self::NotifyAllowedEnergyTransfer(p) => p.serialize(ser),
3244 Self::PublishFirmware(p) => p.serialize(ser),
3245 Self::RequestBatterySwap(p) => p.serialize(ser),
3246 Self::RequestStartTransaction(p) => p.serialize(ser),
3247 Self::RequestStopTransaction(p) => p.serialize(ser),
3248 Self::ReserveNow(p) => p.serialize(ser),
3249 Self::Reset(p) => p.serialize(ser),
3250 Self::SendLocalList(p) => p.serialize(ser),
3251 Self::SetChargingProfile(p) => p.serialize(ser),
3252 Self::SetDERControl(p) => p.serialize(ser),
3253 Self::SetDefaultTariff(p) => p.serialize(ser),
3254 Self::SetDisplayMessage(p) => p.serialize(ser),
3255 Self::SetMonitoringBase(p) => p.serialize(ser),
3256 Self::SetMonitoringLevel(p) => p.serialize(ser),
3257 Self::SetNetworkProfile(p) => p.serialize(ser),
3258 Self::SetVariableMonitoring(p) => p.serialize(ser),
3259 Self::SetVariables(p) => p.serialize(ser),
3260 Self::TriggerMessage(p) => p.serialize(ser),
3261 Self::UnlockConnector(p) => p.serialize(ser),
3262 Self::UnpublishFirmware(p) => p.serialize(ser),
3263 Self::UpdateDynamicSchedule(p) => p.serialize(ser),
3264 Self::UpdateFirmware(p) => p.serialize(ser),
3265 Self::UsePriorityCharging(p) => p.serialize(ser),
3266 }
3267 }
3268}