mirror of
				https://gitea.farpn.net/w1cdn/mwtchahrd.git
				synced 2025-11-04 05:46:36 -06:00 
			
		
		
		
	Add spotter as an argument.
This commit is contained in:
		
							
								
								
									
										10
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								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(),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user