]> code.octet-stream.net Git - m17rt/blob - m17app/src/adapter.rs
Stream and packet encoding round trips
[m17rt] / m17app / src / adapter.rs
1 use crate::app::TxHandle;
2 use m17core::protocol::{LsfFrame, 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(&self, lsf: LsfFrame, packet_type: PacketType, content: Arc<[u8]>);
11 }
12
13 pub trait StreamAdapter: Send + Sync + 'static {
14 fn adapter_registered(&self, id: usize, handle: TxHandle);
15 fn adapter_removed(&self);
16 fn tnc_started(&self);
17 fn tnc_closed(&self);
18 fn stream_began(&self, lsf: LsfFrame);
19 fn stream_data(&self, frame_number: u16, is_final: bool, data: Arc<[u8; 16]>);
20
21 // TODO
22 // fn stream_lost(&self);
23 // fn stream_assembled_text_block()
24 // fn stream_gnss_data()
25 // fn stream_extended_callsign_data()
26
27 // fn stream_tx_ended_early(&self); // underrun/overrun
28 }