diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2024-01-24 22:25:00 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2024-01-24 22:25:00 +0100 |
commit | df4b62f2a1aa616e4038b1511b2e38cd956e6423 (patch) | |
tree | 7a320e08c3a6f3f9b2f944f9158a728c582efc16 /src/main.rs | |
parent | 67441f813917d0a9c6624ec04ddc08d89ec2b3bc (diff) | |
download | cats-radio-node-df4b62f2a1aa616e4038b1511b2e38cd956e6423.tar.gz cats-radio-node-df4b62f2a1aa616e4038b1511b2e38cd956e6423.tar.bz2 cats-radio-node-df4b62f2a1aa616e4038b1511b2e38cd956e6423.zip |
Get Chat window working
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/main.rs b/src/main.rs index 5eb47e8..35d7d65 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,7 +24,10 @@ const TUN_MTU : usize = 255; #[tokio::main] async fn main() -> std::io::Result<()> { - simple_logger::SimpleLogger::new().env().init().unwrap(); + simple_logger::SimpleLogger::new() + .with_level(log::LevelFilter::Debug) + .env() + .init().unwrap(); let conf = config::Config::load().expect("Could not load config"); @@ -125,18 +128,21 @@ async fn main() -> std::io::Result<()> { if let Some(ident) = packet.identification() { debug!(" From {}-{}", ident.callsign, ident.ssid); - let mut commentbuf = [0u8, 255]; - if let Ok(comment) = packet.comment(&mut commentbuf) { - let m = ui::UIPacket { - received_at: chrono::Utc::now(), - from_callsign: ident.callsign.to_string(), - from_ssid: ident.ssid, - comment: Some(comment.to_owned()) - }; - match ws_broadcast.send(m) { - Ok(num) => debug!("Send WS message to {num}"), - Err(_) => debug!("No WS receivers currently"), + let mut commentbuf = [0u8; 255]; + match packet.comment(&mut commentbuf) { + Ok(comment) => { + let m = ui::UIPacket { + received_at: chrono::Utc::now(), + from_callsign: ident.callsign.to_string(), + from_ssid: ident.ssid, + comment: Some(comment.to_owned()) + }; + match ws_broadcast.send(m) { + Ok(num) => debug!("Send WS message to {num}"), + Err(_) => debug!("No WS receivers currently"), + } } + Err(e) => warn!("Decode packet comment error: {e}"), } } |