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

@@ -1,15 +1,17 @@
pub(crate) mod markers { pub(crate) mod markers {
use log::info; use log::info;
use crate::structs::Marker;
pub fn get(placeholder: String) -> &'static str { pub fn get(placeholder: String) -> &'static str {
info!("{}", placeholder); info!("{}", placeholder);
return "not implemented yet"; return "not implemented yet";
} }
pub fn post(placeholder: Vec<String>) -> &'static str { pub fn post(data: Vec<Marker>) -> &'static str {
for item in placeholder { for item in data {
info!("Item: {}", item) info!("{} - {}", item.uid, item.name)
} }
return "not implemented yet"; return "not implemented yet";

View File

@@ -1,7 +1,6 @@
use arma_rs::{arma, Extension, Group}; use arma_rs::{arma, Extension, Group};
use util::get_uuid; use util::get_uuid;
mod commands; mod commands;
mod services;
mod structs; mod structs;
mod tests; mod tests;
mod util; mod util;

View File

@@ -2,23 +2,56 @@ use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
pub struct Marker { pub struct Marker {
pub longitude: f64, pub longitude: f64,
pub latitude: f64, pub latitude: f64,
pub name: String, pub name: String,
pub uid: String, pub uid: String,
pub r#type: Option<String>, pub r#type: String,
pub course: Option<i32>, pub course: i32,
pub azimuth: Option<i32>, pub speed: i32,
pub speed: Option<i32>, pub hae: i32,
pub battery: Option<i32>, pub api_address: String,
pub fov: Option<i32>, pub api_auth_token: String,
pub ce: Option<i32>,
pub hae: Option<i32>,
pub le: Option<i32>,
} }
pub struct MarkerPayload { use arma_rs::FromArma;
pub api_address: String,
pub api_auth_token: String, impl FromArma for Marker {
pub markers: [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,
})
}
}

View File

@@ -12,12 +12,4 @@ mod request {
pub fn post(data: String) -> &'static str { pub fn post(data: String) -> &'static str {
return "not implemented yet"; return "not implemented yet";
} }
pub fn get(data: String) -> &'static str {
return "not implemented yet";
}
pub fn delete(data: String) -> &'static str {
return "not implemented yet";
}
} }