```
feat(realtime): 多源观测追踪与启动配置文件支持 - 协议版本升至 3,Target 新增 sources 字段保留各接收器独立观测 - Store 改为按接收器维护 SourceObservation,基于 received_at_ms 独立执行 TTL 过期,过期后自动 refresh 选取最新有效位置 - refresh() 按时间排序源观测,优先选取有坐标的最近记录 - rid-shared 新增 SourceObservation 结构体 - Observation 验证内联 target_id 规则,长度不超过 192 - DeviceTelemetry 扩展 raw_identity、raw_position、 coordinate_system、position_unverified、relative_height_m - 项目级 config.json 支持版本化配置与 sqlite.busy_timeout_ms, 优先级:环境变量 > config.json > 旧版 maps/config.json - web-worker 传递 sources 与 position_source 至前端 - 首页标题更新为"凌空智巡无人机监测系统" ```
This commit is contained in:
@@ -5,7 +5,7 @@ pub mod geofences;
|
||||
pub mod map_settings;
|
||||
pub mod target_lists;
|
||||
|
||||
pub const PROTOCOL_VERSION: u16 = 2;
|
||||
pub const PROTOCOL_VERSION: u16 = 3;
|
||||
pub const MAX_BATCH: usize = 4096;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
||||
@@ -36,7 +36,7 @@ impl Observation {
|
||||
&& s.bytes()
|
||||
.all(|b| b.is_ascii_alphanumeric() || b == b'-' || b == b'_')
|
||||
}
|
||||
identity(&self.target_id)
|
||||
target_lists::valid_target_id(&self.target_id)
|
||||
&& identity(&self.receiver_id)
|
||||
&& match (self.longitude, self.latitude) {
|
||||
(None, None) => true,
|
||||
@@ -57,8 +57,15 @@ impl Observation {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
||||
pub struct SourceObservation {
|
||||
pub observation: Observation,
|
||||
pub received_at_ms: u64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
||||
pub struct Target {
|
||||
pub sources: Vec<SourceObservation>,
|
||||
pub observation: Observation,
|
||||
pub received_at_ms: u64,
|
||||
/// Changes on every position availability transition, even between coalesced frames.
|
||||
@@ -90,6 +97,11 @@ pub struct Metrics {
|
||||
/// Fields reported by the device; height reference systems are never interchanged.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
|
||||
pub struct DeviceTelemetry {
|
||||
pub raw_identity: Option<String>,
|
||||
pub raw_position: Option<[f64; 2]>,
|
||||
pub coordinate_system: Option<i64>,
|
||||
pub position_unverified: bool,
|
||||
pub relative_height_m: Option<f64>,
|
||||
pub serial: Option<String>,
|
||||
pub mac: Option<String>,
|
||||
pub model: Option<String>,
|
||||
|
||||
@@ -37,7 +37,7 @@ pub struct Mutation {
|
||||
|
||||
pub fn valid_target_id(value: &str) -> bool {
|
||||
!value.is_empty()
|
||||
&& value.len() <= 64
|
||||
&& (value.len() <= 64 || (value.starts_with("SRC-") && value.len() <= 192))
|
||||
&& value
|
||||
.bytes()
|
||||
.all(|b| b.is_ascii_alphanumeric() || b == b'-' || b == b'_')
|
||||
|
||||
Reference in New Issue
Block a user