1use ocpp_core::validate::{Path, Validate, Violation};
7use serde::{Deserialize, Serialize};
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
10pub enum AuthorizationStatus {
11 #[serde(rename = "Accepted")]
12 Accepted,
13 #[serde(rename = "Blocked")]
14 Blocked,
15 #[serde(rename = "Expired")]
16 Expired,
17 #[serde(rename = "Invalid")]
18 Invalid,
19 #[serde(rename = "ConcurrentTx")]
20 ConcurrentTx,
21}
22
23impl AuthorizationStatus {
24 pub const ALL: &'static [AuthorizationStatus] = &[
25 AuthorizationStatus::Accepted,
26 AuthorizationStatus::Blocked,
27 AuthorizationStatus::Expired,
28 AuthorizationStatus::Invalid,
29 AuthorizationStatus::ConcurrentTx,
30 ];
31 pub const fn as_str(&self) -> &'static str {
33 match self {
34 AuthorizationStatus::Accepted => "Accepted",
35 AuthorizationStatus::Blocked => "Blocked",
36 AuthorizationStatus::Expired => "Expired",
37 AuthorizationStatus::Invalid => "Invalid",
38 AuthorizationStatus::ConcurrentTx => "ConcurrentTx",
39 }
40 }
41}
42
43impl std::fmt::Display for AuthorizationStatus {
44 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
45 f.write_str(self.as_str())
46 }
47}
48
49impl std::str::FromStr for AuthorizationStatus {
50 type Err = ();
51 fn from_str(s: &str) -> Result<Self, ()> {
52 Self::ALL
53 .iter()
54 .copied()
55 .find(|v| v.as_str() == s)
56 .ok_or(())
57 }
58}
59
60impl Validate for AuthorizationStatus {
61 #[inline]
62 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
63 Ok(())
64 }
65}
66
67#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
68pub enum AvailabilityStatus {
69 #[serde(rename = "Accepted")]
70 Accepted,
71 #[serde(rename = "Rejected")]
72 Rejected,
73 #[serde(rename = "Scheduled")]
74 Scheduled,
75}
76
77impl AvailabilityStatus {
78 pub const ALL: &'static [AvailabilityStatus] = &[
79 AvailabilityStatus::Accepted,
80 AvailabilityStatus::Rejected,
81 AvailabilityStatus::Scheduled,
82 ];
83 pub const fn as_str(&self) -> &'static str {
85 match self {
86 AvailabilityStatus::Accepted => "Accepted",
87 AvailabilityStatus::Rejected => "Rejected",
88 AvailabilityStatus::Scheduled => "Scheduled",
89 }
90 }
91}
92
93impl std::fmt::Display for AvailabilityStatus {
94 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
95 f.write_str(self.as_str())
96 }
97}
98
99impl std::str::FromStr for AvailabilityStatus {
100 type Err = ();
101 fn from_str(s: &str) -> Result<Self, ()> {
102 Self::ALL
103 .iter()
104 .copied()
105 .find(|v| v.as_str() == s)
106 .ok_or(())
107 }
108}
109
110impl Validate for AvailabilityStatus {
111 #[inline]
112 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
113 Ok(())
114 }
115}
116
117#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
118pub enum AvailabilityType {
119 #[serde(rename = "Inoperative")]
120 Inoperative,
121 #[serde(rename = "Operative")]
122 Operative,
123}
124
125impl AvailabilityType {
126 pub const ALL: &'static [AvailabilityType] =
127 &[AvailabilityType::Inoperative, AvailabilityType::Operative];
128 pub const fn as_str(&self) -> &'static str {
130 match self {
131 AvailabilityType::Inoperative => "Inoperative",
132 AvailabilityType::Operative => "Operative",
133 }
134 }
135}
136
137impl std::fmt::Display for AvailabilityType {
138 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
139 f.write_str(self.as_str())
140 }
141}
142
143impl std::str::FromStr for AvailabilityType {
144 type Err = ();
145 fn from_str(s: &str) -> Result<Self, ()> {
146 Self::ALL
147 .iter()
148 .copied()
149 .find(|v| v.as_str() == s)
150 .ok_or(())
151 }
152}
153
154impl Validate for AvailabilityType {
155 #[inline]
156 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
157 Ok(())
158 }
159}
160
161#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
162pub enum CancelReservationStatus {
163 #[serde(rename = "Accepted")]
164 Accepted,
165 #[serde(rename = "Rejected")]
166 Rejected,
167}
168
169impl CancelReservationStatus {
170 pub const ALL: &'static [CancelReservationStatus] = &[
171 CancelReservationStatus::Accepted,
172 CancelReservationStatus::Rejected,
173 ];
174 pub const fn as_str(&self) -> &'static str {
176 match self {
177 CancelReservationStatus::Accepted => "Accepted",
178 CancelReservationStatus::Rejected => "Rejected",
179 }
180 }
181}
182
183impl std::fmt::Display for CancelReservationStatus {
184 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
185 f.write_str(self.as_str())
186 }
187}
188
189impl std::str::FromStr for CancelReservationStatus {
190 type Err = ();
191 fn from_str(s: &str) -> Result<Self, ()> {
192 Self::ALL
193 .iter()
194 .copied()
195 .find(|v| v.as_str() == s)
196 .ok_or(())
197 }
198}
199
200impl Validate for CancelReservationStatus {
201 #[inline]
202 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
203 Ok(())
204 }
205}
206
207#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
208pub enum ChargePointErrorCode {
209 #[serde(rename = "ConnectorLockFailure")]
210 ConnectorLockFailure,
211 #[serde(rename = "EVCommunicationError")]
212 EVCommunicationError,
213 #[serde(rename = "GroundFailure")]
214 GroundFailure,
215 #[serde(rename = "HighTemperature")]
216 HighTemperature,
217 #[serde(rename = "InternalError")]
218 InternalError,
219 #[serde(rename = "LocalListConflict")]
220 LocalListConflict,
221 #[serde(rename = "NoError")]
222 NoError,
223 #[serde(rename = "OtherError")]
224 OtherError,
225 #[serde(rename = "OverCurrentFailure")]
226 OverCurrentFailure,
227 #[serde(rename = "PowerMeterFailure")]
228 PowerMeterFailure,
229 #[serde(rename = "PowerSwitchFailure")]
230 PowerSwitchFailure,
231 #[serde(rename = "ReaderFailure")]
232 ReaderFailure,
233 #[serde(rename = "ResetFailure")]
234 ResetFailure,
235 #[serde(rename = "UnderVoltage")]
236 UnderVoltage,
237 #[serde(rename = "OverVoltage")]
238 OverVoltage,
239 #[serde(rename = "WeakSignal")]
240 WeakSignal,
241}
242
243impl ChargePointErrorCode {
244 pub const ALL: &'static [ChargePointErrorCode] = &[
245 ChargePointErrorCode::ConnectorLockFailure,
246 ChargePointErrorCode::EVCommunicationError,
247 ChargePointErrorCode::GroundFailure,
248 ChargePointErrorCode::HighTemperature,
249 ChargePointErrorCode::InternalError,
250 ChargePointErrorCode::LocalListConflict,
251 ChargePointErrorCode::NoError,
252 ChargePointErrorCode::OtherError,
253 ChargePointErrorCode::OverCurrentFailure,
254 ChargePointErrorCode::PowerMeterFailure,
255 ChargePointErrorCode::PowerSwitchFailure,
256 ChargePointErrorCode::ReaderFailure,
257 ChargePointErrorCode::ResetFailure,
258 ChargePointErrorCode::UnderVoltage,
259 ChargePointErrorCode::OverVoltage,
260 ChargePointErrorCode::WeakSignal,
261 ];
262 pub const fn as_str(&self) -> &'static str {
264 match self {
265 ChargePointErrorCode::ConnectorLockFailure => "ConnectorLockFailure",
266 ChargePointErrorCode::EVCommunicationError => "EVCommunicationError",
267 ChargePointErrorCode::GroundFailure => "GroundFailure",
268 ChargePointErrorCode::HighTemperature => "HighTemperature",
269 ChargePointErrorCode::InternalError => "InternalError",
270 ChargePointErrorCode::LocalListConflict => "LocalListConflict",
271 ChargePointErrorCode::NoError => "NoError",
272 ChargePointErrorCode::OtherError => "OtherError",
273 ChargePointErrorCode::OverCurrentFailure => "OverCurrentFailure",
274 ChargePointErrorCode::PowerMeterFailure => "PowerMeterFailure",
275 ChargePointErrorCode::PowerSwitchFailure => "PowerSwitchFailure",
276 ChargePointErrorCode::ReaderFailure => "ReaderFailure",
277 ChargePointErrorCode::ResetFailure => "ResetFailure",
278 ChargePointErrorCode::UnderVoltage => "UnderVoltage",
279 ChargePointErrorCode::OverVoltage => "OverVoltage",
280 ChargePointErrorCode::WeakSignal => "WeakSignal",
281 }
282 }
283}
284
285impl std::fmt::Display for ChargePointErrorCode {
286 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
287 f.write_str(self.as_str())
288 }
289}
290
291impl std::str::FromStr for ChargePointErrorCode {
292 type Err = ();
293 fn from_str(s: &str) -> Result<Self, ()> {
294 Self::ALL
295 .iter()
296 .copied()
297 .find(|v| v.as_str() == s)
298 .ok_or(())
299 }
300}
301
302impl Validate for ChargePointErrorCode {
303 #[inline]
304 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
305 Ok(())
306 }
307}
308
309#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
310pub enum ChargePointStatus {
311 #[serde(rename = "Available")]
312 Available,
313 #[serde(rename = "Preparing")]
314 Preparing,
315 #[serde(rename = "Charging")]
316 Charging,
317 #[serde(rename = "SuspendedEVSE")]
318 SuspendedEVSE,
319 #[serde(rename = "SuspendedEV")]
320 SuspendedEV,
321 #[serde(rename = "Finishing")]
322 Finishing,
323 #[serde(rename = "Reserved")]
324 Reserved,
325 #[serde(rename = "Unavailable")]
326 Unavailable,
327 #[serde(rename = "Faulted")]
328 Faulted,
329}
330
331impl ChargePointStatus {
332 pub const ALL: &'static [ChargePointStatus] = &[
333 ChargePointStatus::Available,
334 ChargePointStatus::Preparing,
335 ChargePointStatus::Charging,
336 ChargePointStatus::SuspendedEVSE,
337 ChargePointStatus::SuspendedEV,
338 ChargePointStatus::Finishing,
339 ChargePointStatus::Reserved,
340 ChargePointStatus::Unavailable,
341 ChargePointStatus::Faulted,
342 ];
343 pub const fn as_str(&self) -> &'static str {
345 match self {
346 ChargePointStatus::Available => "Available",
347 ChargePointStatus::Preparing => "Preparing",
348 ChargePointStatus::Charging => "Charging",
349 ChargePointStatus::SuspendedEVSE => "SuspendedEVSE",
350 ChargePointStatus::SuspendedEV => "SuspendedEV",
351 ChargePointStatus::Finishing => "Finishing",
352 ChargePointStatus::Reserved => "Reserved",
353 ChargePointStatus::Unavailable => "Unavailable",
354 ChargePointStatus::Faulted => "Faulted",
355 }
356 }
357}
358
359impl std::fmt::Display for ChargePointStatus {
360 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
361 f.write_str(self.as_str())
362 }
363}
364
365impl std::str::FromStr for ChargePointStatus {
366 type Err = ();
367 fn from_str(s: &str) -> Result<Self, ()> {
368 Self::ALL
369 .iter()
370 .copied()
371 .find(|v| v.as_str() == s)
372 .ok_or(())
373 }
374}
375
376impl Validate for ChargePointStatus {
377 #[inline]
378 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
379 Ok(())
380 }
381}
382
383#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
384pub enum ChargingProfileKindType {
385 #[serde(rename = "Absolute")]
386 Absolute,
387 #[serde(rename = "Recurring")]
388 Recurring,
389 #[serde(rename = "Relative")]
390 Relative,
391}
392
393impl ChargingProfileKindType {
394 pub const ALL: &'static [ChargingProfileKindType] = &[
395 ChargingProfileKindType::Absolute,
396 ChargingProfileKindType::Recurring,
397 ChargingProfileKindType::Relative,
398 ];
399 pub const fn as_str(&self) -> &'static str {
401 match self {
402 ChargingProfileKindType::Absolute => "Absolute",
403 ChargingProfileKindType::Recurring => "Recurring",
404 ChargingProfileKindType::Relative => "Relative",
405 }
406 }
407}
408
409impl std::fmt::Display for ChargingProfileKindType {
410 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
411 f.write_str(self.as_str())
412 }
413}
414
415impl std::str::FromStr for ChargingProfileKindType {
416 type Err = ();
417 fn from_str(s: &str) -> Result<Self, ()> {
418 Self::ALL
419 .iter()
420 .copied()
421 .find(|v| v.as_str() == s)
422 .ok_or(())
423 }
424}
425
426impl Validate for ChargingProfileKindType {
427 #[inline]
428 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
429 Ok(())
430 }
431}
432
433#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
434pub enum ChargingProfilePurposeType {
435 #[serde(rename = "ChargePointMaxProfile")]
436 ChargePointMaxProfile,
437 #[serde(rename = "TxDefaultProfile")]
438 TxDefaultProfile,
439 #[serde(rename = "TxProfile")]
440 TxProfile,
441}
442
443impl ChargingProfilePurposeType {
444 pub const ALL: &'static [ChargingProfilePurposeType] = &[
445 ChargingProfilePurposeType::ChargePointMaxProfile,
446 ChargingProfilePurposeType::TxDefaultProfile,
447 ChargingProfilePurposeType::TxProfile,
448 ];
449 pub const fn as_str(&self) -> &'static str {
451 match self {
452 ChargingProfilePurposeType::ChargePointMaxProfile => "ChargePointMaxProfile",
453 ChargingProfilePurposeType::TxDefaultProfile => "TxDefaultProfile",
454 ChargingProfilePurposeType::TxProfile => "TxProfile",
455 }
456 }
457}
458
459impl std::fmt::Display for ChargingProfilePurposeType {
460 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
461 f.write_str(self.as_str())
462 }
463}
464
465impl std::str::FromStr for ChargingProfilePurposeType {
466 type Err = ();
467 fn from_str(s: &str) -> Result<Self, ()> {
468 Self::ALL
469 .iter()
470 .copied()
471 .find(|v| v.as_str() == s)
472 .ok_or(())
473 }
474}
475
476impl Validate for ChargingProfilePurposeType {
477 #[inline]
478 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
479 Ok(())
480 }
481}
482
483#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
484pub enum ChargingProfileStatus {
485 #[serde(rename = "Accepted")]
486 Accepted,
487 #[serde(rename = "Rejected")]
488 Rejected,
489 #[serde(rename = "NotSupported")]
490 NotSupported,
491}
492
493impl ChargingProfileStatus {
494 pub const ALL: &'static [ChargingProfileStatus] = &[
495 ChargingProfileStatus::Accepted,
496 ChargingProfileStatus::Rejected,
497 ChargingProfileStatus::NotSupported,
498 ];
499 pub const fn as_str(&self) -> &'static str {
501 match self {
502 ChargingProfileStatus::Accepted => "Accepted",
503 ChargingProfileStatus::Rejected => "Rejected",
504 ChargingProfileStatus::NotSupported => "NotSupported",
505 }
506 }
507}
508
509impl std::fmt::Display for ChargingProfileStatus {
510 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
511 f.write_str(self.as_str())
512 }
513}
514
515impl std::str::FromStr for ChargingProfileStatus {
516 type Err = ();
517 fn from_str(s: &str) -> Result<Self, ()> {
518 Self::ALL
519 .iter()
520 .copied()
521 .find(|v| v.as_str() == s)
522 .ok_or(())
523 }
524}
525
526impl Validate for ChargingProfileStatus {
527 #[inline]
528 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
529 Ok(())
530 }
531}
532
533#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
534pub enum ChargingRateUnitType {
535 #[serde(rename = "A")]
536 A,
537 #[serde(rename = "W")]
538 W,
539}
540
541impl ChargingRateUnitType {
542 pub const ALL: &'static [ChargingRateUnitType] =
543 &[ChargingRateUnitType::A, ChargingRateUnitType::W];
544 pub const fn as_str(&self) -> &'static str {
546 match self {
547 ChargingRateUnitType::A => "A",
548 ChargingRateUnitType::W => "W",
549 }
550 }
551}
552
553impl std::fmt::Display for ChargingRateUnitType {
554 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
555 f.write_str(self.as_str())
556 }
557}
558
559impl std::str::FromStr for ChargingRateUnitType {
560 type Err = ();
561 fn from_str(s: &str) -> Result<Self, ()> {
562 Self::ALL
563 .iter()
564 .copied()
565 .find(|v| v.as_str() == s)
566 .ok_or(())
567 }
568}
569
570impl Validate for ChargingRateUnitType {
571 #[inline]
572 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
573 Ok(())
574 }
575}
576
577#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
578pub enum ClearCacheStatus {
579 #[serde(rename = "Accepted")]
580 Accepted,
581 #[serde(rename = "Rejected")]
582 Rejected,
583}
584
585impl ClearCacheStatus {
586 pub const ALL: &'static [ClearCacheStatus] =
587 &[ClearCacheStatus::Accepted, ClearCacheStatus::Rejected];
588 pub const fn as_str(&self) -> &'static str {
590 match self {
591 ClearCacheStatus::Accepted => "Accepted",
592 ClearCacheStatus::Rejected => "Rejected",
593 }
594 }
595}
596
597impl std::fmt::Display for ClearCacheStatus {
598 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
599 f.write_str(self.as_str())
600 }
601}
602
603impl std::str::FromStr for ClearCacheStatus {
604 type Err = ();
605 fn from_str(s: &str) -> Result<Self, ()> {
606 Self::ALL
607 .iter()
608 .copied()
609 .find(|v| v.as_str() == s)
610 .ok_or(())
611 }
612}
613
614impl Validate for ClearCacheStatus {
615 #[inline]
616 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
617 Ok(())
618 }
619}
620
621#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
622pub enum ClearChargingProfileStatus {
623 #[serde(rename = "Accepted")]
624 Accepted,
625 #[serde(rename = "Unknown")]
626 Unknown,
627}
628
629impl ClearChargingProfileStatus {
630 pub const ALL: &'static [ClearChargingProfileStatus] = &[
631 ClearChargingProfileStatus::Accepted,
632 ClearChargingProfileStatus::Unknown,
633 ];
634 pub const fn as_str(&self) -> &'static str {
636 match self {
637 ClearChargingProfileStatus::Accepted => "Accepted",
638 ClearChargingProfileStatus::Unknown => "Unknown",
639 }
640 }
641}
642
643impl std::fmt::Display for ClearChargingProfileStatus {
644 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
645 f.write_str(self.as_str())
646 }
647}
648
649impl std::str::FromStr for ClearChargingProfileStatus {
650 type Err = ();
651 fn from_str(s: &str) -> Result<Self, ()> {
652 Self::ALL
653 .iter()
654 .copied()
655 .find(|v| v.as_str() == s)
656 .ok_or(())
657 }
658}
659
660impl Validate for ClearChargingProfileStatus {
661 #[inline]
662 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
663 Ok(())
664 }
665}
666
667#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
668pub enum ConfigurationStatus {
669 #[serde(rename = "Accepted")]
670 Accepted,
671 #[serde(rename = "Rejected")]
672 Rejected,
673 #[serde(rename = "RebootRequired")]
674 RebootRequired,
675 #[serde(rename = "NotSupported")]
676 NotSupported,
677}
678
679impl ConfigurationStatus {
680 pub const ALL: &'static [ConfigurationStatus] = &[
681 ConfigurationStatus::Accepted,
682 ConfigurationStatus::Rejected,
683 ConfigurationStatus::RebootRequired,
684 ConfigurationStatus::NotSupported,
685 ];
686 pub const fn as_str(&self) -> &'static str {
688 match self {
689 ConfigurationStatus::Accepted => "Accepted",
690 ConfigurationStatus::Rejected => "Rejected",
691 ConfigurationStatus::RebootRequired => "RebootRequired",
692 ConfigurationStatus::NotSupported => "NotSupported",
693 }
694 }
695}
696
697impl std::fmt::Display for ConfigurationStatus {
698 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
699 f.write_str(self.as_str())
700 }
701}
702
703impl std::str::FromStr for ConfigurationStatus {
704 type Err = ();
705 fn from_str(s: &str) -> Result<Self, ()> {
706 Self::ALL
707 .iter()
708 .copied()
709 .find(|v| v.as_str() == s)
710 .ok_or(())
711 }
712}
713
714impl Validate for ConfigurationStatus {
715 #[inline]
716 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
717 Ok(())
718 }
719}
720
721#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
722pub enum DataTransferStatus {
723 #[serde(rename = "Accepted")]
724 Accepted,
725 #[serde(rename = "Rejected")]
726 Rejected,
727 #[serde(rename = "UnknownMessageId")]
728 UnknownMessageId,
729 #[serde(rename = "UnknownVendorId")]
730 UnknownVendorId,
731}
732
733impl DataTransferStatus {
734 pub const ALL: &'static [DataTransferStatus] = &[
735 DataTransferStatus::Accepted,
736 DataTransferStatus::Rejected,
737 DataTransferStatus::UnknownMessageId,
738 DataTransferStatus::UnknownVendorId,
739 ];
740 pub const fn as_str(&self) -> &'static str {
742 match self {
743 DataTransferStatus::Accepted => "Accepted",
744 DataTransferStatus::Rejected => "Rejected",
745 DataTransferStatus::UnknownMessageId => "UnknownMessageId",
746 DataTransferStatus::UnknownVendorId => "UnknownVendorId",
747 }
748 }
749}
750
751impl std::fmt::Display for DataTransferStatus {
752 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
753 f.write_str(self.as_str())
754 }
755}
756
757impl std::str::FromStr for DataTransferStatus {
758 type Err = ();
759 fn from_str(s: &str) -> Result<Self, ()> {
760 Self::ALL
761 .iter()
762 .copied()
763 .find(|v| v.as_str() == s)
764 .ok_or(())
765 }
766}
767
768impl Validate for DataTransferStatus {
769 #[inline]
770 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
771 Ok(())
772 }
773}
774
775#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
776pub enum DiagnosticsStatus {
777 #[serde(rename = "Idle")]
778 Idle,
779 #[serde(rename = "Uploaded")]
780 Uploaded,
781 #[serde(rename = "UploadFailed")]
782 UploadFailed,
783 #[serde(rename = "Uploading")]
784 Uploading,
785}
786
787impl DiagnosticsStatus {
788 pub const ALL: &'static [DiagnosticsStatus] = &[
789 DiagnosticsStatus::Idle,
790 DiagnosticsStatus::Uploaded,
791 DiagnosticsStatus::UploadFailed,
792 DiagnosticsStatus::Uploading,
793 ];
794 pub const fn as_str(&self) -> &'static str {
796 match self {
797 DiagnosticsStatus::Idle => "Idle",
798 DiagnosticsStatus::Uploaded => "Uploaded",
799 DiagnosticsStatus::UploadFailed => "UploadFailed",
800 DiagnosticsStatus::Uploading => "Uploading",
801 }
802 }
803}
804
805impl std::fmt::Display for DiagnosticsStatus {
806 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
807 f.write_str(self.as_str())
808 }
809}
810
811impl std::str::FromStr for DiagnosticsStatus {
812 type Err = ();
813 fn from_str(s: &str) -> Result<Self, ()> {
814 Self::ALL
815 .iter()
816 .copied()
817 .find(|v| v.as_str() == s)
818 .ok_or(())
819 }
820}
821
822impl Validate for DiagnosticsStatus {
823 #[inline]
824 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
825 Ok(())
826 }
827}
828
829#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
830pub enum FirmwareStatus {
831 #[serde(rename = "Downloaded")]
832 Downloaded,
833 #[serde(rename = "DownloadFailed")]
834 DownloadFailed,
835 #[serde(rename = "Downloading")]
836 Downloading,
837 #[serde(rename = "Idle")]
838 Idle,
839 #[serde(rename = "InstallationFailed")]
840 InstallationFailed,
841 #[serde(rename = "Installing")]
842 Installing,
843 #[serde(rename = "Installed")]
844 Installed,
845}
846
847impl FirmwareStatus {
848 pub const ALL: &'static [FirmwareStatus] = &[
849 FirmwareStatus::Downloaded,
850 FirmwareStatus::DownloadFailed,
851 FirmwareStatus::Downloading,
852 FirmwareStatus::Idle,
853 FirmwareStatus::InstallationFailed,
854 FirmwareStatus::Installing,
855 FirmwareStatus::Installed,
856 ];
857 pub const fn as_str(&self) -> &'static str {
859 match self {
860 FirmwareStatus::Downloaded => "Downloaded",
861 FirmwareStatus::DownloadFailed => "DownloadFailed",
862 FirmwareStatus::Downloading => "Downloading",
863 FirmwareStatus::Idle => "Idle",
864 FirmwareStatus::InstallationFailed => "InstallationFailed",
865 FirmwareStatus::Installing => "Installing",
866 FirmwareStatus::Installed => "Installed",
867 }
868 }
869}
870
871impl std::fmt::Display for FirmwareStatus {
872 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
873 f.write_str(self.as_str())
874 }
875}
876
877impl std::str::FromStr for FirmwareStatus {
878 type Err = ();
879 fn from_str(s: &str) -> Result<Self, ()> {
880 Self::ALL
881 .iter()
882 .copied()
883 .find(|v| v.as_str() == s)
884 .ok_or(())
885 }
886}
887
888impl Validate for FirmwareStatus {
889 #[inline]
890 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
891 Ok(())
892 }
893}
894
895#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
896pub enum GetCompositeScheduleStatus {
897 #[serde(rename = "Accepted")]
898 Accepted,
899 #[serde(rename = "Rejected")]
900 Rejected,
901}
902
903impl GetCompositeScheduleStatus {
904 pub const ALL: &'static [GetCompositeScheduleStatus] = &[
905 GetCompositeScheduleStatus::Accepted,
906 GetCompositeScheduleStatus::Rejected,
907 ];
908 pub const fn as_str(&self) -> &'static str {
910 match self {
911 GetCompositeScheduleStatus::Accepted => "Accepted",
912 GetCompositeScheduleStatus::Rejected => "Rejected",
913 }
914 }
915}
916
917impl std::fmt::Display for GetCompositeScheduleStatus {
918 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
919 f.write_str(self.as_str())
920 }
921}
922
923impl std::str::FromStr for GetCompositeScheduleStatus {
924 type Err = ();
925 fn from_str(s: &str) -> Result<Self, ()> {
926 Self::ALL
927 .iter()
928 .copied()
929 .find(|v| v.as_str() == s)
930 .ok_or(())
931 }
932}
933
934impl Validate for GetCompositeScheduleStatus {
935 #[inline]
936 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
937 Ok(())
938 }
939}
940
941#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
942pub enum Location {
943 #[serde(rename = "Cable")]
944 Cable,
945 #[serde(rename = "EV")]
946 EV,
947 #[serde(rename = "Inlet")]
948 Inlet,
949 #[serde(rename = "Outlet")]
950 Outlet,
951 #[serde(rename = "Body")]
952 Body,
953}
954
955impl Location {
956 pub const ALL: &'static [Location] = &[
957 Location::Cable,
958 Location::EV,
959 Location::Inlet,
960 Location::Outlet,
961 Location::Body,
962 ];
963 pub const fn as_str(&self) -> &'static str {
965 match self {
966 Location::Cable => "Cable",
967 Location::EV => "EV",
968 Location::Inlet => "Inlet",
969 Location::Outlet => "Outlet",
970 Location::Body => "Body",
971 }
972 }
973}
974
975impl std::fmt::Display for Location {
976 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
977 f.write_str(self.as_str())
978 }
979}
980
981impl std::str::FromStr for Location {
982 type Err = ();
983 fn from_str(s: &str) -> Result<Self, ()> {
984 Self::ALL
985 .iter()
986 .copied()
987 .find(|v| v.as_str() == s)
988 .ok_or(())
989 }
990}
991
992impl Validate for Location {
993 #[inline]
994 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
995 Ok(())
996 }
997}
998
999#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1000pub enum Measurand {
1001 #[serde(rename = "Energy.Active.Export.Register")]
1002 EnergyActiveExportRegister,
1003 #[serde(rename = "Energy.Active.Import.Register")]
1004 EnergyActiveImportRegister,
1005 #[serde(rename = "Energy.Reactive.Export.Register")]
1006 EnergyReactiveExportRegister,
1007 #[serde(rename = "Energy.Reactive.Import.Register")]
1008 EnergyReactiveImportRegister,
1009 #[serde(rename = "Energy.Active.Export.Interval")]
1010 EnergyActiveExportInterval,
1011 #[serde(rename = "Energy.Active.Import.Interval")]
1012 EnergyActiveImportInterval,
1013 #[serde(rename = "Energy.Reactive.Export.Interval")]
1014 EnergyReactiveExportInterval,
1015 #[serde(rename = "Energy.Reactive.Import.Interval")]
1016 EnergyReactiveImportInterval,
1017 #[serde(rename = "Power.Active.Export")]
1018 PowerActiveExport,
1019 #[serde(rename = "Power.Active.Import")]
1020 PowerActiveImport,
1021 #[serde(rename = "Power.Offered")]
1022 PowerOffered,
1023 #[serde(rename = "Power.Reactive.Export")]
1024 PowerReactiveExport,
1025 #[serde(rename = "Power.Reactive.Import")]
1026 PowerReactiveImport,
1027 #[serde(rename = "Power.Factor")]
1028 PowerFactor,
1029 #[serde(rename = "Current.Import")]
1030 CurrentImport,
1031 #[serde(rename = "Current.Export")]
1032 CurrentExport,
1033 #[serde(rename = "Current.Offered")]
1034 CurrentOffered,
1035 #[serde(rename = "Voltage")]
1036 Voltage,
1037 #[serde(rename = "Frequency")]
1038 Frequency,
1039 #[serde(rename = "Temperature")]
1040 Temperature,
1041 #[serde(rename = "SoC")]
1042 SoC,
1043 #[serde(rename = "RPM")]
1044 RPM,
1045}
1046
1047impl Measurand {
1048 pub const ALL: &'static [Measurand] = &[
1049 Measurand::EnergyActiveExportRegister,
1050 Measurand::EnergyActiveImportRegister,
1051 Measurand::EnergyReactiveExportRegister,
1052 Measurand::EnergyReactiveImportRegister,
1053 Measurand::EnergyActiveExportInterval,
1054 Measurand::EnergyActiveImportInterval,
1055 Measurand::EnergyReactiveExportInterval,
1056 Measurand::EnergyReactiveImportInterval,
1057 Measurand::PowerActiveExport,
1058 Measurand::PowerActiveImport,
1059 Measurand::PowerOffered,
1060 Measurand::PowerReactiveExport,
1061 Measurand::PowerReactiveImport,
1062 Measurand::PowerFactor,
1063 Measurand::CurrentImport,
1064 Measurand::CurrentExport,
1065 Measurand::CurrentOffered,
1066 Measurand::Voltage,
1067 Measurand::Frequency,
1068 Measurand::Temperature,
1069 Measurand::SoC,
1070 Measurand::RPM,
1071 ];
1072 pub const fn as_str(&self) -> &'static str {
1074 match self {
1075 Measurand::EnergyActiveExportRegister => "Energy.Active.Export.Register",
1076 Measurand::EnergyActiveImportRegister => "Energy.Active.Import.Register",
1077 Measurand::EnergyReactiveExportRegister => "Energy.Reactive.Export.Register",
1078 Measurand::EnergyReactiveImportRegister => "Energy.Reactive.Import.Register",
1079 Measurand::EnergyActiveExportInterval => "Energy.Active.Export.Interval",
1080 Measurand::EnergyActiveImportInterval => "Energy.Active.Import.Interval",
1081 Measurand::EnergyReactiveExportInterval => "Energy.Reactive.Export.Interval",
1082 Measurand::EnergyReactiveImportInterval => "Energy.Reactive.Import.Interval",
1083 Measurand::PowerActiveExport => "Power.Active.Export",
1084 Measurand::PowerActiveImport => "Power.Active.Import",
1085 Measurand::PowerOffered => "Power.Offered",
1086 Measurand::PowerReactiveExport => "Power.Reactive.Export",
1087 Measurand::PowerReactiveImport => "Power.Reactive.Import",
1088 Measurand::PowerFactor => "Power.Factor",
1089 Measurand::CurrentImport => "Current.Import",
1090 Measurand::CurrentExport => "Current.Export",
1091 Measurand::CurrentOffered => "Current.Offered",
1092 Measurand::Voltage => "Voltage",
1093 Measurand::Frequency => "Frequency",
1094 Measurand::Temperature => "Temperature",
1095 Measurand::SoC => "SoC",
1096 Measurand::RPM => "RPM",
1097 }
1098 }
1099}
1100
1101impl std::fmt::Display for Measurand {
1102 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1103 f.write_str(self.as_str())
1104 }
1105}
1106
1107impl std::str::FromStr for Measurand {
1108 type Err = ();
1109 fn from_str(s: &str) -> Result<Self, ()> {
1110 Self::ALL
1111 .iter()
1112 .copied()
1113 .find(|v| v.as_str() == s)
1114 .ok_or(())
1115 }
1116}
1117
1118impl Validate for Measurand {
1119 #[inline]
1120 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1121 Ok(())
1122 }
1123}
1124
1125#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1126pub enum MessageTrigger {
1127 #[serde(rename = "BootNotification")]
1128 BootNotification,
1129 #[serde(rename = "DiagnosticsStatusNotification")]
1130 DiagnosticsStatusNotification,
1131 #[serde(rename = "FirmwareStatusNotification")]
1132 FirmwareStatusNotification,
1133 #[serde(rename = "Heartbeat")]
1134 Heartbeat,
1135 #[serde(rename = "MeterValues")]
1136 MeterValues,
1137 #[serde(rename = "StatusNotification")]
1138 StatusNotification,
1139}
1140
1141impl MessageTrigger {
1142 pub const ALL: &'static [MessageTrigger] = &[
1143 MessageTrigger::BootNotification,
1144 MessageTrigger::DiagnosticsStatusNotification,
1145 MessageTrigger::FirmwareStatusNotification,
1146 MessageTrigger::Heartbeat,
1147 MessageTrigger::MeterValues,
1148 MessageTrigger::StatusNotification,
1149 ];
1150 pub const fn as_str(&self) -> &'static str {
1152 match self {
1153 MessageTrigger::BootNotification => "BootNotification",
1154 MessageTrigger::DiagnosticsStatusNotification => "DiagnosticsStatusNotification",
1155 MessageTrigger::FirmwareStatusNotification => "FirmwareStatusNotification",
1156 MessageTrigger::Heartbeat => "Heartbeat",
1157 MessageTrigger::MeterValues => "MeterValues",
1158 MessageTrigger::StatusNotification => "StatusNotification",
1159 }
1160 }
1161}
1162
1163impl std::fmt::Display for MessageTrigger {
1164 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1165 f.write_str(self.as_str())
1166 }
1167}
1168
1169impl std::str::FromStr for MessageTrigger {
1170 type Err = ();
1171 fn from_str(s: &str) -> Result<Self, ()> {
1172 Self::ALL
1173 .iter()
1174 .copied()
1175 .find(|v| v.as_str() == s)
1176 .ok_or(())
1177 }
1178}
1179
1180impl Validate for MessageTrigger {
1181 #[inline]
1182 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1183 Ok(())
1184 }
1185}
1186
1187#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1188pub enum Phase {
1189 #[serde(rename = "L1")]
1190 L1,
1191 #[serde(rename = "L2")]
1192 L2,
1193 #[serde(rename = "L3")]
1194 L3,
1195 #[serde(rename = "N")]
1196 N,
1197 #[serde(rename = "L1-N")]
1198 L1N,
1199 #[serde(rename = "L2-N")]
1200 L2N,
1201 #[serde(rename = "L3-N")]
1202 L3N,
1203 #[serde(rename = "L1-L2")]
1204 L1L2,
1205 #[serde(rename = "L2-L3")]
1206 L2L3,
1207 #[serde(rename = "L3-L1")]
1208 L3L1,
1209}
1210
1211impl Phase {
1212 pub const ALL: &'static [Phase] = &[
1213 Phase::L1,
1214 Phase::L2,
1215 Phase::L3,
1216 Phase::N,
1217 Phase::L1N,
1218 Phase::L2N,
1219 Phase::L3N,
1220 Phase::L1L2,
1221 Phase::L2L3,
1222 Phase::L3L1,
1223 ];
1224 pub const fn as_str(&self) -> &'static str {
1226 match self {
1227 Phase::L1 => "L1",
1228 Phase::L2 => "L2",
1229 Phase::L3 => "L3",
1230 Phase::N => "N",
1231 Phase::L1N => "L1-N",
1232 Phase::L2N => "L2-N",
1233 Phase::L3N => "L3-N",
1234 Phase::L1L2 => "L1-L2",
1235 Phase::L2L3 => "L2-L3",
1236 Phase::L3L1 => "L3-L1",
1237 }
1238 }
1239}
1240
1241impl std::fmt::Display for Phase {
1242 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1243 f.write_str(self.as_str())
1244 }
1245}
1246
1247impl std::str::FromStr for Phase {
1248 type Err = ();
1249 fn from_str(s: &str) -> Result<Self, ()> {
1250 Self::ALL
1251 .iter()
1252 .copied()
1253 .find(|v| v.as_str() == s)
1254 .ok_or(())
1255 }
1256}
1257
1258impl Validate for Phase {
1259 #[inline]
1260 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1261 Ok(())
1262 }
1263}
1264
1265#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1266pub enum ReadingContext {
1267 #[serde(rename = "Interruption.Begin")]
1268 InterruptionBegin,
1269 #[serde(rename = "Interruption.End")]
1270 InterruptionEnd,
1271 #[serde(rename = "Sample.Clock")]
1272 SampleClock,
1273 #[serde(rename = "Sample.Periodic")]
1274 SamplePeriodic,
1275 #[serde(rename = "Transaction.Begin")]
1276 TransactionBegin,
1277 #[serde(rename = "Transaction.End")]
1278 TransactionEnd,
1279 #[serde(rename = "Trigger")]
1280 Trigger,
1281 #[serde(rename = "Other")]
1282 Other,
1283}
1284
1285impl ReadingContext {
1286 pub const ALL: &'static [ReadingContext] = &[
1287 ReadingContext::InterruptionBegin,
1288 ReadingContext::InterruptionEnd,
1289 ReadingContext::SampleClock,
1290 ReadingContext::SamplePeriodic,
1291 ReadingContext::TransactionBegin,
1292 ReadingContext::TransactionEnd,
1293 ReadingContext::Trigger,
1294 ReadingContext::Other,
1295 ];
1296 pub const fn as_str(&self) -> &'static str {
1298 match self {
1299 ReadingContext::InterruptionBegin => "Interruption.Begin",
1300 ReadingContext::InterruptionEnd => "Interruption.End",
1301 ReadingContext::SampleClock => "Sample.Clock",
1302 ReadingContext::SamplePeriodic => "Sample.Periodic",
1303 ReadingContext::TransactionBegin => "Transaction.Begin",
1304 ReadingContext::TransactionEnd => "Transaction.End",
1305 ReadingContext::Trigger => "Trigger",
1306 ReadingContext::Other => "Other",
1307 }
1308 }
1309}
1310
1311impl std::fmt::Display for ReadingContext {
1312 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1313 f.write_str(self.as_str())
1314 }
1315}
1316
1317impl std::str::FromStr for ReadingContext {
1318 type Err = ();
1319 fn from_str(s: &str) -> Result<Self, ()> {
1320 Self::ALL
1321 .iter()
1322 .copied()
1323 .find(|v| v.as_str() == s)
1324 .ok_or(())
1325 }
1326}
1327
1328impl Validate for ReadingContext {
1329 #[inline]
1330 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1331 Ok(())
1332 }
1333}
1334
1335#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1336pub enum Reason {
1337 #[serde(rename = "EmergencyStop")]
1338 EmergencyStop,
1339 #[serde(rename = "EVDisconnected")]
1340 EVDisconnected,
1341 #[serde(rename = "HardReset")]
1342 HardReset,
1343 #[serde(rename = "Local")]
1344 Local,
1345 #[serde(rename = "Other")]
1346 Other,
1347 #[serde(rename = "PowerLoss")]
1348 PowerLoss,
1349 #[serde(rename = "Reboot")]
1350 Reboot,
1351 #[serde(rename = "Remote")]
1352 Remote,
1353 #[serde(rename = "SoftReset")]
1354 SoftReset,
1355 #[serde(rename = "UnlockCommand")]
1356 UnlockCommand,
1357 #[serde(rename = "DeAuthorized")]
1358 DeAuthorized,
1359}
1360
1361impl Reason {
1362 pub const ALL: &'static [Reason] = &[
1363 Reason::EmergencyStop,
1364 Reason::EVDisconnected,
1365 Reason::HardReset,
1366 Reason::Local,
1367 Reason::Other,
1368 Reason::PowerLoss,
1369 Reason::Reboot,
1370 Reason::Remote,
1371 Reason::SoftReset,
1372 Reason::UnlockCommand,
1373 Reason::DeAuthorized,
1374 ];
1375 pub const fn as_str(&self) -> &'static str {
1377 match self {
1378 Reason::EmergencyStop => "EmergencyStop",
1379 Reason::EVDisconnected => "EVDisconnected",
1380 Reason::HardReset => "HardReset",
1381 Reason::Local => "Local",
1382 Reason::Other => "Other",
1383 Reason::PowerLoss => "PowerLoss",
1384 Reason::Reboot => "Reboot",
1385 Reason::Remote => "Remote",
1386 Reason::SoftReset => "SoftReset",
1387 Reason::UnlockCommand => "UnlockCommand",
1388 Reason::DeAuthorized => "DeAuthorized",
1389 }
1390 }
1391}
1392
1393impl std::fmt::Display for Reason {
1394 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1395 f.write_str(self.as_str())
1396 }
1397}
1398
1399impl std::str::FromStr for Reason {
1400 type Err = ();
1401 fn from_str(s: &str) -> Result<Self, ()> {
1402 Self::ALL
1403 .iter()
1404 .copied()
1405 .find(|v| v.as_str() == s)
1406 .ok_or(())
1407 }
1408}
1409
1410impl Validate for Reason {
1411 #[inline]
1412 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1413 Ok(())
1414 }
1415}
1416
1417#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1418pub enum RecurrencyKindType {
1419 #[serde(rename = "Daily")]
1420 Daily,
1421 #[serde(rename = "Weekly")]
1422 Weekly,
1423}
1424
1425impl RecurrencyKindType {
1426 pub const ALL: &'static [RecurrencyKindType] =
1427 &[RecurrencyKindType::Daily, RecurrencyKindType::Weekly];
1428 pub const fn as_str(&self) -> &'static str {
1430 match self {
1431 RecurrencyKindType::Daily => "Daily",
1432 RecurrencyKindType::Weekly => "Weekly",
1433 }
1434 }
1435}
1436
1437impl std::fmt::Display for RecurrencyKindType {
1438 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1439 f.write_str(self.as_str())
1440 }
1441}
1442
1443impl std::str::FromStr for RecurrencyKindType {
1444 type Err = ();
1445 fn from_str(s: &str) -> Result<Self, ()> {
1446 Self::ALL
1447 .iter()
1448 .copied()
1449 .find(|v| v.as_str() == s)
1450 .ok_or(())
1451 }
1452}
1453
1454impl Validate for RecurrencyKindType {
1455 #[inline]
1456 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1457 Ok(())
1458 }
1459}
1460
1461#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1462pub enum RegistrationStatus {
1463 #[serde(rename = "Accepted")]
1464 Accepted,
1465 #[serde(rename = "Pending")]
1466 Pending,
1467 #[serde(rename = "Rejected")]
1468 Rejected,
1469}
1470
1471impl RegistrationStatus {
1472 pub const ALL: &'static [RegistrationStatus] = &[
1473 RegistrationStatus::Accepted,
1474 RegistrationStatus::Pending,
1475 RegistrationStatus::Rejected,
1476 ];
1477 pub const fn as_str(&self) -> &'static str {
1479 match self {
1480 RegistrationStatus::Accepted => "Accepted",
1481 RegistrationStatus::Pending => "Pending",
1482 RegistrationStatus::Rejected => "Rejected",
1483 }
1484 }
1485}
1486
1487impl std::fmt::Display for RegistrationStatus {
1488 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1489 f.write_str(self.as_str())
1490 }
1491}
1492
1493impl std::str::FromStr for RegistrationStatus {
1494 type Err = ();
1495 fn from_str(s: &str) -> Result<Self, ()> {
1496 Self::ALL
1497 .iter()
1498 .copied()
1499 .find(|v| v.as_str() == s)
1500 .ok_or(())
1501 }
1502}
1503
1504impl Validate for RegistrationStatus {
1505 #[inline]
1506 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1507 Ok(())
1508 }
1509}
1510
1511#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1512pub enum RemoteStartStopStatus {
1513 #[serde(rename = "Accepted")]
1514 Accepted,
1515 #[serde(rename = "Rejected")]
1516 Rejected,
1517}
1518
1519impl RemoteStartStopStatus {
1520 pub const ALL: &'static [RemoteStartStopStatus] = &[
1521 RemoteStartStopStatus::Accepted,
1522 RemoteStartStopStatus::Rejected,
1523 ];
1524 pub const fn as_str(&self) -> &'static str {
1526 match self {
1527 RemoteStartStopStatus::Accepted => "Accepted",
1528 RemoteStartStopStatus::Rejected => "Rejected",
1529 }
1530 }
1531}
1532
1533impl std::fmt::Display for RemoteStartStopStatus {
1534 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1535 f.write_str(self.as_str())
1536 }
1537}
1538
1539impl std::str::FromStr for RemoteStartStopStatus {
1540 type Err = ();
1541 fn from_str(s: &str) -> Result<Self, ()> {
1542 Self::ALL
1543 .iter()
1544 .copied()
1545 .find(|v| v.as_str() == s)
1546 .ok_or(())
1547 }
1548}
1549
1550impl Validate for RemoteStartStopStatus {
1551 #[inline]
1552 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1553 Ok(())
1554 }
1555}
1556
1557#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1558pub enum ReservationStatus {
1559 #[serde(rename = "Accepted")]
1560 Accepted,
1561 #[serde(rename = "Faulted")]
1562 Faulted,
1563 #[serde(rename = "Occupied")]
1564 Occupied,
1565 #[serde(rename = "Rejected")]
1566 Rejected,
1567 #[serde(rename = "Unavailable")]
1568 Unavailable,
1569}
1570
1571impl ReservationStatus {
1572 pub const ALL: &'static [ReservationStatus] = &[
1573 ReservationStatus::Accepted,
1574 ReservationStatus::Faulted,
1575 ReservationStatus::Occupied,
1576 ReservationStatus::Rejected,
1577 ReservationStatus::Unavailable,
1578 ];
1579 pub const fn as_str(&self) -> &'static str {
1581 match self {
1582 ReservationStatus::Accepted => "Accepted",
1583 ReservationStatus::Faulted => "Faulted",
1584 ReservationStatus::Occupied => "Occupied",
1585 ReservationStatus::Rejected => "Rejected",
1586 ReservationStatus::Unavailable => "Unavailable",
1587 }
1588 }
1589}
1590
1591impl std::fmt::Display for ReservationStatus {
1592 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1593 f.write_str(self.as_str())
1594 }
1595}
1596
1597impl std::str::FromStr for ReservationStatus {
1598 type Err = ();
1599 fn from_str(s: &str) -> Result<Self, ()> {
1600 Self::ALL
1601 .iter()
1602 .copied()
1603 .find(|v| v.as_str() == s)
1604 .ok_or(())
1605 }
1606}
1607
1608impl Validate for ReservationStatus {
1609 #[inline]
1610 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1611 Ok(())
1612 }
1613}
1614
1615#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1616pub enum ResetStatus {
1617 #[serde(rename = "Accepted")]
1618 Accepted,
1619 #[serde(rename = "Rejected")]
1620 Rejected,
1621}
1622
1623impl ResetStatus {
1624 pub const ALL: &'static [ResetStatus] = &[ResetStatus::Accepted, ResetStatus::Rejected];
1625 pub const fn as_str(&self) -> &'static str {
1627 match self {
1628 ResetStatus::Accepted => "Accepted",
1629 ResetStatus::Rejected => "Rejected",
1630 }
1631 }
1632}
1633
1634impl std::fmt::Display for ResetStatus {
1635 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1636 f.write_str(self.as_str())
1637 }
1638}
1639
1640impl std::str::FromStr for ResetStatus {
1641 type Err = ();
1642 fn from_str(s: &str) -> Result<Self, ()> {
1643 Self::ALL
1644 .iter()
1645 .copied()
1646 .find(|v| v.as_str() == s)
1647 .ok_or(())
1648 }
1649}
1650
1651impl Validate for ResetStatus {
1652 #[inline]
1653 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1654 Ok(())
1655 }
1656}
1657
1658#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1659pub enum ResetType {
1660 #[serde(rename = "Hard")]
1661 Hard,
1662 #[serde(rename = "Soft")]
1663 Soft,
1664}
1665
1666impl ResetType {
1667 pub const ALL: &'static [ResetType] = &[ResetType::Hard, ResetType::Soft];
1668 pub const fn as_str(&self) -> &'static str {
1670 match self {
1671 ResetType::Hard => "Hard",
1672 ResetType::Soft => "Soft",
1673 }
1674 }
1675}
1676
1677impl std::fmt::Display for ResetType {
1678 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1679 f.write_str(self.as_str())
1680 }
1681}
1682
1683impl std::str::FromStr for ResetType {
1684 type Err = ();
1685 fn from_str(s: &str) -> Result<Self, ()> {
1686 Self::ALL
1687 .iter()
1688 .copied()
1689 .find(|v| v.as_str() == s)
1690 .ok_or(())
1691 }
1692}
1693
1694impl Validate for ResetType {
1695 #[inline]
1696 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1697 Ok(())
1698 }
1699}
1700
1701#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1702pub enum TriggerMessageStatus {
1703 #[serde(rename = "Accepted")]
1704 Accepted,
1705 #[serde(rename = "Rejected")]
1706 Rejected,
1707 #[serde(rename = "NotImplemented")]
1708 NotImplemented,
1709}
1710
1711impl TriggerMessageStatus {
1712 pub const ALL: &'static [TriggerMessageStatus] = &[
1713 TriggerMessageStatus::Accepted,
1714 TriggerMessageStatus::Rejected,
1715 TriggerMessageStatus::NotImplemented,
1716 ];
1717 pub const fn as_str(&self) -> &'static str {
1719 match self {
1720 TriggerMessageStatus::Accepted => "Accepted",
1721 TriggerMessageStatus::Rejected => "Rejected",
1722 TriggerMessageStatus::NotImplemented => "NotImplemented",
1723 }
1724 }
1725}
1726
1727impl std::fmt::Display for TriggerMessageStatus {
1728 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1729 f.write_str(self.as_str())
1730 }
1731}
1732
1733impl std::str::FromStr for TriggerMessageStatus {
1734 type Err = ();
1735 fn from_str(s: &str) -> Result<Self, ()> {
1736 Self::ALL
1737 .iter()
1738 .copied()
1739 .find(|v| v.as_str() == s)
1740 .ok_or(())
1741 }
1742}
1743
1744impl Validate for TriggerMessageStatus {
1745 #[inline]
1746 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1747 Ok(())
1748 }
1749}
1750
1751#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1752pub enum UnitOfMeasure {
1753 #[serde(rename = "Wh")]
1754 Wh,
1755 #[serde(rename = "kWh")]
1756 KWh,
1757 #[serde(rename = "varh")]
1758 Varh,
1759 #[serde(rename = "kvarh")]
1760 Kvarh,
1761 #[serde(rename = "W")]
1762 W,
1763 #[serde(rename = "kW")]
1764 KW,
1765 #[serde(rename = "VA")]
1766 VA,
1767 #[serde(rename = "kVA")]
1768 KVA,
1769 #[serde(rename = "var")]
1770 Var,
1771 #[serde(rename = "kvar")]
1772 Kvar,
1773 #[serde(rename = "A")]
1774 A,
1775 #[serde(rename = "V")]
1776 V,
1777 #[serde(rename = "K")]
1778 K,
1779 #[serde(rename = "Celcius")]
1780 Celcius,
1781 #[serde(rename = "Celsius")]
1782 Celsius,
1783 #[serde(rename = "Fahrenheit")]
1784 Fahrenheit,
1785 #[serde(rename = "Percent")]
1786 Percent,
1787}
1788
1789impl UnitOfMeasure {
1790 pub const ALL: &'static [UnitOfMeasure] = &[
1791 UnitOfMeasure::Wh,
1792 UnitOfMeasure::KWh,
1793 UnitOfMeasure::Varh,
1794 UnitOfMeasure::Kvarh,
1795 UnitOfMeasure::W,
1796 UnitOfMeasure::KW,
1797 UnitOfMeasure::VA,
1798 UnitOfMeasure::KVA,
1799 UnitOfMeasure::Var,
1800 UnitOfMeasure::Kvar,
1801 UnitOfMeasure::A,
1802 UnitOfMeasure::V,
1803 UnitOfMeasure::K,
1804 UnitOfMeasure::Celcius,
1805 UnitOfMeasure::Celsius,
1806 UnitOfMeasure::Fahrenheit,
1807 UnitOfMeasure::Percent,
1808 ];
1809 pub const fn as_str(&self) -> &'static str {
1811 match self {
1812 UnitOfMeasure::Wh => "Wh",
1813 UnitOfMeasure::KWh => "kWh",
1814 UnitOfMeasure::Varh => "varh",
1815 UnitOfMeasure::Kvarh => "kvarh",
1816 UnitOfMeasure::W => "W",
1817 UnitOfMeasure::KW => "kW",
1818 UnitOfMeasure::VA => "VA",
1819 UnitOfMeasure::KVA => "kVA",
1820 UnitOfMeasure::Var => "var",
1821 UnitOfMeasure::Kvar => "kvar",
1822 UnitOfMeasure::A => "A",
1823 UnitOfMeasure::V => "V",
1824 UnitOfMeasure::K => "K",
1825 UnitOfMeasure::Celcius => "Celcius",
1826 UnitOfMeasure::Celsius => "Celsius",
1827 UnitOfMeasure::Fahrenheit => "Fahrenheit",
1828 UnitOfMeasure::Percent => "Percent",
1829 }
1830 }
1831}
1832
1833impl std::fmt::Display for UnitOfMeasure {
1834 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1835 f.write_str(self.as_str())
1836 }
1837}
1838
1839impl std::str::FromStr for UnitOfMeasure {
1840 type Err = ();
1841 fn from_str(s: &str) -> Result<Self, ()> {
1842 Self::ALL
1843 .iter()
1844 .copied()
1845 .find(|v| v.as_str() == s)
1846 .ok_or(())
1847 }
1848}
1849
1850impl Validate for UnitOfMeasure {
1851 #[inline]
1852 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1853 Ok(())
1854 }
1855}
1856
1857#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1858pub enum UnlockStatus {
1859 #[serde(rename = "Unlocked")]
1860 Unlocked,
1861 #[serde(rename = "UnlockFailed")]
1862 UnlockFailed,
1863 #[serde(rename = "NotSupported")]
1864 NotSupported,
1865}
1866
1867impl UnlockStatus {
1868 pub const ALL: &'static [UnlockStatus] = &[
1869 UnlockStatus::Unlocked,
1870 UnlockStatus::UnlockFailed,
1871 UnlockStatus::NotSupported,
1872 ];
1873 pub const fn as_str(&self) -> &'static str {
1875 match self {
1876 UnlockStatus::Unlocked => "Unlocked",
1877 UnlockStatus::UnlockFailed => "UnlockFailed",
1878 UnlockStatus::NotSupported => "NotSupported",
1879 }
1880 }
1881}
1882
1883impl std::fmt::Display for UnlockStatus {
1884 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1885 f.write_str(self.as_str())
1886 }
1887}
1888
1889impl std::str::FromStr for UnlockStatus {
1890 type Err = ();
1891 fn from_str(s: &str) -> Result<Self, ()> {
1892 Self::ALL
1893 .iter()
1894 .copied()
1895 .find(|v| v.as_str() == s)
1896 .ok_or(())
1897 }
1898}
1899
1900impl Validate for UnlockStatus {
1901 #[inline]
1902 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1903 Ok(())
1904 }
1905}
1906
1907#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1908pub enum UpdateStatus {
1909 #[serde(rename = "Accepted")]
1910 Accepted,
1911 #[serde(rename = "Failed")]
1912 Failed,
1913 #[serde(rename = "NotSupported")]
1914 NotSupported,
1915 #[serde(rename = "VersionMismatch")]
1916 VersionMismatch,
1917}
1918
1919impl UpdateStatus {
1920 pub const ALL: &'static [UpdateStatus] = &[
1921 UpdateStatus::Accepted,
1922 UpdateStatus::Failed,
1923 UpdateStatus::NotSupported,
1924 UpdateStatus::VersionMismatch,
1925 ];
1926 pub const fn as_str(&self) -> &'static str {
1928 match self {
1929 UpdateStatus::Accepted => "Accepted",
1930 UpdateStatus::Failed => "Failed",
1931 UpdateStatus::NotSupported => "NotSupported",
1932 UpdateStatus::VersionMismatch => "VersionMismatch",
1933 }
1934 }
1935}
1936
1937impl std::fmt::Display for UpdateStatus {
1938 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1939 f.write_str(self.as_str())
1940 }
1941}
1942
1943impl std::str::FromStr for UpdateStatus {
1944 type Err = ();
1945 fn from_str(s: &str) -> Result<Self, ()> {
1946 Self::ALL
1947 .iter()
1948 .copied()
1949 .find(|v| v.as_str() == s)
1950 .ok_or(())
1951 }
1952}
1953
1954impl Validate for UpdateStatus {
1955 #[inline]
1956 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
1957 Ok(())
1958 }
1959}
1960
1961#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1962pub enum UpdateType {
1963 #[serde(rename = "Differential")]
1964 Differential,
1965 #[serde(rename = "Full")]
1966 Full,
1967}
1968
1969impl UpdateType {
1970 pub const ALL: &'static [UpdateType] = &[UpdateType::Differential, UpdateType::Full];
1971 pub const fn as_str(&self) -> &'static str {
1973 match self {
1974 UpdateType::Differential => "Differential",
1975 UpdateType::Full => "Full",
1976 }
1977 }
1978}
1979
1980impl std::fmt::Display for UpdateType {
1981 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1982 f.write_str(self.as_str())
1983 }
1984}
1985
1986impl std::str::FromStr for UpdateType {
1987 type Err = ();
1988 fn from_str(s: &str) -> Result<Self, ()> {
1989 Self::ALL
1990 .iter()
1991 .copied()
1992 .find(|v| v.as_str() == s)
1993 .ok_or(())
1994 }
1995}
1996
1997impl Validate for UpdateType {
1998 #[inline]
1999 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
2000 Ok(())
2001 }
2002}
2003
2004#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
2005pub enum ValueFormat {
2006 #[serde(rename = "Raw")]
2007 Raw,
2008 #[serde(rename = "SignedData")]
2009 SignedData,
2010}
2011
2012impl ValueFormat {
2013 pub const ALL: &'static [ValueFormat] = &[ValueFormat::Raw, ValueFormat::SignedData];
2014 pub const fn as_str(&self) -> &'static str {
2016 match self {
2017 ValueFormat::Raw => "Raw",
2018 ValueFormat::SignedData => "SignedData",
2019 }
2020 }
2021}
2022
2023impl std::fmt::Display for ValueFormat {
2024 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2025 f.write_str(self.as_str())
2026 }
2027}
2028
2029impl std::str::FromStr for ValueFormat {
2030 type Err = ();
2031 fn from_str(s: &str) -> Result<Self, ()> {
2032 Self::ALL
2033 .iter()
2034 .copied()
2035 .find(|v| v.as_str() == s)
2036 .ok_or(())
2037 }
2038}
2039
2040impl Validate for ValueFormat {
2041 #[inline]
2042 fn validate(&self, _: &Path<'_>) -> Result<(), Violation> {
2043 Ok(())
2044 }
2045}