]>
code.octet-stream.net Git - m17rt/blob - tools/m17rt-txpacket/src/main.rs
1 use m17app
::app
::M17App
;
2 use m17app
::link_setup
::{LinkSetup
, M17Address
};
3 use m17app
::serial
::{PttPin
, SerialPtt
};
4 use m17app
::soundcard
::Soundcard
;
5 use m17app
::soundmodem
::Soundmodem
;
6 use m17core
::protocol
::PacketType
;
9 let soundcard
= Soundcard
::new("plughw:CARD=Device,DEV=0").unwrap
();
10 soundcard
.set_tx_inverted(true);
11 let ptt
= SerialPtt
::new("/dev/ttyUSB0", PttPin
::Rts
);
12 let soundmodem
= Soundmodem
::new(soundcard
.inp
ut
(), soundcard
.output(), ptt
);
13 let app
= M17App
::new(soundmodem
);
17 println
!("Transmitting packet...");
18 let source
= M17Address
::from_callsign("VK7XT-1").unwrap
();
19 let destination
= M17Address
::new_broadcast();
20 let link_setup
= LinkSetup
::new_packet(&source
, &destination
);
21 let payload
= b
"Hello, world!";
23 .transmit_packet(&link_setup
, PacketType
::Sms
, payload
);
25 std
::thread
::sleep(std
::time
::Duration
::from_secs(1));