mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 17:53:28 +00:00
Added GPS CoT Structs
This commit is contained in:
@@ -15,6 +15,7 @@ pub struct CursorOverTime {
|
||||
pub track_course: Option<i32>,
|
||||
pub track_speed: Option<f32>,
|
||||
pub link_uid: Option<String>,
|
||||
pub remarker: Option<String>,
|
||||
}
|
||||
|
||||
impl CursorOverTime {
|
||||
@@ -102,6 +103,10 @@ impl CursorOverTime {
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(remark) = &self.remarker {
|
||||
xml.push_str(format!("<remarks>ARMATAK | {}</remarks>", remark).as_str());
|
||||
}
|
||||
|
||||
xml.push_str("</detail></event>");
|
||||
|
||||
return xml;
|
||||
|
||||
@@ -39,6 +39,7 @@ impl DigitalPointerPayload {
|
||||
track_course: None,
|
||||
track_speed: None,
|
||||
link_uid: Some(self.link_uid.clone()),
|
||||
remarker: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use arma_rs::{FromArma, FromArmaError};
|
||||
|
||||
use super::cot::CursorOverTime;
|
||||
|
||||
pub struct EudCoTPayload {
|
||||
@@ -57,6 +56,7 @@ impl EudCoTPayload {
|
||||
track_course: Some(self.track_course),
|
||||
track_speed: Some(self.track_speed),
|
||||
link_uid: None,
|
||||
remarker: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
65
src/cot/gps.rs
Normal file
65
src/cot/gps.rs
Normal file
@@ -0,0 +1,65 @@
|
||||
use arma_rs::{FromArma, FromArmaError};
|
||||
use super::cot::CursorOverTime;
|
||||
|
||||
pub struct ExternalPositionPayload {
|
||||
pub uuid: String,
|
||||
pub point_lat: f64,
|
||||
pub point_lon: f64,
|
||||
pub point_hae: f32,
|
||||
pub contact_callsign: String,
|
||||
pub track_course: i32,
|
||||
pub track_speed: f32,
|
||||
pub group_name: String,
|
||||
pub group_role: String,
|
||||
pub remarker: String,
|
||||
}
|
||||
|
||||
impl FromArma for ExternalPositionPayload {
|
||||
fn from_arma(data: String) -> Result<ExternalPositionPayload, FromArmaError> {
|
||||
let (
|
||||
uuid,
|
||||
point_lat,
|
||||
point_lon,
|
||||
point_hae,
|
||||
contact_callsign,
|
||||
track_course,
|
||||
track_speed,
|
||||
group_name,
|
||||
group_role,
|
||||
remarker,
|
||||
) = <(String, f64, f64, f32, String, i32, f32, String, String, String)>::from_arma(data)?;
|
||||
Ok(Self {
|
||||
uuid,
|
||||
point_lat,
|
||||
point_lon,
|
||||
point_hae,
|
||||
contact_callsign,
|
||||
track_course,
|
||||
track_speed,
|
||||
group_name,
|
||||
group_role,
|
||||
remarker,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl ExternalPositionPayload {
|
||||
pub fn to_cot(&self) -> CursorOverTime {
|
||||
CursorOverTime {
|
||||
uuid: Some(self.uuid.clone()),
|
||||
r#type: None,
|
||||
point_lat: self.point_lat,
|
||||
point_lon: self.point_lon,
|
||||
point_hae: self.point_hae,
|
||||
point_ce: None,
|
||||
point_le: None,
|
||||
contact_callsign: self.contact_callsign.clone(),
|
||||
group_name: Some(self.group_name.clone()),
|
||||
group_role: Some(self.group_role.clone()),
|
||||
track_course: Some(self.track_course),
|
||||
track_speed: Some(self.track_speed),
|
||||
link_uid: None,
|
||||
remarker: Some(self.remarker.clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod cot;
|
||||
pub mod digital_pointer;
|
||||
pub mod eud;
|
||||
pub mod gps;
|
||||
pub mod nato;
|
||||
@@ -54,6 +54,7 @@ impl MarkerCoTPayload {
|
||||
track_course: Some(self.track_course),
|
||||
track_speed: Some(self.track_speed),
|
||||
link_uid: None,
|
||||
remarker: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user