X-Git-Url: https://code.octet-stream.net/m17rt/blobdiff_plain/1a444762d8fd7d48e4f56a87c6bd77f837522d5d..6440cd74346c4b2d63d4774476e8c6113c032534:/tools/m17rt-txpacket/src/main.rs diff --git a/tools/m17rt-txpacket/src/main.rs b/tools/m17rt-txpacket/src/main.rs index 538291a..fb6eda1 100644 --- a/tools/m17rt-txpacket/src/main.rs +++ b/tools/m17rt-txpacket/src/main.rs @@ -1,33 +1,26 @@ use m17app::app::M17App; use m17app::link_setup::{LinkSetup, M17Address}; -use m17app::soundmodem::{ - InputRrcFile, InputSoundcard, NullInputSource, NullOutputSink, NullPtt, OutputRrcFile, - OutputSoundcard, Soundmodem, -}; +use m17app::serial::{PttPin, SerialPtt}; +use m17app::soundcard::Soundcard; +use m17app::soundmodem::Soundmodem; use m17core::protocol::PacketType; -use std::path::PathBuf; -pub fn mod_test() { - let out_path = PathBuf::from("../../../Data/mypacket.rrc"); - let output = OutputRrcFile::new(out_path); - //let output = OutputSoundcard::new(); - let soundmodem = Soundmodem::new(NullInputSource::new(), output, NullPtt::new()); +fn main() { + let soundcard = Soundcard::new("plughw:CARD=Device,DEV=0").unwrap(); + let ptt = SerialPtt::new("/dev/ttyUSB0", PttPin::Rts); + let soundmodem = Soundmodem::new(soundcard.input(), soundcard.output(), ptt); let app = M17App::new(soundmodem); + app.start(); - std::thread::sleep(std::time::Duration::from_secs(1)); - println!("Transmitting packet..."); - let source = M17Address::from_callsign("VK7XT").unwrap(); + println!("Transmitting packet..."); + let source = M17Address::from_callsign("VK7XT-1").unwrap(); let destination = M17Address::new_broadcast(); let link_setup = LinkSetup::new_packet(&source, &destination); let payload = b"Hello, world!"; app.tx() - .transmit_packet(&link_setup, PacketType::Raw, payload); + .transmit_packet(&link_setup, PacketType::Sms, payload); - std::thread::sleep(std::time::Duration::from_secs(5)); -} - -fn main() { - env_logger::init(); - mod_test(); + std::thread::sleep(std::time::Duration::from_secs(1)); + app.close(); }