]>
code.octet-stream.net Git - m17rt/blob - tools/m17rt-rxpacket/src/main.rs
1cdd1d89ef054fe418398b15fd9866a765421ae1
1 use m17app
::adapter
::PacketAdapter
;
2 use m17app
::app
::M17App
;
3 use m17app
::link_setup
::LinkSetup
;
4 use m17app
::soundmodem
::{InputRrcFile
, NullOutputSink
, NullPtt
, Soundmodem
};
5 use m17core
::protocol
::PacketType
;
6 use std
::path
::PathBuf
;
10 let path
= PathBuf
::from("../../../Data/mypacket.rrc");
11 let soundmodem
= Soundmodem
::new(
12 InputRrcFile
::new(path
),
13 NullOutputSink
::new(),
16 let app
= M17App
::new(soundmodem
);
17 app
.add_packet_adapter(PacketPrinter
);
26 impl PacketAdapter
for PacketPrinter
{
27 fn packet_received(&self, link_setup
: LinkSetup
, packet_type
: PacketType
, content
: Arc
<[u8]>) {
29 "from {} to {} type {:?} len {}",
31 link_setup
.destination(),
35 println
!("{}", String
::from_utf8_lossy(&content
));