]> code.octet-stream.net Git - m17rt/blobdiff - m17app/src/adapter.rs
Extend adapter lifecycle, decide on some stream callbacks
[m17rt] / m17app / src / adapter.rs
index 1bc09719526278c23ab5fe59cb5b0a9e121075ad..e31234b6d90d42e484664beefb11cef30907a20e 100644 (file)
@@ -3,10 +3,24 @@ use m17core::protocol::{LsfFrame, PacketType};
 use std::sync::Arc;
 
 pub trait PacketAdapter: Send + Sync + 'static {
-    fn adapter_registered(&self, handle: TxHandle);
+    fn adapter_registered(&self, id: usize, handle: TxHandle);
+    fn adapter_removed(&self);
     fn tnc_started(&self);
     fn tnc_closed(&self);
     fn packet_received(&self, lsf: LsfFrame, packet_type: PacketType, content: Arc<[u8]>);
 }
 
-pub trait StreamAdapter: Send + Sync + 'static {}
+pub trait StreamAdapter: Send + Sync + 'static {
+    fn adapter_registered(&self, id: usize, handle: TxHandle);
+    fn adapter_removed(&self);
+    fn tnc_started(&self);
+    fn tnc_closed(&self);
+    fn stream_began(&self, lsf: LsfFrame);
+    fn stream_data(&self, frame_number: u16, is_final: bool, data: Arc<[u8; 16]>);
+    fn stream_lost(&self);
+
+    // TODO
+    // fn stream_assembled_text_block()
+    // fn stream_gnss_data()
+    // fn stream_extended_callsign_data()
+}