]> code.octet-stream.net Git - m17rt/blob - m17app/src/adapter.rs
New Soundcard struct, use it in test programs
[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 let _ = id;
8 let _ = handle;
9 }
10 fn adapter_removed(&self) {}
11 fn tnc_started(&self) {}
12 fn tnc_closed(&self) {}
13 fn packet_received(&self, link_setup: LinkSetup, packet_type: PacketType, content: Arc<[u8]>) {
14 let _ = link_setup;
15 let _ = packet_type;
16 let _ = content;
17 }
18 }
19
20 pub trait StreamAdapter: Send + Sync + 'static {
21 fn adapter_registered(&self, id: usize, handle: TxHandle) {
22 let _ = id;
23 let _ = handle;
24 }
25 fn adapter_removed(&self) {}
26 fn tnc_started(&self) {}
27 fn tnc_closed(&self) {}
28 fn stream_began(&self, link_setup: LinkSetup) {
29 let _ = link_setup;
30 }
31 fn stream_data(&self, frame_number: u16, is_final: bool, data: Arc<[u8; 16]>) {
32 let _ = frame_number;
33 let _ = is_final;
34 let _ = data;
35 }
36
37 // TODO
38 // fn stream_lost(&self);
39 // fn stream_assembled_text_block()
40 // fn stream_gnss_data()
41 // fn stream_extended_callsign_data()
42
43 // fn stream_tx_ended_early(&self); // underrun/overrun
44 }