brett plis

This commit is contained in:
Valmo Trindade
2024-09-12 02:17:52 -03:00
parent cb9ca9cd20
commit d3af4e064b
4 changed files with 56 additions and 30 deletions

View File

@@ -2,23 +2,56 @@ use serde::Serialize;
#[derive(Serialize)]
pub struct Marker {
pub longitude: f64,
pub latitude: f64,
pub name: String,
pub uid: String,
pub r#type: Option<String>,
pub course: Option<i32>,
pub azimuth: Option<i32>,
pub speed: Option<i32>,
pub battery: Option<i32>,
pub fov: Option<i32>,
pub ce: Option<i32>,
pub hae: Option<i32>,
pub le: Option<i32>,
pub longitude: f64,
pub latitude: f64,
pub name: String,
pub uid: String,
pub r#type: String,
pub course: i32,
pub speed: i32,
pub hae: i32,
pub api_address: String,
pub api_auth_token: String,
}
pub struct MarkerPayload {
pub api_address: String,
pub api_auth_token: String,
pub markers: [Marker],
}
use arma_rs::FromArma;
impl FromArma for Marker {
fn from_arma(data: String) -> Result<Self, String> {
let (
uid,
latitude,
longitude,
speed,
course,
r#type,
name,
hae,
api_address,
api_auth_token,
) = <(
String,
f64,
f64,
i32,
i32,
String,
String,
i32,
String,
String,
)>::from_arma(data)?;
Ok(Self {
uid,
latitude,
longitude,
speed,
course,
r#type,
name,
hae,
api_address,
api_auth_token,
})
}
}