mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 15:23:28 +00:00
refactored get uuid fuction on extension
This commit is contained in:
107
Cargo.lock
generated
107
Cargo.lock
generated
@@ -43,9 +43,17 @@ name = "armatak"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arma-rs",
|
"arma-rs",
|
||||||
|
"regex",
|
||||||
"serde",
|
"serde",
|
||||||
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.1.16"
|
version = "1.1.16"
|
||||||
@@ -89,6 +97,17 @@ dependencies = [
|
|||||||
"windows 0.48.0",
|
"windows 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.11"
|
version = "1.0.11"
|
||||||
@@ -177,6 +196,15 @@ version = "0.2.14"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
|
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.86"
|
version = "1.0.86"
|
||||||
@@ -195,6 +223,36 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.10.6"
|
version = "1.10.6"
|
||||||
@@ -413,12 +471,40 @@ version = "1.0.12"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "uuid"
|
||||||
|
version = "1.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
"rand",
|
||||||
|
"uuid-macro-internal",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "uuid-macro-internal"
|
||||||
|
version = "1.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ee1cd046f83ea2c4e920d6ee9f7c3537ef928d75dce5d84a87c2c5d6b3999a3a"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "valuable"
|
name = "valuable"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
@@ -525,3 +611,24 @@ name = "windows_x86_64_msvc"
|
|||||||
version = "0.48.5"
|
version = "0.48.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy"
|
||||||
|
version = "0.7.35"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"zerocopy-derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy-derive"
|
||||||
|
version = "0.7.35"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|||||||
@@ -7,8 +7,17 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arma-rs = "1.10.4"
|
arma-rs = "1.10.4"
|
||||||
|
regex = "1.10.6"
|
||||||
serde = { version = "1.0.210", features = ["derive"] }
|
serde = { version = "1.0.210", features = ["derive"] }
|
||||||
|
|
||||||
|
[dependencies.uuid]
|
||||||
|
version = "1.10.0"
|
||||||
|
features = [
|
||||||
|
"v4", # Lets you generate random UUIDs
|
||||||
|
"fast-rng", # Use a faster (but still sufficiently random) RNG
|
||||||
|
"macro-diagnostics", # Enable better diagnostics for compile-time UUIDs
|
||||||
|
]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "armatak"
|
name = "armatak"
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ params["_unit"];
|
|||||||
_uuid = _unit getVariable "_atak_uid";
|
_uuid = _unit getVariable "_atak_uid";
|
||||||
|
|
||||||
if (isNil "_uuid") then {
|
if (isNil "_uuid") then {
|
||||||
_uuid = "armatak" callExtension "get_uid";
|
_uuid = "armatak" callExtension "uuid";
|
||||||
_unit setVariable ["_atak_uid", _uuid];
|
_unit setVariable ["_atak_uid", _uuid];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
37
src/lib.rs
37
src/lib.rs
@@ -1,8 +1,9 @@
|
|||||||
use arma_rs::{arma, Extension, Group};
|
use arma_rs::{arma, Extension, Group};
|
||||||
|
|
||||||
#[arma]
|
#[arma]
|
||||||
fn init() -> Extension {
|
pub fn init() -> Extension {
|
||||||
Extension::build()
|
Extension::build()
|
||||||
|
.command("uuid", get_uuid)
|
||||||
.group(
|
.group(
|
||||||
"markers",
|
"markers",
|
||||||
Group::new()
|
Group::new()
|
||||||
@@ -20,43 +21,35 @@ fn init() -> Extension {
|
|||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
mod tests;
|
||||||
pub struct Marker {
|
mod structs;
|
||||||
pub longitude: f64,
|
|
||||||
pub latitude: f64,
|
fn get_uuid() -> String {
|
||||||
pub name: String,
|
use uuid::Uuid;
|
||||||
pub uid: String,
|
|
||||||
pub r#type: Option<String>,
|
Uuid::new_v4().to_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>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mod markers {
|
mod markers {
|
||||||
pub fn get(placeholder: String) -> String {
|
pub fn get(placeholder: String) -> String {
|
||||||
format!("Not implemented yet, {}", placeholder)
|
format!("ERROR: Not implemented yet, {}", placeholder)
|
||||||
}
|
}
|
||||||
pub fn post(placeholder: String) -> String {
|
pub fn post(placeholder: String) -> String {
|
||||||
format!("Not implemented yet, {}", placeholder)
|
format!("ERROR: Not implemented yet, {}", placeholder)
|
||||||
}
|
}
|
||||||
pub fn delete(placeholder: String) -> String {
|
pub fn delete(placeholder: String) -> String {
|
||||||
format!("Not implemented yet, {}", placeholder)
|
format!("ERROR: Not implemented yet, {}", placeholder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod casevac {
|
mod casevac {
|
||||||
pub fn get(placeholder: String) -> String {
|
pub fn get(placeholder: String) -> String {
|
||||||
format!("Not implemented yet, {}", placeholder)
|
format!("ERROR: Not implemented yet, {}", placeholder)
|
||||||
}
|
}
|
||||||
pub fn post(placeholder: String) -> String {
|
pub fn post(placeholder: String) -> String {
|
||||||
format!("Not implemented yet, {}", placeholder)
|
format!("ERROR: Not implemented yet, {}", placeholder)
|
||||||
}
|
}
|
||||||
pub fn delete(placeholder: String) -> String {
|
pub fn delete(placeholder: String) -> String {
|
||||||
format!("Not implemented yet, {}", placeholder)
|
format!("ERROR: Not implemented yet, {}", placeholder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user