openthread/ot/types/
trel.rs1use crate::prelude_internal::*;
6
7#[derive(Debug, Default, Clone)]
11#[repr(transparent)]
12pub struct TrelCounters(pub otTrelCounters);
13
14impl_ot_castable!(TrelCounters, otTrelCounters);
15
16impl TrelCounters {
17 pub fn get_tx_packets(&self) -> u64 {
19 self.0.mTxPackets
20 }
21
22 pub fn get_tx_bytes(&self) -> u64 {
24 self.0.mTxBytes
25 }
26
27 pub fn get_tx_failure(&self) -> u64 {
29 self.0.mTxFailure
30 }
31
32 pub fn get_rx_packets(&self) -> u64 {
34 self.0.mRxPackets
35 }
36
37 pub fn get_rx_bytes(&self) -> u64 {
39 self.0.mRxBytes
40 }
41
42 pub fn update_tx_packets(&mut self, cnt: u64) {
44 self.0.mTxPackets += cnt;
45 }
46
47 pub fn update_tx_bytes(&mut self, cnt: u64) {
49 self.0.mTxBytes += cnt;
50 }
51
52 pub fn update_tx_failure(&mut self, cnt: u64) {
54 self.0.mTxFailure += cnt;
55 }
56
57 pub fn update_rx_packets(&mut self, cnt: u64) {
59 self.0.mRxPackets += cnt;
60 }
61
62 pub fn update_rx_bytes(&mut self, cnt: u64) {
64 self.0.mRxBytes += cnt;
65 }
66
67 pub fn reset_counters(&mut self) {
69 self.0.mTxPackets = 0;
70 self.0.mTxBytes = 0;
71 self.0.mTxFailure = 0;
72 self.0.mRxPackets = 0;
73 self.0.mRxBytes = 0;
74 }
75}