pub struct StationList { /* private fields */ }Expand description
Tracks APRS stations heard on the network.
Implementations§
Source§impl StationList
impl StationList
Sourcepub fn new(max_entries: usize, max_age: Duration) -> StationList
pub fn new(max_entries: usize, max_age: Duration) -> StationList
Create a new station list with the given capacity and age limits.
Sourcepub fn update(
&mut self,
source: &str,
data: &AprsData,
path: &[String],
now: Instant,
)
pub fn update( &mut self, source: &str, data: &AprsData, path: &[String], now: Instant, )
Update the station list from a parsed APRS packet.
Creates a new entry if the station has not been seen before, or
updates the existing entry with fresh data. The now parameter
stamps the entry’s last_heard field — callers in the tokio
shell read the wall clock once per iteration and thread it down.
Sourcepub fn get(&self, callsign: &str) -> Option<&StationEntry>
pub fn get(&self, callsign: &str) -> Option<&StationEntry>
Get a station entry by callsign.
Sourcepub fn recent(&self) -> Vec<&StationEntry>
pub fn recent(&self) -> Vec<&StationEntry>
Get all stations sorted by last heard (most recent first).
Sourcepub fn nearby(&self, lat: f64, lon: f64, radius_km: f64) -> Vec<&StationEntry>
pub fn nearby(&self, lat: f64, lon: f64, radius_km: f64) -> Vec<&StationEntry>
Get stations within a radius (in km) of a position.
Uses the haversine formula for great-circle distance calculation. Only stations with a known position are considered.
Sourcepub fn purge_expired(&mut self, now: Instant)
pub fn purge_expired(&mut self, now: Instant)
Remove expired entries (older than max_age).
The now parameter is compared against each entry’s last_heard
timestamp; entries older than max_age are evicted.