blitzortung/src/detectors.rs
2025-08-21 00:58:40 +03:00

55 lines
1.3 KiB
Rust

use serde::Deserialize;
#[derive(Debug, Deserialize, Clone)]
pub struct DetectorFile {
#[serde(rename = "type")]
pub file_type: String, // "FeatureCollection"
pub features: Vec<Feature>,
}
#[derive(Debug, Deserialize, Clone)]
pub struct Feature {
#[serde(rename = "type")]
pub feature_type: String, // "Feature"
pub geometry: Geometry,
pub properties: Properties,
}
#[derive(Debug, Deserialize, Clone)]
pub struct Geometry {
#[serde(rename = "type")]
pub geometry_type: String, // "Point"
pub coordinates: [f64; 2],
}
#[derive(Debug, Deserialize, Clone)]
pub struct Properties {
pub station: i32,
pub user: i32,
pub generation: String,
pub status: String,
// Sometimes string timestamp, sometimes number 0
pub signal_last_ctime: serde_json::Value,
pub region_mask: i32,
pub comment: Option<String>,
pub controller_board: Option<String>,
pub firmware: Option<String>,
pub city: Option<String>,
pub country: Option<String>,
pub website: Option<String>,
pub counters: Vec<Counter>,
pub user_stations: Vec<i32>,
}
#[derive(Debug, Deserialize, Clone)]
pub struct Counter {
pub region: i32,
pub all: i32,
pub valid: i32,
pub member: i32,
pub used: i32,
pub min_distance: i64,
pub max_distance: i64,
}