simple_someip/e2e/
state.rs1#[derive(Debug, Clone)]
5pub struct Profile4State {
6 pub(crate) protect_counter: u16,
8 pub(crate) last_counter: Option<u16>,
10}
11
12impl Profile4State {
13 #[must_use]
15 pub fn new() -> Self {
16 Self {
17 protect_counter: 0,
18 last_counter: None,
19 }
20 }
21
22 #[must_use]
24 pub fn with_initial_counter(counter: u16) -> Self {
25 Self {
26 protect_counter: counter,
27 last_counter: None,
28 }
29 }
30
31 pub fn reset(&mut self) {
33 self.protect_counter = 0;
34 self.last_counter = None;
35 }
36}
37
38impl Default for Profile4State {
39 fn default() -> Self {
40 Self::new()
41 }
42}
43
44#[derive(Debug, Clone)]
46pub struct Profile5State {
47 pub(crate) protect_counter: u8,
49 pub(crate) last_counter: Option<u8>,
51}
52
53impl Profile5State {
54 #[must_use]
56 pub fn new() -> Self {
57 Self {
58 protect_counter: 0,
59 last_counter: None,
60 }
61 }
62
63 #[must_use]
65 pub fn with_initial_counter(counter: u8) -> Self {
66 Self {
67 protect_counter: counter,
68 last_counter: None,
69 }
70 }
71
72 pub fn reset(&mut self) {
74 self.protect_counter = 0;
75 self.last_counter = None;
76 }
77}
78
79impl Default for Profile5State {
80 fn default() -> Self {
81 Self::new()
82 }
83}