]> code.octet-stream.net Git - m17rt/blob - tools/m17rt-txpacket/src/main.rs
538291aecfd55fa3a5043fb7c91c41b2fc6496dd
[m17rt] / tools / m17rt-txpacket / src / main.rs
1 use m17app::app::M17App;
2 use m17app::link_setup::{LinkSetup, M17Address};
3 use m17app::soundmodem::{
4 InputRrcFile, InputSoundcard, NullInputSource, NullOutputSink, NullPtt, OutputRrcFile,
5 OutputSoundcard, Soundmodem,
6 };
7 use m17core::protocol::PacketType;
8 use std::path::PathBuf;
9
10 pub fn mod_test() {
11 let out_path = PathBuf::from("../../../Data/mypacket.rrc");
12 let output = OutputRrcFile::new(out_path);
13 //let output = OutputSoundcard::new();
14 let soundmodem = Soundmodem::new(NullInputSource::new(), output, NullPtt::new());
15 let app = M17App::new(soundmodem);
16 app.start();
17 std::thread::sleep(std::time::Duration::from_secs(1));
18 println!("Transmitting packet...");
19
20 let source = M17Address::from_callsign("VK7XT").unwrap();
21 let destination = M17Address::new_broadcast();
22 let link_setup = LinkSetup::new_packet(&source, &destination);
23 let payload = b"Hello, world!";
24 app.tx()
25 .transmit_packet(&link_setup, PacketType::Raw, payload);
26
27 std::thread::sleep(std::time::Duration::from_secs(5));
28 }
29
30 fn main() {
31 env_logger::init();
32 mod_test();
33 }