#![allow(unused_imports, clippy::doc_markdown, clippy::struct_excessive_bools)]
#![allow(
clippy::too_many_lines,
clippy::too_many_arguments,
clippy::wildcard_imports
)]
#![allow(clippy::match_same_arms, clippy::fn_params_excessive_bools)]
use alloc::string::String;
use alloc::vec::Vec;
use serde::{Deserialize, Serialize};
use super::messages::*;
use crate::decode::{DecodeError, DecodeOptions};
use crate::message::{MessageKind, Origin};
use crate::validate::{Validate, ValidationPath, Violations};
use serde_json::value::RawValue;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[non_exhaustive]
pub enum Action {
AFRRSignal,
AdjustPeriodicEventStream,
Authorize,
BatterySwap,
BootNotification,
CancelReservation,
CertificateSigned,
ChangeAvailability,
ChangeTransactionTariff,
ClearCache,
ClearChargingProfile,
ClearDERControl,
ClearDisplayMessage,
ClearTariffs,
ClearVariableMonitoring,
ClearedChargingLimit,
ClosePeriodicEventStream,
CostUpdated,
CustomerInformation,
DataTransfer,
DeleteCertificate,
FirmwareStatusNotification,
Get15118EVCertificate,
GetBaseReport,
GetCertificateChainStatus,
GetCertificateStatus,
GetChargingProfiles,
GetCompositeSchedule,
GetDERControl,
GetDisplayMessages,
GetInstalledCertificateIds,
GetLocalListVersion,
GetLog,
GetMonitoringReport,
GetPeriodicEventStream,
GetReport,
GetTariffs,
GetTransactionStatus,
GetVariables,
Heartbeat,
InstallCertificate,
LogStatusNotification,
MeterValues,
NotifyAllowedEnergyTransfer,
NotifyChargingLimit,
NotifyCustomerInformation,
NotifyDERAlarm,
NotifyDERStartStop,
NotifyDisplayMessages,
NotifyEVChargingNeeds,
NotifyEVChargingSchedule,
NotifyEvent,
NotifyMonitoringReport,
NotifyPeriodicEventStream,
NotifyPriorityCharging,
NotifyReport,
NotifySettlement,
NotifyWebPaymentStarted,
OpenPeriodicEventStream,
PublishFirmware,
PublishFirmwareStatusNotification,
PullDynamicScheduleUpdate,
ReportChargingProfiles,
ReportDERControl,
RequestBatterySwap,
RequestStartTransaction,
RequestStopTransaction,
ReservationStatusUpdate,
ReserveNow,
Reset,
SecurityEventNotification,
SendLocalList,
SetChargingProfile,
SetDERControl,
SetDefaultTariff,
SetDisplayMessage,
SetMonitoringBase,
SetMonitoringLevel,
SetNetworkProfile,
SetVariableMonitoring,
SetVariables,
SignCertificate,
StatusNotification,
TransactionEvent,
TriggerMessage,
UnlockConnector,
UnpublishFirmware,
UpdateDynamicSchedule,
UpdateFirmware,
UsePriorityCharging,
VatNumberValidation,
}
impl Action {
pub const ALL: &'static [Action] = &[
Action::AFRRSignal,
Action::AdjustPeriodicEventStream,
Action::Authorize,
Action::BatterySwap,
Action::BootNotification,
Action::CancelReservation,
Action::CertificateSigned,
Action::ChangeAvailability,
Action::ChangeTransactionTariff,
Action::ClearCache,
Action::ClearChargingProfile,
Action::ClearDERControl,
Action::ClearDisplayMessage,
Action::ClearTariffs,
Action::ClearVariableMonitoring,
Action::ClearedChargingLimit,
Action::ClosePeriodicEventStream,
Action::CostUpdated,
Action::CustomerInformation,
Action::DataTransfer,
Action::DeleteCertificate,
Action::FirmwareStatusNotification,
Action::Get15118EVCertificate,
Action::GetBaseReport,
Action::GetCertificateChainStatus,
Action::GetCertificateStatus,
Action::GetChargingProfiles,
Action::GetCompositeSchedule,
Action::GetDERControl,
Action::GetDisplayMessages,
Action::GetInstalledCertificateIds,
Action::GetLocalListVersion,
Action::GetLog,
Action::GetMonitoringReport,
Action::GetPeriodicEventStream,
Action::GetReport,
Action::GetTariffs,
Action::GetTransactionStatus,
Action::GetVariables,
Action::Heartbeat,
Action::InstallCertificate,
Action::LogStatusNotification,
Action::MeterValues,
Action::NotifyAllowedEnergyTransfer,
Action::NotifyChargingLimit,
Action::NotifyCustomerInformation,
Action::NotifyDERAlarm,
Action::NotifyDERStartStop,
Action::NotifyDisplayMessages,
Action::NotifyEVChargingNeeds,
Action::NotifyEVChargingSchedule,
Action::NotifyEvent,
Action::NotifyMonitoringReport,
Action::NotifyPeriodicEventStream,
Action::NotifyPriorityCharging,
Action::NotifyReport,
Action::NotifySettlement,
Action::NotifyWebPaymentStarted,
Action::OpenPeriodicEventStream,
Action::PublishFirmware,
Action::PublishFirmwareStatusNotification,
Action::PullDynamicScheduleUpdate,
Action::ReportChargingProfiles,
Action::ReportDERControl,
Action::RequestBatterySwap,
Action::RequestStartTransaction,
Action::RequestStopTransaction,
Action::ReservationStatusUpdate,
Action::ReserveNow,
Action::Reset,
Action::SecurityEventNotification,
Action::SendLocalList,
Action::SetChargingProfile,
Action::SetDERControl,
Action::SetDefaultTariff,
Action::SetDisplayMessage,
Action::SetMonitoringBase,
Action::SetMonitoringLevel,
Action::SetNetworkProfile,
Action::SetVariableMonitoring,
Action::SetVariables,
Action::SignCertificate,
Action::StatusNotification,
Action::TransactionEvent,
Action::TriggerMessage,
Action::UnlockConnector,
Action::UnpublishFirmware,
Action::UpdateDynamicSchedule,
Action::UpdateFirmware,
Action::UsePriorityCharging,
Action::VatNumberValidation,
];
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Action::AFRRSignal => "AFRRSignal",
Action::AdjustPeriodicEventStream => "AdjustPeriodicEventStream",
Action::Authorize => "Authorize",
Action::BatterySwap => "BatterySwap",
Action::BootNotification => "BootNotification",
Action::CancelReservation => "CancelReservation",
Action::CertificateSigned => "CertificateSigned",
Action::ChangeAvailability => "ChangeAvailability",
Action::ChangeTransactionTariff => "ChangeTransactionTariff",
Action::ClearCache => "ClearCache",
Action::ClearChargingProfile => "ClearChargingProfile",
Action::ClearDERControl => "ClearDERControl",
Action::ClearDisplayMessage => "ClearDisplayMessage",
Action::ClearTariffs => "ClearTariffs",
Action::ClearVariableMonitoring => "ClearVariableMonitoring",
Action::ClearedChargingLimit => "ClearedChargingLimit",
Action::ClosePeriodicEventStream => "ClosePeriodicEventStream",
Action::CostUpdated => "CostUpdated",
Action::CustomerInformation => "CustomerInformation",
Action::DataTransfer => "DataTransfer",
Action::DeleteCertificate => "DeleteCertificate",
Action::FirmwareStatusNotification => "FirmwareStatusNotification",
Action::Get15118EVCertificate => "Get15118EVCertificate",
Action::GetBaseReport => "GetBaseReport",
Action::GetCertificateChainStatus => "GetCertificateChainStatus",
Action::GetCertificateStatus => "GetCertificateStatus",
Action::GetChargingProfiles => "GetChargingProfiles",
Action::GetCompositeSchedule => "GetCompositeSchedule",
Action::GetDERControl => "GetDERControl",
Action::GetDisplayMessages => "GetDisplayMessages",
Action::GetInstalledCertificateIds => "GetInstalledCertificateIds",
Action::GetLocalListVersion => "GetLocalListVersion",
Action::GetLog => "GetLog",
Action::GetMonitoringReport => "GetMonitoringReport",
Action::GetPeriodicEventStream => "GetPeriodicEventStream",
Action::GetReport => "GetReport",
Action::GetTariffs => "GetTariffs",
Action::GetTransactionStatus => "GetTransactionStatus",
Action::GetVariables => "GetVariables",
Action::Heartbeat => "Heartbeat",
Action::InstallCertificate => "InstallCertificate",
Action::LogStatusNotification => "LogStatusNotification",
Action::MeterValues => "MeterValues",
Action::NotifyAllowedEnergyTransfer => "NotifyAllowedEnergyTransfer",
Action::NotifyChargingLimit => "NotifyChargingLimit",
Action::NotifyCustomerInformation => "NotifyCustomerInformation",
Action::NotifyDERAlarm => "NotifyDERAlarm",
Action::NotifyDERStartStop => "NotifyDERStartStop",
Action::NotifyDisplayMessages => "NotifyDisplayMessages",
Action::NotifyEVChargingNeeds => "NotifyEVChargingNeeds",
Action::NotifyEVChargingSchedule => "NotifyEVChargingSchedule",
Action::NotifyEvent => "NotifyEvent",
Action::NotifyMonitoringReport => "NotifyMonitoringReport",
Action::NotifyPeriodicEventStream => "NotifyPeriodicEventStream",
Action::NotifyPriorityCharging => "NotifyPriorityCharging",
Action::NotifyReport => "NotifyReport",
Action::NotifySettlement => "NotifySettlement",
Action::NotifyWebPaymentStarted => "NotifyWebPaymentStarted",
Action::OpenPeriodicEventStream => "OpenPeriodicEventStream",
Action::PublishFirmware => "PublishFirmware",
Action::PublishFirmwareStatusNotification => "PublishFirmwareStatusNotification",
Action::PullDynamicScheduleUpdate => "PullDynamicScheduleUpdate",
Action::ReportChargingProfiles => "ReportChargingProfiles",
Action::ReportDERControl => "ReportDERControl",
Action::RequestBatterySwap => "RequestBatterySwap",
Action::RequestStartTransaction => "RequestStartTransaction",
Action::RequestStopTransaction => "RequestStopTransaction",
Action::ReservationStatusUpdate => "ReservationStatusUpdate",
Action::ReserveNow => "ReserveNow",
Action::Reset => "Reset",
Action::SecurityEventNotification => "SecurityEventNotification",
Action::SendLocalList => "SendLocalList",
Action::SetChargingProfile => "SetChargingProfile",
Action::SetDERControl => "SetDERControl",
Action::SetDefaultTariff => "SetDefaultTariff",
Action::SetDisplayMessage => "SetDisplayMessage",
Action::SetMonitoringBase => "SetMonitoringBase",
Action::SetMonitoringLevel => "SetMonitoringLevel",
Action::SetNetworkProfile => "SetNetworkProfile",
Action::SetVariableMonitoring => "SetVariableMonitoring",
Action::SetVariables => "SetVariables",
Action::SignCertificate => "SignCertificate",
Action::StatusNotification => "StatusNotification",
Action::TransactionEvent => "TransactionEvent",
Action::TriggerMessage => "TriggerMessage",
Action::UnlockConnector => "UnlockConnector",
Action::UnpublishFirmware => "UnpublishFirmware",
Action::UpdateDynamicSchedule => "UpdateDynamicSchedule",
Action::UpdateFirmware => "UpdateFirmware",
Action::UsePriorityCharging => "UsePriorityCharging",
Action::VatNumberValidation => "VatNumberValidation",
}
}
#[must_use]
pub fn from_wire(name: &str) -> Option<Self> {
Some(match name {
"AFRRSignal" => Action::AFRRSignal,
"AdjustPeriodicEventStream" => Action::AdjustPeriodicEventStream,
"Authorize" => Action::Authorize,
"BatterySwap" => Action::BatterySwap,
"BootNotification" => Action::BootNotification,
"CancelReservation" => Action::CancelReservation,
"CertificateSigned" => Action::CertificateSigned,
"ChangeAvailability" => Action::ChangeAvailability,
"ChangeTransactionTariff" => Action::ChangeTransactionTariff,
"ClearCache" => Action::ClearCache,
"ClearChargingProfile" => Action::ClearChargingProfile,
"ClearDERControl" => Action::ClearDERControl,
"ClearDisplayMessage" => Action::ClearDisplayMessage,
"ClearTariffs" => Action::ClearTariffs,
"ClearVariableMonitoring" => Action::ClearVariableMonitoring,
"ClearedChargingLimit" => Action::ClearedChargingLimit,
"ClosePeriodicEventStream" => Action::ClosePeriodicEventStream,
"CostUpdated" => Action::CostUpdated,
"CustomerInformation" => Action::CustomerInformation,
"DataTransfer" => Action::DataTransfer,
"DeleteCertificate" => Action::DeleteCertificate,
"FirmwareStatusNotification" => Action::FirmwareStatusNotification,
"Get15118EVCertificate" => Action::Get15118EVCertificate,
"GetBaseReport" => Action::GetBaseReport,
"GetCertificateChainStatus" => Action::GetCertificateChainStatus,
"GetCertificateStatus" => Action::GetCertificateStatus,
"GetChargingProfiles" => Action::GetChargingProfiles,
"GetCompositeSchedule" => Action::GetCompositeSchedule,
"GetDERControl" => Action::GetDERControl,
"GetDisplayMessages" => Action::GetDisplayMessages,
"GetInstalledCertificateIds" => Action::GetInstalledCertificateIds,
"GetLocalListVersion" => Action::GetLocalListVersion,
"GetLog" => Action::GetLog,
"GetMonitoringReport" => Action::GetMonitoringReport,
"GetPeriodicEventStream" => Action::GetPeriodicEventStream,
"GetReport" => Action::GetReport,
"GetTariffs" => Action::GetTariffs,
"GetTransactionStatus" => Action::GetTransactionStatus,
"GetVariables" => Action::GetVariables,
"Heartbeat" => Action::Heartbeat,
"InstallCertificate" => Action::InstallCertificate,
"LogStatusNotification" => Action::LogStatusNotification,
"MeterValues" => Action::MeterValues,
"NotifyAllowedEnergyTransfer" => Action::NotifyAllowedEnergyTransfer,
"NotifyChargingLimit" => Action::NotifyChargingLimit,
"NotifyCustomerInformation" => Action::NotifyCustomerInformation,
"NotifyDERAlarm" => Action::NotifyDERAlarm,
"NotifyDERStartStop" => Action::NotifyDERStartStop,
"NotifyDisplayMessages" => Action::NotifyDisplayMessages,
"NotifyEVChargingNeeds" => Action::NotifyEVChargingNeeds,
"NotifyEVChargingSchedule" => Action::NotifyEVChargingSchedule,
"NotifyEvent" => Action::NotifyEvent,
"NotifyMonitoringReport" => Action::NotifyMonitoringReport,
"NotifyPeriodicEventStream" => Action::NotifyPeriodicEventStream,
"NotifyPriorityCharging" => Action::NotifyPriorityCharging,
"NotifyReport" => Action::NotifyReport,
"NotifySettlement" => Action::NotifySettlement,
"NotifyWebPaymentStarted" => Action::NotifyWebPaymentStarted,
"OpenPeriodicEventStream" => Action::OpenPeriodicEventStream,
"PublishFirmware" => Action::PublishFirmware,
"PublishFirmwareStatusNotification" => Action::PublishFirmwareStatusNotification,
"PullDynamicScheduleUpdate" => Action::PullDynamicScheduleUpdate,
"ReportChargingProfiles" => Action::ReportChargingProfiles,
"ReportDERControl" => Action::ReportDERControl,
"RequestBatterySwap" => Action::RequestBatterySwap,
"RequestStartTransaction" => Action::RequestStartTransaction,
"RequestStopTransaction" => Action::RequestStopTransaction,
"ReservationStatusUpdate" => Action::ReservationStatusUpdate,
"ReserveNow" => Action::ReserveNow,
"Reset" => Action::Reset,
"SecurityEventNotification" => Action::SecurityEventNotification,
"SendLocalList" => Action::SendLocalList,
"SetChargingProfile" => Action::SetChargingProfile,
"SetDERControl" => Action::SetDERControl,
"SetDefaultTariff" => Action::SetDefaultTariff,
"SetDisplayMessage" => Action::SetDisplayMessage,
"SetMonitoringBase" => Action::SetMonitoringBase,
"SetMonitoringLevel" => Action::SetMonitoringLevel,
"SetNetworkProfile" => Action::SetNetworkProfile,
"SetVariableMonitoring" => Action::SetVariableMonitoring,
"SetVariables" => Action::SetVariables,
"SignCertificate" => Action::SignCertificate,
"StatusNotification" => Action::StatusNotification,
"TransactionEvent" => Action::TransactionEvent,
"TriggerMessage" => Action::TriggerMessage,
"UnlockConnector" => Action::UnlockConnector,
"UnpublishFirmware" => Action::UnpublishFirmware,
"UpdateDynamicSchedule" => Action::UpdateDynamicSchedule,
"UpdateFirmware" => Action::UpdateFirmware,
"UsePriorityCharging" => Action::UsePriorityCharging,
"VatNumberValidation" => Action::VatNumberValidation,
_ => return None,
})
}
#[must_use]
pub const fn kind(self) -> MessageKind {
match self {
Action::NotifyPeriodicEventStream => MessageKind::Send,
_ => MessageKind::Call,
}
}
#[must_use]
pub const fn origin(self) -> Origin {
match self {
Action::AFRRSignal => Origin::Csms,
Action::AdjustPeriodicEventStream => Origin::Csms,
Action::Authorize => Origin::ChargingStation,
Action::BatterySwap => Origin::ChargingStation,
Action::BootNotification => Origin::ChargingStation,
Action::CancelReservation => Origin::Csms,
Action::CertificateSigned => Origin::Csms,
Action::ChangeAvailability => Origin::Csms,
Action::ChangeTransactionTariff => Origin::Csms,
Action::ClearCache => Origin::Csms,
Action::ClearChargingProfile => Origin::Csms,
Action::ClearDERControl => Origin::Csms,
Action::ClearDisplayMessage => Origin::Csms,
Action::ClearTariffs => Origin::Csms,
Action::ClearVariableMonitoring => Origin::Csms,
Action::ClearedChargingLimit => Origin::ChargingStation,
Action::ClosePeriodicEventStream => Origin::ChargingStation,
Action::CostUpdated => Origin::Csms,
Action::CustomerInformation => Origin::Csms,
Action::DataTransfer => Origin::Both,
Action::DeleteCertificate => Origin::Csms,
Action::FirmwareStatusNotification => Origin::ChargingStation,
Action::Get15118EVCertificate => Origin::ChargingStation,
Action::GetBaseReport => Origin::Csms,
Action::GetCertificateChainStatus => Origin::ChargingStation,
Action::GetCertificateStatus => Origin::ChargingStation,
Action::GetChargingProfiles => Origin::Csms,
Action::GetCompositeSchedule => Origin::Csms,
Action::GetDERControl => Origin::Csms,
Action::GetDisplayMessages => Origin::Csms,
Action::GetInstalledCertificateIds => Origin::Csms,
Action::GetLocalListVersion => Origin::Csms,
Action::GetLog => Origin::Csms,
Action::GetMonitoringReport => Origin::Csms,
Action::GetPeriodicEventStream => Origin::Csms,
Action::GetReport => Origin::Csms,
Action::GetTariffs => Origin::Csms,
Action::GetTransactionStatus => Origin::Csms,
Action::GetVariables => Origin::Csms,
Action::Heartbeat => Origin::ChargingStation,
Action::InstallCertificate => Origin::Csms,
Action::LogStatusNotification => Origin::ChargingStation,
Action::MeterValues => Origin::ChargingStation,
Action::NotifyAllowedEnergyTransfer => Origin::Csms,
Action::NotifyChargingLimit => Origin::ChargingStation,
Action::NotifyCustomerInformation => Origin::ChargingStation,
Action::NotifyDERAlarm => Origin::ChargingStation,
Action::NotifyDERStartStop => Origin::ChargingStation,
Action::NotifyDisplayMessages => Origin::ChargingStation,
Action::NotifyEVChargingNeeds => Origin::ChargingStation,
Action::NotifyEVChargingSchedule => Origin::ChargingStation,
Action::NotifyEvent => Origin::ChargingStation,
Action::NotifyMonitoringReport => Origin::ChargingStation,
Action::NotifyPeriodicEventStream => Origin::ChargingStation,
Action::NotifyPriorityCharging => Origin::ChargingStation,
Action::NotifyReport => Origin::ChargingStation,
Action::NotifySettlement => Origin::ChargingStation,
Action::NotifyWebPaymentStarted => Origin::Csms,
Action::OpenPeriodicEventStream => Origin::ChargingStation,
Action::PublishFirmware => Origin::Csms,
Action::PublishFirmwareStatusNotification => Origin::ChargingStation,
Action::PullDynamicScheduleUpdate => Origin::ChargingStation,
Action::ReportChargingProfiles => Origin::ChargingStation,
Action::ReportDERControl => Origin::ChargingStation,
Action::RequestBatterySwap => Origin::Csms,
Action::RequestStartTransaction => Origin::Csms,
Action::RequestStopTransaction => Origin::Csms,
Action::ReservationStatusUpdate => Origin::ChargingStation,
Action::ReserveNow => Origin::Csms,
Action::Reset => Origin::Csms,
Action::SecurityEventNotification => Origin::ChargingStation,
Action::SendLocalList => Origin::Csms,
Action::SetChargingProfile => Origin::Csms,
Action::SetDERControl => Origin::Csms,
Action::SetDefaultTariff => Origin::Csms,
Action::SetDisplayMessage => Origin::Csms,
Action::SetMonitoringBase => Origin::Csms,
Action::SetMonitoringLevel => Origin::Csms,
Action::SetNetworkProfile => Origin::Csms,
Action::SetVariableMonitoring => Origin::Csms,
Action::SetVariables => Origin::Csms,
Action::SignCertificate => Origin::ChargingStation,
Action::StatusNotification => Origin::ChargingStation,
Action::TransactionEvent => Origin::ChargingStation,
Action::TriggerMessage => Origin::Csms,
Action::UnlockConnector => Origin::Csms,
Action::UnpublishFirmware => Origin::Csms,
Action::UpdateDynamicSchedule => Origin::Csms,
Action::UpdateFirmware => Origin::Csms,
Action::UsePriorityCharging => Origin::Csms,
Action::VatNumberValidation => Origin::ChargingStation,
}
}
#[must_use]
pub const fn block(self) -> &'static str {
match self {
Action::AFRRSignal => "Q",
Action::AdjustPeriodicEventStream => "N",
Action::Authorize => "C",
Action::BatterySwap => "S",
Action::BootNotification => "B",
Action::CancelReservation => "H",
Action::CertificateSigned => "A",
Action::ChangeAvailability => "G",
Action::ChangeTransactionTariff => "I",
Action::ClearCache => "C",
Action::ClearChargingProfile => "K",
Action::ClearDERControl => "R",
Action::ClearDisplayMessage => "O",
Action::ClearTariffs => "I",
Action::ClearVariableMonitoring => "N",
Action::ClearedChargingLimit => "K",
Action::ClosePeriodicEventStream => "N",
Action::CostUpdated => "I",
Action::CustomerInformation => "N",
Action::DataTransfer => "P",
Action::DeleteCertificate => "M",
Action::FirmwareStatusNotification => "L",
Action::Get15118EVCertificate => "M",
Action::GetBaseReport => "B",
Action::GetCertificateChainStatus => "M",
Action::GetCertificateStatus => "M",
Action::GetChargingProfiles => "K",
Action::GetCompositeSchedule => "K",
Action::GetDERControl => "R",
Action::GetDisplayMessages => "O",
Action::GetInstalledCertificateIds => "M",
Action::GetLocalListVersion => "D",
Action::GetLog => "N",
Action::GetMonitoringReport => "N",
Action::GetPeriodicEventStream => "N",
Action::GetReport => "B",
Action::GetTariffs => "I",
Action::GetTransactionStatus => "E",
Action::GetVariables => "B",
Action::Heartbeat => "G",
Action::InstallCertificate => "M",
Action::LogStatusNotification => "N",
Action::MeterValues => "J",
Action::NotifyAllowedEnergyTransfer => "Q",
Action::NotifyChargingLimit => "K",
Action::NotifyCustomerInformation => "N",
Action::NotifyDERAlarm => "R",
Action::NotifyDERStartStop => "R",
Action::NotifyDisplayMessages => "O",
Action::NotifyEVChargingNeeds => "K",
Action::NotifyEVChargingSchedule => "K",
Action::NotifyEvent => "N",
Action::NotifyMonitoringReport => "N",
Action::NotifyPeriodicEventStream => "N",
Action::NotifyPriorityCharging => "K",
Action::NotifyReport => "B",
Action::NotifySettlement => "C",
Action::NotifyWebPaymentStarted => "C",
Action::OpenPeriodicEventStream => "N",
Action::PublishFirmware => "L",
Action::PublishFirmwareStatusNotification => "L",
Action::PullDynamicScheduleUpdate => "K",
Action::ReportChargingProfiles => "K",
Action::ReportDERControl => "R",
Action::RequestBatterySwap => "S",
Action::RequestStartTransaction => "F",
Action::RequestStopTransaction => "F",
Action::ReservationStatusUpdate => "H",
Action::ReserveNow => "H",
Action::Reset => "B",
Action::SecurityEventNotification => "A",
Action::SendLocalList => "D",
Action::SetChargingProfile => "K",
Action::SetDERControl => "R",
Action::SetDefaultTariff => "I",
Action::SetDisplayMessage => "O",
Action::SetMonitoringBase => "N",
Action::SetMonitoringLevel => "N",
Action::SetNetworkProfile => "B",
Action::SetVariableMonitoring => "N",
Action::SetVariables => "B",
Action::SignCertificate => "A",
Action::StatusNotification => "G",
Action::TransactionEvent => "E",
Action::TriggerMessage => "F",
Action::UnlockConnector => "F",
Action::UnpublishFirmware => "L",
Action::UpdateDynamicSchedule => "K",
Action::UpdateFirmware => "L",
Action::UsePriorityCharging => "K",
Action::VatNumberValidation => "C",
}
}
}
impl crate::message::ActionName for Action {
fn all() -> &'static [Self] {
Self::ALL
}
fn as_str(&self) -> &'static str {
Action::as_str(*self)
}
fn from_wire(name: &str) -> Option<Self> {
Action::from_wire(name)
}
fn kind(&self) -> MessageKind {
Action::kind(*self)
}
fn origin(&self) -> Origin {
Action::origin(*self)
}
fn block(&self) -> &'static str {
Action::block(*self)
}
}
impl core::fmt::Display for Action {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str(self.as_str())
}
}
impl core::str::FromStr for Action {
type Err = crate::message::UnknownAction;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Self::from_wire(s).ok_or(crate::message::UnknownAction)
}
}
impl Serialize for Action {
fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
ser.serialize_str(self.as_str())
}
}
impl<'de> Deserialize<'de> for Action {
fn deserialize<D: serde::Deserializer<'de>>(de: D) -> Result<Self, D::Error> {
let s = <&str as Deserialize>::deserialize(de)?;
Self::from_wire(s).ok_or_else(|| serde::de::Error::custom("unknown OCPP action"))
}
}
impl Action {
#[must_use]
pub const fn has_response(self) -> bool {
matches!(self.kind(), MessageKind::Call)
}
}
pub fn transcode_request(
action: Action,
payload: &RawValue,
options: &DecodeOptions,
) -> Result<alloc::boxed::Box<RawValue>, DecodeError> {
match action {
Action::AFRRSignal => crate::decode::transcode::<AFRRSignalRequest>(payload, options),
Action::AdjustPeriodicEventStream => {
crate::decode::transcode::<AdjustPeriodicEventStreamRequest>(payload, options)
}
Action::Authorize => crate::decode::transcode::<AuthorizeRequest>(payload, options),
Action::BatterySwap => crate::decode::transcode::<BatterySwapRequest>(payload, options),
Action::BootNotification => {
crate::decode::transcode::<BootNotificationRequest>(payload, options)
}
Action::CancelReservation => {
crate::decode::transcode::<CancelReservationRequest>(payload, options)
}
Action::CertificateSigned => {
crate::decode::transcode::<CertificateSignedRequest>(payload, options)
}
Action::ChangeAvailability => {
crate::decode::transcode::<ChangeAvailabilityRequest>(payload, options)
}
Action::ChangeTransactionTariff => {
crate::decode::transcode::<ChangeTransactionTariffRequest>(payload, options)
}
Action::ClearCache => crate::decode::transcode::<ClearCacheRequest>(payload, options),
Action::ClearChargingProfile => {
crate::decode::transcode::<ClearChargingProfileRequest>(payload, options)
}
Action::ClearDERControl => {
crate::decode::transcode::<ClearDERControlRequest>(payload, options)
}
Action::ClearDisplayMessage => {
crate::decode::transcode::<ClearDisplayMessageRequest>(payload, options)
}
Action::ClearTariffs => crate::decode::transcode::<ClearTariffsRequest>(payload, options),
Action::ClearVariableMonitoring => {
crate::decode::transcode::<ClearVariableMonitoringRequest>(payload, options)
}
Action::ClearedChargingLimit => {
crate::decode::transcode::<ClearedChargingLimitRequest>(payload, options)
}
Action::ClosePeriodicEventStream => {
crate::decode::transcode::<ClosePeriodicEventStreamRequest>(payload, options)
}
Action::CostUpdated => crate::decode::transcode::<CostUpdatedRequest>(payload, options),
Action::CustomerInformation => {
crate::decode::transcode::<CustomerInformationRequest>(payload, options)
}
Action::DataTransfer => crate::decode::transcode::<DataTransferRequest>(payload, options),
Action::DeleteCertificate => {
crate::decode::transcode::<DeleteCertificateRequest>(payload, options)
}
Action::FirmwareStatusNotification => {
crate::decode::transcode::<FirmwareStatusNotificationRequest>(payload, options)
}
Action::Get15118EVCertificate => {
crate::decode::transcode::<Get15118EVCertificateRequest>(payload, options)
}
Action::GetBaseReport => crate::decode::transcode::<GetBaseReportRequest>(payload, options),
Action::GetCertificateChainStatus => {
crate::decode::transcode::<GetCertificateChainStatusRequest>(payload, options)
}
Action::GetCertificateStatus => {
crate::decode::transcode::<GetCertificateStatusRequest>(payload, options)
}
Action::GetChargingProfiles => {
crate::decode::transcode::<GetChargingProfilesRequest>(payload, options)
}
Action::GetCompositeSchedule => {
crate::decode::transcode::<GetCompositeScheduleRequest>(payload, options)
}
Action::GetDERControl => crate::decode::transcode::<GetDERControlRequest>(payload, options),
Action::GetDisplayMessages => {
crate::decode::transcode::<GetDisplayMessagesRequest>(payload, options)
}
Action::GetInstalledCertificateIds => {
crate::decode::transcode::<GetInstalledCertificateIdsRequest>(payload, options)
}
Action::GetLocalListVersion => {
crate::decode::transcode::<GetLocalListVersionRequest>(payload, options)
}
Action::GetLog => crate::decode::transcode::<GetLogRequest>(payload, options),
Action::GetMonitoringReport => {
crate::decode::transcode::<GetMonitoringReportRequest>(payload, options)
}
Action::GetPeriodicEventStream => {
crate::decode::transcode::<GetPeriodicEventStreamRequest>(payload, options)
}
Action::GetReport => crate::decode::transcode::<GetReportRequest>(payload, options),
Action::GetTariffs => crate::decode::transcode::<GetTariffsRequest>(payload, options),
Action::GetTransactionStatus => {
crate::decode::transcode::<GetTransactionStatusRequest>(payload, options)
}
Action::GetVariables => crate::decode::transcode::<GetVariablesRequest>(payload, options),
Action::Heartbeat => crate::decode::transcode::<HeartbeatRequest>(payload, options),
Action::InstallCertificate => {
crate::decode::transcode::<InstallCertificateRequest>(payload, options)
}
Action::LogStatusNotification => {
crate::decode::transcode::<LogStatusNotificationRequest>(payload, options)
}
Action::MeterValues => crate::decode::transcode::<MeterValuesRequest>(payload, options),
Action::NotifyAllowedEnergyTransfer => {
crate::decode::transcode::<NotifyAllowedEnergyTransferRequest>(payload, options)
}
Action::NotifyChargingLimit => {
crate::decode::transcode::<NotifyChargingLimitRequest>(payload, options)
}
Action::NotifyCustomerInformation => {
crate::decode::transcode::<NotifyCustomerInformationRequest>(payload, options)
}
Action::NotifyDERAlarm => {
crate::decode::transcode::<NotifyDERAlarmRequest>(payload, options)
}
Action::NotifyDERStartStop => {
crate::decode::transcode::<NotifyDERStartStopRequest>(payload, options)
}
Action::NotifyDisplayMessages => {
crate::decode::transcode::<NotifyDisplayMessagesRequest>(payload, options)
}
Action::NotifyEVChargingNeeds => {
crate::decode::transcode::<NotifyEVChargingNeedsRequest>(payload, options)
}
Action::NotifyEVChargingSchedule => {
crate::decode::transcode::<NotifyEVChargingScheduleRequest>(payload, options)
}
Action::NotifyEvent => crate::decode::transcode::<NotifyEventRequest>(payload, options),
Action::NotifyMonitoringReport => {
crate::decode::transcode::<NotifyMonitoringReportRequest>(payload, options)
}
Action::NotifyPeriodicEventStream => {
crate::decode::transcode::<NotifyPeriodicEventStreamRequest>(payload, options)
}
Action::NotifyPriorityCharging => {
crate::decode::transcode::<NotifyPriorityChargingRequest>(payload, options)
}
Action::NotifyReport => crate::decode::transcode::<NotifyReportRequest>(payload, options),
Action::NotifySettlement => {
crate::decode::transcode::<NotifySettlementRequest>(payload, options)
}
Action::NotifyWebPaymentStarted => {
crate::decode::transcode::<NotifyWebPaymentStartedRequest>(payload, options)
}
Action::OpenPeriodicEventStream => {
crate::decode::transcode::<OpenPeriodicEventStreamRequest>(payload, options)
}
Action::PublishFirmware => {
crate::decode::transcode::<PublishFirmwareRequest>(payload, options)
}
Action::PublishFirmwareStatusNotification => {
crate::decode::transcode::<PublishFirmwareStatusNotificationRequest>(payload, options)
}
Action::PullDynamicScheduleUpdate => {
crate::decode::transcode::<PullDynamicScheduleUpdateRequest>(payload, options)
}
Action::ReportChargingProfiles => {
crate::decode::transcode::<ReportChargingProfilesRequest>(payload, options)
}
Action::ReportDERControl => {
crate::decode::transcode::<ReportDERControlRequest>(payload, options)
}
Action::RequestBatterySwap => {
crate::decode::transcode::<RequestBatterySwapRequest>(payload, options)
}
Action::RequestStartTransaction => {
crate::decode::transcode::<RequestStartTransactionRequest>(payload, options)
}
Action::RequestStopTransaction => {
crate::decode::transcode::<RequestStopTransactionRequest>(payload, options)
}
Action::ReservationStatusUpdate => {
crate::decode::transcode::<ReservationStatusUpdateRequest>(payload, options)
}
Action::ReserveNow => crate::decode::transcode::<ReserveNowRequest>(payload, options),
Action::Reset => crate::decode::transcode::<ResetRequest>(payload, options),
Action::SecurityEventNotification => {
crate::decode::transcode::<SecurityEventNotificationRequest>(payload, options)
}
Action::SendLocalList => crate::decode::transcode::<SendLocalListRequest>(payload, options),
Action::SetChargingProfile => {
crate::decode::transcode::<SetChargingProfileRequest>(payload, options)
}
Action::SetDERControl => crate::decode::transcode::<SetDERControlRequest>(payload, options),
Action::SetDefaultTariff => {
crate::decode::transcode::<SetDefaultTariffRequest>(payload, options)
}
Action::SetDisplayMessage => {
crate::decode::transcode::<SetDisplayMessageRequest>(payload, options)
}
Action::SetMonitoringBase => {
crate::decode::transcode::<SetMonitoringBaseRequest>(payload, options)
}
Action::SetMonitoringLevel => {
crate::decode::transcode::<SetMonitoringLevelRequest>(payload, options)
}
Action::SetNetworkProfile => {
crate::decode::transcode::<SetNetworkProfileRequest>(payload, options)
}
Action::SetVariableMonitoring => {
crate::decode::transcode::<SetVariableMonitoringRequest>(payload, options)
}
Action::SetVariables => crate::decode::transcode::<SetVariablesRequest>(payload, options),
Action::SignCertificate => {
crate::decode::transcode::<SignCertificateRequest>(payload, options)
}
Action::StatusNotification => {
crate::decode::transcode::<StatusNotificationRequest>(payload, options)
}
Action::TransactionEvent => {
crate::decode::transcode::<TransactionEventRequest>(payload, options)
}
Action::TriggerMessage => {
crate::decode::transcode::<TriggerMessageRequest>(payload, options)
}
Action::UnlockConnector => {
crate::decode::transcode::<UnlockConnectorRequest>(payload, options)
}
Action::UnpublishFirmware => {
crate::decode::transcode::<UnpublishFirmwareRequest>(payload, options)
}
Action::UpdateDynamicSchedule => {
crate::decode::transcode::<UpdateDynamicScheduleRequest>(payload, options)
}
Action::UpdateFirmware => {
crate::decode::transcode::<UpdateFirmwareRequest>(payload, options)
}
Action::UsePriorityCharging => {
crate::decode::transcode::<UsePriorityChargingRequest>(payload, options)
}
Action::VatNumberValidation => {
crate::decode::transcode::<VatNumberValidationRequest>(payload, options)
}
}
}
pub fn transcode_response(
action: Action,
payload: &RawValue,
options: &DecodeOptions,
) -> Result<alloc::boxed::Box<RawValue>, DecodeError> {
match action {
Action::AFRRSignal => crate::decode::transcode::<AFRRSignalResponse>(payload, options),
Action::AdjustPeriodicEventStream => {
crate::decode::transcode::<AdjustPeriodicEventStreamResponse>(payload, options)
}
Action::Authorize => crate::decode::transcode::<AuthorizeResponse>(payload, options),
Action::BatterySwap => crate::decode::transcode::<BatterySwapResponse>(payload, options),
Action::BootNotification => {
crate::decode::transcode::<BootNotificationResponse>(payload, options)
}
Action::CancelReservation => {
crate::decode::transcode::<CancelReservationResponse>(payload, options)
}
Action::CertificateSigned => {
crate::decode::transcode::<CertificateSignedResponse>(payload, options)
}
Action::ChangeAvailability => {
crate::decode::transcode::<ChangeAvailabilityResponse>(payload, options)
}
Action::ChangeTransactionTariff => {
crate::decode::transcode::<ChangeTransactionTariffResponse>(payload, options)
}
Action::ClearCache => crate::decode::transcode::<ClearCacheResponse>(payload, options),
Action::ClearChargingProfile => {
crate::decode::transcode::<ClearChargingProfileResponse>(payload, options)
}
Action::ClearDERControl => {
crate::decode::transcode::<ClearDERControlResponse>(payload, options)
}
Action::ClearDisplayMessage => {
crate::decode::transcode::<ClearDisplayMessageResponse>(payload, options)
}
Action::ClearTariffs => crate::decode::transcode::<ClearTariffsResponse>(payload, options),
Action::ClearVariableMonitoring => {
crate::decode::transcode::<ClearVariableMonitoringResponse>(payload, options)
}
Action::ClearedChargingLimit => {
crate::decode::transcode::<ClearedChargingLimitResponse>(payload, options)
}
Action::ClosePeriodicEventStream => {
crate::decode::transcode::<ClosePeriodicEventStreamResponse>(payload, options)
}
Action::CostUpdated => crate::decode::transcode::<CostUpdatedResponse>(payload, options),
Action::CustomerInformation => {
crate::decode::transcode::<CustomerInformationResponse>(payload, options)
}
Action::DataTransfer => crate::decode::transcode::<DataTransferResponse>(payload, options),
Action::DeleteCertificate => {
crate::decode::transcode::<DeleteCertificateResponse>(payload, options)
}
Action::FirmwareStatusNotification => {
crate::decode::transcode::<FirmwareStatusNotificationResponse>(payload, options)
}
Action::Get15118EVCertificate => {
crate::decode::transcode::<Get15118EVCertificateResponse>(payload, options)
}
Action::GetBaseReport => {
crate::decode::transcode::<GetBaseReportResponse>(payload, options)
}
Action::GetCertificateChainStatus => {
crate::decode::transcode::<GetCertificateChainStatusResponse>(payload, options)
}
Action::GetCertificateStatus => {
crate::decode::transcode::<GetCertificateStatusResponse>(payload, options)
}
Action::GetChargingProfiles => {
crate::decode::transcode::<GetChargingProfilesResponse>(payload, options)
}
Action::GetCompositeSchedule => {
crate::decode::transcode::<GetCompositeScheduleResponse>(payload, options)
}
Action::GetDERControl => {
crate::decode::transcode::<GetDERControlResponse>(payload, options)
}
Action::GetDisplayMessages => {
crate::decode::transcode::<GetDisplayMessagesResponse>(payload, options)
}
Action::GetInstalledCertificateIds => {
crate::decode::transcode::<GetInstalledCertificateIdsResponse>(payload, options)
}
Action::GetLocalListVersion => {
crate::decode::transcode::<GetLocalListVersionResponse>(payload, options)
}
Action::GetLog => crate::decode::transcode::<GetLogResponse>(payload, options),
Action::GetMonitoringReport => {
crate::decode::transcode::<GetMonitoringReportResponse>(payload, options)
}
Action::GetPeriodicEventStream => {
crate::decode::transcode::<GetPeriodicEventStreamResponse>(payload, options)
}
Action::GetReport => crate::decode::transcode::<GetReportResponse>(payload, options),
Action::GetTariffs => crate::decode::transcode::<GetTariffsResponse>(payload, options),
Action::GetTransactionStatus => {
crate::decode::transcode::<GetTransactionStatusResponse>(payload, options)
}
Action::GetVariables => crate::decode::transcode::<GetVariablesResponse>(payload, options),
Action::Heartbeat => crate::decode::transcode::<HeartbeatResponse>(payload, options),
Action::InstallCertificate => {
crate::decode::transcode::<InstallCertificateResponse>(payload, options)
}
Action::LogStatusNotification => {
crate::decode::transcode::<LogStatusNotificationResponse>(payload, options)
}
Action::MeterValues => crate::decode::transcode::<MeterValuesResponse>(payload, options),
Action::NotifyAllowedEnergyTransfer => {
crate::decode::transcode::<NotifyAllowedEnergyTransferResponse>(payload, options)
}
Action::NotifyChargingLimit => {
crate::decode::transcode::<NotifyChargingLimitResponse>(payload, options)
}
Action::NotifyCustomerInformation => {
crate::decode::transcode::<NotifyCustomerInformationResponse>(payload, options)
}
Action::NotifyDERAlarm => {
crate::decode::transcode::<NotifyDERAlarmResponse>(payload, options)
}
Action::NotifyDERStartStop => {
crate::decode::transcode::<NotifyDERStartStopResponse>(payload, options)
}
Action::NotifyDisplayMessages => {
crate::decode::transcode::<NotifyDisplayMessagesResponse>(payload, options)
}
Action::NotifyEVChargingNeeds => {
crate::decode::transcode::<NotifyEVChargingNeedsResponse>(payload, options)
}
Action::NotifyEVChargingSchedule => {
crate::decode::transcode::<NotifyEVChargingScheduleResponse>(payload, options)
}
Action::NotifyEvent => crate::decode::transcode::<NotifyEventResponse>(payload, options),
Action::NotifyMonitoringReport => {
crate::decode::transcode::<NotifyMonitoringReportResponse>(payload, options)
}
Action::NotifyPeriodicEventStream => {
Err(DecodeError::unsupported_action("NotifyPeriodicEventStream"))
}
Action::NotifyPriorityCharging => {
crate::decode::transcode::<NotifyPriorityChargingResponse>(payload, options)
}
Action::NotifyReport => crate::decode::transcode::<NotifyReportResponse>(payload, options),
Action::NotifySettlement => {
crate::decode::transcode::<NotifySettlementResponse>(payload, options)
}
Action::NotifyWebPaymentStarted => {
crate::decode::transcode::<NotifyWebPaymentStartedResponse>(payload, options)
}
Action::OpenPeriodicEventStream => {
crate::decode::transcode::<OpenPeriodicEventStreamResponse>(payload, options)
}
Action::PublishFirmware => {
crate::decode::transcode::<PublishFirmwareResponse>(payload, options)
}
Action::PublishFirmwareStatusNotification => {
crate::decode::transcode::<PublishFirmwareStatusNotificationResponse>(payload, options)
}
Action::PullDynamicScheduleUpdate => {
crate::decode::transcode::<PullDynamicScheduleUpdateResponse>(payload, options)
}
Action::ReportChargingProfiles => {
crate::decode::transcode::<ReportChargingProfilesResponse>(payload, options)
}
Action::ReportDERControl => {
crate::decode::transcode::<ReportDERControlResponse>(payload, options)
}
Action::RequestBatterySwap => {
crate::decode::transcode::<RequestBatterySwapResponse>(payload, options)
}
Action::RequestStartTransaction => {
crate::decode::transcode::<RequestStartTransactionResponse>(payload, options)
}
Action::RequestStopTransaction => {
crate::decode::transcode::<RequestStopTransactionResponse>(payload, options)
}
Action::ReservationStatusUpdate => {
crate::decode::transcode::<ReservationStatusUpdateResponse>(payload, options)
}
Action::ReserveNow => crate::decode::transcode::<ReserveNowResponse>(payload, options),
Action::Reset => crate::decode::transcode::<ResetResponse>(payload, options),
Action::SecurityEventNotification => {
crate::decode::transcode::<SecurityEventNotificationResponse>(payload, options)
}
Action::SendLocalList => {
crate::decode::transcode::<SendLocalListResponse>(payload, options)
}
Action::SetChargingProfile => {
crate::decode::transcode::<SetChargingProfileResponse>(payload, options)
}
Action::SetDERControl => {
crate::decode::transcode::<SetDERControlResponse>(payload, options)
}
Action::SetDefaultTariff => {
crate::decode::transcode::<SetDefaultTariffResponse>(payload, options)
}
Action::SetDisplayMessage => {
crate::decode::transcode::<SetDisplayMessageResponse>(payload, options)
}
Action::SetMonitoringBase => {
crate::decode::transcode::<SetMonitoringBaseResponse>(payload, options)
}
Action::SetMonitoringLevel => {
crate::decode::transcode::<SetMonitoringLevelResponse>(payload, options)
}
Action::SetNetworkProfile => {
crate::decode::transcode::<SetNetworkProfileResponse>(payload, options)
}
Action::SetVariableMonitoring => {
crate::decode::transcode::<SetVariableMonitoringResponse>(payload, options)
}
Action::SetVariables => crate::decode::transcode::<SetVariablesResponse>(payload, options),
Action::SignCertificate => {
crate::decode::transcode::<SignCertificateResponse>(payload, options)
}
Action::StatusNotification => {
crate::decode::transcode::<StatusNotificationResponse>(payload, options)
}
Action::TransactionEvent => {
crate::decode::transcode::<TransactionEventResponse>(payload, options)
}
Action::TriggerMessage => {
crate::decode::transcode::<TriggerMessageResponse>(payload, options)
}
Action::UnlockConnector => {
crate::decode::transcode::<UnlockConnectorResponse>(payload, options)
}
Action::UnpublishFirmware => {
crate::decode::transcode::<UnpublishFirmwareResponse>(payload, options)
}
Action::UpdateDynamicSchedule => {
crate::decode::transcode::<UpdateDynamicScheduleResponse>(payload, options)
}
Action::UpdateFirmware => {
crate::decode::transcode::<UpdateFirmwareResponse>(payload, options)
}
Action::UsePriorityCharging => {
crate::decode::transcode::<UsePriorityChargingResponse>(payload, options)
}
Action::VatNumberValidation => {
crate::decode::transcode::<VatNumberValidationResponse>(payload, options)
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
#[allow(clippy::large_enum_variant)]
pub enum CsRequest {
Authorize(AuthorizeRequest),
BatterySwap(BatterySwapRequest),
BootNotification(BootNotificationRequest),
ClearedChargingLimit(ClearedChargingLimitRequest),
ClosePeriodicEventStream(ClosePeriodicEventStreamRequest),
DataTransfer(DataTransferRequest),
FirmwareStatusNotification(FirmwareStatusNotificationRequest),
Get15118EVCertificate(Get15118EVCertificateRequest),
GetCertificateChainStatus(GetCertificateChainStatusRequest),
GetCertificateStatus(GetCertificateStatusRequest),
Heartbeat(HeartbeatRequest),
LogStatusNotification(LogStatusNotificationRequest),
MeterValues(MeterValuesRequest),
NotifyChargingLimit(NotifyChargingLimitRequest),
NotifyCustomerInformation(NotifyCustomerInformationRequest),
NotifyDERAlarm(NotifyDERAlarmRequest),
NotifyDERStartStop(NotifyDERStartStopRequest),
NotifyDisplayMessages(NotifyDisplayMessagesRequest),
NotifyEVChargingNeeds(NotifyEVChargingNeedsRequest),
NotifyEVChargingSchedule(NotifyEVChargingScheduleRequest),
NotifyEvent(NotifyEventRequest),
NotifyMonitoringReport(NotifyMonitoringReportRequest),
NotifyPeriodicEventStream(NotifyPeriodicEventStreamRequest),
NotifyPriorityCharging(NotifyPriorityChargingRequest),
NotifyReport(NotifyReportRequest),
NotifySettlement(NotifySettlementRequest),
OpenPeriodicEventStream(OpenPeriodicEventStreamRequest),
PublishFirmwareStatusNotification(PublishFirmwareStatusNotificationRequest),
PullDynamicScheduleUpdate(PullDynamicScheduleUpdateRequest),
ReportChargingProfiles(ReportChargingProfilesRequest),
ReportDERControl(ReportDERControlRequest),
ReservationStatusUpdate(ReservationStatusUpdateRequest),
SecurityEventNotification(SecurityEventNotificationRequest),
SignCertificate(SignCertificateRequest),
StatusNotification(StatusNotificationRequest),
TransactionEvent(TransactionEventRequest),
VatNumberValidation(VatNumberValidationRequest),
}
impl CsRequest {
#[must_use]
pub const fn action(&self) -> Action {
match self {
Self::Authorize(_) => Action::Authorize,
Self::BatterySwap(_) => Action::BatterySwap,
Self::BootNotification(_) => Action::BootNotification,
Self::ClearedChargingLimit(_) => Action::ClearedChargingLimit,
Self::ClosePeriodicEventStream(_) => Action::ClosePeriodicEventStream,
Self::DataTransfer(_) => Action::DataTransfer,
Self::FirmwareStatusNotification(_) => Action::FirmwareStatusNotification,
Self::Get15118EVCertificate(_) => Action::Get15118EVCertificate,
Self::GetCertificateChainStatus(_) => Action::GetCertificateChainStatus,
Self::GetCertificateStatus(_) => Action::GetCertificateStatus,
Self::Heartbeat(_) => Action::Heartbeat,
Self::LogStatusNotification(_) => Action::LogStatusNotification,
Self::MeterValues(_) => Action::MeterValues,
Self::NotifyChargingLimit(_) => Action::NotifyChargingLimit,
Self::NotifyCustomerInformation(_) => Action::NotifyCustomerInformation,
Self::NotifyDERAlarm(_) => Action::NotifyDERAlarm,
Self::NotifyDERStartStop(_) => Action::NotifyDERStartStop,
Self::NotifyDisplayMessages(_) => Action::NotifyDisplayMessages,
Self::NotifyEVChargingNeeds(_) => Action::NotifyEVChargingNeeds,
Self::NotifyEVChargingSchedule(_) => Action::NotifyEVChargingSchedule,
Self::NotifyEvent(_) => Action::NotifyEvent,
Self::NotifyMonitoringReport(_) => Action::NotifyMonitoringReport,
Self::NotifyPeriodicEventStream(_) => Action::NotifyPeriodicEventStream,
Self::NotifyPriorityCharging(_) => Action::NotifyPriorityCharging,
Self::NotifyReport(_) => Action::NotifyReport,
Self::NotifySettlement(_) => Action::NotifySettlement,
Self::OpenPeriodicEventStream(_) => Action::OpenPeriodicEventStream,
Self::PublishFirmwareStatusNotification(_) => Action::PublishFirmwareStatusNotification,
Self::PullDynamicScheduleUpdate(_) => Action::PullDynamicScheduleUpdate,
Self::ReportChargingProfiles(_) => Action::ReportChargingProfiles,
Self::ReportDERControl(_) => Action::ReportDERControl,
Self::ReservationStatusUpdate(_) => Action::ReservationStatusUpdate,
Self::SecurityEventNotification(_) => Action::SecurityEventNotification,
Self::SignCertificate(_) => Action::SignCertificate,
Self::StatusNotification(_) => Action::StatusNotification,
Self::TransactionEvent(_) => Action::TransactionEvent,
Self::VatNumberValidation(_) => Action::VatNumberValidation,
}
}
pub fn decode(
action: Action,
payload: &RawValue,
options: &DecodeOptions,
) -> Result<Self, DecodeError> {
Ok(match action {
Action::Authorize => Self::Authorize(
crate::decode::decode_payload::<AuthorizeRequest>(payload, options)?,
),
Action::BatterySwap => Self::BatterySwap(crate::decode::decode_payload::<
BatterySwapRequest,
>(payload, options)?),
Action::BootNotification => Self::BootNotification(crate::decode::decode_payload::<
BootNotificationRequest,
>(payload, options)?),
Action::ClearedChargingLimit => {
Self::ClearedChargingLimit(crate::decode::decode_payload::<
ClearedChargingLimitRequest,
>(payload, options)?)
}
Action::ClosePeriodicEventStream => {
Self::ClosePeriodicEventStream(crate::decode::decode_payload::<
ClosePeriodicEventStreamRequest,
>(payload, options)?)
}
Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
DataTransferRequest,
>(payload, options)?),
Action::FirmwareStatusNotification => {
Self::FirmwareStatusNotification(crate::decode::decode_payload::<
FirmwareStatusNotificationRequest,
>(payload, options)?)
}
Action::Get15118EVCertificate => {
Self::Get15118EVCertificate(crate::decode::decode_payload::<
Get15118EVCertificateRequest,
>(payload, options)?)
}
Action::GetCertificateChainStatus => {
Self::GetCertificateChainStatus(crate::decode::decode_payload::<
GetCertificateChainStatusRequest,
>(payload, options)?)
}
Action::GetCertificateStatus => {
Self::GetCertificateStatus(crate::decode::decode_payload::<
GetCertificateStatusRequest,
>(payload, options)?)
}
Action::Heartbeat => Self::Heartbeat(
crate::decode::decode_payload::<HeartbeatRequest>(payload, options)?,
),
Action::LogStatusNotification => {
Self::LogStatusNotification(crate::decode::decode_payload::<
LogStatusNotificationRequest,
>(payload, options)?)
}
Action::MeterValues => Self::MeterValues(crate::decode::decode_payload::<
MeterValuesRequest,
>(payload, options)?),
Action::NotifyChargingLimit => {
Self::NotifyChargingLimit(crate::decode::decode_payload::<
NotifyChargingLimitRequest,
>(payload, options)?)
}
Action::NotifyCustomerInformation => {
Self::NotifyCustomerInformation(crate::decode::decode_payload::<
NotifyCustomerInformationRequest,
>(payload, options)?)
}
Action::NotifyDERAlarm => Self::NotifyDERAlarm(crate::decode::decode_payload::<
NotifyDERAlarmRequest,
>(payload, options)?),
Action::NotifyDERStartStop => Self::NotifyDERStartStop(
crate::decode::decode_payload::<NotifyDERStartStopRequest>(payload, options)?,
),
Action::NotifyDisplayMessages => {
Self::NotifyDisplayMessages(crate::decode::decode_payload::<
NotifyDisplayMessagesRequest,
>(payload, options)?)
}
Action::NotifyEVChargingNeeds => {
Self::NotifyEVChargingNeeds(crate::decode::decode_payload::<
NotifyEVChargingNeedsRequest,
>(payload, options)?)
}
Action::NotifyEVChargingSchedule => {
Self::NotifyEVChargingSchedule(crate::decode::decode_payload::<
NotifyEVChargingScheduleRequest,
>(payload, options)?)
}
Action::NotifyEvent => Self::NotifyEvent(crate::decode::decode_payload::<
NotifyEventRequest,
>(payload, options)?),
Action::NotifyMonitoringReport => {
Self::NotifyMonitoringReport(crate::decode::decode_payload::<
NotifyMonitoringReportRequest,
>(payload, options)?)
}
Action::NotifyPeriodicEventStream => {
Self::NotifyPeriodicEventStream(crate::decode::decode_payload::<
NotifyPeriodicEventStreamRequest,
>(payload, options)?)
}
Action::NotifyPriorityCharging => {
Self::NotifyPriorityCharging(crate::decode::decode_payload::<
NotifyPriorityChargingRequest,
>(payload, options)?)
}
Action::NotifyReport => Self::NotifyReport(crate::decode::decode_payload::<
NotifyReportRequest,
>(payload, options)?),
Action::NotifySettlement => Self::NotifySettlement(crate::decode::decode_payload::<
NotifySettlementRequest,
>(payload, options)?),
Action::OpenPeriodicEventStream => {
Self::OpenPeriodicEventStream(crate::decode::decode_payload::<
OpenPeriodicEventStreamRequest,
>(payload, options)?)
}
Action::PublishFirmwareStatusNotification => {
Self::PublishFirmwareStatusNotification(crate::decode::decode_payload::<
PublishFirmwareStatusNotificationRequest,
>(payload, options)?)
}
Action::PullDynamicScheduleUpdate => {
Self::PullDynamicScheduleUpdate(crate::decode::decode_payload::<
PullDynamicScheduleUpdateRequest,
>(payload, options)?)
}
Action::ReportChargingProfiles => {
Self::ReportChargingProfiles(crate::decode::decode_payload::<
ReportChargingProfilesRequest,
>(payload, options)?)
}
Action::ReportDERControl => Self::ReportDERControl(crate::decode::decode_payload::<
ReportDERControlRequest,
>(payload, options)?),
Action::ReservationStatusUpdate => {
Self::ReservationStatusUpdate(crate::decode::decode_payload::<
ReservationStatusUpdateRequest,
>(payload, options)?)
}
Action::SecurityEventNotification => {
Self::SecurityEventNotification(crate::decode::decode_payload::<
SecurityEventNotificationRequest,
>(payload, options)?)
}
Action::SignCertificate => Self::SignCertificate(crate::decode::decode_payload::<
SignCertificateRequest,
>(payload, options)?),
Action::StatusNotification => Self::StatusNotification(
crate::decode::decode_payload::<StatusNotificationRequest>(payload, options)?,
),
Action::TransactionEvent => Self::TransactionEvent(crate::decode::decode_payload::<
TransactionEventRequest,
>(payload, options)?),
Action::VatNumberValidation => {
Self::VatNumberValidation(crate::decode::decode_payload::<
VatNumberValidationRequest,
>(payload, options)?)
}
other => return Err(DecodeError::unsupported_action(other.as_str())),
})
}
pub fn decode_reporting(
action: Action,
payload: &RawValue,
options: &DecodeOptions,
) -> Result<crate::decode::Decoded<Self>, DecodeError> {
Ok(match action {
Action::Authorize => {
crate::decode::decode_payload_reporting::<AuthorizeRequest>(payload, options)?
.map(Self::Authorize)
}
Action::BatterySwap => {
crate::decode::decode_payload_reporting::<BatterySwapRequest>(payload, options)?
.map(Self::BatterySwap)
}
Action::BootNotification => crate::decode::decode_payload_reporting::<
BootNotificationRequest,
>(payload, options)?
.map(Self::BootNotification),
Action::ClearedChargingLimit => crate::decode::decode_payload_reporting::<
ClearedChargingLimitRequest,
>(payload, options)?
.map(Self::ClearedChargingLimit),
Action::ClosePeriodicEventStream => crate::decode::decode_payload_reporting::<
ClosePeriodicEventStreamRequest,
>(payload, options)?
.map(Self::ClosePeriodicEventStream),
Action::DataTransfer => {
crate::decode::decode_payload_reporting::<DataTransferRequest>(payload, options)?
.map(Self::DataTransfer)
}
Action::FirmwareStatusNotification => crate::decode::decode_payload_reporting::<
FirmwareStatusNotificationRequest,
>(payload, options)?
.map(Self::FirmwareStatusNotification),
Action::Get15118EVCertificate => crate::decode::decode_payload_reporting::<
Get15118EVCertificateRequest,
>(payload, options)?
.map(Self::Get15118EVCertificate),
Action::GetCertificateChainStatus => crate::decode::decode_payload_reporting::<
GetCertificateChainStatusRequest,
>(payload, options)?
.map(Self::GetCertificateChainStatus),
Action::GetCertificateStatus => crate::decode::decode_payload_reporting::<
GetCertificateStatusRequest,
>(payload, options)?
.map(Self::GetCertificateStatus),
Action::Heartbeat => {
crate::decode::decode_payload_reporting::<HeartbeatRequest>(payload, options)?
.map(Self::Heartbeat)
}
Action::LogStatusNotification => crate::decode::decode_payload_reporting::<
LogStatusNotificationRequest,
>(payload, options)?
.map(Self::LogStatusNotification),
Action::MeterValues => {
crate::decode::decode_payload_reporting::<MeterValuesRequest>(payload, options)?
.map(Self::MeterValues)
}
Action::NotifyChargingLimit => crate::decode::decode_payload_reporting::<
NotifyChargingLimitRequest,
>(payload, options)?
.map(Self::NotifyChargingLimit),
Action::NotifyCustomerInformation => crate::decode::decode_payload_reporting::<
NotifyCustomerInformationRequest,
>(payload, options)?
.map(Self::NotifyCustomerInformation),
Action::NotifyDERAlarm => {
crate::decode::decode_payload_reporting::<NotifyDERAlarmRequest>(payload, options)?
.map(Self::NotifyDERAlarm)
}
Action::NotifyDERStartStop => crate::decode::decode_payload_reporting::<
NotifyDERStartStopRequest,
>(payload, options)?
.map(Self::NotifyDERStartStop),
Action::NotifyDisplayMessages => crate::decode::decode_payload_reporting::<
NotifyDisplayMessagesRequest,
>(payload, options)?
.map(Self::NotifyDisplayMessages),
Action::NotifyEVChargingNeeds => crate::decode::decode_payload_reporting::<
NotifyEVChargingNeedsRequest,
>(payload, options)?
.map(Self::NotifyEVChargingNeeds),
Action::NotifyEVChargingSchedule => crate::decode::decode_payload_reporting::<
NotifyEVChargingScheduleRequest,
>(payload, options)?
.map(Self::NotifyEVChargingSchedule),
Action::NotifyEvent => {
crate::decode::decode_payload_reporting::<NotifyEventRequest>(payload, options)?
.map(Self::NotifyEvent)
}
Action::NotifyMonitoringReport => crate::decode::decode_payload_reporting::<
NotifyMonitoringReportRequest,
>(payload, options)?
.map(Self::NotifyMonitoringReport),
Action::NotifyPeriodicEventStream => crate::decode::decode_payload_reporting::<
NotifyPeriodicEventStreamRequest,
>(payload, options)?
.map(Self::NotifyPeriodicEventStream),
Action::NotifyPriorityCharging => crate::decode::decode_payload_reporting::<
NotifyPriorityChargingRequest,
>(payload, options)?
.map(Self::NotifyPriorityCharging),
Action::NotifyReport => {
crate::decode::decode_payload_reporting::<NotifyReportRequest>(payload, options)?
.map(Self::NotifyReport)
}
Action::NotifySettlement => crate::decode::decode_payload_reporting::<
NotifySettlementRequest,
>(payload, options)?
.map(Self::NotifySettlement),
Action::OpenPeriodicEventStream => crate::decode::decode_payload_reporting::<
OpenPeriodicEventStreamRequest,
>(payload, options)?
.map(Self::OpenPeriodicEventStream),
Action::PublishFirmwareStatusNotification => crate::decode::decode_payload_reporting::<
PublishFirmwareStatusNotificationRequest,
>(payload, options)?
.map(Self::PublishFirmwareStatusNotification),
Action::PullDynamicScheduleUpdate => crate::decode::decode_payload_reporting::<
PullDynamicScheduleUpdateRequest,
>(payload, options)?
.map(Self::PullDynamicScheduleUpdate),
Action::ReportChargingProfiles => crate::decode::decode_payload_reporting::<
ReportChargingProfilesRequest,
>(payload, options)?
.map(Self::ReportChargingProfiles),
Action::ReportDERControl => crate::decode::decode_payload_reporting::<
ReportDERControlRequest,
>(payload, options)?
.map(Self::ReportDERControl),
Action::ReservationStatusUpdate => crate::decode::decode_payload_reporting::<
ReservationStatusUpdateRequest,
>(payload, options)?
.map(Self::ReservationStatusUpdate),
Action::SecurityEventNotification => crate::decode::decode_payload_reporting::<
SecurityEventNotificationRequest,
>(payload, options)?
.map(Self::SecurityEventNotification),
Action::SignCertificate => {
crate::decode::decode_payload_reporting::<SignCertificateRequest>(payload, options)?
.map(Self::SignCertificate)
}
Action::StatusNotification => crate::decode::decode_payload_reporting::<
StatusNotificationRequest,
>(payload, options)?
.map(Self::StatusNotification),
Action::TransactionEvent => crate::decode::decode_payload_reporting::<
TransactionEventRequest,
>(payload, options)?
.map(Self::TransactionEvent),
Action::VatNumberValidation => crate::decode::decode_payload_reporting::<
VatNumberValidationRequest,
>(payload, options)?
.map(Self::VatNumberValidation),
other => return Err(DecodeError::unsupported_action(other.as_str())),
})
}
pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
match self {
Self::Authorize(p) => serde_json::to_string(p),
Self::BatterySwap(p) => serde_json::to_string(p),
Self::BootNotification(p) => serde_json::to_string(p),
Self::ClearedChargingLimit(p) => serde_json::to_string(p),
Self::ClosePeriodicEventStream(p) => serde_json::to_string(p),
Self::DataTransfer(p) => serde_json::to_string(p),
Self::FirmwareStatusNotification(p) => serde_json::to_string(p),
Self::Get15118EVCertificate(p) => serde_json::to_string(p),
Self::GetCertificateChainStatus(p) => serde_json::to_string(p),
Self::GetCertificateStatus(p) => serde_json::to_string(p),
Self::Heartbeat(p) => serde_json::to_string(p),
Self::LogStatusNotification(p) => serde_json::to_string(p),
Self::MeterValues(p) => serde_json::to_string(p),
Self::NotifyChargingLimit(p) => serde_json::to_string(p),
Self::NotifyCustomerInformation(p) => serde_json::to_string(p),
Self::NotifyDERAlarm(p) => serde_json::to_string(p),
Self::NotifyDERStartStop(p) => serde_json::to_string(p),
Self::NotifyDisplayMessages(p) => serde_json::to_string(p),
Self::NotifyEVChargingNeeds(p) => serde_json::to_string(p),
Self::NotifyEVChargingSchedule(p) => serde_json::to_string(p),
Self::NotifyEvent(p) => serde_json::to_string(p),
Self::NotifyMonitoringReport(p) => serde_json::to_string(p),
Self::NotifyPeriodicEventStream(p) => serde_json::to_string(p),
Self::NotifyPriorityCharging(p) => serde_json::to_string(p),
Self::NotifyReport(p) => serde_json::to_string(p),
Self::NotifySettlement(p) => serde_json::to_string(p),
Self::OpenPeriodicEventStream(p) => serde_json::to_string(p),
Self::PublishFirmwareStatusNotification(p) => serde_json::to_string(p),
Self::PullDynamicScheduleUpdate(p) => serde_json::to_string(p),
Self::ReportChargingProfiles(p) => serde_json::to_string(p),
Self::ReportDERControl(p) => serde_json::to_string(p),
Self::ReservationStatusUpdate(p) => serde_json::to_string(p),
Self::SecurityEventNotification(p) => serde_json::to_string(p),
Self::SignCertificate(p) => serde_json::to_string(p),
Self::StatusNotification(p) => serde_json::to_string(p),
Self::TransactionEvent(p) => serde_json::to_string(p),
Self::VatNumberValidation(p) => serde_json::to_string(p),
}
}
}
impl Validate for CsRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
match self {
Self::Authorize(p) => p.validate_at(path, out),
Self::BatterySwap(p) => p.validate_at(path, out),
Self::BootNotification(p) => p.validate_at(path, out),
Self::ClearedChargingLimit(p) => p.validate_at(path, out),
Self::ClosePeriodicEventStream(p) => p.validate_at(path, out),
Self::DataTransfer(p) => p.validate_at(path, out),
Self::FirmwareStatusNotification(p) => p.validate_at(path, out),
Self::Get15118EVCertificate(p) => p.validate_at(path, out),
Self::GetCertificateChainStatus(p) => p.validate_at(path, out),
Self::GetCertificateStatus(p) => p.validate_at(path, out),
Self::Heartbeat(p) => p.validate_at(path, out),
Self::LogStatusNotification(p) => p.validate_at(path, out),
Self::MeterValues(p) => p.validate_at(path, out),
Self::NotifyChargingLimit(p) => p.validate_at(path, out),
Self::NotifyCustomerInformation(p) => p.validate_at(path, out),
Self::NotifyDERAlarm(p) => p.validate_at(path, out),
Self::NotifyDERStartStop(p) => p.validate_at(path, out),
Self::NotifyDisplayMessages(p) => p.validate_at(path, out),
Self::NotifyEVChargingNeeds(p) => p.validate_at(path, out),
Self::NotifyEVChargingSchedule(p) => p.validate_at(path, out),
Self::NotifyEvent(p) => p.validate_at(path, out),
Self::NotifyMonitoringReport(p) => p.validate_at(path, out),
Self::NotifyPeriodicEventStream(p) => p.validate_at(path, out),
Self::NotifyPriorityCharging(p) => p.validate_at(path, out),
Self::NotifyReport(p) => p.validate_at(path, out),
Self::NotifySettlement(p) => p.validate_at(path, out),
Self::OpenPeriodicEventStream(p) => p.validate_at(path, out),
Self::PublishFirmwareStatusNotification(p) => p.validate_at(path, out),
Self::PullDynamicScheduleUpdate(p) => p.validate_at(path, out),
Self::ReportChargingProfiles(p) => p.validate_at(path, out),
Self::ReportDERControl(p) => p.validate_at(path, out),
Self::ReservationStatusUpdate(p) => p.validate_at(path, out),
Self::SecurityEventNotification(p) => p.validate_at(path, out),
Self::SignCertificate(p) => p.validate_at(path, out),
Self::StatusNotification(p) => p.validate_at(path, out),
Self::TransactionEvent(p) => p.validate_at(path, out),
Self::VatNumberValidation(p) => p.validate_at(path, out),
}
}
}
impl serde::Serialize for CsRequest {
fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
match self {
Self::Authorize(p) => p.serialize(ser),
Self::BatterySwap(p) => p.serialize(ser),
Self::BootNotification(p) => p.serialize(ser),
Self::ClearedChargingLimit(p) => p.serialize(ser),
Self::ClosePeriodicEventStream(p) => p.serialize(ser),
Self::DataTransfer(p) => p.serialize(ser),
Self::FirmwareStatusNotification(p) => p.serialize(ser),
Self::Get15118EVCertificate(p) => p.serialize(ser),
Self::GetCertificateChainStatus(p) => p.serialize(ser),
Self::GetCertificateStatus(p) => p.serialize(ser),
Self::Heartbeat(p) => p.serialize(ser),
Self::LogStatusNotification(p) => p.serialize(ser),
Self::MeterValues(p) => p.serialize(ser),
Self::NotifyChargingLimit(p) => p.serialize(ser),
Self::NotifyCustomerInformation(p) => p.serialize(ser),
Self::NotifyDERAlarm(p) => p.serialize(ser),
Self::NotifyDERStartStop(p) => p.serialize(ser),
Self::NotifyDisplayMessages(p) => p.serialize(ser),
Self::NotifyEVChargingNeeds(p) => p.serialize(ser),
Self::NotifyEVChargingSchedule(p) => p.serialize(ser),
Self::NotifyEvent(p) => p.serialize(ser),
Self::NotifyMonitoringReport(p) => p.serialize(ser),
Self::NotifyPeriodicEventStream(p) => p.serialize(ser),
Self::NotifyPriorityCharging(p) => p.serialize(ser),
Self::NotifyReport(p) => p.serialize(ser),
Self::NotifySettlement(p) => p.serialize(ser),
Self::OpenPeriodicEventStream(p) => p.serialize(ser),
Self::PublishFirmwareStatusNotification(p) => p.serialize(ser),
Self::PullDynamicScheduleUpdate(p) => p.serialize(ser),
Self::ReportChargingProfiles(p) => p.serialize(ser),
Self::ReportDERControl(p) => p.serialize(ser),
Self::ReservationStatusUpdate(p) => p.serialize(ser),
Self::SecurityEventNotification(p) => p.serialize(ser),
Self::SignCertificate(p) => p.serialize(ser),
Self::StatusNotification(p) => p.serialize(ser),
Self::TransactionEvent(p) => p.serialize(ser),
Self::VatNumberValidation(p) => p.serialize(ser),
}
}
}
impl crate::message::Sealed for CsRequest {}
impl crate::message::DecodeRequest for CsRequest {
type Action = Action;
fn decode_reporting(
action: Action,
payload: &RawValue,
options: &DecodeOptions,
) -> Result<crate::decode::Decoded<Self>, DecodeError> {
CsRequest::decode_reporting(action, payload, options)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
#[allow(clippy::large_enum_variant)]
pub enum CsResponse {
Authorize(AuthorizeResponse),
BatterySwap(BatterySwapResponse),
BootNotification(BootNotificationResponse),
ClearedChargingLimit(ClearedChargingLimitResponse),
ClosePeriodicEventStream(ClosePeriodicEventStreamResponse),
DataTransfer(DataTransferResponse),
FirmwareStatusNotification(FirmwareStatusNotificationResponse),
Get15118EVCertificate(Get15118EVCertificateResponse),
GetCertificateChainStatus(GetCertificateChainStatusResponse),
GetCertificateStatus(GetCertificateStatusResponse),
Heartbeat(HeartbeatResponse),
LogStatusNotification(LogStatusNotificationResponse),
MeterValues(MeterValuesResponse),
NotifyChargingLimit(NotifyChargingLimitResponse),
NotifyCustomerInformation(NotifyCustomerInformationResponse),
NotifyDERAlarm(NotifyDERAlarmResponse),
NotifyDERStartStop(NotifyDERStartStopResponse),
NotifyDisplayMessages(NotifyDisplayMessagesResponse),
NotifyEVChargingNeeds(NotifyEVChargingNeedsResponse),
NotifyEVChargingSchedule(NotifyEVChargingScheduleResponse),
NotifyEvent(NotifyEventResponse),
NotifyMonitoringReport(NotifyMonitoringReportResponse),
NotifyPriorityCharging(NotifyPriorityChargingResponse),
NotifyReport(NotifyReportResponse),
NotifySettlement(NotifySettlementResponse),
OpenPeriodicEventStream(OpenPeriodicEventStreamResponse),
PublishFirmwareStatusNotification(PublishFirmwareStatusNotificationResponse),
PullDynamicScheduleUpdate(PullDynamicScheduleUpdateResponse),
ReportChargingProfiles(ReportChargingProfilesResponse),
ReportDERControl(ReportDERControlResponse),
ReservationStatusUpdate(ReservationStatusUpdateResponse),
SecurityEventNotification(SecurityEventNotificationResponse),
SignCertificate(SignCertificateResponse),
StatusNotification(StatusNotificationResponse),
TransactionEvent(TransactionEventResponse),
VatNumberValidation(VatNumberValidationResponse),
}
impl CsResponse {
#[must_use]
pub const fn action(&self) -> Action {
match self {
Self::Authorize(_) => Action::Authorize,
Self::BatterySwap(_) => Action::BatterySwap,
Self::BootNotification(_) => Action::BootNotification,
Self::ClearedChargingLimit(_) => Action::ClearedChargingLimit,
Self::ClosePeriodicEventStream(_) => Action::ClosePeriodicEventStream,
Self::DataTransfer(_) => Action::DataTransfer,
Self::FirmwareStatusNotification(_) => Action::FirmwareStatusNotification,
Self::Get15118EVCertificate(_) => Action::Get15118EVCertificate,
Self::GetCertificateChainStatus(_) => Action::GetCertificateChainStatus,
Self::GetCertificateStatus(_) => Action::GetCertificateStatus,
Self::Heartbeat(_) => Action::Heartbeat,
Self::LogStatusNotification(_) => Action::LogStatusNotification,
Self::MeterValues(_) => Action::MeterValues,
Self::NotifyChargingLimit(_) => Action::NotifyChargingLimit,
Self::NotifyCustomerInformation(_) => Action::NotifyCustomerInformation,
Self::NotifyDERAlarm(_) => Action::NotifyDERAlarm,
Self::NotifyDERStartStop(_) => Action::NotifyDERStartStop,
Self::NotifyDisplayMessages(_) => Action::NotifyDisplayMessages,
Self::NotifyEVChargingNeeds(_) => Action::NotifyEVChargingNeeds,
Self::NotifyEVChargingSchedule(_) => Action::NotifyEVChargingSchedule,
Self::NotifyEvent(_) => Action::NotifyEvent,
Self::NotifyMonitoringReport(_) => Action::NotifyMonitoringReport,
Self::NotifyPriorityCharging(_) => Action::NotifyPriorityCharging,
Self::NotifyReport(_) => Action::NotifyReport,
Self::NotifySettlement(_) => Action::NotifySettlement,
Self::OpenPeriodicEventStream(_) => Action::OpenPeriodicEventStream,
Self::PublishFirmwareStatusNotification(_) => Action::PublishFirmwareStatusNotification,
Self::PullDynamicScheduleUpdate(_) => Action::PullDynamicScheduleUpdate,
Self::ReportChargingProfiles(_) => Action::ReportChargingProfiles,
Self::ReportDERControl(_) => Action::ReportDERControl,
Self::ReservationStatusUpdate(_) => Action::ReservationStatusUpdate,
Self::SecurityEventNotification(_) => Action::SecurityEventNotification,
Self::SignCertificate(_) => Action::SignCertificate,
Self::StatusNotification(_) => Action::StatusNotification,
Self::TransactionEvent(_) => Action::TransactionEvent,
Self::VatNumberValidation(_) => Action::VatNumberValidation,
}
}
pub fn decode(
action: Action,
payload: &RawValue,
options: &DecodeOptions,
) -> Result<Self, DecodeError> {
Ok(match action {
Action::Authorize => Self::Authorize(
crate::decode::decode_payload::<AuthorizeResponse>(payload, options)?,
),
Action::BatterySwap => Self::BatterySwap(crate::decode::decode_payload::<
BatterySwapResponse,
>(payload, options)?),
Action::BootNotification => Self::BootNotification(crate::decode::decode_payload::<
BootNotificationResponse,
>(payload, options)?),
Action::ClearedChargingLimit => {
Self::ClearedChargingLimit(crate::decode::decode_payload::<
ClearedChargingLimitResponse,
>(payload, options)?)
}
Action::ClosePeriodicEventStream => {
Self::ClosePeriodicEventStream(crate::decode::decode_payload::<
ClosePeriodicEventStreamResponse,
>(payload, options)?)
}
Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
DataTransferResponse,
>(payload, options)?),
Action::FirmwareStatusNotification => {
Self::FirmwareStatusNotification(crate::decode::decode_payload::<
FirmwareStatusNotificationResponse,
>(payload, options)?)
}
Action::Get15118EVCertificate => {
Self::Get15118EVCertificate(crate::decode::decode_payload::<
Get15118EVCertificateResponse,
>(payload, options)?)
}
Action::GetCertificateChainStatus => {
Self::GetCertificateChainStatus(crate::decode::decode_payload::<
GetCertificateChainStatusResponse,
>(payload, options)?)
}
Action::GetCertificateStatus => {
Self::GetCertificateStatus(crate::decode::decode_payload::<
GetCertificateStatusResponse,
>(payload, options)?)
}
Action::Heartbeat => Self::Heartbeat(
crate::decode::decode_payload::<HeartbeatResponse>(payload, options)?,
),
Action::LogStatusNotification => {
Self::LogStatusNotification(crate::decode::decode_payload::<
LogStatusNotificationResponse,
>(payload, options)?)
}
Action::MeterValues => Self::MeterValues(crate::decode::decode_payload::<
MeterValuesResponse,
>(payload, options)?),
Action::NotifyChargingLimit => {
Self::NotifyChargingLimit(crate::decode::decode_payload::<
NotifyChargingLimitResponse,
>(payload, options)?)
}
Action::NotifyCustomerInformation => {
Self::NotifyCustomerInformation(crate::decode::decode_payload::<
NotifyCustomerInformationResponse,
>(payload, options)?)
}
Action::NotifyDERAlarm => Self::NotifyDERAlarm(crate::decode::decode_payload::<
NotifyDERAlarmResponse,
>(payload, options)?),
Action::NotifyDERStartStop => Self::NotifyDERStartStop(
crate::decode::decode_payload::<NotifyDERStartStopResponse>(payload, options)?,
),
Action::NotifyDisplayMessages => {
Self::NotifyDisplayMessages(crate::decode::decode_payload::<
NotifyDisplayMessagesResponse,
>(payload, options)?)
}
Action::NotifyEVChargingNeeds => {
Self::NotifyEVChargingNeeds(crate::decode::decode_payload::<
NotifyEVChargingNeedsResponse,
>(payload, options)?)
}
Action::NotifyEVChargingSchedule => {
Self::NotifyEVChargingSchedule(crate::decode::decode_payload::<
NotifyEVChargingScheduleResponse,
>(payload, options)?)
}
Action::NotifyEvent => Self::NotifyEvent(crate::decode::decode_payload::<
NotifyEventResponse,
>(payload, options)?),
Action::NotifyMonitoringReport => {
Self::NotifyMonitoringReport(crate::decode::decode_payload::<
NotifyMonitoringReportResponse,
>(payload, options)?)
}
Action::NotifyPriorityCharging => {
Self::NotifyPriorityCharging(crate::decode::decode_payload::<
NotifyPriorityChargingResponse,
>(payload, options)?)
}
Action::NotifyReport => Self::NotifyReport(crate::decode::decode_payload::<
NotifyReportResponse,
>(payload, options)?),
Action::NotifySettlement => Self::NotifySettlement(crate::decode::decode_payload::<
NotifySettlementResponse,
>(payload, options)?),
Action::OpenPeriodicEventStream => {
Self::OpenPeriodicEventStream(crate::decode::decode_payload::<
OpenPeriodicEventStreamResponse,
>(payload, options)?)
}
Action::PublishFirmwareStatusNotification => {
Self::PublishFirmwareStatusNotification(crate::decode::decode_payload::<
PublishFirmwareStatusNotificationResponse,
>(payload, options)?)
}
Action::PullDynamicScheduleUpdate => {
Self::PullDynamicScheduleUpdate(crate::decode::decode_payload::<
PullDynamicScheduleUpdateResponse,
>(payload, options)?)
}
Action::ReportChargingProfiles => {
Self::ReportChargingProfiles(crate::decode::decode_payload::<
ReportChargingProfilesResponse,
>(payload, options)?)
}
Action::ReportDERControl => Self::ReportDERControl(crate::decode::decode_payload::<
ReportDERControlResponse,
>(payload, options)?),
Action::ReservationStatusUpdate => {
Self::ReservationStatusUpdate(crate::decode::decode_payload::<
ReservationStatusUpdateResponse,
>(payload, options)?)
}
Action::SecurityEventNotification => {
Self::SecurityEventNotification(crate::decode::decode_payload::<
SecurityEventNotificationResponse,
>(payload, options)?)
}
Action::SignCertificate => Self::SignCertificate(crate::decode::decode_payload::<
SignCertificateResponse,
>(payload, options)?),
Action::StatusNotification => Self::StatusNotification(
crate::decode::decode_payload::<StatusNotificationResponse>(payload, options)?,
),
Action::TransactionEvent => Self::TransactionEvent(crate::decode::decode_payload::<
TransactionEventResponse,
>(payload, options)?),
Action::VatNumberValidation => {
Self::VatNumberValidation(crate::decode::decode_payload::<
VatNumberValidationResponse,
>(payload, options)?)
}
other => return Err(DecodeError::unsupported_action(other.as_str())),
})
}
pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
match self {
Self::Authorize(p) => serde_json::to_string(p),
Self::BatterySwap(p) => serde_json::to_string(p),
Self::BootNotification(p) => serde_json::to_string(p),
Self::ClearedChargingLimit(p) => serde_json::to_string(p),
Self::ClosePeriodicEventStream(p) => serde_json::to_string(p),
Self::DataTransfer(p) => serde_json::to_string(p),
Self::FirmwareStatusNotification(p) => serde_json::to_string(p),
Self::Get15118EVCertificate(p) => serde_json::to_string(p),
Self::GetCertificateChainStatus(p) => serde_json::to_string(p),
Self::GetCertificateStatus(p) => serde_json::to_string(p),
Self::Heartbeat(p) => serde_json::to_string(p),
Self::LogStatusNotification(p) => serde_json::to_string(p),
Self::MeterValues(p) => serde_json::to_string(p),
Self::NotifyChargingLimit(p) => serde_json::to_string(p),
Self::NotifyCustomerInformation(p) => serde_json::to_string(p),
Self::NotifyDERAlarm(p) => serde_json::to_string(p),
Self::NotifyDERStartStop(p) => serde_json::to_string(p),
Self::NotifyDisplayMessages(p) => serde_json::to_string(p),
Self::NotifyEVChargingNeeds(p) => serde_json::to_string(p),
Self::NotifyEVChargingSchedule(p) => serde_json::to_string(p),
Self::NotifyEvent(p) => serde_json::to_string(p),
Self::NotifyMonitoringReport(p) => serde_json::to_string(p),
Self::NotifyPriorityCharging(p) => serde_json::to_string(p),
Self::NotifyReport(p) => serde_json::to_string(p),
Self::NotifySettlement(p) => serde_json::to_string(p),
Self::OpenPeriodicEventStream(p) => serde_json::to_string(p),
Self::PublishFirmwareStatusNotification(p) => serde_json::to_string(p),
Self::PullDynamicScheduleUpdate(p) => serde_json::to_string(p),
Self::ReportChargingProfiles(p) => serde_json::to_string(p),
Self::ReportDERControl(p) => serde_json::to_string(p),
Self::ReservationStatusUpdate(p) => serde_json::to_string(p),
Self::SecurityEventNotification(p) => serde_json::to_string(p),
Self::SignCertificate(p) => serde_json::to_string(p),
Self::StatusNotification(p) => serde_json::to_string(p),
Self::TransactionEvent(p) => serde_json::to_string(p),
Self::VatNumberValidation(p) => serde_json::to_string(p),
}
}
}
impl Validate for CsResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
match self {
Self::Authorize(p) => p.validate_at(path, out),
Self::BatterySwap(p) => p.validate_at(path, out),
Self::BootNotification(p) => p.validate_at(path, out),
Self::ClearedChargingLimit(p) => p.validate_at(path, out),
Self::ClosePeriodicEventStream(p) => p.validate_at(path, out),
Self::DataTransfer(p) => p.validate_at(path, out),
Self::FirmwareStatusNotification(p) => p.validate_at(path, out),
Self::Get15118EVCertificate(p) => p.validate_at(path, out),
Self::GetCertificateChainStatus(p) => p.validate_at(path, out),
Self::GetCertificateStatus(p) => p.validate_at(path, out),
Self::Heartbeat(p) => p.validate_at(path, out),
Self::LogStatusNotification(p) => p.validate_at(path, out),
Self::MeterValues(p) => p.validate_at(path, out),
Self::NotifyChargingLimit(p) => p.validate_at(path, out),
Self::NotifyCustomerInformation(p) => p.validate_at(path, out),
Self::NotifyDERAlarm(p) => p.validate_at(path, out),
Self::NotifyDERStartStop(p) => p.validate_at(path, out),
Self::NotifyDisplayMessages(p) => p.validate_at(path, out),
Self::NotifyEVChargingNeeds(p) => p.validate_at(path, out),
Self::NotifyEVChargingSchedule(p) => p.validate_at(path, out),
Self::NotifyEvent(p) => p.validate_at(path, out),
Self::NotifyMonitoringReport(p) => p.validate_at(path, out),
Self::NotifyPriorityCharging(p) => p.validate_at(path, out),
Self::NotifyReport(p) => p.validate_at(path, out),
Self::NotifySettlement(p) => p.validate_at(path, out),
Self::OpenPeriodicEventStream(p) => p.validate_at(path, out),
Self::PublishFirmwareStatusNotification(p) => p.validate_at(path, out),
Self::PullDynamicScheduleUpdate(p) => p.validate_at(path, out),
Self::ReportChargingProfiles(p) => p.validate_at(path, out),
Self::ReportDERControl(p) => p.validate_at(path, out),
Self::ReservationStatusUpdate(p) => p.validate_at(path, out),
Self::SecurityEventNotification(p) => p.validate_at(path, out),
Self::SignCertificate(p) => p.validate_at(path, out),
Self::StatusNotification(p) => p.validate_at(path, out),
Self::TransactionEvent(p) => p.validate_at(path, out),
Self::VatNumberValidation(p) => p.validate_at(path, out),
}
}
}
impl serde::Serialize for CsResponse {
fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
match self {
Self::Authorize(p) => p.serialize(ser),
Self::BatterySwap(p) => p.serialize(ser),
Self::BootNotification(p) => p.serialize(ser),
Self::ClearedChargingLimit(p) => p.serialize(ser),
Self::ClosePeriodicEventStream(p) => p.serialize(ser),
Self::DataTransfer(p) => p.serialize(ser),
Self::FirmwareStatusNotification(p) => p.serialize(ser),
Self::Get15118EVCertificate(p) => p.serialize(ser),
Self::GetCertificateChainStatus(p) => p.serialize(ser),
Self::GetCertificateStatus(p) => p.serialize(ser),
Self::Heartbeat(p) => p.serialize(ser),
Self::LogStatusNotification(p) => p.serialize(ser),
Self::MeterValues(p) => p.serialize(ser),
Self::NotifyChargingLimit(p) => p.serialize(ser),
Self::NotifyCustomerInformation(p) => p.serialize(ser),
Self::NotifyDERAlarm(p) => p.serialize(ser),
Self::NotifyDERStartStop(p) => p.serialize(ser),
Self::NotifyDisplayMessages(p) => p.serialize(ser),
Self::NotifyEVChargingNeeds(p) => p.serialize(ser),
Self::NotifyEVChargingSchedule(p) => p.serialize(ser),
Self::NotifyEvent(p) => p.serialize(ser),
Self::NotifyMonitoringReport(p) => p.serialize(ser),
Self::NotifyPriorityCharging(p) => p.serialize(ser),
Self::NotifyReport(p) => p.serialize(ser),
Self::NotifySettlement(p) => p.serialize(ser),
Self::OpenPeriodicEventStream(p) => p.serialize(ser),
Self::PublishFirmwareStatusNotification(p) => p.serialize(ser),
Self::PullDynamicScheduleUpdate(p) => p.serialize(ser),
Self::ReportChargingProfiles(p) => p.serialize(ser),
Self::ReportDERControl(p) => p.serialize(ser),
Self::ReservationStatusUpdate(p) => p.serialize(ser),
Self::SecurityEventNotification(p) => p.serialize(ser),
Self::SignCertificate(p) => p.serialize(ser),
Self::StatusNotification(p) => p.serialize(ser),
Self::TransactionEvent(p) => p.serialize(ser),
Self::VatNumberValidation(p) => p.serialize(ser),
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
#[allow(clippy::large_enum_variant)]
pub enum CsmsRequest {
AFRRSignal(AFRRSignalRequest),
AdjustPeriodicEventStream(AdjustPeriodicEventStreamRequest),
CancelReservation(CancelReservationRequest),
CertificateSigned(CertificateSignedRequest),
ChangeAvailability(ChangeAvailabilityRequest),
ChangeTransactionTariff(ChangeTransactionTariffRequest),
ClearCache(ClearCacheRequest),
ClearChargingProfile(ClearChargingProfileRequest),
ClearDERControl(ClearDERControlRequest),
ClearDisplayMessage(ClearDisplayMessageRequest),
ClearTariffs(ClearTariffsRequest),
ClearVariableMonitoring(ClearVariableMonitoringRequest),
CostUpdated(CostUpdatedRequest),
CustomerInformation(CustomerInformationRequest),
DataTransfer(DataTransferRequest),
DeleteCertificate(DeleteCertificateRequest),
GetBaseReport(GetBaseReportRequest),
GetChargingProfiles(GetChargingProfilesRequest),
GetCompositeSchedule(GetCompositeScheduleRequest),
GetDERControl(GetDERControlRequest),
GetDisplayMessages(GetDisplayMessagesRequest),
GetInstalledCertificateIds(GetInstalledCertificateIdsRequest),
GetLocalListVersion(GetLocalListVersionRequest),
GetLog(GetLogRequest),
GetMonitoringReport(GetMonitoringReportRequest),
GetPeriodicEventStream(GetPeriodicEventStreamRequest),
GetReport(GetReportRequest),
GetTariffs(GetTariffsRequest),
GetTransactionStatus(GetTransactionStatusRequest),
GetVariables(GetVariablesRequest),
InstallCertificate(InstallCertificateRequest),
NotifyAllowedEnergyTransfer(NotifyAllowedEnergyTransferRequest),
NotifyWebPaymentStarted(NotifyWebPaymentStartedRequest),
PublishFirmware(PublishFirmwareRequest),
RequestBatterySwap(RequestBatterySwapRequest),
RequestStartTransaction(RequestStartTransactionRequest),
RequestStopTransaction(RequestStopTransactionRequest),
ReserveNow(ReserveNowRequest),
Reset(ResetRequest),
SendLocalList(SendLocalListRequest),
SetChargingProfile(SetChargingProfileRequest),
SetDERControl(SetDERControlRequest),
SetDefaultTariff(SetDefaultTariffRequest),
SetDisplayMessage(SetDisplayMessageRequest),
SetMonitoringBase(SetMonitoringBaseRequest),
SetMonitoringLevel(SetMonitoringLevelRequest),
SetNetworkProfile(SetNetworkProfileRequest),
SetVariableMonitoring(SetVariableMonitoringRequest),
SetVariables(SetVariablesRequest),
TriggerMessage(TriggerMessageRequest),
UnlockConnector(UnlockConnectorRequest),
UnpublishFirmware(UnpublishFirmwareRequest),
UpdateDynamicSchedule(UpdateDynamicScheduleRequest),
UpdateFirmware(UpdateFirmwareRequest),
UsePriorityCharging(UsePriorityChargingRequest),
}
impl CsmsRequest {
#[must_use]
pub const fn action(&self) -> Action {
match self {
Self::AFRRSignal(_) => Action::AFRRSignal,
Self::AdjustPeriodicEventStream(_) => Action::AdjustPeriodicEventStream,
Self::CancelReservation(_) => Action::CancelReservation,
Self::CertificateSigned(_) => Action::CertificateSigned,
Self::ChangeAvailability(_) => Action::ChangeAvailability,
Self::ChangeTransactionTariff(_) => Action::ChangeTransactionTariff,
Self::ClearCache(_) => Action::ClearCache,
Self::ClearChargingProfile(_) => Action::ClearChargingProfile,
Self::ClearDERControl(_) => Action::ClearDERControl,
Self::ClearDisplayMessage(_) => Action::ClearDisplayMessage,
Self::ClearTariffs(_) => Action::ClearTariffs,
Self::ClearVariableMonitoring(_) => Action::ClearVariableMonitoring,
Self::CostUpdated(_) => Action::CostUpdated,
Self::CustomerInformation(_) => Action::CustomerInformation,
Self::DataTransfer(_) => Action::DataTransfer,
Self::DeleteCertificate(_) => Action::DeleteCertificate,
Self::GetBaseReport(_) => Action::GetBaseReport,
Self::GetChargingProfiles(_) => Action::GetChargingProfiles,
Self::GetCompositeSchedule(_) => Action::GetCompositeSchedule,
Self::GetDERControl(_) => Action::GetDERControl,
Self::GetDisplayMessages(_) => Action::GetDisplayMessages,
Self::GetInstalledCertificateIds(_) => Action::GetInstalledCertificateIds,
Self::GetLocalListVersion(_) => Action::GetLocalListVersion,
Self::GetLog(_) => Action::GetLog,
Self::GetMonitoringReport(_) => Action::GetMonitoringReport,
Self::GetPeriodicEventStream(_) => Action::GetPeriodicEventStream,
Self::GetReport(_) => Action::GetReport,
Self::GetTariffs(_) => Action::GetTariffs,
Self::GetTransactionStatus(_) => Action::GetTransactionStatus,
Self::GetVariables(_) => Action::GetVariables,
Self::InstallCertificate(_) => Action::InstallCertificate,
Self::NotifyAllowedEnergyTransfer(_) => Action::NotifyAllowedEnergyTransfer,
Self::NotifyWebPaymentStarted(_) => Action::NotifyWebPaymentStarted,
Self::PublishFirmware(_) => Action::PublishFirmware,
Self::RequestBatterySwap(_) => Action::RequestBatterySwap,
Self::RequestStartTransaction(_) => Action::RequestStartTransaction,
Self::RequestStopTransaction(_) => Action::RequestStopTransaction,
Self::ReserveNow(_) => Action::ReserveNow,
Self::Reset(_) => Action::Reset,
Self::SendLocalList(_) => Action::SendLocalList,
Self::SetChargingProfile(_) => Action::SetChargingProfile,
Self::SetDERControl(_) => Action::SetDERControl,
Self::SetDefaultTariff(_) => Action::SetDefaultTariff,
Self::SetDisplayMessage(_) => Action::SetDisplayMessage,
Self::SetMonitoringBase(_) => Action::SetMonitoringBase,
Self::SetMonitoringLevel(_) => Action::SetMonitoringLevel,
Self::SetNetworkProfile(_) => Action::SetNetworkProfile,
Self::SetVariableMonitoring(_) => Action::SetVariableMonitoring,
Self::SetVariables(_) => Action::SetVariables,
Self::TriggerMessage(_) => Action::TriggerMessage,
Self::UnlockConnector(_) => Action::UnlockConnector,
Self::UnpublishFirmware(_) => Action::UnpublishFirmware,
Self::UpdateDynamicSchedule(_) => Action::UpdateDynamicSchedule,
Self::UpdateFirmware(_) => Action::UpdateFirmware,
Self::UsePriorityCharging(_) => Action::UsePriorityCharging,
}
}
pub fn decode(
action: Action,
payload: &RawValue,
options: &DecodeOptions,
) -> Result<Self, DecodeError> {
Ok(match action {
Action::AFRRSignal => Self::AFRRSignal(crate::decode::decode_payload::<
AFRRSignalRequest,
>(payload, options)?),
Action::AdjustPeriodicEventStream => {
Self::AdjustPeriodicEventStream(crate::decode::decode_payload::<
AdjustPeriodicEventStreamRequest,
>(payload, options)?)
}
Action::CancelReservation => Self::CancelReservation(crate::decode::decode_payload::<
CancelReservationRequest,
>(payload, options)?),
Action::CertificateSigned => Self::CertificateSigned(crate::decode::decode_payload::<
CertificateSignedRequest,
>(payload, options)?),
Action::ChangeAvailability => Self::ChangeAvailability(
crate::decode::decode_payload::<ChangeAvailabilityRequest>(payload, options)?,
),
Action::ChangeTransactionTariff => {
Self::ChangeTransactionTariff(crate::decode::decode_payload::<
ChangeTransactionTariffRequest,
>(payload, options)?)
}
Action::ClearCache => Self::ClearCache(crate::decode::decode_payload::<
ClearCacheRequest,
>(payload, options)?),
Action::ClearChargingProfile => {
Self::ClearChargingProfile(crate::decode::decode_payload::<
ClearChargingProfileRequest,
>(payload, options)?)
}
Action::ClearDERControl => Self::ClearDERControl(crate::decode::decode_payload::<
ClearDERControlRequest,
>(payload, options)?),
Action::ClearDisplayMessage => {
Self::ClearDisplayMessage(crate::decode::decode_payload::<
ClearDisplayMessageRequest,
>(payload, options)?)
}
Action::ClearTariffs => Self::ClearTariffs(crate::decode::decode_payload::<
ClearTariffsRequest,
>(payload, options)?),
Action::ClearVariableMonitoring => {
Self::ClearVariableMonitoring(crate::decode::decode_payload::<
ClearVariableMonitoringRequest,
>(payload, options)?)
}
Action::CostUpdated => Self::CostUpdated(crate::decode::decode_payload::<
CostUpdatedRequest,
>(payload, options)?),
Action::CustomerInformation => {
Self::CustomerInformation(crate::decode::decode_payload::<
CustomerInformationRequest,
>(payload, options)?)
}
Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
DataTransferRequest,
>(payload, options)?),
Action::DeleteCertificate => Self::DeleteCertificate(crate::decode::decode_payload::<
DeleteCertificateRequest,
>(payload, options)?),
Action::GetBaseReport => Self::GetBaseReport(crate::decode::decode_payload::<
GetBaseReportRequest,
>(payload, options)?),
Action::GetChargingProfiles => {
Self::GetChargingProfiles(crate::decode::decode_payload::<
GetChargingProfilesRequest,
>(payload, options)?)
}
Action::GetCompositeSchedule => {
Self::GetCompositeSchedule(crate::decode::decode_payload::<
GetCompositeScheduleRequest,
>(payload, options)?)
}
Action::GetDERControl => Self::GetDERControl(crate::decode::decode_payload::<
GetDERControlRequest,
>(payload, options)?),
Action::GetDisplayMessages => Self::GetDisplayMessages(
crate::decode::decode_payload::<GetDisplayMessagesRequest>(payload, options)?,
),
Action::GetInstalledCertificateIds => {
Self::GetInstalledCertificateIds(crate::decode::decode_payload::<
GetInstalledCertificateIdsRequest,
>(payload, options)?)
}
Action::GetLocalListVersion => {
Self::GetLocalListVersion(crate::decode::decode_payload::<
GetLocalListVersionRequest,
>(payload, options)?)
}
Action::GetLog => Self::GetLog(crate::decode::decode_payload::<GetLogRequest>(
payload, options,
)?),
Action::GetMonitoringReport => {
Self::GetMonitoringReport(crate::decode::decode_payload::<
GetMonitoringReportRequest,
>(payload, options)?)
}
Action::GetPeriodicEventStream => {
Self::GetPeriodicEventStream(crate::decode::decode_payload::<
GetPeriodicEventStreamRequest,
>(payload, options)?)
}
Action::GetReport => Self::GetReport(
crate::decode::decode_payload::<GetReportRequest>(payload, options)?,
),
Action::GetTariffs => Self::GetTariffs(crate::decode::decode_payload::<
GetTariffsRequest,
>(payload, options)?),
Action::GetTransactionStatus => {
Self::GetTransactionStatus(crate::decode::decode_payload::<
GetTransactionStatusRequest,
>(payload, options)?)
}
Action::GetVariables => Self::GetVariables(crate::decode::decode_payload::<
GetVariablesRequest,
>(payload, options)?),
Action::InstallCertificate => Self::InstallCertificate(
crate::decode::decode_payload::<InstallCertificateRequest>(payload, options)?,
),
Action::NotifyAllowedEnergyTransfer => {
Self::NotifyAllowedEnergyTransfer(crate::decode::decode_payload::<
NotifyAllowedEnergyTransferRequest,
>(payload, options)?)
}
Action::NotifyWebPaymentStarted => {
Self::NotifyWebPaymentStarted(crate::decode::decode_payload::<
NotifyWebPaymentStartedRequest,
>(payload, options)?)
}
Action::PublishFirmware => Self::PublishFirmware(crate::decode::decode_payload::<
PublishFirmwareRequest,
>(payload, options)?),
Action::RequestBatterySwap => Self::RequestBatterySwap(
crate::decode::decode_payload::<RequestBatterySwapRequest>(payload, options)?,
),
Action::RequestStartTransaction => {
Self::RequestStartTransaction(crate::decode::decode_payload::<
RequestStartTransactionRequest,
>(payload, options)?)
}
Action::RequestStopTransaction => {
Self::RequestStopTransaction(crate::decode::decode_payload::<
RequestStopTransactionRequest,
>(payload, options)?)
}
Action::ReserveNow => Self::ReserveNow(crate::decode::decode_payload::<
ReserveNowRequest,
>(payload, options)?),
Action::Reset => Self::Reset(crate::decode::decode_payload::<ResetRequest>(
payload, options,
)?),
Action::SendLocalList => Self::SendLocalList(crate::decode::decode_payload::<
SendLocalListRequest,
>(payload, options)?),
Action::SetChargingProfile => Self::SetChargingProfile(
crate::decode::decode_payload::<SetChargingProfileRequest>(payload, options)?,
),
Action::SetDERControl => Self::SetDERControl(crate::decode::decode_payload::<
SetDERControlRequest,
>(payload, options)?),
Action::SetDefaultTariff => Self::SetDefaultTariff(crate::decode::decode_payload::<
SetDefaultTariffRequest,
>(payload, options)?),
Action::SetDisplayMessage => Self::SetDisplayMessage(crate::decode::decode_payload::<
SetDisplayMessageRequest,
>(payload, options)?),
Action::SetMonitoringBase => Self::SetMonitoringBase(crate::decode::decode_payload::<
SetMonitoringBaseRequest,
>(payload, options)?),
Action::SetMonitoringLevel => Self::SetMonitoringLevel(
crate::decode::decode_payload::<SetMonitoringLevelRequest>(payload, options)?,
),
Action::SetNetworkProfile => Self::SetNetworkProfile(crate::decode::decode_payload::<
SetNetworkProfileRequest,
>(payload, options)?),
Action::SetVariableMonitoring => {
Self::SetVariableMonitoring(crate::decode::decode_payload::<
SetVariableMonitoringRequest,
>(payload, options)?)
}
Action::SetVariables => Self::SetVariables(crate::decode::decode_payload::<
SetVariablesRequest,
>(payload, options)?),
Action::TriggerMessage => Self::TriggerMessage(crate::decode::decode_payload::<
TriggerMessageRequest,
>(payload, options)?),
Action::UnlockConnector => Self::UnlockConnector(crate::decode::decode_payload::<
UnlockConnectorRequest,
>(payload, options)?),
Action::UnpublishFirmware => Self::UnpublishFirmware(crate::decode::decode_payload::<
UnpublishFirmwareRequest,
>(payload, options)?),
Action::UpdateDynamicSchedule => {
Self::UpdateDynamicSchedule(crate::decode::decode_payload::<
UpdateDynamicScheduleRequest,
>(payload, options)?)
}
Action::UpdateFirmware => Self::UpdateFirmware(crate::decode::decode_payload::<
UpdateFirmwareRequest,
>(payload, options)?),
Action::UsePriorityCharging => {
Self::UsePriorityCharging(crate::decode::decode_payload::<
UsePriorityChargingRequest,
>(payload, options)?)
}
other => return Err(DecodeError::unsupported_action(other.as_str())),
})
}
pub fn decode_reporting(
action: Action,
payload: &RawValue,
options: &DecodeOptions,
) -> Result<crate::decode::Decoded<Self>, DecodeError> {
Ok(match action {
Action::AFRRSignal => {
crate::decode::decode_payload_reporting::<AFRRSignalRequest>(payload, options)?
.map(Self::AFRRSignal)
}
Action::AdjustPeriodicEventStream => crate::decode::decode_payload_reporting::<
AdjustPeriodicEventStreamRequest,
>(payload, options)?
.map(Self::AdjustPeriodicEventStream),
Action::CancelReservation => crate::decode::decode_payload_reporting::<
CancelReservationRequest,
>(payload, options)?
.map(Self::CancelReservation),
Action::CertificateSigned => crate::decode::decode_payload_reporting::<
CertificateSignedRequest,
>(payload, options)?
.map(Self::CertificateSigned),
Action::ChangeAvailability => crate::decode::decode_payload_reporting::<
ChangeAvailabilityRequest,
>(payload, options)?
.map(Self::ChangeAvailability),
Action::ChangeTransactionTariff => crate::decode::decode_payload_reporting::<
ChangeTransactionTariffRequest,
>(payload, options)?
.map(Self::ChangeTransactionTariff),
Action::ClearCache => {
crate::decode::decode_payload_reporting::<ClearCacheRequest>(payload, options)?
.map(Self::ClearCache)
}
Action::ClearChargingProfile => crate::decode::decode_payload_reporting::<
ClearChargingProfileRequest,
>(payload, options)?
.map(Self::ClearChargingProfile),
Action::ClearDERControl => {
crate::decode::decode_payload_reporting::<ClearDERControlRequest>(payload, options)?
.map(Self::ClearDERControl)
}
Action::ClearDisplayMessage => crate::decode::decode_payload_reporting::<
ClearDisplayMessageRequest,
>(payload, options)?
.map(Self::ClearDisplayMessage),
Action::ClearTariffs => {
crate::decode::decode_payload_reporting::<ClearTariffsRequest>(payload, options)?
.map(Self::ClearTariffs)
}
Action::ClearVariableMonitoring => crate::decode::decode_payload_reporting::<
ClearVariableMonitoringRequest,
>(payload, options)?
.map(Self::ClearVariableMonitoring),
Action::CostUpdated => {
crate::decode::decode_payload_reporting::<CostUpdatedRequest>(payload, options)?
.map(Self::CostUpdated)
}
Action::CustomerInformation => crate::decode::decode_payload_reporting::<
CustomerInformationRequest,
>(payload, options)?
.map(Self::CustomerInformation),
Action::DataTransfer => {
crate::decode::decode_payload_reporting::<DataTransferRequest>(payload, options)?
.map(Self::DataTransfer)
}
Action::DeleteCertificate => crate::decode::decode_payload_reporting::<
DeleteCertificateRequest,
>(payload, options)?
.map(Self::DeleteCertificate),
Action::GetBaseReport => {
crate::decode::decode_payload_reporting::<GetBaseReportRequest>(payload, options)?
.map(Self::GetBaseReport)
}
Action::GetChargingProfiles => crate::decode::decode_payload_reporting::<
GetChargingProfilesRequest,
>(payload, options)?
.map(Self::GetChargingProfiles),
Action::GetCompositeSchedule => crate::decode::decode_payload_reporting::<
GetCompositeScheduleRequest,
>(payload, options)?
.map(Self::GetCompositeSchedule),
Action::GetDERControl => {
crate::decode::decode_payload_reporting::<GetDERControlRequest>(payload, options)?
.map(Self::GetDERControl)
}
Action::GetDisplayMessages => crate::decode::decode_payload_reporting::<
GetDisplayMessagesRequest,
>(payload, options)?
.map(Self::GetDisplayMessages),
Action::GetInstalledCertificateIds => crate::decode::decode_payload_reporting::<
GetInstalledCertificateIdsRequest,
>(payload, options)?
.map(Self::GetInstalledCertificateIds),
Action::GetLocalListVersion => crate::decode::decode_payload_reporting::<
GetLocalListVersionRequest,
>(payload, options)?
.map(Self::GetLocalListVersion),
Action::GetLog => {
crate::decode::decode_payload_reporting::<GetLogRequest>(payload, options)?
.map(Self::GetLog)
}
Action::GetMonitoringReport => crate::decode::decode_payload_reporting::<
GetMonitoringReportRequest,
>(payload, options)?
.map(Self::GetMonitoringReport),
Action::GetPeriodicEventStream => crate::decode::decode_payload_reporting::<
GetPeriodicEventStreamRequest,
>(payload, options)?
.map(Self::GetPeriodicEventStream),
Action::GetReport => {
crate::decode::decode_payload_reporting::<GetReportRequest>(payload, options)?
.map(Self::GetReport)
}
Action::GetTariffs => {
crate::decode::decode_payload_reporting::<GetTariffsRequest>(payload, options)?
.map(Self::GetTariffs)
}
Action::GetTransactionStatus => crate::decode::decode_payload_reporting::<
GetTransactionStatusRequest,
>(payload, options)?
.map(Self::GetTransactionStatus),
Action::GetVariables => {
crate::decode::decode_payload_reporting::<GetVariablesRequest>(payload, options)?
.map(Self::GetVariables)
}
Action::InstallCertificate => crate::decode::decode_payload_reporting::<
InstallCertificateRequest,
>(payload, options)?
.map(Self::InstallCertificate),
Action::NotifyAllowedEnergyTransfer => crate::decode::decode_payload_reporting::<
NotifyAllowedEnergyTransferRequest,
>(payload, options)?
.map(Self::NotifyAllowedEnergyTransfer),
Action::NotifyWebPaymentStarted => crate::decode::decode_payload_reporting::<
NotifyWebPaymentStartedRequest,
>(payload, options)?
.map(Self::NotifyWebPaymentStarted),
Action::PublishFirmware => {
crate::decode::decode_payload_reporting::<PublishFirmwareRequest>(payload, options)?
.map(Self::PublishFirmware)
}
Action::RequestBatterySwap => crate::decode::decode_payload_reporting::<
RequestBatterySwapRequest,
>(payload, options)?
.map(Self::RequestBatterySwap),
Action::RequestStartTransaction => crate::decode::decode_payload_reporting::<
RequestStartTransactionRequest,
>(payload, options)?
.map(Self::RequestStartTransaction),
Action::RequestStopTransaction => crate::decode::decode_payload_reporting::<
RequestStopTransactionRequest,
>(payload, options)?
.map(Self::RequestStopTransaction),
Action::ReserveNow => {
crate::decode::decode_payload_reporting::<ReserveNowRequest>(payload, options)?
.map(Self::ReserveNow)
}
Action::Reset => {
crate::decode::decode_payload_reporting::<ResetRequest>(payload, options)?
.map(Self::Reset)
}
Action::SendLocalList => {
crate::decode::decode_payload_reporting::<SendLocalListRequest>(payload, options)?
.map(Self::SendLocalList)
}
Action::SetChargingProfile => crate::decode::decode_payload_reporting::<
SetChargingProfileRequest,
>(payload, options)?
.map(Self::SetChargingProfile),
Action::SetDERControl => {
crate::decode::decode_payload_reporting::<SetDERControlRequest>(payload, options)?
.map(Self::SetDERControl)
}
Action::SetDefaultTariff => crate::decode::decode_payload_reporting::<
SetDefaultTariffRequest,
>(payload, options)?
.map(Self::SetDefaultTariff),
Action::SetDisplayMessage => crate::decode::decode_payload_reporting::<
SetDisplayMessageRequest,
>(payload, options)?
.map(Self::SetDisplayMessage),
Action::SetMonitoringBase => crate::decode::decode_payload_reporting::<
SetMonitoringBaseRequest,
>(payload, options)?
.map(Self::SetMonitoringBase),
Action::SetMonitoringLevel => crate::decode::decode_payload_reporting::<
SetMonitoringLevelRequest,
>(payload, options)?
.map(Self::SetMonitoringLevel),
Action::SetNetworkProfile => crate::decode::decode_payload_reporting::<
SetNetworkProfileRequest,
>(payload, options)?
.map(Self::SetNetworkProfile),
Action::SetVariableMonitoring => crate::decode::decode_payload_reporting::<
SetVariableMonitoringRequest,
>(payload, options)?
.map(Self::SetVariableMonitoring),
Action::SetVariables => {
crate::decode::decode_payload_reporting::<SetVariablesRequest>(payload, options)?
.map(Self::SetVariables)
}
Action::TriggerMessage => {
crate::decode::decode_payload_reporting::<TriggerMessageRequest>(payload, options)?
.map(Self::TriggerMessage)
}
Action::UnlockConnector => {
crate::decode::decode_payload_reporting::<UnlockConnectorRequest>(payload, options)?
.map(Self::UnlockConnector)
}
Action::UnpublishFirmware => crate::decode::decode_payload_reporting::<
UnpublishFirmwareRequest,
>(payload, options)?
.map(Self::UnpublishFirmware),
Action::UpdateDynamicSchedule => crate::decode::decode_payload_reporting::<
UpdateDynamicScheduleRequest,
>(payload, options)?
.map(Self::UpdateDynamicSchedule),
Action::UpdateFirmware => {
crate::decode::decode_payload_reporting::<UpdateFirmwareRequest>(payload, options)?
.map(Self::UpdateFirmware)
}
Action::UsePriorityCharging => crate::decode::decode_payload_reporting::<
UsePriorityChargingRequest,
>(payload, options)?
.map(Self::UsePriorityCharging),
other => return Err(DecodeError::unsupported_action(other.as_str())),
})
}
pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
match self {
Self::AFRRSignal(p) => serde_json::to_string(p),
Self::AdjustPeriodicEventStream(p) => serde_json::to_string(p),
Self::CancelReservation(p) => serde_json::to_string(p),
Self::CertificateSigned(p) => serde_json::to_string(p),
Self::ChangeAvailability(p) => serde_json::to_string(p),
Self::ChangeTransactionTariff(p) => serde_json::to_string(p),
Self::ClearCache(p) => serde_json::to_string(p),
Self::ClearChargingProfile(p) => serde_json::to_string(p),
Self::ClearDERControl(p) => serde_json::to_string(p),
Self::ClearDisplayMessage(p) => serde_json::to_string(p),
Self::ClearTariffs(p) => serde_json::to_string(p),
Self::ClearVariableMonitoring(p) => serde_json::to_string(p),
Self::CostUpdated(p) => serde_json::to_string(p),
Self::CustomerInformation(p) => serde_json::to_string(p),
Self::DataTransfer(p) => serde_json::to_string(p),
Self::DeleteCertificate(p) => serde_json::to_string(p),
Self::GetBaseReport(p) => serde_json::to_string(p),
Self::GetChargingProfiles(p) => serde_json::to_string(p),
Self::GetCompositeSchedule(p) => serde_json::to_string(p),
Self::GetDERControl(p) => serde_json::to_string(p),
Self::GetDisplayMessages(p) => serde_json::to_string(p),
Self::GetInstalledCertificateIds(p) => serde_json::to_string(p),
Self::GetLocalListVersion(p) => serde_json::to_string(p),
Self::GetLog(p) => serde_json::to_string(p),
Self::GetMonitoringReport(p) => serde_json::to_string(p),
Self::GetPeriodicEventStream(p) => serde_json::to_string(p),
Self::GetReport(p) => serde_json::to_string(p),
Self::GetTariffs(p) => serde_json::to_string(p),
Self::GetTransactionStatus(p) => serde_json::to_string(p),
Self::GetVariables(p) => serde_json::to_string(p),
Self::InstallCertificate(p) => serde_json::to_string(p),
Self::NotifyAllowedEnergyTransfer(p) => serde_json::to_string(p),
Self::NotifyWebPaymentStarted(p) => serde_json::to_string(p),
Self::PublishFirmware(p) => serde_json::to_string(p),
Self::RequestBatterySwap(p) => serde_json::to_string(p),
Self::RequestStartTransaction(p) => serde_json::to_string(p),
Self::RequestStopTransaction(p) => serde_json::to_string(p),
Self::ReserveNow(p) => serde_json::to_string(p),
Self::Reset(p) => serde_json::to_string(p),
Self::SendLocalList(p) => serde_json::to_string(p),
Self::SetChargingProfile(p) => serde_json::to_string(p),
Self::SetDERControl(p) => serde_json::to_string(p),
Self::SetDefaultTariff(p) => serde_json::to_string(p),
Self::SetDisplayMessage(p) => serde_json::to_string(p),
Self::SetMonitoringBase(p) => serde_json::to_string(p),
Self::SetMonitoringLevel(p) => serde_json::to_string(p),
Self::SetNetworkProfile(p) => serde_json::to_string(p),
Self::SetVariableMonitoring(p) => serde_json::to_string(p),
Self::SetVariables(p) => serde_json::to_string(p),
Self::TriggerMessage(p) => serde_json::to_string(p),
Self::UnlockConnector(p) => serde_json::to_string(p),
Self::UnpublishFirmware(p) => serde_json::to_string(p),
Self::UpdateDynamicSchedule(p) => serde_json::to_string(p),
Self::UpdateFirmware(p) => serde_json::to_string(p),
Self::UsePriorityCharging(p) => serde_json::to_string(p),
}
}
}
impl Validate for CsmsRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
match self {
Self::AFRRSignal(p) => p.validate_at(path, out),
Self::AdjustPeriodicEventStream(p) => p.validate_at(path, out),
Self::CancelReservation(p) => p.validate_at(path, out),
Self::CertificateSigned(p) => p.validate_at(path, out),
Self::ChangeAvailability(p) => p.validate_at(path, out),
Self::ChangeTransactionTariff(p) => p.validate_at(path, out),
Self::ClearCache(p) => p.validate_at(path, out),
Self::ClearChargingProfile(p) => p.validate_at(path, out),
Self::ClearDERControl(p) => p.validate_at(path, out),
Self::ClearDisplayMessage(p) => p.validate_at(path, out),
Self::ClearTariffs(p) => p.validate_at(path, out),
Self::ClearVariableMonitoring(p) => p.validate_at(path, out),
Self::CostUpdated(p) => p.validate_at(path, out),
Self::CustomerInformation(p) => p.validate_at(path, out),
Self::DataTransfer(p) => p.validate_at(path, out),
Self::DeleteCertificate(p) => p.validate_at(path, out),
Self::GetBaseReport(p) => p.validate_at(path, out),
Self::GetChargingProfiles(p) => p.validate_at(path, out),
Self::GetCompositeSchedule(p) => p.validate_at(path, out),
Self::GetDERControl(p) => p.validate_at(path, out),
Self::GetDisplayMessages(p) => p.validate_at(path, out),
Self::GetInstalledCertificateIds(p) => p.validate_at(path, out),
Self::GetLocalListVersion(p) => p.validate_at(path, out),
Self::GetLog(p) => p.validate_at(path, out),
Self::GetMonitoringReport(p) => p.validate_at(path, out),
Self::GetPeriodicEventStream(p) => p.validate_at(path, out),
Self::GetReport(p) => p.validate_at(path, out),
Self::GetTariffs(p) => p.validate_at(path, out),
Self::GetTransactionStatus(p) => p.validate_at(path, out),
Self::GetVariables(p) => p.validate_at(path, out),
Self::InstallCertificate(p) => p.validate_at(path, out),
Self::NotifyAllowedEnergyTransfer(p) => p.validate_at(path, out),
Self::NotifyWebPaymentStarted(p) => p.validate_at(path, out),
Self::PublishFirmware(p) => p.validate_at(path, out),
Self::RequestBatterySwap(p) => p.validate_at(path, out),
Self::RequestStartTransaction(p) => p.validate_at(path, out),
Self::RequestStopTransaction(p) => p.validate_at(path, out),
Self::ReserveNow(p) => p.validate_at(path, out),
Self::Reset(p) => p.validate_at(path, out),
Self::SendLocalList(p) => p.validate_at(path, out),
Self::SetChargingProfile(p) => p.validate_at(path, out),
Self::SetDERControl(p) => p.validate_at(path, out),
Self::SetDefaultTariff(p) => p.validate_at(path, out),
Self::SetDisplayMessage(p) => p.validate_at(path, out),
Self::SetMonitoringBase(p) => p.validate_at(path, out),
Self::SetMonitoringLevel(p) => p.validate_at(path, out),
Self::SetNetworkProfile(p) => p.validate_at(path, out),
Self::SetVariableMonitoring(p) => p.validate_at(path, out),
Self::SetVariables(p) => p.validate_at(path, out),
Self::TriggerMessage(p) => p.validate_at(path, out),
Self::UnlockConnector(p) => p.validate_at(path, out),
Self::UnpublishFirmware(p) => p.validate_at(path, out),
Self::UpdateDynamicSchedule(p) => p.validate_at(path, out),
Self::UpdateFirmware(p) => p.validate_at(path, out),
Self::UsePriorityCharging(p) => p.validate_at(path, out),
}
}
}
impl serde::Serialize for CsmsRequest {
fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
match self {
Self::AFRRSignal(p) => p.serialize(ser),
Self::AdjustPeriodicEventStream(p) => p.serialize(ser),
Self::CancelReservation(p) => p.serialize(ser),
Self::CertificateSigned(p) => p.serialize(ser),
Self::ChangeAvailability(p) => p.serialize(ser),
Self::ChangeTransactionTariff(p) => p.serialize(ser),
Self::ClearCache(p) => p.serialize(ser),
Self::ClearChargingProfile(p) => p.serialize(ser),
Self::ClearDERControl(p) => p.serialize(ser),
Self::ClearDisplayMessage(p) => p.serialize(ser),
Self::ClearTariffs(p) => p.serialize(ser),
Self::ClearVariableMonitoring(p) => p.serialize(ser),
Self::CostUpdated(p) => p.serialize(ser),
Self::CustomerInformation(p) => p.serialize(ser),
Self::DataTransfer(p) => p.serialize(ser),
Self::DeleteCertificate(p) => p.serialize(ser),
Self::GetBaseReport(p) => p.serialize(ser),
Self::GetChargingProfiles(p) => p.serialize(ser),
Self::GetCompositeSchedule(p) => p.serialize(ser),
Self::GetDERControl(p) => p.serialize(ser),
Self::GetDisplayMessages(p) => p.serialize(ser),
Self::GetInstalledCertificateIds(p) => p.serialize(ser),
Self::GetLocalListVersion(p) => p.serialize(ser),
Self::GetLog(p) => p.serialize(ser),
Self::GetMonitoringReport(p) => p.serialize(ser),
Self::GetPeriodicEventStream(p) => p.serialize(ser),
Self::GetReport(p) => p.serialize(ser),
Self::GetTariffs(p) => p.serialize(ser),
Self::GetTransactionStatus(p) => p.serialize(ser),
Self::GetVariables(p) => p.serialize(ser),
Self::InstallCertificate(p) => p.serialize(ser),
Self::NotifyAllowedEnergyTransfer(p) => p.serialize(ser),
Self::NotifyWebPaymentStarted(p) => p.serialize(ser),
Self::PublishFirmware(p) => p.serialize(ser),
Self::RequestBatterySwap(p) => p.serialize(ser),
Self::RequestStartTransaction(p) => p.serialize(ser),
Self::RequestStopTransaction(p) => p.serialize(ser),
Self::ReserveNow(p) => p.serialize(ser),
Self::Reset(p) => p.serialize(ser),
Self::SendLocalList(p) => p.serialize(ser),
Self::SetChargingProfile(p) => p.serialize(ser),
Self::SetDERControl(p) => p.serialize(ser),
Self::SetDefaultTariff(p) => p.serialize(ser),
Self::SetDisplayMessage(p) => p.serialize(ser),
Self::SetMonitoringBase(p) => p.serialize(ser),
Self::SetMonitoringLevel(p) => p.serialize(ser),
Self::SetNetworkProfile(p) => p.serialize(ser),
Self::SetVariableMonitoring(p) => p.serialize(ser),
Self::SetVariables(p) => p.serialize(ser),
Self::TriggerMessage(p) => p.serialize(ser),
Self::UnlockConnector(p) => p.serialize(ser),
Self::UnpublishFirmware(p) => p.serialize(ser),
Self::UpdateDynamicSchedule(p) => p.serialize(ser),
Self::UpdateFirmware(p) => p.serialize(ser),
Self::UsePriorityCharging(p) => p.serialize(ser),
}
}
}
impl crate::message::Sealed for CsmsRequest {}
impl crate::message::DecodeRequest for CsmsRequest {
type Action = Action;
fn decode_reporting(
action: Action,
payload: &RawValue,
options: &DecodeOptions,
) -> Result<crate::decode::Decoded<Self>, DecodeError> {
CsmsRequest::decode_reporting(action, payload, options)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
#[allow(clippy::large_enum_variant)]
pub enum CsmsResponse {
AFRRSignal(AFRRSignalResponse),
AdjustPeriodicEventStream(AdjustPeriodicEventStreamResponse),
CancelReservation(CancelReservationResponse),
CertificateSigned(CertificateSignedResponse),
ChangeAvailability(ChangeAvailabilityResponse),
ChangeTransactionTariff(ChangeTransactionTariffResponse),
ClearCache(ClearCacheResponse),
ClearChargingProfile(ClearChargingProfileResponse),
ClearDERControl(ClearDERControlResponse),
ClearDisplayMessage(ClearDisplayMessageResponse),
ClearTariffs(ClearTariffsResponse),
ClearVariableMonitoring(ClearVariableMonitoringResponse),
CostUpdated(CostUpdatedResponse),
CustomerInformation(CustomerInformationResponse),
DataTransfer(DataTransferResponse),
DeleteCertificate(DeleteCertificateResponse),
GetBaseReport(GetBaseReportResponse),
GetChargingProfiles(GetChargingProfilesResponse),
GetCompositeSchedule(GetCompositeScheduleResponse),
GetDERControl(GetDERControlResponse),
GetDisplayMessages(GetDisplayMessagesResponse),
GetInstalledCertificateIds(GetInstalledCertificateIdsResponse),
GetLocalListVersion(GetLocalListVersionResponse),
GetLog(GetLogResponse),
GetMonitoringReport(GetMonitoringReportResponse),
GetPeriodicEventStream(GetPeriodicEventStreamResponse),
GetReport(GetReportResponse),
GetTariffs(GetTariffsResponse),
GetTransactionStatus(GetTransactionStatusResponse),
GetVariables(GetVariablesResponse),
InstallCertificate(InstallCertificateResponse),
NotifyAllowedEnergyTransfer(NotifyAllowedEnergyTransferResponse),
NotifyWebPaymentStarted(NotifyWebPaymentStartedResponse),
PublishFirmware(PublishFirmwareResponse),
RequestBatterySwap(RequestBatterySwapResponse),
RequestStartTransaction(RequestStartTransactionResponse),
RequestStopTransaction(RequestStopTransactionResponse),
ReserveNow(ReserveNowResponse),
Reset(ResetResponse),
SendLocalList(SendLocalListResponse),
SetChargingProfile(SetChargingProfileResponse),
SetDERControl(SetDERControlResponse),
SetDefaultTariff(SetDefaultTariffResponse),
SetDisplayMessage(SetDisplayMessageResponse),
SetMonitoringBase(SetMonitoringBaseResponse),
SetMonitoringLevel(SetMonitoringLevelResponse),
SetNetworkProfile(SetNetworkProfileResponse),
SetVariableMonitoring(SetVariableMonitoringResponse),
SetVariables(SetVariablesResponse),
TriggerMessage(TriggerMessageResponse),
UnlockConnector(UnlockConnectorResponse),
UnpublishFirmware(UnpublishFirmwareResponse),
UpdateDynamicSchedule(UpdateDynamicScheduleResponse),
UpdateFirmware(UpdateFirmwareResponse),
UsePriorityCharging(UsePriorityChargingResponse),
}
impl CsmsResponse {
#[must_use]
pub const fn action(&self) -> Action {
match self {
Self::AFRRSignal(_) => Action::AFRRSignal,
Self::AdjustPeriodicEventStream(_) => Action::AdjustPeriodicEventStream,
Self::CancelReservation(_) => Action::CancelReservation,
Self::CertificateSigned(_) => Action::CertificateSigned,
Self::ChangeAvailability(_) => Action::ChangeAvailability,
Self::ChangeTransactionTariff(_) => Action::ChangeTransactionTariff,
Self::ClearCache(_) => Action::ClearCache,
Self::ClearChargingProfile(_) => Action::ClearChargingProfile,
Self::ClearDERControl(_) => Action::ClearDERControl,
Self::ClearDisplayMessage(_) => Action::ClearDisplayMessage,
Self::ClearTariffs(_) => Action::ClearTariffs,
Self::ClearVariableMonitoring(_) => Action::ClearVariableMonitoring,
Self::CostUpdated(_) => Action::CostUpdated,
Self::CustomerInformation(_) => Action::CustomerInformation,
Self::DataTransfer(_) => Action::DataTransfer,
Self::DeleteCertificate(_) => Action::DeleteCertificate,
Self::GetBaseReport(_) => Action::GetBaseReport,
Self::GetChargingProfiles(_) => Action::GetChargingProfiles,
Self::GetCompositeSchedule(_) => Action::GetCompositeSchedule,
Self::GetDERControl(_) => Action::GetDERControl,
Self::GetDisplayMessages(_) => Action::GetDisplayMessages,
Self::GetInstalledCertificateIds(_) => Action::GetInstalledCertificateIds,
Self::GetLocalListVersion(_) => Action::GetLocalListVersion,
Self::GetLog(_) => Action::GetLog,
Self::GetMonitoringReport(_) => Action::GetMonitoringReport,
Self::GetPeriodicEventStream(_) => Action::GetPeriodicEventStream,
Self::GetReport(_) => Action::GetReport,
Self::GetTariffs(_) => Action::GetTariffs,
Self::GetTransactionStatus(_) => Action::GetTransactionStatus,
Self::GetVariables(_) => Action::GetVariables,
Self::InstallCertificate(_) => Action::InstallCertificate,
Self::NotifyAllowedEnergyTransfer(_) => Action::NotifyAllowedEnergyTransfer,
Self::NotifyWebPaymentStarted(_) => Action::NotifyWebPaymentStarted,
Self::PublishFirmware(_) => Action::PublishFirmware,
Self::RequestBatterySwap(_) => Action::RequestBatterySwap,
Self::RequestStartTransaction(_) => Action::RequestStartTransaction,
Self::RequestStopTransaction(_) => Action::RequestStopTransaction,
Self::ReserveNow(_) => Action::ReserveNow,
Self::Reset(_) => Action::Reset,
Self::SendLocalList(_) => Action::SendLocalList,
Self::SetChargingProfile(_) => Action::SetChargingProfile,
Self::SetDERControl(_) => Action::SetDERControl,
Self::SetDefaultTariff(_) => Action::SetDefaultTariff,
Self::SetDisplayMessage(_) => Action::SetDisplayMessage,
Self::SetMonitoringBase(_) => Action::SetMonitoringBase,
Self::SetMonitoringLevel(_) => Action::SetMonitoringLevel,
Self::SetNetworkProfile(_) => Action::SetNetworkProfile,
Self::SetVariableMonitoring(_) => Action::SetVariableMonitoring,
Self::SetVariables(_) => Action::SetVariables,
Self::TriggerMessage(_) => Action::TriggerMessage,
Self::UnlockConnector(_) => Action::UnlockConnector,
Self::UnpublishFirmware(_) => Action::UnpublishFirmware,
Self::UpdateDynamicSchedule(_) => Action::UpdateDynamicSchedule,
Self::UpdateFirmware(_) => Action::UpdateFirmware,
Self::UsePriorityCharging(_) => Action::UsePriorityCharging,
}
}
pub fn decode(
action: Action,
payload: &RawValue,
options: &DecodeOptions,
) -> Result<Self, DecodeError> {
Ok(match action {
Action::AFRRSignal => Self::AFRRSignal(crate::decode::decode_payload::<
AFRRSignalResponse,
>(payload, options)?),
Action::AdjustPeriodicEventStream => {
Self::AdjustPeriodicEventStream(crate::decode::decode_payload::<
AdjustPeriodicEventStreamResponse,
>(payload, options)?)
}
Action::CancelReservation => Self::CancelReservation(crate::decode::decode_payload::<
CancelReservationResponse,
>(payload, options)?),
Action::CertificateSigned => Self::CertificateSigned(crate::decode::decode_payload::<
CertificateSignedResponse,
>(payload, options)?),
Action::ChangeAvailability => Self::ChangeAvailability(
crate::decode::decode_payload::<ChangeAvailabilityResponse>(payload, options)?,
),
Action::ChangeTransactionTariff => {
Self::ChangeTransactionTariff(crate::decode::decode_payload::<
ChangeTransactionTariffResponse,
>(payload, options)?)
}
Action::ClearCache => Self::ClearCache(crate::decode::decode_payload::<
ClearCacheResponse,
>(payload, options)?),
Action::ClearChargingProfile => {
Self::ClearChargingProfile(crate::decode::decode_payload::<
ClearChargingProfileResponse,
>(payload, options)?)
}
Action::ClearDERControl => Self::ClearDERControl(crate::decode::decode_payload::<
ClearDERControlResponse,
>(payload, options)?),
Action::ClearDisplayMessage => {
Self::ClearDisplayMessage(crate::decode::decode_payload::<
ClearDisplayMessageResponse,
>(payload, options)?)
}
Action::ClearTariffs => Self::ClearTariffs(crate::decode::decode_payload::<
ClearTariffsResponse,
>(payload, options)?),
Action::ClearVariableMonitoring => {
Self::ClearVariableMonitoring(crate::decode::decode_payload::<
ClearVariableMonitoringResponse,
>(payload, options)?)
}
Action::CostUpdated => Self::CostUpdated(crate::decode::decode_payload::<
CostUpdatedResponse,
>(payload, options)?),
Action::CustomerInformation => {
Self::CustomerInformation(crate::decode::decode_payload::<
CustomerInformationResponse,
>(payload, options)?)
}
Action::DataTransfer => Self::DataTransfer(crate::decode::decode_payload::<
DataTransferResponse,
>(payload, options)?),
Action::DeleteCertificate => Self::DeleteCertificate(crate::decode::decode_payload::<
DeleteCertificateResponse,
>(payload, options)?),
Action::GetBaseReport => Self::GetBaseReport(crate::decode::decode_payload::<
GetBaseReportResponse,
>(payload, options)?),
Action::GetChargingProfiles => {
Self::GetChargingProfiles(crate::decode::decode_payload::<
GetChargingProfilesResponse,
>(payload, options)?)
}
Action::GetCompositeSchedule => {
Self::GetCompositeSchedule(crate::decode::decode_payload::<
GetCompositeScheduleResponse,
>(payload, options)?)
}
Action::GetDERControl => Self::GetDERControl(crate::decode::decode_payload::<
GetDERControlResponse,
>(payload, options)?),
Action::GetDisplayMessages => Self::GetDisplayMessages(
crate::decode::decode_payload::<GetDisplayMessagesResponse>(payload, options)?,
),
Action::GetInstalledCertificateIds => {
Self::GetInstalledCertificateIds(crate::decode::decode_payload::<
GetInstalledCertificateIdsResponse,
>(payload, options)?)
}
Action::GetLocalListVersion => {
Self::GetLocalListVersion(crate::decode::decode_payload::<
GetLocalListVersionResponse,
>(payload, options)?)
}
Action::GetLog => Self::GetLog(crate::decode::decode_payload::<GetLogResponse>(
payload, options,
)?),
Action::GetMonitoringReport => {
Self::GetMonitoringReport(crate::decode::decode_payload::<
GetMonitoringReportResponse,
>(payload, options)?)
}
Action::GetPeriodicEventStream => {
Self::GetPeriodicEventStream(crate::decode::decode_payload::<
GetPeriodicEventStreamResponse,
>(payload, options)?)
}
Action::GetReport => Self::GetReport(
crate::decode::decode_payload::<GetReportResponse>(payload, options)?,
),
Action::GetTariffs => Self::GetTariffs(crate::decode::decode_payload::<
GetTariffsResponse,
>(payload, options)?),
Action::GetTransactionStatus => {
Self::GetTransactionStatus(crate::decode::decode_payload::<
GetTransactionStatusResponse,
>(payload, options)?)
}
Action::GetVariables => Self::GetVariables(crate::decode::decode_payload::<
GetVariablesResponse,
>(payload, options)?),
Action::InstallCertificate => Self::InstallCertificate(
crate::decode::decode_payload::<InstallCertificateResponse>(payload, options)?,
),
Action::NotifyAllowedEnergyTransfer => {
Self::NotifyAllowedEnergyTransfer(crate::decode::decode_payload::<
NotifyAllowedEnergyTransferResponse,
>(payload, options)?)
}
Action::NotifyWebPaymentStarted => {
Self::NotifyWebPaymentStarted(crate::decode::decode_payload::<
NotifyWebPaymentStartedResponse,
>(payload, options)?)
}
Action::PublishFirmware => Self::PublishFirmware(crate::decode::decode_payload::<
PublishFirmwareResponse,
>(payload, options)?),
Action::RequestBatterySwap => Self::RequestBatterySwap(
crate::decode::decode_payload::<RequestBatterySwapResponse>(payload, options)?,
),
Action::RequestStartTransaction => {
Self::RequestStartTransaction(crate::decode::decode_payload::<
RequestStartTransactionResponse,
>(payload, options)?)
}
Action::RequestStopTransaction => {
Self::RequestStopTransaction(crate::decode::decode_payload::<
RequestStopTransactionResponse,
>(payload, options)?)
}
Action::ReserveNow => Self::ReserveNow(crate::decode::decode_payload::<
ReserveNowResponse,
>(payload, options)?),
Action::Reset => Self::Reset(crate::decode::decode_payload::<ResetResponse>(
payload, options,
)?),
Action::SendLocalList => Self::SendLocalList(crate::decode::decode_payload::<
SendLocalListResponse,
>(payload, options)?),
Action::SetChargingProfile => Self::SetChargingProfile(
crate::decode::decode_payload::<SetChargingProfileResponse>(payload, options)?,
),
Action::SetDERControl => Self::SetDERControl(crate::decode::decode_payload::<
SetDERControlResponse,
>(payload, options)?),
Action::SetDefaultTariff => Self::SetDefaultTariff(crate::decode::decode_payload::<
SetDefaultTariffResponse,
>(payload, options)?),
Action::SetDisplayMessage => Self::SetDisplayMessage(crate::decode::decode_payload::<
SetDisplayMessageResponse,
>(payload, options)?),
Action::SetMonitoringBase => Self::SetMonitoringBase(crate::decode::decode_payload::<
SetMonitoringBaseResponse,
>(payload, options)?),
Action::SetMonitoringLevel => Self::SetMonitoringLevel(
crate::decode::decode_payload::<SetMonitoringLevelResponse>(payload, options)?,
),
Action::SetNetworkProfile => Self::SetNetworkProfile(crate::decode::decode_payload::<
SetNetworkProfileResponse,
>(payload, options)?),
Action::SetVariableMonitoring => {
Self::SetVariableMonitoring(crate::decode::decode_payload::<
SetVariableMonitoringResponse,
>(payload, options)?)
}
Action::SetVariables => Self::SetVariables(crate::decode::decode_payload::<
SetVariablesResponse,
>(payload, options)?),
Action::TriggerMessage => Self::TriggerMessage(crate::decode::decode_payload::<
TriggerMessageResponse,
>(payload, options)?),
Action::UnlockConnector => Self::UnlockConnector(crate::decode::decode_payload::<
UnlockConnectorResponse,
>(payload, options)?),
Action::UnpublishFirmware => Self::UnpublishFirmware(crate::decode::decode_payload::<
UnpublishFirmwareResponse,
>(payload, options)?),
Action::UpdateDynamicSchedule => {
Self::UpdateDynamicSchedule(crate::decode::decode_payload::<
UpdateDynamicScheduleResponse,
>(payload, options)?)
}
Action::UpdateFirmware => Self::UpdateFirmware(crate::decode::decode_payload::<
UpdateFirmwareResponse,
>(payload, options)?),
Action::UsePriorityCharging => {
Self::UsePriorityCharging(crate::decode::decode_payload::<
UsePriorityChargingResponse,
>(payload, options)?)
}
other => return Err(DecodeError::unsupported_action(other.as_str())),
})
}
pub fn to_json(&self) -> Result<alloc::string::String, serde_json::Error> {
match self {
Self::AFRRSignal(p) => serde_json::to_string(p),
Self::AdjustPeriodicEventStream(p) => serde_json::to_string(p),
Self::CancelReservation(p) => serde_json::to_string(p),
Self::CertificateSigned(p) => serde_json::to_string(p),
Self::ChangeAvailability(p) => serde_json::to_string(p),
Self::ChangeTransactionTariff(p) => serde_json::to_string(p),
Self::ClearCache(p) => serde_json::to_string(p),
Self::ClearChargingProfile(p) => serde_json::to_string(p),
Self::ClearDERControl(p) => serde_json::to_string(p),
Self::ClearDisplayMessage(p) => serde_json::to_string(p),
Self::ClearTariffs(p) => serde_json::to_string(p),
Self::ClearVariableMonitoring(p) => serde_json::to_string(p),
Self::CostUpdated(p) => serde_json::to_string(p),
Self::CustomerInformation(p) => serde_json::to_string(p),
Self::DataTransfer(p) => serde_json::to_string(p),
Self::DeleteCertificate(p) => serde_json::to_string(p),
Self::GetBaseReport(p) => serde_json::to_string(p),
Self::GetChargingProfiles(p) => serde_json::to_string(p),
Self::GetCompositeSchedule(p) => serde_json::to_string(p),
Self::GetDERControl(p) => serde_json::to_string(p),
Self::GetDisplayMessages(p) => serde_json::to_string(p),
Self::GetInstalledCertificateIds(p) => serde_json::to_string(p),
Self::GetLocalListVersion(p) => serde_json::to_string(p),
Self::GetLog(p) => serde_json::to_string(p),
Self::GetMonitoringReport(p) => serde_json::to_string(p),
Self::GetPeriodicEventStream(p) => serde_json::to_string(p),
Self::GetReport(p) => serde_json::to_string(p),
Self::GetTariffs(p) => serde_json::to_string(p),
Self::GetTransactionStatus(p) => serde_json::to_string(p),
Self::GetVariables(p) => serde_json::to_string(p),
Self::InstallCertificate(p) => serde_json::to_string(p),
Self::NotifyAllowedEnergyTransfer(p) => serde_json::to_string(p),
Self::NotifyWebPaymentStarted(p) => serde_json::to_string(p),
Self::PublishFirmware(p) => serde_json::to_string(p),
Self::RequestBatterySwap(p) => serde_json::to_string(p),
Self::RequestStartTransaction(p) => serde_json::to_string(p),
Self::RequestStopTransaction(p) => serde_json::to_string(p),
Self::ReserveNow(p) => serde_json::to_string(p),
Self::Reset(p) => serde_json::to_string(p),
Self::SendLocalList(p) => serde_json::to_string(p),
Self::SetChargingProfile(p) => serde_json::to_string(p),
Self::SetDERControl(p) => serde_json::to_string(p),
Self::SetDefaultTariff(p) => serde_json::to_string(p),
Self::SetDisplayMessage(p) => serde_json::to_string(p),
Self::SetMonitoringBase(p) => serde_json::to_string(p),
Self::SetMonitoringLevel(p) => serde_json::to_string(p),
Self::SetNetworkProfile(p) => serde_json::to_string(p),
Self::SetVariableMonitoring(p) => serde_json::to_string(p),
Self::SetVariables(p) => serde_json::to_string(p),
Self::TriggerMessage(p) => serde_json::to_string(p),
Self::UnlockConnector(p) => serde_json::to_string(p),
Self::UnpublishFirmware(p) => serde_json::to_string(p),
Self::UpdateDynamicSchedule(p) => serde_json::to_string(p),
Self::UpdateFirmware(p) => serde_json::to_string(p),
Self::UsePriorityCharging(p) => serde_json::to_string(p),
}
}
}
impl Validate for CsmsResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
match self {
Self::AFRRSignal(p) => p.validate_at(path, out),
Self::AdjustPeriodicEventStream(p) => p.validate_at(path, out),
Self::CancelReservation(p) => p.validate_at(path, out),
Self::CertificateSigned(p) => p.validate_at(path, out),
Self::ChangeAvailability(p) => p.validate_at(path, out),
Self::ChangeTransactionTariff(p) => p.validate_at(path, out),
Self::ClearCache(p) => p.validate_at(path, out),
Self::ClearChargingProfile(p) => p.validate_at(path, out),
Self::ClearDERControl(p) => p.validate_at(path, out),
Self::ClearDisplayMessage(p) => p.validate_at(path, out),
Self::ClearTariffs(p) => p.validate_at(path, out),
Self::ClearVariableMonitoring(p) => p.validate_at(path, out),
Self::CostUpdated(p) => p.validate_at(path, out),
Self::CustomerInformation(p) => p.validate_at(path, out),
Self::DataTransfer(p) => p.validate_at(path, out),
Self::DeleteCertificate(p) => p.validate_at(path, out),
Self::GetBaseReport(p) => p.validate_at(path, out),
Self::GetChargingProfiles(p) => p.validate_at(path, out),
Self::GetCompositeSchedule(p) => p.validate_at(path, out),
Self::GetDERControl(p) => p.validate_at(path, out),
Self::GetDisplayMessages(p) => p.validate_at(path, out),
Self::GetInstalledCertificateIds(p) => p.validate_at(path, out),
Self::GetLocalListVersion(p) => p.validate_at(path, out),
Self::GetLog(p) => p.validate_at(path, out),
Self::GetMonitoringReport(p) => p.validate_at(path, out),
Self::GetPeriodicEventStream(p) => p.validate_at(path, out),
Self::GetReport(p) => p.validate_at(path, out),
Self::GetTariffs(p) => p.validate_at(path, out),
Self::GetTransactionStatus(p) => p.validate_at(path, out),
Self::GetVariables(p) => p.validate_at(path, out),
Self::InstallCertificate(p) => p.validate_at(path, out),
Self::NotifyAllowedEnergyTransfer(p) => p.validate_at(path, out),
Self::NotifyWebPaymentStarted(p) => p.validate_at(path, out),
Self::PublishFirmware(p) => p.validate_at(path, out),
Self::RequestBatterySwap(p) => p.validate_at(path, out),
Self::RequestStartTransaction(p) => p.validate_at(path, out),
Self::RequestStopTransaction(p) => p.validate_at(path, out),
Self::ReserveNow(p) => p.validate_at(path, out),
Self::Reset(p) => p.validate_at(path, out),
Self::SendLocalList(p) => p.validate_at(path, out),
Self::SetChargingProfile(p) => p.validate_at(path, out),
Self::SetDERControl(p) => p.validate_at(path, out),
Self::SetDefaultTariff(p) => p.validate_at(path, out),
Self::SetDisplayMessage(p) => p.validate_at(path, out),
Self::SetMonitoringBase(p) => p.validate_at(path, out),
Self::SetMonitoringLevel(p) => p.validate_at(path, out),
Self::SetNetworkProfile(p) => p.validate_at(path, out),
Self::SetVariableMonitoring(p) => p.validate_at(path, out),
Self::SetVariables(p) => p.validate_at(path, out),
Self::TriggerMessage(p) => p.validate_at(path, out),
Self::UnlockConnector(p) => p.validate_at(path, out),
Self::UnpublishFirmware(p) => p.validate_at(path, out),
Self::UpdateDynamicSchedule(p) => p.validate_at(path, out),
Self::UpdateFirmware(p) => p.validate_at(path, out),
Self::UsePriorityCharging(p) => p.validate_at(path, out),
}
}
}
impl serde::Serialize for CsmsResponse {
fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
match self {
Self::AFRRSignal(p) => p.serialize(ser),
Self::AdjustPeriodicEventStream(p) => p.serialize(ser),
Self::CancelReservation(p) => p.serialize(ser),
Self::CertificateSigned(p) => p.serialize(ser),
Self::ChangeAvailability(p) => p.serialize(ser),
Self::ChangeTransactionTariff(p) => p.serialize(ser),
Self::ClearCache(p) => p.serialize(ser),
Self::ClearChargingProfile(p) => p.serialize(ser),
Self::ClearDERControl(p) => p.serialize(ser),
Self::ClearDisplayMessage(p) => p.serialize(ser),
Self::ClearTariffs(p) => p.serialize(ser),
Self::ClearVariableMonitoring(p) => p.serialize(ser),
Self::CostUpdated(p) => p.serialize(ser),
Self::CustomerInformation(p) => p.serialize(ser),
Self::DataTransfer(p) => p.serialize(ser),
Self::DeleteCertificate(p) => p.serialize(ser),
Self::GetBaseReport(p) => p.serialize(ser),
Self::GetChargingProfiles(p) => p.serialize(ser),
Self::GetCompositeSchedule(p) => p.serialize(ser),
Self::GetDERControl(p) => p.serialize(ser),
Self::GetDisplayMessages(p) => p.serialize(ser),
Self::GetInstalledCertificateIds(p) => p.serialize(ser),
Self::GetLocalListVersion(p) => p.serialize(ser),
Self::GetLog(p) => p.serialize(ser),
Self::GetMonitoringReport(p) => p.serialize(ser),
Self::GetPeriodicEventStream(p) => p.serialize(ser),
Self::GetReport(p) => p.serialize(ser),
Self::GetTariffs(p) => p.serialize(ser),
Self::GetTransactionStatus(p) => p.serialize(ser),
Self::GetVariables(p) => p.serialize(ser),
Self::InstallCertificate(p) => p.serialize(ser),
Self::NotifyAllowedEnergyTransfer(p) => p.serialize(ser),
Self::NotifyWebPaymentStarted(p) => p.serialize(ser),
Self::PublishFirmware(p) => p.serialize(ser),
Self::RequestBatterySwap(p) => p.serialize(ser),
Self::RequestStartTransaction(p) => p.serialize(ser),
Self::RequestStopTransaction(p) => p.serialize(ser),
Self::ReserveNow(p) => p.serialize(ser),
Self::Reset(p) => p.serialize(ser),
Self::SendLocalList(p) => p.serialize(ser),
Self::SetChargingProfile(p) => p.serialize(ser),
Self::SetDERControl(p) => p.serialize(ser),
Self::SetDefaultTariff(p) => p.serialize(ser),
Self::SetDisplayMessage(p) => p.serialize(ser),
Self::SetMonitoringBase(p) => p.serialize(ser),
Self::SetMonitoringLevel(p) => p.serialize(ser),
Self::SetNetworkProfile(p) => p.serialize(ser),
Self::SetVariableMonitoring(p) => p.serialize(ser),
Self::SetVariables(p) => p.serialize(ser),
Self::TriggerMessage(p) => p.serialize(ser),
Self::UnlockConnector(p) => p.serialize(ser),
Self::UnpublishFirmware(p) => p.serialize(ser),
Self::UpdateDynamicSchedule(p) => p.serialize(ser),
Self::UpdateFirmware(p) => p.serialize(ser),
Self::UsePriorityCharging(p) => p.serialize(ser),
}
}
}