From 6bbfa66c4f77446c7e903fbd0cdb2addc606ca16 Mon Sep 17 00:00:00 2001 From: mattbk Date: Tue, 18 Nov 2025 21:28:24 -0600 Subject: [PATCH] Check harder for 3rd party locations and drop them. --- src/main.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index b27b54d..7226a6c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -545,6 +545,13 @@ fn aprs_loc(packet: &str) -> (f64, f64) { // Capture different pieces of the location string let re_loc = Regex::new(r"(?P\d{2})(?P[\d ]{2}\.[\d ]{2})(?P[nsNS])/(?P\d{3})(?P[\d ]{2}\.[\d ]{2})(?P[ewEW])").unwrap(); + // Check for 3rd party traffic, which may include location + let re_3p = Regex::new(r"(?TCPIP)").unwrap(); + let mut loc3p: bool = false; + if re_3p.is_match(&packet) { + loc3p = true; + } + // Only proceed if there were captures match re_loc.captures(&packet) { Some(_caps) => { @@ -572,7 +579,14 @@ fn aprs_loc(packet: &str) -> (f64, f64) { // String to paste into map for testing //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 (lat_dec, lon_dec)