1
0
mirror of https://gitea.farpn.net/w1cdn/mwtchahrd.git synced 2025-11-24 22:56:35 -06:00

Check harder for 3rd party locations and drop them.

This commit is contained in:
mattbk
2025-11-18 21:28:24 -06:00
parent d95cf3e368
commit 6bbfa66c4f

View File

@@ -545,6 +545,13 @@ fn aprs_loc(packet: &str) -> (f64, f64) {
// Capture different pieces of the location string // Capture different pieces of the location string
let re_loc = Regex::new(r"(?P<latd>\d{2})(?P<latm>[\d ]{2}\.[\d ]{2})(?P<ns>[nsNS])/(?P<lond>\d{3})(?P<lonm>[\d ]{2}\.[\d ]{2})(?P<ew>[ewEW])").unwrap(); let re_loc = Regex::new(r"(?P<latd>\d{2})(?P<latm>[\d ]{2}\.[\d ]{2})(?P<ns>[nsNS])/(?P<lond>\d{3})(?P<lonm>[\d ]{2}\.[\d ]{2})(?P<ew>[ewEW])").unwrap();
// Check for 3rd party traffic, which may include location
let re_3p = Regex::new(r"(?<tcpip>TCPIP)").unwrap();
let mut loc3p: bool = false;
if re_3p.is_match(&packet) {
loc3p = true;
}
// Only proceed if there were captures // Only proceed if there were captures
match re_loc.captures(&packet) { match re_loc.captures(&packet) {
Some(_caps) => { Some(_caps) => {
@@ -573,6 +580,13 @@ fn aprs_loc(packet: &str) -> (f64, f64) {
// String to paste into map for testing // String to paste into map for testing
//println!("{}, {}", lat_dec, lon_dec); //println!("{}, {}", lat_dec, lon_dec);
// But if after all that, it's a 3rd-party location, toss it
// This is the only capture group we ID by numberf
if loc3p == true {
(lat_dec, lon_dec) = (-9999.0_f64, -9999.0_f64);
println!("Dropping location, looks like 3rd party");
}
// Return // Return
(lat_dec, lon_dec) (lat_dec, lon_dec)