#![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
)]
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, ValueCtx,
};
pub const SCHEMA: &str = "V2G_CI_WPT";
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct AlternativeSECCList {
pub alternative_secc: Vec<AlternativeSECC>,
}
impl AlternativeSECCList {
const SHAPE: Shape =
Shape { prod_before: &[0, 1], width: &[1, 1], repeat_width: &[2], min: &[1], max: &[8] };
}
impl AlternativeSECCList {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let items = &self.alternative_secc;
let count = items.len() as u32;
if count < 1 || count > 8 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 0, c as u32)?;
item.encode_body(e)?;
}
if count > 0 {
w.finish(0, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl AlternativeSECCList {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = Vec::new();
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
let value = AlternativeSECC::decode_body(d)?;
f_0.push(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
alternative_secc: {
if (f_0.len() as u32) < 1 {
return Err(ExiError::MissingElement);
}
f_0
},
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct AlternativeSECC {
pub ss_id: Option<String>,
pub bss_id: Option<String>,
pub ip_address: Option<String>,
pub port: Option<u16>,
}
impl AlternativeSECC {
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 AlternativeSECC {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
if let Some(item) = &self.ss_id {
w.start(e, 0, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.string(ValueCtx(120), item, Lengths::max(255))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(0, 1);
}
if let Some(item) = &self.bss_id {
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.string(ValueCtx(8), item, Lengths::max(12))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
if let Some(item) = &self.ip_address {
w.start(e, 2, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.string(ValueCtx(51), item, Lengths::max(39))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(2, 1);
}
if let Some(item) = &self.port {
w.start(e, 3, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(3, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl AlternativeSECC {
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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.string(ValueCtx(120), Lengths::max(255))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.string(ValueCtx(8), Lengths::max(12))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.string(ValueCtx(51), Lengths::max(39))?;
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 { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self { ss_id: f_0, bss_id: f_1, ip_address: f_2, port: f_3 })
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTAlignmentCheckMethodList {
pub wpt_alignment_check_method: Vec<WPTAlignmentCheckMethod>,
}
impl WPTAlignmentCheckMethodList {
const SHAPE: Shape =
Shape { prod_before: &[0, 1], width: &[1, 1], repeat_width: &[2], min: &[1], max: &[8] };
}
impl WPTAlignmentCheckMethodList {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let items = &self.wpt_alignment_check_method;
let count = items.len() as u32;
if count < 1 || count > 8 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 0, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), WPTAlignmentCheckMethod::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(0, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTAlignmentCheckMethodList {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = Vec::new();
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = WPTAlignmentCheckMethod::from_index(
d.nbit(WPTAlignmentCheckMethod::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_0.push(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
wpt_alignment_check_method: {
if (f_0.len() as u32) < 1 {
return Err(ExiError::MissingElement);
}
f_0
},
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(u16)]
pub enum WPTAlignmentCheckMethod {
PowerCheck = 0,
LPE = 1,
Proprietary = 2,
}
impl WPTAlignmentCheckMethod {
pub const WIDTH: u32 = 2;
pub const ALL: [Self; 3] = [Self::PowerCheck, Self::LPE, Self::Proprietary];
#[must_use]
pub const fn as_index(self) -> u64 {
self as u64
}
pub const fn from_index(index: u64) -> ExiResult<Self> {
Ok(match index {
0 => Self::PowerCheck,
1 => Self::LPE,
2 => Self::Proprietary,
_ => return Err(ExiError::UnknownEnumValue),
})
}
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::PowerCheck => "PowerCheck",
Self::LPE => "LPE",
Self::Proprietary => "Proprietary",
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTAlignmentCheckReq {
pub header: super::common::MessageHeader,
pub ev_processing: super::common::Processing,
pub target_coil_current: Option<super::common::RationalNumber>,
pub ev_result_code: WPTEVResult,
pub vendor_specific_data_container: Vec<Vec<u8>>,
}
impl WPTAlignmentCheckReq {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5],
width: &[1, 1, 2, 1, 2, 1],
repeat_width: &[0, 0, 0, 0, 2],
min: &[1, 1, 0, 1, 0],
max: &[1, 1, 1, 1, 16],
};
}
impl WPTAlignmentCheckReq {
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);
}
if let Some(item) = &self.target_coil_current {
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.ev_result_code;
w.start(e, 3, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), WPTEVResult::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(3, 1);
}
{
let items = &self.vendor_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 4, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(4, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTAlignmentCheckReq {
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 = Vec::new();
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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = WPTEVResult::from_index(d.nbit(WPTEVResult::WIDTH)?)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_4.push(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)?,
target_coil_current: f_2,
ev_result_code: f_3.ok_or(ExiError::MissingElement)?,
vendor_specific_data_container: f_4,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTAlignmentCheckRes {
pub header: super::common::MessageHeader,
pub response_code: super::common::ResponseCode,
pub evse_processing: super::common::Processing,
pub power_transmitted: Option<super::common::RationalNumber>,
pub supply_device_current: Option<super::common::RationalNumber>,
pub vendor_specific_data_container: Vec<Vec<u8>>,
}
impl WPTAlignmentCheckRes {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6],
width: &[1, 1, 1, 3, 2, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 2],
min: &[1, 1, 1, 0, 0, 0],
max: &[1, 1, 1, 1, 1, 16],
};
}
impl WPTAlignmentCheckRes {
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);
}
if let Some(item) = &self.power_transmitted {
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
if let Some(item) = &self.supply_device_current {
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let items = &self.vendor_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 5, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(5, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTAlignmentCheckRes {
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 = Vec::new();
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 { 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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_5.push(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)?,
power_transmitted: f_3,
supply_device_current: f_4,
vendor_specific_data_container: f_5,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTChargeLoopReq {
pub header: super::common::MessageHeader,
pub display_parameters: Option<super::common::DisplayParameters>,
pub meter_info_requested: bool,
pub ev_pc_power_request: super::common::RationalNumber,
pub ev_pc_power_output: super::common::RationalNumber,
pub ev_pc_charge_diagnostics: WPTEVPCChargeDiagnostics,
pub ev_pc_operating_frequency: Option<super::common::RationalNumber>,
pub ev_pc_power_control_parameter: Option<WPTEVPCPowerControlParameter>,
pub manufacturer_specific_data_container: Vec<Vec<u8>>,
}
impl WPTChargeLoopReq {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
width: &[1, 2, 1, 1, 1, 1, 3, 2, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0, 2],
min: &[1, 0, 1, 1, 1, 1, 0, 0, 0],
max: &[1, 1, 1, 1, 1, 1, 1, 1, 16],
};
}
impl WPTChargeLoopReq {
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_pc_power_request;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.ev_pc_power_output;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.ev_pc_charge_diagnostics;
w.start(e, 5, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), WPTEVPCChargeDiagnostics::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(5, 1);
}
if let Some(item) = &self.ev_pc_operating_frequency {
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
if let Some(item) = &self.ev_pc_power_control_parameter {
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
{
let items = &self.manufacturer_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 8, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(8, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTChargeLoopReq {
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 = Vec::new();
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, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = WPTEVPCChargeDiagnostics::from_index(
d.nbit(WPTEVPCChargeDiagnostics::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; 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 = WPTEVPCPowerControlParameter::decode_body(d)?;
f_7 = Some(value);
}
Step::Item { index: 8, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_8.push(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_pc_power_request: f_3.ok_or(ExiError::MissingElement)?,
ev_pc_power_output: f_4.ok_or(ExiError::MissingElement)?,
ev_pc_charge_diagnostics: f_5.ok_or(ExiError::MissingElement)?,
ev_pc_operating_frequency: f_6,
ev_pc_power_control_parameter: f_7,
manufacturer_specific_data_container: f_8,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTChargeLoopRes {
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 ev_pc_power_request: super::common::RationalNumber,
pub sd_power_input: Option<super::common::RationalNumber>,
pub spc_max_output_power_limit: super::common::RationalNumber,
pub spc_min_output_power_limit: super::common::RationalNumber,
pub spc_charge_diagnostics: WPTSPCChargeDiagnostics,
pub spc_operating_frequency: Option<super::common::RationalNumber>,
pub spc_power_control_parameter: Option<WPTSPCPowerControlParameter>,
pub manufacturer_specific_data_container: Vec<Vec<u8>>,
}
impl WPTChargeLoopRes {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
width: &[1, 1, 3, 2, 2, 1, 2, 1, 1, 1, 3, 2, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2],
min: &[1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0],
max: &[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16],
};
}
impl WPTChargeLoopRes {
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.ev_pc_power_request;
w.start(e, 5, 0)?;
item.encode_body(e)?;
w.finish(5, 1);
}
if let Some(item) = &self.sd_power_input {
w.start(e, 6, 0)?;
item.encode_body(e)?;
w.finish(6, 1);
}
{
let item = &self.spc_max_output_power_limit;
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
{
let item = &self.spc_min_output_power_limit;
w.start(e, 8, 0)?;
item.encode_body(e)?;
w.finish(8, 1);
}
{
let item = &self.spc_charge_diagnostics;
w.start(e, 9, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), WPTSPCChargeDiagnostics::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(9, 1);
}
if let Some(item) = &self.spc_operating_frequency {
w.start(e, 10, 0)?;
item.encode_body(e)?;
w.finish(10, 1);
}
if let Some(item) = &self.spc_power_control_parameter {
w.start(e, 11, 0)?;
item.encode_body(e)?;
w.finish(11, 1);
}
{
let items = &self.manufacturer_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 12, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(12, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTChargeLoopRes {
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 = Vec::new();
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, .. } => {
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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = WPTSPCChargeDiagnostics::from_index(
d.nbit(WPTSPCChargeDiagnostics::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; 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 = WPTSPCPowerControlParameter::decode_body(d)?;
f_11 = Some(value);
}
Step::Item { index: 12, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_12.push(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,
ev_pc_power_request: f_5.ok_or(ExiError::MissingElement)?,
sd_power_input: f_6,
spc_max_output_power_limit: f_7.ok_or(ExiError::MissingElement)?,
spc_min_output_power_limit: f_8.ok_or(ExiError::MissingElement)?,
spc_charge_diagnostics: f_9.ok_or(ExiError::MissingElement)?,
spc_operating_frequency: f_10,
spc_power_control_parameter: f_11,
manufacturer_specific_data_container: f_12,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTChargeParameterDiscoveryReq {
pub header: super::common::MessageHeader,
pub ev_pc_max_receivable_power: super::common::RationalNumber,
pub sd_max_ground_clearence: u16,
pub sd_min_ground_clearence: u16,
pub ev_pc_natural_frequency: super::common::RationalNumber,
pub ev_pc_device_local_control: bool,
pub vendor_specific_data_container: Vec<Vec<u8>>,
}
impl WPTChargeParameterDiscoveryReq {
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, 2],
min: &[1, 1, 1, 1, 1, 1, 0],
max: &[1, 1, 1, 1, 1, 1, 16],
};
}
impl WPTChargeParameterDiscoveryReq {
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_pc_max_receivable_power;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
{
let item = &self.sd_max_ground_clearence;
w.start(e, 2, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(2, 1);
}
{
let item = &self.sd_min_ground_clearence;
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.ev_pc_natural_frequency;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.ev_pc_device_local_control;
w.start(e, 5, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.boolean(*item)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(5, 1);
}
{
let items = &self.vendor_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 6, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(6, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTChargeParameterDiscoveryReq {
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 = Vec::new();
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::RationalNumber::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u16::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.boolean()?;
d.expect_event(0, SIMPLE_WIDTH)?; f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_6.push(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
header: f_0.ok_or(ExiError::MissingElement)?,
ev_pc_max_receivable_power: f_1.ok_or(ExiError::MissingElement)?,
sd_max_ground_clearence: f_2.ok_or(ExiError::MissingElement)?,
sd_min_ground_clearence: f_3.ok_or(ExiError::MissingElement)?,
ev_pc_natural_frequency: f_4.ok_or(ExiError::MissingElement)?,
ev_pc_device_local_control: f_5.ok_or(ExiError::MissingElement)?,
vendor_specific_data_container: f_6,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTChargeParameterDiscoveryRes {
pub header: super::common::MessageHeader,
pub response_code: super::common::ResponseCode,
pub pd_input_power_class: WPTPowerClass,
pub sd_min_output_power: super::common::RationalNumber,
pub sd_max_output_power: super::common::RationalNumber,
pub sd_max_ground_clearance_support: u16,
pub sd_min_ground_clearance_support: u16,
pub pd_min_coil_current: super::common::RationalNumber,
pub pd_max_coil_current: super::common::RationalNumber,
pub sd_manufacturer_specific_data_container: Vec<Vec<u8>>,
}
impl WPTChargeParameterDiscoveryRes {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
width: &[1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 0, 0, 0, 2],
min: &[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
max: &[1, 1, 1, 1, 1, 1, 1, 1, 1, 16],
};
}
impl WPTChargeParameterDiscoveryRes {
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.pd_input_power_class;
w.start(e, 2, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), WPTPowerClass::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(2, 1);
}
{
let item = &self.sd_min_output_power;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.sd_max_output_power;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.sd_max_ground_clearance_support;
w.start(e, 5, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(5, 1);
}
{
let item = &self.sd_min_ground_clearance_support;
w.start(e, 6, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(6, 1);
}
{
let item = &self.pd_min_coil_current;
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
{
let item = &self.pd_max_coil_current;
w.start(e, 8, 0)?;
item.encode_body(e)?;
w.finish(8, 1);
}
{
let items = &self.sd_manufacturer_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 9, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(9, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTChargeParameterDiscoveryRes {
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 = Vec::new();
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 = WPTPowerClass::from_index(d.nbit(WPTPowerClass::WIDTH)?)?;
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, .. } => {
let value = super::common::RationalNumber::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u16::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u16::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_9.push(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)?,
pd_input_power_class: f_2.ok_or(ExiError::MissingElement)?,
sd_min_output_power: f_3.ok_or(ExiError::MissingElement)?,
sd_max_output_power: f_4.ok_or(ExiError::MissingElement)?,
sd_max_ground_clearance_support: f_5.ok_or(ExiError::MissingElement)?,
sd_min_ground_clearance_support: f_6.ok_or(ExiError::MissingElement)?,
pd_min_coil_current: f_7.ok_or(ExiError::MissingElement)?,
pd_max_coil_current: f_8.ok_or(ExiError::MissingElement)?,
sd_manufacturer_specific_data_container: f_9,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTCoordinateXYZ {
pub coord_x: i16,
pub coord_y: i16,
pub coord_z: i16,
}
impl WPTCoordinateXYZ {
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 WPTCoordinateXYZ {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.coord_x;
w.start(e, 0, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.int(i64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(0, 1);
}
{
let item = &self.coord_y;
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.int(i64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
{
let item = &self.coord_z;
w.start(e, 2, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.int(i64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(2, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTCoordinateXYZ {
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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = i16::try_from(d.int()?).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 = i16::try_from(d.int()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = i16::try_from(d.int()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_2 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
coord_x: f_0.ok_or(ExiError::MissingElement)?,
coord_y: f_1.ok_or(ExiError::MissingElement)?,
coord_z: f_2.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(u16)]
pub enum WPTEVPCChargeDiagnostics {
EVPCNoIssue = 0,
EVPCTempOverheatDetected = 1,
EVPCPowerTransferAnomalyDetected = 2,
EVPCAnomalyDetected = 3,
}
impl WPTEVPCChargeDiagnostics {
pub const WIDTH: u32 = 2;
pub const ALL: [Self; 4] = [
Self::EVPCNoIssue,
Self::EVPCTempOverheatDetected,
Self::EVPCPowerTransferAnomalyDetected,
Self::EVPCAnomalyDetected,
];
#[must_use]
pub const fn as_index(self) -> u64 {
self as u64
}
pub const fn from_index(index: u64) -> ExiResult<Self> {
Ok(match index {
0 => Self::EVPCNoIssue,
1 => Self::EVPCTempOverheatDetected,
2 => Self::EVPCPowerTransferAnomalyDetected,
3 => Self::EVPCAnomalyDetected,
_ => return Err(ExiError::UnknownEnumValue),
})
}
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::EVPCNoIssue => "EVPCNoIssue",
Self::EVPCTempOverheatDetected => "EVPCTempOverheatDetected",
Self::EVPCPowerTransferAnomalyDetected => "EVPCPowerTransferAnomalyDetected",
Self::EVPCAnomalyDetected => "EVPCAnomalyDetected",
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTEVPCPowerControlParameter {
pub ev_pc_coil_current_request: super::common::RationalNumber,
pub ev_pc_coil_current_information: super::common::RationalNumber,
pub ev_pc_current_output_information: super::common::RationalNumber,
pub ev_pc_voltage_output_information: super::common::RationalNumber,
}
impl WPTEVPCPowerControlParameter {
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 WPTEVPCPowerControlParameter {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.ev_pc_coil_current_request;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
{
let item = &self.ev_pc_coil_current_information;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
{
let item = &self.ev_pc_current_output_information;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.ev_pc_voltage_output_information;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTEVPCPowerControlParameter {
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 {
ev_pc_coil_current_request: f_0.ok_or(ExiError::MissingElement)?,
ev_pc_coil_current_information: f_1.ok_or(ExiError::MissingElement)?,
ev_pc_current_output_information: f_2.ok_or(ExiError::MissingElement)?,
ev_pc_voltage_output_information: f_3.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(u16)]
pub enum WPTEVResult {
EVResultUnknown = 0,
EVResultSuccess = 1,
EVResultFailed = 2,
}
impl WPTEVResult {
pub const WIDTH: u32 = 2;
pub const ALL: [Self; 3] = [Self::EVResultUnknown, Self::EVResultSuccess, Self::EVResultFailed];
#[must_use]
pub const fn as_index(self) -> u64 {
self as u64
}
pub const fn from_index(index: u64) -> ExiResult<Self> {
Ok(match index {
0 => Self::EVResultUnknown,
1 => Self::EVResultSuccess,
2 => Self::EVResultFailed,
_ => return Err(ExiError::UnknownEnumValue),
})
}
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::EVResultUnknown => "EVResultUnknown",
Self::EVResultSuccess => "EVResultSuccess",
Self::EVResultFailed => "EVResultFailed",
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTFinePositioningMethodList {
pub wpt_fine_positioning_method: Vec<WPTFinePositioningMethod>,
}
impl WPTFinePositioningMethodList {
const SHAPE: Shape =
Shape { prod_before: &[0, 1], width: &[1, 1], repeat_width: &[2], min: &[1], max: &[8] };
}
impl WPTFinePositioningMethodList {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let items = &self.wpt_fine_positioning_method;
let count = items.len() as u32;
if count < 1 || count > 8 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 0, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), WPTFinePositioningMethod::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(0, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTFinePositioningMethodList {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = Vec::new();
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = WPTFinePositioningMethod::from_index(
d.nbit(WPTFinePositioningMethod::WIDTH)?,
)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_0.push(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
wpt_fine_positioning_method: {
if (f_0.len() as u32) < 1 {
return Err(ExiError::MissingElement);
}
f_0
},
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(u16)]
pub enum WPTFinePositioningMethod {
Manual = 0,
LFTxEV = 1,
LFTxPrimaryDevice = 2,
LPE = 3,
Proprietary = 4,
}
impl WPTFinePositioningMethod {
pub const WIDTH: u32 = 3;
pub const ALL: [Self; 5] =
[Self::Manual, Self::LFTxEV, Self::LFTxPrimaryDevice, Self::LPE, Self::Proprietary];
#[must_use]
pub const fn as_index(self) -> u64 {
self as u64
}
pub const fn from_index(index: u64) -> ExiResult<Self> {
Ok(match index {
0 => Self::Manual,
1 => Self::LFTxEV,
2 => Self::LFTxPrimaryDevice,
3 => Self::LPE,
4 => Self::Proprietary,
_ => return Err(ExiError::UnknownEnumValue),
})
}
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::Manual => "Manual",
Self::LFTxEV => "LF_TxEV",
Self::LFTxPrimaryDevice => "LF_TxPrimaryDevice",
Self::LPE => "LPE",
Self::Proprietary => "Proprietary",
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTFinePositioningReq {
pub header: super::common::MessageHeader,
pub ev_processing: super::common::Processing,
pub ev_result_code: WPTEVResult,
pub vendor_specific_data_container: Vec<Vec<u8>>,
pub wpt_lf_data_package_list: Option<WPTLFDataPackageList>,
}
impl WPTFinePositioningReq {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5],
width: &[1, 1, 1, 2, 2, 1],
repeat_width: &[0, 0, 0, 2, 0],
min: &[1, 1, 1, 0, 0],
max: &[1, 1, 1, 16, 1],
};
}
impl WPTFinePositioningReq {
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_result_code;
w.start(e, 2, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), WPTEVResult::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(2, 1);
}
{
let items = &self.vendor_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 3, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(3, count);
}
}
if let Some(item) = &self.wpt_lf_data_package_list {
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTFinePositioningReq {
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 = Vec::new();
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, .. } => {
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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = WPTEVResult::from_index(d.nbit(WPTEVResult::WIDTH)?)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_3.push(value);
}
Step::Item { index: 4, .. } => {
let value = WPTLFDataPackageList::decode_body(d)?;
f_4 = 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_result_code: f_2.ok_or(ExiError::MissingElement)?,
vendor_specific_data_container: f_3,
wpt_lf_data_package_list: f_4,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTFinePositioningRes {
pub header: super::common::MessageHeader,
pub response_code: super::common::ResponseCode,
pub evse_processing: super::common::Processing,
pub vendor_specific_data_container: Vec<Vec<u8>>,
pub wpt_lf_data_package_list: Option<WPTLFDataPackageList>,
}
impl WPTFinePositioningRes {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5],
width: &[1, 1, 1, 2, 2, 1],
repeat_width: &[0, 0, 0, 2, 0],
min: &[1, 1, 1, 0, 0],
max: &[1, 1, 1, 16, 1],
};
}
impl WPTFinePositioningRes {
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);
}
{
let items = &self.vendor_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 3, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(3, count);
}
}
if let Some(item) = &self.wpt_lf_data_package_list {
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTFinePositioningRes {
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 = Vec::new();
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, .. } => {
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 { index: 3, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_3.push(value);
}
Step::Item { index: 4, .. } => {
let value = WPTLFDataPackageList::decode_body(d)?;
f_4 = 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)?,
vendor_specific_data_container: f_3,
wpt_lf_data_package_list: f_4,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTFinePositioningSetupReq {
pub header: super::common::MessageHeader,
pub ev_processing: super::common::Processing,
pub ev_device_fine_positioning_method_list: WPTFinePositioningMethodList,
pub ev_device_pairing_method_list: WPTPairingMethodList,
pub ev_device_alignment_check_method_list: WPTAlignmentCheckMethodList,
pub natural_offset: u16,
pub vendor_specific_data_container: Vec<Vec<u8>>,
pub lf_system_setup_data: Option<WPTLFSystemSetupData>,
}
impl WPTFinePositioningSetupReq {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8],
width: &[1, 1, 1, 1, 1, 1, 2, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 2, 0],
min: &[1, 1, 1, 1, 1, 1, 0, 0],
max: &[1, 1, 1, 1, 1, 1, 16, 1],
};
}
impl WPTFinePositioningSetupReq {
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_device_fine_positioning_method_list;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.ev_device_pairing_method_list;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.ev_device_alignment_check_method_list;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.natural_offset;
w.start(e, 5, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(5, 1);
}
{
let items = &self.vendor_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 6, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(6, count);
}
}
if let Some(item) = &self.lf_system_setup_data {
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTFinePositioningSetupReq {
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 = Vec::new();
let mut f_7 = 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 = WPTFinePositioningMethodList::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = WPTPairingMethodList::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = WPTAlignmentCheckMethodList::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u16::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_6.push(value);
}
Step::Item { index: 7, .. } => {
let value = WPTLFSystemSetupData::decode_body(d)?;
f_7 = 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_device_fine_positioning_method_list: f_2.ok_or(ExiError::MissingElement)?,
ev_device_pairing_method_list: f_3.ok_or(ExiError::MissingElement)?,
ev_device_alignment_check_method_list: f_4.ok_or(ExiError::MissingElement)?,
natural_offset: f_5.ok_or(ExiError::MissingElement)?,
vendor_specific_data_container: f_6,
lf_system_setup_data: f_7,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTFinePositioningSetupRes {
pub header: super::common::MessageHeader,
pub response_code: super::common::ResponseCode,
pub primary_device_fine_positioning_method_list: WPTFinePositioningMethodList,
pub primary_device_pairing_method_list: WPTPairingMethodList,
pub primary_device_alignment_check_method_list: WPTAlignmentCheckMethodList,
pub natural_offset: u16,
pub vendor_specific_data_container: Vec<Vec<u8>>,
pub lf_system_setup_data: Option<WPTLFSystemSetupData>,
}
impl WPTFinePositioningSetupRes {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6, 7, 8],
width: &[1, 1, 1, 1, 1, 1, 2, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 0, 2, 0],
min: &[1, 1, 1, 1, 1, 1, 0, 0],
max: &[1, 1, 1, 1, 1, 1, 16, 1],
};
}
impl WPTFinePositioningSetupRes {
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.primary_device_fine_positioning_method_list;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
{
let item = &self.primary_device_pairing_method_list;
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
{
let item = &self.primary_device_alignment_check_method_list;
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let item = &self.natural_offset;
w.start(e, 5, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(5, 1);
}
{
let items = &self.vendor_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 6, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(6, count);
}
}
if let Some(item) = &self.lf_system_setup_data {
w.start(e, 7, 0)?;
item.encode_body(e)?;
w.finish(7, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTFinePositioningSetupRes {
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 = Vec::new();
let mut f_7 = 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 = WPTFinePositioningMethodList::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
let value = WPTPairingMethodList::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = WPTAlignmentCheckMethodList::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u16::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_5 = Some(value);
}
Step::Item { index: 6, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_6.push(value);
}
Step::Item { index: 7, .. } => {
let value = WPTLFSystemSetupData::decode_body(d)?;
f_7 = 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)?,
primary_device_fine_positioning_method_list: f_2.ok_or(ExiError::MissingElement)?,
primary_device_pairing_method_list: f_3.ok_or(ExiError::MissingElement)?,
primary_device_alignment_check_method_list: f_4.ok_or(ExiError::MissingElement)?,
natural_offset: f_5.ok_or(ExiError::MissingElement)?,
vendor_specific_data_container: f_6,
lf_system_setup_data: f_7,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTLFDataPackageList {
pub num_packages: u8,
pub wpt_lf_data_package: WPTLFDataPackage,
}
impl WPTLFDataPackageList {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2],
width: &[1, 1, 1],
repeat_width: &[0, 0],
min: &[1, 1],
max: &[1, 1],
};
}
impl WPTLFDataPackageList {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.num_packages;
w.start(e, 0, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.restricted(i64::from(*item), 0, 255)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(0, 1);
}
{
let item = &self.wpt_lf_data_package;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTLFDataPackageList {
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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u8::try_from(d.restricted(0, 255)?)
.map_err(|_| ExiError::ValueOutOfRange)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = WPTLFDataPackage::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
num_packages: f_0.ok_or(ExiError::MissingElement)?,
wpt_lf_data_package: f_1.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum WPTLFDataPackageChoice {
LFTxData(WPTLFTxDataList),
LFRxData(WPTLFRxDataList),
}
impl WPTLFDataPackageChoice {
#[must_use]
pub const fn name(&self) -> &'static str {
match self {
Self::LFTxData(_) => "LF_TxData",
Self::LFRxData(_) => "LF_RxData",
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTLFDataPackage {
pub package_index: u8,
pub choice: WPTLFDataPackageChoice,
}
impl WPTLFDataPackage {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 3],
width: &[1, 2, 1],
repeat_width: &[0, 0],
min: &[1, 1],
max: &[1, 1],
};
}
impl WPTLFDataPackage {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.package_index;
w.start(e, 0, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.restricted(i64::from(*item), 0, 255)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(0, 1);
}
{
let item = &self.choice;
match item {
WPTLFDataPackageChoice::LFTxData(value) => {
w.start_branch(e, 1, 0, 0)?;
value.encode_body(e)?;
}
WPTLFDataPackageChoice::LFRxData(value) => {
w.start_branch(e, 1, 0, 1)?;
value.encode_body(e)?;
}
}
w.finish(1, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTLFDataPackage {
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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u8::try_from(d.restricted(0, 255)?)
.map_err(|_| ExiError::ValueOutOfRange)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_0 = Some(value);
}
Step::Item { index: 1, branch, .. } => {
let value = match branch {
0 => {
let value = WPTLFTxDataList::decode_body(d)?;
WPTLFDataPackageChoice::LFTxData(value)
}
1 => {
let value = WPTLFRxDataList::decode_body(d)?;
WPTLFDataPackageChoice::LFRxData(value)
}
_ => return Err(ExiError::UnknownEventCode),
};
f_1 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
package_index: 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 struct WPTLFReceiverData {
pub number_of_receivers: u8,
pub rx_spec_data: Vec<WPTTxRxSpecData>,
}
impl WPTLFReceiverData {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2],
width: &[1, 1, 1],
repeat_width: &[0, 2],
min: &[1, 2],
max: &[1, 255],
};
}
impl WPTLFReceiverData {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.number_of_receivers;
w.start(e, 0, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.restricted(i64::from(*item), 0, 255)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(0, 1);
}
{
let items = &self.rx_spec_data;
let count = items.len() as u32;
if count < 2 || count > 255 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 1, c as u32)?;
item.encode_body(e)?;
}
if count > 0 {
w.finish(1, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTLFReceiverData {
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 = Vec::new();
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u8::try_from(d.restricted(0, 255)?)
.map_err(|_| ExiError::ValueOutOfRange)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_0 = Some(value);
}
Step::Item { index: 1, .. } => {
let value = WPTTxRxSpecData::decode_body(d)?;
f_1.push(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
number_of_receivers: f_0.ok_or(ExiError::MissingElement)?,
rx_spec_data: {
if (f_1.len() as u32) < 2 {
return Err(ExiError::MissingElement);
}
f_1
},
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTLFRxDataList {
pub wpt_lf_rx_data_list: WPTLFRxData,
}
impl WPTLFRxDataList {
const SHAPE: Shape =
Shape { prod_before: &[0, 1], width: &[1, 1], repeat_width: &[0], min: &[1], max: &[1] };
}
impl WPTLFRxDataList {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.wpt_lf_rx_data_list;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTLFRxDataList {
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 = WPTLFRxData::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self { wpt_lf_rx_data_list: f_0.ok_or(ExiError::MissingElement)? })
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTLFRxData {
pub rx_identifier: u32,
pub rssi_data: WPTLFRxRSSIList,
}
impl WPTLFRxData {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2],
width: &[1, 1, 1],
repeat_width: &[0, 0],
min: &[1, 1],
max: &[1, 1],
};
}
impl WPTLFRxData {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.rx_identifier;
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.rssi_data;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTLFRxData {
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, .. } => {
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 = WPTLFRxRSSIList::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
rx_identifier: f_0.ok_or(ExiError::MissingElement)?,
rssi_data: f_1.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTLFRxRSSIList {
pub rssi_data_list: WPTLFRxRSSI,
}
impl WPTLFRxRSSIList {
const SHAPE: Shape =
Shape { prod_before: &[0, 1], width: &[1, 1], repeat_width: &[0], min: &[1], max: &[1] };
}
impl WPTLFRxRSSIList {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.rssi_data_list;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTLFRxRSSIList {
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 = WPTLFRxRSSI::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self { rssi_data_list: f_0.ok_or(ExiError::MissingElement)? })
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTLFRxRSSI {
pub tx_identifier: u32,
pub rssi: super::common::RationalNumber,
}
impl WPTLFRxRSSI {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2],
width: &[1, 1, 1],
repeat_width: &[0, 0],
min: &[1, 1],
max: &[1, 1],
};
}
impl WPTLFRxRSSI {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.tx_identifier;
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.rssi;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTLFRxRSSI {
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, .. } => {
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 { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
tx_identifier: f_0.ok_or(ExiError::MissingElement)?,
rssi: f_1.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum WPTLFSystemSetupDataChoice {
LFTransmitterSetupData(WPTLFTransmitterData),
LFReceiverSetupData(WPTLFReceiverData),
}
impl WPTLFSystemSetupDataChoice {
#[must_use]
pub const fn name(&self) -> &'static str {
match self {
Self::LFTransmitterSetupData(_) => "LF_TransmitterSetupData",
Self::LFReceiverSetupData(_) => "LF_ReceiverSetupData",
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTLFSystemSetupData {
pub choice: WPTLFSystemSetupDataChoice,
}
impl WPTLFSystemSetupData {
const SHAPE: Shape =
Shape { prod_before: &[0, 2], width: &[2, 1], repeat_width: &[0], min: &[1], max: &[1] };
}
impl WPTLFSystemSetupData {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.choice;
match item {
WPTLFSystemSetupDataChoice::LFTransmitterSetupData(value) => {
w.start_branch(e, 0, 0, 0)?;
value.encode_body(e)?;
}
WPTLFSystemSetupDataChoice::LFReceiverSetupData(value) => {
w.start_branch(e, 0, 0, 1)?;
value.encode_body(e)?;
}
}
w.finish(0, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTLFSystemSetupData {
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, branch, .. } => {
let value = match branch {
0 => {
let value = WPTLFTransmitterData::decode_body(d)?;
WPTLFSystemSetupDataChoice::LFTransmitterSetupData(value)
}
1 => {
let value = WPTLFReceiverData::decode_body(d)?;
WPTLFSystemSetupDataChoice::LFReceiverSetupData(value)
}
_ => return Err(ExiError::UnknownEventCode),
};
f_0 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self { choice: f_0.ok_or(ExiError::MissingElement)? })
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTLFTransmitterData {
pub number_of_transmitters: u8,
pub signal_frequency: super::common::RationalNumber,
pub tx_spec_data: Vec<WPTTxRxSpecData>,
pub tx_package_spec_data: Option<WPTTxRxPackageSpecData>,
}
impl WPTLFTransmitterData {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4],
width: &[1, 1, 1, 2, 1],
repeat_width: &[0, 0, 2, 0],
min: &[1, 1, 2, 0],
max: &[1, 1, 255, 1],
};
}
impl WPTLFTransmitterData {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.number_of_transmitters;
w.start(e, 0, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.restricted(i64::from(*item), 0, 255)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(0, 1);
}
{
let item = &self.signal_frequency;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
{
let items = &self.tx_spec_data;
let count = items.len() as u32;
if count < 2 || count > 255 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 2, c as u32)?;
item.encode_body(e)?;
}
if count > 0 {
w.finish(2, count);
}
}
if let Some(item) = &self.tx_package_spec_data {
w.start(e, 3, 0)?;
item.encode_body(e)?;
w.finish(3, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTLFTransmitterData {
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 = Vec::new();
let mut f_3 = None;
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u8::try_from(d.restricted(0, 255)?)
.map_err(|_| ExiError::ValueOutOfRange)?;
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 = WPTTxRxSpecData::decode_body(d)?;
f_2.push(value);
}
Step::Item { index: 3, .. } => {
let value = WPTTxRxPackageSpecData::decode_body(d)?;
f_3 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
number_of_transmitters: f_0.ok_or(ExiError::MissingElement)?,
signal_frequency: f_1.ok_or(ExiError::MissingElement)?,
tx_spec_data: {
if (f_2.len() as u32) < 2 {
return Err(ExiError::MissingElement);
}
f_2
},
tx_package_spec_data: f_3,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTLFTxDataList {
pub wpt_lf_tx_data_list: WPTLFTxData,
}
impl WPTLFTxDataList {
const SHAPE: Shape =
Shape { prod_before: &[0, 1], width: &[1, 1], repeat_width: &[0], min: &[1], max: &[1] };
}
impl WPTLFTxDataList {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.wpt_lf_tx_data_list;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTLFTxDataList {
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 = WPTLFTxData::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self { wpt_lf_tx_data_list: f_0.ok_or(ExiError::MissingElement)? })
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTLFTxData {
pub tx_identifier: u32,
pub eirp: super::common::RationalNumber,
}
impl WPTLFTxData {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2],
width: &[1, 1, 1],
repeat_width: &[0, 0],
min: &[1, 1],
max: &[1, 1],
};
}
impl WPTLFTxData {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.tx_identifier;
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.eirp;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTLFTxData {
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, .. } => {
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 { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
tx_identifier: f_0.ok_or(ExiError::MissingElement)?,
eirp: f_1.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTPairingMethodList {
pub wpt_pairing_method: Vec<WPTPairingMethod>,
}
impl WPTPairingMethodList {
const SHAPE: Shape =
Shape { prod_before: &[0, 1], width: &[1, 1], repeat_width: &[2], min: &[1], max: &[8] };
}
impl WPTPairingMethodList {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let items = &self.wpt_pairing_method;
let count = items.len() as u32;
if count < 1 || count > 8 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 0, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), WPTPairingMethod::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(0, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTPairingMethodList {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = Vec::new();
loop {
match r.next(d)? {
Step::End => break,
Step::Item { index: 0, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = WPTPairingMethod::from_index(d.nbit(WPTPairingMethod::WIDTH)?)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_0.push(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
wpt_pairing_method: {
if (f_0.len() as u32) < 1 {
return Err(ExiError::MissingElement);
}
f_0
},
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(u16)]
pub enum WPTPairingMethod {
ExternalConfirmation = 0,
LPE = 1,
LFTxEV = 2,
LFTxPrimaryDevice = 3,
Optical = 4,
Proprietary = 5,
}
impl WPTPairingMethod {
pub const WIDTH: u32 = 3;
pub const ALL: [Self; 6] = [
Self::ExternalConfirmation,
Self::LPE,
Self::LFTxEV,
Self::LFTxPrimaryDevice,
Self::Optical,
Self::Proprietary,
];
#[must_use]
pub const fn as_index(self) -> u64 {
self as u64
}
pub const fn from_index(index: u64) -> ExiResult<Self> {
Ok(match index {
0 => Self::ExternalConfirmation,
1 => Self::LPE,
2 => Self::LFTxEV,
3 => Self::LFTxPrimaryDevice,
4 => Self::Optical,
5 => Self::Proprietary,
_ => return Err(ExiError::UnknownEnumValue),
})
}
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::ExternalConfirmation => "External confirmation",
Self::LPE => "LPE",
Self::LFTxEV => "LF_TxEV",
Self::LFTxPrimaryDevice => "LF_TxPrimaryDevice",
Self::Optical => "Optical",
Self::Proprietary => "Proprietary",
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTPairingReq {
pub header: super::common::MessageHeader,
pub ev_processing: super::common::Processing,
pub observed_id_code: Option<u32>,
pub ev_result_code: WPTEVResult,
pub vendor_specific_data_container: Vec<Vec<u8>>,
}
impl WPTPairingReq {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5],
width: &[1, 1, 2, 1, 2, 1],
repeat_width: &[0, 0, 0, 0, 2],
min: &[1, 1, 0, 1, 0],
max: &[1, 1, 1, 1, 16],
};
}
impl WPTPairingReq {
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);
}
if let Some(item) = &self.observed_id_code {
w.start(e, 2, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(2, 1);
}
{
let item = &self.ev_result_code;
w.start(e, 3, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.nbit(item.as_index(), WPTEVResult::WIDTH)?;
e.event(0, SIMPLE_WIDTH)?; w.finish(3, 1);
}
{
let items = &self.vendor_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 4, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(4, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTPairingReq {
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 = Vec::new();
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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u32::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_2 = Some(value);
}
Step::Item { index: 3, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = WPTEVResult::from_index(d.nbit(WPTEVResult::WIDTH)?)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_4.push(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)?,
observed_id_code: f_2,
ev_result_code: f_3.ok_or(ExiError::MissingElement)?,
vendor_specific_data_container: f_4,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTPairingRes {
pub header: super::common::MessageHeader,
pub response_code: super::common::ResponseCode,
pub evse_processing: super::common::Processing,
pub observed_id_code: Option<u32>,
pub alternative_secc_list: Option<AlternativeSECCList>,
pub vendor_specific_data_container: Vec<Vec<u8>>,
}
impl WPTPairingRes {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4, 5, 6],
width: &[1, 1, 1, 3, 2, 2, 1],
repeat_width: &[0, 0, 0, 0, 0, 2],
min: &[1, 1, 1, 0, 0, 0],
max: &[1, 1, 1, 1, 1, 16],
};
}
impl WPTPairingRes {
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);
}
if let Some(item) = &self.observed_id_code {
w.start(e, 3, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(3, 1);
}
if let Some(item) = &self.alternative_secc_list {
w.start(e, 4, 0)?;
item.encode_body(e)?;
w.finish(4, 1);
}
{
let items = &self.vendor_specific_data_container;
let count = items.len() as u32;
if count > 16 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 5, c as u32)?;
e.event(0, SIMPLE_WIDTH)?; e.binary(item, Lengths::max(256))?;
e.event(0, SIMPLE_WIDTH)?; }
if count > 0 {
w.finish(5, count);
}
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTPairingRes {
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 = Vec::new();
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 { index: 3, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u32::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_3 = Some(value);
}
Step::Item { index: 4, .. } => {
let value = AlternativeSECCList::decode_body(d)?;
f_4 = Some(value);
}
Step::Item { index: 5, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = d.binary(Lengths::max(256))?;
d.expect_event(0, SIMPLE_WIDTH)?; f_5.push(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)?,
observed_id_code: f_3,
alternative_secc_list: f_4,
vendor_specific_data_container: f_5,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(u16)]
pub enum WPTPowerClass {
MFWPT1 = 0,
MFWPT2 = 1,
MFWPT3 = 2,
MFWPT4 = 3,
}
impl WPTPowerClass {
pub const WIDTH: u32 = 2;
pub const ALL: [Self; 4] = [Self::MFWPT1, Self::MFWPT2, Self::MFWPT3, Self::MFWPT4];
#[must_use]
pub const fn as_index(self) -> u64 {
self as u64
}
pub const fn from_index(index: u64) -> ExiResult<Self> {
Ok(match index {
0 => Self::MFWPT1,
1 => Self::MFWPT2,
2 => Self::MFWPT3,
3 => Self::MFWPT4,
_ => return Err(ExiError::UnknownEnumValue),
})
}
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::MFWPT1 => "MF-WPT1",
Self::MFWPT2 => "MF-WPT2",
Self::MFWPT3 => "MF-WPT3",
Self::MFWPT4 => "MF-WPT4",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(u16)]
pub enum WPTSPCChargeDiagnostics {
SPCNoIssue = 0,
SPCFODDetected = 1,
SPCLOPDetected = 2,
SPCTempOverheatDetected = 3,
SPCPowerTransferAnomalyDetected = 4,
SPCAnomalyDetected = 5,
}
impl WPTSPCChargeDiagnostics {
pub const WIDTH: u32 = 3;
pub const ALL: [Self; 6] = [
Self::SPCNoIssue,
Self::SPCFODDetected,
Self::SPCLOPDetected,
Self::SPCTempOverheatDetected,
Self::SPCPowerTransferAnomalyDetected,
Self::SPCAnomalyDetected,
];
#[must_use]
pub const fn as_index(self) -> u64 {
self as u64
}
pub const fn from_index(index: u64) -> ExiResult<Self> {
Ok(match index {
0 => Self::SPCNoIssue,
1 => Self::SPCFODDetected,
2 => Self::SPCLOPDetected,
3 => Self::SPCTempOverheatDetected,
4 => Self::SPCPowerTransferAnomalyDetected,
5 => Self::SPCAnomalyDetected,
_ => return Err(ExiError::UnknownEnumValue),
})
}
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::SPCNoIssue => "SPCNoIssue",
Self::SPCFODDetected => "SPCFODDetected",
Self::SPCLOPDetected => "SPCLOPDetected",
Self::SPCTempOverheatDetected => "SPCTempOverheatDetected",
Self::SPCPowerTransferAnomalyDetected => "SPCPowerTransferAnomalyDetected",
Self::SPCAnomalyDetected => "SPCAnomalyDetected",
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTSPCPowerControlParameter {
pub spc_primary_device_coil_current_information: super::common::RationalNumber,
}
impl WPTSPCPowerControlParameter {
const SHAPE: Shape =
Shape { prod_before: &[0, 1], width: &[1, 1], repeat_width: &[0], min: &[1], max: &[1] };
}
impl WPTSPCPowerControlParameter {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.spc_primary_device_coil_current_information;
w.start(e, 0, 0)?;
item.encode_body(e)?;
w.finish(0, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTSPCPowerControlParameter {
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::RationalNumber::decode_body(d)?;
f_0 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
spc_primary_device_coil_current_information: f_0.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTTxRxPackageSpecData {
pub pulse_sequence_order: Vec<WPTTxRxPulseOrder>,
pub pulse_separation_time: u16,
pub pulse_duration: u16,
pub package_separation_time: u16,
}
impl WPTTxRxPackageSpecData {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2, 3, 4],
width: &[1, 1, 1, 1, 1],
repeat_width: &[2, 0, 0, 0],
min: &[2, 1, 1, 1],
max: &[255, 1, 1, 1],
};
}
impl WPTTxRxPackageSpecData {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let items = &self.pulse_sequence_order;
let count = items.len() as u32;
if count < 2 || count > 255 {
return Err(ExiError::ValueOutOfRange);
}
for (c, item) in items.iter().enumerate() {
w.start(e, 0, c as u32)?;
item.encode_body(e)?;
}
if count > 0 {
w.finish(0, count);
}
}
{
let item = &self.pulse_separation_time;
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
{
let item = &self.pulse_duration;
w.start(e, 2, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(2, 1);
}
{
let item = &self.package_separation_time;
w.start(e, 3, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(3, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTTxRxPackageSpecData {
pub fn decode_body(d: &mut Decoder<'_>) -> ExiResult<Self> {
d.enter()?;
let mut r = SeqReader::new(Self::SHAPE);
let mut f_0 = Vec::new();
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 = WPTTxRxPulseOrder::decode_body(d)?;
f_0.push(value);
}
Step::Item { index: 1, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u16::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u16::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
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 { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
pulse_sequence_order: {
if (f_0.len() as u32) < 2 {
return Err(ExiError::MissingElement);
}
f_0
},
pulse_separation_time: f_1.ok_or(ExiError::MissingElement)?,
pulse_duration: f_2.ok_or(ExiError::MissingElement)?,
package_separation_time: f_3.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTTxRxPulseOrder {
pub index_number: u16,
pub tx_rx_identifier: u32,
}
impl WPTTxRxPulseOrder {
const SHAPE: Shape = Shape {
prod_before: &[0, 1, 2],
width: &[1, 1, 1],
repeat_width: &[0, 0],
min: &[1, 1],
max: &[1, 1],
};
}
impl WPTTxRxPulseOrder {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.index_number;
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.tx_rx_identifier;
w.start(e, 1, 0)?;
e.event(0, SIMPLE_WIDTH)?; e.uint(u64::from(*item))?;
e.event(0, SIMPLE_WIDTH)?; w.finish(1, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTTxRxPulseOrder {
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, .. } => {
d.expect_event(0, SIMPLE_WIDTH)?; let value = u16::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 = u32::try_from(d.uint()?).map_err(|_| ExiError::IntegerOverflow)?;
d.expect_event(0, SIMPLE_WIDTH)?; f_1 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
index_number: f_0.ok_or(ExiError::MissingElement)?,
tx_rx_identifier: f_1.ok_or(ExiError::MissingElement)?,
})
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WPTTxRxSpecData {
pub tx_rx_identifier: u32,
pub tx_rx_position: WPTCoordinateXYZ,
pub tx_rx_orientation: WPTCoordinateXYZ,
}
impl WPTTxRxSpecData {
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 WPTTxRxSpecData {
pub fn encode_body(&self, e: &mut Encoder<'_>) -> ExiResult<()> {
e.enter()?;
let mut w = SeqWriter::new(Self::SHAPE);
{
let item = &self.tx_rx_identifier;
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.tx_rx_position;
w.start(e, 1, 0)?;
item.encode_body(e)?;
w.finish(1, 1);
}
{
let item = &self.tx_rx_orientation;
w.start(e, 2, 0)?;
item.encode_body(e)?;
w.finish(2, 1);
}
w.end(e)?;
e.leave();
Ok(())
}
}
impl WPTTxRxSpecData {
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, .. } => {
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 = WPTCoordinateXYZ::decode_body(d)?;
f_1 = Some(value);
}
Step::Item { index: 2, .. } => {
let value = WPTCoordinateXYZ::decode_body(d)?;
f_2 = Some(value);
}
Step::Item { .. } => return Err(ExiError::UnknownEventCode),
}
}
d.leave();
Ok(Self {
tx_rx_identifier: f_0.ok_or(ExiError::MissingElement)?,
tx_rx_position: f_1.ok_or(ExiError::MissingElement)?,
tx_rx_orientation: f_2.ok_or(ExiError::MissingElement)?,
})
}
}
pub const DOCUMENT_WIDTH: u32 = 6;
pub const FRAGMENT_WIDTH: u32 = 8;
pub const FRAGMENT_ED_CODE: u64 = 194;
pub const XMLDSIG_FRAGMENT_WIDTH: u32 = 6;
pub const XMLDSIG_FRAGMENT_ED_CODE: u64 = 46;
impl WPTAlignmentCheckReq {
pub const DOCUMENT_CODE: u64 = 25;
}
impl crate::exi::ExiDocument for WPTAlignmentCheckReq {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 WPTAlignmentCheckRes {
pub const DOCUMENT_CODE: u64 = 26;
}
impl crate::exi::ExiDocument for WPTAlignmentCheckRes {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 WPTChargeLoopReq {
pub const DOCUMENT_CODE: u64 = 27;
}
impl crate::exi::ExiDocument for WPTChargeLoopReq {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 WPTChargeLoopRes {
pub const DOCUMENT_CODE: u64 = 28;
}
impl crate::exi::ExiDocument for WPTChargeLoopRes {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 WPTChargeParameterDiscoveryReq {
pub const DOCUMENT_CODE: u64 = 29;
}
impl crate::exi::ExiDocument for WPTChargeParameterDiscoveryReq {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 WPTChargeParameterDiscoveryRes {
pub const DOCUMENT_CODE: u64 = 30;
}
impl crate::exi::ExiDocument for WPTChargeParameterDiscoveryRes {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 WPTFinePositioningReq {
pub const DOCUMENT_CODE: u64 = 31;
}
impl crate::exi::ExiDocument for WPTFinePositioningReq {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 WPTFinePositioningRes {
pub const DOCUMENT_CODE: u64 = 32;
}
impl crate::exi::ExiDocument for WPTFinePositioningRes {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 WPTFinePositioningSetupReq {
pub const DOCUMENT_CODE: u64 = 33;
}
impl crate::exi::ExiDocument for WPTFinePositioningSetupReq {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 WPTFinePositioningSetupRes {
pub const DOCUMENT_CODE: u64 = 34;
}
impl crate::exi::ExiDocument for WPTFinePositioningSetupRes {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 WPTPairingReq {
pub const DOCUMENT_CODE: u64 = 35;
}
impl crate::exi::ExiDocument for WPTPairingReq {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 WPTPairingRes {
pub const DOCUMENT_CODE: u64 = 36;
}
impl crate::exi::ExiDocument for WPTPairingRes {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 {
WPTAlignmentCheckReq(WPTAlignmentCheckReq),
WPTAlignmentCheckRes(WPTAlignmentCheckRes),
WPTChargeLoopReq(WPTChargeLoopReq),
WPTChargeLoopRes(WPTChargeLoopRes),
WPTChargeParameterDiscoveryReq(WPTChargeParameterDiscoveryReq),
WPTChargeParameterDiscoveryRes(WPTChargeParameterDiscoveryRes),
WPTFinePositioningReq(WPTFinePositioningReq),
WPTFinePositioningRes(WPTFinePositioningRes),
WPTFinePositioningSetupReq(WPTFinePositioningSetupReq),
WPTFinePositioningSetupRes(WPTFinePositioningSetupRes),
WPTPairingReq(WPTPairingReq),
WPTPairingRes(WPTPairingRes),
}
impl Document {
#[must_use]
pub const fn name(&self) -> &'static str {
match self {
Self::WPTAlignmentCheckReq(_) => "WPT_AlignmentCheckReq",
Self::WPTAlignmentCheckRes(_) => "WPT_AlignmentCheckRes",
Self::WPTChargeLoopReq(_) => "WPT_ChargeLoopReq",
Self::WPTChargeLoopRes(_) => "WPT_ChargeLoopRes",
Self::WPTChargeParameterDiscoveryReq(_) => "WPT_ChargeParameterDiscoveryReq",
Self::WPTChargeParameterDiscoveryRes(_) => "WPT_ChargeParameterDiscoveryRes",
Self::WPTFinePositioningReq(_) => "WPT_FinePositioningReq",
Self::WPTFinePositioningRes(_) => "WPT_FinePositioningRes",
Self::WPTFinePositioningSetupReq(_) => "WPT_FinePositioningSetupReq",
Self::WPTFinePositioningSetupRes(_) => "WPT_FinePositioningSetupRes",
Self::WPTPairingReq(_) => "WPT_PairingReq",
Self::WPTPairingRes(_) => "WPT_PairingRes",
}
}
#[must_use]
pub const fn code(&self) -> u64 {
match self {
Self::WPTAlignmentCheckReq(_) => 25,
Self::WPTAlignmentCheckRes(_) => 26,
Self::WPTChargeLoopReq(_) => 27,
Self::WPTChargeLoopRes(_) => 28,
Self::WPTChargeParameterDiscoveryReq(_) => 29,
Self::WPTChargeParameterDiscoveryRes(_) => 30,
Self::WPTFinePositioningReq(_) => 31,
Self::WPTFinePositioningRes(_) => 32,
Self::WPTFinePositioningSetupReq(_) => 33,
Self::WPTFinePositioningSetupRes(_) => 34,
Self::WPTPairingReq(_) => 35,
Self::WPTPairingRes(_) => 36,
}
}
}
impl crate::exi::ExiDocument for Document {
fn to_slice(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(self.code(), DOCUMENT_WIDTH)?;
match self {
Self::WPTAlignmentCheckReq(m) => m.encode_body(&mut e)?,
Self::WPTAlignmentCheckRes(m) => m.encode_body(&mut e)?,
Self::WPTChargeLoopReq(m) => m.encode_body(&mut e)?,
Self::WPTChargeLoopRes(m) => m.encode_body(&mut e)?,
Self::WPTChargeParameterDiscoveryReq(m) => m.encode_body(&mut e)?,
Self::WPTChargeParameterDiscoveryRes(m) => m.encode_body(&mut e)?,
Self::WPTFinePositioningReq(m) => m.encode_body(&mut e)?,
Self::WPTFinePositioningRes(m) => m.encode_body(&mut e)?,
Self::WPTFinePositioningSetupReq(m) => m.encode_body(&mut e)?,
Self::WPTFinePositioningSetupRes(m) => m.encode_body(&mut e)?,
Self::WPTPairingReq(m) => m.encode_body(&mut e)?,
Self::WPTPairingRes(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)? {
25 => Self::WPTAlignmentCheckReq(WPTAlignmentCheckReq::decode_body(&mut d)?),
26 => Self::WPTAlignmentCheckRes(WPTAlignmentCheckRes::decode_body(&mut d)?),
27 => Self::WPTChargeLoopReq(WPTChargeLoopReq::decode_body(&mut d)?),
28 => Self::WPTChargeLoopRes(WPTChargeLoopRes::decode_body(&mut d)?),
29 => Self::WPTChargeParameterDiscoveryReq(
WPTChargeParameterDiscoveryReq::decode_body(&mut d)?,
),
30 => Self::WPTChargeParameterDiscoveryRes(
WPTChargeParameterDiscoveryRes::decode_body(&mut d)?,
),
31 => Self::WPTFinePositioningReq(WPTFinePositioningReq::decode_body(&mut d)?),
32 => Self::WPTFinePositioningRes(WPTFinePositioningRes::decode_body(&mut d)?),
33 => {
Self::WPTFinePositioningSetupReq(WPTFinePositioningSetupReq::decode_body(&mut d)?)
}
34 => {
Self::WPTFinePositioningSetupRes(WPTFinePositioningSetupRes::decode_body(&mut d)?)
}
35 => Self::WPTPairingReq(WPTPairingReq::decode_body(&mut d)?),
36 => Self::WPTPairingRes(WPTPairingRes::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::WPTAlignmentCheckReq(m) => Some(&m.header),
Self::WPTAlignmentCheckRes(m) => Some(&m.header),
Self::WPTChargeLoopReq(m) => Some(&m.header),
Self::WPTChargeLoopRes(m) => Some(&m.header),
Self::WPTChargeParameterDiscoveryReq(m) => Some(&m.header),
Self::WPTChargeParameterDiscoveryRes(m) => Some(&m.header),
Self::WPTFinePositioningReq(m) => Some(&m.header),
Self::WPTFinePositioningRes(m) => Some(&m.header),
Self::WPTFinePositioningSetupReq(m) => Some(&m.header),
Self::WPTFinePositioningSetupRes(m) => Some(&m.header),
Self::WPTPairingReq(m) => Some(&m.header),
Self::WPTPairingRes(m) => Some(&m.header),
}
}
pub const fn header_mut(&mut self) -> Option<&mut super::common::MessageHeader> {
match self {
Self::WPTAlignmentCheckReq(m) => Some(&mut m.header),
Self::WPTAlignmentCheckRes(m) => Some(&mut m.header),
Self::WPTChargeLoopReq(m) => Some(&mut m.header),
Self::WPTChargeLoopRes(m) => Some(&mut m.header),
Self::WPTChargeParameterDiscoveryReq(m) => Some(&mut m.header),
Self::WPTChargeParameterDiscoveryRes(m) => Some(&mut m.header),
Self::WPTFinePositioningReq(m) => Some(&mut m.header),
Self::WPTFinePositioningRes(m) => Some(&mut m.header),
Self::WPTFinePositioningSetupReq(m) => Some(&mut m.header),
Self::WPTFinePositioningSetupRes(m) => Some(&mut m.header),
Self::WPTPairingReq(m) => Some(&mut m.header),
Self::WPTPairingRes(m) => Some(&mut m.header),
}
}
}
impl Document {
#[must_use]
pub const fn response_code(&self) -> Option<super::common::ResponseCode> {
match self {
Self::WPTAlignmentCheckRes(m) => Some(m.response_code),
Self::WPTChargeLoopRes(m) => Some(m.response_code),
Self::WPTChargeParameterDiscoveryRes(m) => Some(m.response_code),
Self::WPTFinePositioningRes(m) => Some(m.response_code),
Self::WPTFinePositioningSetupRes(m) => Some(m.response_code),
Self::WPTPairingRes(m) => Some(m.response_code),
_ => None,
}
}
}
impl Document {
#[must_use]
pub const fn fragment_code(&self) -> u64 {
match self {
Self::WPTAlignmentCheckReq(_) => 165,
Self::WPTAlignmentCheckRes(_) => 166,
Self::WPTChargeLoopReq(_) => 167,
Self::WPTChargeLoopRes(_) => 168,
Self::WPTChargeParameterDiscoveryReq(_) => 169,
Self::WPTChargeParameterDiscoveryRes(_) => 170,
Self::WPTFinePositioningReq(_) => 172,
Self::WPTFinePositioningRes(_) => 173,
Self::WPTFinePositioningSetupReq(_) => 174,
Self::WPTFinePositioningSetupRes(_) => 175,
Self::WPTPairingReq(_) => 181,
Self::WPTPairingRes(_) => 182,
}
}
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
e.write_header(crate::exi::Header::ISO15118)?;
e.event(self.fragment_code(), FRAGMENT_WIDTH)?;
match self {
Self::WPTAlignmentCheckReq(m) => m.encode_body(&mut e)?,
Self::WPTAlignmentCheckRes(m) => m.encode_body(&mut e)?,
Self::WPTChargeLoopReq(m) => m.encode_body(&mut e)?,
Self::WPTChargeLoopRes(m) => m.encode_body(&mut e)?,
Self::WPTChargeParameterDiscoveryReq(m) => m.encode_body(&mut e)?,
Self::WPTChargeParameterDiscoveryRes(m) => m.encode_body(&mut e)?,
Self::WPTFinePositioningReq(m) => m.encode_body(&mut e)?,
Self::WPTFinePositioningRes(m) => m.encode_body(&mut e)?,
Self::WPTFinePositioningSetupReq(m) => m.encode_body(&mut e)?,
Self::WPTFinePositioningSetupRes(m) => m.encode_body(&mut e)?,
Self::WPTPairingReq(m) => m.encode_body(&mut e)?,
Self::WPTPairingRes(m) => m.encode_body(&mut e)?,
}
e.event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
e.finish()
}
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()?;
let value = match d.event(FRAGMENT_WIDTH)? {
165 => Self::WPTAlignmentCheckReq(WPTAlignmentCheckReq::decode_body(&mut d)?),
166 => Self::WPTAlignmentCheckRes(WPTAlignmentCheckRes::decode_body(&mut d)?),
167 => Self::WPTChargeLoopReq(WPTChargeLoopReq::decode_body(&mut d)?),
168 => Self::WPTChargeLoopRes(WPTChargeLoopRes::decode_body(&mut d)?),
169 => Self::WPTChargeParameterDiscoveryReq(
WPTChargeParameterDiscoveryReq::decode_body(&mut d)?,
),
170 => Self::WPTChargeParameterDiscoveryRes(
WPTChargeParameterDiscoveryRes::decode_body(&mut d)?,
),
172 => Self::WPTFinePositioningReq(WPTFinePositioningReq::decode_body(&mut d)?),
173 => Self::WPTFinePositioningRes(WPTFinePositioningRes::decode_body(&mut d)?),
174 => {
Self::WPTFinePositioningSetupReq(WPTFinePositioningSetupReq::decode_body(&mut d)?)
}
175 => {
Self::WPTFinePositioningSetupRes(WPTFinePositioningSetupRes::decode_body(&mut d)?)
}
181 => Self::WPTPairingReq(WPTPairingReq::decode_body(&mut d)?),
182 => Self::WPTPairingRes(WPTPairingRes::decode_body(&mut d)?),
_ => return Err(ExiError::UnknownEventCode),
};
d.expect_event(FRAGMENT_ED_CODE, FRAGMENT_WIDTH)?;
d.finish()?;
Ok(value)
}
}
impl AlternativeSECC {
pub const FRAGMENT_CODE: u64 = 2;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 AlternativeSECCList {
pub const FRAGMENT_CODE: u64 = 3;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTEVPCPowerControlParameter {
pub const FRAGMENT_CODE: u64 = 38;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTLFReceiverData {
pub const FRAGMENT_CODE: u64 = 61;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTLFRxDataList {
pub const FRAGMENT_CODE: u64 = 62;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTLFSystemSetupData {
pub const FRAGMENT_CODE: u64 = 63;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTLFTransmitterData {
pub const FRAGMENT_CODE: u64 = 64;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTLFTxDataList {
pub const FRAGMENT_CODE: u64 = 65;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTTxRxPulseOrder {
pub const FRAGMENT_CODE: u64 = 105;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTLFRxRSSIList {
pub const FRAGMENT_CODE: u64 = 109;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTLFRxRSSI {
pub const FRAGMENT_CODE: u64 = 110;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTSPCPowerControlParameter {
pub const FRAGMENT_CODE: u64 = 133;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTTxRxPackageSpecData {
pub const FRAGMENT_CODE: u64 = 157;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTAlignmentCheckReq {
pub const FRAGMENT_CODE: u64 = 165;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTAlignmentCheckRes {
pub const FRAGMENT_CODE: u64 = 166;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTChargeLoopReq {
pub const FRAGMENT_CODE: u64 = 167;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTChargeLoopRes {
pub const FRAGMENT_CODE: u64 = 168;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTChargeParameterDiscoveryReq {
pub const FRAGMENT_CODE: u64 = 169;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTChargeParameterDiscoveryRes {
pub const FRAGMENT_CODE: u64 = 170;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTFinePositioningReq {
pub const FRAGMENT_CODE: u64 = 172;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTFinePositioningRes {
pub const FRAGMENT_CODE: u64 = 173;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTFinePositioningSetupReq {
pub const FRAGMENT_CODE: u64 = 174;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTFinePositioningSetupRes {
pub const FRAGMENT_CODE: u64 = 175;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTLFDataPackage {
pub const FRAGMENT_CODE: u64 = 176;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTLFDataPackageList {
pub const FRAGMENT_CODE: u64 = 177;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTLFRxData {
pub const FRAGMENT_CODE: u64 = 178;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTLFTxData {
pub const FRAGMENT_CODE: u64 = 179;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTPairingReq {
pub const FRAGMENT_CODE: u64 = 181;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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 WPTPairingRes {
pub const FRAGMENT_CODE: u64 = 182;
pub fn encode_fragment(&self, buf: &mut [u8]) -> ExiResult<usize> {
let mut e = Encoder::new(buf);
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 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)
}
}