1
0
mirror of https://gitea.farpn.net/w1cdn/mwtchahrd.git synced 2025-10-19 16:04:10 -05:00

Add spotter as an argument.

This commit is contained in:
mattbk
2025-10-15 21:19:27 -05:00
parent 98da8b95d5
commit c8d7b6a817

View File

@ -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(),