sunspec/models/
model18.rs

1//! Cellular Link
2/// Cellular Link
3///
4/// Include this model to support a cellular interface link
5#[derive(Debug)]
6#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
7pub struct Model18 {
8    /// Name
9    ///
10    /// Interface name
11    pub nam: Option<String>,
12    /// IMEI
13    ///
14    /// International Mobile Equipment Identifier for the interface
15    pub imei: Option<u32>,
16    /// APN
17    ///
18    /// Access Point Name for the interface
19    pub apn: Option<String>,
20    /// Number
21    ///
22    /// Phone number for the interface
23    pub num: Option<String>,
24    /// PIN
25    ///
26    /// Personal Identification Number for the interface
27    pub pin: Option<String>,
28}
29#[allow(missing_docs)]
30impl Model18 {
31    pub const NAM: crate::Point<Self, Option<String>> = crate::Point::new(0, 4, true);
32    pub const IMEI: crate::Point<Self, Option<u32>> = crate::Point::new(4, 2, true);
33    pub const APN: crate::Point<Self, Option<String>> = crate::Point::new(6, 4, true);
34    pub const NUM: crate::Point<Self, Option<String>> = crate::Point::new(10, 6, true);
35    pub const PIN: crate::Point<Self, Option<String>> = crate::Point::new(16, 6, true);
36}
37impl crate::Model for Model18 {
38    const ID: u16 = 18;
39    fn from_data(data: &[u16]) -> Result<Self, crate::DecodeError> {
40        Ok(Self {
41            nam: Self::NAM.from_data(data)?,
42            imei: Self::IMEI.from_data(data)?,
43            apn: Self::APN.from_data(data)?,
44            num: Self::NUM.from_data(data)?,
45            pin: Self::PIN.from_data(data)?,
46        })
47    }
48    fn addr(models: &crate::Models) -> crate::ModelAddr<Self> {
49        models.m18
50    }
51}