pub type Model64415 = CsipControl;
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
pub struct CsipControl {
pub log_event_ena: Option<LogEventEna>,
pub http_msg: Option<HttpMsg>,
pub comm004_cert: Option<Comm004Cert>,
}
#[allow(missing_docs)]
impl CsipControl {
pub const LOG_EVENT_ENA: crate::Point<Self, Option<LogEventEna>> =
crate::Point::new(0, 1, true);
pub const HTTP_MSG: crate::Point<Self, Option<HttpMsg>> = crate::Point::new(1, 1, true);
pub const COMM004_CERT: crate::Point<Self, Option<Comm004Cert>> = crate::Point::new(2, 1, true);
}
impl crate::Group for CsipControl {
const LEN: u16 = 3;
}
impl CsipControl {
fn parse_group(data: &[u16]) -> Result<(&[u16], Self), crate::DecodeError> {
let nested_data = data
.get(usize::from(<Self as crate::Group>::LEN)..)
.unwrap_or(&[]);
Ok((
nested_data,
Self {
log_event_ena: Self::LOG_EVENT_ENA.from_data(data)?,
http_msg: Self::HTTP_MSG.from_data(data)?,
comm004_cert: Self::COMM004_CERT.from_data(data)?,
},
))
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
pub enum LogEventEna {
Disabled,
Enabled,
Invalid(u16),
}
impl crate::EnumValue for LogEventEna {
type Repr = u16;
const INVALID: Self::Repr = 65535;
fn from_repr(value: Self::Repr) -> Self {
match value {
0 => Self::Disabled,
1 => Self::Enabled,
value => Self::Invalid(value),
}
}
fn to_repr(self) -> Self::Repr {
match self {
Self::Disabled => 0,
Self::Enabled => 1,
Self::Invalid(value) => value,
}
}
}
impl crate::FixedSize for LogEventEna {
const SIZE: u16 = 1u16;
const INVALID: Self = Self::Invalid(65535);
fn is_invalid(&self) -> bool {
matches!(self, Self::Invalid(_))
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
pub enum HttpMsg {
Disabled,
Enabled,
Invalid(u16),
}
impl crate::EnumValue for HttpMsg {
type Repr = u16;
const INVALID: Self::Repr = 65535;
fn from_repr(value: Self::Repr) -> Self {
match value {
0 => Self::Disabled,
1 => Self::Enabled,
value => Self::Invalid(value),
}
}
fn to_repr(self) -> Self::Repr {
match self {
Self::Disabled => 0,
Self::Enabled => 1,
Self::Invalid(value) => value,
}
}
}
impl crate::FixedSize for HttpMsg {
const SIZE: u16 = 1u16;
const INVALID: Self = Self::Invalid(65535);
fn is_invalid(&self) -> bool {
matches!(self, Self::Invalid(_))
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
pub enum Comm004Cert {
DefaultCertificate,
Comm004a,
Comm004b,
Comm004c,
Comm004d,
Comm004e,
Comm004f,
Comm004g,
Invalid(u16),
}
impl crate::EnumValue for Comm004Cert {
type Repr = u16;
const INVALID: Self::Repr = 65535;
fn from_repr(value: Self::Repr) -> Self {
match value {
0 => Self::DefaultCertificate,
1 => Self::Comm004a,
2 => Self::Comm004b,
3 => Self::Comm004c,
4 => Self::Comm004d,
5 => Self::Comm004e,
6 => Self::Comm004f,
7 => Self::Comm004g,
value => Self::Invalid(value),
}
}
fn to_repr(self) -> Self::Repr {
match self {
Self::DefaultCertificate => 0,
Self::Comm004a => 1,
Self::Comm004b => 2,
Self::Comm004c => 3,
Self::Comm004d => 4,
Self::Comm004e => 5,
Self::Comm004f => 6,
Self::Comm004g => 7,
Self::Invalid(value) => value,
}
}
}
impl crate::FixedSize for Comm004Cert {
const SIZE: u16 = 1u16;
const INVALID: Self = Self::Invalid(65535);
fn is_invalid(&self) -> bool {
matches!(self, Self::Invalid(_))
}
}
impl crate::Model for CsipControl {
const ID: u16 = 64415;
fn addr(models: &crate::Models) -> crate::ModelAddr<Self> {
models.m64415
}
fn parse(data: &[u16]) -> Result<Self, crate::ParseError<Self>> {
let (_, model) = Self::parse_group(data)?;
Ok(model)
}
}