]> code.octet-stream.net Git - m17rt/blob - tools/m17rt-txpacket/src/main.rs
RTLSDR input via rtl_fm
[m17rt] / 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;
7
8 fn main() {
9 let soundcard = Soundcard::new("plughw:CARD=Device,DEV=0").unwrap();
10 let ptt = SerialPtt::new("/dev/ttyUSB0", PttPin::Rts);
11 let soundmodem = Soundmodem::new(soundcard.input(), soundcard.output(), ptt);
12 let app = M17App::new(soundmodem);
13
14 app.start();
15
16 println!("Transmitting packet...");
17 let source = M17Address::from_callsign("VK7XT-1").unwrap();
18 let destination = M17Address::new_broadcast();
19 let link_setup = LinkSetup::new_packet(&source, &destination);
20 let payload = b"Hello, world!";
21 app.tx()
22 .transmit_packet(&link_setup, PacketType::Sms, payload);
23
24 std::thread::sleep(std::time::Duration::from_secs(1));
25 app.close();
26 }