mirror of
https://gitea.farpn.net/w1cdn/mwtchahrd.git
synced 2025-11-18 11:56:37 -06:00
Send actual null values instead of empty text strings to spothole if there is no SSID.
This commit is contained in:
14
src/main.rs
14
src/main.rs
@@ -10,7 +10,7 @@ use std::thread::sleep;
|
|||||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||||
use std::net::UdpSocket;
|
use std::net::UdpSocket;
|
||||||
use std::net::Ipv4Addr;
|
use std::net::Ipv4Addr;
|
||||||
use serde_json::json;
|
use serde_json::{json};
|
||||||
use reqwest;
|
use reqwest;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
@@ -393,15 +393,19 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager, loc_st
|
|||||||
let my_lon = &cli.my_lon;
|
let my_lon = &cli.my_lon;
|
||||||
|
|
||||||
// Split callsign and SSID if there are both
|
// Split callsign and SSID if there are both
|
||||||
let (source_call, source_ssid) = if source.contains("-") {
|
let (source_call, source_ssid): (&String, Option<&String>) = if source.contains("-") {
|
||||||
let re_source = Regex::new(r"(?P<call>.*)-(?P<ssid>[\d])").unwrap();
|
let re_source = Regex::new(r"(?P<call>.*)-(?P<ssid>[\d])").unwrap();
|
||||||
// Break captures into named values
|
// Break captures into named values
|
||||||
let callssid = re_source.captures(&source).unwrap();
|
let callssid = re_source.captures(&source).unwrap();
|
||||||
|
|
||||||
(&callssid["call"].to_string(), &callssid["ssid"].to_string())
|
(&callssid["call"].to_string(), Some(&callssid["ssid"].to_string()))
|
||||||
|
// Otherwise there is just the call and no SSID
|
||||||
} else {
|
} else {
|
||||||
(&source, &"".to_string())
|
(&source, None)
|
||||||
|
//(&source, &String::new())
|
||||||
};
|
};
|
||||||
|
println!("{:?}",(source_call, source_ssid));
|
||||||
|
|
||||||
|
|
||||||
//println!("{} - {}", source_call, source_ssid);
|
//println!("{} - {}", source_call, source_ssid);
|
||||||
|
|
||||||
@@ -478,7 +482,7 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager, loc_st
|
|||||||
let json_lat = stored_loc[0].clone() ;
|
let json_lat = stored_loc[0].clone() ;
|
||||||
let json_lon = stored_loc[1].clone() ;
|
let json_lon = stored_loc[1].clone() ;
|
||||||
|
|
||||||
println!("Stored location: {} {}", stored_loc[0].clone(), stored_loc[1].clone());
|
//println!("Stored location: {} {}", stored_loc[0].clone(), stored_loc[1].clone());
|
||||||
|
|
||||||
// If Spothole is enabled
|
// If Spothole is enabled
|
||||||
if summary == "UI" && cli.spothole {
|
if summary == "UI" && cli.spothole {
|
||||||
|
|||||||
Reference in New Issue
Block a user