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();
}