]>
code.octet-stream.net Git - m17rt/blob - tools/m17rt-rxpacket/src/main.rs
1 use m17app
::adapter
::PacketAdapter
;
2 use m17app
::app
::M17App
;
3 use m17app
::link_setup
::LinkSetup
;
4 use m17app
::soundcard
::Soundcard
;
5 use m17app
::soundmodem
::{NullOutputSink
, NullPtt
, Soundmodem
};
6 use m17app
::PacketType
;
10 let soundcard
= Soundcard
::new("plughw:CARD=Device,DEV=0").unwrap
();
11 let soundmodem
= Soundmodem
::new(soundcard
.inp
ut
(), NullOutputSink
::new(), NullPtt
::new());
12 let app
= M17App
::new(soundmodem
);
13 app
.add_packet_adapter(PacketPrinter
);
22 impl PacketAdapter
for PacketPrinter
{
23 fn packet_received(&self, link_setup
: LinkSetup
, packet_type
: PacketType
, content
: Arc
<[u8]>) {
25 "from {} to {} type {:?} len {}",
27 link_setup
.destination(),
31 println
!("{}", String
::from_utf8_lossy(&content
));