]> code.octet-stream.net Git - m17rt/blob - m17app/src/adapter.rs
57e01bbbabae6e35947a07ceacdb50219446e67b
[m17rt] / m17app / src / adapter.rs
1 use crate::{app::TxHandle, link_setup::LinkSetup};
2 use m17core::protocol::PacketType;
3 use std::sync::Arc;
4
5 pub trait PacketAdapter: Send + Sync + 'static {
6 fn adapter_registered(&self, _id: usize, _handle: TxHandle) {}
7 fn adapter_removed(&self) {}
8 fn tnc_started(&self) {}
9 fn tnc_closed(&self) {}
10 fn packet_received(
11 &self,
12 _link_setup: LinkSetup,
13 _packet_type: PacketType,
14 _content: Arc<[u8]>,
15 ) {
16 }
17 }
18
19 pub trait StreamAdapter: Send + Sync + 'static {
20 fn adapter_registered(&self, _id: usize, _handle: TxHandle) {}
21 fn adapter_removed(&self) {}
22 fn tnc_started(&self) {}
23 fn tnc_closed(&self) {}
24 fn stream_began(&self, _link_setup: LinkSetup) {}
25 fn stream_data(&self, _frame_number: u16, _is_final: bool, _data: Arc<[u8; 16]>) {}
26
27 // TODO
28 // fn stream_lost(&self);
29 // fn stream_assembled_text_block()
30 // fn stream_gnss_data()
31 // fn stream_extended_callsign_data()
32
33 // fn stream_tx_ended_early(&self); // underrun/overrun
34 }