statime/observability/
default.rs

1use crate::datastructures::datasets::InternalDefaultDS;
2
3/// A concrete implementation of the PTP Current dataset (IEEE1588-2019 section
4/// 8.2.1)
5///
6/// See [InternalDefaultDS](crate::datastructures::datasets::InternalDefaultDS).
7#[derive(Debug, Copy, Clone)]
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9pub struct DefaultDS {
10    /// The identity of a PTP node.
11    /// See *IEEE1588-2019 section 8.2.1.2.2*.
12    pub clock_identity: crate::config::ClockIdentity,
13    /// The amount of PTP ports on this PTP instance.
14    /// See *IEEE1588-2019 section 8.2.1.2.3*.
15    pub number_ports: u16,
16    /// A description of the accuracy and type of a clock.
17    pub clock_quality: crate::config::ClockQuality,
18    /// See *IEEE1588-2019 section 8.2.1.4.1*.
19    pub priority_1: u8,
20    /// See *IEEE1588-2019 section 8.2.1.4.2*.
21    pub priority_2: u8,
22    /// See *IEEE1588-2019 section 8.2.1.4.3*.
23    pub domain_number: u8,
24    /// See *IEEE1588-2019 section  8.2.1.4.4*.
25    pub slave_only: bool,
26    /// See *IEEE1588-2019 section 7.1.4 table 2*.
27    pub sdo_id: crate::config::SdoId,
28}
29
30impl From<&InternalDefaultDS> for DefaultDS {
31    fn from(v: &InternalDefaultDS) -> Self {
32        Self {
33            clock_identity: v.clock_identity,
34            number_ports: v.number_ports,
35            clock_quality: v.clock_quality,
36            priority_1: v.priority_1,
37            priority_2: v.priority_2,
38            domain_number: v.domain_number,
39            slave_only: v.slave_only,
40            sdo_id: v.sdo_id,
41        }
42    }
43}