1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use super::{rawir, Message};
impl Message {
pub fn new() -> Self {
Message::default()
}
pub fn extend(&mut self, other: &Message) {
if self.carrier.is_none() {
self.carrier = other.carrier;
}
if self.duty_cycle.is_none() {
self.duty_cycle = other.duty_cycle;
}
self.raw.extend_from_slice(&other.raw);
}
pub fn has_trailing_gap(&self) -> bool {
let len = self.raw.len();
len > 0 && (len % 2) == 0
}
pub fn remove_trailing_gap(&mut self) {
if self.has_trailing_gap() {
self.raw.pop();
}
}
pub fn print_rawir(&self) -> String {
rawir::print_to_string(&self.raw)
}
}