mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 22:13:28 +00:00
added location sender dll command
This commit is contained in:
@@ -9,6 +9,22 @@ pub struct LocationPayload {
|
||||
pub bearing: f32,
|
||||
}
|
||||
|
||||
pub trait IntoMessage {
|
||||
fn into_message(self) -> String;
|
||||
}
|
||||
|
||||
impl IntoMessage for String {
|
||||
fn into_message(self) -> String {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoMessage for LocationPayload {
|
||||
fn into_message(self) -> String {
|
||||
serde_json::to_string(&self).unwrap() // Convert struct to JSON
|
||||
}
|
||||
}
|
||||
|
||||
impl FromArma for LocationPayload {
|
||||
fn from_arma(data: String) -> Result<LocationPayload, FromArmaError> {
|
||||
let (latitude, longitude, altitude, bearing) = <(f32, f32, f32, f32)>::from_arma(data)?;
|
||||
|
||||
Reference in New Issue
Block a user