#![allow(
unused_imports,
clippy::doc_markdown,
clippy::too_many_lines,
clippy::needless_range_loop,
clippy::similar_names,
clippy::upper_case_acronyms,
clippy::struct_excessive_bools,
clippy::module_name_repetitions,
clippy::enum_variant_names,
clippy::never_loop,
clippy::cast_possible_truncation,
clippy::cast_lossless,
clippy::manual_range_contains,
clippy::useless_conversion,
clippy::unnecessary_cast,
clippy::redundant_closure_for_method_calls,
clippy::wildcard_imports,
clippy::match_same_arms,
clippy::single_match_else,
clippy::large_enum_variant,
clippy::result_large_err,
clippy::unreadable_literal,
clippy::needless_update
)]
use alloc::string::String;
use alloc::vec::Vec;
use crate::exi::seq::{SIMPLE_WIDTH, SeqReader, SeqWriter, Shape, Step};
use crate::exi::{
DateTime, Decimal, Decoder, Encoder, ExiError, ExiResult, Float, Lengths, ValueCoding, ValueCtx,
};
pub const SCHEMA: &str = "V2G_CI_DC";
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BPTDCCPDReqEnergyTransferMode {
pub ev_maximum_charge_power: super::common::RationalNumber,
pub ev_minimum_charge_power: super::common::RationalNumber,
pub ev_maximum_charge_current: super::common::RationalNumber,
pub ev_minimum_charge_current: super::common::RationalNumber,
pub ev_maximum_voltage: super::common::RationalNumber,
pub ev_minimum_voltage: super::common::RationalNumber,
pub target_soc: Option<u8>,
pub ev_maximum_discharge_power: super::common::RationalNumber,
pub ev_minimum_discharge_power: super::common::RationalNumber,
pub ev_maximum_discharge_current: super::common::RationalNumber,
pub ev_minimum_discharge_current: super::common::RationalNumber,
}
impl BPTDCCPDReqEnergyTransferMode {
#[must_use]
pub fn minimal() -> Self {
Self {
ev_maximum_charge_power: super::common::RationalNumber::minimal(),
ev_minimum_charge_power: super::common::RationalNumber::minimal(),
ev_maximum_charge_current: super::common::RationalNumber::minimal(),
ev_minimum_charge_current: super::common::RationalNumber::minimal(),
ev_maximum_voltage: super::common::RationalNumber::minimal(),
ev_minimum_voltage: super::common::RationalNumber::minimal(),
target_soc: None,
ev_maximum_discharge_power: super::common::RationalNumber::minimal(),
ev_minimum_discharge_power: super::common::RationalNumber::minimal(),
ev_maximum_discharge_current: super::common::RationalNumber::minimal(),
ev_minimum_discharge_current: super::common::RationalNumber::minimal(),
}
}
}
impl BPTDCCPDReqEnergyTransferMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
width: &[1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
min: &[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1],
max: &[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
};
}
impl BPTDCCPDReqEnergyTransferMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.ev_maximum_charge_power;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.ev_minimum_charge_power;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
{
let item = &self.ev_maximum_charge_current;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.ev_minimum_charge_current;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.ev_maximum_voltage;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.ev_minimum_voltage;
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
if let Some(item) = &self.target_soc {
w.start(e, 6, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.restricted(i64::from(*item), 0, 100)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(6, 1);
}
{
let item = &self.ev_maximum_discharge_power;
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
{
let item = &self.ev_minimum_discharge_power;
w.start(e, 8, 0)?;
item.encode_body(e)?;
w.finish(8, 1);
}
{
let item = &self.ev_maximum_discharge_current;
w.start(e, 9, 0)?;
item.encode_body(e)?;
w.finish(9, 1);
}
{
let item = &self.ev_minimum_discharge_current;
w.start(e, 10, 0)?;
item.encode_body(e)?;
w.finish(10, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl BPTDCCPDReqEnergyTransferMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
let mut f_7 = None;
let mut f_8 = None;
let mut f_9 = None;
let mut f_10 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u8::try_from(d.restricted(0, 100)?)
.map_err(|_| ExiError::ValueOutOfRange)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_6 = Some(value);
}
Step::Item { index: 7, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_7 = Some(value);
}
Step::Item { index: 8, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_8 = Some(value);
}
Step::Item { index: 9, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_9 = Some(value);
}
Step::Item { index: 10, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_10 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
ev_maximum_charge_power: f_0.ok_or(ExiError::MissingElement)?,
ev_minimum_charge_power: f_1.ok_or(ExiError::MissingElement)?,
ev_maximum_charge_current: f_2.ok_or(ExiError::MissingElement)?,
ev_minimum_charge_current: f_3.ok_or(ExiError::MissingElement)?,
ev_maximum_voltage: f_4.ok_or(ExiError::MissingElement)?,
ev_minimum_voltage: f_5.ok_or(ExiError::MissingElement)?,
target_soc: f_6,
ev_maximum_discharge_power: f_7.ok_or(ExiError::MissingElement)?,
ev_minimum_discharge_power: f_8.ok_or(ExiError::MissingElement)?,
ev_maximum_discharge_current: f_9.ok_or(ExiError::MissingElement)?,
ev_minimum_discharge_current: f_10.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BPTDCCPDResEnergyTransferMode {
pub evse_maximum_charge_power: super::common::RationalNumber,
pub evse_minimum_charge_power: super::common::RationalNumber,
pub evse_maximum_charge_current: super::common::RationalNumber,
pub evse_minimum_charge_current: super::common::RationalNumber,
pub evse_maximum_voltage: super::common::RationalNumber,
pub evse_minimum_voltage: super::common::RationalNumber,
pub evse_power_ramp_limitation: Option<super::common::RationalNumber>,
pub evse_maximum_discharge_power: super::common::RationalNumber,
pub evse_minimum_discharge_power: super::common::RationalNumber,
pub evse_maximum_discharge_current: super::common::RationalNumber,
pub evse_minimum_discharge_current: super::common::RationalNumber,
}
impl BPTDCCPDResEnergyTransferMode {
#[must_use]
pub fn minimal() -> Self {
Self {
evse_maximum_charge_power: super::common::RationalNumber::minimal(),
evse_minimum_charge_power: super::common::RationalNumber::minimal(),
evse_maximum_charge_current: super::common::RationalNumber::minimal(),
evse_minimum_charge_current: super::common::RationalNumber::minimal(),
evse_maximum_voltage: super::common::RationalNumber::minimal(),
evse_minimum_voltage: super::common::RationalNumber::minimal(),
evse_power_ramp_limitation: None,
evse_maximum_discharge_power: super::common::RationalNumber::minimal(),
evse_minimum_discharge_power: super::common::RationalNumber::minimal(),
evse_maximum_discharge_current: super::common::RationalNumber::minimal(),
evse_minimum_discharge_current: super::common::RationalNumber::minimal(),
}
}
}
impl BPTDCCPDResEnergyTransferMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
width: &[1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
min: &[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1],
max: &[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
};
}
impl BPTDCCPDResEnergyTransferMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.evse_maximum_charge_power;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.evse_minimum_charge_power;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
{
let item = &self.evse_maximum_charge_current;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.evse_minimum_charge_current;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.evse_maximum_voltage;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.evse_minimum_voltage;
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
if let Some(item) = &self.evse_power_ramp_limitation {
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
{
let item = &self.evse_maximum_discharge_power;
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
{
let item = &self.evse_minimum_discharge_power;
w.start(e, 8, 0)?;
item.encode_body(e)?;
w.finish(8, 1);
}
{
let item = &self.evse_maximum_discharge_current;
w.start(e, 9, 0)?;
item.encode_body(e)?;
w.finish(9, 1);
}
{
let item = &self.evse_minimum_discharge_current;
w.start(e, 10, 0)?;
item.encode_body(e)?;
w.finish(10, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl BPTDCCPDResEnergyTransferMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
let mut f_7 = None;
let mut f_8 = None;
let mut f_9 = None;
let mut f_10 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_6 = Some(value);
}
Step::Item { index: 7, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_7 = Some(value);
}
Step::Item { index: 8, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_8 = Some(value);
}
Step::Item { index: 9, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_9 = Some(value);
}
Step::Item { index: 10, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_10 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
evse_maximum_charge_power: f_0.ok_or(ExiError::MissingElement)?,
evse_minimum_charge_power: f_1.ok_or(ExiError::MissingElement)?,
evse_maximum_charge_current: f_2.ok_or(ExiError::MissingElement)?,
evse_minimum_charge_current: f_3.ok_or(ExiError::MissingElement)?,
evse_maximum_voltage: f_4.ok_or(ExiError::MissingElement)?,
evse_minimum_voltage: f_5.ok_or(ExiError::MissingElement)?,
evse_power_ramp_limitation: f_6,
evse_maximum_discharge_power: f_7.ok_or(ExiError::MissingElement)?,
evse_minimum_discharge_power: f_8.ok_or(ExiError::MissingElement)?,
evse_maximum_discharge_current: f_9.ok_or(ExiError::MissingElement)?,
evse_minimum_discharge_current: f_10.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BPTDynamicDCCLReqControlMode {
pub departure_time: Option<u32>,
pub ev_target_energy_request: super::common::RationalNumber,
pub ev_maximum_energy_request: super::common::RationalNumber,
pub ev_minimum_energy_request: super::common::RationalNumber,
pub ev_maximum_charge_power: super::common::RationalNumber,
pub ev_minimum_charge_power: super::common::RationalNumber,
pub ev_maximum_charge_current: super::common::RationalNumber,
pub ev_maximum_voltage: super::common::RationalNumber,
pub ev_minimum_voltage: super::common::RationalNumber,
pub ev_maximum_discharge_power: super::common::RationalNumber,
pub ev_minimum_discharge_power: super::common::RationalNumber,
pub ev_maximum_discharge_current: super::common::RationalNumber,
pub ev_maximum_v2_x_energy_request: Option<super::common::RationalNumber>,
pub ev_minimum_v2_x_energy_request: Option<super::common::RationalNumber>,
}
impl BPTDynamicDCCLReqControlMode {
#[must_use]
pub fn minimal() -> Self {
Self {
departure_time: None,
ev_target_energy_request: super::common::RationalNumber::minimal(),
ev_maximum_energy_request: super::common::RationalNumber::minimal(),
ev_minimum_energy_request: super::common::RationalNumber::minimal(),
ev_maximum_charge_power: super::common::RationalNumber::minimal(),
ev_minimum_charge_power: super::common::RationalNumber::minimal(),
ev_maximum_charge_current: super::common::RationalNumber::minimal(),
ev_maximum_voltage: super::common::RationalNumber::minimal(),
ev_minimum_voltage: super::common::RationalNumber::minimal(),
ev_maximum_discharge_power: super::common::RationalNumber::minimal(),
ev_minimum_discharge_power: super::common::RationalNumber::minimal(),
ev_maximum_discharge_current: super::common::RationalNumber::minimal(),
ev_maximum_v2_x_energy_request: None,
ev_minimum_v2_x_energy_request: None,
}
}
}
impl BPTDynamicDCCLReqControlMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
width: &[2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
min: &[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
max: &[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
};
}
impl BPTDynamicDCCLReqControlMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
if let Some(item) = &self.departure_time {
w.start(e, 0, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(0, 1);
}
{
let item = &self.ev_target_energy_request;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
{
let item = &self.ev_maximum_energy_request;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.ev_minimum_energy_request;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.ev_maximum_charge_power;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.ev_minimum_charge_power;
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
{
let item = &self.ev_maximum_charge_current;
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
{
let item = &self.ev_maximum_voltage;
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
{
let item = &self.ev_minimum_voltage;
w.start(e, 8, 0)?;
item.encode_body(e)?;
w.finish(8, 1);
}
{
let item = &self.ev_maximum_discharge_power;
w.start(e, 9, 0)?;
item.encode_body(e)?;
w.finish(9, 1);
}
{
let item = &self.ev_minimum_discharge_power;
w.start(e, 10, 0)?;
item.encode_body(e)?;
w.finish(10, 1);
}
{
let item = &self.ev_maximum_discharge_current;
w.start(e, 11, 0)?;
item.encode_body(e)?;
w.finish(11, 1);
}
if let Some(item) = &self.ev_maximum_v2_x_energy_request {
w.start(e, 12, 0)?;
item.encode_body(e)?;
w.finish(12, 1);
}
if let Some(item) = &self.ev_minimum_v2_x_energy_request {
w.start(e, 13, 0)?;
item.encode_body(e)?;
w.finish(13, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl BPTDynamicDCCLReqControlMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
let mut f_7 = None;
let mut f_8 = None;
let mut f_9 = None;
let mut f_10 = None;
let mut f_11 = None;
let mut f_12 = None;
let mut f_13 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u32::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_6 = Some(value);
}
Step::Item { index: 7, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_7 = Some(value);
}
Step::Item { index: 8, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_8 = Some(value);
}
Step::Item { index: 9, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_9 = Some(value);
}
Step::Item { index: 10, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_10 = Some(value);
}
Step::Item { index: 11, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_11 = Some(value);
}
Step::Item { index: 12, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_12 = Some(value);
}
Step::Item { index: 13, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_13 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
departure_time: f_0,
ev_target_energy_request: f_1.ok_or(ExiError::MissingElement)?,
ev_maximum_energy_request: f_2.ok_or(ExiError::MissingElement)?,
ev_minimum_energy_request: f_3.ok_or(ExiError::MissingElement)?,
ev_maximum_charge_power: f_4.ok_or(ExiError::MissingElement)?,
ev_minimum_charge_power: f_5.ok_or(ExiError::MissingElement)?,
ev_maximum_charge_current: f_6.ok_or(ExiError::MissingElement)?,
ev_maximum_voltage: f_7.ok_or(ExiError::MissingElement)?,
ev_minimum_voltage: f_8.ok_or(ExiError::MissingElement)?,
ev_maximum_discharge_power: f_9.ok_or(ExiError::MissingElement)?,
ev_minimum_discharge_power: f_10.ok_or(ExiError::MissingElement)?,
ev_maximum_discharge_current: f_11.ok_or(ExiError::MissingElement)?,
ev_maximum_v2_x_energy_request: f_12,
ev_minimum_v2_x_energy_request: f_13,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BPTDynamicDCCLResControlMode {
pub departure_time: Option<u32>,
pub minimum_soc: Option<u8>,
pub target_soc: Option<u8>,
pub ack_max_delay: Option<u16>,
pub evse_maximum_charge_power: super::common::RationalNumber,
pub evse_minimum_charge_power: super::common::RationalNumber,
pub evse_maximum_charge_current: super::common::RationalNumber,
pub evse_maximum_voltage: super::common::RationalNumber,
pub evse_maximum_discharge_power: super::common::RationalNumber,
pub evse_minimum_discharge_power: super::common::RationalNumber,
pub evse_maximum_discharge_current: super::common::RationalNumber,
pub evse_minimum_voltage: super::common::RationalNumber,
}
impl BPTDynamicDCCLResControlMode {
#[must_use]
pub fn minimal() -> Self {
Self {
departure_time: None,
minimum_soc: None,
target_soc: None,
ack_max_delay: None,
evse_maximum_charge_power: super::common::RationalNumber::minimal(),
evse_minimum_charge_power: super::common::RationalNumber::minimal(),
evse_maximum_charge_current: super::common::RationalNumber::minimal(),
evse_maximum_voltage: super::common::RationalNumber::minimal(),
evse_maximum_discharge_power: super::common::RationalNumber::minimal(),
evse_minimum_discharge_power: super::common::RationalNumber::minimal(),
evse_maximum_discharge_current: super::common::RationalNumber::minimal(),
evse_minimum_voltage: super::common::RationalNumber::minimal(),
}
}
}
impl BPTDynamicDCCLResControlMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
width: &[3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
min: &[0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1],
max: &[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
};
}
impl BPTDynamicDCCLResControlMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
if let Some(item) = &self.departure_time {
w.start(e, 0, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(0, 1);
}
if let Some(item) = &self.minimum_soc {
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.restricted(i64::from(*item), 0, 100)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
if let Some(item) = &self.target_soc {
w.start(e, 2, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.restricted(i64::from(*item), 0, 100)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(2, 1);
}
if let Some(item) = &self.ack_max_delay {
w.start(e, 3, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(3, 1);
}
{
let item = &self.evse_maximum_charge_power;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.evse_minimum_charge_power;
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
{
let item = &self.evse_maximum_charge_current;
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
{
let item = &self.evse_maximum_voltage;
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
{
let item = &self.evse_maximum_discharge_power;
w.start(e, 8, 0)?;
item.encode_body(e)?;
w.finish(8, 1);
}
{
let item = &self.evse_minimum_discharge_power;
w.start(e, 9, 0)?;
item.encode_body(e)?;
w.finish(9, 1);
}
{
let item = &self.evse_maximum_discharge_current;
w.start(e, 10, 0)?;
item.encode_body(e)?;
w.finish(10, 1);
}
{
let item = &self.evse_minimum_voltage;
w.start(e, 11, 0)?;
item.encode_body(e)?;
w.finish(11, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl BPTDynamicDCCLResControlMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
let mut f_7 = None;
let mut f_8 = None;
let mut f_9 = None;
let mut f_10 = None;
let mut f_11 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u32::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u8::try_from(d.restricted(0, 100)?)
.map_err(|_| ExiError::ValueOutOfRange)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u8::try_from(d.restricted(0, 100)?)
.map_err(|_| ExiError::ValueOutOfRange)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u16::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_6 = Some(value);
}
Step::Item { index: 7, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_7 = Some(value);
}
Step::Item { index: 8, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_8 = Some(value);
}
Step::Item { index: 9, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_9 = Some(value);
}
Step::Item { index: 10, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_10 = Some(value);
}
Step::Item { index: 11, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_11 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
departure_time: f_0,
minimum_soc: f_1,
target_soc: f_2,
ack_max_delay: f_3,
evse_maximum_charge_power: f_4.ok_or(ExiError::MissingElement)?,
evse_minimum_charge_power: f_5.ok_or(ExiError::MissingElement)?,
evse_maximum_charge_current: f_6.ok_or(ExiError::MissingElement)?,
evse_maximum_voltage: f_7.ok_or(ExiError::MissingElement)?,
evse_maximum_discharge_power: f_8.ok_or(ExiError::MissingElement)?,
evse_minimum_discharge_power: f_9.ok_or(ExiError::MissingElement)?,
evse_maximum_discharge_current: f_10.ok_or(ExiError::MissingElement)?,
evse_minimum_voltage: f_11.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BPTScheduledDCCLReqControlMode {
pub ev_target_energy_request: Option<super::common::RationalNumber>,
pub ev_maximum_energy_request: Option<super::common::RationalNumber>,
pub ev_minimum_energy_request: Option<super::common::RationalNumber>,
pub ev_target_current: super::common::RationalNumber,
pub ev_target_voltage: super::common::RationalNumber,
pub ev_maximum_charge_power: Option<super::common::RationalNumber>,
pub ev_minimum_charge_power: Option<super::common::RationalNumber>,
pub ev_maximum_charge_current: Option<super::common::RationalNumber>,
pub ev_maximum_voltage: Option<super::common::RationalNumber>,
pub ev_minimum_voltage: Option<super::common::RationalNumber>,
pub ev_maximum_discharge_power: Option<super::common::RationalNumber>,
pub ev_minimum_discharge_power: Option<super::common::RationalNumber>,
pub ev_maximum_discharge_current: Option<super::common::RationalNumber>,
}
impl BPTScheduledDCCLReqControlMode {
#[must_use]
pub fn minimal() -> Self {
Self {
ev_target_energy_request: None,
ev_maximum_energy_request: None,
ev_minimum_energy_request: None,
ev_target_current: super::common::RationalNumber::minimal(),
ev_target_voltage: super::common::RationalNumber::minimal(),
ev_maximum_charge_power: None,
ev_minimum_charge_power: None,
ev_maximum_charge_current: None,
ev_maximum_voltage: None,
ev_minimum_voltage: None,
ev_maximum_discharge_power: None,
ev_minimum_discharge_power: None,
ev_maximum_discharge_current: None,
}
}
}
impl BPTScheduledDCCLReqControlMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
width: &[3, 2, 2, 1, 1, 4, 4, 3, 3, 3, 3, 2, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
min: &[0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
max: &[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
};
}
impl BPTScheduledDCCLReqControlMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
if let Some(item) = &self.ev_target_energy_request {
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
if let Some(item) = &self.ev_maximum_energy_request {
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
if let Some(item) = &self.ev_minimum_energy_request {
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.ev_target_current;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.ev_target_voltage;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
if let Some(item) = &self.ev_maximum_charge_power {
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
if let Some(item) = &self.ev_minimum_charge_power {
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
if let Some(item) = &self.ev_maximum_charge_current {
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
if let Some(item) = &self.ev_maximum_voltage {
w.start(e, 8, 0)?;
item.encode_body(e)?;
w.finish(8, 1);
}
if let Some(item) = &self.ev_minimum_voltage {
w.start(e, 9, 0)?;
item.encode_body(e)?;
w.finish(9, 1);
}
if let Some(item) = &self.ev_maximum_discharge_power {
w.start(e, 10, 0)?;
item.encode_body(e)?;
w.finish(10, 1);
}
if let Some(item) = &self.ev_minimum_discharge_power {
w.start(e, 11, 0)?;
item.encode_body(e)?;
w.finish(11, 1);
}
if let Some(item) = &self.ev_maximum_discharge_current {
w.start(e, 12, 0)?;
item.encode_body(e)?;
w.finish(12, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl BPTScheduledDCCLReqControlMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
let mut f_7 = None;
let mut f_8 = None;
let mut f_9 = None;
let mut f_10 = None;
let mut f_11 = None;
let mut f_12 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_6 = Some(value);
}
Step::Item { index: 7, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_7 = Some(value);
}
Step::Item { index: 8, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_8 = Some(value);
}
Step::Item { index: 9, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_9 = Some(value);
}
Step::Item { index: 10, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_10 = Some(value);
}
Step::Item { index: 11, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_11 = Some(value);
}
Step::Item { index: 12, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_12 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
ev_target_energy_request: f_0,
ev_maximum_energy_request: f_1,
ev_minimum_energy_request: f_2,
ev_target_current: f_3.ok_or(ExiError::MissingElement)?,
ev_target_voltage: f_4.ok_or(ExiError::MissingElement)?,
ev_maximum_charge_power: f_5,
ev_minimum_charge_power: f_6,
ev_maximum_charge_current: f_7,
ev_maximum_voltage: f_8,
ev_minimum_voltage: f_9,
ev_maximum_discharge_power: f_10,
ev_minimum_discharge_power: f_11,
ev_maximum_discharge_current: f_12,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BPTScheduledDCCLResControlMode {
pub evse_maximum_charge_power: Option<super::common::RationalNumber>,
pub evse_minimum_charge_power: Option<super::common::RationalNumber>,
pub evse_maximum_charge_current: Option<super::common::RationalNumber>,
pub evse_maximum_voltage: Option<super::common::RationalNumber>,
pub evse_maximum_discharge_power: Option<super::common::RationalNumber>,
pub evse_minimum_discharge_power: Option<super::common::RationalNumber>,
pub evse_maximum_discharge_current: Option<super::common::RationalNumber>,
pub evse_minimum_voltage: Option<super::common::RationalNumber>,
}
impl BPTScheduledDCCLResControlMode {
#[must_use]
pub fn minimal() -> Self {
Self {
evse_maximum_charge_power: None,
evse_minimum_charge_power: None,
evse_maximum_charge_current: None,
evse_maximum_voltage: None,
evse_maximum_discharge_power: None,
evse_minimum_discharge_power: None,
evse_maximum_discharge_current: None,
evse_minimum_voltage: None,
}
}
}
impl BPTScheduledDCCLResControlMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8],
width: &[4, 4, 3, 3, 3, 3, 2, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0],
min: &[0, 0, 0, 0, 0, 0, 0, 0],
max: &[1, 1, 1, 1, 1, 1, 1, 1],
};
}
impl BPTScheduledDCCLResControlMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
if let Some(item) = &self.evse_maximum_charge_power {
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
if let Some(item) = &self.evse_minimum_charge_power {
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
if let Some(item) = &self.evse_maximum_charge_current {
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
if let Some(item) = &self.evse_maximum_voltage {
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
if let Some(item) = &self.evse_maximum_discharge_power {
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
if let Some(item) = &self.evse_minimum_discharge_power {
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
if let Some(item) = &self.evse_maximum_discharge_current {
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
if let Some(item) = &self.evse_minimum_voltage {
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl BPTScheduledDCCLResControlMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
let mut f_7 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_6 = Some(value);
}
Step::Item { index: 7, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_7 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
evse_maximum_charge_power: f_0,
evse_minimum_charge_power: f_1,
evse_maximum_charge_current: f_2,
evse_maximum_voltage: f_3,
evse_maximum_discharge_power: f_4,
evse_minimum_discharge_power: f_5,
evse_maximum_discharge_current: f_6,
evse_minimum_voltage: f_7,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCCPDReqEnergyTransferMode {
pub ev_maximum_charge_power: super::common::RationalNumber,
pub ev_minimum_charge_power: super::common::RationalNumber,
pub ev_maximum_charge_current: super::common::RationalNumber,
pub ev_minimum_charge_current: super::common::RationalNumber,
pub ev_maximum_voltage: super::common::RationalNumber,
pub ev_minimum_voltage: super::common::RationalNumber,
pub target_soc: Option<u8>,
}
impl DCCPDReqEnergyTransferMode {
#[must_use]
pub fn minimal() -> Self {
Self {
ev_maximum_charge_power: super::common::RationalNumber::minimal(),
ev_minimum_charge_power: super::common::RationalNumber::minimal(),
ev_maximum_charge_current: super::common::RationalNumber::minimal(),
ev_minimum_charge_current: super::common::RationalNumber::minimal(),
ev_maximum_voltage: super::common::RationalNumber::minimal(),
ev_minimum_voltage: super::common::RationalNumber::minimal(),
target_soc: None,
}
}
}
impl DCCPDReqEnergyTransferMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7],
width: &[1, 1, 1, 1, 1, 1, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0],
min: &[1, 1, 1, 1, 1, 1, 0],
max: &[1, 1, 1, 1, 1, 1, 1],
};
}
impl DCCPDReqEnergyTransferMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.ev_maximum_charge_power;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.ev_minimum_charge_power;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
{
let item = &self.ev_maximum_charge_current;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.ev_minimum_charge_current;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.ev_maximum_voltage;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.ev_minimum_voltage;
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
if let Some(item) = &self.target_soc {
w.start(e, 6, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.restricted(i64::from(*item), 0, 100)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(6, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCCPDReqEnergyTransferMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u8::try_from(d.restricted(0, 100)?)
.map_err(|_| ExiError::ValueOutOfRange)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_6 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
ev_maximum_charge_power: f_0.ok_or(ExiError::MissingElement)?,
ev_minimum_charge_power: f_1.ok_or(ExiError::MissingElement)?,
ev_maximum_charge_current: f_2.ok_or(ExiError::MissingElement)?,
ev_minimum_charge_current: f_3.ok_or(ExiError::MissingElement)?,
ev_maximum_voltage: f_4.ok_or(ExiError::MissingElement)?,
ev_minimum_voltage: f_5.ok_or(ExiError::MissingElement)?,
target_soc: f_6,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCCPDResEnergyTransferMode {
pub evse_maximum_charge_power: super::common::RationalNumber,
pub evse_minimum_charge_power: super::common::RationalNumber,
pub evse_maximum_charge_current: super::common::RationalNumber,
pub evse_minimum_charge_current: super::common::RationalNumber,
pub evse_maximum_voltage: super::common::RationalNumber,
pub evse_minimum_voltage: super::common::RationalNumber,
pub evse_power_ramp_limitation: Option<super::common::RationalNumber>,
}
impl DCCPDResEnergyTransferMode {
#[must_use]
pub fn minimal() -> Self {
Self {
evse_maximum_charge_power: super::common::RationalNumber::minimal(),
evse_minimum_charge_power: super::common::RationalNumber::minimal(),
evse_maximum_charge_current: super::common::RationalNumber::minimal(),
evse_minimum_charge_current: super::common::RationalNumber::minimal(),
evse_maximum_voltage: super::common::RationalNumber::minimal(),
evse_minimum_voltage: super::common::RationalNumber::minimal(),
evse_power_ramp_limitation: None,
}
}
}
impl DCCPDResEnergyTransferMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7],
width: &[1, 1, 1, 1, 1, 1, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0],
min: &[1, 1, 1, 1, 1, 1, 0],
max: &[1, 1, 1, 1, 1, 1, 1],
};
}
impl DCCPDResEnergyTransferMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.evse_maximum_charge_power;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.evse_minimum_charge_power;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
{
let item = &self.evse_maximum_charge_current;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.evse_minimum_charge_current;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.evse_maximum_voltage;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.evse_minimum_voltage;
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
if let Some(item) = &self.evse_power_ramp_limitation {
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCCPDResEnergyTransferMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_6 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
evse_maximum_charge_power: f_0.ok_or(ExiError::MissingElement)?,
evse_minimum_charge_power: f_1.ok_or(ExiError::MissingElement)?,
evse_maximum_charge_current: f_2.ok_or(ExiError::MissingElement)?,
evse_minimum_charge_current: f_3.ok_or(ExiError::MissingElement)?,
evse_maximum_voltage: f_4.ok_or(ExiError::MissingElement)?,
evse_minimum_voltage: f_5.ok_or(ExiError::MissingElement)?,
evse_power_ramp_limitation: f_6,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCCableCheckReq {
pub header: super::common::MessageHeader,
}
impl DCCableCheckReq {
#[must_use]
pub fn minimal() -> Self {
Self { header: super::common::MessageHeader::minimal() }
}
}
impl DCCableCheckReq {
const SHAPE: Shape =
Shape { prod_before: &[0, 1], width: &[1, 1], repeat_width: &[0], min: &[1], max: &[1] };
}
impl DCCableCheckReq {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.header;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCCableCheckReq {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::MessageHeader::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self { header: f_0.ok_or(ExiError::MissingElement)? })
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCCableCheckRes {
pub header: super::common::MessageHeader,
pub response_code: super::common::ResponseCode,
pub evse_processing: super::common::Processing,
}
impl DCCableCheckRes {
#[must_use]
pub fn minimal() -> Self {
Self {
header: super::common::MessageHeader::minimal(),
response_code: super::common::ResponseCode::ALL[0],
evse_processing: super::common::Processing::ALL[0],
}
}
}
impl DCCableCheckRes {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3],
width: &[1, 1, 1, 1],
repeat_width: &[0, 0, 0],
min: &[1, 1, 1],
max: &[1, 1, 1],
};
}
impl DCCableCheckRes {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.header;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.response_code;
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), super::common::ResponseCode::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
{
let item = &self.evse_processing;
w.start(e, 2, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), super::common::Processing::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(2, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCCableCheckRes {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::MessageHeader::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = super::common::ResponseCode::from_index(
d.nbit(super::common::ResponseCode::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = super::common::Processing::from_index(
d.nbit(super::common::Processing::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_2 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
header: f_0.ok_or(ExiError::MissingElement)?,
response_code: f_1.ok_or(ExiError::MissingElement)?,
evse_processing: f_2.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum DCChargeLoopReqChoice {
BPTDynamicDCCLReqControlMode(BPTDynamicDCCLReqControlMode),
BPTScheduledDCCLReqControlMode(BPTScheduledDCCLReqControlMode),
CLReqControlMode(super::common::CLReqControlMode),
DynamicDCCLReqControlMode(DynamicDCCLReqControlMode),
ScheduledDCCLReqControlMode(ScheduledDCCLReqControlMode),
}
impl DCChargeLoopReqChoice {
#[must_use]
pub const fn name(&self) -> &'static str {
match self {
Self::BPTDynamicDCCLReqControlMode(_) => "BPT_Dynamic_DC_CLReqControlMode",
Self::BPTScheduledDCCLReqControlMode(_) => "BPT_Scheduled_DC_CLReqControlMode",
Self::CLReqControlMode(_) => "CLReqControlMode",
Self::DynamicDCCLReqControlMode(_) => "Dynamic_DC_CLReqControlMode",
Self::ScheduledDCCLReqControlMode(_) => "Scheduled_DC_CLReqControlMode",
}
}
#[must_use]
pub fn minimal() -> Self {
Self::BPTDynamicDCCLReqControlMode(BPTDynamicDCCLReqControlMode::minimal())
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCChargeLoopReq {
pub header: super::common::MessageHeader,
pub display_parameters: Option<super::common::DisplayParameters>,
pub meter_info_requested: bool,
pub ev_present_voltage: super::common::RationalNumber,
pub choice: DCChargeLoopReqChoice,
}
impl DCChargeLoopReq {
#[must_use]
pub fn minimal() -> Self {
Self {
header: super::common::MessageHeader::minimal(),
display_parameters: None,
meter_info_requested: false,
ev_present_voltage: super::common::RationalNumber::minimal(),
choice: DCChargeLoopReqChoice::minimal(),
}
}
}
impl DCChargeLoopReq {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 9],
width: &[1, 2, 1, 1, 3, 1],
repeat_width: &[0, 0, 0, 0, 0],
min: &[1, 0, 1, 1, 1],
max: &[1, 1, 1, 1, 1],
};
}
impl DCChargeLoopReq {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.header;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
if let Some(item) = &self.display_parameters {
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
{
let item = &self.meter_info_requested;
w.start(e, 2, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.boolean(*item)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(2, 1);
}
{
let item = &self.ev_present_voltage;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.choice;
match item {
DCChargeLoopReqChoice::BPTDynamicDCCLReqControlMode(value) => {
w.start_branch(e, 4, 0, 0)?;
value.encode_body(e)?;
}
DCChargeLoopReqChoice::BPTScheduledDCCLReqControlMode(value) => {
w.start_branch(e, 4, 0, 1)?;
value.encode_body(e)?;
}
DCChargeLoopReqChoice::CLReqControlMode(value) => {
w.start_branch(e, 4, 0, 2)?;
value.encode_body(e)?;
}
DCChargeLoopReqChoice::DynamicDCCLReqControlMode(value) => {
w.start_branch(e, 4, 0, 3)?;
value.encode_body(e)?;
}
DCChargeLoopReqChoice::ScheduledDCCLReqControlMode(value) => {
w.start_branch(e, 4, 0, 4)?;
value.encode_body(e)?;
}
}
w.finish(4, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCChargeLoopReq {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::MessageHeader::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = super::common::DisplayParameters::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.boolean()?;
d.expect_event(0, SIMPLE_WIDTH)?; f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, branch, .. } => {
let value = match branch {
0 => {
let value = BPTDynamicDCCLReqControlMode::decode_body(d)?;
DCChargeLoopReqChoice::BPTDynamicDCCLReqControlMode(value)
}
1 => {
let value = BPTScheduledDCCLReqControlMode::decode_body(d)?;
DCChargeLoopReqChoice::BPTScheduledDCCLReqControlMode(value)
}
2 => {
let value = super::common::CLReqControlMode::decode_body(d)?;
DCChargeLoopReqChoice::CLReqControlMode(value)
}
3 => {
let value = DynamicDCCLReqControlMode::decode_body(d)?;
DCChargeLoopReqChoice::DynamicDCCLReqControlMode(value)
}
4 => {
let value = ScheduledDCCLReqControlMode::decode_body(d)?;
DCChargeLoopReqChoice::ScheduledDCCLReqControlMode(value)
}
_ => return Err(ExiError::UnknownEventCode),
};
f_4 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
header: f_0.ok_or(ExiError::MissingElement)?,
display_parameters: f_1,
meter_info_requested: f_2.ok_or(ExiError::MissingElement)?,
ev_present_voltage: f_3.ok_or(ExiError::MissingElement)?,
choice: f_4.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum DCChargeLoopResChoice {
BPTDynamicDCCLResControlMode(BPTDynamicDCCLResControlMode),
BPTScheduledDCCLResControlMode(BPTScheduledDCCLResControlMode),
CLResControlMode(super::common::CLResControlMode),
DynamicDCCLResControlMode(DynamicDCCLResControlMode),
ScheduledDCCLResControlMode(ScheduledDCCLResControlMode),
}
impl DCChargeLoopResChoice {
#[must_use]
pub const fn name(&self) -> &'static str {
match self {
Self::BPTDynamicDCCLResControlMode(_) => "BPT_Dynamic_DC_CLResControlMode",
Self::BPTScheduledDCCLResControlMode(_) => "BPT_Scheduled_DC_CLResControlMode",
Self::CLResControlMode(_) => "CLResControlMode",
Self::DynamicDCCLResControlMode(_) => "Dynamic_DC_CLResControlMode",
Self::ScheduledDCCLResControlMode(_) => "Scheduled_DC_CLResControlMode",
}
}
#[must_use]
pub fn minimal() -> Self {
Self::BPTDynamicDCCLResControlMode(BPTDynamicDCCLResControlMode::minimal())
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCChargeLoopRes {
pub header: super::common::MessageHeader,
pub response_code: super::common::ResponseCode,
pub evse_status: Option<super::common::EVSEStatus>,
pub meter_info: Option<super::common::MeterInfo>,
pub receipt: Option<super::common::Receipt>,
pub evse_present_current: super::common::RationalNumber,
pub evse_present_voltage: super::common::RationalNumber,
pub evse_power_limit_achieved: bool,
pub evse_current_limit_achieved: bool,
pub evse_voltage_limit_achieved: bool,
pub choice: DCChargeLoopResChoice,
}
impl DCChargeLoopRes {
#[must_use]
pub fn minimal() -> Self {
Self {
header: super::common::MessageHeader::minimal(),
response_code: super::common::ResponseCode::ALL[0],
evse_status: None,
meter_info: None,
receipt: None,
evse_present_current: super::common::RationalNumber::minimal(),
evse_present_voltage: super::common::RationalNumber::minimal(),
evse_power_limit_achieved: false,
evse_current_limit_achieved: false,
evse_voltage_limit_achieved: false,
choice: DCChargeLoopResChoice::minimal(),
}
}
}
impl DCChargeLoopRes {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15],
width: &[1, 1, 3, 2, 2, 1, 1, 1, 1, 1, 3, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
min: &[1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1],
max: &[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
};
}
impl DCChargeLoopRes {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.header;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.response_code;
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), super::common::ResponseCode::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
if let Some(item) = &self.evse_status {
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
if let Some(item) = &self.meter_info {
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
if let Some(item) = &self.receipt {
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.evse_present_current;
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
{
let item = &self.evse_present_voltage;
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
{
let item = &self.evse_power_limit_achieved;
w.start(e, 7, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.boolean(*item)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(7, 1);
}
{
let item = &self.evse_current_limit_achieved;
w.start(e, 8, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.boolean(*item)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(8, 1);
}
{
let item = &self.evse_voltage_limit_achieved;
w.start(e, 9, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.boolean(*item)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(9, 1);
}
{
let item = &self.choice;
match item {
DCChargeLoopResChoice::BPTDynamicDCCLResControlMode(value) => {
w.start_branch(e, 10, 0, 0)?;
value.encode_body(e)?;
}
DCChargeLoopResChoice::BPTScheduledDCCLResControlMode(value) => {
w.start_branch(e, 10, 0, 1)?;
value.encode_body(e)?;
}
DCChargeLoopResChoice::CLResControlMode(value) => {
w.start_branch(e, 10, 0, 2)?;
value.encode_body(e)?;
}
DCChargeLoopResChoice::DynamicDCCLResControlMode(value) => {
w.start_branch(e, 10, 0, 3)?;
value.encode_body(e)?;
}
DCChargeLoopResChoice::ScheduledDCCLResControlMode(value) => {
w.start_branch(e, 10, 0, 4)?;
value.encode_body(e)?;
}
}
w.finish(10, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCChargeLoopRes {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
let mut f_7 = None;
let mut f_8 = None;
let mut f_9 = None;
let mut f_10 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::MessageHeader::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = super::common::ResponseCode::from_index(
d.nbit(super::common::ResponseCode::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::EVSEStatus::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::MeterInfo::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::Receipt::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_6 = Some(value);
}
Step::Item { index: 7, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.boolean()?;
d.expect_event(0, SIMPLE_WIDTH)?; f_7 = Some(value);
}
Step::Item { index: 8, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.boolean()?;
d.expect_event(0, SIMPLE_WIDTH)?; f_8 = Some(value);
}
Step::Item { index: 9, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.boolean()?;
d.expect_event(0, SIMPLE_WIDTH)?; f_9 = Some(value);
}
Step::Item { index: 10, branch, .. } => {
let value = match branch {
0 => {
let value = BPTDynamicDCCLResControlMode::decode_body(d)?;
DCChargeLoopResChoice::BPTDynamicDCCLResControlMode(value)
}
1 => {
let value = BPTScheduledDCCLResControlMode::decode_body(d)?;
DCChargeLoopResChoice::BPTScheduledDCCLResControlMode(value)
}
2 => {
let value = super::common::CLResControlMode::decode_body(d)?;
DCChargeLoopResChoice::CLResControlMode(value)
}
3 => {
let value = DynamicDCCLResControlMode::decode_body(d)?;
DCChargeLoopResChoice::DynamicDCCLResControlMode(value)
}
4 => {
let value = ScheduledDCCLResControlMode::decode_body(d)?;
DCChargeLoopResChoice::ScheduledDCCLResControlMode(value)
}
_ => return Err(ExiError::UnknownEventCode),
};
f_10 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
header: f_0.ok_or(ExiError::MissingElement)?,
response_code: f_1.ok_or(ExiError::MissingElement)?,
evse_status: f_2,
meter_info: f_3,
receipt: f_4,
evse_present_current: f_5.ok_or(ExiError::MissingElement)?,
evse_present_voltage: f_6.ok_or(ExiError::MissingElement)?,
evse_power_limit_achieved: f_7.ok_or(ExiError::MissingElement)?,
evse_current_limit_achieved: f_8.ok_or(ExiError::MissingElement)?,
evse_voltage_limit_achieved: f_9.ok_or(ExiError::MissingElement)?,
choice: f_10.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum DCChargeParameterDiscoveryReqChoice {
BPTDCCPDReqEnergyTransferMode(BPTDCCPDReqEnergyTransferMode),
DCCPDReqEnergyTransferMode(DCCPDReqEnergyTransferMode),
}
impl DCChargeParameterDiscoveryReqChoice {
#[must_use]
pub const fn name(&self) -> &'static str {
match self {
Self::BPTDCCPDReqEnergyTransferMode(_) => "BPT_DC_CPDReqEnergyTransferMode",
Self::DCCPDReqEnergyTransferMode(_) => "DC_CPDReqEnergyTransferMode",
}
}
#[must_use]
pub fn minimal() -> Self {
Self::BPTDCCPDReqEnergyTransferMode(BPTDCCPDReqEnergyTransferMode::minimal())
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCChargeParameterDiscoveryReq {
pub header: super::common::MessageHeader,
pub choice: DCChargeParameterDiscoveryReqChoice,
}
impl DCChargeParameterDiscoveryReq {
#[must_use]
pub fn minimal() -> Self {
Self {
header: super::common::MessageHeader::minimal(),
choice: DCChargeParameterDiscoveryReqChoice::minimal(),
}
}
}
impl DCChargeParameterDiscoveryReq {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 3],
width: &[1, 2, 1],
repeat_width: &[0, 0],
min: &[1, 1],
max: &[1, 1],
};
}
impl DCChargeParameterDiscoveryReq {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.header;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.choice;
match item {
DCChargeParameterDiscoveryReqChoice::BPTDCCPDReqEnergyTransferMode(value) => {
w.start_branch(e, 1, 0, 0)?;
value.encode_body(e)?;
}
DCChargeParameterDiscoveryReqChoice::DCCPDReqEnergyTransferMode(value) => {
w.start_branch(e, 1, 0, 1)?;
value.encode_body(e)?;
}
}
w.finish(1, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCChargeParameterDiscoveryReq {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::MessageHeader::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, branch, .. } => {
let value = match branch {
0 => {
let value = BPTDCCPDReqEnergyTransferMode::decode_body(d)?;
DCChargeParameterDiscoveryReqChoice::BPTDCCPDReqEnergyTransferMode(
value,
)
}
1 => {
let value = DCCPDReqEnergyTransferMode::decode_body(d)?;
DCChargeParameterDiscoveryReqChoice::DCCPDReqEnergyTransferMode(value)
}
_ => return Err(ExiError::UnknownEventCode),
};
f_1 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
header: f_0.ok_or(ExiError::MissingElement)?,
choice: f_1.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum DCChargeParameterDiscoveryResChoice {
BPTDCCPDResEnergyTransferMode(BPTDCCPDResEnergyTransferMode),
DCCPDResEnergyTransferMode(DCCPDResEnergyTransferMode),
}
impl DCChargeParameterDiscoveryResChoice {
#[must_use]
pub const fn name(&self) -> &'static str {
match self {
Self::BPTDCCPDResEnergyTransferMode(_) => "BPT_DC_CPDResEnergyTransferMode",
Self::DCCPDResEnergyTransferMode(_) => "DC_CPDResEnergyTransferMode",
}
}
#[must_use]
pub fn minimal() -> Self {
Self::BPTDCCPDResEnergyTransferMode(BPTDCCPDResEnergyTransferMode::minimal())
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCChargeParameterDiscoveryRes {
pub header: super::common::MessageHeader,
pub response_code: super::common::ResponseCode,
pub choice: DCChargeParameterDiscoveryResChoice,
}
impl DCChargeParameterDiscoveryRes {
#[must_use]
pub fn minimal() -> Self {
Self {
header: super::common::MessageHeader::minimal(),
response_code: super::common::ResponseCode::ALL[0],
choice: DCChargeParameterDiscoveryResChoice::minimal(),
}
}
}
impl DCChargeParameterDiscoveryRes {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 4],
width: &[1, 1, 2, 1],
repeat_width: &[0, 0, 0],
min: &[1, 1, 1],
max: &[1, 1, 1],
};
}
impl DCChargeParameterDiscoveryRes {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.header;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.response_code;
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), super::common::ResponseCode::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
{
let item = &self.choice;
match item {
DCChargeParameterDiscoveryResChoice::BPTDCCPDResEnergyTransferMode(value) => {
w.start_branch(e, 2, 0, 0)?;
value.encode_body(e)?;
}
DCChargeParameterDiscoveryResChoice::DCCPDResEnergyTransferMode(value) => {
w.start_branch(e, 2, 0, 1)?;
value.encode_body(e)?;
}
}
w.finish(2, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCChargeParameterDiscoveryRes {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::MessageHeader::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = super::common::ResponseCode::from_index(
d.nbit(super::common::ResponseCode::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { index: 2, branch, .. } => {
let value = match branch {
0 => {
let value = BPTDCCPDResEnergyTransferMode::decode_body(d)?;
DCChargeParameterDiscoveryResChoice::BPTDCCPDResEnergyTransferMode(
value,
)
}
1 => {
let value = DCCPDResEnergyTransferMode::decode_body(d)?;
DCChargeParameterDiscoveryResChoice::DCCPDResEnergyTransferMode(value)
}
_ => return Err(ExiError::UnknownEventCode),
};
f_2 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
header: f_0.ok_or(ExiError::MissingElement)?,
response_code: f_1.ok_or(ExiError::MissingElement)?,
choice: f_2.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCPreChargeReq {
pub header: super::common::MessageHeader,
pub ev_processing: super::common::Processing,
pub ev_present_voltage: super::common::RationalNumber,
pub ev_target_voltage: super::common::RationalNumber,
}
impl DCPreChargeReq {
#[must_use]
pub fn minimal() -> Self {
Self {
header: super::common::MessageHeader::minimal(),
ev_processing: super::common::Processing::ALL[0],
ev_present_voltage: super::common::RationalNumber::minimal(),
ev_target_voltage: super::common::RationalNumber::minimal(),
}
}
}
impl DCPreChargeReq {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4],
width: &[1, 1, 1, 1, 1],
repeat_width: &[0, 0, 0, 0],
min: &[1, 1, 1, 1],
max: &[1, 1, 1, 1],
};
}
impl DCPreChargeReq {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.header;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.ev_processing;
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), super::common::Processing::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
{
let item = &self.ev_present_voltage;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.ev_target_voltage;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCPreChargeReq {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::MessageHeader::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = super::common::Processing::from_index(
d.nbit(super::common::Processing::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
header: f_0.ok_or(ExiError::MissingElement)?,
ev_processing: f_1.ok_or(ExiError::MissingElement)?,
ev_present_voltage: f_2.ok_or(ExiError::MissingElement)?,
ev_target_voltage: f_3.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCPreChargeRes {
pub header: super::common::MessageHeader,
pub response_code: super::common::ResponseCode,
pub evse_present_voltage: super::common::RationalNumber,
}
impl DCPreChargeRes {
#[must_use]
pub fn minimal() -> Self {
Self {
header: super::common::MessageHeader::minimal(),
response_code: super::common::ResponseCode::ALL[0],
evse_present_voltage: super::common::RationalNumber::minimal(),
}
}
}
impl DCPreChargeRes {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3],
width: &[1, 1, 1, 1],
repeat_width: &[0, 0, 0],
min: &[1, 1, 1],
max: &[1, 1, 1],
};
}
impl DCPreChargeRes {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.header;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.response_code;
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), super::common::ResponseCode::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
{
let item = &self.evse_present_voltage;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCPreChargeRes {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::MessageHeader::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = super::common::ResponseCode::from_index(
d.nbit(super::common::ResponseCode::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
header: f_0.ok_or(ExiError::MissingElement)?,
response_code: f_1.ok_or(ExiError::MissingElement)?,
evse_present_voltage: f_2.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCWeldingDetectionReq {
pub header: super::common::MessageHeader,
pub ev_processing: super::common::Processing,
}
impl DCWeldingDetectionReq {
#[must_use]
pub fn minimal() -> Self {
Self {
header: super::common::MessageHeader::minimal(),
ev_processing: super::common::Processing::ALL[0],
}
}
}
impl DCWeldingDetectionReq {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2],
width: &[1, 1, 1],
repeat_width: &[0, 0],
min: &[1, 1],
max: &[1, 1],
};
}
impl DCWeldingDetectionReq {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.header;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.ev_processing;
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), super::common::Processing::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCWeldingDetectionReq {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::MessageHeader::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = super::common::Processing::from_index(
d.nbit(super::common::Processing::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
header: f_0.ok_or(ExiError::MissingElement)?,
ev_processing: f_1.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DCWeldingDetectionRes {
pub header: super::common::MessageHeader,
pub response_code: super::common::ResponseCode,
pub evse_present_voltage: super::common::RationalNumber,
}
impl DCWeldingDetectionRes {
#[must_use]
pub fn minimal() -> Self {
Self {
header: super::common::MessageHeader::minimal(),
response_code: super::common::ResponseCode::ALL[0],
evse_present_voltage: super::common::RationalNumber::minimal(),
}
}
}
impl DCWeldingDetectionRes {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3],
width: &[1, 1, 1, 1],
repeat_width: &[0, 0, 0],
min: &[1, 1, 1],
max: &[1, 1, 1],
};
}
impl DCWeldingDetectionRes {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.header;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.response_code;
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), super::common::ResponseCode::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
{
let item = &self.evse_present_voltage;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DCWeldingDetectionRes {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::MessageHeader::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = super::common::ResponseCode::from_index(
d.nbit(super::common::ResponseCode::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
header: f_0.ok_or(ExiError::MissingElement)?,
response_code: f_1.ok_or(ExiError::MissingElement)?,
evse_present_voltage: f_2.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DynamicDCCLReqControlMode {
pub departure_time: Option<u32>,
pub ev_target_energy_request: super::common::RationalNumber,
pub ev_maximum_energy_request: super::common::RationalNumber,
pub ev_minimum_energy_request: super::common::RationalNumber,
pub ev_maximum_charge_power: super::common::RationalNumber,
pub ev_minimum_charge_power: super::common::RationalNumber,
pub ev_maximum_charge_current: super::common::RationalNumber,
pub ev_maximum_voltage: super::common::RationalNumber,
pub ev_minimum_voltage: super::common::RationalNumber,
}
impl DynamicDCCLReqControlMode {
#[must_use]
pub fn minimal() -> Self {
Self {
departure_time: None,
ev_target_energy_request: super::common::RationalNumber::minimal(),
ev_maximum_energy_request: super::common::RationalNumber::minimal(),
ev_minimum_energy_request: super::common::RationalNumber::minimal(),
ev_maximum_charge_power: super::common::RationalNumber::minimal(),
ev_minimum_charge_power: super::common::RationalNumber::minimal(),
ev_maximum_charge_current: super::common::RationalNumber::minimal(),
ev_maximum_voltage: super::common::RationalNumber::minimal(),
ev_minimum_voltage: super::common::RationalNumber::minimal(),
}
}
}
impl DynamicDCCLReqControlMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
width: &[2, 1, 1, 1, 1, 1, 1, 1, 1, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0, 0],
min: &[0, 1, 1, 1, 1, 1, 1, 1, 1],
max: &[1, 1, 1, 1, 1, 1, 1, 1, 1],
};
}
impl DynamicDCCLReqControlMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
if let Some(item) = &self.departure_time {
w.start(e, 0, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(0, 1);
}
{
let item = &self.ev_target_energy_request;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
{
let item = &self.ev_maximum_energy_request;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.ev_minimum_energy_request;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.ev_maximum_charge_power;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.ev_minimum_charge_power;
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
{
let item = &self.ev_maximum_charge_current;
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
{
let item = &self.ev_maximum_voltage;
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
{
let item = &self.ev_minimum_voltage;
w.start(e, 8, 0)?;
item.encode_body(e)?;
w.finish(8, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DynamicDCCLReqControlMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
let mut f_7 = None;
let mut f_8 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u32::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_6 = Some(value);
}
Step::Item { index: 7, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_7 = Some(value);
}
Step::Item { index: 8, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_8 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
departure_time: f_0,
ev_target_energy_request: f_1.ok_or(ExiError::MissingElement)?,
ev_maximum_energy_request: f_2.ok_or(ExiError::MissingElement)?,
ev_minimum_energy_request: f_3.ok_or(ExiError::MissingElement)?,
ev_maximum_charge_power: f_4.ok_or(ExiError::MissingElement)?,
ev_minimum_charge_power: f_5.ok_or(ExiError::MissingElement)?,
ev_maximum_charge_current: f_6.ok_or(ExiError::MissingElement)?,
ev_maximum_voltage: f_7.ok_or(ExiError::MissingElement)?,
ev_minimum_voltage: f_8.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DynamicDCCLResControlMode {
pub departure_time: Option<u32>,
pub minimum_soc: Option<u8>,
pub target_soc: Option<u8>,
pub ack_max_delay: Option<u16>,
pub evse_maximum_charge_power: super::common::RationalNumber,
pub evse_minimum_charge_power: super::common::RationalNumber,
pub evse_maximum_charge_current: super::common::RationalNumber,
pub evse_maximum_voltage: super::common::RationalNumber,
}
impl DynamicDCCLResControlMode {
#[must_use]
pub fn minimal() -> Self {
Self {
departure_time: None,
minimum_soc: None,
target_soc: None,
ack_max_delay: None,
evse_maximum_charge_power: super::common::RationalNumber::minimal(),
evse_minimum_charge_power: super::common::RationalNumber::minimal(),
evse_maximum_charge_current: super::common::RationalNumber::minimal(),
evse_maximum_voltage: super::common::RationalNumber::minimal(),
}
}
}
impl DynamicDCCLResControlMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8],
width: &[3, 3, 2, 2, 1, 1, 1, 1, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0],
min: &[0, 0, 0, 0, 1, 1, 1, 1],
max: &[1, 1, 1, 1, 1, 1, 1, 1],
};
}
impl DynamicDCCLResControlMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
if let Some(item) = &self.departure_time {
w.start(e, 0, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(0, 1);
}
if let Some(item) = &self.minimum_soc {
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.restricted(i64::from(*item), 0, 100)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
if let Some(item) = &self.target_soc {
w.start(e, 2, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.restricted(i64::from(*item), 0, 100)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(2, 1);
}
if let Some(item) = &self.ack_max_delay {
w.start(e, 3, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(3, 1);
}
{
let item = &self.evse_maximum_charge_power;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.evse_minimum_charge_power;
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
{
let item = &self.evse_maximum_charge_current;
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
{
let item = &self.evse_maximum_voltage;
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl DynamicDCCLResControlMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
let mut f_7 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u32::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u8::try_from(d.restricted(0, 100)?)
.map_err(|_| ExiError::ValueOutOfRange)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u8::try_from(d.restricted(0, 100)?)
.map_err(|_| ExiError::ValueOutOfRange)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u16::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_6 = Some(value);
}
Step::Item { index: 7, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_7 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
departure_time: f_0,
minimum_soc: f_1,
target_soc: f_2,
ack_max_delay: f_3,
evse_maximum_charge_power: f_4.ok_or(ExiError::MissingElement)?,
evse_minimum_charge_power: f_5.ok_or(ExiError::MissingElement)?,
evse_maximum_charge_current: f_6.ok_or(ExiError::MissingElement)?,
evse_maximum_voltage: f_7.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ScheduledDCCLReqControlMode {
pub ev_target_energy_request: Option<super::common::RationalNumber>,
pub ev_maximum_energy_request: Option<super::common::RationalNumber>,
pub ev_minimum_energy_request: Option<super::common::RationalNumber>,
pub ev_target_current: super::common::RationalNumber,
pub ev_target_voltage: super::common::RationalNumber,
pub ev_maximum_charge_power: Option<super::common::RationalNumber>,
pub ev_minimum_charge_power: Option<super::common::RationalNumber>,
pub ev_maximum_charge_current: Option<super::common::RationalNumber>,
pub ev_maximum_voltage: Option<super::common::RationalNumber>,
pub ev_minimum_voltage: Option<super::common::RationalNumber>,
}
impl ScheduledDCCLReqControlMode {
#[must_use]
pub fn minimal() -> Self {
Self {
ev_target_energy_request: None,
ev_maximum_energy_request: None,
ev_minimum_energy_request: None,
ev_target_current: super::common::RationalNumber::minimal(),
ev_target_voltage: super::common::RationalNumber::minimal(),
ev_maximum_charge_power: None,
ev_minimum_charge_power: None,
ev_maximum_charge_current: None,
ev_maximum_voltage: None,
ev_minimum_voltage: None,
}
}
}
impl ScheduledDCCLReqControlMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
width: &[3, 2, 2, 1, 1, 3, 3, 3, 2, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
min: &[0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
max: &[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
};
}
impl ScheduledDCCLReqControlMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
if let Some(item) = &self.ev_target_energy_request {
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
if let Some(item) = &self.ev_maximum_energy_request {
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
if let Some(item) = &self.ev_minimum_energy_request {
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.ev_target_current;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.ev_target_voltage;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
if let Some(item) = &self.ev_maximum_charge_power {
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
if let Some(item) = &self.ev_minimum_charge_power {
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
if let Some(item) = &self.ev_maximum_charge_current {
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
if let Some(item) = &self.ev_maximum_voltage {
w.start(e, 8, 0)?;
item.encode_body(e)?;
w.finish(8, 1);
}
if let Some(item) = &self.ev_minimum_voltage {
w.start(e, 9, 0)?;
item.encode_body(e)?;
w.finish(9, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl ScheduledDCCLReqControlMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
let mut f_4 = None;
let mut f_5 = None;
let mut f_6 = None;
let mut f_7 = None;
let mut f_8 = None;
let mut f_9 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_6 = Some(value);
}
Step::Item { index: 7, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_7 = Some(value);
}
Step::Item { index: 8, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_8 = Some(value);
}
Step::Item { index: 9, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_9 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
ev_target_energy_request: f_0,
ev_maximum_energy_request: f_1,
ev_minimum_energy_request: f_2,
ev_target_current: f_3.ok_or(ExiError::MissingElement)?,
ev_target_voltage: f_4.ok_or(ExiError::MissingElement)?,
ev_maximum_charge_power: f_5,
ev_minimum_charge_power: f_6,
ev_maximum_charge_current: f_7,
ev_maximum_voltage: f_8,
ev_minimum_voltage: f_9,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ScheduledDCCLResControlMode {
pub evse_maximum_charge_power: Option<super::common::RationalNumber>,
pub evse_minimum_charge_power: Option<super::common::RationalNumber>,
pub evse_maximum_charge_current: Option<super::common::RationalNumber>,
pub evse_maximum_voltage: Option<super::common::RationalNumber>,
}
impl ScheduledDCCLResControlMode {
#[must_use]
pub fn minimal() -> Self {
Self {
evse_maximum_charge_power: None,
evse_minimum_charge_power: None,
evse_maximum_charge_current: None,
evse_maximum_voltage: None,
}
}
}
impl ScheduledDCCLResControlMode {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4],
width: &[3, 3, 2, 2, 1],
repeat_width: &[0, 0, 0, 0],
min: &[0, 0, 0, 0],
max: &[1, 1, 1, 1],
};
}
impl ScheduledDCCLResControlMode {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
if let Some(item) = &self.evse_maximum_charge_power {
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
if let Some(item) = &self.evse_minimum_charge_power {
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
if let Some(item) = &self.evse_maximum_charge_current {
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
if let Some(item) = &self.evse_maximum_voltage {
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl ScheduledDCCLResControlMode {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = None;
let mut f_1 = None;
let mut f_2 = None;
let mut f_3 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
evse_maximum_charge_power: f_0,
evse_minimum_charge_power: f_1,
evse_maximum_charge_current: f_2,
evse_maximum_voltage: f_3,
})
}
}
pub const DOCUMENT_WIDTH: u32 = 6;
pub const FRAGMENT_WIDTH: u32 = 8;
pub const FRAGMENT_ED_CODE: u64 = 150;
pub const XMLDSIG_FRAGMENT_WIDTH: u32 = 6;
pub const XMLDSIG_FRAGMENT_ED_CODE: u64 = 46;
impl BPTDCCPDReqEnergyTransferMode {
pub const DOCUMENT_CODE: u64 = 0;
}
impl crate::exi::ExiDocument for BPTDCCPDReqEnergyTransferMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl BPTDCCPDResEnergyTransferMode {
pub const DOCUMENT_CODE: u64 = 1;
}
impl crate::exi::ExiDocument for BPTDCCPDResEnergyTransferMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl BPTDynamicDCCLReqControlMode {
pub const DOCUMENT_CODE: u64 = 2;
}
impl crate::exi::ExiDocument for BPTDynamicDCCLReqControlMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl BPTDynamicDCCLResControlMode {
pub const DOCUMENT_CODE: u64 = 3;
}
impl crate::exi::ExiDocument for BPTDynamicDCCLResControlMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl BPTScheduledDCCLReqControlMode {
pub const DOCUMENT_CODE: u64 = 4;
}
impl crate::exi::ExiDocument for BPTScheduledDCCLReqControlMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl BPTScheduledDCCLResControlMode {
pub const DOCUMENT_CODE: u64 = 5;
}
impl crate::exi::ExiDocument for BPTScheduledDCCLResControlMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCCPDReqEnergyTransferMode {
pub const DOCUMENT_CODE: u64 = 9;
}
impl crate::exi::ExiDocument for DCCPDReqEnergyTransferMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCCPDResEnergyTransferMode {
pub const DOCUMENT_CODE: u64 = 10;
}
impl crate::exi::ExiDocument for DCCPDResEnergyTransferMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCCableCheckReq {
pub const DOCUMENT_CODE: u64 = 11;
}
impl crate::exi::ExiDocument for DCCableCheckReq {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCCableCheckRes {
pub const DOCUMENT_CODE: u64 = 12;
}
impl crate::exi::ExiDocument for DCCableCheckRes {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCChargeLoopReq {
pub const DOCUMENT_CODE: u64 = 13;
}
impl crate::exi::ExiDocument for DCChargeLoopReq {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCChargeLoopRes {
pub const DOCUMENT_CODE: u64 = 14;
}
impl crate::exi::ExiDocument for DCChargeLoopRes {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCChargeParameterDiscoveryReq {
pub const DOCUMENT_CODE: u64 = 15;
}
impl crate::exi::ExiDocument for DCChargeParameterDiscoveryReq {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCChargeParameterDiscoveryRes {
pub const DOCUMENT_CODE: u64 = 16;
}
impl crate::exi::ExiDocument for DCChargeParameterDiscoveryRes {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCPreChargeReq {
pub const DOCUMENT_CODE: u64 = 17;
}
impl crate::exi::ExiDocument for DCPreChargeReq {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCPreChargeRes {
pub const DOCUMENT_CODE: u64 = 18;
}
impl crate::exi::ExiDocument for DCPreChargeRes {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCWeldingDetectionReq {
pub const DOCUMENT_CODE: u64 = 19;
}
impl crate::exi::ExiDocument for DCWeldingDetectionReq {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DCWeldingDetectionRes {
pub const DOCUMENT_CODE: u64 = 20;
}
impl crate::exi::ExiDocument for DCWeldingDetectionRes {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DynamicDCCLReqControlMode {
pub const DOCUMENT_CODE: u64 = 24;
}
impl crate::exi::ExiDocument for DynamicDCCLReqControlMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl DynamicDCCLResControlMode {
pub const DOCUMENT_CODE: u64 = 25;
}
impl crate::exi::ExiDocument for DynamicDCCLResControlMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl ScheduledDCCLReqControlMode {
pub const DOCUMENT_CODE: u64 = 37;
}
impl crate::exi::ExiDocument for ScheduledDCCLReqControlMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
impl ScheduledDCCLResControlMode {
pub const DOCUMENT_CODE: u64 = 38;
}
impl crate::exi::ExiDocument for ScheduledDCCLResControlMode {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::DOCUMENT_CODE, DOCUMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.finish()?;
Ok(value)
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[non_exhaustive]
pub enum Document {
BPTDCCPDReqEnergyTransferMode(BPTDCCPDReqEnergyTransferMode),
BPTDCCPDResEnergyTransferMode(BPTDCCPDResEnergyTransferMode),
BPTDynamicDCCLReqControlMode(BPTDynamicDCCLReqControlMode),
BPTDynamicDCCLResControlMode(BPTDynamicDCCLResControlMode),
BPTScheduledDCCLReqControlMode(BPTScheduledDCCLReqControlMode),
BPTScheduledDCCLResControlMode(BPTScheduledDCCLResControlMode),
DCCPDReqEnergyTransferMode(DCCPDReqEnergyTransferMode),
DCCPDResEnergyTransferMode(DCCPDResEnergyTransferMode),
DCCableCheckReq(DCCableCheckReq),
DCCableCheckRes(DCCableCheckRes),
DCChargeLoopReq(DCChargeLoopReq),
DCChargeLoopRes(DCChargeLoopRes),
DCChargeParameterDiscoveryReq(DCChargeParameterDiscoveryReq),
DCChargeParameterDiscoveryRes(DCChargeParameterDiscoveryRes),
DCPreChargeReq(DCPreChargeReq),
DCPreChargeRes(DCPreChargeRes),
DCWeldingDetectionReq(DCWeldingDetectionReq),
DCWeldingDetectionRes(DCWeldingDetectionRes),
DynamicDCCLReqControlMode(DynamicDCCLReqControlMode),
DynamicDCCLResControlMode(DynamicDCCLResControlMode),
ScheduledDCCLReqControlMode(ScheduledDCCLReqControlMode),
ScheduledDCCLResControlMode(ScheduledDCCLResControlMode),
}
impl Document {
#[must_use]
pub const fn name(&self) -> &'static str {
match self {
Self::BPTDCCPDReqEnergyTransferMode(_) => "BPT_DC_CPDReqEnergyTransferMode",
Self::BPTDCCPDResEnergyTransferMode(_) => "BPT_DC_CPDResEnergyTransferMode",
Self::BPTDynamicDCCLReqControlMode(_) => "BPT_Dynamic_DC_CLReqControlMode",
Self::BPTDynamicDCCLResControlMode(_) => "BPT_Dynamic_DC_CLResControlMode",
Self::BPTScheduledDCCLReqControlMode(_) => "BPT_Scheduled_DC_CLReqControlMode",
Self::BPTScheduledDCCLResControlMode(_) => "BPT_Scheduled_DC_CLResControlMode",
Self::DCCPDReqEnergyTransferMode(_) => "DC_CPDReqEnergyTransferMode",
Self::DCCPDResEnergyTransferMode(_) => "DC_CPDResEnergyTransferMode",
Self::DCCableCheckReq(_) => "DC_CableCheckReq",
Self::DCCableCheckRes(_) => "DC_CableCheckRes",
Self::DCChargeLoopReq(_) => "DC_ChargeLoopReq",
Self::DCChargeLoopRes(_) => "DC_ChargeLoopRes",
Self::DCChargeParameterDiscoveryReq(_) => "DC_ChargeParameterDiscoveryReq",
Self::DCChargeParameterDiscoveryRes(_) => "DC_ChargeParameterDiscoveryRes",
Self::DCPreChargeReq(_) => "DC_PreChargeReq",
Self::DCPreChargeRes(_) => "DC_PreChargeRes",
Self::DCWeldingDetectionReq(_) => "DC_WeldingDetectionReq",
Self::DCWeldingDetectionRes(_) => "DC_WeldingDetectionRes",
Self::DynamicDCCLReqControlMode(_) => "Dynamic_DC_CLReqControlMode",
Self::DynamicDCCLResControlMode(_) => "Dynamic_DC_CLResControlMode",
Self::ScheduledDCCLReqControlMode(_) => "Scheduled_DC_CLReqControlMode",
Self::ScheduledDCCLResControlMode(_) => "Scheduled_DC_CLResControlMode",
}
}
#[must_use]
pub const fn code(&self) -> u64 {
match self {
Self::BPTDCCPDReqEnergyTransferMode(_) => 0,
Self::BPTDCCPDResEnergyTransferMode(_) => 1,
Self::BPTDynamicDCCLReqControlMode(_) => 2,
Self::BPTDynamicDCCLResControlMode(_) => 3,
Self::BPTScheduledDCCLReqControlMode(_) => 4,
Self::BPTScheduledDCCLResControlMode(_) => 5,
Self::DCCPDReqEnergyTransferMode(_) => 9,
Self::DCCPDResEnergyTransferMode(_) => 10,
Self::DCCableCheckReq(_) => 11,
Self::DCCableCheckRes(_) => 12,
Self::DCChargeLoopReq(_) => 13,
Self::DCChargeLoopRes(_) => 14,
Self::DCChargeParameterDiscoveryReq(_) => 15,
Self::DCChargeParameterDiscoveryRes(_) => 16,
Self::DCPreChargeReq(_) => 17,
Self::DCPreChargeRes(_) => 18,
Self::DCWeldingDetectionReq(_) => 19,
Self::DCWeldingDetectionRes(_) => 20,
Self::DynamicDCCLReqControlMode(_) => 24,
Self::DynamicDCCLResControlMode(_) => 25,
Self::ScheduledDCCLReqControlMode(_) => 37,
Self::ScheduledDCCLResControlMode(_) => 38,
}
}
}
impl crate::exi::ExiDocument for Document {
fn to_slice_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(self.code(), DOCUMENT_WIDTH)?;
match self {
Self::BPTDCCPDReqEnergyTransferMode(m) => m.encode_body(&mut e)?,
Self::BPTDCCPDResEnergyTransferMode(m) => m.encode_body(&mut e)?,
Self::BPTDynamicDCCLReqControlMode(m) => m.encode_body(&mut e)?,
Self::BPTDynamicDCCLResControlMode(m) => m.encode_body(&mut e)?,
Self::BPTScheduledDCCLReqControlMode(m) => m.encode_body(&mut e)?,
Self::BPTScheduledDCCLResControlMode(m) => m.encode_body(&mut e)?,
Self::DCCPDReqEnergyTransferMode(m) => m.encode_body(&mut e)?,
Self::DCCPDResEnergyTransferMode(m) => m.encode_body(&mut e)?,
Self::DCCableCheckReq(m) => m.encode_body(&mut e)?,
Self::DCCableCheckRes(m) => m.encode_body(&mut e)?,
Self::DCChargeLoopReq(m) => m.encode_body(&mut e)?,
Self::DCChargeLoopRes(m) => m.encode_body(&mut e)?,
Self::DCChargeParameterDiscoveryReq(m) => m.encode_body(&mut e)?,
Self::DCChargeParameterDiscoveryRes(m) => m.encode_body(&mut e)?,
Self::DCPreChargeReq(m) => m.encode_body(&mut e)?,
Self::DCPreChargeRes(m) => m.encode_body(&mut e)?,
Self::DCWeldingDetectionReq(m) => m.encode_body(&mut e)?,
Self::DCWeldingDetectionRes(m) => m.encode_body(&mut e)?,
Self::DynamicDCCLReqControlMode(m) => m.encode_body(&mut e)?,
Self::DynamicDCCLResControlMode(m) => m.encode_body(&mut e)?,
Self::ScheduledDCCLReqControlMode(m) => m.encode_body(&mut e)?,
Self::ScheduledDCCLResControlMode(m) => m.encode_body(&mut e)?,
}
e.finish()
}
fn from_bytes(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
let value = match d.event(DOCUMENT_WIDTH)? {
0 => Self::BPTDCCPDReqEnergyTransferMode(BPTDCCPDReqEnergyTransferMode::decode_body(
&mut d,
)?),
1 => Self::BPTDCCPDResEnergyTransferMode(BPTDCCPDResEnergyTransferMode::decode_body(
&mut d,
)?),
2 => Self::BPTDynamicDCCLReqControlMode(BPTDynamicDCCLReqControlMode::decode_body(
&mut d,
)?),
3 => Self::BPTDynamicDCCLResControlMode(BPTDynamicDCCLResControlMode::decode_body(
&mut d,
)?),
4 => Self::BPTScheduledDCCLReqControlMode(BPTScheduledDCCLReqControlMode::decode_body(
&mut d,
)?),
5 => Self::BPTScheduledDCCLResControlMode(BPTScheduledDCCLResControlMode::decode_body(
&mut d,
)?),
9 => Self::DCCPDReqEnergyTransferMode(DCCPDReqEnergyTransferMode::decode_body(&mut d)?),
10 => {
Self::DCCPDResEnergyTransferMode(DCCPDResEnergyTransferMode::decode_body(&mut d)?)
}
11 => Self::DCCableCheckReq(DCCableCheckReq::decode_body(&mut d)?),
12 => Self::DCCableCheckRes(DCCableCheckRes::decode_body(&mut d)?),
13 => Self::DCChargeLoopReq(DCChargeLoopReq::decode_body(&mut d)?),
14 => Self::DCChargeLoopRes(DCChargeLoopRes::decode_body(&mut d)?),
15 => Self::DCChargeParameterDiscoveryReq(DCChargeParameterDiscoveryReq::decode_body(
&mut d,
)?),
16 => Self::DCChargeParameterDiscoveryRes(DCChargeParameterDiscoveryRes::decode_body(
&mut d,
)?),
17 => Self::DCPreChargeReq(DCPreChargeReq::decode_body(&mut d)?),
18 => Self::DCPreChargeRes(DCPreChargeRes::decode_body(&mut d)?),
19 => Self::DCWeldingDetectionReq(DCWeldingDetectionReq::decode_body(&mut d)?),
20 => Self::DCWeldingDetectionRes(DCWeldingDetectionRes::decode_body(&mut d)?),
24 => Self::DynamicDCCLReqControlMode(DynamicDCCLReqControlMode::decode_body(&mut d)?),
25 => Self::DynamicDCCLResControlMode(DynamicDCCLResControlMode::decode_body(&mut d)?),
37 => {
Self::ScheduledDCCLReqControlMode(ScheduledDCCLReqControlMode::decode_body(&mut d)?)
}
38 => {
Self::ScheduledDCCLResControlMode(ScheduledDCCLResControlMode::decode_body(&mut d)?)
}
_ => return Err(ExiError::UnknownEventCode),
};
d.finish()?;
Ok(value)
}
}
impl Document {
#[must_use]
pub const fn header(&self) -> Option<&super::common::MessageHeader> {
match self {
Self::DCCableCheckReq(m) => Some(&m.header),
Self::DCCableCheckRes(m) => Some(&m.header),
Self::DCChargeLoopReq(m) => Some(&m.header),
Self::DCChargeLoopRes(m) => Some(&m.header),
Self::DCChargeParameterDiscoveryReq(m) => Some(&m.header),
Self::DCChargeParameterDiscoveryRes(m) => Some(&m.header),
Self::DCPreChargeReq(m) => Some(&m.header),
Self::DCPreChargeRes(m) => Some(&m.header),
Self::DCWeldingDetectionReq(m) => Some(&m.header),
Self::DCWeldingDetectionRes(m) => Some(&m.header),
_ => None,
}
}
pub const fn header_mut(&mut self) -> Option<&mut super::common::MessageHeader> {
match self {
Self::DCCableCheckReq(m) => Some(&mut m.header),
Self::DCCableCheckRes(m) => Some(&mut m.header),
Self::DCChargeLoopReq(m) => Some(&mut m.header),
Self::DCChargeLoopRes(m) => Some(&mut m.header),
Self::DCChargeParameterDiscoveryReq(m) => Some(&mut m.header),
Self::DCChargeParameterDiscoveryRes(m) => Some(&mut m.header),
Self::DCPreChargeReq(m) => Some(&mut m.header),
Self::DCPreChargeRes(m) => Some(&mut m.header),
Self::DCWeldingDetectionReq(m) => Some(&mut m.header),
Self::DCWeldingDetectionRes(m) => Some(&mut m.header),
_ => None,
}
}
}
impl Document {
#[must_use]
pub const fn response_code(&self) -> Option<super::common::ResponseCode> {
match self {
Self::DCCableCheckRes(m) => Some(m.response_code),
Self::DCChargeLoopRes(m) => Some(m.response_code),
Self::DCChargeParameterDiscoveryRes(m) => Some(m.response_code),
Self::DCPreChargeRes(m) => Some(m.response_code),
Self::DCWeldingDetectionRes(m) => Some(m.response_code),
_ => None,
}
}
}
impl Document {
#[must_use]
pub fn refusal(&self, code: super::common::ResponseCode) -> Option<Self> {
Some(match self {
Self::DCCableCheckReq(_) => Self::DCCableCheckRes(DCCableCheckRes {
response_code: code,
..DCCableCheckRes::minimal()
}),
Self::DCChargeLoopReq(_) => Self::DCChargeLoopRes(DCChargeLoopRes {
response_code: code,
..DCChargeLoopRes::minimal()
}),
Self::DCChargeParameterDiscoveryReq(_) => {
Self::DCChargeParameterDiscoveryRes(DCChargeParameterDiscoveryRes {
response_code: code,
..DCChargeParameterDiscoveryRes::minimal()
})
}
Self::DCPreChargeReq(_) => Self::DCPreChargeRes(DCPreChargeRes {
response_code: code,
..DCPreChargeRes::minimal()
}),
Self::DCWeldingDetectionReq(_) => Self::DCWeldingDetectionRes(DCWeldingDetectionRes {
response_code: code,
..DCWeldingDetectionRes::minimal()
}),
_ => return None,
})
}
}
impl Document {
#[must_use]
pub const fn fragment_code(&self) -> u64 {
match self {
Self::BPTDCCPDReqEnergyTransferMode(_) => 3,
Self::BPTDCCPDResEnergyTransferMode(_) => 4,
Self::BPTDynamicDCCLReqControlMode(_) => 6,
Self::BPTDynamicDCCLResControlMode(_) => 7,
Self::BPTScheduledDCCLReqControlMode(_) => 9,
Self::BPTScheduledDCCLResControlMode(_) => 10,
Self::DCCPDReqEnergyTransferMode(_) => 19,
Self::DCCPDResEnergyTransferMode(_) => 20,
Self::DCCableCheckReq(_) => 21,
Self::DCCableCheckRes(_) => 22,
Self::DCChargeLoopReq(_) => 23,
Self::DCChargeLoopRes(_) => 24,
Self::DCChargeParameterDiscoveryReq(_) => 25,
Self::DCChargeParameterDiscoveryRes(_) => 26,
Self::DCPreChargeReq(_) => 27,
Self::DCPreChargeRes(_) => 28,
Self::DCWeldingDetectionReq(_) => 29,
Self::DCWeldingDetectionRes(_) => 30,
Self::DynamicDCCLReqControlMode(_) => 36,
Self::DynamicDCCLResControlMode(_) => 37,
Self::ScheduledDCCLReqControlMode(_) => 120,
Self::ScheduledDCCLResControlMode(_) => 121,
}
}
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(self.fragment_code(), FRAGMENT_WIDTH)?;
match self {
Self::BPTDCCPDReqEnergyTransferMode(m) => m.encode_body(&mut e)?,
Self::BPTDCCPDResEnergyTransferMode(m) => m.encode_body(&mut e)?,
Self::BPTDynamicDCCLReqControlMode(m) => m.encode_body(&mut e)?,
Self::BPTDynamicDCCLResControlMode(m) => m.encode_body(&mut e)?,
Self::BPTScheduledDCCLReqControlMode(m) => m.encode_body(&mut e)?,
Self::BPTScheduledDCCLResControlMode(m) => m.encode_body(&mut e)?,
Self::DCCPDReqEnergyTransferMode(m) => m.encode_body(&mut e)?,
Self::DCCPDResEnergyTransferMode(m) => m.encode_body(&mut e)?,
Self::DCCableCheckReq(m) => m.encode_body(&mut e)?,
Self::DCCableCheckRes(m) => m.encode_body(&mut e)?,
Self::DCChargeLoopReq(m) => m.encode_body(&mut e)?,
Self::DCChargeLoopRes(m) => m.encode_body(&mut e)?,
Self::DCChargeParameterDiscoveryReq(m) => m.encode_body(&mut e)?,
Self::DCChargeParameterDiscoveryRes(m) => m.encode_body(&mut e)?,
Self::DCPreChargeReq(m) => m.encode_body(&mut e)?,
Self::DCPreChargeRes(m) => m.encode_body(&mut e)?,
Self::DCWeldingDetectionReq(m) => m.encode_body(&mut e)?,
Self::DCWeldingDetectionRes(m) => m.encode_body(&mut e)?,
Self::DynamicDCCLReqControlMode(m) => m.encode_body(&mut e)?,
Self::DynamicDCCLResControlMode(m) => m.encode_body(&mut e)?,
Self::ScheduledDCCLReqControlMode(m) => m.encode_body(&mut e)?,
Self::ScheduledDCCLResControlMode(m) => m.encode_body(&mut e)?,
}
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
let value = match d.event(FRAGMENT_WIDTH)? {
3 => Self::BPTDCCPDReqEnergyTransferMode(BPTDCCPDReqEnergyTransferMode::decode_body(
&mut d,
)?),
4 => Self::BPTDCCPDResEnergyTransferMode(BPTDCCPDResEnergyTransferMode::decode_body(
&mut d,
)?),
6 => Self::BPTDynamicDCCLReqControlMode(BPTDynamicDCCLReqControlMode::decode_body(
&mut d,
)?),
7 => Self::BPTDynamicDCCLResControlMode(BPTDynamicDCCLResControlMode::decode_body(
&mut d,
)?),
9 => Self::BPTScheduledDCCLReqControlMode(BPTScheduledDCCLReqControlMode::decode_body(
&mut d,
)?),
10 => Self::BPTScheduledDCCLResControlMode(
BPTScheduledDCCLResControlMode::decode_body(&mut d)?,
),
19 => {
Self::DCCPDReqEnergyTransferMode(DCCPDReqEnergyTransferMode::decode_body(&mut d)?)
}
20 => {
Self::DCCPDResEnergyTransferMode(DCCPDResEnergyTransferMode::decode_body(&mut d)?)
}
21 => Self::DCCableCheckReq(DCCableCheckReq::decode_body(&mut d)?),
22 => Self::DCCableCheckRes(DCCableCheckRes::decode_body(&mut d)?),
23 => Self::DCChargeLoopReq(DCChargeLoopReq::decode_body(&mut d)?),
24 => Self::DCChargeLoopRes(DCChargeLoopRes::decode_body(&mut d)?),
25 => Self::DCChargeParameterDiscoveryReq(DCChargeParameterDiscoveryReq::decode_body(
&mut d,
)?),
26 => Self::DCChargeParameterDiscoveryRes(DCChargeParameterDiscoveryRes::decode_body(
&mut d,
)?),
27 => Self::DCPreChargeReq(DCPreChargeReq::decode_body(&mut d)?),
28 => Self::DCPreChargeRes(DCPreChargeRes::decode_body(&mut d)?),
29 => Self::DCWeldingDetectionReq(DCWeldingDetectionReq::decode_body(&mut d)?),
30 => Self::DCWeldingDetectionRes(DCWeldingDetectionRes::decode_body(&mut d)?),
36 => Self::DynamicDCCLReqControlMode(DynamicDCCLReqControlMode::decode_body(&mut d)?),
37 => Self::DynamicDCCLResControlMode(DynamicDCCLResControlMode::decode_body(&mut d)?),
120 => {
Self::ScheduledDCCLReqControlMode(ScheduledDCCLReqControlMode::decode_body(&mut d)?)
}
121 => {
Self::ScheduledDCCLResControlMode(ScheduledDCCLResControlMode::decode_body(&mut d)?)
}
_ => return Err(ExiError::UnknownEventCode),
};
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl BPTDCCPDReqEnergyTransferMode {
pub const FRAGMENT_CODE: u64 = 3;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl BPTDCCPDResEnergyTransferMode {
pub const FRAGMENT_CODE: u64 = 4;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl BPTDynamicDCCLReqControlMode {
pub const FRAGMENT_CODE: u64 = 6;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl BPTDynamicDCCLResControlMode {
pub const FRAGMENT_CODE: u64 = 7;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl BPTScheduledDCCLReqControlMode {
pub const FRAGMENT_CODE: u64 = 9;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl BPTScheduledDCCLResControlMode {
pub const FRAGMENT_CODE: u64 = 10;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCCPDReqEnergyTransferMode {
pub const FRAGMENT_CODE: u64 = 19;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCCPDResEnergyTransferMode {
pub const FRAGMENT_CODE: u64 = 20;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCCableCheckReq {
pub const FRAGMENT_CODE: u64 = 21;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCCableCheckRes {
pub const FRAGMENT_CODE: u64 = 22;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCChargeLoopReq {
pub const FRAGMENT_CODE: u64 = 23;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCChargeLoopRes {
pub const FRAGMENT_CODE: u64 = 24;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCChargeParameterDiscoveryReq {
pub const FRAGMENT_CODE: u64 = 25;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCChargeParameterDiscoveryRes {
pub const FRAGMENT_CODE: u64 = 26;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCPreChargeReq {
pub const FRAGMENT_CODE: u64 = 27;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCPreChargeRes {
pub const FRAGMENT_CODE: u64 = 28;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCWeldingDetectionReq {
pub const FRAGMENT_CODE: u64 = 29;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DCWeldingDetectionRes {
pub const FRAGMENT_CODE: u64 = 30;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DynamicDCCLReqControlMode {
pub const FRAGMENT_CODE: u64 = 36;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl DynamicDCCLResControlMode {
pub const FRAGMENT_CODE: u64 = 37;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl ScheduledDCCLReqControlMode {
pub const FRAGMENT_CODE: u64 = 120;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl ScheduledDCCLResControlMode {
pub const FRAGMENT_CODE: u64 = 121;
pub fn encode_fragment_with(&self, buf: &mut [u8], coding: ValueCoding) -> ExiResult<usize> {
let mut e = Encoder::with_value_coding(buf, coding);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
self.encode_body(&mut e)?;
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
self.encode_fragment_with(buf, ValueCoding::Literal)
}
pub fn to_fragment_with(&self, coding: ValueCoding) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment_with(buf, coding))
}
pub fn to_fragment(&self) -> ExiResult<Vec<u8>> {
crate::exi::encode_growing(|buf| self.encode_fragment(buf))
}
pub fn from_fragment(bytes: &[u8]) -> ExiResult<Self> {
let mut d = Decoder::new(bytes);
d.read_header()?;
d.expect_event(Self::FRAGMENT_CODE, FRAGMENT_WIDTH)?;
let value = Self::decode_body(&mut d)?;
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}