dis_rs/common/stop_freeze_r/
model.rs1use crate::common::model::{ClockTime, EntityId, PduBody};
2use crate::common::{BodyInfo, Interaction};
3use crate::enumerations::{
4 PduType, RequiredReliabilityService, StopFreezeFrozenBehavior, StopFreezeReason,
5};
6use crate::stop_freeze_r::builder::StopFreezeRBuilder;
7#[cfg(feature = "serde")]
8use serde::{Deserialize, Serialize};
9
10const STOP_FREEZE_R_BODY_LENGTH: u16 = 28;
11
12#[derive(Clone, Debug, Default, PartialEq)]
16#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
17pub struct StopFreezeR {
18 pub originating_id: EntityId,
19 pub receiving_id: EntityId,
20 pub real_world_time: ClockTime,
21 pub reason: StopFreezeReason,
22 pub frozen_behavior: StopFreezeFrozenBehavior,
23 pub required_reliability_service: RequiredReliabilityService,
24 pub request_id: u32,
25}
26
27impl StopFreezeR {
28 #[must_use]
29 pub fn builder() -> StopFreezeRBuilder {
30 StopFreezeRBuilder::new()
31 }
32
33 #[must_use]
34 pub fn into_builder(self) -> StopFreezeRBuilder {
35 StopFreezeRBuilder::new_from_body(self)
36 }
37
38 #[must_use]
39 pub fn into_pdu_body(self) -> PduBody {
40 PduBody::StopFreezeR(self)
41 }
42}
43
44impl BodyInfo for StopFreezeR {
45 fn body_length(&self) -> u16 {
46 STOP_FREEZE_R_BODY_LENGTH
47 }
48
49 fn body_type(&self) -> PduType {
50 PduType::StopFreezeR
51 }
52}
53
54impl Interaction for StopFreezeR {
55 fn originator(&self) -> Option<&EntityId> {
56 Some(&self.originating_id)
57 }
58
59 fn receiver(&self) -> Option<&EntityId> {
60 Some(&self.receiving_id)
61 }
62}