diff --git a/src/main.rs b/src/main.rs index 5211c97..cfea471 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,13 +51,17 @@ struct Cli { #[arg(short = 'u', long, default_value_t = false)] ui_only: bool, - // Send UDP to what IP address (e.g. 127.0.0.1) + /// Send UDP to what IP address (e.g. 127.0.0.1) #[arg(short = 'b', long, default_value_t = std::net::IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)))] uip: std::net::IpAddr, - // Send UDP to what port (e.g. 8000) + /// Send UDP to what port (e.g. 8000; 55555 disables UDP) #[arg(short = 'k', long, value_parser = validate_port, default_value_t = 55555)] uport: u16, + + /// Spotter callsign (e.g. W1CDN) + #[arg(short = 's', long)] + spotter: String, } /// Convert a byte slice into a hex-dump string for debugging purposes. @@ -358,6 +362,7 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) { let source = hdr.callfrom_str(); let basic_destination = hdr.callto_str(); let timestamp = Local::now().format("%H:%M:%S").to_string(); + let spotter = &cli.spotter; // Filter and compute the text from the payload only once. let text = filter_text(&frame.payload); @@ -403,6 +408,7 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) { let packet = json!({ "final_destination": &final_destination, "source": &source, + "spotter": &spotter, "summary": &summary, "text": &text, "timestamp": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(),