timex_datalink/protocol_3/
mod.rs1pub mod sync;
4pub mod start;
5pub mod time;
6pub mod alarm;
7pub mod end;
8pub mod sound_options;
9pub mod sound_theme;
10pub mod eeprom;
11pub mod wrist_app;
12
13pub use sync::Sync;
14pub use start::Start;
15pub use time::Time;
16pub use alarm::Alarm;
17pub use end::End;
18pub use sound_options::SoundOptions;
19pub use sound_theme::SoundTheme;
20pub use eeprom::Eeprom;
21pub use wrist_app::WristApp;
22
23use crate::PacketGenerator;
24
25pub struct Protocol3 {
31 models: Vec<Box<dyn PacketGenerator>>,
33}
34
35impl Protocol3 {
36 pub fn new() -> Self {
38 Protocol3 {
39 models: Vec::new()
40 }
41 }
42
43 pub fn add<T: PacketGenerator + 'static>(&mut self, model: T) {
45 self.models.push(Box::new(model));
46 }
47}
48
49impl PacketGenerator for Protocol3 {
50 fn packets(&self) -> Vec<Vec<u8>> {
51 self.models.iter()
52 .flat_map(|model| model.packets())
53 .collect()
54 }
55}