mirror of
https://github.com/valmojr/armatak.git
synced 2026-08-18 16:02:58 +00:00
Compare commits
99 Commits
v1.2.4
...
feature/ci
| Author | SHA1 | Date | |
|---|---|---|---|
| ccc63d1a35 | |||
| aa2a088892 | |||
| 9f560b546a | |||
| 806e317a55 | |||
| bcb2d1983b | |||
| e71fd38b46 | |||
| 8278dab9a3 | |||
| 66a20e7527 | |||
| fe8a134897 | |||
| 7bb2da2412 | |||
| fe6bad6e88 | |||
| 7374b7222d | |||
| 2c6ca81669 | |||
| d799e99cb8 | |||
| e71db4e514 | |||
| 15e45fff71 | |||
| 3724a85c9f | |||
| 81a5a34cf2 | |||
| 26a18eac6d | |||
| 7a6c4d5bfc | |||
| ff218d6d00 | |||
| d70eb15924 | |||
| ec3507910d | |||
| c941e61e20 | |||
| 398f11efb8 | |||
| 95bb4e75e1 | |||
| a213fd916c | |||
| 74620d3346 | |||
| 5e3e3cb7a0 | |||
| 4432ea20f1 | |||
| 395487f26e | |||
| 6dee1987bb | |||
| d35ccd58e1 | |||
| 980107e00b | |||
| e53ba2ae0f | |||
| 37aa51f8c2 | |||
| ad03444ff5 | |||
| 167d47e488 | |||
| 3a82dba854 | |||
| 1fff02cdd2 | |||
| 1ab318c279 | |||
| 7a1a4b7372 | |||
| 2802f9cdc8 | |||
| ed039035df | |||
| 7fa4a7c411 | |||
| d4dfd80cdf | |||
| 720f9da2df | |||
| 5015f09d1d | |||
| 882a35c2cd | |||
| 6b3ce96c18 | |||
| 760027b925 | |||
| 9b05bcccc2 | |||
| 80320c0f2c | |||
| b43a6c9748 | |||
| dcc9e1d469 | |||
| 3c37185c1a | |||
| 671e7d5dc1 | |||
| 0ebd192487 | |||
| 3fc54a1fb5 | |||
| eaf38a4d06 | |||
| 6376b7acf0 | |||
| 52edf94b17 | |||
| 3e11dd9e16 | |||
| a9f09b6ce6 | |||
| a43aa60f45 | |||
| 9cba642e9b | |||
| c7494da901 | |||
| b9e848d66e | |||
| 99f8d991be | |||
| 753dcab26e | |||
| 2f53488ba8 | |||
| 323339e679 | |||
| 3f14a75e81 | |||
| 469a54c141 | |||
| 2ee9030c00 | |||
| 5b29a40990 | |||
| 708fe5e670 | |||
| e32aadda4e | |||
| c35b7f0268 | |||
| 876cf900c3 | |||
| 778ac0ac54 | |||
| b816144fb0 | |||
| 61ba9f6d63 | |||
| f88c02a7aa | |||
| 5ffc08e6f1 | |||
| 9392380c78 | |||
| a18343b81d | |||
| 13cd08c655 | |||
| 8fe14dc18d | |||
| 1bec26df8a | |||
| c5d5da636f | |||
| c2e137e67c | |||
| de5ac9dbb5 | |||
| ef3be1e768 | |||
| 9bda92d389 | |||
| 9763cb6697 | |||
| 5ac49e12f8 | |||
| 2108d20b01 | |||
| 524e7a0b3e |
@@ -0,0 +1,58 @@
|
|||||||
|
name: Rust CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- "feature/**"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: rust-ci-${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-and-coverage:
|
||||||
|
name: Rust tests and coverage
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install stable Rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- name: Cache Rust build artifacts
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
|
- name: Install cargo-llvm-cov
|
||||||
|
uses: taiki-e/install-action@cargo-llvm-cov
|
||||||
|
|
||||||
|
- name: Run unit tests
|
||||||
|
run: cargo test --all-targets --locked
|
||||||
|
|
||||||
|
- name: Report whole-extension coverage
|
||||||
|
run: cargo llvm-cov --all-targets --locked --summary-only --show-missing-lines
|
||||||
|
|
||||||
|
- name: Enforce 100% coverage on deterministic core
|
||||||
|
run: |
|
||||||
|
cargo llvm-cov --all-targets --locked --summary-only \
|
||||||
|
--ignore-filename-regex 'src/(lib\.rs|tests\.rs|structs\.rs|mdns\.rs|udp_socket\.rs|video_stream\.rs|tcp/(client\.rs|cot\.rs|draw\.rs|mod\.rs|transport\.rs)|tcp/tls/(connector\.rs|enrollment\.rs|mod\.rs)|cot/(cot\.rs|delete\.rs|digital_pointer\.rs|draws/.*|eud\.rs|gps\.rs|lrf\.rs|message\.rs|mod\.rs|nato\.rs|report_marker\.rs|uas\.rs)|uas/(callbacks\.rs|constants\.rs|endpoint\.rs|identity\.rs|mod\.rs|packets\.rs|payload\.rs|send\.rs|state\.rs)|utils/(address\.rs|log\.rs|mod\.rs))' \
|
||||||
|
--fail-under-lines 100
|
||||||
|
|
||||||
|
- name: Generate LCOV artifact
|
||||||
|
run: cargo llvm-cov --all-targets --locked --lcov --output-path lcov.info
|
||||||
|
|
||||||
|
- name: Upload LCOV artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: rust-lcov
|
||||||
|
path: lcov.info
|
||||||
|
if-no-files-found: error
|
||||||
+5
-1
@@ -3,6 +3,7 @@
|
|||||||
hemtt
|
hemtt
|
||||||
hemtt.exe
|
hemtt.exe
|
||||||
*.biprivatekey
|
*.biprivatekey
|
||||||
|
.hemttprivatekey
|
||||||
source/
|
source/
|
||||||
.vscode
|
.vscode
|
||||||
releases/
|
releases/
|
||||||
@@ -87,4 +88,7 @@ target/
|
|||||||
.cxx
|
.cxx
|
||||||
local.properties
|
local.properties
|
||||||
|
|
||||||
*.apk
|
*.apk
|
||||||
|
|
||||||
|
|
||||||
|
.hemtt/missions
|
||||||
+1
-22
@@ -38,28 +38,7 @@ preset = "Hemtt"
|
|||||||
[hemtt.launch.default]
|
[hemtt.launch.default]
|
||||||
workshop = [
|
workshop = [
|
||||||
"450814997", # CBA_A3
|
"450814997", # CBA_A3
|
||||||
"463939057", # ACE
|
"463939057", # ace
|
||||||
"751965892", # ACRE2
|
|
||||||
"2522638637", # ACE Extended Arsenal
|
|
||||||
"333310405", # Enhanced Movement
|
|
||||||
"2034363662", # Enhanced Movement Rework
|
|
||||||
"2941986336", # Hatchet Interaction Framework - Stable Version
|
|
||||||
"1745501605", # Hatchet H-60 pack - Stable Version
|
|
||||||
"843577117", # RHSUSAF
|
|
||||||
"843425103", # RHSAFRF
|
|
||||||
"843632231", # RHSSAF
|
|
||||||
"843593391", # RHSGREF
|
|
||||||
"1673456286", # 3CB Factions
|
|
||||||
"623475643", # 3den Enhanced
|
|
||||||
"2257686620", # Blastcore Murr Edition
|
|
||||||
"583496184", # CUP Terrains - Core
|
|
||||||
"3078351739", # Kunduz River
|
|
||||||
"1858075458", # LAMBS_Danger.fsm
|
|
||||||
"1808238502", # LAMBS_Suppression
|
|
||||||
"3425368881", # M4A1_URGI
|
|
||||||
"2268351256", # Tier One Weapons
|
|
||||||
"2560276469", # Restrict Markers
|
|
||||||
"3493557838" # Ballad of the Green Berets
|
|
||||||
]
|
]
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
|
|||||||
Generated
+1055
-19
File diff suppressed because it is too large
Load Diff
+4
-1
@@ -9,7 +9,10 @@ chrono = "0.4.39"
|
|||||||
lazy_static = "1.5.0"
|
lazy_static = "1.5.0"
|
||||||
log = "0.4.22"
|
log = "0.4.22"
|
||||||
log4rs = "1.3.0"
|
log4rs = "1.3.0"
|
||||||
once_cell = "1.19.0"
|
reqwest = { version = "0.12.15", default-features = false, features = ["blocking", "json", "rustls-tls"] }
|
||||||
|
rcgen = { version = "0.13.2", default-features = false, features = ["crypto", "pem", "aws_lc_rs"] }
|
||||||
|
rustls = "0.23.23"
|
||||||
|
rustls-pemfile = "2.2.0"
|
||||||
serde = { version = "1.0.210", features = ["derive"] }
|
serde = { version = "1.0.210", features = ["derive"] }
|
||||||
|
|
||||||
[dependencies.uuid]
|
[dependencies.uuid]
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
PREP(convertClientLocation);
|
PREP(convertClientLocation);
|
||||||
PREP(extractClientPosition);
|
PREP(extractClientPosition);
|
||||||
|
PREP(initCuratorRouterIndicators);
|
||||||
|
PREP(sendLaserRangeFinder);
|
||||||
PREP(startUDPSocket);
|
PREP(startUDPSocket);
|
||||||
|
|||||||
@@ -6,3 +6,6 @@ _local_address = "armatak" callExtension ["local_ip", []] select 0;
|
|||||||
|
|
||||||
SETVAR(player,GVAR(localAddress),_local_address);
|
SETVAR(player,GVAR(localAddress),_local_address);
|
||||||
SETVAR(player,GVAR(eudConnected),false);
|
SETVAR(player,GVAR(eudConnected),false);
|
||||||
|
SETVAR(player,GVAR(lrfEnabled),false);
|
||||||
|
|
||||||
|
call FUNC(initCuratorRouterIndicators);
|
||||||
|
|||||||
+66
-13
@@ -10,44 +10,97 @@ class armatak_udp_socket_start_dialog {
|
|||||||
class armatak_gui_module_udp_socket_dialog_main_frame: RscBackground {
|
class armatak_gui_module_udp_socket_dialog_main_frame: RscBackground {
|
||||||
idc = 16960;
|
idc = 16960;
|
||||||
x = "0.386562 * safezoneW + safezoneX";
|
x = "0.386562 * safezoneW + safezoneX";
|
||||||
y = "0.401 * safezoneH + safezoneY";
|
y = "0.357 * safezoneH + safezoneY";
|
||||||
w = "0.216563 * safezoneW";
|
w = "0.216563 * safezoneW";
|
||||||
h = "0.242 * safezoneH";
|
h = "0.495 * safezoneH";
|
||||||
colorBackground[]={0,0,0,0.45};
|
colorBackground[]={0,0,0,0.45};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Controls {
|
class Controls {
|
||||||
class armatak_gui_module_udp_socket_dialog_address_edit: RscEdit {
|
class armatak_gui_module_udp_socket_dialog_address_edit: RscEdit {
|
||||||
idc = 16961;
|
idc = 16961;
|
||||||
text = "168.15.0.3";
|
text = "192.168.15.121";
|
||||||
x = "0.391719 * safezoneW + safezoneX";
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
y = "0.445 * safezoneH + safezoneY";
|
y = "0.401 * safezoneH + safezoneY";
|
||||||
w = "0.20625 * safezoneW";
|
w = "0.20625 * safezoneW";
|
||||||
h = "0.044 * safezoneH";
|
h = "0.044 * safezoneH";
|
||||||
colorBackground[]={0,0,0,0.5};
|
colorBackground[]={0,0,0,0.5};
|
||||||
};
|
};
|
||||||
class armatak_gui_module_udp_socket_dialog_address_port_edit: RscEdit {
|
class armatak_gui_module_udp_socket_dialog_gnss_port_edit: RscEdit {
|
||||||
idc = 16962;
|
idc = 16962;
|
||||||
text = "4349";
|
text = "4349";
|
||||||
x = "0.391719 * safezoneW + safezoneX";
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
y = "0.522 * safezoneH + safezoneY";
|
y = "0.478 * safezoneH + safezoneY";
|
||||||
w = "0.20625 * safezoneW";
|
w = "0.20625 * safezoneW";
|
||||||
h = "0.044 * safezoneH";
|
h = "0.044 * safezoneH";
|
||||||
colorBackground[]={0,0,0,0.5};
|
colorBackground[]={0,0,0,0.5};
|
||||||
};
|
};
|
||||||
|
class armatak_gui_module_udp_socket_dialog_mavlink_port_edit: RscEdit {
|
||||||
|
idc = 16967;
|
||||||
|
text = "14550";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.555 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.044 * safezoneH";
|
||||||
|
colorBackground[]={0,0,0,0.5};
|
||||||
|
};
|
||||||
|
class armatak_gui_module_udp_socket_dialog_video_feed_url_edit: RscEdit {
|
||||||
|
idc = 16969;
|
||||||
|
text = "";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.709 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.044 * safezoneH";
|
||||||
|
colorBackground[]={0,0,0,0.5};
|
||||||
|
tooltip = "Optional shared feed URL. If empty, the UAV 3DEN URL is used first, then a local RTP fallback.";
|
||||||
|
};
|
||||||
|
class armatak_gui_module_udp_socket_dialog_lrf_port_edit: RscEdit {
|
||||||
|
idc = 16971;
|
||||||
|
text = "17211";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.632 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.044 * safezoneH";
|
||||||
|
colorBackground[]={0,0,0,0.5};
|
||||||
|
tooltip = "ATAK local Laser Range Finder UDP input. Leave empty to disable.";
|
||||||
|
};
|
||||||
class armatak_gui_module_udp_socket_dialog_address_text: RscText {
|
class armatak_gui_module_udp_socket_dialog_address_text: RscText {
|
||||||
idc = 16963;
|
idc = 16963;
|
||||||
text = "Phone's Socket Local Address";
|
text = "EUD's Address";
|
||||||
x = "0.391719 * safezoneW + safezoneX";
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
y = "0.412 * safezoneH + safezoneY";
|
y = "0.368 * safezoneH + safezoneY";
|
||||||
w = "0.20625 * safezoneW";
|
w = "0.20625 * safezoneW";
|
||||||
h = "0.033 * safezoneH";
|
h = "0.033 * safezoneH";
|
||||||
};
|
};
|
||||||
class armatak_gui_module_udp_socket_dialog_address_port_text: RscText {
|
class armatak_gui_module_udp_socket_dialog_gnss_port_text: RscText {
|
||||||
idc = 16964;
|
idc = 16964;
|
||||||
text = "Phone's Socket Local Port";
|
text = "Network GNSS Port";
|
||||||
x = "0.391719 * safezoneW + safezoneX";
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
y = "0.489 * safezoneH + safezoneY";
|
y = "0.445 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.033 * safezoneH";
|
||||||
|
};
|
||||||
|
class armatak_gui_module_udp_socket_dialog_mavlink_port_text: RscText {
|
||||||
|
idc = 16968;
|
||||||
|
text = "Mavlink Port";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.522 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.033 * safezoneH";
|
||||||
|
};
|
||||||
|
class armatak_gui_module_udp_socket_dialog_video_feed_url_text: RscText {
|
||||||
|
idc = 16970;
|
||||||
|
text = "Video Feed URL (Optional)";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.676 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.033 * safezoneH";
|
||||||
|
};
|
||||||
|
class armatak_gui_module_udp_socket_dialog_lrf_port_text: RscText {
|
||||||
|
idc = 16972;
|
||||||
|
text = "Laser Range Finder Port";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.599 * safezoneH + safezoneY";
|
||||||
w = "0.20625 * safezoneW";
|
w = "0.20625 * safezoneW";
|
||||||
h = "0.033 * safezoneH";
|
h = "0.033 * safezoneH";
|
||||||
};
|
};
|
||||||
@@ -56,7 +109,7 @@ class armatak_udp_socket_start_dialog {
|
|||||||
text = "Cancel";
|
text = "Cancel";
|
||||||
action = "closeDialog 2;";
|
action = "closeDialog 2;";
|
||||||
x = "0.551563 * safezoneW + safezoneX";
|
x = "0.551563 * safezoneW + safezoneX";
|
||||||
y = "0.577 * safezoneH + safezoneY";
|
y = "0.786 * safezoneH + safezoneY";
|
||||||
w = "0.0464063 * safezoneW";
|
w = "0.0464063 * safezoneW";
|
||||||
h = "0.055 * safezoneH";
|
h = "0.055 * safezoneH";
|
||||||
};
|
};
|
||||||
@@ -65,7 +118,7 @@ class armatak_udp_socket_start_dialog {
|
|||||||
text = "Ok";
|
text = "Ok";
|
||||||
action = QUOTE(call FUNC(startUDPSocket));
|
action = QUOTE(call FUNC(startUDPSocket));
|
||||||
x = "0.5 * safezoneW + safezoneX";
|
x = "0.5 * safezoneW + safezoneX";
|
||||||
y = "0.577 * safezoneH + safezoneY";
|
y = "0.786 * safezoneH + safezoneY";
|
||||||
w = "0.0464063 * safezoneW";
|
w = "0.0464063 * safezoneW";
|
||||||
h = "0.055 * safezoneH";
|
h = "0.055 * safezoneH";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,29 +1,33 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: Valmo Trindade
|
* Author: Valmo Trindade
|
||||||
* This function is used to convert the position of a unit to the world world location.
|
* This function is used to convert the position of a unit to the world world location.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
* 0: in game latitude <NUMBER> is the latitude of the unit.
|
* 0: in game latitude <NUMBER> is the latitude of the unit.
|
||||||
* 1: in game longitude <NUMBER> is the longitude of the unit.
|
* 1: in game longitude <NUMBER> is the longitude of the unit.
|
||||||
* 2: in game altitude <NUMBER> is the altitude of the unit.
|
* 2: in game altitude <NUMBER> is the altitude of the unit.
|
||||||
* 3: in game bearing <NUMBER> is the bearing of the unit.
|
* 3: in game bearing <NUMBER> is the bearing of the unit.
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* ARRAY -> [latitude, longitude, altitude, bearing]
|
* ARRAY -> [latitude, longitude, altitude, bearing]
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [player] call armatak_client_fnc_convertClientLocation;
|
* [player] call armatak_client_fnc_convertClientLocation;
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params["_latitude", "_longitude", "_altitude"];
|
params [
|
||||||
|
["_latitude", 0, [0]],
|
||||||
|
["_longitude", 0, [0]],
|
||||||
|
["_altitude", 0, [0]]
|
||||||
|
];
|
||||||
|
|
||||||
_position = [_latitude, _longitude, _altitude];
|
private _position = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
_realLocation = null;
|
private _realLocation = [0, 0, _altitude];
|
||||||
|
|
||||||
switch (toLower worldName) do {
|
switch (toLower worldName) do {
|
||||||
case "altis": {
|
case "altis": {
|
||||||
@@ -38,6 +42,9 @@ switch (toLower worldName) do {
|
|||||||
case "vr": {
|
case "vr": {
|
||||||
_realLocation = _position call armatak_fnc_convert_to_vr;
|
_realLocation = _position call armatak_fnc_convert_to_vr;
|
||||||
};
|
};
|
||||||
|
case "lawn": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_lawn;
|
||||||
|
};
|
||||||
case "cucui": {
|
case "cucui": {
|
||||||
_realLocation = _position call armatak_fnc_convert_to_cucui;
|
_realLocation = _position call armatak_fnc_convert_to_cucui;
|
||||||
};
|
};
|
||||||
@@ -74,12 +81,42 @@ switch (toLower worldName) do {
|
|||||||
case "kunduz_valley": {
|
case "kunduz_valley": {
|
||||||
_realLocation = _position call armatak_fnc_convert_to_kunduz_valley;
|
_realLocation = _position call armatak_fnc_convert_to_kunduz_valley;
|
||||||
};
|
};
|
||||||
|
case "malvinasfalkands": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_malvinas_malvinasfalkands;
|
||||||
|
};
|
||||||
|
case "pebble_island_airfield": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_malvinas_pebble_island_airfield;
|
||||||
|
};
|
||||||
|
case "p_argentino_stanley": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_malvinas_p_argentino_stanley;
|
||||||
|
};
|
||||||
|
case "top_malo_house": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_malvinas_top_malo_house;
|
||||||
|
};
|
||||||
|
case "pradera_ganso": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_malvinas_pradera_ganso;
|
||||||
|
};
|
||||||
case "tanoa": {
|
case "tanoa": {
|
||||||
_realLocation = _position call armatak_fnc_convert_to_tanoa;
|
_realLocation = _position call armatak_fnc_convert_to_tanoa;
|
||||||
};
|
};
|
||||||
case "zagor_zagorsk_reserved_forest": {
|
case "zagor_zagorsk_reserved_forest": {
|
||||||
_realLocation = _position call armatak_fnc_convert_to_zagor_zagorsk_reserved_forest;
|
_realLocation = _position call armatak_fnc_convert_to_zagor_zagorsk_reserved_forest;
|
||||||
};
|
};
|
||||||
|
case "umb_colombia": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_colombia;
|
||||||
|
};
|
||||||
|
case "clafghan": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_clafghan;
|
||||||
|
};
|
||||||
|
case "rut_mandol": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_rut_mandol;
|
||||||
|
};
|
||||||
|
case "hellanmaa": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_hellanmaa;
|
||||||
|
};
|
||||||
|
case "hellanmaaw": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_hellanmaa;
|
||||||
|
};
|
||||||
default {
|
default {
|
||||||
_warning = format ["<t color='#FF8021'>ARMATAK</t><br/> %1", "Unsupported Map"];
|
_warning = format ["<t color='#FF8021'>ARMATAK</t><br/> %1", "Unsupported Map"];
|
||||||
[[_warning, 1.5]] call CBA_fnc_notify;
|
[[_warning, 1.5]] call CBA_fnc_notify;
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Codex
|
||||||
|
* Draws a Zeus-only visual border over entities routed by the ArmaTAK CoT Router.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Draw3D event handler id <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {-1};
|
||||||
|
|
||||||
|
private _existingEh = missionNamespace getVariable [QGVAR(curatorRouterIndicatorEh), -1];
|
||||||
|
if (_existingEh >= 0) exitWith {_existingEh};
|
||||||
|
|
||||||
|
private _eh = addMissionEventHandler ["Draw3D", {
|
||||||
|
if (isNull findDisplay 312) exitWith {};
|
||||||
|
|
||||||
|
private _curator = getAssignedCuratorLogic player;
|
||||||
|
if (isNull _curator) exitWith {};
|
||||||
|
|
||||||
|
private _routed = missionNamespace getVariable ["armatak_server_syncedUnits", []];
|
||||||
|
if (_routed isEqualTo []) exitWith {};
|
||||||
|
|
||||||
|
private _editableObjects = curatorEditableObjects _curator;
|
||||||
|
private _texture = "\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa";
|
||||||
|
private _color = [0, 0.85, 1, 0.95];
|
||||||
|
private _camera = curatorCamera;
|
||||||
|
|
||||||
|
{
|
||||||
|
if (!isNull _x && {alive _x} && {_x in _editableObjects}) then {
|
||||||
|
private _pos = ASLToAGL (getPosASLVisual _x);
|
||||||
|
_pos set [2, (_pos select 2) + 0.12];
|
||||||
|
|
||||||
|
private _distance = _camera distance _x;
|
||||||
|
private _size = linearConversion [0, 2000, _distance, 0.8, 1.35, true];
|
||||||
|
private _textSize = linearConversion [0, 2000, _distance, 0.032, 0.05, true];
|
||||||
|
drawIcon3D [_texture, _color, _pos, _size, _size, 0, "TAK", 1, _textSize, "RobotoCondensed", "center"];
|
||||||
|
};
|
||||||
|
} forEach _routed;
|
||||||
|
}];
|
||||||
|
|
||||||
|
missionNamespace setVariable [QGVAR(curatorRouterIndicatorEh), _eh];
|
||||||
|
|
||||||
|
_eh
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit"];
|
||||||
|
|
||||||
|
private _lrfEnabled = player getVariable [QGVAR(lrfEnabled), false];
|
||||||
|
|
||||||
|
private _uid = format ["%1.LRF", _unit call armatak_fnc_extract_uuid];
|
||||||
|
private _laserTarget = laserTarget _unit;
|
||||||
|
|
||||||
|
if (!isNull _laserTarget) exitWith {
|
||||||
|
private _originASL = getPosASL _unit;
|
||||||
|
private _targetASL = getPosASL _laserTarget;
|
||||||
|
private _delta = _targetASL vectorDiff _originASL;
|
||||||
|
|
||||||
|
private _dx = _delta select 0;
|
||||||
|
private _dy = _delta select 1;
|
||||||
|
private _dz = _delta select 2;
|
||||||
|
private _horizontalDistance = sqrt ((_dx * _dx) + (_dy * _dy));
|
||||||
|
private _slantDistance = (_originASL vectorDistance _targetASL) max 1;
|
||||||
|
private _azimuth = (((_dx atan2 _dy) + 360) mod 360);
|
||||||
|
private _elevation = _dz atan2 (_horizontalDistance max 0.001);
|
||||||
|
private _lastTargetASL = player getVariable [QGVAR(lrfLastTargetASL), []];
|
||||||
|
private _lastSentAt = player getVariable [QGVAR(lrfLastSentAt), -1000];
|
||||||
|
private _targetMoved = _lastTargetASL isEqualTo [] || {(_lastTargetASL vectorDistance _targetASL) > 5};
|
||||||
|
private _sendCooldownElapsed = (time - _lastSentAt) >= 2.5;
|
||||||
|
|
||||||
|
player setVariable [QGVAR(lrfWasActive), true];
|
||||||
|
player setVariable [QGVAR(lrfLostAt), -1];
|
||||||
|
player setVariable [QGVAR(lrfClearSent), false];
|
||||||
|
|
||||||
|
if (_lrfEnabled && {_targetMoved} && {_sendCooldownElapsed}) then {
|
||||||
|
"armatak" callExtension ["udp_socket:send_lrf", [[_uid, _slantDistance, _azimuth, _elevation]]];
|
||||||
|
player setVariable [QGVAR(lrfLastTargetASL), _targetASL];
|
||||||
|
player setVariable [QGVAR(lrfLastSentAt), time];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(player getVariable [QGVAR(lrfWasActive), false]) exitWith {};
|
||||||
|
|
||||||
|
private _lostAt = player getVariable [QGVAR(lrfLostAt), -1];
|
||||||
|
if (_lostAt < 0) then {
|
||||||
|
player setVariable [QGVAR(lrfLostAt), time];
|
||||||
|
};
|
||||||
|
|
||||||
|
private _clearSent = player getVariable [QGVAR(lrfClearSent), false];
|
||||||
|
if (_lrfEnabled && {!_clearSent} && {(time - (player getVariable [QGVAR(lrfLostAt), time])) >= 6}) then {
|
||||||
|
"armatak" callExtension ["udp_socket:clear_lrf", [_uid]];
|
||||||
|
player setVariable [QGVAR(lrfWasActive), false];
|
||||||
|
player setVariable [QGVAR(lrfClearSent), true];
|
||||||
|
player setVariable [QGVAR(lrfLastTargetASL), []];
|
||||||
|
player setVariable [QGVAR(lrfLastSentAt), -1000];
|
||||||
|
};
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
params ["_logic"];
|
params ["_logic"];
|
||||||
|
|
||||||
_socket_is_running = player getVariable [QGVAR(eudConnected), false];
|
private _socket_is_running = player getVariable [QGVAR(eudConnected), false];
|
||||||
|
|
||||||
if (_socket_is_running) exitWith {
|
if (_socket_is_running) exitWith {
|
||||||
["Socket is already running", "error", "UDP Socket"] call EFUNC(main,notify);
|
["Socket is already running", "error", "UDP Socket"] call EFUNC(main,notify);
|
||||||
@@ -11,21 +11,55 @@ if (_socket_is_running) exitWith {
|
|||||||
|
|
||||||
disableSerialization;
|
disableSerialization;
|
||||||
|
|
||||||
_udp_socket_instance_address = ctrlText 16961;
|
private _eud_address = ctrlText 16961;
|
||||||
_udp_socket_instance_port = ctrlText 16962;
|
private _gnss_port = ctrlText 16962;
|
||||||
|
private _mavlink_port = ctrlText 16967;
|
||||||
|
private _lrf_port = ctrlText 16971;
|
||||||
|
private _video_feed_url = ctrlText 16969;
|
||||||
|
|
||||||
_udp_socket_fulladdress = ((_udp_socket_instance_address) + ":" + (_udp_socket_instance_port));
|
private _udp_socket_fulladdress = _eud_address + ":" + _gnss_port;
|
||||||
|
private _mavlink_address = _eud_address + ":" + _mavlink_port;
|
||||||
|
private _lrf_port_trimmed = trim _lrf_port;
|
||||||
|
private _lrf_enabled = _lrf_port_trimmed isNotEqualTo "";
|
||||||
|
private _lrf_address = _eud_address + ":" + _lrf_port_trimmed;
|
||||||
|
|
||||||
player setVariable [QGVAR(udp_socket_address), _udp_socket_fulladdress];
|
player setVariable [QGVAR(udp_socket_address), _udp_socket_fulladdress];
|
||||||
player setVariable [QGVAR(eudConnected), true];
|
player setVariable [QGVAR(mavlink_address), _mavlink_address];
|
||||||
|
player setVariable [QGVAR(lrf_address), _lrf_address];
|
||||||
|
player setVariable [QGVAR(lrfEnabled), _lrf_enabled];
|
||||||
|
player setVariable [QGVAR(lrfWasActive), false];
|
||||||
|
player setVariable [QGVAR(lrfLostAt), -1];
|
||||||
|
player setVariable [QGVAR(lrfClearSent), false];
|
||||||
|
player setVariable [QGVAR(lrfLastTargetASL), []];
|
||||||
|
player setVariable [QGVAR(lrfLastSentAt), -1000];
|
||||||
|
player setVariable [QGVAR(video_feed_url), trim _video_feed_url];
|
||||||
|
player setVariable [QGVAR(eudConnected), true, true];
|
||||||
|
|
||||||
|
private _advertised_video_uri = [objNull] call EFUNC(uav,resolveVideoUri);
|
||||||
|
|
||||||
"armatak" callExtension ["udp_socket:start", [_udp_socket_fulladdress]];
|
"armatak" callExtension ["udp_socket:start", [_udp_socket_fulladdress]];
|
||||||
|
"armatak" callExtension ["uas:start_endpoint", [parseNumber _mavlink_port]];
|
||||||
|
if (_lrf_enabled) then {
|
||||||
|
"armatak" callExtension ["udp_socket:start_lrf", [_lrf_address]];
|
||||||
|
};
|
||||||
|
|
||||||
|
private _mdnsInstanceName = format ["ArmaTAK-%1", name player];
|
||||||
|
"armatak" callExtension ["mdns:start_uas_advertisement", [_mdnsInstanceName, parseNumber _mavlink_port, _advertised_video_uri]];
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Client UDP socket started for %1, MAVLink target set to %2, LRF target set to %3 and advertised video URI set to %4. Digital pointer uses ATAK LRF when enabled.", _udp_socket_fulladdress, _mavlink_address, _lrf_address, _advertised_video_uri]]]];
|
||||||
|
|
||||||
|
call EFUNC(uav,startMavlinkBroadcast);
|
||||||
|
|
||||||
[{
|
[{
|
||||||
if (player getVariable [QGVAR(eudConnected), false]) then {
|
if !(player getVariable [QGVAR(eudConnected), false]) exitWith {};
|
||||||
"armatak" callExtension ["udp_socket:send_gps_cot", [player call FUNC(extractClientPosition)]];
|
|
||||||
};
|
"armatak" callExtension ["udp_socket:send_gps_cot", [player call FUNC(extractClientPosition)]];
|
||||||
}, 0.5, []] call CBA_fnc_addPerFrameHandler;
|
}, 0.5, []] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
[{
|
||||||
|
if !(player getVariable [QGVAR(eudConnected), false]) exitWith {};
|
||||||
|
|
||||||
|
[player] call FUNC(sendLaserRangeFinder);
|
||||||
|
}, 0.25, []] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
deleteVehicle _logic;
|
deleteVehicle _logic;
|
||||||
closeDialog 1;
|
closeDialog 1;
|
||||||
|
|||||||
@@ -78,6 +78,16 @@ class Cfg3den {
|
|||||||
condition = "objectVehicle";
|
condition = "objectVehicle";
|
||||||
typeName = "STRING";
|
typeName = "STRING";
|
||||||
};
|
};
|
||||||
|
class armatak_attribute_marker_video_url {
|
||||||
|
displayName = "Video Feed URL";
|
||||||
|
tooltip = "Shared UAV video URL. This per-vehicle value overrides the optional session video URL from Connect to EUD.";
|
||||||
|
property = "armatak_attribute_marker_video_url";
|
||||||
|
control = "Edit";
|
||||||
|
expression = "_this setVariable ['armatak_attribute_marker_video_url',_value]";
|
||||||
|
defaultValue = "''";
|
||||||
|
condition = "objectVehicle";
|
||||||
|
typeName = "STRING";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,12 +10,54 @@ class CfgFunctions {
|
|||||||
class send_group_cots {
|
class send_group_cots {
|
||||||
file = "\armatak\armatak\addons\main\functions\api\fn_send_group_cots.sqf";
|
file = "\armatak\armatak\addons\main\functions\api\fn_send_group_cots.sqf";
|
||||||
};
|
};
|
||||||
|
class send_enemy_cot {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_send_enemy_cot.sqf";
|
||||||
|
};
|
||||||
class send_eud_cot {
|
class send_eud_cot {
|
||||||
file = "\armatak\armatak\addons\main\functions\api\fn_send_eud_cot.sqf";
|
file = "\armatak\armatak\addons\main\functions\api\fn_send_eud_cot.sqf";
|
||||||
};
|
};
|
||||||
class send_marker_cot {
|
class send_marker_cot {
|
||||||
file = "\armatak\armatak\addons\main\functions\api\fn_send_marker_cot.sqf";
|
file = "\armatak\armatak\addons\main\functions\api\fn_send_marker_cot.sqf";
|
||||||
};
|
};
|
||||||
|
class report_marker {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_report_marker.sqf";
|
||||||
|
};
|
||||||
|
class register_cot {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_register_cot.sqf";
|
||||||
|
};
|
||||||
|
class delete_registered_cots {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_delete_registered_cots.sqf";
|
||||||
|
};
|
||||||
|
class draw_circle {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_draw_circle.sqf";
|
||||||
|
};
|
||||||
|
class draw_ellipse {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_draw_ellipse.sqf";
|
||||||
|
};
|
||||||
|
class draw_rectangle {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_draw_rectangle.sqf";
|
||||||
|
};
|
||||||
|
class draw_polyline {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_draw_polyline.sqf";
|
||||||
|
};
|
||||||
|
class draw_route {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_draw_route.sqf";
|
||||||
|
};
|
||||||
|
class draw_tactical_graphic {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_draw_tactical_graphic.sqf";
|
||||||
|
};
|
||||||
|
class send_uas_platform_cot {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_send_uas_platform_cot.sqf";
|
||||||
|
};
|
||||||
|
class send_uas_video_cot {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_send_uas_video_cot.sqf";
|
||||||
|
};
|
||||||
|
class send_uas_sensor_cot {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_send_uas_sensor_cot.sqf";
|
||||||
|
};
|
||||||
|
class set_uas_camera_override {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_set_uas_camera_override.sqf";
|
||||||
|
};
|
||||||
class stop_tcp_socket {
|
class stop_tcp_socket {
|
||||||
file = "\armatak\armatak\addons\main\functions\api\fn_stop_tcp_socket.sqf";
|
file = "\armatak\armatak\addons\main\functions\api\fn_stop_tcp_socket.sqf";
|
||||||
};
|
};
|
||||||
@@ -28,9 +70,18 @@ class CfgFunctions {
|
|||||||
class extract_marker_callsign {
|
class extract_marker_callsign {
|
||||||
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_marker_callsign.sqf";
|
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_marker_callsign.sqf";
|
||||||
};
|
};
|
||||||
|
class extract_marker_video_url {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_marker_video_url.sqf";
|
||||||
|
};
|
||||||
class extract_role {
|
class extract_role {
|
||||||
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_role.sqf";
|
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_role.sqf";
|
||||||
};
|
};
|
||||||
|
class extract_sensor_data {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_sensor_data.sqf";
|
||||||
|
};
|
||||||
|
class extract_uas_camera_data {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_uas_camera_data.sqf";
|
||||||
|
};
|
||||||
class extract_unit_callsign {
|
class extract_unit_callsign {
|
||||||
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_unit_callsign.sqf";
|
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_unit_callsign.sqf";
|
||||||
};
|
};
|
||||||
@@ -62,12 +113,30 @@ class CfgFunctions {
|
|||||||
class convert_to_kunduz_valley {
|
class convert_to_kunduz_valley {
|
||||||
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_kunduz_valley.sqf";
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_kunduz_valley.sqf";
|
||||||
};
|
};
|
||||||
|
class convert_to_lawn {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_lawn.sqf";
|
||||||
|
};
|
||||||
class convert_to_livonia {
|
class convert_to_livonia {
|
||||||
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_livonia.sqf";
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_livonia.sqf";
|
||||||
};
|
};
|
||||||
class convert_to_malden {
|
class convert_to_malden {
|
||||||
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malden.sqf";
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malden.sqf";
|
||||||
};
|
};
|
||||||
|
class convert_to_malvinas_malvinasfalkands {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malvinas_malvinasfalkands.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_malvinas_p_argentino_stanley {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malvinas_p_argentino_stanley.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_malvinas_pebble_island_airfield {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malvinas_pebble_island_airfield.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_malvinas_pradera_ganso {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malvinas_pradera_ganso.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_malvinas_top_malo_house {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malvinas_top_malo_house.sqf";
|
||||||
|
};
|
||||||
class convert_to_southen_sahrani {
|
class convert_to_southen_sahrani {
|
||||||
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_southen_sahrani.sqf";
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_southen_sahrani.sqf";
|
||||||
};
|
};
|
||||||
@@ -89,6 +158,18 @@ class CfgFunctions {
|
|||||||
class convert_to_zagor_zagorsk_reserved_forest {
|
class convert_to_zagor_zagorsk_reserved_forest {
|
||||||
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_zagor_zagorsk_reserved_forest.sqf";
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_zagor_zagorsk_reserved_forest.sqf";
|
||||||
};
|
};
|
||||||
|
class convert_to_colombia {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_colombia.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_clafghan {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_clafghan.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_rut_mandol {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_rut_mandol.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_hellanmaa {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_hellanmaa.sqf";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,10 +9,14 @@ addMissionEventHandler ["ExtensionCallback", {
|
|||||||
|
|
||||||
switch (_function) do {
|
switch (_function) do {
|
||||||
case "EUD Connected": {
|
case "EUD Connected": {
|
||||||
SETVAR(player,EGVAR(client,eudConnected),true);
|
player setVariable [QEGVAR(client,eudConnected), true, true];
|
||||||
};
|
};
|
||||||
case "EUD Disconnected": {
|
case "EUD Disconnected": {
|
||||||
SETVAR(player,EGVAR(client,eudConnected),false);
|
player setVariable [QEGVAR(client,eudConnected), false, true];
|
||||||
|
SETVAR(player,EGVAR(client,lrfEnabled),false);
|
||||||
|
call EFUNC(uav,stopMavlinkBroadcast);
|
||||||
|
"armatak" callExtension ["uas:stop_endpoint", []];
|
||||||
|
"armatak" callExtension ["mdns:stop", []];
|
||||||
};
|
};
|
||||||
default {};
|
default {};
|
||||||
};
|
};
|
||||||
@@ -24,22 +28,77 @@ addMissionEventHandler ["ExtensionCallback", {
|
|||||||
[_function, "error", _name] call FUNC(notify);
|
[_function, "error", _name] call FUNC(notify);
|
||||||
|
|
||||||
if (_function == "UDP Socket is not running") then {
|
if (_function == "UDP Socket is not running") then {
|
||||||
SETVAR(player,EGVAR(client,eudConnected),false);
|
player setVariable [QEGVAR(client,eudConnected), false, true];
|
||||||
|
SETVAR(player,EGVAR(client,lrfEnabled),false);
|
||||||
|
call EFUNC(uav,stopMavlinkBroadcast);
|
||||||
|
"armatak" callExtension ["uas:stop_endpoint", []];
|
||||||
|
"armatak" callExtension ["mdns:stop", []];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_function == "failed to bind UDP socket") then {
|
if (_function == "failed to bind UDP socket") then {
|
||||||
SETVAR(player,EGVAR(client,eudConnected),false);
|
player setVariable [QEGVAR(client,eudConnected), false, true];
|
||||||
|
SETVAR(player,EGVAR(client,lrfEnabled),false);
|
||||||
|
call EFUNC(uav,stopMavlinkBroadcast);
|
||||||
|
"armatak" callExtension ["uas:stop_endpoint", []];
|
||||||
|
"armatak" callExtension ["mdns:stop", []];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case "MAVLINK UDP ERROR": {
|
||||||
|
_message = _function;
|
||||||
|
if (_data isNotEqualTo "") then {
|
||||||
|
_message = format ["%1: %2", _function, _data];
|
||||||
|
};
|
||||||
|
|
||||||
|
[_message, "warning", _name] call FUNC(notify);
|
||||||
|
};
|
||||||
|
case "MAVLINK UDP": {
|
||||||
|
private _history = missionNamespace getVariable ["armatak_uav_mavlink_callback_history", []];
|
||||||
|
_history pushBack [diag_tickTime, _function, _data];
|
||||||
|
if ((count _history) > 50) then {
|
||||||
|
_history deleteRange [0, (count _history) - 50];
|
||||||
|
};
|
||||||
|
missionNamespace setVariable ["armatak_uav_mavlink_callback_history", _history];
|
||||||
|
missionNamespace setVariable ["armatak_uav_last_mavlink_callback", [diag_tickTime, _function, _data]];
|
||||||
|
|
||||||
|
switch (_function) do {
|
||||||
|
case "COMMAND_LONG";
|
||||||
|
case "COMMAND_INT";
|
||||||
|
case "COMMAND_ACK";
|
||||||
|
case "MISSION_COUNT";
|
||||||
|
case "MISSION_ITEM";
|
||||||
|
case "MISSION_ITEM_INT";
|
||||||
|
case "MISSION_CLEAR_ALL";
|
||||||
|
case "MISSION_SET_CURRENT";
|
||||||
|
case "SET_HOME_POSITION";
|
||||||
|
case "SET_MODE";
|
||||||
|
case "SET_POSITION_TARGET_GLOBAL_INT";
|
||||||
|
case "MANUAL_CONTROL": {
|
||||||
|
"armatak" callExtension ["log", [["info", format ["MAVLINK UDP CALLBACK %1 %2", _function, _data]]]];
|
||||||
|
[_function, _data] call EFUNC(uav,handleMavlinkCallback);
|
||||||
|
};
|
||||||
|
default {};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
case "TCP SOCKET": {
|
case "TCP SOCKET": {
|
||||||
[_function, "success", _name] call FUNC(notify);
|
[_function, "success", _name] call FUNC(notify);
|
||||||
};
|
};
|
||||||
case "TCP SOCKET ERROR": {
|
case "TCP SOCKET ERROR": {
|
||||||
[_function, "error", _name] call FUNC(notify);
|
_message = _function;
|
||||||
|
if (_data isNotEqualTo "") then {
|
||||||
|
_message = format ["%1: %2", _function, _data];
|
||||||
|
};
|
||||||
|
|
||||||
|
[_message, "error", _name] call FUNC(notify);
|
||||||
};
|
};
|
||||||
case "VIDEO": {
|
case "VIDEO": {
|
||||||
[_function, "success", _name] call FUNC(notify);
|
[_function, "success", _name] call FUNC(notify);
|
||||||
};
|
};
|
||||||
|
case "MDNS": {
|
||||||
|
[_function, "success", _name] call FUNC(notify);
|
||||||
|
};
|
||||||
|
case "MDNS ERROR": {
|
||||||
|
[_function, "warning", _name] call FUNC(notify);
|
||||||
|
};
|
||||||
case "VIDEO ERROR": {
|
case "VIDEO ERROR": {
|
||||||
[_function, "error", _name] call FUNC(notify);
|
[_function, "error", _name] call FUNC(notify);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
// function name: armatak_fnc_delete_registered_cots
|
||||||
|
// function author: Valmo, Codex
|
||||||
|
// function description: Sends forced delete CoTs for all registered CoTs in a scope.
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// 0: Scope/key used to group CoTs <STRING>
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
// Number of delete CoTs sent <NUMBER>
|
||||||
|
//
|
||||||
|
// Public: Yes
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_scope", "", [""]]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (_scope isEqualTo "") exitWith {0};
|
||||||
|
|
||||||
|
private _registry = missionNamespace getVariable ["armatak_registered_cots", []];
|
||||||
|
private _remaining = [];
|
||||||
|
private _deleted = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
_x params ["_registeredScope", "_uid", "_type", "_lat", "_lon", "_hae"];
|
||||||
|
|
||||||
|
if (_registeredScope isEqualTo _scope) then {
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:delete", [[_uid, _type, _lat, _lon, _hae]]];
|
||||||
|
_deleted = _deleted + 1;
|
||||||
|
} else {
|
||||||
|
_remaining pushBack _x;
|
||||||
|
};
|
||||||
|
} forEach _registry;
|
||||||
|
|
||||||
|
missionNamespace setVariable ["armatak_registered_cots", _remaining];
|
||||||
|
|
||||||
|
_deleted
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
// function name: armatak_fnc_draw_circle
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: Sends an ATAK Drawing Tools circle CoT.
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// 0: Center position or object <ARRAY|OBJECT>
|
||||||
|
// 1: Radius in meters <NUMBER>
|
||||||
|
// 2: Callsign/title <STRING> (default: "ArmaTAK Circle")
|
||||||
|
// 3: Stale time in seconds <NUMBER> (default: 86400)
|
||||||
|
// 4: Stroke color as signed ARGB int <NUMBER> (default: -1)
|
||||||
|
// 5: Fill color as signed ARGB int <NUMBER> (default: -1761607681)
|
||||||
|
// 6: Stroke weight <NUMBER> (default: 3)
|
||||||
|
// 7: Optional registration scope <STRING> (default: "")
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// [player, 300, "Mortar Risk Area"] call armatak_fnc_draw_circle;
|
||||||
|
//
|
||||||
|
// Public: Yes
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_center", objNull, [objNull, []]],
|
||||||
|
["_radius", 100, [0]],
|
||||||
|
["_callsign", "ArmaTAK Circle", [""]],
|
||||||
|
["_staleSeconds", 86400, [0]],
|
||||||
|
["_strokeColor", -1, [0]],
|
||||||
|
["_fillColor", -1761607681, [0]],
|
||||||
|
["_strokeWeight", 3, [0]],
|
||||||
|
["_scope", "", [""]]
|
||||||
|
];
|
||||||
|
|
||||||
|
[
|
||||||
|
_center,
|
||||||
|
_radius,
|
||||||
|
_radius,
|
||||||
|
360,
|
||||||
|
_callsign,
|
||||||
|
_staleSeconds,
|
||||||
|
_strokeColor,
|
||||||
|
_fillColor,
|
||||||
|
_strokeWeight,
|
||||||
|
"",
|
||||||
|
"u-d-c-c",
|
||||||
|
_scope
|
||||||
|
] call armatak_fnc_draw_ellipse;
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
// function name: armatak_fnc_draw_ellipse
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: Sends an ATAK Drawing Tools ellipse or circle CoT.
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// 0: Center position or object <ARRAY|OBJECT>
|
||||||
|
// 1: Major radius in meters <NUMBER>
|
||||||
|
// 2: Minor radius in meters <NUMBER>
|
||||||
|
// 3: Rotation angle in degrees <NUMBER> (default: 0)
|
||||||
|
// 4: Callsign/title <STRING> (default: "ArmaTAK Ellipse")
|
||||||
|
// 5: Stale time in seconds <NUMBER> (default: 86400)
|
||||||
|
// 6: Stroke color as signed ARGB int <NUMBER> (default: -1)
|
||||||
|
// 7: Fill color as signed ARGB int <NUMBER> (default: -1761607681)
|
||||||
|
// 8: Stroke weight <NUMBER> (default: 3)
|
||||||
|
// 9: MilSym SIDC for tactical overlay <STRING> (default: "")
|
||||||
|
// 10: CoT type <STRING> (default: "u-d-c-e")
|
||||||
|
// 11: Optional registration scope <STRING> (default: "")
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// [screenToWorld [0.5, 0.5], 250, 100, 45, "Support by Fire"] call armatak_fnc_draw_ellipse;
|
||||||
|
//
|
||||||
|
// Public: Yes
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_center", objNull, [objNull, []]],
|
||||||
|
["_major", 100, [0]],
|
||||||
|
["_minor", 50, [0]],
|
||||||
|
["_angle", 0, [0]],
|
||||||
|
["_callsign", "ArmaTAK Ellipse", [""]],
|
||||||
|
["_staleSeconds", 86400, [0]],
|
||||||
|
["_strokeColor", -1, [0]],
|
||||||
|
["_fillColor", -1761607681, [0]],
|
||||||
|
["_strokeWeight", 3, [0]],
|
||||||
|
["_milsym", "", [""]],
|
||||||
|
["_cotType", "u-d-c-e", [""]],
|
||||||
|
["_scope", "", [""]]
|
||||||
|
];
|
||||||
|
|
||||||
|
private _position = if (_center isEqualType objNull) then {
|
||||||
|
getPos _center
|
||||||
|
} else {
|
||||||
|
_center
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((count _position) < 2) exitWith {""};
|
||||||
|
|
||||||
|
private _altitude = _position param [2, 0, [0]];
|
||||||
|
private _realLocation = [_position select 0, _position select 1, _altitude] call armatak_client_fnc_convertClientLocation;
|
||||||
|
private _uuid = "armatak" callExtension ["uuid", []] select 0;
|
||||||
|
private _payload = [
|
||||||
|
_uuid,
|
||||||
|
_cotType,
|
||||||
|
_realLocation select 0,
|
||||||
|
_realLocation select 1,
|
||||||
|
_realLocation select 2,
|
||||||
|
_major max 1,
|
||||||
|
_minor max 1,
|
||||||
|
_angle,
|
||||||
|
_callsign,
|
||||||
|
_staleSeconds max 1,
|
||||||
|
_strokeColor,
|
||||||
|
_fillColor,
|
||||||
|
_strokeWeight max 1,
|
||||||
|
_milsym
|
||||||
|
];
|
||||||
|
|
||||||
|
"armatak" callExtension ["tcp_socket:draw:ellipse", [_payload]];
|
||||||
|
[_scope, _uuid, _cotType, _realLocation select 0, _realLocation select 1, _realLocation select 2] call armatak_fnc_register_cot;
|
||||||
|
|
||||||
|
_uuid
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
// function name: armatak_fnc_draw_polyline
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: Sends an ATAK Drawing Tools freeform line or polygon CoT.
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// 0: Positions or objects <ARRAY>
|
||||||
|
// 1: Callsign/title <STRING> (default: "ArmaTAK Line")
|
||||||
|
// 2: Closed polygon <BOOL> (default: false)
|
||||||
|
// 3: Stale time in seconds <NUMBER> (default: 86400)
|
||||||
|
// 4: Stroke color as signed ARGB int <NUMBER> (default: -1)
|
||||||
|
// 5: Fill color as signed ARGB int <NUMBER> (default: -1761607681)
|
||||||
|
// 6: Stroke weight <NUMBER> (default: 3)
|
||||||
|
// 7: Stroke style <STRING> (default: "solid")
|
||||||
|
// 8: MilSym SIDC for tactical overlay <STRING> (default: "")
|
||||||
|
// 9: CoT type <STRING> (default: "u-d-f")
|
||||||
|
// 10: Optional registration scope <STRING> (default: "")
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// [[pos player, screenToWorld [0.5, 0.5]], "Phase Line Blue"] call armatak_fnc_draw_polyline;
|
||||||
|
//
|
||||||
|
// Public: Yes
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_points", [], [[]]],
|
||||||
|
["_callsign", "ArmaTAK Line", [""]],
|
||||||
|
["_closed", false, [true]],
|
||||||
|
["_staleSeconds", 86400, [0]],
|
||||||
|
["_strokeColor", -1, [0]],
|
||||||
|
["_fillColor", -1761607681, [0]],
|
||||||
|
["_strokeWeight", 3, [0]],
|
||||||
|
["_strokeStyle", "solid", [""]],
|
||||||
|
["_milsym", "", [""]],
|
||||||
|
["_cotType", "u-d-f", [""]],
|
||||||
|
["_scope", "", [""]]
|
||||||
|
];
|
||||||
|
|
||||||
|
if ((count _points) < 2) exitWith {""};
|
||||||
|
|
||||||
|
private _pointStrings = [];
|
||||||
|
private _center = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
private _position = if (_x isEqualType objNull) then {
|
||||||
|
getPos _x
|
||||||
|
} else {
|
||||||
|
_x
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((count _position) >= 2) then {
|
||||||
|
private _altitude = _position param [2, 0, [0]];
|
||||||
|
private _realLocation = [_position select 0, _position select 1, _altitude] call armatak_client_fnc_convertClientLocation;
|
||||||
|
_pointStrings pushBack format ["%1,%2,%3", _realLocation select 0, _realLocation select 1, _realLocation select 2];
|
||||||
|
|
||||||
|
if (_center isEqualTo []) then {
|
||||||
|
_center = _realLocation;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _points;
|
||||||
|
|
||||||
|
if ((count _pointStrings) < 2) exitWith {""};
|
||||||
|
|
||||||
|
private _uuid = "armatak" callExtension ["uuid", []] select 0;
|
||||||
|
private _payload = [
|
||||||
|
_uuid,
|
||||||
|
_cotType,
|
||||||
|
_center select 0,
|
||||||
|
_center select 1,
|
||||||
|
_center select 2,
|
||||||
|
_pointStrings joinString ";",
|
||||||
|
_callsign,
|
||||||
|
_staleSeconds max 1,
|
||||||
|
_strokeColor,
|
||||||
|
_fillColor,
|
||||||
|
_strokeWeight max 1,
|
||||||
|
_strokeStyle,
|
||||||
|
_closed,
|
||||||
|
_milsym
|
||||||
|
];
|
||||||
|
|
||||||
|
"armatak" callExtension ["tcp_socket:draw:free", [_payload]];
|
||||||
|
[_scope, _uuid, _cotType, _center select 0, _center select 1, _center select 2] call armatak_fnc_register_cot;
|
||||||
|
|
||||||
|
_uuid
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
// function name: armatak_fnc_draw_rectangle
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: Sends an ATAK Drawing Tools rectangle CoT from an Arma center, width, length, and bearing.
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// 0: Center position or object <ARRAY|OBJECT>
|
||||||
|
// 1: Width in meters <NUMBER>
|
||||||
|
// 2: Length in meters <NUMBER>
|
||||||
|
// 3: Bearing in degrees <NUMBER> (default: 0)
|
||||||
|
// 4: Callsign/title <STRING> (default: "ArmaTAK Rectangle")
|
||||||
|
// 5: Stale time in seconds <NUMBER> (default: 86400)
|
||||||
|
// 6: Stroke color as signed ARGB int <NUMBER> (default: -1)
|
||||||
|
// 7: Fill color as signed ARGB int <NUMBER> (default: -1761607681)
|
||||||
|
// 8: Stroke weight <NUMBER> (default: 3)
|
||||||
|
// 9: MilSym SIDC for tactical overlay <STRING> (default: "")
|
||||||
|
// 10: Optional registration scope <STRING> (default: "")
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// [screenToWorld [0.5, 0.5], 200, 500, 30, "Engagement Area"] call armatak_fnc_draw_rectangle;
|
||||||
|
//
|
||||||
|
// Public: Yes
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_center", objNull, [objNull, []]],
|
||||||
|
["_width", 100, [0]],
|
||||||
|
["_length", 100, [0]],
|
||||||
|
["_bearing", 0, [0]],
|
||||||
|
["_callsign", "ArmaTAK Rectangle", [""]],
|
||||||
|
["_staleSeconds", 86400, [0]],
|
||||||
|
["_strokeColor", -1, [0]],
|
||||||
|
["_fillColor", -1761607681, [0]],
|
||||||
|
["_strokeWeight", 3, [0]],
|
||||||
|
["_milsym", "", [""]],
|
||||||
|
["_scope", "", [""]]
|
||||||
|
];
|
||||||
|
|
||||||
|
private _centerPos = if (_center isEqualType objNull) then {
|
||||||
|
getPos _center
|
||||||
|
} else {
|
||||||
|
_center
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((count _centerPos) < 2) exitWith {""};
|
||||||
|
|
||||||
|
private _altitude = _centerPos param [2, 0, [0]];
|
||||||
|
private _halfWidth = (_width max 1) / 2;
|
||||||
|
private _halfLength = (_length max 1) / 2;
|
||||||
|
private _sin = sin _bearing;
|
||||||
|
private _cos = cos _bearing;
|
||||||
|
private _forward = [_sin, _cos, 0];
|
||||||
|
private _right = [_cos, -_sin, 0];
|
||||||
|
private _offsets = [
|
||||||
|
[(_right vectorMultiply -_halfWidth), (_forward vectorMultiply _halfLength)],
|
||||||
|
[(_right vectorMultiply _halfWidth), (_forward vectorMultiply _halfLength)],
|
||||||
|
[(_right vectorMultiply _halfWidth), (_forward vectorMultiply -_halfLength)],
|
||||||
|
[(_right vectorMultiply -_halfWidth), (_forward vectorMultiply -_halfLength)]
|
||||||
|
];
|
||||||
|
private _points = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
private _offset = (_x select 0) vectorAdd (_x select 1);
|
||||||
|
_points pushBack ([_centerPos select 0, _centerPos select 1, _altitude] vectorAdd _offset);
|
||||||
|
} forEach _offsets;
|
||||||
|
|
||||||
|
private _centerReal = [_centerPos select 0, _centerPos select 1, _altitude] call armatak_client_fnc_convertClientLocation;
|
||||||
|
private _pointStrings = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
private _realLocation = [_x select 0, _x select 1, _x select 2] call armatak_client_fnc_convertClientLocation;
|
||||||
|
_pointStrings pushBack format ["%1,%2,%3", _realLocation select 0, _realLocation select 1, _realLocation select 2];
|
||||||
|
} forEach _points;
|
||||||
|
|
||||||
|
private _uuid = "armatak" callExtension ["uuid", []] select 0;
|
||||||
|
private _payload = [
|
||||||
|
_uuid,
|
||||||
|
"u-d-r",
|
||||||
|
_centerReal select 0,
|
||||||
|
_centerReal select 1,
|
||||||
|
_centerReal select 2,
|
||||||
|
_pointStrings joinString ";",
|
||||||
|
_callsign,
|
||||||
|
_staleSeconds max 1,
|
||||||
|
_strokeColor,
|
||||||
|
_fillColor,
|
||||||
|
_strokeWeight max 1,
|
||||||
|
"solid",
|
||||||
|
false,
|
||||||
|
_milsym
|
||||||
|
];
|
||||||
|
|
||||||
|
"armatak" callExtension ["tcp_socket:draw:rectangle", [_payload]];
|
||||||
|
[_scope, _uuid, "u-d-r", _centerReal select 0, _centerReal select 1, _centerReal select 2] call armatak_fnc_register_cot;
|
||||||
|
|
||||||
|
_uuid
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
// function name: armatak_fnc_draw_route
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: Sends an ATAK navigable route CoT.
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// 0: Positions or objects <ARRAY>
|
||||||
|
// 1: Callsign/title <STRING> (default: "ArmaTAK Route")
|
||||||
|
// 2: Stale time in seconds <NUMBER> (default: 86400)
|
||||||
|
// 3: Color as signed ARGB int <NUMBER> (default: -1)
|
||||||
|
// 4: Stroke weight <NUMBER> (default: 3)
|
||||||
|
// 5: Navigation method <STRING> (default: "Driving")
|
||||||
|
// 6: Route type <STRING> (default: "Primary")
|
||||||
|
// 7: Direction/planning method <STRING> (default: "Infil")
|
||||||
|
// 8: Checkpoint interval among route points <NUMBER> (default: 5)
|
||||||
|
// 9: Optional registration scope <STRING> (default: "")
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// [[pos player, screenToWorld [0.5, 0.5]], "Patrol Route"] call armatak_fnc_draw_route;
|
||||||
|
//
|
||||||
|
// Public: Yes
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_points", [], [[]]],
|
||||||
|
["_callsign", "ArmaTAK Route", [""]],
|
||||||
|
["_staleSeconds", 86400, [0]],
|
||||||
|
["_color", -1, [0]],
|
||||||
|
["_strokeWeight", 3, [0]],
|
||||||
|
["_method", "Driving", [""]],
|
||||||
|
["_routeType", "Primary", [""]],
|
||||||
|
["_direction", "Infil", [""]],
|
||||||
|
["_checkpointInterval", 5, [0]],
|
||||||
|
["_scope", "", [""]]
|
||||||
|
];
|
||||||
|
|
||||||
|
if ((count _points) < 2) exitWith {""};
|
||||||
|
|
||||||
|
private _pointStrings = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
private _position = if (_x isEqualType objNull) then {
|
||||||
|
getPos _x
|
||||||
|
} else {
|
||||||
|
_x
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((count _position) >= 2) then {
|
||||||
|
private _altitude = _position param [2, 0, [0]];
|
||||||
|
private _realLocation = [_position select 0, _position select 1, _altitude] call armatak_client_fnc_convertClientLocation;
|
||||||
|
_pointStrings pushBack format ["%1,%2,%3", _realLocation select 0, _realLocation select 1, _realLocation select 2];
|
||||||
|
};
|
||||||
|
} forEach _points;
|
||||||
|
|
||||||
|
if ((count _pointStrings) < 2) exitWith {""};
|
||||||
|
|
||||||
|
private _uuid = "armatak" callExtension ["uuid", []] select 0;
|
||||||
|
private _pad = {
|
||||||
|
params ["_value", "_digits"];
|
||||||
|
|
||||||
|
private _text = str (floor _value);
|
||||||
|
while {(count _text) < _digits} do {
|
||||||
|
_text = "0" + _text;
|
||||||
|
};
|
||||||
|
|
||||||
|
_text
|
||||||
|
};
|
||||||
|
|
||||||
|
private _formatCotTime = {
|
||||||
|
params ["_dateParts"];
|
||||||
|
|
||||||
|
format [
|
||||||
|
"%1-%2-%3T%4:%5:%6.%7Z",
|
||||||
|
_dateParts param [0, 1970, [0]],
|
||||||
|
[_dateParts param [1, 1, [0]], 2] call _pad,
|
||||||
|
[_dateParts param [2, 1, [0]], 2] call _pad,
|
||||||
|
[_dateParts param [3, 0, [0]], 2] call _pad,
|
||||||
|
[_dateParts param [4, 0, [0]], 2] call _pad,
|
||||||
|
[_dateParts param [5, 0, [0]], 2] call _pad,
|
||||||
|
[_dateParts param [6, 0, [0]], 3] call _pad
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
private _addSecondsUtc = {
|
||||||
|
params ["_dateParts", "_secondsToAdd"];
|
||||||
|
|
||||||
|
private _year = _dateParts param [0, 1970, [0]];
|
||||||
|
private _month = _dateParts param [1, 1, [0]];
|
||||||
|
private _day = _dateParts param [2, 1, [0]];
|
||||||
|
private _hour = _dateParts param [3, 0, [0]];
|
||||||
|
private _minute = _dateParts param [4, 0, [0]];
|
||||||
|
private _second = (_dateParts param [5, 0, [0]]) + (floor _secondsToAdd);
|
||||||
|
private _millisecond = _dateParts param [6, 0, [0]];
|
||||||
|
|
||||||
|
while {_second >= 60} do {
|
||||||
|
_second = _second - 60;
|
||||||
|
_minute = _minute + 1;
|
||||||
|
};
|
||||||
|
while {_minute >= 60} do {
|
||||||
|
_minute = _minute - 60;
|
||||||
|
_hour = _hour + 1;
|
||||||
|
};
|
||||||
|
while {_hour >= 24} do {
|
||||||
|
_hour = _hour - 24;
|
||||||
|
_day = _day + 1;
|
||||||
|
|
||||||
|
private _daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
||||||
|
private _isLeapYear = ((_year mod 4) isEqualTo 0) && {((_year mod 100) isNotEqualTo 0) || {(_year mod 400) isEqualTo 0}};
|
||||||
|
if (_isLeapYear) then {_daysInMonth set [1, 29];};
|
||||||
|
|
||||||
|
if (_day > (_daysInMonth select (_month - 1))) then {
|
||||||
|
_day = 1;
|
||||||
|
_month = _month + 1;
|
||||||
|
if (_month > 12) then {
|
||||||
|
_month = 1;
|
||||||
|
_year = _year + 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
[_year, _month, _day, _hour, _minute, _second, _millisecond]
|
||||||
|
};
|
||||||
|
|
||||||
|
private _nowDate = systemTimeUTC;
|
||||||
|
private _now = [_nowDate] call _formatCotTime;
|
||||||
|
private _stale = [[_nowDate, _staleSeconds max 60] call _addSecondsUtc] call _formatCotTime;
|
||||||
|
|
||||||
|
private _links = "";
|
||||||
|
private _routeWaypoints = [];
|
||||||
|
private _lastIndex = (count _pointStrings) - 1;
|
||||||
|
private _checkpointNumber = 1;
|
||||||
|
private _checkpointIntervalSafe = _checkpointInterval max 1;
|
||||||
|
|
||||||
|
{
|
||||||
|
private _linkUuid = "armatak" callExtension ["uuid", []] select 0;
|
||||||
|
private _pointCallsign = "";
|
||||||
|
if (_forEachIndex isEqualTo 0) then {
|
||||||
|
_pointCallsign = format ["%1 SP", _callsign];
|
||||||
|
} else {
|
||||||
|
if (_forEachIndex isEqualTo _lastIndex) then {
|
||||||
|
_pointCallsign = "VDO";
|
||||||
|
} else {
|
||||||
|
if ((_forEachIndex mod _checkpointIntervalSafe) isEqualTo 0) then {
|
||||||
|
_pointCallsign = format ["CP%1", _checkpointNumber];
|
||||||
|
_checkpointNumber = _checkpointNumber + 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
private _linkType = ["b-m-p-w", "b-m-p-c"] select (_pointCallsign isEqualTo "");
|
||||||
|
_links = _links + format [
|
||||||
|
"<link uid=""%1"" callsign=""%2"" type=""%3"" point=""%4"" remarks="""" relation=""c""/>",
|
||||||
|
_linkUuid,
|
||||||
|
_pointCallsign,
|
||||||
|
_linkType,
|
||||||
|
_x
|
||||||
|
];
|
||||||
|
|
||||||
|
if (_pointCallsign isNotEqualTo "") then {
|
||||||
|
_routeWaypoints pushBack [_linkUuid, _pointCallsign, _x];
|
||||||
|
};
|
||||||
|
} forEach _pointStrings;
|
||||||
|
|
||||||
|
private _xml = format [
|
||||||
|
"<?xml version=""1.0"" encoding=""UTF-8"" ?><event version=""2.0"" uid=""%1"" type=""b-m-r"" time=""%2"" start=""%2"" stale=""%3"" how=""h-e"" access=""Undefined""><point lat=""0.0"" lon=""0.0"" hae=""9999999.0"" ce=""9999999.0"" le=""9999999.0""/><detail>%4<link_attr planningmethod=""%5"" color=""%6"" method=""%7"" prefix=""CP"" style=""0"" type=""Vehicle"" stroke=""%8"" direction=""%5"" routetype=""%9"" order=""Ascending Check Points""/><creator uid=""ARMATAK"" callsign=""ArmaTAK"" time=""%2"" type=""a-f-G-U-C""/><strokeColor value=""%6""/><strokeWeight value=""%8""/><strokeStyle value=""solid""/><labels_on value=""false""/><__routeinfo><__navcues/></__routeinfo><color value=""%6""/><remarks/><contact callsign=""%10""/><archive/><height_unit>1</height_unit></detail></event>",
|
||||||
|
_uuid,
|
||||||
|
_now,
|
||||||
|
_stale,
|
||||||
|
_links,
|
||||||
|
_direction,
|
||||||
|
_color,
|
||||||
|
_method,
|
||||||
|
_strokeWeight max 1,
|
||||||
|
_routeType,
|
||||||
|
_callsign
|
||||||
|
];
|
||||||
|
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Sending ATAK route '%1' with %2 points (%3 bytes)", _callsign, count _pointStrings, count _xml]]]];
|
||||||
|
"armatak" callExtension ["tcp_socket:send_payload", [_xml]];
|
||||||
|
[_scope, _uuid, "b-m-r", 0, 0, 9999999] call armatak_fnc_register_cot;
|
||||||
|
|
||||||
|
{
|
||||||
|
_x params ["_waypointUid", "_waypointCallsign", "_pointString"];
|
||||||
|
private _pointParts = _pointString splitString ",";
|
||||||
|
if ((count _pointParts) >= 3) then {
|
||||||
|
private _waypointXml = format [
|
||||||
|
"<?xml version=""1.0"" encoding=""UTF-8"" ?><event version=""2.0"" uid=""%1"" type=""b-m-p-w"" time=""%2"" start=""%2"" stale=""%3"" how=""h-e""><point lat=""%4"" lon=""%5"" hae=""%6"" ce=""9999999.0"" le=""9999999.0""/><detail><contact callsign=""%7""/><remarks/><archive/><link relation=""p-p"" type=""b-m-r"" uid=""%8""/></detail></event>",
|
||||||
|
_waypointUid,
|
||||||
|
_now,
|
||||||
|
_stale,
|
||||||
|
_pointParts select 0,
|
||||||
|
_pointParts select 1,
|
||||||
|
_pointParts select 2,
|
||||||
|
_waypointCallsign,
|
||||||
|
_uuid
|
||||||
|
];
|
||||||
|
"armatak" callExtension ["tcp_socket:send_payload", [_waypointXml]];
|
||||||
|
[_scope, _waypointUid, "b-m-p-w", parseNumber (_pointParts select 0), parseNumber (_pointParts select 1), parseNumber (_pointParts select 2)] call armatak_fnc_register_cot;
|
||||||
|
};
|
||||||
|
} forEach _routeWaypoints;
|
||||||
|
|
||||||
|
_uuid
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
// function name: armatak_fnc_draw_tactical_graphic
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: Sends an ATAK Drawing Tools shape with a MilSym tactical graphic overlay.
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// 0: Positions or objects <ARRAY>
|
||||||
|
// 1: MilSym SIDC <STRING>
|
||||||
|
// 2: Callsign/title <STRING> (default: "ArmaTAK Tactical Graphic")
|
||||||
|
// 3: Closed polygon <BOOL> (default: false)
|
||||||
|
// 4: Stale time in seconds <NUMBER> (default: 86400)
|
||||||
|
// 5: Stroke color as signed ARGB int <NUMBER> (default: -1)
|
||||||
|
// 6: Fill color as signed ARGB int <NUMBER> (default: -1761607681)
|
||||||
|
// 7: Stroke weight <NUMBER> (default: 3)
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// [[pos player, screenToWorld [0.5, 0.5]], "GFGPOLAGM-----X", "Axis of Advance"] call armatak_fnc_draw_tactical_graphic;
|
||||||
|
//
|
||||||
|
// Public: Yes
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_points", [], [[]]],
|
||||||
|
["_milsym", "", [""]],
|
||||||
|
["_callsign", "ArmaTAK Tactical Graphic", [""]],
|
||||||
|
["_closed", false, [true]],
|
||||||
|
["_staleSeconds", 86400, [0]],
|
||||||
|
["_strokeColor", -1, [0]],
|
||||||
|
["_fillColor", -1761607681, [0]],
|
||||||
|
["_strokeWeight", 3, [0]]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (_milsym isEqualTo "") exitWith {""};
|
||||||
|
if ((count _points) < 2) exitWith {""};
|
||||||
|
|
||||||
|
private _pointStrings = [];
|
||||||
|
private _center = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
private _position = if (_x isEqualType objNull) then {
|
||||||
|
getPos _x
|
||||||
|
} else {
|
||||||
|
_x
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((count _position) >= 2) then {
|
||||||
|
private _altitude = _position param [2, 0, [0]];
|
||||||
|
private _realLocation = [_position select 0, _position select 1, _altitude] call armatak_client_fnc_convertClientLocation;
|
||||||
|
_pointStrings pushBack format ["%1,%2,%3", _realLocation select 0, _realLocation select 1, _realLocation select 2];
|
||||||
|
|
||||||
|
if (_center isEqualTo []) then {
|
||||||
|
_center = _realLocation;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _points;
|
||||||
|
|
||||||
|
if ((count _pointStrings) < 2) exitWith {""};
|
||||||
|
|
||||||
|
private _uuid = "armatak" callExtension ["uuid", []] select 0;
|
||||||
|
private _payload = [
|
||||||
|
_uuid,
|
||||||
|
"u-d-f",
|
||||||
|
_center select 0,
|
||||||
|
_center select 1,
|
||||||
|
_center select 2,
|
||||||
|
_pointStrings joinString ";",
|
||||||
|
_callsign,
|
||||||
|
_staleSeconds max 1,
|
||||||
|
_strokeColor,
|
||||||
|
_fillColor,
|
||||||
|
_strokeWeight max 1,
|
||||||
|
"solid",
|
||||||
|
_closed,
|
||||||
|
_milsym
|
||||||
|
];
|
||||||
|
|
||||||
|
"armatak" callExtension ["tcp_socket:draw:vector", [_payload]];
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// function name: armatak_fnc_register_cot
|
||||||
|
// function author: Valmo, Codex
|
||||||
|
// function description: Registers a CoT object under a scope so it can be deleted later.
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// 0: Scope/key used to group CoTs <STRING>
|
||||||
|
// 1: CoT UID <STRING>
|
||||||
|
// 2: CoT type <STRING>
|
||||||
|
// 3: Latitude <NUMBER>
|
||||||
|
// 4: Longitude <NUMBER>
|
||||||
|
// 5: HAE altitude <NUMBER>
|
||||||
|
//
|
||||||
|
// Public: Yes
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_scope", "", [""]],
|
||||||
|
["_uid", "", [""]],
|
||||||
|
["_type", "", [""]],
|
||||||
|
["_lat", 0, [0]],
|
||||||
|
["_lon", 0, [0]],
|
||||||
|
["_hae", 0, [0]]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (_scope isEqualTo "" || {_uid isEqualTo ""} || {_type isEqualTo ""}) exitWith {false};
|
||||||
|
|
||||||
|
private _registry = missionNamespace getVariable ["armatak_registered_cots", []];
|
||||||
|
_registry pushBack [_scope, _uid, _type, _lat, _lon, _hae];
|
||||||
|
missionNamespace setVariable ["armatak_registered_cots", _registry];
|
||||||
|
|
||||||
|
true
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
// function name: armatak_fnc_report_marker
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: Sends a one-shot TAK report marker with an independent stale time.
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// 0: Source position or object <ARRAY|OBJECT>
|
||||||
|
// 1: Affiliation or raw CoT type <STRING> (default: "unknown")
|
||||||
|
// Supported affiliations: "friendly", "enemy", "hostile", "neutral", "unknown"
|
||||||
|
// 2: Marker kind <STRING> (default: "infantry")
|
||||||
|
// Supported kinds: "infantry", "tank", "car", "apc", "helicopter", "plane", "ship", "static"
|
||||||
|
// 3: Callsign <STRING> (default: "Report")
|
||||||
|
// 4: Remarks <STRING> (default: "")
|
||||||
|
// 5: Stale time in seconds <NUMBER> (default: 3600)
|
||||||
|
// 6: Optional registration scope <STRING> (default: "")
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// [cursorObject, "enemy", "tank", "Enemy Tank", "Reported enemy tank"] call armatak_fnc_report_marker;
|
||||||
|
// [screenToWorld [0.5, 0.5], "unknown", "infantry", "Unknown Contact", "Unknown contact reported", 7200] call armatak_fnc_report_marker;
|
||||||
|
// [cursorObject, "a-h-G-U-C-A-T", "Enemy Tank", "Reported enemy tank", 7200] call armatak_fnc_report_marker;
|
||||||
|
//
|
||||||
|
// Public: Yes
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_source", objNull, [objNull, []]],
|
||||||
|
["_affiliationOrType", "unknown", [""]],
|
||||||
|
["_kindOrCallsign", "infantry", [""]],
|
||||||
|
["_callsignOrRemarks", "Report", [""]],
|
||||||
|
["_remarksOrStaleSeconds", "", ["", 0]],
|
||||||
|
["_staleSeconds", 3600, [0, ""]],
|
||||||
|
["_scope", "", [""]]
|
||||||
|
];
|
||||||
|
|
||||||
|
private _type = "";
|
||||||
|
private _callsign = _callsignOrRemarks;
|
||||||
|
private _remarks = _remarksOrStaleSeconds;
|
||||||
|
|
||||||
|
if (_staleSeconds isEqualType "") then {
|
||||||
|
_scope = _staleSeconds;
|
||||||
|
_staleSeconds = 3600;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((_affiliationOrType select [0, 2]) isEqualTo "a-") then {
|
||||||
|
_type = _affiliationOrType;
|
||||||
|
_callsign = _kindOrCallsign;
|
||||||
|
_remarks = _callsignOrRemarks;
|
||||||
|
|
||||||
|
if (_remarksOrStaleSeconds isEqualType 0) then {
|
||||||
|
_staleSeconds = _remarksOrStaleSeconds;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
private _affiliation = switch (toLower _affiliationOrType) do {
|
||||||
|
case "friendly": {"f"};
|
||||||
|
case "enemy": {"h"};
|
||||||
|
case "hostile": {"h"};
|
||||||
|
case "neutral": {"n"};
|
||||||
|
default {"u"};
|
||||||
|
};
|
||||||
|
|
||||||
|
private _kind = switch (toLower _kindOrCallsign) do {
|
||||||
|
case "tank": {"G-U-C-A-T"};
|
||||||
|
case "car": {"G-U-C-I-M"};
|
||||||
|
case "apc": {"G-U-C-I-I"};
|
||||||
|
case "helicopter": {"A-M-H"};
|
||||||
|
case "plane": {"A-M-F"};
|
||||||
|
case "ship": {"S"};
|
||||||
|
case "static": {"G-U-C-F-M"};
|
||||||
|
default {"G-U-C-I"};
|
||||||
|
};
|
||||||
|
|
||||||
|
_type = "a-" + _affiliation + "-" + _kind;
|
||||||
|
|
||||||
|
if (_remarksOrStaleSeconds isEqualType 0) then {
|
||||||
|
_staleSeconds = _remarksOrStaleSeconds;
|
||||||
|
_remarks = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
private _position = if (_source isEqualType objNull) then {
|
||||||
|
getPos _source
|
||||||
|
} else {
|
||||||
|
_source
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((count _position) < 2) exitWith {
|
||||||
|
""
|
||||||
|
};
|
||||||
|
|
||||||
|
private _altitude = _position param [2, 0, [0]];
|
||||||
|
private _realLocation = [_position select 0, _position select 1, _altitude] call armatak_client_fnc_convertClientLocation;
|
||||||
|
private _uuid = "armatak" callExtension ["uuid", []] select 0;
|
||||||
|
private _payload = [
|
||||||
|
_uuid,
|
||||||
|
_type,
|
||||||
|
_realLocation select 0,
|
||||||
|
_realLocation select 1,
|
||||||
|
_realLocation select 2,
|
||||||
|
_callsign,
|
||||||
|
_staleSeconds max 1,
|
||||||
|
_remarks
|
||||||
|
];
|
||||||
|
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:report_marker", [_payload]];
|
||||||
|
[_scope, _uuid, _type, _realLocation select 0, _realLocation select 1, _realLocation select 2] call armatak_fnc_register_cot;
|
||||||
|
|
||||||
|
_uuid
|
||||||
@@ -6,9 +6,15 @@ if (!isNull _digitalPointer) then {
|
|||||||
_digitalPointerPosition = _digitalPointer call armatak_client_fnc_extractClientPosition;
|
_digitalPointerPosition = _digitalPointer call armatak_client_fnc_extractClientPosition;
|
||||||
|
|
||||||
_link_uid = [_unit] call armatak_fnc_extract_uuid;
|
_link_uid = [_unit] call armatak_fnc_extract_uuid;
|
||||||
_contact_callsign = ([player] call armatak_fnc_extract_unit_callsign) + ".DP1";
|
_objectType = [_unit] call BIS_fnc_objectType;
|
||||||
|
_ownerCallsign = if ((_objectType select 0) == "Soldier") then {
|
||||||
|
[_unit] call armatak_fnc_extract_unit_callsign
|
||||||
|
} else {
|
||||||
|
[_unit] call armatak_fnc_extract_marker_callsign
|
||||||
|
};
|
||||||
|
_contact_callsign = _ownerCallsign + ".DP1";
|
||||||
|
|
||||||
_dpCot = [_link_uid, _contact_callsign, _digitalPointerPosition select 1, _digitalPointerPosition select 2, _digitalPointerPosition select 3];
|
_dpCot = [_link_uid, _contact_callsign, _digitalPointerPosition select 1, _digitalPointerPosition select 2, _digitalPointerPosition select 3];
|
||||||
|
|
||||||
"armatak" callExtension ["tcp_socket:send_digital_pointer_cot", [_dpCot]];
|
"armatak" callExtension ["tcp_socket:cot:digital_pointer", [_dpCot]];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,31 +4,4 @@
|
|||||||
|
|
||||||
params["_drone"];
|
params["_drone"];
|
||||||
|
|
||||||
private _atak_role = "a-f-A";
|
[_drone] call armatak_fnc_send_uas_platform_cot;
|
||||||
private _atak_callsign = [_drone] call armatak_fnc_extract_marker_callsign;
|
|
||||||
|
|
||||||
switch (side _drone) do {
|
|
||||||
case "WEST": {
|
|
||||||
_atak_role = "a-f-A-M-F-Q"
|
|
||||||
};
|
|
||||||
case "EAST": {
|
|
||||||
_atak_role = "a-h-A-M-F-Q"
|
|
||||||
};
|
|
||||||
case "INDEPENDENT": {
|
|
||||||
_atak_role = "a-n-A-M-F-Q"
|
|
||||||
};
|
|
||||||
case "CIVILIAN": {
|
|
||||||
_atak_role = "a-f-A-C"
|
|
||||||
};
|
|
||||||
default {
|
|
||||||
_atak_role = "a-f-A-M-F-Q"
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
_pre_defined_role = _drone getVariable "_atak_group_role";
|
|
||||||
|
|
||||||
if (!isNil "_pre_defined_role") then {
|
|
||||||
_callsign = _pre_defined_role;
|
|
||||||
};
|
|
||||||
|
|
||||||
_cot = [_drone, _atak_role, _atak_callsign] call armatak_fnc_send_marker_cot;
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ _unit_position = _unit call armatak_client_fnc_extractClientPosition;
|
|||||||
_uuid = _unit call armatak_fnc_extract_uuid;
|
_uuid = _unit call armatak_fnc_extract_uuid;
|
||||||
_type = _unit call armatak_fnc_extract_role;
|
_type = _unit call armatak_fnc_extract_role;
|
||||||
_callsign = _unit call armatak_fnc_extract_marker_callsign;
|
_callsign = _unit call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
_marker_cot = [_uuid, _type, _unit_position select 1, _unit_position select 2, _unit_position select 3, _callsign, _unit_position select 5, _unit_position select 6];
|
_marker_cot = [_uuid, _type, _unit_position select 1, _unit_position select 2, _unit_position select 3, _callsign, _unit_position select 5, _unit_position select 6];
|
||||||
|
|
||||||
"armatak" callExtension ["tcp_socket:send_marker_cot", [_marker_cot]];
|
"armatak" callExtension ["tcp_socket:cot:marker", [_marker_cot]];
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ _position = _unit call armatak_client_fnc_extractClientPosition;
|
|||||||
_uuid = _unit call armatak_fnc_extract_uuid;
|
_uuid = _unit call armatak_fnc_extract_uuid;
|
||||||
|
|
||||||
_eud_cot = [_uuid, _position select 1, _position select 2, _position select 3, _callsign, _group_name, _group_role, _position select 5, _position select 6];
|
_eud_cot = [_uuid, _position select 1, _position select 2, _position select 3, _callsign, _group_name, _group_role, _position select 5, _position select 6];
|
||||||
"armatak" callExtension ["tcp_socket:send_eud_cot", [_eud_cot]];
|
"armatak" callExtension ["tcp_socket:cot:eud", [_eud_cot]];
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
|
|
||||||
params ["_unit", "_type", "_callsign"];
|
params ["_unit", "_type", "_callsign"];
|
||||||
|
|
||||||
_unit_position = _unit call armatak_client_fnc_extractClientPosition;
|
_unit_position = _unit call armatak_client_fnc_extractClientPosition;
|
||||||
|
_video_url = [_unit] call armatak_fnc_extract_marker_video_url;
|
||||||
_uuid = _unit call armatak_fnc_extract_uuid;
|
|
||||||
|
_uuid = _unit call armatak_fnc_extract_uuid;
|
||||||
_marker_cot = [_uuid, _type, _unit_position select 1, _unit_position select 2, _unit_position select 3, _callsign, _unit_position select 5, _unit_position select 6];
|
|
||||||
|
_marker_cot = [_uuid, _type, _unit_position select 1, _unit_position select 2, _unit_position select 3, _callsign, _unit_position select 5, _unit_position select 6, _video_url];
|
||||||
"armatak" callExtension ["tcp_socket:send_marker_cot", [_marker_cot]];
|
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:marker", [_marker_cot]];
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
params ["_drone"];
|
||||||
|
|
||||||
|
private _uuid = _drone call armatak_fnc_extract_uuid;
|
||||||
|
private _uavControl = UAVControl _drone;
|
||||||
|
private _controller = _uavControl param [0, objNull];
|
||||||
|
private _controller_uid = if (!isNull _controller) then { [_controller] call armatak_fnc_extract_uuid } else { _drone getVariable ["armatak_uas_controller_uid", _uuid] };
|
||||||
|
private _callsign = [_drone] call armatak_fnc_extract_marker_callsign;
|
||||||
|
private _video_url = [_drone] call armatak_fnc_extract_marker_video_url;
|
||||||
|
|
||||||
|
private _atak_role = "a-f-A-M-H-Q";
|
||||||
|
switch (side _drone) do {
|
||||||
|
case west: {
|
||||||
|
_atak_role = "a-f-A-M-H-Q";
|
||||||
|
};
|
||||||
|
case east: {
|
||||||
|
_atak_role = "a-h-A-M-H-Q";
|
||||||
|
};
|
||||||
|
case independent: {
|
||||||
|
_atak_role = "a-n-A-M-H-Q";
|
||||||
|
};
|
||||||
|
case civilian: {
|
||||||
|
_atak_role = "a-f-A-C";
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
_atak_role = "a-f-A-M-H-Q";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
private _position = _drone call armatak_client_fnc_extractClientPosition;
|
||||||
|
private _lat = _position select 1;
|
||||||
|
private _lon = _position select 2;
|
||||||
|
private _hae = _position select 3;
|
||||||
|
private _course = _position select 5;
|
||||||
|
private _speed = _position select 6;
|
||||||
|
|
||||||
|
private _cameraData = [_drone] call armatak_fnc_extract_uas_camera_data;
|
||||||
|
private _azimuth = _cameraData select 0;
|
||||||
|
private _elevation = _cameraData select 1;
|
||||||
|
private _fov = _cameraData select 2;
|
||||||
|
private _range = _cameraData select 3;
|
||||||
|
private _vfov = _drone getVariable ["armatak_uas_vfov", _fov];
|
||||||
|
|
||||||
|
private _yaw = round (getDir _drone);
|
||||||
|
private _pitch = (vectorDir _drone) select 2;
|
||||||
|
private _roll = (vectorUp _drone) select 0;
|
||||||
|
private _isFlying = parseNumber (isEngineOn _drone);
|
||||||
|
private _hal = ((getPosATL _drone) select 2) max 0;
|
||||||
|
private _vehicleType = if (_video_url == "") then {
|
||||||
|
typeOf _drone
|
||||||
|
} else {
|
||||||
|
format ["%1|armatak_video_url=%2", typeOf _drone, _video_url]
|
||||||
|
};
|
||||||
|
|
||||||
|
private _payload = [
|
||||||
|
_uuid,
|
||||||
|
_atak_role,
|
||||||
|
_callsign,
|
||||||
|
_lat,
|
||||||
|
_lon,
|
||||||
|
_hae,
|
||||||
|
_course,
|
||||||
|
_speed,
|
||||||
|
_azimuth,
|
||||||
|
_elevation,
|
||||||
|
_fov,
|
||||||
|
_vfov,
|
||||||
|
_range,
|
||||||
|
_yaw,
|
||||||
|
_pitch,
|
||||||
|
_roll,
|
||||||
|
_hal,
|
||||||
|
_vehicleType,
|
||||||
|
_isFlying,
|
||||||
|
_controller_uid
|
||||||
|
];
|
||||||
|
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:uas_platform", [_payload]];
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
params ["_drone"];
|
||||||
|
|
||||||
|
private _video_url = [_drone] call armatak_fnc_extract_marker_video_url;
|
||||||
|
if (_video_url == "") exitWith {};
|
||||||
|
|
||||||
|
private _uuid = _drone call armatak_fnc_extract_uuid;
|
||||||
|
private _video_uid = _uuid + "-video";
|
||||||
|
private _sensor_uid = _uuid + "-sensor";
|
||||||
|
private _callsign = [_drone] call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
|
private _position = _drone call armatak_client_fnc_extractClientPosition;
|
||||||
|
private _lat = _position select 1;
|
||||||
|
private _lon = _position select 2;
|
||||||
|
private _hae = _position select 3;
|
||||||
|
|
||||||
|
private _cameraData = [_drone] call armatak_fnc_extract_uas_camera_data;
|
||||||
|
private _azimuth = _cameraData select 0;
|
||||||
|
private _fov = _cameraData select 2;
|
||||||
|
private _range = _cameraData select 3;
|
||||||
|
|
||||||
|
private _payload = [_sensor_uid, _video_uid, _callsign, _lat, _lon, _hae, _azimuth, _fov, _range];
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:uas_sensor", [_payload]];
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
params ["_drone"];
|
||||||
|
|
||||||
|
private _video_url = [_drone] call armatak_fnc_extract_marker_video_url;
|
||||||
|
if (_video_url == "") exitWith {};
|
||||||
|
|
||||||
|
private _uuid = _drone call armatak_fnc_extract_uuid;
|
||||||
|
private _video_uid = _uuid + "-video";
|
||||||
|
private _callsign = [_drone] call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
|
private _signature = format ["%1|%2|%3", _video_uid, _callsign, _video_url];
|
||||||
|
private _nextRefreshAt = _drone getVariable ["armatak_next_uas_video_refresh_at", 0];
|
||||||
|
private _lastSignature = _drone getVariable ["armatak_last_uas_video_signature", ""];
|
||||||
|
|
||||||
|
if (_signature == _lastSignature && {diag_tickTime < _nextRefreshAt}) exitWith {};
|
||||||
|
|
||||||
|
_drone setVariable ["armatak_last_uas_video_signature", _signature, false];
|
||||||
|
_drone setVariable ["armatak_next_uas_video_refresh_at", diag_tickTime + 300, false];
|
||||||
|
|
||||||
|
private _payload = [_video_uid, _callsign, _video_url];
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:uas_video", [_payload]];
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
params ["_drone", ["_cameraData", []]];
|
||||||
|
|
||||||
|
if (isNull _drone) exitWith {};
|
||||||
|
|
||||||
|
if ((_cameraData isEqualType []) && {(count _cameraData) >= 6}) then {
|
||||||
|
_drone setVariable ["armatak_uas_camera_data_override", _cameraData + [serverTime], false];
|
||||||
|
} else {
|
||||||
|
_drone setVariable ["armatak_uas_camera_data_override", nil, false];
|
||||||
|
};
|
||||||
@@ -5,29 +5,45 @@
|
|||||||
params["_unit"];
|
params["_unit"];
|
||||||
|
|
||||||
private _callsign = "";
|
private _callsign = "";
|
||||||
|
private _displayName = localize (getText (configOf _unit >> "displayName"));
|
||||||
|
private _markerCallsignOverride = _unit getVariable ["armatak_attribute_marker_callsign", ""];
|
||||||
|
|
||||||
|
if (_markerCallsignOverride isNotEqualTo "") exitWith {
|
||||||
|
_markerCallsignOverride
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_displayName isEqualTo "") then {
|
||||||
|
_displayName = typeOf _unit;
|
||||||
|
};
|
||||||
|
|
||||||
|
private _vehicleName = vehicleVarName _unit;
|
||||||
|
|
||||||
if ((([_unit] call BIS_fnc_objectType) select 0) == "Vehicle") then {
|
if ((([_unit] call BIS_fnc_objectType) select 0) == "Vehicle") then {
|
||||||
_callsign = getText (configOf _unit >> "displayName");
|
_callsign = [_displayName, _vehicleName] select (_vehicleName isNotEqualTo "");
|
||||||
|
|
||||||
if (!isNull driver _unit) then {
|
if (!isNull driver _unit) then {
|
||||||
_callsign = getText (configOf _unit >> "displayName") + " | " + ([name (driver _unit)] call armatak_fnc_shorten_name);
|
_callsign = _displayName + " | " + ([name (driver _unit)] call armatak_fnc_shorten_name);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (unitIsUAV _unit) then {
|
if (unitIsUAV _unit) then {
|
||||||
_callsign = getText (configOf _unit >> "displayName");
|
_callsign = [_displayName, _vehicleName] select (_vehicleName isNotEqualTo "");
|
||||||
|
|
||||||
|
private _uavControl = UAVControl _unit;
|
||||||
|
private _controller = _uavControl param [0, objNull];
|
||||||
|
if (!isNull _controller) then {
|
||||||
|
_callsign = _callsign + " | " + ([name _controller] call armatak_fnc_shorten_name);
|
||||||
|
};
|
||||||
|
|
||||||
if (isUAVConnected _unit) then {
|
if (isUAVConnected _unit) then {
|
||||||
_callsign = (_callsign) + "[ON]";
|
_callsign = _callsign + " [ON]";
|
||||||
} else {
|
} else {
|
||||||
_callsign = (_callsign) + "[OFF]";
|
_callsign = _callsign + " [OFF]";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
armatak_attribute_marker_callsign = _unit getVariable "armatak_attribute_marker_callsign";
|
if (_callsign isEqualTo "") then {
|
||||||
|
_callsign = _displayName;
|
||||||
if (!isNil "armatak_attribute_marker_callsign" or armatak_attribute_marker_callsign != '') then {
|
|
||||||
_callsign = armatak_attribute_marker_callsign;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_callsign
|
_callsign
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// function name: armatak_fnc_extract_marker_video_url
|
||||||
|
// function author: Codex
|
||||||
|
// function description: Gets the marker video URL configured in 3DEN for a vehicle
|
||||||
|
|
||||||
|
params ["_unit"];
|
||||||
|
|
||||||
|
private _videoUrl = _unit getVariable ["armatak_attribute_marker_video_url", ""];
|
||||||
|
|
||||||
|
if (isNil "_videoUrl") exitWith {
|
||||||
|
""
|
||||||
|
};
|
||||||
|
|
||||||
|
_videoUrl
|
||||||
@@ -7,8 +7,9 @@ params["_unit"];
|
|||||||
private _affiliation = "f";
|
private _affiliation = "f";
|
||||||
private _type = "G";
|
private _type = "G";
|
||||||
private _role = "a-f-G-U-C-I";
|
private _role = "a-f-G-U-C-I";
|
||||||
|
private _side = _unit getVariable ["armatak_current_side", side _unit];
|
||||||
switch (str side _unit) do {
|
|
||||||
|
switch (str _side) do {
|
||||||
case "WEST": {
|
case "WEST": {
|
||||||
_affiliation = "f";
|
_affiliation = "f";
|
||||||
};
|
};
|
||||||
@@ -22,11 +23,11 @@ switch (str side _unit) do {
|
|||||||
_affiliation = "u";
|
_affiliation = "u";
|
||||||
};
|
};
|
||||||
default {
|
default {
|
||||||
_affiliation = "f";
|
_affiliation = "u";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
_unit_type = _unit call BIS_fnc_objectType;
|
private _unit_type = _unit call BIS_fnc_objectType;
|
||||||
|
|
||||||
if ((_unit_type select 0) == "Soldier") then {
|
if ((_unit_type select 0) == "Soldier") then {
|
||||||
switch (_unit_type select 1) do {
|
switch (_unit_type select 1) do {
|
||||||
@@ -70,7 +71,7 @@ if ((_unit_type select 0) == "Soldier") then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if ((typeOf (vehicle _unit) != typeOf _unit) or ((_unit_type select 0) == "Vehicle")) then {
|
if ((typeOf (vehicle _unit) != typeOf _unit) or ((_unit_type select 0) == "Vehicle")) then {
|
||||||
_vehicle_type = (vehicle _unit) call BIS_fnc_objectType select 1;
|
private _vehicle_type = (vehicle _unit) call BIS_fnc_objectType select 1;
|
||||||
switch (_vehicle_type) do {
|
switch (_vehicle_type) do {
|
||||||
case "Car": {
|
case "Car": {
|
||||||
_type = "G-U-C-I-M";
|
_type = "G-U-C-I-M";
|
||||||
@@ -110,11 +111,10 @@ if ((typeOf (vehicle _unit) != typeOf _unit) or ((_unit_type select 0) == "Vehic
|
|||||||
|
|
||||||
_role = "a-" + _affiliation + "-" + _type;
|
_role = "a-" + _affiliation + "-" + _type;
|
||||||
|
|
||||||
|
private _markerTypeOverride = _unit getVariable ["armatak_attribute_marker_type", ""];
|
||||||
|
|
||||||
armatak_attribute_marker_type = _unit getVariable "armatak_attribute_marker_type";
|
if (_markerTypeOverride isNotEqualTo "") then {
|
||||||
|
_role = _markerTypeOverride;
|
||||||
if (!isNil "armatak_attribute_marker_type" or armatak_attribute_marker_type != '') then {
|
|
||||||
_role = armatak_attribute_marker_type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_role
|
_role
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
params["_unit"];
|
||||||
|
|
||||||
|
if (_unit getVariable ["armatak_disable_sensor_data", false]) exitWith {};
|
||||||
|
|
||||||
|
_target = getSensorTargets (_unit);
|
||||||
|
|
||||||
|
{
|
||||||
|
private _targetUnit = _x select 0;
|
||||||
|
_position = _x select 1;
|
||||||
|
_status = _x select 2;
|
||||||
|
private _targetType = toLower (typeOf _targetUnit);
|
||||||
|
|
||||||
|
if ((_targetType find "lasertarget") < 0) then {
|
||||||
|
if (isNil {
|
||||||
|
_targetUnit getVariable "armatak_current_side"
|
||||||
|
}) then {
|
||||||
|
_targetUnit setVariable ["armatak_current_side", side _targetUnit];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_status != "destroyed" && !(_targetUnit in armatak_server_syncedUnits)) then {
|
||||||
|
_unit_position = _targetUnit call armatak_client_fnc_extractClientPosition;
|
||||||
|
|
||||||
|
_uuid = _targetUnit call armatak_fnc_extract_uuid;
|
||||||
|
_type = _targetUnit call armatak_fnc_extract_role;
|
||||||
|
_callsign = getText (configOf _targetUnit >> "displayName");
|
||||||
|
|
||||||
|
_marker_cot = [_uuid, _type, _unit_position select 1, _unit_position select 2, _unit_position select 3, _callsign, _unit_position select 5, _unit_position select 6];
|
||||||
|
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:marker", [_marker_cot]];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _target;
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
params ["_drone", ["_cameraMode", "turret"]];
|
||||||
|
|
||||||
|
private _override = _drone getVariable ["armatak_uas_camera_data_override", []];
|
||||||
|
private _isLocalController = hasInterface && {!isNull player} && {(getConnectedUAV player) isEqualTo _drone};
|
||||||
|
|
||||||
|
if (!_isLocalController && {_override isEqualType []} && {(count _override) >= 7}) then {
|
||||||
|
private _updatedAt = _override param [6, -1000];
|
||||||
|
if ((time - _updatedAt) <= 5) exitWith {
|
||||||
|
private _overrideSpiAsl = _override param [4, []];
|
||||||
|
private _overrideSpiGeo = _override param [5, []];
|
||||||
|
_drone setVariable ["armatak_uas_spi_asl", _overrideSpiAsl, false];
|
||||||
|
_drone setVariable ["armatak_uas_spi_geo", _overrideSpiGeo, false];
|
||||||
|
_override select [0, 6]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
private _defaultFov = _drone getVariable ["armatak_uas_fov", 60];
|
||||||
|
private _maxRange = _drone getVariable ["armatak_uas_max_range", 15000];
|
||||||
|
private _originASL = getPosASL _drone;
|
||||||
|
private _originAGL = ASLToAGL _originASL;
|
||||||
|
private _cameraDir = [];
|
||||||
|
private _spiASL = [];
|
||||||
|
private _slantRange = 0;
|
||||||
|
|
||||||
|
if (_cameraMode isNotEqualTo "fpv") then {
|
||||||
|
private _laserTarget = laserTarget _drone;
|
||||||
|
if (!isNull _laserTarget) then {
|
||||||
|
private _laserTargetWorld = getPosWorld _laserTarget;
|
||||||
|
private _laserTargetAslZ = (getPosASL _laserTarget) select 2;
|
||||||
|
_spiASL = [_laserTargetWorld select 0, _laserTargetWorld select 1, _laserTargetAslZ];
|
||||||
|
_cameraDir = _spiASL vectorDiff _originASL;
|
||||||
|
_slantRange = _originASL vectorDistance _spiASL;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_cameraDir isEqualTo [] && {_cameraMode isNotEqualTo "fpv"}) then {
|
||||||
|
private _uavControl = UAVControl _drone;
|
||||||
|
private _controlledTurretPath = _uavControl param [1, []];
|
||||||
|
private _candidateTurrets = [];
|
||||||
|
|
||||||
|
if ((_controlledTurretPath isEqualType []) && {_controlledTurretPath isNotEqualTo []}) then {
|
||||||
|
_candidateTurrets pushBack _controlledTurretPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
if !(_x in _candidateTurrets) then {
|
||||||
|
_candidateTurrets pushBack _x;
|
||||||
|
};
|
||||||
|
} forEach (allTurrets _drone);
|
||||||
|
|
||||||
|
{
|
||||||
|
private _turretWeapons = _drone weaponsTurret _x;
|
||||||
|
if (_turretWeapons isNotEqualTo []) exitWith {
|
||||||
|
private _weapon = _turretWeapons select 0;
|
||||||
|
private _weaponDirection = _drone weaponDirection _weapon;
|
||||||
|
if (_weaponDirection isNotEqualTo [0, 0, 0]) then {
|
||||||
|
_cameraDir = _weaponDirection;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _candidateTurrets;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_cameraDir isEqualTo []) then {
|
||||||
|
_cameraDir = vectorDirVisual _drone;
|
||||||
|
};
|
||||||
|
|
||||||
|
private _dirMagnitude = vectorMagnitude _cameraDir;
|
||||||
|
if (_dirMagnitude <= 0) then {
|
||||||
|
private _fallbackAzimuth = getDir _drone;
|
||||||
|
_cameraDir = [sin _fallbackAzimuth, cos _fallbackAzimuth, -1];
|
||||||
|
_dirMagnitude = vectorMagnitude _cameraDir;
|
||||||
|
};
|
||||||
|
|
||||||
|
_cameraDir = _cameraDir vectorMultiply (1 / _dirMagnitude);
|
||||||
|
|
||||||
|
private _dirX = _cameraDir select 0;
|
||||||
|
private _dirY = _cameraDir select 1;
|
||||||
|
private _dirZ = _cameraDir select 2;
|
||||||
|
private _horizontalMagnitude = sqrt ((_dirX * _dirX) + (_dirY * _dirY));
|
||||||
|
|
||||||
|
private _azimuth = (((_dirX atan2 _dirY) + 360) mod 360);
|
||||||
|
private _elevation = (_dirZ atan2 (_horizontalMagnitude max 0.001));
|
||||||
|
|
||||||
|
if (_spiASL isEqualTo []) then {
|
||||||
|
private _altitudeAGL = (_originAGL select 2) max 0.1;
|
||||||
|
private _probeASL = _originASL vectorAdd (_cameraDir vectorMultiply _maxRange);
|
||||||
|
|
||||||
|
if (_dirZ < -0.01 && {terrainIntersectASL [_originASL, _probeASL]}) then {
|
||||||
|
private _near = _originASL;
|
||||||
|
private _far = _probeASL;
|
||||||
|
|
||||||
|
for "_i" from 0 to 24 do {
|
||||||
|
private _mid = [
|
||||||
|
((_near select 0) + (_far select 0)) / 2,
|
||||||
|
((_near select 1) + (_far select 1)) / 2,
|
||||||
|
((_near select 2) + (_far select 2)) / 2
|
||||||
|
];
|
||||||
|
|
||||||
|
if (terrainIntersectASL [_originASL, _mid]) then {
|
||||||
|
_far = _mid;
|
||||||
|
} else {
|
||||||
|
_near = _mid;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_spiASL = _far;
|
||||||
|
_slantRange = _originASL vectorDistance _spiASL;
|
||||||
|
} else {
|
||||||
|
private _verticalComponent = abs _dirZ;
|
||||||
|
|
||||||
|
if (_verticalComponent > 0.01) then {
|
||||||
|
_slantRange = (_altitudeAGL / _verticalComponent) min _maxRange;
|
||||||
|
} else {
|
||||||
|
_slantRange = _maxRange;
|
||||||
|
};
|
||||||
|
|
||||||
|
_slantRange = _slantRange max 1;
|
||||||
|
_spiASL = _originASL vectorAdd (_cameraDir vectorMultiply _slantRange);
|
||||||
|
_spiASL set [2, getTerrainHeightASL [_spiASL select 0, _spiASL select 1]];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_slantRange <= 0) then {
|
||||||
|
_slantRange = (_originASL vectorDistance _spiASL) max 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
private _spiAgl = ASLToAGL _spiASL;
|
||||||
|
private _spiWorld = [_spiAgl select 0, _spiAgl select 1, (_spiAgl select 2) max 0];
|
||||||
|
private _spiGeo = _spiWorld call armatak_client_fnc_convertClientLocation;
|
||||||
|
|
||||||
|
_drone setVariable ["armatak_uas_spi_asl", _spiASL, false];
|
||||||
|
_drone setVariable ["armatak_uas_spi_geo", _spiGeo, false];
|
||||||
|
|
||||||
|
[
|
||||||
|
round _azimuth,
|
||||||
|
round _elevation,
|
||||||
|
round _defaultFov,
|
||||||
|
round (_slantRange max 1),
|
||||||
|
_spiASL,
|
||||||
|
_spiGeo
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -16,10 +16,14 @@ if (roleDescription _unit != "") then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
armatak_attribute_unit_callsign = _unit getVariable "armatak_attribute_unit_callsign";
|
if (side _unit == east) then {
|
||||||
|
_callsign = getText (configOf _unit >> "displayName");
|
||||||
|
};
|
||||||
|
|
||||||
if (!isNil "armatak_attribute_unit_callsign" or armatak_attribute_unit_callsign != '') then {
|
private _unitCallsignOverride = _unit getVariable ["armatak_attribute_unit_callsign", ""];
|
||||||
_callsign = armatak_attribute_unit_callsign;
|
|
||||||
|
if (_unitCallsignOverride isNotEqualTo "") then {
|
||||||
|
_callsign = _unitCallsignOverride;
|
||||||
};
|
};
|
||||||
|
|
||||||
_callsign
|
_callsign
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
params["_latitude", "_longitude", "_altitude"];
|
||||||
|
|
||||||
|
_playerPosition = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
|
_playerLatitude = _playerPosition select 0;
|
||||||
|
_playerLongitude = _playerPosition select 1;
|
||||||
|
|
||||||
|
_playerMaxLatitude = 20480;
|
||||||
|
_playerMaxLongitude = 20480;
|
||||||
|
|
||||||
|
_MapMaxLongitude = 33.728772;
|
||||||
|
_MapMinLongitude = 33.542815;
|
||||||
|
|
||||||
|
_MapMaxLatitude = 63.169746;
|
||||||
|
_MapMinLatitude = 62.938820;
|
||||||
|
|
||||||
|
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
||||||
|
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
||||||
|
|
||||||
|
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
||||||
|
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
||||||
|
|
||||||
|
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
params["_latitude", "_longitude", "_altitude"];
|
||||||
|
|
||||||
|
_playerPosition = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
|
_playerLatitude = _playerPosition select 0;
|
||||||
|
_playerLongitude = _playerPosition select 1;
|
||||||
|
|
||||||
|
_playerMaxLatitude = 20480;
|
||||||
|
_playerMaxLongitude = 20480;
|
||||||
|
|
||||||
|
_MapMaxLatitude = -67.765153;
|
||||||
|
_MapMinLatitude = -68.223664;
|
||||||
|
|
||||||
|
_MapMaxLongitude = 10.593815;
|
||||||
|
_MapMinLongitude = 10.137466;
|
||||||
|
|
||||||
|
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
||||||
|
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
||||||
|
|
||||||
|
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
||||||
|
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
||||||
|
|
||||||
|
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
params ["_longitudeInGame", "_latitudeInGame", "_altitude"];
|
||||||
|
|
||||||
|
private _mapWidth = 8192;
|
||||||
|
private _mapHeight = 8192;
|
||||||
|
|
||||||
|
// SW corner (used as origin)
|
||||||
|
private _SW_lat = 63.005389;
|
||||||
|
private _SW_lon = 22.638957;
|
||||||
|
|
||||||
|
// SE corner
|
||||||
|
private _SE_lat = 63.010092;
|
||||||
|
private _SE_lon = 22.800107;
|
||||||
|
|
||||||
|
// NW corner
|
||||||
|
private _NW_lat = 63.078713;
|
||||||
|
private _NW_lon = 22.628542;
|
||||||
|
|
||||||
|
private _edgeSE_lat = _SE_lat - _SW_lat;
|
||||||
|
private _edgeSE_lon = _SE_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _edgeNW_lat = _NW_lat - _SW_lat;
|
||||||
|
private _edgeNW_lon = _NW_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _fx = _longitudeInGame / _mapWidth;
|
||||||
|
private _fy = _latitudeInGame / _mapHeight;
|
||||||
|
|
||||||
|
private _realLat = _SW_lat + (_fx * _edgeSE_lat) + (_fy * _edgeNW_lat);
|
||||||
|
private _realLon = _SW_lon + (_fx * _edgeSE_lon) + (_fy * _edgeNW_lon);
|
||||||
|
|
||||||
|
[_realLat, _realLon, _altitude]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
params["_latitude", "_longitude", "_altitude"];
|
||||||
|
|
||||||
|
_playerPosition = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
|
_playerLatitude = _playerPosition select 0;
|
||||||
|
_playerLongitude = _playerPosition select 1;
|
||||||
|
|
||||||
|
_playerMaxLongitude = 4992;
|
||||||
|
_playerMaxLatitude = 4992;
|
||||||
|
|
||||||
|
_MapMaxLongitude = -99.722665;
|
||||||
|
_MapMinLongitude = -99.775505;
|
||||||
|
|
||||||
|
_MapMaxLatitude = 32.159272;
|
||||||
|
_MapMinLatitude = 32.114011;
|
||||||
|
|
||||||
|
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
||||||
|
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
||||||
|
|
||||||
|
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
||||||
|
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
||||||
|
|
||||||
|
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
params ["_longitudeInGame", "_latitudeInGame", "_altitude"];
|
||||||
|
|
||||||
|
private _mapWidth = 11264;
|
||||||
|
private _mapHeight = 11264;
|
||||||
|
|
||||||
|
// SW corner (used as origin)
|
||||||
|
private _SW_lat = -51.736078;
|
||||||
|
private _SW_lon = -57.915032;
|
||||||
|
|
||||||
|
// SE corner
|
||||||
|
private _SE_lat = -51.736078;
|
||||||
|
private _SE_lon = -58.077879;
|
||||||
|
|
||||||
|
// NW corner
|
||||||
|
private _NW_lat = -51.634750;
|
||||||
|
private _NW_lon = -58.077879;
|
||||||
|
|
||||||
|
private _edgeSE_lat = _SE_lat - _SW_lat;
|
||||||
|
private _edgeSE_lon = _SE_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _edgeNW_lat = _NW_lat - _SW_lat;
|
||||||
|
private _edgeNW_lon = _NW_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _fx = _longitudeInGame / _mapWidth;
|
||||||
|
private _fy = _latitudeInGame / _mapHeight;
|
||||||
|
|
||||||
|
private _realLat = _SW_lat + (_fx * _edgeSE_lat) + (_fy * _edgeNW_lat);
|
||||||
|
private _realLon = _SW_lon + (_fx * _edgeSE_lon) + (_fy * _edgeNW_lon);
|
||||||
|
|
||||||
|
[_realLat, _realLon, _altitude]
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
params ["_longitudeInGame", "_latitudeInGame", "_altitude"];
|
||||||
|
|
||||||
|
private _mapWidth = 16384;
|
||||||
|
private _mapHeight = 16384;
|
||||||
|
|
||||||
|
// SW corner (used as origin)
|
||||||
|
private _SW_lat = -51.806546;
|
||||||
|
private _SW_lon = -57.939747;
|
||||||
|
|
||||||
|
// SE corner
|
||||||
|
private _SE_lat = -51.806546;
|
||||||
|
private _SE_lon = -57.701978;
|
||||||
|
|
||||||
|
// NW corner
|
||||||
|
private _NW_lat = -51.658913;
|
||||||
|
private _NW_lon = -57.939747;
|
||||||
|
|
||||||
|
private _edgeSE_lat = _SE_lat - _SW_lat;
|
||||||
|
private _edgeSE_lon = _SE_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _edgeNW_lat = _NW_lat - _SW_lat;
|
||||||
|
private _edgeNW_lon = _NW_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _fx = _longitudeInGame / _mapWidth;
|
||||||
|
private _fy = _latitudeInGame / _mapHeight;
|
||||||
|
|
||||||
|
private _realLat = _SW_lat + (_fx * _edgeSE_lat) + (_fy * _edgeNW_lat);
|
||||||
|
private _realLon = _SW_lon + (_fx * _edgeSE_lon) + (_fy * _edgeNW_lon);
|
||||||
|
|
||||||
|
[_realLat, _realLon, _altitude]
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
params ["_longitudeInGame", "_latitudeInGame", "_altitude"];
|
||||||
|
|
||||||
|
private _mapWidth = 10240;
|
||||||
|
private _mapHeight = 10240;
|
||||||
|
|
||||||
|
// SW corner (used as origin)
|
||||||
|
private _SW_lat = -51.863358;
|
||||||
|
private _SW_lon = -59.054585;
|
||||||
|
|
||||||
|
// SE corner
|
||||||
|
private _SE_lat = -51.863358;
|
||||||
|
private _SE_lon = -58.906155;
|
||||||
|
|
||||||
|
// NW corner
|
||||||
|
private _NW_lat = -51.771493;
|
||||||
|
private _NW_lon = -59.054585;
|
||||||
|
|
||||||
|
private _edgeSE_lat = _SE_lat - _SW_lat;
|
||||||
|
private _edgeSE_lon = _SE_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _edgeNW_lat = _NW_lat - _SW_lat;
|
||||||
|
private _edgeNW_lon = _NW_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _fx = _longitudeInGame / _mapWidth;
|
||||||
|
private _fy = _latitudeInGame / _mapHeight;
|
||||||
|
|
||||||
|
private _realLat = _SW_lat + (_fx * _edgeSE_lat) + (_fy * _edgeNW_lat);
|
||||||
|
private _realLon = _SW_lon + (_fx * _edgeSE_lon) + (_fy * _edgeNW_lon);
|
||||||
|
|
||||||
|
[_realLat, _realLon, _altitude]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
params["_latitude", "_longitude", "_altitude"];
|
||||||
|
|
||||||
|
_playerPosition = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
|
_playerLatitude = _playerPosition select 0;
|
||||||
|
_playerLongitude = _playerPosition select 1;
|
||||||
|
|
||||||
|
_playerMaxLongitude = 5120;
|
||||||
|
_playerMaxLatitude = 5120;
|
||||||
|
|
||||||
|
_MapMaxLatitude = -51.619725;
|
||||||
|
_MapMinLatitude = -51.664223;
|
||||||
|
|
||||||
|
_MapMaxLongitude = -58.394630;
|
||||||
|
_MapMinLongitude = -58.469580;
|
||||||
|
|
||||||
|
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
||||||
|
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
||||||
|
|
||||||
|
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
||||||
|
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
||||||
|
|
||||||
|
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
params["_latitude", "_longitude", "_altitude"];
|
||||||
|
|
||||||
|
_playerPosition = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
|
_playerLatitude = _playerPosition select 0;
|
||||||
|
_playerLongitude = _playerPosition select 1;
|
||||||
|
|
||||||
|
_playerMaxLatitude = 32768;
|
||||||
|
_playerMaxLongitude = 32768;
|
||||||
|
|
||||||
|
_MapMaxLongitude = 35.285485;
|
||||||
|
_MapMinLongitude = 34.927617;
|
||||||
|
|
||||||
|
_MapMaxLatitude = 70.445404;
|
||||||
|
_MapMinLatitude = 70.016783;
|
||||||
|
|
||||||
|
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
||||||
|
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
||||||
|
|
||||||
|
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
||||||
|
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
||||||
|
|
||||||
|
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
||||||
@@ -1,42 +1,28 @@
|
|||||||
class CfgVehicles {
|
class CfgVehicles {
|
||||||
class Logic;
|
class Logic;
|
||||||
class Module_F : Logic
|
class Module_F : Logic {
|
||||||
{
|
class AttributesBase {
|
||||||
class AttributesBase
|
|
||||||
{
|
|
||||||
class Default;
|
|
||||||
class Edit;
|
class Edit;
|
||||||
class Combo;
|
|
||||||
class Checkbox;
|
|
||||||
class CheckboxNumber;
|
|
||||||
class ModuleDescription;
|
class ModuleDescription;
|
||||||
class Units;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ModuleDescription
|
|
||||||
{
|
|
||||||
class AnyBrain;
|
|
||||||
};
|
};
|
||||||
|
class ModuleDescription;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GVAR(moduleBase): Module_F {
|
class GVAR(moduleBase): Module_F {
|
||||||
author = PROJECT_AUTHOR;
|
author = PROJECT_AUTHOR;
|
||||||
category = QEGVAR(main,moduleCategory);
|
category = QEGVAR(main,moduleCategory);
|
||||||
function = QUOTE({});
|
function = QUOTE({});
|
||||||
functionPriority = 1;
|
functionPriority = 1;
|
||||||
isGlobal = 1;
|
isGlobal = 1;
|
||||||
isTriggerActivated = 0;
|
isTriggerActivated = 0;
|
||||||
scope = 1;
|
scope = 1;
|
||||||
scopeCurator = 2;
|
scopeCurator = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GVAR(coreModule): GVAR(moduleBase) {
|
class GVAR(connectionModuleBase): GVAR(moduleBase) {
|
||||||
scope = 2;
|
|
||||||
scopeCurator = 0;
|
scopeCurator = 0;
|
||||||
displayname = "CoT Router";
|
|
||||||
icon = "\a3\Modules_F_Curator\Data\iconRadio_ca.paa";
|
icon = "\a3\Modules_F_Curator\Data\iconRadio_ca.paa";
|
||||||
category = QEGVAR(main,moduleCategory);
|
category = QEGVAR(main,moduleCategory);
|
||||||
function = QFUNC(3denCoreModuleConfig);
|
|
||||||
functionPriority = 1;
|
functionPriority = 1;
|
||||||
isGlobal = 0;
|
isGlobal = 0;
|
||||||
isTriggerActivated = 1;
|
isTriggerActivated = 1;
|
||||||
@@ -47,19 +33,25 @@ class CfgVehicles {
|
|||||||
canSetArea = 0;
|
canSetArea = 0;
|
||||||
canSetAreaShape = 0;
|
canSetAreaShape = 0;
|
||||||
canSetAreaHeight = 0;
|
canSetAreaHeight = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GVAR(tcpModule): GVAR(connectionModuleBase) {
|
||||||
|
scope = 2;
|
||||||
|
displayName = "CoT Router (TCP)";
|
||||||
|
function = QFUNC(3denTcpModuleConfig);
|
||||||
|
|
||||||
class Attributes: AttributesBase {
|
class Attributes: AttributesBase {
|
||||||
class GVAR(moduleInstanceAddress): Edit {
|
class GVAR(moduleInstanceAddress): Edit {
|
||||||
property = QGVAR(moduleInstanceAddress);
|
property = QGVAR(moduleInstanceAddress);
|
||||||
displayname = "TAK Server Address";
|
displayName = "TAK Server Address";
|
||||||
tooltip = "TAK Server Instance Address";
|
tooltip = "Hostname or IP address for the TAK or IronTAK server.";
|
||||||
typeName = "STRING";
|
typeName = "STRING";
|
||||||
defaultValue = "localhost";
|
defaultValue = "'localhost'";
|
||||||
};
|
};
|
||||||
class GVAR(moduleInstancePort): Edit {
|
class GVAR(moduleInstancePort): Edit {
|
||||||
property = QGVAR(moduleInstancePort);
|
property = QGVAR(moduleInstancePort);
|
||||||
displayname = "TAK Server TCP Port";
|
displayName = "TAK Server TCP Port";
|
||||||
tooltip = "TAK Server instance Port for TCP connection";
|
tooltip = "Port for the unauthenticated TCP socket.";
|
||||||
typeName = "NUMBER";
|
typeName = "NUMBER";
|
||||||
defaultValue = "8088";
|
defaultValue = "8088";
|
||||||
};
|
};
|
||||||
@@ -67,24 +59,75 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class ModuleDescription: ModuleDescription {
|
class ModuleDescription: ModuleDescription {
|
||||||
description = "Generate the initial ARMATAK configuration, syncronizing all players to the TAK server instance";
|
description = "Connect ArmaTAK to a TAK server over plain TCP.";
|
||||||
sync[] = {"LocationArea_F"};
|
sync[] = {"LocationArea_F"};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class GVAR(coreModuleCurator): GVAR(coreModule) {
|
class GVAR(enrollModule): GVAR(connectionModuleBase) {
|
||||||
|
scope = 2;
|
||||||
|
displayName = "CoT Router (Authenticated)";
|
||||||
|
function = QFUNC(3denEnrollModuleConfig);
|
||||||
|
|
||||||
|
class Attributes: AttributesBase {
|
||||||
|
class GVAR(moduleInstanceAddress): Edit {
|
||||||
|
property = QGVAR(moduleInstanceAddress);
|
||||||
|
displayname = "TAK Server Address";
|
||||||
|
tooltip = "Hostname or IP address used for enrollment and the final TLS connection.";
|
||||||
|
typeName = "STRING";
|
||||||
|
defaultValue = "'localhost'";
|
||||||
|
};
|
||||||
|
class GVAR(moduleEnrollmentPort): Edit {
|
||||||
|
property = QGVAR(moduleEnrollmentPort);
|
||||||
|
displayName = "Enrollment HTTPS Port";
|
||||||
|
tooltip = "Port used for GET /Marti/api/tls/config and POST /Marti/api/tls/signClient/v2.";
|
||||||
|
typeName = "NUMBER";
|
||||||
|
defaultValue = "8446";
|
||||||
|
};
|
||||||
|
class GVAR(moduleEnrollmentUsername): Edit {
|
||||||
|
property = QGVAR(moduleEnrollmentUsername);
|
||||||
|
displayName = "Enrollment Username";
|
||||||
|
tooltip = "Username used in Basic Auth for client certificate enrollment.";
|
||||||
|
typeName = "STRING";
|
||||||
|
defaultValue = "''";
|
||||||
|
};
|
||||||
|
class GVAR(moduleEnrollmentPassword): Edit {
|
||||||
|
property = QGVAR(moduleEnrollmentPassword);
|
||||||
|
displayName = "Enrollment Password";
|
||||||
|
tooltip = "Password used in Basic Auth for client certificate enrollment.";
|
||||||
|
typeName = "STRING";
|
||||||
|
defaultValue = "''";
|
||||||
|
};
|
||||||
|
class ModuleDescription: ModuleDescription {};
|
||||||
|
};
|
||||||
|
|
||||||
|
class ModuleDescription: ModuleDescription {
|
||||||
|
description = "Enroll a client certificate and connect ArmaTAK over mTLS.";
|
||||||
|
sync[] = {"LocationArea_F"};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class GVAR(tcpModuleCurator): GVAR(tcpModule) {
|
||||||
scope = 1;
|
scope = 1;
|
||||||
scopeCurator = 2;
|
scopeCurator = 2;
|
||||||
function = "";
|
function = "";
|
||||||
displayName = "CoT Router (Zeus)";
|
displayName = "CoT Router (TCP, Zeus)";
|
||||||
curatorInfoType = "armatak_zeus_core_module_dialog";
|
curatorInfoType = "armatak_zeus_tcp_module_dialog";
|
||||||
|
};
|
||||||
|
|
||||||
|
class GVAR(enrollModuleCurator): GVAR(enrollModule) {
|
||||||
|
scope = 1;
|
||||||
|
scopeCurator = 2;
|
||||||
|
function = "";
|
||||||
|
displayName = "CoT Router (Authenticated, Zeus)";
|
||||||
|
curatorInfoType = "armatak_zeus_enroll_module_dialog";
|
||||||
};
|
};
|
||||||
|
|
||||||
class GVAR(markEntity): GVAR(moduleBase) {
|
class GVAR(markEntity): GVAR(moduleBase) {
|
||||||
curatorCanAttach = 1;
|
curatorCanAttach = 1;
|
||||||
category = QEGVAR(main,moduleCategory);
|
category = QEGVAR(main,moduleCategory);
|
||||||
displayname = "Mark Entity";
|
displayname = "Mark Entity";
|
||||||
function = QFUNC(routerEntityAdd);
|
function = QFUNC(routerEntityAdd);
|
||||||
icon = "\a3\Modules_F_Curator\Data\iconRadio_ca.paa";
|
icon = "\a3\Modules_F_Curator\Data\iconRadio_ca.paa";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
PREP(3denCoreModuleConfig);
|
PREP(3denEnrollModuleConfig);
|
||||||
|
PREP(3denTcpModuleConfig);
|
||||||
|
PREP(addRouterEntities);
|
||||||
|
PREP(removeRouterEntities);
|
||||||
PREP(routerEntityAdd);
|
PREP(routerEntityAdd);
|
||||||
PREP(routerEntityRemove);
|
PREP(routerEntityRemove);
|
||||||
PREP(ZeusCoreModuleConfig);
|
PREP(setRouterEntities);
|
||||||
|
PREP(startCotRouter);
|
||||||
|
PREP(ZeusEnrollModuleConfig);
|
||||||
|
PREP(ZeusTcpModuleConfig);
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ class CfgPatches {
|
|||||||
class ADDON {
|
class ADDON {
|
||||||
name = COMPONENT_NAME;
|
name = COMPONENT_NAME;
|
||||||
units[] = {
|
units[] = {
|
||||||
QGVAR(coreModule),
|
QGVAR(tcpModule),
|
||||||
QGVAR(coreModuleCurator),
|
QGVAR(tcpModuleCurator),
|
||||||
|
QGVAR(enrollModule),
|
||||||
|
QGVAR(enrollModuleCurator),
|
||||||
QGVAR(markEntity)
|
QGVAR(markEntity)
|
||||||
};
|
};
|
||||||
weapons[] = {};
|
weapons[] = {};
|
||||||
|
|||||||
+135
-32
@@ -3,69 +3,172 @@ class RscBackground;
|
|||||||
class RscButton;
|
class RscButton;
|
||||||
class RscEdit;
|
class RscEdit;
|
||||||
|
|
||||||
class armatak_zeus_core_module_dialog {
|
class armatak_zeus_tcp_module_dialog {
|
||||||
idd = 999991;
|
idd = 999991;
|
||||||
movingEnable = 0;
|
movingEnable = 0;
|
||||||
class ControlsBackground {
|
class ControlsBackground {
|
||||||
class armatak_gui_module_zeus_core_dialog_main_frame: RscBackground {
|
class main_frame: RscBackground {
|
||||||
idc = 1800;
|
idc = 1800;
|
||||||
x = "0.386562 * safezoneW + safezoneX";
|
x = "0.386562 * safezoneW + safezoneX";
|
||||||
y = "0.401 * safezoneH + safezoneY";
|
y = "0.29 * safezoneH + safezoneY";
|
||||||
w = "0.216563 * safezoneW";
|
w = "0.216563 * safezoneW";
|
||||||
h = "0.242 * safezoneH";
|
h = "0.32 * safezoneH";
|
||||||
colorBackground[]={0,0,0,0.45};
|
colorBackground[] = {0,0,0,0.45};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Controls {
|
class Controls {
|
||||||
class armatak_gui_module_zeus_core_dialog_address_edit: RscEdit {
|
class address_text: RscText {
|
||||||
idc = 14000;
|
|
||||||
text = "localhost";
|
|
||||||
x = "0.391719 * safezoneW + safezoneX";
|
|
||||||
y = "0.445 * safezoneH + safezoneY";
|
|
||||||
w = "0.20625 * safezoneW";
|
|
||||||
h = "0.044 * safezoneH";
|
|
||||||
colorBackground[]={0,0,0,0.5};
|
|
||||||
};
|
|
||||||
class armatak_gui_module_zeus_core_dialog_address_port_edit: RscEdit {
|
|
||||||
idc = 14001;
|
|
||||||
text = "8088";
|
|
||||||
x = "0.391719 * safezoneW + safezoneX";
|
|
||||||
y = "0.522 * safezoneH + safezoneY";
|
|
||||||
w = "0.20625 * safezoneW";
|
|
||||||
h = "0.044 * safezoneH";
|
|
||||||
colorBackground[]={0,0,0,0.5};
|
|
||||||
};
|
|
||||||
class armatak_gui_module_zeus_core_dialog_address_text: RscText {
|
|
||||||
idc = 1000;
|
idc = 1000;
|
||||||
text = "TAK Server Address";
|
text = "TAK Server Address";
|
||||||
x = "0.391719 * safezoneW + safezoneX";
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
y = "0.412 * safezoneH + safezoneY";
|
y = "0.332 * safezoneH + safezoneY";
|
||||||
w = "0.20625 * safezoneW";
|
w = "0.20625 * safezoneW";
|
||||||
h = "0.033 * safezoneH";
|
h = "0.033 * safezoneH";
|
||||||
};
|
};
|
||||||
class armatak_gui_module_zeus_core_dialog_address_port_text: RscText {
|
class address_edit: RscEdit {
|
||||||
|
idc = 14000;
|
||||||
|
text = "localhost";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.365 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.044 * safezoneH";
|
||||||
|
colorBackground[] = {0,0,0,0.5};
|
||||||
|
};
|
||||||
|
class port_text: RscText {
|
||||||
idc = 1001;
|
idc = 1001;
|
||||||
text = "TAK Server Port";
|
text = "TAK Server Port";
|
||||||
x = "0.391719 * safezoneW + safezoneX";
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
y = "0.489 * safezoneH + safezoneY";
|
y = "0.425 * safezoneH + safezoneY";
|
||||||
w = "0.20625 * safezoneW";
|
w = "0.20625 * safezoneW";
|
||||||
h = "0.033 * safezoneH";
|
h = "0.033 * safezoneH";
|
||||||
};
|
};
|
||||||
class armatak_gui_module_zeus_core_dialog_address_button_cancel: RscButton {
|
class port_edit: RscEdit {
|
||||||
|
idc = 14001;
|
||||||
|
text = "8088";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.458 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.044 * safezoneH";
|
||||||
|
colorBackground[] = {0,0,0,0.5};
|
||||||
|
};
|
||||||
|
class button_cancel: RscButton {
|
||||||
idc = 1601;
|
idc = 1601;
|
||||||
text = "Cancel";
|
text = "Cancel";
|
||||||
action = "closeDialog 2;";
|
action = "closeDialog 2;";
|
||||||
x = "0.551563 * safezoneW + safezoneX";
|
x = "0.551563 * safezoneW + safezoneX";
|
||||||
y = "0.577 * safezoneH + safezoneY";
|
y = "0.535 * safezoneH + safezoneY";
|
||||||
w = "0.0464063 * safezoneW";
|
w = "0.0464063 * safezoneW";
|
||||||
h = "0.055 * safezoneH";
|
h = "0.055 * safezoneH";
|
||||||
};
|
};
|
||||||
class armatak_gui_module_zeus_core_dialog_address_button_ok: RscButton {
|
class button_ok: RscButton {
|
||||||
idc = 1600;
|
idc = 1600;
|
||||||
text = "Ok";
|
text = "Ok";
|
||||||
action = QUOTE(call FUNC(zeusCoreModuleConfig));
|
action = QUOTE(call FUNC(ZeusTcpModuleConfig));
|
||||||
x = "0.5 * safezoneW + safezoneX";
|
x = "0.5 * safezoneW + safezoneX";
|
||||||
y = "0.577 * safezoneH + safezoneY";
|
y = "0.535 * safezoneH + safezoneY";
|
||||||
|
w = "0.0464063 * safezoneW";
|
||||||
|
h = "0.055 * safezoneH";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class armatak_zeus_enroll_module_dialog {
|
||||||
|
idd = 999992;
|
||||||
|
movingEnable = 0;
|
||||||
|
class ControlsBackground {
|
||||||
|
class main_frame: RscBackground {
|
||||||
|
idc = 1810;
|
||||||
|
x = "0.386562 * safezoneW + safezoneX";
|
||||||
|
y = "0.2 * safezoneH + safezoneY";
|
||||||
|
w = "0.216563 * safezoneW";
|
||||||
|
h = "0.52 * safezoneH";
|
||||||
|
colorBackground[] = {0,0,0,0.45};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class Controls {
|
||||||
|
class address_text: RscText {
|
||||||
|
idc = 1010;
|
||||||
|
text = "TAK Server Address";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.242 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.033 * safezoneH";
|
||||||
|
};
|
||||||
|
class address_edit: RscEdit {
|
||||||
|
idc = 14100;
|
||||||
|
text = "localhost";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.275 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.044 * safezoneH";
|
||||||
|
colorBackground[] = {0,0,0,0.5};
|
||||||
|
};
|
||||||
|
class enroll_port_text: RscText {
|
||||||
|
idc = 1011;
|
||||||
|
text = "Enrollment HTTPS Port";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.335 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.033 * safezoneH";
|
||||||
|
};
|
||||||
|
class enroll_port_edit: RscEdit {
|
||||||
|
idc = 14101;
|
||||||
|
text = "8446";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.368 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.044 * safezoneH";
|
||||||
|
colorBackground[] = {0,0,0,0.5};
|
||||||
|
};
|
||||||
|
class username_text: RscText {
|
||||||
|
idc = 1012;
|
||||||
|
text = "Enrollment Username";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.428 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.033 * safezoneH";
|
||||||
|
};
|
||||||
|
class username_edit: RscEdit {
|
||||||
|
idc = 14102;
|
||||||
|
text = "";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.461 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.044 * safezoneH";
|
||||||
|
colorBackground[] = {0,0,0,0.5};
|
||||||
|
};
|
||||||
|
class password_text: RscText {
|
||||||
|
idc = 1013;
|
||||||
|
text = "Enrollment Password";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.521 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.033 * safezoneH";
|
||||||
|
};
|
||||||
|
class password_edit: RscEdit {
|
||||||
|
idc = 14103;
|
||||||
|
text = "";
|
||||||
|
x = "0.391719 * safezoneW + safezoneX";
|
||||||
|
y = "0.554 * safezoneH + safezoneY";
|
||||||
|
w = "0.20625 * safezoneW";
|
||||||
|
h = "0.044 * safezoneH";
|
||||||
|
colorBackground[] = {0,0,0,0.5};
|
||||||
|
};
|
||||||
|
class button_cancel: RscButton {
|
||||||
|
idc = 1611;
|
||||||
|
text = "Cancel";
|
||||||
|
action = "closeDialog 2;";
|
||||||
|
x = "0.551563 * safezoneW + safezoneX";
|
||||||
|
y = "0.645 * safezoneH + safezoneY";
|
||||||
|
w = "0.0464063 * safezoneW";
|
||||||
|
h = "0.055 * safezoneH";
|
||||||
|
};
|
||||||
|
class button_ok: RscButton {
|
||||||
|
idc = 1610;
|
||||||
|
text = "Ok";
|
||||||
|
action = QUOTE(call FUNC(ZeusEnrollModuleConfig));
|
||||||
|
x = "0.5 * safezoneW + safezoneX";
|
||||||
|
y = "0.645 * safezoneH + safezoneY";
|
||||||
w = "0.0464063 * safezoneW";
|
w = "0.0464063 * safezoneW";
|
||||||
h = "0.055 * safezoneH";
|
h = "0.055 * safezoneH";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
#include "..\script_component.hpp"
|
|
||||||
|
|
||||||
params [
|
|
||||||
["_logic", objNull, [objNull]],
|
|
||||||
["_units", [], [[]]],
|
|
||||||
["_activated", true, [true]]
|
|
||||||
];
|
|
||||||
|
|
||||||
if (isServer) exitWith {
|
|
||||||
["Connecting to TCP Socket", "success", "TCP Socket"] call EFUNC(main,notify);
|
|
||||||
|
|
||||||
_tak_server_instance_address = _logic getVariable QGVAR(moduleInstanceAddress);
|
|
||||||
_tak_server_instance_port = _logic getVariable QGVAR(moduleInstancePort);
|
|
||||||
|
|
||||||
_tak_server_fulladdress = _tak_server_instance_address + ":" + (str _tak_server_instance_port);
|
|
||||||
|
|
||||||
missionNamespace setVariable ["armatak_server_instance", _tak_server_fulladdress];
|
|
||||||
missionNamespace setVariable ["armatak_tcp_socket_is_running", true];
|
|
||||||
|
|
||||||
"armatak" callExtension ["tcp_socket:start", [_tak_server_fulladdress]];
|
|
||||||
|
|
||||||
_syncUnits = synchronizedObjects _logic;
|
|
||||||
|
|
||||||
missionNamespace setVariable ["armatak_server_syncedUnits", _syncUnits];
|
|
||||||
|
|
||||||
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
|
|
||||||
|
|
||||||
[{
|
|
||||||
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
|
|
||||||
|
|
||||||
{
|
|
||||||
_objectType = _x call BIS_fnc_objectType;
|
|
||||||
switch (true) do {
|
|
||||||
case ((_objectType select 0) == "Soldier"): {
|
|
||||||
_callsign = [_x] call armatak_fnc_extract_unit_callsign;
|
|
||||||
_group_name = [group _x] call armatak_fnc_extract_group_color;
|
|
||||||
_group_role = [_x] call armatak_fnc_extract_group_role;
|
|
||||||
|
|
||||||
[_x, _callsign, _group_name, _group_role] call armatak_fnc_send_eud_cot;
|
|
||||||
[_x] call armatak_fnc_send_digital_pointer_cot;
|
|
||||||
};
|
|
||||||
case ((_objectType select 0) == "Vehicle"): {
|
|
||||||
_atak_type = [_x] call armatak_fnc_extract_role;
|
|
||||||
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
|
||||||
|
|
||||||
[_x, _atak_type, _callsign] call armatak_fnc_send_marker_cot;
|
|
||||||
};
|
|
||||||
case ((_objectType select 0) == "VehicleAutonomous"): {
|
|
||||||
_atak_type = [_x] call armatak_fnc_extract_role;
|
|
||||||
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
|
||||||
|
|
||||||
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
|
|
||||||
[_x] call armatak_fnc_send_digital_pointer_cot;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} forEach GVAR(syncedUnits);
|
|
||||||
}, 1, []] call CBA_fnc_addPerFrameHandler;
|
|
||||||
};
|
|
||||||
|
|
||||||
true;
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_logic", objNull, [objNull]],
|
||||||
|
["_units", [], [[]]],
|
||||||
|
["_activated", true, [true]]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isServer) exitWith {
|
||||||
|
if (missionNamespace getVariable ["armatak_tcp_socket_is_running", false]) exitWith {
|
||||||
|
["Socket was called twice", "error", "TCP Socket"] call EFUNC(main,notify);
|
||||||
|
};
|
||||||
|
|
||||||
|
["Connecting to authenticated TAK socket", "success", "TCP Socket"] call EFUNC(main,notify);
|
||||||
|
|
||||||
|
_tak_server_instance_address = _logic getVariable [QGVAR(moduleInstanceAddress), "localhost"];
|
||||||
|
_tak_server_enrollment_port = _logic getVariable [QGVAR(moduleEnrollmentPort), 8446];
|
||||||
|
_tak_server_enrollment_username = _logic getVariable [QGVAR(moduleEnrollmentUsername), ""];
|
||||||
|
_tak_server_enrollment_password = _logic getVariable [QGVAR(moduleEnrollmentPassword), ""];
|
||||||
|
|
||||||
|
"armatak" callExtension [
|
||||||
|
"tcp_socket:start_enroll_mtls",
|
||||||
|
[
|
||||||
|
_tak_server_instance_address,
|
||||||
|
_tak_server_instance_address,
|
||||||
|
str _tak_server_enrollment_port,
|
||||||
|
_tak_server_enrollment_username,
|
||||||
|
_tak_server_enrollment_password,
|
||||||
|
""
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
missionNamespace setVariable ["armatak_server_syncedUnits", synchronizedObjects _logic];
|
||||||
|
_tak_server_instance_address call FUNC(startCotRouter);
|
||||||
|
};
|
||||||
|
|
||||||
|
true
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_logic", objNull, [objNull]],
|
||||||
|
["_units", [], [[]]],
|
||||||
|
["_activated", true, [true]]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isServer) exitWith {
|
||||||
|
if (missionNamespace getVariable ["armatak_tcp_socket_is_running", false]) exitWith {
|
||||||
|
["Socket was called twice", "error", "TCP Socket"] call EFUNC(main,notify);
|
||||||
|
};
|
||||||
|
|
||||||
|
["Connecting to TCP Socket", "success", "TCP Socket"] call EFUNC(main,notify);
|
||||||
|
|
||||||
|
_tak_server_instance_address = _logic getVariable [QGVAR(moduleInstanceAddress), "localhost"];
|
||||||
|
_tak_server_instance_port = _logic getVariable [QGVAR(moduleInstancePort), 8088];
|
||||||
|
_tak_server_fulladdress = _tak_server_instance_address + ":" + (str _tak_server_instance_port);
|
||||||
|
|
||||||
|
"armatak" callExtension ["tcp_socket:start", [_tak_server_fulladdress]];
|
||||||
|
|
||||||
|
missionNamespace setVariable ["armatak_server_syncedUnits", synchronizedObjects _logic];
|
||||||
|
_tak_server_fulladdress call FUNC(startCotRouter);
|
||||||
|
};
|
||||||
|
|
||||||
|
true
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
#include "..\script_component.hpp"
|
|
||||||
|
|
||||||
params ["_logic"];
|
|
||||||
|
|
||||||
_socket_is_running = missionNamespace getVariable ["armatak_tcp_socket_is_running", false];
|
|
||||||
|
|
||||||
if (_socket_is_running) exitWith {
|
|
||||||
["Socket was called twice", "error", "TCP Socket"] call EFUNC(main,notify);
|
|
||||||
closeDialog 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
disableSerialization;
|
|
||||||
|
|
||||||
["Connecting to TCP Socket", "success", "TCP Socket"] call EFUNC(main,notify);
|
|
||||||
|
|
||||||
_tak_server_instance_address = ctrlText 14000;
|
|
||||||
_tak_server_instance_port = ctrlText 14001;
|
|
||||||
|
|
||||||
_tak_server_fulladdress = ((_tak_server_instance_address) + ":" + (_tak_server_instance_port));
|
|
||||||
|
|
||||||
missionNamespace setVariable ["armatak_server_instance", _tak_server_fulladdress];
|
|
||||||
missionNamespace setVariable ["armatak_tcp_socket_is_running", true];
|
|
||||||
|
|
||||||
"armatak" callExtension ["tcp_socket:start", [_tak_server_fulladdress]];
|
|
||||||
|
|
||||||
_syncUnits = [];
|
|
||||||
|
|
||||||
missionNamespace setVariable ["armatak_server_syncedUnits", _syncUnits];
|
|
||||||
|
|
||||||
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
|
|
||||||
|
|
||||||
[{
|
|
||||||
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
|
|
||||||
|
|
||||||
{
|
|
||||||
_objectType = _x call BIS_fnc_objectType;
|
|
||||||
switch (true) do {
|
|
||||||
case ((_objectType select 0) == "Soldier"): {
|
|
||||||
_callsign = [_x] call armatak_fnc_extract_unit_callsign;
|
|
||||||
_group_name = [group _x] call armatak_fnc_extract_group_color;
|
|
||||||
_group_role = [_x] call armatak_fnc_extract_group_role;
|
|
||||||
|
|
||||||
[_x, _callsign, _group_name, _group_role] call armatak_fnc_send_eud_cot;
|
|
||||||
[_x] call armatak_fnc_send_digital_pointer_cot;
|
|
||||||
};
|
|
||||||
case ((_objectType select 0) == "Vehicle"): {
|
|
||||||
_atak_type = [_x] call armatak_fnc_extract_role;
|
|
||||||
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
|
||||||
|
|
||||||
[_x, _atak_type, _callsign] call armatak_fnc_send_marker_cot;
|
|
||||||
};
|
|
||||||
case ((_objectType select 0) == "VehicleAutonomous"): {
|
|
||||||
_atak_type = [_x] call armatak_fnc_extract_role;
|
|
||||||
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
|
||||||
|
|
||||||
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
|
|
||||||
[_x] call armatak_fnc_send_digital_pointer_cot;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} forEach GVAR(syncedUnits);
|
|
||||||
}, 1, []] call CBA_fnc_addPerFrameHandler;
|
|
||||||
deleteVehicle _logic;
|
|
||||||
closeDialog 1;
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params ["_logic"];
|
||||||
|
|
||||||
|
if (missionNamespace getVariable ["armatak_tcp_socket_is_running", false]) exitWith {
|
||||||
|
["Socket was called twice", "error", "TCP Socket"] call EFUNC(main,notify);
|
||||||
|
closeDialog 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
disableSerialization;
|
||||||
|
|
||||||
|
["Connecting to authenticated TAK socket", "success", "TCP Socket"] call EFUNC(main,notify);
|
||||||
|
|
||||||
|
_tak_server_instance_address = ctrlText 14100;
|
||||||
|
_tak_server_enrollment_port = ctrlText 14101;
|
||||||
|
_tak_server_enrollment_username = ctrlText 14102;
|
||||||
|
_tak_server_enrollment_password = ctrlText 14103;
|
||||||
|
|
||||||
|
"armatak" callExtension [
|
||||||
|
"tcp_socket:start_enroll_mtls",
|
||||||
|
[
|
||||||
|
_tak_server_instance_address,
|
||||||
|
_tak_server_instance_address,
|
||||||
|
_tak_server_enrollment_port,
|
||||||
|
_tak_server_enrollment_username,
|
||||||
|
_tak_server_enrollment_password,
|
||||||
|
""
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
_tak_server_instance_address call FUNC(startCotRouter);
|
||||||
|
deleteVehicle _logic;
|
||||||
|
closeDialog 1;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params ["_logic"];
|
||||||
|
|
||||||
|
if (missionNamespace getVariable ["armatak_tcp_socket_is_running", false]) exitWith {
|
||||||
|
["Socket was called twice", "error", "TCP Socket"] call EFUNC(main,notify);
|
||||||
|
closeDialog 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
disableSerialization;
|
||||||
|
|
||||||
|
["Connecting to TCP Socket", "success", "TCP Socket"] call EFUNC(main,notify);
|
||||||
|
|
||||||
|
_tak_server_instance_address = ctrlText 14000;
|
||||||
|
_tak_server_instance_port = ctrlText 14001;
|
||||||
|
_tak_server_fulladdress = _tak_server_instance_address + ":" + _tak_server_instance_port;
|
||||||
|
|
||||||
|
"armatak" callExtension ["tcp_socket:start", [_tak_server_fulladdress]];
|
||||||
|
|
||||||
|
_tak_server_fulladdress call FUNC(startCotRouter);
|
||||||
|
deleteVehicle _logic;
|
||||||
|
closeDialog 1;
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Valmo, Codex
|
||||||
|
* Adds entities to the server-side CoT router entity list.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Entity or entities to publish through the CoT router <OBJECT|ARRAY>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Current routed entities <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_entities", [], [objNull, []]]
|
||||||
|
];
|
||||||
|
|
||||||
|
private _toAdd = if (_entities isEqualType objNull) then {[_entities]} else {_entities};
|
||||||
|
private _routed = missionNamespace getVariable ["armatak_server_syncedUnits", []];
|
||||||
|
_routed append _toAdd;
|
||||||
|
_routed = _routed arrayIntersect _routed;
|
||||||
|
_routed = _routed select {!isNull _x && {alive _x}};
|
||||||
|
|
||||||
|
missionNamespace setVariable ["armatak_server_syncedUnits", _routed, true];
|
||||||
|
GVAR(syncedUnits) = _routed;
|
||||||
|
|
||||||
|
_routed
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Valmo, Codex
|
||||||
|
* Removes entities from the server-side CoT router entity list.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Entity or entities to remove from the CoT router <OBJECT|ARRAY>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Current routed entities <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_entities", [], [objNull, []]]
|
||||||
|
];
|
||||||
|
|
||||||
|
private _toRemove = if (_entities isEqualType objNull) then {[_entities]} else {_entities};
|
||||||
|
private _routed = missionNamespace getVariable ["armatak_server_syncedUnits", []];
|
||||||
|
_routed = (_routed - _toRemove) select {!isNull _x && {alive _x}};
|
||||||
|
|
||||||
|
missionNamespace setVariable ["armatak_server_syncedUnits", _routed, true];
|
||||||
|
GVAR(syncedUnits) = _routed;
|
||||||
|
|
||||||
|
_routed
|
||||||
@@ -36,7 +36,7 @@ switch (false) do {
|
|||||||
|
|
||||||
GVAR(syncedUnits) pushBack _unit;
|
GVAR(syncedUnits) pushBack _unit;
|
||||||
|
|
||||||
missionNamespace setVariable ["armatak_server_syncedUnits", GVAR(syncedUnits)];
|
missionNamespace setVariable ["armatak_server_syncedUnits", GVAR(syncedUnits), true];
|
||||||
SETVAR(_unit,GVAR(isRouting),true);
|
SETVAR(_unit,GVAR(isRouting),true);
|
||||||
|
|
||||||
deleteVehicle _logic;
|
deleteVehicle _logic;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ switch (false) do {
|
|||||||
};
|
};
|
||||||
} forEach GVAR(syncedUnits);
|
} forEach GVAR(syncedUnits);
|
||||||
|
|
||||||
missionNmaespace setVariable ["armatak_server_syncedUnits", GVAR(syncedUnits)];
|
missionNamespace setVariable ["armatak_server_syncedUnits", GVAR(syncedUnits), true];
|
||||||
SETVAR(_unit,GVAR(isRouting),false);
|
SETVAR(_unit,GVAR(isRouting),false);
|
||||||
|
|
||||||
deleteVehicle _logic;
|
deleteVehicle _logic;
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Valmo, Codex
|
||||||
|
* Replaces the server-side CoT router entity list with a de-duplicated list.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Entities to publish through the CoT router <ARRAY>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Current routed entities <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_entities", [], [[]]]
|
||||||
|
];
|
||||||
|
|
||||||
|
private _routed = _entities arrayIntersect _entities;
|
||||||
|
_routed = _routed select {!isNull _x && {alive _x}};
|
||||||
|
|
||||||
|
missionNamespace setVariable ["armatak_server_syncedUnits", _routed, true];
|
||||||
|
GVAR(syncedUnits) = _routed;
|
||||||
|
|
||||||
|
_routed
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params [["_server_instance", "", [""]]];
|
||||||
|
|
||||||
|
missionNamespace setVariable ["armatak_server_instance", _server_instance];
|
||||||
|
missionNamespace setVariable ["armatak_tcp_socket_is_running", true];
|
||||||
|
|
||||||
|
if (isNil { missionNamespace getVariable "armatak_server_syncedUnits" }) then {
|
||||||
|
missionNamespace setVariable ["armatak_server_syncedUnits", []];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isNil { missionNamespace getVariable "armatak_server_clientClaimedEuds" }) then {
|
||||||
|
missionNamespace setVariable ["armatak_server_clientClaimedEuds", []];
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
|
||||||
|
|
||||||
|
[{
|
||||||
|
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
|
||||||
|
private _clientClaimedEuds = missionNamespace getVariable ["armatak_server_clientClaimedEuds", []];
|
||||||
|
|
||||||
|
{
|
||||||
|
_objectType = _x call BIS_fnc_objectType;
|
||||||
|
switch (true) do {
|
||||||
|
case ((_objectType select 0) == "Soldier"): {
|
||||||
|
private _uuid = _x call armatak_fnc_extract_uuid;
|
||||||
|
private _isClientEud = _x getVariable [QEGVAR(client,eudConnected), false];
|
||||||
|
if (_isClientEud) exitWith {
|
||||||
|
if !(_uuid in _clientClaimedEuds) then {
|
||||||
|
private _position = _x call armatak_client_fnc_extractClientPosition;
|
||||||
|
private _deleteCot = [_uuid, "a-f-G-U-C-I", _position select 1, _position select 2, _position select 3];
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:delete", [_deleteCot]];
|
||||||
|
_clientClaimedEuds pushBack _uuid;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_clientClaimedEuds = _clientClaimedEuds - [_uuid];
|
||||||
|
|
||||||
|
_callsign = [_x] call armatak_fnc_extract_unit_callsign;
|
||||||
|
_group_name = [group _x] call armatak_fnc_extract_group_color;
|
||||||
|
_group_role = [_x] call armatak_fnc_extract_group_role;
|
||||||
|
|
||||||
|
[_x, _callsign, _group_name, _group_role] call armatak_fnc_send_eud_cot;
|
||||||
|
[_x] call armatak_fnc_send_digital_pointer_cot;
|
||||||
|
};
|
||||||
|
case (unitIsUAV _x): {
|
||||||
|
if !(_x getVariable ["armatak_uav_mavlink_broadcasting", false]) then {
|
||||||
|
_atak_type = [_x] call armatak_fnc_extract_role;
|
||||||
|
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
|
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
|
||||||
|
_x call armatak_fnc_extract_sensor_data;
|
||||||
|
[_x] call armatak_fnc_send_digital_pointer_cot;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case ((_objectType select 0) == "Vehicle"): {
|
||||||
|
_atak_type = [_x] call armatak_fnc_extract_role;
|
||||||
|
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
|
[_x, _atak_type, _callsign] call armatak_fnc_send_marker_cot;
|
||||||
|
_x call armatak_fnc_extract_sensor_data;
|
||||||
|
[_x] call armatak_fnc_send_digital_pointer_cot;
|
||||||
|
};
|
||||||
|
case ((_objectType select 0) == "VehicleAutonomous"): {
|
||||||
|
if !(_x getVariable ["armatak_uav_mavlink_broadcasting", false]) then {
|
||||||
|
_atak_type = [_x] call armatak_fnc_extract_role;
|
||||||
|
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
|
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
|
||||||
|
_x call armatak_fnc_extract_sensor_data;
|
||||||
|
[_x] call armatak_fnc_send_digital_pointer_cot;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach GVAR(syncedUnits);
|
||||||
|
|
||||||
|
missionNamespace setVariable ["armatak_server_clientClaimedEuds", _clientClaimedEuds];
|
||||||
|
}, 1, []] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
armatak\armatak\addons\uav
|
||||||
@@ -9,3 +9,9 @@ class Extended_PreInit_EventHandlers {
|
|||||||
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
|
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Extended_PostInit_EventHandlers {
|
||||||
|
class ADDON {
|
||||||
|
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
PREP(startMavlinkBroadcast);
|
||||||
|
PREP(stopMavlinkBroadcast);
|
||||||
|
PREP(updateMavlinkBroadcast);
|
||||||
|
PREP(resolveVideoUri);
|
||||||
|
PREP(handleMavlinkCallback);
|
||||||
|
PREP(parseMavlinkCallbackData);
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
SETVAR(player,GVAR(mavlinkPFH),-1);
|
||||||
@@ -3,15 +3,13 @@
|
|||||||
class CfgPatches {
|
class CfgPatches {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
name = COMPONENT_NAME;
|
name = COMPONENT_NAME;
|
||||||
units[] = {
|
units[] = {};
|
||||||
QGVAR(videoModule)
|
|
||||||
};
|
|
||||||
weapons[] = {};
|
weapons[] = {};
|
||||||
requiredAddons[] = {
|
requiredAddons[] = {
|
||||||
"cba_main",
|
"cba_main",
|
||||||
"ace_main",
|
"ace_main",
|
||||||
"armatak_main",
|
"armatak_main",
|
||||||
"armatak_server"
|
"armatak_client"
|
||||||
};
|
};
|
||||||
requiredVersion = REQUIRED_VERSION;
|
requiredVersion = REQUIRED_VERSION;
|
||||||
author = PROJECT_AUTHOR;
|
author = PROJECT_AUTHOR;
|
||||||
@@ -20,4 +18,3 @@ class CfgPatches {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
//#include "CfgVehicles.hpp"
|
|
||||||
@@ -0,0 +1,382 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params ["_function", ["_data", "", [""]]];
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
private _payload = [_data] call FUNC(parseMavlinkCallbackData);
|
||||||
|
private _uav = getConnectedUAV player;
|
||||||
|
if (isNull _uav) then {
|
||||||
|
_uav = player getVariable [QGVAR(broadcastingUav), objNull];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isNull _uav) exitWith {
|
||||||
|
"armatak" callExtension ["log", [["warn", format ["Ignoring MAVLINK UDP callback %1 because no UAV is connected: %2", _function, _data]]]];
|
||||||
|
};
|
||||||
|
|
||||||
|
private _number = {
|
||||||
|
params ["_key", ["_default", 0]];
|
||||||
|
private _raw = _payload getOrDefault [_key, str _default];
|
||||||
|
private _value = parseNumber _raw;
|
||||||
|
if (!finite _value) exitWith {_default};
|
||||||
|
_value
|
||||||
|
};
|
||||||
|
|
||||||
|
private _uavGroup = {
|
||||||
|
params ["_vehicle"];
|
||||||
|
private _crew = crew _vehicle;
|
||||||
|
if (_crew isEqualTo []) exitWith {grpNull};
|
||||||
|
group (_crew select 0)
|
||||||
|
};
|
||||||
|
|
||||||
|
private _clearWaypoints = {
|
||||||
|
params ["_group"];
|
||||||
|
if (isNull _group) exitWith {};
|
||||||
|
for "_i" from ((count waypoints _group) - 1) to 0 step -1 do {
|
||||||
|
deleteWaypoint [_group, _i];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
private _clearUavRoute = {
|
||||||
|
private _group = [_uav] call _uavGroup;
|
||||||
|
if (isNull _group) exitWith {false};
|
||||||
|
[_group] call _clearWaypoints;
|
||||||
|
_uav setVariable ["armatak_uas_mission_items", [], true];
|
||||||
|
true
|
||||||
|
};
|
||||||
|
|
||||||
|
private _geoToAtl = {
|
||||||
|
params ["_vehicle", "_lat", "_lon", ["_alt", -1]];
|
||||||
|
|
||||||
|
private _current = [_vehicle] call EFUNC(client,extractClientPosition);
|
||||||
|
private _currentLat = _current select 1;
|
||||||
|
private _currentLon = _current select 2;
|
||||||
|
private _currentAtl = getPosATL _vehicle;
|
||||||
|
|
||||||
|
private _northM = (_lat - _currentLat) * 111320;
|
||||||
|
private _eastM = (_lon - _currentLon) * (111320 * (cos _currentLat));
|
||||||
|
|
||||||
|
[
|
||||||
|
(_currentAtl select 0) + _eastM,
|
||||||
|
(_currentAtl select 1) + _northM,
|
||||||
|
if (_alt >= 0) then {_alt} else {_currentAtl select 2}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
private _commandMove = {
|
||||||
|
params ["_vehicle", "_positionAtl", ["_type", "MOVE"], ["_radius", 80], ["_completion", 50]];
|
||||||
|
|
||||||
|
private _group = [_vehicle] call _uavGroup;
|
||||||
|
if (isNull _group) exitWith {false};
|
||||||
|
|
||||||
|
[_group] call _clearWaypoints;
|
||||||
|
|
||||||
|
_vehicle engineOn true;
|
||||||
|
_vehicle setVariable ["armatak_uas_armed", true, true];
|
||||||
|
_vehicle setFuel ((fuel _vehicle) max 0.1);
|
||||||
|
_vehicle flyInHeight ((_positionAtl select 2) max 10);
|
||||||
|
_vehicle doMove _positionAtl;
|
||||||
|
|
||||||
|
private _wp = _group addWaypoint [_positionAtl, 0];
|
||||||
|
_wp setWaypointType _type;
|
||||||
|
_wp setWaypointBehaviour "CARELESS";
|
||||||
|
_wp setWaypointCombatMode "BLUE";
|
||||||
|
_wp setWaypointSpeed "NORMAL";
|
||||||
|
_wp setWaypointCompletionRadius _completion;
|
||||||
|
|
||||||
|
if (_type == "LOITER") then {
|
||||||
|
_wp setWaypointLoiterRadius (_radius max 25);
|
||||||
|
_wp setWaypointLoiterType "CIRCLE_L";
|
||||||
|
};
|
||||||
|
|
||||||
|
true
|
||||||
|
};
|
||||||
|
|
||||||
|
private _appendMissionWaypoint = {
|
||||||
|
params ["_vehicle", "_positionAtl", "_command", "_seq", ["_radius", 80]];
|
||||||
|
|
||||||
|
private _group = [_vehicle] call _uavGroup;
|
||||||
|
if (isNull _group) exitWith {false};
|
||||||
|
|
||||||
|
private _type = switch (_command) do {
|
||||||
|
case 17;
|
||||||
|
case 18;
|
||||||
|
case 19;
|
||||||
|
case 31: {"LOITER"};
|
||||||
|
case 21: {"MOVE"};
|
||||||
|
default {"MOVE"};
|
||||||
|
};
|
||||||
|
|
||||||
|
private _wp = _group addWaypoint [_positionAtl, 0];
|
||||||
|
_wp setWaypointType _type;
|
||||||
|
_wp setWaypointBehaviour "CARELESS";
|
||||||
|
_wp setWaypointCombatMode "BLUE";
|
||||||
|
_wp setWaypointSpeed "NORMAL";
|
||||||
|
_wp setWaypointCompletionRadius 35;
|
||||||
|
|
||||||
|
if (_type == "LOITER") then {
|
||||||
|
_wp setWaypointLoiterRadius (_radius max 25);
|
||||||
|
_wp setWaypointLoiterType "CIRCLE_L";
|
||||||
|
};
|
||||||
|
if (_command == 21) then {
|
||||||
|
_wp setWaypointStatements ["true", "(vehicle this) land 'LAND'"];
|
||||||
|
};
|
||||||
|
|
||||||
|
private _items = _vehicle getVariable ["armatak_uas_mission_items", []];
|
||||||
|
_items pushBack [_seq, _command, _positionAtl];
|
||||||
|
_vehicle setVariable ["armatak_uas_mission_items", _items, true];
|
||||||
|
|
||||||
|
true
|
||||||
|
};
|
||||||
|
|
||||||
|
private _commandName = _payload getOrDefault ["command_name", "UNKNOWN"];
|
||||||
|
private _command = [_payload getOrDefault ["command", "-1"]] call BIS_fnc_parseNumber;
|
||||||
|
private _callsign = [_uav] call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
|
private _applySpeed = {
|
||||||
|
params ["_speed"];
|
||||||
|
if (_speed <= 0) exitWith {false};
|
||||||
|
_uav limitSpeed _speed;
|
||||||
|
systemChat format ["ATAK SPEED %1m/s %2", round _speed, _callsign];
|
||||||
|
true
|
||||||
|
};
|
||||||
|
|
||||||
|
private _applyMode = {
|
||||||
|
params ["_mode"];
|
||||||
|
|
||||||
|
switch (_mode) do {
|
||||||
|
case 4: {
|
||||||
|
_uav engineOn true;
|
||||||
|
_uav setVariable ["armatak_uas_armed", true, true];
|
||||||
|
_uav setFuel ((fuel _uav) max 0.1);
|
||||||
|
systemChat format ["ATAK GUIDED %1", _callsign];
|
||||||
|
};
|
||||||
|
case 5: {
|
||||||
|
private _pos = getPosATL _uav;
|
||||||
|
[_uav, _pos, "LOITER", 80, 25] call _commandMove;
|
||||||
|
systemChat format ["ATAK LOITER %1", _callsign];
|
||||||
|
};
|
||||||
|
case 6;
|
||||||
|
case 21;
|
||||||
|
case 27: {
|
||||||
|
private _home = _uav getVariable ["armatak_uas_home_atl", getPosATL _uav];
|
||||||
|
_home set [2, ((_home select 2) max 60)];
|
||||||
|
[_uav, _home, "MOVE", 80, 60] call _commandMove;
|
||||||
|
systemChat format ["ATAK RTL %1", _callsign];
|
||||||
|
};
|
||||||
|
case 9: {
|
||||||
|
private _pos = getPosATL _uav;
|
||||||
|
_pos set [2, 0];
|
||||||
|
[_uav, _pos, "MOVE", 30, 20] call _commandMove;
|
||||||
|
_uav flyInHeight 0;
|
||||||
|
systemChat format ["ATAK LAND %1", _callsign];
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Unhandled MAVLINK mode %1 for UAV %2", _mode, _uav]]]];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
private _setHomeFromGeo = {
|
||||||
|
params ["_lat", "_lon", "_alt"];
|
||||||
|
if (_lat == 0 && {_lon == 0}) exitWith {false};
|
||||||
|
private _homeAtl = [_uav, _lat, _lon, _alt] call _geoToAtl;
|
||||||
|
_uav setVariable ["armatak_uas_home_atl", _homeAtl, true];
|
||||||
|
_uav setVariable ["armatak_uas_home_geo", [_lat, _lon, _alt], true];
|
||||||
|
systemChat format ["ATAK HOME %1", _callsign];
|
||||||
|
true
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (_function) do {
|
||||||
|
case "COMMAND_LONG": {
|
||||||
|
switch (_command) do {
|
||||||
|
case 176: {
|
||||||
|
private _mode = ["param2", -1] call _number;
|
||||||
|
if (_mode < 0) then {
|
||||||
|
_mode = ["param1", -1] call _number;
|
||||||
|
};
|
||||||
|
[_mode] call _applyMode;
|
||||||
|
};
|
||||||
|
case 178: {
|
||||||
|
private _speed = ["param2", -1] call _number;
|
||||||
|
if (_speed <= 0) then {
|
||||||
|
_speed = ["param1", -1] call _number;
|
||||||
|
};
|
||||||
|
[_speed] call _applySpeed;
|
||||||
|
};
|
||||||
|
case 179: {
|
||||||
|
private _useCurrent = (["param1", 0] call _number) >= 1;
|
||||||
|
if (_useCurrent) then {
|
||||||
|
private _pos = [_uav] call EFUNC(client,extractClientPosition);
|
||||||
|
private _relAlt = ((getPosATL _uav) select 2) max 0;
|
||||||
|
private _homeAtl = getPosATL _uav;
|
||||||
|
_uav setVariable ["armatak_uas_home_atl", _homeAtl, true];
|
||||||
|
_uav setVariable ["armatak_uas_home_geo", [_pos select 1, _pos select 2, (_pos select 3) - _relAlt], true];
|
||||||
|
systemChat format ["ATAK HOME %1", _callsign];
|
||||||
|
} else {
|
||||||
|
[["param5", 0] call _number, ["param6", 0] call _number, ["param7", 0] call _number] call _setHomeFromGeo;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case 400: {
|
||||||
|
private _doArm = (["param1", 0] call _number) >= 1;
|
||||||
|
_uav engineOn _doArm;
|
||||||
|
_uav setVariable ["armatak_uas_armed", _doArm, true];
|
||||||
|
if (_doArm) then {
|
||||||
|
_uav setFuel ((fuel _uav) max 0.1);
|
||||||
|
};
|
||||||
|
systemChat format ["ATAK %1 %2", ["DISARM", "ARM"] select _doArm, _callsign];
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Applied MAVLINK ARM=%1 to UAV %2", _doArm, _uav]]]];
|
||||||
|
};
|
||||||
|
case 22: {
|
||||||
|
private _alt = (["param7", 75] call _number) max 10;
|
||||||
|
private _pos = getPosATL _uav;
|
||||||
|
_pos set [2, _alt];
|
||||||
|
[_uav, _pos, "MOVE", 80, 25] call _commandMove;
|
||||||
|
_uav setVelocityModelSpace [0, 15, 8];
|
||||||
|
systemChat format ["ATAK TAKEOFF %1m %2", round _alt, _callsign];
|
||||||
|
};
|
||||||
|
case 21: {
|
||||||
|
[9] call _applyMode;
|
||||||
|
};
|
||||||
|
case 20: {
|
||||||
|
[6] call _applyMode;
|
||||||
|
};
|
||||||
|
case 16: {
|
||||||
|
private _lat = ["param5", 0] call _number;
|
||||||
|
private _lon = ["param6", 0] call _number;
|
||||||
|
private _alt = ["param7", -1] call _number;
|
||||||
|
private _pos = [_uav, _lat, _lon, _alt] call _geoToAtl;
|
||||||
|
[_uav, _pos, "MOVE", 80, 50] call _commandMove;
|
||||||
|
systemChat format ["ATAK MOVE %1", _callsign];
|
||||||
|
};
|
||||||
|
case 17: {
|
||||||
|
private _lat = ["param5", 0] call _number;
|
||||||
|
private _lon = ["param6", 0] call _number;
|
||||||
|
private _alt = ["param7", -1] call _number;
|
||||||
|
private _radius = abs (["param3", 80] call _number);
|
||||||
|
private _pos = [_uav, _lat, _lon, _alt] call _geoToAtl;
|
||||||
|
[_uav, _pos, "LOITER", _radius, 30] call _commandMove;
|
||||||
|
systemChat format ["ATAK LOITER %1", _callsign];
|
||||||
|
};
|
||||||
|
case 43000: {
|
||||||
|
private _speed = ["param2", -1] call _number;
|
||||||
|
if (_speed <= 0) then {
|
||||||
|
_speed = ["param1", -1] call _number;
|
||||||
|
};
|
||||||
|
[_speed] call _applySpeed;
|
||||||
|
};
|
||||||
|
case 43001: {
|
||||||
|
private _alt = ["param1", -1] call _number;
|
||||||
|
if (_alt < 0) then {
|
||||||
|
_alt = ["param7", -1] call _number;
|
||||||
|
};
|
||||||
|
private _pos = getPosATL _uav;
|
||||||
|
_pos set [2, _alt max 10];
|
||||||
|
[_uav, _pos, "MOVE", 80, 25] call _commandMove;
|
||||||
|
systemChat format ["ATAK ALT %1m %2", round (_pos select 2), _callsign];
|
||||||
|
};
|
||||||
|
case 43002: {
|
||||||
|
private _heading = ["param1", -1] call _number;
|
||||||
|
if (_heading >= 0) then {
|
||||||
|
_uav setDir _heading;
|
||||||
|
systemChat format ["ATAK HDG %1 %2", round _heading, _callsign];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Unhandled MAVLINK COMMAND_LONG %1 (%2): %3", _command, _commandName, _data]]]];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case "COMMAND_INT": {
|
||||||
|
private _lat = (["x", 0] call _number) / 1e7;
|
||||||
|
private _lon = (["y", 0] call _number) / 1e7;
|
||||||
|
private _alt = ["z", -1] call _number;
|
||||||
|
|
||||||
|
switch (_command) do {
|
||||||
|
case 16: {
|
||||||
|
private _pos = [_uav, _lat, _lon, _alt] call _geoToAtl;
|
||||||
|
[_uav, _pos, "MOVE", 80, 50] call _commandMove;
|
||||||
|
systemChat format ["ATAK MOVE %1", _callsign];
|
||||||
|
};
|
||||||
|
case 17;
|
||||||
|
case 192: {
|
||||||
|
private _radius = abs (["param3", 80] call _number);
|
||||||
|
private _direction = ["CIRCLE_L", "CIRCLE_R"] select ((["param4", 0] call _number) < 0);
|
||||||
|
private _pos = [_uav, _lat, _lon, _alt] call _geoToAtl;
|
||||||
|
private _type = ["MOVE", "LOITER"] select (_radius > 1);
|
||||||
|
[_uav, _pos, _type, _radius, 30] call _commandMove;
|
||||||
|
if (_type == "LOITER") then {
|
||||||
|
private _group = [_uav] call _uavGroup;
|
||||||
|
private _waypoints = waypoints _group;
|
||||||
|
if (_waypoints isNotEqualTo []) then {
|
||||||
|
(_waypoints select -1) setWaypointLoiterType _direction;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
systemChat format ["ATAK %1 %2", _type, _callsign];
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Unhandled MAVLINK COMMAND_INT %1 (%2): %3", _command, _commandName, _data]]]];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case "MISSION_COUNT": {
|
||||||
|
private _count = ["count", 0] call _number;
|
||||||
|
[] call _clearUavRoute;
|
||||||
|
systemChat format ["ATAK ROUTE %1 pts %2", round _count, _callsign];
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Receiving MAVLINK mission count=%1 for UAV %2", _count, _uav]]]];
|
||||||
|
};
|
||||||
|
case "MISSION_CLEAR_ALL": {
|
||||||
|
[] call _clearUavRoute;
|
||||||
|
systemChat format ["ATAK ROUTE CLEAR %1", _callsign];
|
||||||
|
};
|
||||||
|
case "MISSION_SET_CURRENT": {
|
||||||
|
private _seq = ["seq", 0] call _number;
|
||||||
|
"armatak" callExtension ["log", [["info", format ["MAVLINK mission set current seq=%1 for UAV %2", _seq, _uav]]]];
|
||||||
|
};
|
||||||
|
case "MISSION_ITEM";
|
||||||
|
case "MISSION_ITEM_INT": {
|
||||||
|
private _seq = ["seq", 0] call _number;
|
||||||
|
private _missionCommand = ["command", -1] call _number;
|
||||||
|
private _lat = ["lat", 0] call _number;
|
||||||
|
private _lon = ["lon", 0] call _number;
|
||||||
|
private _alt = ["alt", -1] call _number;
|
||||||
|
|
||||||
|
if (_lat == 0 && {_lon == 0}) exitWith {
|
||||||
|
"armatak" callExtension ["log", [["warn", format ["Ignoring MAVLINK mission item at zero coordinate: %1", _data]]]];
|
||||||
|
};
|
||||||
|
|
||||||
|
private _pos = [_uav, _lat, _lon, _alt] call _geoToAtl;
|
||||||
|
private _radius = abs (["param3", 80] call _number);
|
||||||
|
[_uav, _pos, _missionCommand, _seq, _radius] call _appendMissionWaypoint;
|
||||||
|
_uav engineOn true;
|
||||||
|
_uav setVariable ["armatak_uas_armed", true, true];
|
||||||
|
_uav setFuel ((fuel _uav) max 0.1);
|
||||||
|
_uav flyInHeight ((_pos select 2) max 10);
|
||||||
|
systemChat format ["ATAK ROUTE WP %1 %2", round _seq, _callsign];
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Added MAVLINK mission item seq=%1 command=%2 posATL=%3 for UAV %4", _seq, _missionCommand, _pos, _uav]]]];
|
||||||
|
};
|
||||||
|
case "SET_HOME_POSITION": {
|
||||||
|
[["lat", 0] call _number, ["lon", 0] call _number, ["alt", 0] call _number] call _setHomeFromGeo;
|
||||||
|
};
|
||||||
|
case "SET_POSITION_TARGET_GLOBAL_INT": {
|
||||||
|
private _lat = ["lat", 0] call _number;
|
||||||
|
private _lon = ["lon", 0] call _number;
|
||||||
|
private _alt = ["alt", -1] call _number;
|
||||||
|
private _pos = [_uav, _lat, _lon, _alt] call _geoToAtl;
|
||||||
|
[_uav, _pos, "MOVE", 80, 40] call _commandMove;
|
||||||
|
systemChat format ["ATAK GUIDED MOVE %1", _callsign];
|
||||||
|
};
|
||||||
|
case "SET_MODE": {
|
||||||
|
private _mode = ["custom_mode", -1] call _number;
|
||||||
|
[_mode] call _applyMode;
|
||||||
|
};
|
||||||
|
case "COMMAND_ACK": {
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Received MAVLINK COMMAND_ACK %1 (%2): %3", _command, _commandName, _data]]]];
|
||||||
|
};
|
||||||
|
case "MANUAL_CONTROL": {
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Received MAVLINK MANUAL_CONTROL: %1", _data]]]];
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Unhandled MAVLINK UDP callback %1: %2", _function, _data]]]];
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params [["_raw", "", [""]]];
|
||||||
|
|
||||||
|
private _pairs = createHashMap;
|
||||||
|
|
||||||
|
{
|
||||||
|
private _entry = _x;
|
||||||
|
private _separatorIndex = _entry find "=";
|
||||||
|
if (_separatorIndex > 0) then {
|
||||||
|
private _key = _entry select [0, _separatorIndex];
|
||||||
|
private _value = _entry select [_separatorIndex + 1];
|
||||||
|
_pairs set [_key, _value];
|
||||||
|
};
|
||||||
|
} forEach (_raw splitString ";");
|
||||||
|
|
||||||
|
_pairs
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params [["_uav", objNull, [objNull]]];
|
||||||
|
|
||||||
|
private _defaultVideoUri = "rtsp://undefined:554/fpv";
|
||||||
|
private _activelyControlledUav = if (!isNull player) then {getConnectedUAV player} else {objNull};
|
||||||
|
|
||||||
|
private _normalize = {
|
||||||
|
params ["_rawUrl"];
|
||||||
|
|
||||||
|
private _url = trim _rawUrl;
|
||||||
|
if (_url isEqualTo "") exitWith {""};
|
||||||
|
|
||||||
|
if (_url find "://" >= 0) exitWith {_url};
|
||||||
|
|
||||||
|
if (_url find "/" >= 0) exitWith {
|
||||||
|
format ["rtsp://%1", _url]
|
||||||
|
};
|
||||||
|
|
||||||
|
format ["rtp://%1", _url]
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!isNull _uav) then {
|
||||||
|
private _objectVideoUrl = [_uav] call armatak_fnc_extract_marker_video_url;
|
||||||
|
private _normalizedObjectVideoUrl = [_objectVideoUrl] call _normalize;
|
||||||
|
if (_normalizedObjectVideoUrl isNotEqualTo "") exitWith {
|
||||||
|
_normalizedObjectVideoUrl
|
||||||
|
};
|
||||||
|
|
||||||
|
private _activeSessionVideoUrl = player getVariable [QEGVAR(client,video_feed_url), ""];
|
||||||
|
private _normalizedActiveSessionVideoUrl = [_activeSessionVideoUrl] call _normalize;
|
||||||
|
if (_normalizedActiveSessionVideoUrl isNotEqualTo "") exitWith {
|
||||||
|
_normalizedActiveSessionVideoUrl
|
||||||
|
};
|
||||||
|
|
||||||
|
_defaultVideoUri
|
||||||
|
};
|
||||||
|
|
||||||
|
private _sessionVideoUrl = player getVariable [QEGVAR(client,video_feed_url), ""];
|
||||||
|
private _normalizedSessionVideoUrl = [_sessionVideoUrl] call _normalize;
|
||||||
|
if (_normalizedSessionVideoUrl isNotEqualTo "") exitWith {
|
||||||
|
_normalizedSessionVideoUrl
|
||||||
|
};
|
||||||
|
|
||||||
|
_defaultVideoUri
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
private _existingPfh = player getVariable [QGVAR(mavlinkPFH), -1];
|
||||||
|
if (_existingPfh >= 0) then {
|
||||||
|
[_existingPfh] call CBA_fnc_removePerFrameHandler;
|
||||||
|
};
|
||||||
|
|
||||||
|
player setVariable [QGVAR(broadcastingUav), objNull];
|
||||||
|
|
||||||
|
private _pfh = [{
|
||||||
|
call FUNC(updateMavlinkBroadcast);
|
||||||
|
}, 0.5, []] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
player setVariable [QGVAR(mavlinkPFH), _pfh];
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
private _existingPfh = player getVariable [QGVAR(mavlinkPFH), -1];
|
||||||
|
if (_existingPfh >= 0) then {
|
||||||
|
[_existingPfh] call CBA_fnc_removePerFrameHandler;
|
||||||
|
player setVariable [QGVAR(mavlinkPFH), -1];
|
||||||
|
};
|
||||||
|
|
||||||
|
private _broadcastingUav = player getVariable [QGVAR(broadcastingUav), objNull];
|
||||||
|
if (!isNull _broadcastingUav) then {
|
||||||
|
_broadcastingUav setVariable ["armatak_uav_mavlink_broadcasting", false, true];
|
||||||
|
systemChat "UAV broadcasting stopped";
|
||||||
|
};
|
||||||
|
|
||||||
|
player setVariable [QGVAR(broadcastingUav), objNull];
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
private _broadcastingUav = player getVariable [QGVAR(broadcastingUav), objNull];
|
||||||
|
|
||||||
|
if !(player getVariable [QEGVAR(client,eudConnected), false]) exitWith {
|
||||||
|
if (!isNull _broadcastingUav) then {
|
||||||
|
_broadcastingUav setVariable ["armatak_uav_mavlink_broadcasting", false, true];
|
||||||
|
player setVariable [QGVAR(broadcastingUav), objNull];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
private _uav = getConnectedUAV player;
|
||||||
|
if (isNull _uav) then {
|
||||||
|
_uav = _broadcastingUav;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isNull _uav || {!alive _uav}) exitWith {
|
||||||
|
if (!isNull _broadcastingUav) then {
|
||||||
|
_broadcastingUav setVariable ["armatak_uav_mavlink_broadcasting", false, true];
|
||||||
|
player setVariable [QGVAR(broadcastingUav), objNull];
|
||||||
|
systemChat "UAV broadcasting stopped";
|
||||||
|
"armatak" callExtension ["log", [["info", "UAV broadcasting stopped because the UAV is no longer available"]]];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_broadcastingUav isNotEqualTo _uav) then {
|
||||||
|
if (!isNull _broadcastingUav) then {
|
||||||
|
_broadcastingUav setVariable ["armatak_uav_mavlink_broadcasting", false, true];
|
||||||
|
};
|
||||||
|
player setVariable [QGVAR(broadcastingUav), _uav];
|
||||||
|
_uav setVariable ["armatak_uav_mavlink_broadcasting", true, true];
|
||||||
|
private _callsign = [_uav] call armatak_fnc_extract_marker_callsign;
|
||||||
|
systemChat format ["Broadcasting UAV %1", _callsign];
|
||||||
|
"armatak" callExtension ["log", [["info", format ["Broadcasting UAV %1 via MAVLink mock to %2", _callsign, player getVariable [QEGVAR(client,mavlink_address), ""]]]]];
|
||||||
|
};
|
||||||
|
|
||||||
|
_uav setVariable ["armatak_uav_mavlink_broadcasting", true, true];
|
||||||
|
|
||||||
|
private _mavlinkAddress = player getVariable [QEGVAR(client,mavlink_address), ""];
|
||||||
|
if (_mavlinkAddress isEqualTo "") exitWith {};
|
||||||
|
|
||||||
|
private _pos = [_uav] call EFUNC(client,extractClientPosition);
|
||||||
|
private _relAlt = ((getPosATL _uav) select 2) max 0;
|
||||||
|
if (isNil {_uav getVariable "armatak_uas_home_atl"}) then {
|
||||||
|
_uav setVariable ["armatak_uas_home_atl", getPosATL _uav, true];
|
||||||
|
_uav setVariable ["armatak_uas_home_geo", [_pos select 1, _pos select 2, (_pos select 3) - _relAlt], true];
|
||||||
|
};
|
||||||
|
private _uuid = [_uav] call armatak_fnc_extract_uuid;
|
||||||
|
private _callsign = [_uav] call armatak_fnc_extract_marker_callsign;
|
||||||
|
private _videoUri = [_uav] call FUNC(resolveVideoUri);
|
||||||
|
private _dir = vectorDir _uav;
|
||||||
|
private _up = vectorUp _uav;
|
||||||
|
private _yaw = getDir _uav;
|
||||||
|
private _pitch = asin (((_dir select 2) max -1) min 1);
|
||||||
|
private _roll = asin (((_up select 0) max -1) min 1);
|
||||||
|
private _uavType = if (_uav isKindOf "Plane") then {1} else {[2, 3] select (_uav isKindOf "Helicopter")};
|
||||||
|
private _armed = _uav getVariable ["armatak_uas_armed", isEngineOn _uav];
|
||||||
|
if !(isEngineOn _uav) then {
|
||||||
|
_armed = false;
|
||||||
|
_uav setVariable ["armatak_uas_armed", false, true];
|
||||||
|
};
|
||||||
|
private _groundSpeed = abs (_pos select 6);
|
||||||
|
private _landed = (_relAlt <= 1.5) && {_groundSpeed <= 0.5};
|
||||||
|
private _batteryRemaining = round ((((fuel _uav) max 0) min 1) * 100);
|
||||||
|
|
||||||
|
private _gimbalRoll = 0;
|
||||||
|
private _gimbalPitch = _pitch;
|
||||||
|
private _gimbalYaw = _yaw;
|
||||||
|
private _hfov = _uav getVariable ["armatak_uas_fov", 60];
|
||||||
|
private _vfov = _uav getVariable ["armatak_uas_vfov", (_hfov * 0.5625)];
|
||||||
|
private _imageLat = _pos select 1;
|
||||||
|
private _imageLon = _pos select 2;
|
||||||
|
private _imageAlt = _pos select 3;
|
||||||
|
private _cameraData = [_uav, "turret"] call armatak_fnc_extract_uas_camera_data;
|
||||||
|
private _uavControl = UAVControl _uav;
|
||||||
|
private _controlledTurretPath = _uavControl param [1, []];
|
||||||
|
private _hasTurretCamera = ((_controlledTurretPath isEqualType []) && {_controlledTurretPath isNotEqualTo []}) || {(allTurrets _uav) isNotEqualTo []};
|
||||||
|
|
||||||
|
if (_cameraData isEqualType [] && {(count _cameraData) >= 6}) then {
|
||||||
|
_gimbalYaw = _cameraData param [0, _yaw];
|
||||||
|
_gimbalPitch = _cameraData param [1, _pitch];
|
||||||
|
_hfov = _cameraData param [2, _hfov];
|
||||||
|
_vfov = _uav getVariable ["armatak_uas_vfov", (_hfov * 0.5625)];
|
||||||
|
|
||||||
|
private _spiGeo = _cameraData param [5, []];
|
||||||
|
if (_spiGeo isEqualType [] && {(count _spiGeo) >= 3}) then {
|
||||||
|
_imageLat = _spiGeo select 0;
|
||||||
|
_imageLon = _spiGeo select 1;
|
||||||
|
_imageAlt = _spiGeo select 2;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
private _systemPayload = [
|
||||||
|
_mavlinkAddress,
|
||||||
|
_uuid,
|
||||||
|
_callsign,
|
||||||
|
_uavType,
|
||||||
|
_pos select 1,
|
||||||
|
_pos select 2,
|
||||||
|
_pos select 3,
|
||||||
|
_relAlt,
|
||||||
|
_pos select 5,
|
||||||
|
_pos select 6,
|
||||||
|
_roll,
|
||||||
|
_pitch,
|
||||||
|
_yaw,
|
||||||
|
parseNumber _armed,
|
||||||
|
parseNumber _landed,
|
||||||
|
_gimbalRoll,
|
||||||
|
_gimbalPitch,
|
||||||
|
_gimbalYaw,
|
||||||
|
_videoUri,
|
||||||
|
_hfov,
|
||||||
|
_vfov,
|
||||||
|
_imageLat,
|
||||||
|
_imageLon,
|
||||||
|
_imageAlt,
|
||||||
|
parseNumber _hasTurretCamera,
|
||||||
|
_batteryRemaining
|
||||||
|
];
|
||||||
|
|
||||||
|
"armatak" callExtension ["uas:send_uas_system", [_systemPayload]];
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
#define COMPONENT video
|
#define COMPONENT uav
|
||||||
#define COMPONENT_BEAUTIFIED Video Streaming
|
#define COMPONENT_BEAUTIFIED UAV
|
||||||
#include "\armatak\armatak\addons\main\script_mod.hpp"
|
#include "\armatak\armatak\addons\main\script_mod.hpp"
|
||||||
|
|
||||||
// #define DEBUG_MODE_FULL
|
// #define DEBUG_MODE_FULL
|
||||||
// #define DISABLE_COMPILE_CACHE
|
// #define DISABLE_COMPILE_CACHE
|
||||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED_MAIN
|
#ifdef DEBUG_ENABLED_UAV
|
||||||
#define DEBUG_MODE_FULL
|
#define DEBUG_MODE_FULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_SETTINGS_MAIN
|
#ifdef DEBUG_SETTINGS_UAV
|
||||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN
|
#define DEBUG_SETTINGS DEBUG_SETTINGS_UAV
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "\z\ace\addons\main\script_macros.hpp"
|
#include "\z\ace\addons\main\script_macros.hpp"
|
||||||
@@ -1 +0,0 @@
|
|||||||
armatak\armatak\addons\video
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
class CfgVehicles {
|
|
||||||
class Logic;
|
|
||||||
|
|
||||||
class Module_F : Logic
|
|
||||||
{
|
|
||||||
class AttributesBase
|
|
||||||
{
|
|
||||||
class Default;
|
|
||||||
class Edit;
|
|
||||||
class Combo;
|
|
||||||
class Checkbox;
|
|
||||||
class CheckboxNumber;
|
|
||||||
class ModuleDescription;
|
|
||||||
class Units;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ModuleDescription
|
|
||||||
{
|
|
||||||
class AnyBrain;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
class EGVAR(server,moduleBase);
|
|
||||||
class GVAR(videoModule): EGVAR(server,moduleBase) {
|
|
||||||
scope = 2;
|
|
||||||
scopeCurator = 0;
|
|
||||||
displayname = "Video Streaming Handler";
|
|
||||||
icon = "\a3\Modules_F_Curator\Data\iconRadio_ca.paa";
|
|
||||||
category = QEGVAR(main,moduleCategory);
|
|
||||||
function = QFUNC(videoParser);
|
|
||||||
functionPriority = 1;
|
|
||||||
isGlobal = 0;
|
|
||||||
isTriggerActivated = 1;
|
|
||||||
isDisposable = 1;
|
|
||||||
is3den = 0;
|
|
||||||
curatorCanAttach = 0;
|
|
||||||
curatorInfoType = "RscDisplayAttributeModuleNuke";
|
|
||||||
canSetArea = 0;
|
|
||||||
canSetAreaShape = 0;
|
|
||||||
canSetAreaHeight = 0;
|
|
||||||
/*
|
|
||||||
class Attributes: AttributesBase {
|
|
||||||
class GVAR(instanceAddress): Edit {
|
|
||||||
property = QGVAR(instanceAddress);
|
|
||||||
displayname = "MediaMTX Provider Address";
|
|
||||||
tooltip = "MediaMTX Provider Instance Address";
|
|
||||||
typeName = "STRING";
|
|
||||||
defaultValue = "localhost";
|
|
||||||
};
|
|
||||||
class GVAR(instancePort): Edit {
|
|
||||||
property = QGVAR(instancePort);
|
|
||||||
displayname = QUOTE(MediaMTX Provider Port);
|
|
||||||
tooltip = QUOTE(MediaMTX Provider Port for handling video streams);
|
|
||||||
typeName = "STRING";
|
|
||||||
defaultValue = "8554";
|
|
||||||
};
|
|
||||||
class GVAR(instanceAuthUser): Edit {
|
|
||||||
property = QGVAR(instanceAuthUser);
|
|
||||||
displayname = QUOTE(MediaMTX Provider Username);
|
|
||||||
tooltip = QUOTE(MediaMTX Provider Instance Username);
|
|
||||||
typeName = "STRING";
|
|
||||||
defaultValue = "administrator";
|
|
||||||
};
|
|
||||||
class GVAR(instanceAuthPassword): Edit {
|
|
||||||
property = QGVAR(instanceAuthPassword);
|
|
||||||
displayname = QUOTE(MediaMTX Provider Password);
|
|
||||||
tooltip = QUOTE(MediaMTX Provider Instance Password);
|
|
||||||
typeName = "STRING";
|
|
||||||
defaultValue = "password";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
PREP(videoParser);
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
#include "..\script_component.hpp"
|
|
||||||
|
|
||||||
params [
|
|
||||||
["_logic", objNull, [objNull]],
|
|
||||||
["_units", [], [[]]],
|
|
||||||
["_activated", true, [true]]
|
|
||||||
];
|
|
||||||
|
|
||||||
if (isServer) exitWith {
|
|
||||||
private _instance_address = GETVAR(_logic,GVAR(instanceAddress),false);
|
|
||||||
private _instance_port = GETVAR(_logic,GVAR(instancePort),false);
|
|
||||||
private _instance_auth_user = GETVAR(_logic,GVAR(instanceAuthUser),false);
|
|
||||||
private _instance_auth_pass = GETVAR(_logic,GVAR(instanceAuthPassword),false);
|
|
||||||
|
|
||||||
SETMVAR(GVAR(instanceAddress),_instance_address);
|
|
||||||
SETMVAR(GVAR(instancePort),_instance_port);
|
|
||||||
SETMVAR(GVAR(instanceAuthUser),_instance_auth_user);
|
|
||||||
SETMVAR(GVAR(instanceAuthPassword),_instance_auth_pass);
|
|
||||||
|
|
||||||
_startAction = [
|
|
||||||
QGVAR(startStream),
|
|
||||||
"Start Video Feed",
|
|
||||||
"",
|
|
||||||
{
|
|
||||||
_uuid = (_this select 0) call armatak_fnc_extract_uuid;
|
|
||||||
_uuid_short = _uuid select [0, 8];
|
|
||||||
_role = roleDescription (_this select 0);
|
|
||||||
_name = name (_this select 0);
|
|
||||||
|
|
||||||
_role = [_role] call BIS_fnc_filterString;
|
|
||||||
_name = [_name] call BIS_fnc_filterString;
|
|
||||||
|
|
||||||
_stream_path = _name + "_" + _role + "_" + _uuid_short;
|
|
||||||
|
|
||||||
armatak_mediamtx_video_stream_instance_address = GETMVAR(instance_address,false);
|
|
||||||
armatak_mediamtx_video_stream_instance_port = missionNamespace getVariable "instance_port";
|
|
||||||
armatak_mediamtx_video_stream_instance_auth_user = missionNamespace getVariable "instance_auth_user";
|
|
||||||
armatak_mediamtx_video_stream_instance_auth_pass = missionNamespace getVariable "instance_auth_pass";
|
|
||||||
|
|
||||||
"armatak" callExtension ["video_stream:start", [armatak_mediamtx_video_stream_instance_address, armatak_mediamtx_video_stream_instance_port, _stream_path, armatak_mediamtx_video_stream_instance_auth_user, armatak_mediamtx_video_stream_instance_auth_pass]];
|
|
||||||
(_this select 0) setVariable ["armatak_video_feed_is_streaming", true];
|
|
||||||
},
|
|
||||||
{
|
|
||||||
(_this select 0) getVariable "armatak_video_feed_is_streaming" == false
|
|
||||||
}
|
|
||||||
] call ace_interact_menu_fnc_createAction;
|
|
||||||
[
|
|
||||||
"Man",
|
|
||||||
1,
|
|
||||||
["ACE_SelfActions"],
|
|
||||||
_startAction,
|
|
||||||
true
|
|
||||||
] call ace_interact_menu_fnc_addActionToClass;
|
|
||||||
|
|
||||||
_stopAction = [
|
|
||||||
"ArmatakStopStream",
|
|
||||||
"Stop Video Feed",
|
|
||||||
"",
|
|
||||||
{
|
|
||||||
"armatak" callExtension ["video_stream:stop", []];
|
|
||||||
SETVAR(_this select 0,GVAR(isStreaming),false);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GETVAR((this select 0),GVAR(isStreaming),false)
|
|
||||||
}
|
|
||||||
] call ace_interact_menu_fnc_createAction;
|
|
||||||
[
|
|
||||||
"Man",
|
|
||||||
1,
|
|
||||||
["ACE_SelfActions"],
|
|
||||||
_stopAction,
|
|
||||||
true
|
|
||||||
] call ace_interact_menu_fnc_addActionToClass;
|
|
||||||
if (isMultiplayer) then {
|
|
||||||
{
|
|
||||||
SETVAR(_x,GVAR(isStreaming),false);
|
|
||||||
} forEach playableUnits;
|
|
||||||
} else {
|
|
||||||
SETVAR(player,GVAR(isStreaming),false);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
true;
|
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
# TAK authentication flows
|
||||||
|
|
||||||
|
This document describes the authentication and transport flows implemented by the ArmaTAK Rust extension. It is development documentation, not end-user documentation.
|
||||||
|
|
||||||
|
## Security model
|
||||||
|
|
||||||
|
ArmaTAK currently exposes three TCP connection modes:
|
||||||
|
|
||||||
|
| Mode | ArmaTAK entry point | Authentication | Transport protection | Intended use |
|
||||||
|
| --- | --- | --- | --- | --- |
|
||||||
|
| Plain TCP | `tcp_socket.start` | None | None | Local development or explicitly trusted isolated networks only |
|
||||||
|
| Manual mTLS | `tcp_socket.start_mtls` | Client X.509 certificate | TLS with server certificate validation | Production-compatible secure connection |
|
||||||
|
| Credential enrollment followed by mTLS | `tcp_socket.start_enroll_mtls` | HTTP Basic credentials during enrollment, then client X.509 certificate | Enrollment HTTPS currently skips certificate validation; the resulting TAK stream uses validated mTLS | Transitional/bootstrap flow; do not treat the enrollment phase as secure until server verification is enabled |
|
||||||
|
|
||||||
|
The official TAK Server example enables a TLS input on port `8089`. Its plaintext TCP/streaming examples are anonymous and are shown on ports `8087` and `8088`. ArmaTAK must not infer security from a port number; the selected connection mode controls the client-side security properties.
|
||||||
|
|
||||||
|
## Insecure flow: plain TCP
|
||||||
|
|
||||||
|
The plain flow is deliberately simple:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Arma/SQF
|
||||||
|
|
|
||||||
|
| tcp_socket.start("host:port")
|
||||||
|
v
|
||||||
|
ConnectionConfig::Plain
|
||||||
|
|
|
||||||
|
v
|
||||||
|
TCP connect
|
||||||
|
|
|
||||||
|
| unencrypted CoT bytes
|
||||||
|
v
|
||||||
|
TAK Server plaintext/anonymous input
|
||||||
|
```
|
||||||
|
|
||||||
|
`ConnectionConfig::Plain` resolves the supplied address and opens a normal `TcpStream`. No TLS handshake occurs, there is no server identity verification, and no client identity is established by ArmaTAK.
|
||||||
|
|
||||||
|
Consequences:
|
||||||
|
|
||||||
|
- CoT payloads can be observed or modified by an on-path attacker.
|
||||||
|
- ArmaTAK cannot prove that it connected to the intended TAK Server.
|
||||||
|
- The server cannot authenticate ArmaTAK by certificate.
|
||||||
|
- Plain TCP must never be the production default.
|
||||||
|
|
||||||
|
The official TAK Server `CoreConfig.example.xml` keeps anonymous TCP inputs commented out and enables the TLS input instead. Use plain TCP only when a developer intentionally configures a corresponding non-TLS server input.
|
||||||
|
|
||||||
|
## Secure flow: manual mTLS
|
||||||
|
|
||||||
|
The manual mTLS flow uses pre-provisioned certificate material:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Arma/SQF
|
||||||
|
|
|
||||||
|
| tcp_socket.start_mtls(
|
||||||
|
| address,
|
||||||
|
| server_name,
|
||||||
|
| ca_cert_path,
|
||||||
|
| client_cert_path,
|
||||||
|
| client_key_path
|
||||||
|
| )
|
||||||
|
v
|
||||||
|
ConnectionConfig::Mtls
|
||||||
|
|
|
||||||
|
+--> load trusted CA certificate(s)
|
||||||
|
+--> load client certificate chain
|
||||||
|
+--> load client private key
|
||||||
|
|
|
||||||
|
v
|
||||||
|
rustls client configuration
|
||||||
|
|
|
||||||
|
+--> validate server certificate chain
|
||||||
|
+--> validate TLS server name
|
||||||
|
+--> present client certificate
|
||||||
|
v
|
||||||
|
Authenticated mTLS TAK stream
|
||||||
|
```
|
||||||
|
|
||||||
|
The CA file is loaded into a dedicated `rustls::RootCertStore`; the client certificate and private key are used for client authentication. When `server_name` is empty, ArmaTAK derives a name from the target address. A non-empty `server_name` should be preferred when DNS and certificate names are known.
|
||||||
|
|
||||||
|
This is the preferred production flow when certificate provisioning is handled outside ArmaTAK.
|
||||||
|
|
||||||
|
## Enrollment flow: credentials to client certificate
|
||||||
|
|
||||||
|
TAK enrollment converts a username/password bootstrap credential into a short- or medium-lived client certificate, then reconnects using mTLS.
|
||||||
|
|
||||||
|
### Protocol contract
|
||||||
|
|
||||||
|
ArmaTAK follows the contract visible in the official TAK Server and ATAK implementations:
|
||||||
|
|
||||||
|
1. `GET https://HOST:ENROLL_PORT/Marti/api/tls/config`
|
||||||
|
2. Authenticate the request with HTTP Basic credentials.
|
||||||
|
3. Read `serverPort` and `enrollPath` from the TAK certificate configuration. If the fields are absent, ArmaTAK currently falls back to `8089` and `/Marti/api/tls/signClient/v2`.
|
||||||
|
4. Generate a local RSA key pair and PKCS#10 CSR. The private key never needs to be sent to the server.
|
||||||
|
5. `POST https://HOST:ENROLL_PORT{enrollPath}?clientUid=CLIENT_UID`
|
||||||
|
6. Authenticate the signing request with HTTP Basic credentials, send the CSR as `application/pkcs10`, and request JSON.
|
||||||
|
7. Parse `signedCert` and `ca0` from the enrollment response.
|
||||||
|
8. Build an in-memory client identity from the returned certificate plus the locally generated private key.
|
||||||
|
9. Connect to `HOST:serverPort` with mTLS and validate the TAK streaming server against the returned CA.
|
||||||
|
|
||||||
|
The official TAK Server exposes `/tls/config`, `/tls/signClient`, and `/tls/signClient/v2`. The v2 endpoint can return JSON containing `signedCert` plus `ca0`, `ca1`, and additional CA-chain entries. The current ArmaTAK implementation consumes `signedCert` and `ca0`.
|
||||||
|
|
||||||
|
### Current ArmaTAK enrollment security caveat
|
||||||
|
|
||||||
|
`enrollment_http_client()` currently uses `danger_accept_invalid_certs(true)`. Therefore the HTTPS bootstrap does **not** authenticate the enrollment server certificate.
|
||||||
|
|
||||||
|
That means the current enrollment phase is vulnerable to an active man-in-the-middle attacker who can impersonate the HTTPS enrollment endpoint and receive the submitted Basic credentials. The private key remains local, but the username/password bootstrap secret is still exposed to the impersonating endpoint.
|
||||||
|
|
||||||
|
The connection established *after* enrollment is mTLS and uses the returned CA, but that does not retroactively secure the bootstrap exchange. Consequently:
|
||||||
|
|
||||||
|
- `start_enroll_mtls` is a transitional flow, not the preferred production-secure flow in its current form.
|
||||||
|
- `start_mtls` with a trusted CA and pre-provisioned client certificate is the secure production path today.
|
||||||
|
- A future secure enrollment implementation must validate the HTTPS server with a trusted CA, certificate pin, or equivalent authenticated trust bootstrap.
|
||||||
|
- An explicit insecure/development enrollment switch is preferable to silently disabling verification.
|
||||||
|
|
||||||
|
The official ATAK enrollment manager exposes a `verifyHost` choice and records whether host verification is on or off. ArmaTAK should converge on the same explicit distinction.
|
||||||
|
|
||||||
|
## Target secure enrollment design
|
||||||
|
|
||||||
|
The intended production enrollment flow is:
|
||||||
|
|
||||||
|
```text
|
||||||
|
username/password
|
||||||
|
|
|
||||||
|
v
|
||||||
|
HTTPS enrollment endpoint
|
||||||
|
(server certificate MUST validate)
|
||||||
|
|
|
||||||
|
+--> GET /Marti/api/tls/config
|
||||||
|
+--> generate local private key + CSR
|
||||||
|
+--> POST configured signClient endpoint
|
||||||
|
v
|
||||||
|
signed client certificate + trusted CA
|
||||||
|
|
|
||||||
|
v
|
||||||
|
mTLS TAK streaming connection
|
||||||
|
|
|
||||||
|
+--> server authenticated by CA/name
|
||||||
|
+--> client authenticated by certificate
|
||||||
|
v
|
||||||
|
CoT traffic
|
||||||
|
```
|
||||||
|
|
||||||
|
The development-only insecure variant should be explicit:
|
||||||
|
|
||||||
|
```text
|
||||||
|
username/password
|
||||||
|
|
|
||||||
|
v
|
||||||
|
HTTPS enrollment endpoint
|
||||||
|
(certificate verification explicitly disabled)
|
||||||
|
|
|
||||||
|
v
|
||||||
|
WARNING / development-only path
|
||||||
|
```
|
||||||
|
|
||||||
|
Do not silently fall back from verified enrollment to unverified enrollment after a certificate validation failure.
|
||||||
|
|
||||||
|
## Secret-handling requirements
|
||||||
|
|
||||||
|
- Never include passwords, private keys, certificate payloads, or Authorization headers in logs.
|
||||||
|
- `ConnectionConfig::describe()` may include the username and client UID for diagnostics, but it must never include the password.
|
||||||
|
- Keep generated private keys in memory unless a future feature explicitly requires persistence.
|
||||||
|
- Do not commit development certificates or credentials to the repository.
|
||||||
|
- Treat enrollment credentials as bootstrap secrets and rotate/revoke them according to the TAK Server deployment policy.
|
||||||
|
|
||||||
|
## Test contract
|
||||||
|
|
||||||
|
Unit tests should lock down the protocol-level behavior that does not require a live TAK Server:
|
||||||
|
|
||||||
|
- official endpoint paths and default mTLS port;
|
||||||
|
- trimming and construction of enrollment URLs;
|
||||||
|
- parsing TAK enrollment configuration with explicit values and fallback defaults;
|
||||||
|
- PEM normalization;
|
||||||
|
- absence of passwords from diagnostic descriptions;
|
||||||
|
- TLS server-name derivation and PEM parsing where deterministic;
|
||||||
|
- CoT and MAVLink pure serialization logic.
|
||||||
|
|
||||||
|
Live certificate signing, TLS handshake behavior, socket reconnect behavior, mDNS, video processes, and Arma callback behavior belong in integration/E2E tests because they depend on operating-system or external-server state.
|
||||||
|
|
||||||
|
## Upstream references
|
||||||
|
|
||||||
|
The tests and protocol assumptions in this repository are based on these upstream implementations:
|
||||||
|
|
||||||
|
- TAK Server, `CertManagerApi.java`: <https://github.com/TAK-Product-Center/Server/blob/5187abd46d827d37cfc5708805eced197a837e49/src/takserver-core/takserver-war/src/main/java/com/bbn/tak/tls/CertManagerApi.java>
|
||||||
|
- TAK Server, `CoreConfig.example.xml`: <https://github.com/TAK-Product-Center/Server/blob/5187abd46d827d37cfc5708805eced197a837e49/src/takserver-core/example/CoreConfig.example.xml>
|
||||||
|
- ATAK/CommonCommo, `enrollmentmanager.cpp`: <https://github.com/TAK-Product-Center/atak-civ/blob/9f6893dd657feacc35ec5de03dad721c2e44170e/commoncommo/core/impl/enrollmentmanager.cpp>
|
||||||
|
|
||||||
|
Pinning the source revisions in this document keeps the development contract reproducible. When the upstream protocol changes, update both the implementation/tests and these references together.
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
# Rust testing and coverage policy
|
||||||
|
|
||||||
|
This document defines the development-time testing and coverage policy for the ArmaTAK Rust extension.
|
||||||
|
|
||||||
|
## Goals
|
||||||
|
|
||||||
|
The CI pipeline has two complementary coverage goals:
|
||||||
|
|
||||||
|
1. **100% line coverage for deterministic unit-testable code.** Pure protocol parsing, serialization, value normalization, packet construction, configuration descriptions, and other deterministic helpers belong in this gate.
|
||||||
|
2. **A non-regression floor for the complete Rust extension.** The complete report includes network adapters, mDNS, process management, Arma callbacks, socket loops, and TLS handshakes even when those components require integration or E2E infrastructure rather than unit tests.
|
||||||
|
|
||||||
|
The first goal prevents newly added deterministic logic from bypassing unit tests. The second prevents the overall extension from silently losing coverage while integration coverage is expanded.
|
||||||
|
|
||||||
|
## Local commands
|
||||||
|
|
||||||
|
Run the complete Rust unit test suite with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo test --all-targets --locked
|
||||||
|
```
|
||||||
|
|
||||||
|
Install `cargo-llvm-cov` and inspect line coverage with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo llvm-cov --all-targets --locked --summary-only
|
||||||
|
```
|
||||||
|
|
||||||
|
Generate an LCOV file with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo llvm-cov --all-targets --locked --lcov --output-path lcov.info
|
||||||
|
```
|
||||||
|
|
||||||
|
CI publishes `lcov.info` as the `rust-lcov` artifact after a successful run.
|
||||||
|
|
||||||
|
## What belongs in the 100% unit gate
|
||||||
|
|
||||||
|
A source file should be included in the deterministic 100% gate when its behavior can be exercised without relying on:
|
||||||
|
|
||||||
|
- a live TAK Server;
|
||||||
|
- a live ATAK client;
|
||||||
|
- an operating-system socket peer;
|
||||||
|
- mDNS availability;
|
||||||
|
- an FFmpeg or external video process;
|
||||||
|
- timing-sensitive reconnect loops;
|
||||||
|
- Arma engine callback scheduling;
|
||||||
|
- real certificate enrollment or a real TLS handshake.
|
||||||
|
|
||||||
|
Examples include TAK enrollment URL/config parsing, XML serialization, MAVLink checksums and identity derivation, payload conversion, and diagnostic formatting.
|
||||||
|
|
||||||
|
When adding deterministic production code, add the tests in the same change. If a previously excluded file becomes fully unit-testable, bring it to 100% line coverage and remove it from the CI exclusion expression.
|
||||||
|
|
||||||
|
## What does not belong in a unit-only 100% gate
|
||||||
|
|
||||||
|
External adapters are still part of the full-extension coverage report, but forcing them into a unit-only percentage usually produces brittle or misleading tests. The following behavior should be verified through integration or E2E fixtures instead:
|
||||||
|
|
||||||
|
- TCP/UDP connection establishment and reconnect behavior;
|
||||||
|
- TAK Server certificate enrollment over HTTPS;
|
||||||
|
- real mTLS certificate-chain and server-name verification;
|
||||||
|
- mDNS publication/discovery;
|
||||||
|
- subprocess lifecycle and video streaming;
|
||||||
|
- Arma engine callback delivery and long-running endpoint threads.
|
||||||
|
|
||||||
|
These components must not be hidden from the complete report. Their zero or partial unit coverage remains visible and therefore continues to affect the global non-regression floor.
|
||||||
|
|
||||||
|
## Authentication test contract
|
||||||
|
|
||||||
|
Authentication protocol assumptions are derived from pinned official upstream implementations. See [authentication-flows.md](authentication-flows.md) for the exact TAK Server and ATAK source revisions.
|
||||||
|
|
||||||
|
At minimum, unit tests lock down:
|
||||||
|
|
||||||
|
- `/Marti/api/tls/config` construction;
|
||||||
|
- the v2 `signClient` enrollment path and the official `8089` mTLS default;
|
||||||
|
- Basic-auth enrollment configuration behavior at the adapter boundary;
|
||||||
|
- enrollment XML parsing, including missing and malformed tags;
|
||||||
|
- PEM normalization;
|
||||||
|
- the rule that diagnostic descriptions never contain enrollment passwords.
|
||||||
|
|
||||||
|
A future verified-enrollment implementation must add tests for the trust-bootstrap configuration and integration tests using a real or fixture TLS server. It must never silently downgrade from verified HTTPS to disabled certificate validation.
|
||||||
|
|
||||||
|
## Coverage changes
|
||||||
|
|
||||||
|
Coverage thresholds are intentionally enforced in CI rather than documented as aspirational numbers. When a change increases the complete-extension baseline, raise the global floor in the workflow in the same pull request or branch before merging. Do not lower either coverage threshold merely to make CI pass; lower thresholds only when a documented architectural change makes the previous metric invalid.
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 143 KiB |
BIN
Binary file not shown.
+92
-3
@@ -1,5 +1,6 @@
|
|||||||
use uuid::Uuid;
|
use super::video::video_detail_xml;
|
||||||
use chrono::{Duration, SecondsFormat, Utc};
|
use chrono::{Duration, SecondsFormat, Utc};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
pub struct CursorOverTime {
|
pub struct CursorOverTime {
|
||||||
pub uuid: Option<String>,
|
pub uuid: Option<String>,
|
||||||
@@ -16,6 +17,8 @@ pub struct CursorOverTime {
|
|||||||
pub track_speed: Option<f32>,
|
pub track_speed: Option<f32>,
|
||||||
pub link_uid: Option<String>,
|
pub link_uid: Option<String>,
|
||||||
pub remarker: Option<String>,
|
pub remarker: Option<String>,
|
||||||
|
pub video_url: Option<String>,
|
||||||
|
pub stale_seconds: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CursorOverTime {
|
impl CursorOverTime {
|
||||||
@@ -32,8 +35,9 @@ impl CursorOverTime {
|
|||||||
|
|
||||||
let created_time = Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true);
|
let created_time = Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true);
|
||||||
|
|
||||||
let stale_time =
|
let stale_seconds = self.stale_seconds.unwrap_or(360).max(1);
|
||||||
(Utc::now() + Duration::seconds(360)).to_rfc3339_opts(SecondsFormat::Millis, true);
|
let stale_time = (Utc::now() + Duration::seconds(stale_seconds))
|
||||||
|
.to_rfc3339_opts(SecondsFormat::Millis, true);
|
||||||
|
|
||||||
let mut xml = String::new();
|
let mut xml = String::new();
|
||||||
|
|
||||||
@@ -107,8 +111,93 @@ impl CursorOverTime {
|
|||||||
xml.push_str(format!("<remarks>ARMATAK | {}</remarks>", remark).as_str());
|
xml.push_str(format!("<remarks>ARMATAK | {}</remarks>", remark).as_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(video_url) = &self.video_url {
|
||||||
|
if !video_url.trim().is_empty() {
|
||||||
|
xml.push_str(&video_detail_xml(video_url, uuid, &self.contact_callsign));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
xml.push_str("</detail></event>");
|
xml.push_str("</detail></event>");
|
||||||
|
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::CursorOverTime;
|
||||||
|
|
||||||
|
fn minimal_marker() -> CursorOverTime {
|
||||||
|
CursorOverTime {
|
||||||
|
uuid: None,
|
||||||
|
r#type: None,
|
||||||
|
point_lat: -30.0,
|
||||||
|
point_lon: -51.0,
|
||||||
|
point_hae: 10.0,
|
||||||
|
point_ce: None,
|
||||||
|
point_le: None,
|
||||||
|
contact_callsign: "Falcon".to_string(),
|
||||||
|
group_name: None,
|
||||||
|
group_role: None,
|
||||||
|
track_course: None,
|
||||||
|
track_speed: None,
|
||||||
|
link_uid: None,
|
||||||
|
remarker: None,
|
||||||
|
video_url: None,
|
||||||
|
stale_seconds: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn serializes_minimal_marker_with_tak_defaults() {
|
||||||
|
let xml = minimal_marker().convert_to_xml();
|
||||||
|
|
||||||
|
assert!(xml.starts_with("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"));
|
||||||
|
assert!(xml.contains("<event type=\"a-f-G-U-C-I\" version=\"2.0\""));
|
||||||
|
assert!(xml.contains("<point ce=\"9999999\" le=\"9999999\" hae=\"10\" lat=\"-30\" lon=\"-51\" />"));
|
||||||
|
assert!(xml.contains("<contact callsign=\"Falcon\" />"));
|
||||||
|
assert!(xml.contains("<uid Droid=\"Falcon\"/>"));
|
||||||
|
assert!(!xml.contains("<link "));
|
||||||
|
assert!(!xml.contains("<track "));
|
||||||
|
assert!(!xml.contains("<__group "));
|
||||||
|
assert!(!xml.contains("<remarks>"));
|
||||||
|
assert!(!xml.contains("<__video>"));
|
||||||
|
assert!(xml.ends_with("</detail></event>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn serializes_all_optional_marker_details() {
|
||||||
|
let marker = CursorOverTime {
|
||||||
|
uuid: Some("marker-1".to_string()),
|
||||||
|
r#type: Some("a-f-G-U-C".to_string()),
|
||||||
|
point_lat: 1.25,
|
||||||
|
point_lon: 2.5,
|
||||||
|
point_hae: 100.0,
|
||||||
|
point_ce: Some(3.0),
|
||||||
|
point_le: Some(4.0),
|
||||||
|
contact_callsign: "Raven".to_string(),
|
||||||
|
group_name: Some("Cyan".to_string()),
|
||||||
|
group_role: Some("Team Member".to_string()),
|
||||||
|
track_course: Some(180),
|
||||||
|
track_speed: Some(12.5),
|
||||||
|
link_uid: Some("parent-1".to_string()),
|
||||||
|
remarker: Some("test remark".to_string()),
|
||||||
|
video_url: Some("rtsp://video.example.test:8554/live".to_string()),
|
||||||
|
stale_seconds: Some(0),
|
||||||
|
};
|
||||||
|
|
||||||
|
let xml = marker.convert_to_xml();
|
||||||
|
|
||||||
|
assert!(xml.contains("type=\"a-f-G-U-C\""));
|
||||||
|
assert!(xml.contains("uid=\"marker-1\""));
|
||||||
|
assert!(xml.contains("<point ce=\"3\" le=\"4\" hae=\"100\" lat=\"1.25\" lon=\"2.5\" />"));
|
||||||
|
assert!(xml.contains("<precisionlocation altsrc=\"DTED0\" />"));
|
||||||
|
assert!(xml.contains("<link uid=\"parent-1\" type=\"a-f-G-U-C\" relation=\"p-p\" />"));
|
||||||
|
assert!(xml.contains("<hideLabel />"));
|
||||||
|
assert!(xml.contains("<track course=\"180\" speed=\"12.5\" />"));
|
||||||
|
assert!(xml.contains("<status battery=\"89\" />"));
|
||||||
|
assert!(xml.contains("<__group name=\"Cyan\" role=\"Team Member\" />"));
|
||||||
|
assert!(xml.contains("<remarks>ARMATAK | test remark</remarks>"));
|
||||||
|
assert!(xml.contains("<ConnectionEntry protocol=\"rtsp\""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
use arma_rs::{FromArma, FromArmaError};
|
||||||
|
use chrono::{Duration, SecondsFormat, Utc};
|
||||||
|
|
||||||
|
pub struct DeleteCoTPayload {
|
||||||
|
pub target_uid: String,
|
||||||
|
pub target_type: String,
|
||||||
|
pub point_lat: f64,
|
||||||
|
pub point_lon: f64,
|
||||||
|
pub point_hae: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromArma for DeleteCoTPayload {
|
||||||
|
fn from_arma(data: String) -> Result<DeleteCoTPayload, FromArmaError> {
|
||||||
|
let (target_uid, target_type, point_lat, point_lon, point_hae) =
|
||||||
|
<(String, String, f64, f64, f32)>::from_arma(data)?;
|
||||||
|
Ok(Self {
|
||||||
|
target_uid,
|
||||||
|
target_type,
|
||||||
|
point_lat,
|
||||||
|
point_lon,
|
||||||
|
point_hae,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DeleteCoTPayload {
|
||||||
|
pub fn to_xml(&self) -> String {
|
||||||
|
let created_time = Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true);
|
||||||
|
let stale_time =
|
||||||
|
(Utc::now() + Duration::seconds(60)).to_rfc3339_opts(SecondsFormat::Millis, true);
|
||||||
|
|
||||||
|
format!(
|
||||||
|
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?><event type=\"t-x-d-d\" version=\"2.0\" how=\"m-g\" uid=\"{}.delete\" time=\"{}\" start=\"{}\" stale=\"{}\"><point ce=\"9999999\" le=\"9999999\" hae=\"{}\" lat=\"{}\" lon=\"{}\" /><detail><link uid=\"{}\" type=\"{}\" relation=\"none\" /><__forcedelete /></detail></event>",
|
||||||
|
self.target_uid,
|
||||||
|
created_time,
|
||||||
|
created_time,
|
||||||
|
stale_time,
|
||||||
|
self.point_hae,
|
||||||
|
self.point_lat,
|
||||||
|
self.point_lon,
|
||||||
|
self.target_uid,
|
||||||
|
self.target_type
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::DeleteCoTPayload;
|
||||||
|
use arma_rs::FromArma;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_and_serializes_forced_delete_cot() {
|
||||||
|
let payload = DeleteCoTPayload::from_arma(
|
||||||
|
r#"["target-1","a-f-G-U-C",-30.1,-51.2,123.5]"#.to_string(),
|
||||||
|
)
|
||||||
|
.expect("delete CoT payload should parse");
|
||||||
|
|
||||||
|
assert_eq!(payload.target_uid, "target-1");
|
||||||
|
assert_eq!(payload.target_type, "a-f-G-U-C");
|
||||||
|
assert_eq!(payload.point_lat, -30.1);
|
||||||
|
assert_eq!(payload.point_lon, -51.2);
|
||||||
|
assert_eq!(payload.point_hae, 123.5);
|
||||||
|
|
||||||
|
let xml = payload.to_xml();
|
||||||
|
assert!(xml.starts_with("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"));
|
||||||
|
assert!(xml.contains("type=\"t-x-d-d\""));
|
||||||
|
assert!(xml.contains("uid=\"target-1.delete\""));
|
||||||
|
assert!(xml.contains("hae=\"123.5\" lat=\"-30.1\" lon=\"-51.2\""));
|
||||||
|
assert!(xml.contains("<link uid=\"target-1\" type=\"a-f-G-U-C\" relation=\"none\" />"));
|
||||||
|
assert!(xml.contains("<__forcedelete />"));
|
||||||
|
assert!(xml.ends_with("</detail></event>"));
|
||||||
|
}
|
||||||
|
}
|
||||||
+68
-35
@@ -1,45 +1,78 @@
|
|||||||
use arma_rs::{FromArma, FromArmaError};
|
|
||||||
use super::cot::CursorOverTime;
|
use super::cot::CursorOverTime;
|
||||||
|
use arma_rs::{FromArma, FromArmaError};
|
||||||
|
|
||||||
pub struct DigitalPointerPayload {
|
pub struct DigitalPointerPayload {
|
||||||
pub link_uid: String,
|
pub link_uid: String,
|
||||||
pub contact_callsign: String,
|
pub contact_callsign: String,
|
||||||
pub point_lat: f64,
|
pub point_lat: f64,
|
||||||
pub point_lon: f64,
|
pub point_lon: f64,
|
||||||
pub point_hae: f32,
|
pub point_hae: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromArma for DigitalPointerPayload {
|
impl FromArma for DigitalPointerPayload {
|
||||||
fn from_arma(data: String) -> Result<DigitalPointerPayload, FromArmaError> {
|
fn from_arma(data: String) -> Result<DigitalPointerPayload, FromArmaError> {
|
||||||
let (link_uid, contact_callsign, point_lat, point_lon, point_hae) =
|
let (link_uid, contact_callsign, point_lat, point_lon, point_hae) =
|
||||||
<(String, String, f64, f64, f32)>::from_arma(data)?;
|
<(String, String, f64, f64, f32)>::from_arma(data)?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
link_uid,
|
link_uid,
|
||||||
contact_callsign,
|
contact_callsign,
|
||||||
point_lat,
|
point_lat,
|
||||||
point_lon,
|
point_lon,
|
||||||
point_hae,
|
point_hae,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DigitalPointerPayload {
|
impl DigitalPointerPayload {
|
||||||
pub fn to_cot(&self) -> CursorOverTime {
|
pub fn to_cot(&self) -> CursorOverTime {
|
||||||
CursorOverTime {
|
CursorOverTime {
|
||||||
uuid: Some(format!("{}{}", self.link_uid.clone(), ".SPI1")),
|
uuid: Some(format!("{}{}", self.link_uid.clone(), ".SPI1")),
|
||||||
r#type: Some("b-m-p-s-p-i".to_string()),
|
r#type: Some("b-m-p-s-p-i".to_string()),
|
||||||
point_lat: self.point_lat,
|
point_lat: self.point_lat,
|
||||||
point_lon: self.point_lon,
|
point_lon: self.point_lon,
|
||||||
point_hae: self.point_hae,
|
point_hae: self.point_hae,
|
||||||
point_ce: None,
|
point_ce: None,
|
||||||
point_le: None,
|
point_le: None,
|
||||||
contact_callsign: self.contact_callsign.clone(),
|
contact_callsign: self.contact_callsign.clone(),
|
||||||
group_name: None,
|
group_name: None,
|
||||||
group_role: None,
|
group_role: None,
|
||||||
track_course: None,
|
track_course: None,
|
||||||
track_speed: None,
|
track_speed: None,
|
||||||
link_uid: Some(self.link_uid.clone()),
|
link_uid: Some(self.link_uid.clone()),
|
||||||
remarker: None,
|
remarker: None,
|
||||||
}
|
video_url: None,
|
||||||
}
|
stale_seconds: Some(7),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::DigitalPointerPayload;
|
||||||
|
use arma_rs::FromArma;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_digital_pointer_and_maps_spi_contract() {
|
||||||
|
let payload = DigitalPointerPayload::from_arma(
|
||||||
|
r#"["operator-1","Falcon SPI",-30.1,-51.2,20.0]"#.to_string(),
|
||||||
|
)
|
||||||
|
.expect("digital pointer should parse");
|
||||||
|
|
||||||
|
assert_eq!(payload.link_uid, "operator-1");
|
||||||
|
assert_eq!(payload.contact_callsign, "Falcon SPI");
|
||||||
|
|
||||||
|
let cot = payload.to_cot();
|
||||||
|
assert_eq!(cot.uuid.as_deref(), Some("operator-1.SPI1"));
|
||||||
|
assert_eq!(cot.r#type.as_deref(), Some("b-m-p-s-p-i"));
|
||||||
|
assert_eq!(cot.point_lat, -30.1);
|
||||||
|
assert_eq!(cot.point_lon, -51.2);
|
||||||
|
assert_eq!(cot.point_hae, 20.0);
|
||||||
|
assert_eq!(cot.contact_callsign, "Falcon SPI");
|
||||||
|
assert_eq!(cot.link_uid.as_deref(), Some("operator-1"));
|
||||||
|
assert_eq!(cot.stale_seconds, Some(7));
|
||||||
|
assert!(cot.group_name.is_none());
|
||||||
|
assert!(cot.track_course.is_none());
|
||||||
|
assert!(cot.remarker.is_none());
|
||||||
|
assert!(cot.video_url.is_none());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,163 @@
|
|||||||
|
use arma_rs::{FromArma, FromArmaError};
|
||||||
|
|
||||||
|
pub struct CircleCoTPayload {
|
||||||
|
pub uuid: String,
|
||||||
|
pub center_lat: f64,
|
||||||
|
pub center_lon: f64,
|
||||||
|
pub center_hae: f32,
|
||||||
|
pub major: f64,
|
||||||
|
pub minor: f64,
|
||||||
|
pub angle: f32,
|
||||||
|
pub callsign: String,
|
||||||
|
pub creator_uid: String,
|
||||||
|
pub creator_callsign: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromArma for CircleCoTPayload {
|
||||||
|
fn from_arma(data: String) -> Result<Self, FromArmaError> {
|
||||||
|
let (
|
||||||
|
uuid,
|
||||||
|
center_lat,
|
||||||
|
center_lon,
|
||||||
|
center_hae,
|
||||||
|
major,
|
||||||
|
minor,
|
||||||
|
angle,
|
||||||
|
callsign,
|
||||||
|
creator_uid,
|
||||||
|
creator_callsign,
|
||||||
|
) = <(String, f64, f64, f32, f64, f64, f32, String, String, String)>::from_arma(data)?;
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
|
uuid,
|
||||||
|
center_lat,
|
||||||
|
center_lon,
|
||||||
|
center_hae,
|
||||||
|
major,
|
||||||
|
minor,
|
||||||
|
angle,
|
||||||
|
callsign,
|
||||||
|
creator_uid,
|
||||||
|
creator_callsign,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ShapeCircleCoT {
|
||||||
|
pub uid: String,
|
||||||
|
pub lat: f64,
|
||||||
|
pub lon: f64,
|
||||||
|
pub hae: f32,
|
||||||
|
pub major: f64,
|
||||||
|
pub minor: f64,
|
||||||
|
pub angle: f32,
|
||||||
|
pub callsign: String,
|
||||||
|
pub creator_uid: String,
|
||||||
|
pub creator_callsign: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CircleCoTPayload {
|
||||||
|
pub fn to_cot(&self) -> ShapeCircleCoT {
|
||||||
|
ShapeCircleCoT {
|
||||||
|
uid: self.uuid.clone(),
|
||||||
|
lat: self.center_lat,
|
||||||
|
lon: self.center_lon,
|
||||||
|
hae: self.center_hae,
|
||||||
|
major: self.major,
|
||||||
|
minor: self.minor,
|
||||||
|
angle: self.angle,
|
||||||
|
callsign: self.callsign.clone(),
|
||||||
|
creator_uid: self.creator_uid.clone(),
|
||||||
|
creator_callsign: self.creator_callsign.clone(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ShapeCircleCoT {
|
||||||
|
pub fn to_xml(&self, now: &str, stale: &str) -> String {
|
||||||
|
format!(
|
||||||
|
r#"<event version="2.0" uid="{uid}" type="u-d-c-c"
|
||||||
|
time="{t}" start="{t}" stale="{stale}"
|
||||||
|
how="h-e" access="Undefined">
|
||||||
|
<point lat="{lat}" lon="{lon}" hae="{hae}" ce="10.9" le="9999999.0" />
|
||||||
|
<detail>
|
||||||
|
<shape>
|
||||||
|
<ellipse major="{major}" minor="{minor}" angle="{angle}" />
|
||||||
|
<link uid="{uid}.Style" type="b-x-KmlStyle" relation="p-c">
|
||||||
|
<Style>
|
||||||
|
<LineStyle>
|
||||||
|
<color>ffffffff</color>
|
||||||
|
<width>3.0</width>
|
||||||
|
</LineStyle>
|
||||||
|
<PolyStyle>
|
||||||
|
<color>96ffffff</color>
|
||||||
|
</PolyStyle>
|
||||||
|
</Style>
|
||||||
|
</link>
|
||||||
|
<link uid="{creator_uid}" type="self" relation="p-p-CenterAnchor" />
|
||||||
|
</shape>
|
||||||
|
<__shapeExtras cpvis="true" editable="true" />
|
||||||
|
<remarks />
|
||||||
|
<contact callsign="{callsign}" />
|
||||||
|
<creator uid="{creator_uid}" callsign="{creator_callsign}" time="{t}" type="a-f-G-U-C" />
|
||||||
|
<archive />
|
||||||
|
<labels_on value="true" />
|
||||||
|
<strokeColor value="-1" />
|
||||||
|
<strokeWeight value="3.0" />
|
||||||
|
<strokeStyle value="solid" />
|
||||||
|
<fillColor value="-1761607681" />
|
||||||
|
<precisionlocation altsrc="GPS" geopointsrc="GPS" />
|
||||||
|
</detail>
|
||||||
|
</event>"#,
|
||||||
|
uid = self.uid,
|
||||||
|
t = now,
|
||||||
|
stale = stale,
|
||||||
|
lat = self.lat,
|
||||||
|
lon = self.lon,
|
||||||
|
hae = self.hae,
|
||||||
|
major = self.major,
|
||||||
|
minor = self.minor,
|
||||||
|
angle = self.angle,
|
||||||
|
callsign = self.callsign,
|
||||||
|
creator_uid = self.creator_uid,
|
||||||
|
creator_callsign = self.creator_callsign
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::CircleCoTPayload;
|
||||||
|
use arma_rs::FromArma;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_circle_payload_maps_shape_and_serializes_cot() {
|
||||||
|
let payload = CircleCoTPayload::from_arma(
|
||||||
|
r#"["circle-1",-30.1,-51.2,20,100,50,30,"Area Alpha","creator-1","Falcon"]"#
|
||||||
|
.to_string(),
|
||||||
|
)
|
||||||
|
.expect("circle payload should parse");
|
||||||
|
|
||||||
|
assert_eq!(payload.uuid, "circle-1");
|
||||||
|
assert_eq!(payload.center_lat, -30.1);
|
||||||
|
assert_eq!(payload.center_lon, -51.2);
|
||||||
|
assert_eq!(payload.center_hae, 20.0);
|
||||||
|
assert_eq!(payload.major, 100.0);
|
||||||
|
assert_eq!(payload.minor, 50.0);
|
||||||
|
assert_eq!(payload.angle, 30.0);
|
||||||
|
|
||||||
|
let shape = payload.to_cot();
|
||||||
|
assert_eq!(shape.uid, "circle-1");
|
||||||
|
assert_eq!(shape.callsign, "Area Alpha");
|
||||||
|
assert_eq!(shape.creator_uid, "creator-1");
|
||||||
|
assert_eq!(shape.creator_callsign, "Falcon");
|
||||||
|
|
||||||
|
let xml = shape.to_xml("2026-08-07T17:00:00.000Z", "2026-08-07T18:00:00.000Z");
|
||||||
|
assert!(xml.contains("uid=\"circle-1\" type=\"u-d-c-c\""));
|
||||||
|
assert!(xml.contains("<point lat=\"-30.1\" lon=\"-51.2\" hae=\"20\""));
|
||||||
|
assert!(xml.contains("<ellipse major=\"100\" minor=\"50\" angle=\"30\" />"));
|
||||||
|
assert!(xml.contains("<link uid=\"creator-1\" type=\"self\" relation=\"p-p-CenterAnchor\" />"));
|
||||||
|
assert!(xml.contains("<contact callsign=\"Area Alpha\" />"));
|
||||||
|
assert!(xml.contains("<creator uid=\"creator-1\" callsign=\"Falcon\""));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
pub mod circle;
|
||||||
|
pub mod route;
|
||||||
|
pub mod shape;
|
||||||
@@ -0,0 +1,204 @@
|
|||||||
|
use arma_rs::{FromArma, FromArmaError};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct RoutePoint {
|
||||||
|
lat: f64,
|
||||||
|
lon: f64,
|
||||||
|
hae: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct RoutePayload {
|
||||||
|
pub uuid: String,
|
||||||
|
pub points: String,
|
||||||
|
pub callsign: String,
|
||||||
|
pub stale_seconds: i64,
|
||||||
|
pub color: i32,
|
||||||
|
pub stroke_weight: f64,
|
||||||
|
pub method: String,
|
||||||
|
pub route_type: String,
|
||||||
|
pub direction: String,
|
||||||
|
pub checkpoint_interval: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromArma for RoutePayload {
|
||||||
|
fn from_arma(data: String) -> Result<Self, FromArmaError> {
|
||||||
|
let (
|
||||||
|
uuid,
|
||||||
|
points,
|
||||||
|
callsign,
|
||||||
|
stale_seconds,
|
||||||
|
color,
|
||||||
|
stroke_weight,
|
||||||
|
method,
|
||||||
|
route_type,
|
||||||
|
direction,
|
||||||
|
checkpoint_interval,
|
||||||
|
) = <(
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
i64,
|
||||||
|
i32,
|
||||||
|
f64,
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
i32,
|
||||||
|
)>::from_arma(data)?;
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
|
uuid,
|
||||||
|
points,
|
||||||
|
callsign,
|
||||||
|
stale_seconds,
|
||||||
|
color,
|
||||||
|
stroke_weight,
|
||||||
|
method,
|
||||||
|
route_type,
|
||||||
|
direction,
|
||||||
|
checkpoint_interval: checkpoint_interval.max(1) as usize,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RoutePayload {
|
||||||
|
pub fn to_xml(&self, now: &str, stale: &str) -> String {
|
||||||
|
let points = parse_points(&self.points);
|
||||||
|
let links = route_links(&self.callsign, &points, self.checkpoint_interval);
|
||||||
|
|
||||||
|
format!(
|
||||||
|
r#"<?xml version="1.0" encoding="UTF-8" ?><event version="2.0" uid="{uid}" type="b-m-r" time="{now}" start="{now}" stale="{stale}" how="h-e" access="Undefined"><point lat="0.0" lon="0.0" hae="9999999.0" ce="9999999.0" le="9999999.0"/><detail>{links}<link_attr planningmethod="{direction}" color="{color}" method="{method}" prefix="CP" style="0" type="Vehicle" stroke="{stroke_weight}" direction="{direction}" routetype="{route_type}" order="Ascending Check Points"/><creator uid="ARMATAK" callsign="ArmaTAK" time="{now}" type="a-f-G-U-C"/><strokeColor value="{color}"/><strokeWeight value="{stroke_weight}"/><strokeStyle value="solid"/><labels_on value="false"/><__routeinfo><__navcues/></__routeinfo><color value="{color}"/><remarks/><contact callsign="{callsign}"/><archive/><height_unit>1</height_unit></detail></event>"#,
|
||||||
|
uid = escape_attr(&self.uuid),
|
||||||
|
now = now,
|
||||||
|
stale = stale,
|
||||||
|
links = links,
|
||||||
|
direction = escape_attr(&self.direction),
|
||||||
|
color = self.color,
|
||||||
|
method = escape_attr(&self.method),
|
||||||
|
stroke_weight = self.stroke_weight.max(1.0),
|
||||||
|
route_type = escape_attr(&self.route_type),
|
||||||
|
callsign = escape_attr(&self.callsign)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn route_links(callsign: &str, points: &[RoutePoint], checkpoint_interval: usize) -> String {
|
||||||
|
let mut xml = String::new();
|
||||||
|
let last_index = points.len().saturating_sub(1);
|
||||||
|
let mut checkpoint_number = 1;
|
||||||
|
|
||||||
|
for (index, point) in points.iter().enumerate() {
|
||||||
|
let is_start = index == 0;
|
||||||
|
let is_end = index == last_index;
|
||||||
|
let is_checkpoint = !is_start && !is_end && index % checkpoint_interval == 0;
|
||||||
|
let point_callsign = if is_start {
|
||||||
|
format!("{} SP", callsign)
|
||||||
|
} else if is_end {
|
||||||
|
"VDO".to_string()
|
||||||
|
} else if is_checkpoint {
|
||||||
|
let name = format!("CP{}", checkpoint_number);
|
||||||
|
checkpoint_number += 1;
|
||||||
|
name
|
||||||
|
} else {
|
||||||
|
String::new()
|
||||||
|
};
|
||||||
|
let link_type = if point_callsign.is_empty() {
|
||||||
|
"b-m-p-c"
|
||||||
|
} else {
|
||||||
|
"b-m-p-w"
|
||||||
|
};
|
||||||
|
|
||||||
|
xml.push_str(&format!(
|
||||||
|
r#"<link uid="{link_uid}" callsign="{callsign}" type="{link_type}" point="{lat},{lon},{hae}" remarks="" relation="c"/>"#,
|
||||||
|
link_uid = escape_attr(&Uuid::new_v4().to_string()),
|
||||||
|
callsign = escape_attr(&point_callsign),
|
||||||
|
link_type = link_type,
|
||||||
|
lat = point.lat,
|
||||||
|
lon = point.lon,
|
||||||
|
hae = point.hae
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
xml
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_points(raw: &str) -> Vec<RoutePoint> {
|
||||||
|
raw.split(';')
|
||||||
|
.filter_map(|entry| {
|
||||||
|
let parts: Vec<_> = entry.split(',').collect();
|
||||||
|
if parts.len() != 3 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(RoutePoint {
|
||||||
|
lat: parts[0].parse().ok()?,
|
||||||
|
lon: parts[1].parse().ok()?,
|
||||||
|
hae: parts[2].parse().ok()?,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn escape_attr(value: &str) -> String {
|
||||||
|
value
|
||||||
|
.replace('&', "&")
|
||||||
|
.replace('"', """)
|
||||||
|
.replace('<', "<")
|
||||||
|
.replace('>', ">")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::{parse_points, route_links, RoutePayload, RoutePoint};
|
||||||
|
use arma_rs::FromArma;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_route_payload_clamps_interval_and_serializes_attributes() {
|
||||||
|
let mut payload = RoutePayload::from_arma(
|
||||||
|
r#"["route<&","","Route<&",600,-1,0.5,"Driving<&","Primary<&","Infil<&",0]"#
|
||||||
|
.to_string(),
|
||||||
|
)
|
||||||
|
.expect("route payload should parse");
|
||||||
|
payload.points = "-30.1,-51.2,10;-30.2,-51.3,20".to_string();
|
||||||
|
|
||||||
|
assert_eq!(payload.checkpoint_interval, 1);
|
||||||
|
assert_eq!(payload.stale_seconds, 600);
|
||||||
|
assert_eq!(payload.stroke_weight, 0.5);
|
||||||
|
|
||||||
|
let xml = payload.to_xml("2026-08-07T17:00:00.000Z", "2026-08-07T18:00:00.000Z");
|
||||||
|
assert!(xml.contains("uid=\"route<&\" type=\"b-m-r\""));
|
||||||
|
assert!(xml.contains("planningmethod=\"Infil<&\""));
|
||||||
|
assert!(xml.contains("method=\"Driving<&\""));
|
||||||
|
assert!(xml.contains("routetype=\"Primary<&\""));
|
||||||
|
assert!(xml.contains("stroke=\"1\""));
|
||||||
|
assert!(xml.contains("<contact callsign=\"Route<&\"/>"));
|
||||||
|
assert!(xml.contains("callsign=\"Route<& SP\""));
|
||||||
|
assert!(xml.contains("callsign=\"VDO\""));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn route_links_cover_start_checkpoint_regular_and_end_points() {
|
||||||
|
let points = vec![
|
||||||
|
RoutePoint { lat: 1.0, lon: 1.0, hae: 1.0 },
|
||||||
|
RoutePoint { lat: 2.0, lon: 2.0, hae: 2.0 },
|
||||||
|
RoutePoint { lat: 3.0, lon: 3.0, hae: 3.0 },
|
||||||
|
RoutePoint { lat: 4.0, lon: 4.0, hae: 4.0 },
|
||||||
|
RoutePoint { lat: 5.0, lon: 5.0, hae: 5.0 },
|
||||||
|
];
|
||||||
|
|
||||||
|
let xml = route_links("Route", &points, 2);
|
||||||
|
assert!(xml.contains("callsign=\"Route SP\" type=\"b-m-p-w\""));
|
||||||
|
assert!(xml.contains("callsign=\"CP1\" type=\"b-m-p-w\""));
|
||||||
|
assert!(xml.contains("callsign=\"\" type=\"b-m-p-c\""));
|
||||||
|
assert!(xml.contains("callsign=\"VDO\" type=\"b-m-p-w\""));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn point_parser_drops_malformed_entries() {
|
||||||
|
let points = parse_points("1,2,3;missing;bad,2,3;4,bad,6;7,8,bad;9,10,11");
|
||||||
|
assert_eq!(points.len(), 2);
|
||||||
|
assert_eq!(points[0].lat, 1.0);
|
||||||
|
assert_eq!(points[1].lat, 9.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,376 @@
|
|||||||
|
use arma_rs::{FromArma, FromArmaError};
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct DrawPoint {
|
||||||
|
lat: f64,
|
||||||
|
lon: f64,
|
||||||
|
hae: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct DrawEllipsePayload {
|
||||||
|
pub uuid: String,
|
||||||
|
pub cot_type: String,
|
||||||
|
pub center_lat: f64,
|
||||||
|
pub center_lon: f64,
|
||||||
|
pub center_hae: f32,
|
||||||
|
pub major: f64,
|
||||||
|
pub minor: f64,
|
||||||
|
pub angle: f32,
|
||||||
|
pub callsign: String,
|
||||||
|
pub stale_seconds: i64,
|
||||||
|
pub stroke_color: i32,
|
||||||
|
pub fill_color: i32,
|
||||||
|
pub stroke_weight: f64,
|
||||||
|
pub milsym: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct DrawLinksPayload {
|
||||||
|
pub uuid: String,
|
||||||
|
pub cot_type: String,
|
||||||
|
pub center_lat: f64,
|
||||||
|
pub center_lon: f64,
|
||||||
|
pub center_hae: f32,
|
||||||
|
pub points: String,
|
||||||
|
pub callsign: String,
|
||||||
|
pub stale_seconds: i64,
|
||||||
|
pub stroke_color: i32,
|
||||||
|
pub fill_color: i32,
|
||||||
|
pub stroke_weight: f64,
|
||||||
|
pub stroke_style: String,
|
||||||
|
pub closed: bool,
|
||||||
|
pub milsym: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromArma for DrawEllipsePayload {
|
||||||
|
fn from_arma(data: String) -> Result<Self, FromArmaError> {
|
||||||
|
let (
|
||||||
|
uuid,
|
||||||
|
cot_type,
|
||||||
|
center_lat,
|
||||||
|
center_lon,
|
||||||
|
center_hae,
|
||||||
|
major,
|
||||||
|
minor,
|
||||||
|
angle,
|
||||||
|
callsign,
|
||||||
|
stale_seconds,
|
||||||
|
stroke_color,
|
||||||
|
fill_color,
|
||||||
|
stroke_weight,
|
||||||
|
milsym,
|
||||||
|
) = <(
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
f64,
|
||||||
|
f64,
|
||||||
|
f32,
|
||||||
|
f64,
|
||||||
|
f64,
|
||||||
|
f32,
|
||||||
|
String,
|
||||||
|
i64,
|
||||||
|
i32,
|
||||||
|
i32,
|
||||||
|
f64,
|
||||||
|
String,
|
||||||
|
)>::from_arma(data)?;
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
|
uuid,
|
||||||
|
cot_type,
|
||||||
|
center_lat,
|
||||||
|
center_lon,
|
||||||
|
center_hae,
|
||||||
|
major,
|
||||||
|
minor,
|
||||||
|
angle,
|
||||||
|
callsign,
|
||||||
|
stale_seconds,
|
||||||
|
stroke_color,
|
||||||
|
fill_color,
|
||||||
|
stroke_weight,
|
||||||
|
milsym,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromArma for DrawLinksPayload {
|
||||||
|
fn from_arma(data: String) -> Result<Self, FromArmaError> {
|
||||||
|
let (
|
||||||
|
uuid,
|
||||||
|
cot_type,
|
||||||
|
center_lat,
|
||||||
|
center_lon,
|
||||||
|
center_hae,
|
||||||
|
points,
|
||||||
|
callsign,
|
||||||
|
stale_seconds,
|
||||||
|
stroke_color,
|
||||||
|
fill_color,
|
||||||
|
stroke_weight,
|
||||||
|
stroke_style,
|
||||||
|
closed,
|
||||||
|
milsym,
|
||||||
|
) = <(
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
f64,
|
||||||
|
f64,
|
||||||
|
f32,
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
i64,
|
||||||
|
i32,
|
||||||
|
i32,
|
||||||
|
f64,
|
||||||
|
String,
|
||||||
|
bool,
|
||||||
|
String,
|
||||||
|
)>::from_arma(data)?;
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
|
uuid,
|
||||||
|
cot_type,
|
||||||
|
center_lat,
|
||||||
|
center_lon,
|
||||||
|
center_hae,
|
||||||
|
points,
|
||||||
|
callsign,
|
||||||
|
stale_seconds,
|
||||||
|
stroke_color,
|
||||||
|
fill_color,
|
||||||
|
stroke_weight,
|
||||||
|
stroke_style,
|
||||||
|
closed,
|
||||||
|
milsym,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DrawEllipsePayload {
|
||||||
|
pub fn to_xml(&self, now: &str, stale: &str) -> String {
|
||||||
|
shape_event(
|
||||||
|
&self.uuid,
|
||||||
|
&self.cot_type,
|
||||||
|
self.center_lat,
|
||||||
|
self.center_lon,
|
||||||
|
self.center_hae,
|
||||||
|
now,
|
||||||
|
stale,
|
||||||
|
&self.callsign,
|
||||||
|
&ellipse_shape_detail(
|
||||||
|
&self.uuid,
|
||||||
|
self.major,
|
||||||
|
self.minor,
|
||||||
|
self.angle,
|
||||||
|
self.stroke_color,
|
||||||
|
self.fill_color,
|
||||||
|
self.stroke_weight,
|
||||||
|
),
|
||||||
|
self.stroke_color,
|
||||||
|
self.fill_color,
|
||||||
|
self.stroke_weight,
|
||||||
|
"solid",
|
||||||
|
&self.milsym,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DrawLinksPayload {
|
||||||
|
pub fn to_xml(&self, now: &str, stale: &str) -> String {
|
||||||
|
let points = parse_points(&self.points);
|
||||||
|
let shape_detail = links_detail(&points, self.closed);
|
||||||
|
|
||||||
|
shape_event(
|
||||||
|
&self.uuid,
|
||||||
|
&self.cot_type,
|
||||||
|
self.center_lat,
|
||||||
|
self.center_lon,
|
||||||
|
self.center_hae,
|
||||||
|
now,
|
||||||
|
stale,
|
||||||
|
&self.callsign,
|
||||||
|
&shape_detail,
|
||||||
|
self.stroke_color,
|
||||||
|
self.fill_color,
|
||||||
|
self.stroke_weight,
|
||||||
|
&self.stroke_style,
|
||||||
|
&self.milsym,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn shape_event(
|
||||||
|
uid: &str,
|
||||||
|
cot_type: &str,
|
||||||
|
lat: f64,
|
||||||
|
lon: f64,
|
||||||
|
hae: f32,
|
||||||
|
now: &str,
|
||||||
|
stale: &str,
|
||||||
|
callsign: &str,
|
||||||
|
shape_detail: &str,
|
||||||
|
stroke_color: i32,
|
||||||
|
fill_color: i32,
|
||||||
|
stroke_weight: f64,
|
||||||
|
stroke_style: &str,
|
||||||
|
milsym: &str,
|
||||||
|
) -> String {
|
||||||
|
let milsym_detail = if milsym.trim().is_empty() {
|
||||||
|
String::new()
|
||||||
|
} else {
|
||||||
|
format!(r#"<__milsym id="{}" />"#, escape_attr(milsym))
|
||||||
|
};
|
||||||
|
|
||||||
|
format!(
|
||||||
|
r#"<?xml version="1.0" encoding="UTF-8" ?><event version="2.0" uid="{uid}" type="{cot_type}" time="{now}" start="{now}" stale="{stale}" how="h-e" access="Undefined"><point lat="{lat}" lon="{lon}" hae="{hae}" ce="10.9" le="9999999.0" /><detail>{shape_detail}<__shapeExtras cpvis="true" editable="true" /><contact callsign="{callsign}" /><remarks /><archive /><labels_on value="true" /><strokeColor value="{stroke_color}" /><strokeWeight value="{stroke_weight}" /><strokeStyle value="{stroke_style}" /><fillColor value="{fill_color}" /><precisionlocation altsrc="GPS" geopointsrc="GPS" />{milsym_detail}</detail></event>"#,
|
||||||
|
uid = escape_attr(uid),
|
||||||
|
cot_type = escape_attr(cot_type),
|
||||||
|
now = now,
|
||||||
|
stale = stale,
|
||||||
|
lat = lat,
|
||||||
|
lon = lon,
|
||||||
|
hae = hae,
|
||||||
|
shape_detail = shape_detail,
|
||||||
|
callsign = escape_attr(callsign),
|
||||||
|
stroke_color = stroke_color,
|
||||||
|
stroke_weight = stroke_weight,
|
||||||
|
stroke_style = escape_attr(stroke_style),
|
||||||
|
fill_color = fill_color,
|
||||||
|
milsym_detail = milsym_detail
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ellipse_shape_detail(
|
||||||
|
uid: &str,
|
||||||
|
major: f64,
|
||||||
|
minor: f64,
|
||||||
|
angle: f32,
|
||||||
|
stroke_color: i32,
|
||||||
|
fill_color: i32,
|
||||||
|
stroke_weight: f64,
|
||||||
|
) -> String {
|
||||||
|
format!(
|
||||||
|
r#"<shape><ellipse major="{major}" minor="{minor}" angle="{angle}" /><link uid="{style_uid}" type="b-x-KmlStyle" relation="p-c"><Style><LineStyle><color>{stroke_hex}</color><width>{stroke_weight}</width></LineStyle><PolyStyle><color>{fill_hex}</color></PolyStyle></Style></link></shape>"#,
|
||||||
|
major = major,
|
||||||
|
minor = minor,
|
||||||
|
angle = angle,
|
||||||
|
style_uid = escape_attr(&format!("{}.Style", uid)),
|
||||||
|
stroke_hex = argb_hex(stroke_color),
|
||||||
|
stroke_weight = stroke_weight,
|
||||||
|
fill_hex = argb_hex(fill_color)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn links_detail(points: &[DrawPoint], closed: bool) -> String {
|
||||||
|
let mut detail = String::new();
|
||||||
|
|
||||||
|
for point in points {
|
||||||
|
detail.push_str(&link_detail(point));
|
||||||
|
}
|
||||||
|
|
||||||
|
if closed {
|
||||||
|
if let Some(first) = points.first() {
|
||||||
|
detail.push_str(&link_detail(first));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
detail
|
||||||
|
}
|
||||||
|
|
||||||
|
fn link_detail(point: &DrawPoint) -> String {
|
||||||
|
format!(
|
||||||
|
r#"<link point="{lat},{lon},{hae}" />"#,
|
||||||
|
lat = point.lat,
|
||||||
|
lon = point.lon,
|
||||||
|
hae = point.hae
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_points(raw: &str) -> Vec<DrawPoint> {
|
||||||
|
raw.split(';')
|
||||||
|
.filter_map(|entry| {
|
||||||
|
let parts: Vec<_> = entry.split(',').collect();
|
||||||
|
if parts.len() != 3 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(DrawPoint {
|
||||||
|
lat: parts[0].parse().ok()?,
|
||||||
|
lon: parts[1].parse().ok()?,
|
||||||
|
hae: parts[2].parse().ok()?,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn argb_hex(color: i32) -> String {
|
||||||
|
format!("{:08x}", color as u32)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn escape_attr(value: &str) -> String {
|
||||||
|
value
|
||||||
|
.replace('&', "&")
|
||||||
|
.replace('"', """)
|
||||||
|
.replace('<', "<")
|
||||||
|
.replace('>', ">")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::{parse_points, DrawEllipsePayload, DrawLinksPayload};
|
||||||
|
use arma_rs::FromArma;
|
||||||
|
|
||||||
|
const NOW: &str = "2026-08-07T17:00:00.000Z";
|
||||||
|
const STALE: &str = "2026-08-07T18:00:00.000Z";
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_and_serializes_ellipse_shape_with_milsym() {
|
||||||
|
let payload = DrawEllipsePayload::from_arma(
|
||||||
|
r#"["ellipse<&","u-d-c-e",-30.1,-51.2,10,100,50,25,"Ellipse<&",600,-1,-1761607681,3,"SFGPUCI----K<&"]"#
|
||||||
|
.to_string(),
|
||||||
|
)
|
||||||
|
.expect("ellipse payload should parse");
|
||||||
|
|
||||||
|
assert_eq!(payload.uuid, "ellipse<&");
|
||||||
|
assert_eq!(payload.stale_seconds, 600);
|
||||||
|
assert_eq!(payload.major, 100.0);
|
||||||
|
assert_eq!(payload.minor, 50.0);
|
||||||
|
|
||||||
|
let xml = payload.to_xml(NOW, STALE);
|
||||||
|
assert!(xml.contains("uid=\"ellipse<&\" type=\"u-d-c-e\""));
|
||||||
|
assert!(xml.contains("<ellipse major=\"100\" minor=\"50\" angle=\"25\" />"));
|
||||||
|
assert!(xml.contains("<color>ffffffff</color>"));
|
||||||
|
assert!(xml.contains("<color>96ffffff</color>"));
|
||||||
|
assert!(xml.contains("<contact callsign=\"Ellipse<&\" />"));
|
||||||
|
assert!(xml.contains("<__milsym id=\"SFGPUCI----K<&\" />"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_and_serializes_closed_link_shape_without_milsym() {
|
||||||
|
let mut payload = DrawLinksPayload::from_arma(
|
||||||
|
r#"["shape<&","u-d-f",1,2,3,"","Polygon<&",300,-16777216,16777215,2,"dashed<&",true,""]"#
|
||||||
|
.to_string(),
|
||||||
|
)
|
||||||
|
.expect("link shape payload should parse");
|
||||||
|
payload.points = "1,2,3;4,5,6".to_string();
|
||||||
|
|
||||||
|
assert!(payload.closed);
|
||||||
|
assert_eq!(payload.stroke_style, "dashed<&");
|
||||||
|
|
||||||
|
let xml = payload.to_xml(NOW, STALE);
|
||||||
|
assert!(xml.contains("uid=\"shape<&\" type=\"u-d-f\""));
|
||||||
|
assert_eq!(xml.matches("<link point=\"1,2,3\" />").count(), 2);
|
||||||
|
assert_eq!(xml.matches("<link point=\"4,5,6\" />").count(), 1);
|
||||||
|
assert!(xml.contains("<strokeStyle value=\"dashed<&\" />"));
|
||||||
|
assert!(!xml.contains("<__milsym"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn point_parser_drops_invalid_shape_points() {
|
||||||
|
let points = parse_points("1,2,3;missing;bad,2,3;4,bad,6;7,8,bad;9,10,11");
|
||||||
|
assert_eq!(points.len(), 2);
|
||||||
|
assert_eq!(points[0].lat, 1.0);
|
||||||
|
assert_eq!(points[1].lon, 10.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
+89
-52
@@ -1,62 +1,99 @@
|
|||||||
use arma_rs::{FromArma, FromArmaError};
|
|
||||||
use super::cot::CursorOverTime;
|
use super::cot::CursorOverTime;
|
||||||
|
use arma_rs::{FromArma, FromArmaError};
|
||||||
|
|
||||||
pub struct EudCoTPayload {
|
pub struct EudCoTPayload {
|
||||||
pub uuid: String,
|
pub uuid: String,
|
||||||
pub point_lat: f64,
|
pub point_lat: f64,
|
||||||
pub point_lon: f64,
|
pub point_lon: f64,
|
||||||
pub point_hae: f32,
|
pub point_hae: f32,
|
||||||
pub contact_callsign: String,
|
pub contact_callsign: String,
|
||||||
pub group_name: String,
|
pub group_name: String,
|
||||||
pub group_role: String,
|
pub group_role: String,
|
||||||
pub track_course: i32,
|
pub track_course: i32,
|
||||||
pub track_speed: f32,
|
pub track_speed: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromArma for EudCoTPayload {
|
impl FromArma for EudCoTPayload {
|
||||||
fn from_arma(data: String) -> Result<EudCoTPayload, FromArmaError> {
|
fn from_arma(data: String) -> Result<EudCoTPayload, FromArmaError> {
|
||||||
let (
|
let (
|
||||||
uuid,
|
uuid,
|
||||||
point_lat,
|
point_lat,
|
||||||
point_lon,
|
point_lon,
|
||||||
point_hae,
|
point_hae,
|
||||||
contact_callsign,
|
contact_callsign,
|
||||||
group_name,
|
group_name,
|
||||||
group_role,
|
group_role,
|
||||||
track_course,
|
track_course,
|
||||||
track_speed,
|
track_speed,
|
||||||
) = <(String, f64, f64, f32, String, String, String, i32, f32)>::from_arma(data)?;
|
) = <(String, f64, f64, f32, String, String, String, i32, f32)>::from_arma(data)?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
uuid,
|
uuid,
|
||||||
point_lat,
|
point_lat,
|
||||||
point_lon,
|
point_lon,
|
||||||
point_hae,
|
point_hae,
|
||||||
contact_callsign,
|
contact_callsign,
|
||||||
group_name,
|
group_name,
|
||||||
group_role,
|
group_role,
|
||||||
track_course,
|
track_course,
|
||||||
track_speed,
|
track_speed,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EudCoTPayload {
|
impl EudCoTPayload {
|
||||||
pub fn to_cot(&self) -> CursorOverTime {
|
pub fn to_cot(&self) -> CursorOverTime {
|
||||||
CursorOverTime {
|
CursorOverTime {
|
||||||
uuid: Some(self.uuid.clone()),
|
uuid: Some(self.uuid.clone()),
|
||||||
r#type: None,
|
r#type: None,
|
||||||
point_lat: self.point_lat,
|
point_lat: self.point_lat,
|
||||||
point_lon: self.point_lon,
|
point_lon: self.point_lon,
|
||||||
point_hae: self.point_hae,
|
point_hae: self.point_hae,
|
||||||
point_ce: None,
|
point_ce: None,
|
||||||
point_le: None,
|
point_le: None,
|
||||||
contact_callsign: self.contact_callsign.clone(),
|
contact_callsign: self.contact_callsign.clone(),
|
||||||
group_name: Some(self.group_name.clone()),
|
group_name: Some(self.group_name.clone()),
|
||||||
group_role: Some(self.group_role.clone()),
|
group_role: Some(self.group_role.clone()),
|
||||||
track_course: Some(self.track_course),
|
track_course: Some(self.track_course),
|
||||||
track_speed: Some(self.track_speed),
|
track_speed: Some(self.track_speed),
|
||||||
link_uid: None,
|
link_uid: None,
|
||||||
remarker: None,
|
remarker: None,
|
||||||
}
|
video_url: None,
|
||||||
}
|
stale_seconds: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::EudCoTPayload;
|
||||||
|
use arma_rs::FromArma;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_eud_payload_and_maps_all_tactical_fields() {
|
||||||
|
let payload = EudCoTPayload::from_arma(
|
||||||
|
r#"["eud-1",-30.1,-51.2,75.0,"Falcon","Cyan","Team Member",90,4.5]"#
|
||||||
|
.to_string(),
|
||||||
|
)
|
||||||
|
.expect("EUD payload should parse");
|
||||||
|
|
||||||
|
assert_eq!(payload.uuid, "eud-1");
|
||||||
|
assert_eq!(payload.contact_callsign, "Falcon");
|
||||||
|
assert_eq!(payload.group_name, "Cyan");
|
||||||
|
assert_eq!(payload.group_role, "Team Member");
|
||||||
|
|
||||||
|
let cot = payload.to_cot();
|
||||||
|
assert_eq!(cot.uuid.as_deref(), Some("eud-1"));
|
||||||
|
assert_eq!(cot.point_lat, -30.1);
|
||||||
|
assert_eq!(cot.point_lon, -51.2);
|
||||||
|
assert_eq!(cot.point_hae, 75.0);
|
||||||
|
assert_eq!(cot.contact_callsign, "Falcon");
|
||||||
|
assert_eq!(cot.group_name.as_deref(), Some("Cyan"));
|
||||||
|
assert_eq!(cot.group_role.as_deref(), Some("Team Member"));
|
||||||
|
assert_eq!(cot.track_course, Some(90));
|
||||||
|
assert_eq!(cot.track_speed, Some(4.5));
|
||||||
|
assert!(cot.link_uid.is_none());
|
||||||
|
assert!(cot.remarker.is_none());
|
||||||
|
assert!(cot.video_url.is_none());
|
||||||
|
assert!(cot.stale_seconds.is_none());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+83
-41
@@ -1,5 +1,5 @@
|
|||||||
use arma_rs::{FromArma, FromArmaError};
|
|
||||||
use super::cot::CursorOverTime;
|
use super::cot::CursorOverTime;
|
||||||
|
use arma_rs::{FromArma, FromArmaError};
|
||||||
|
|
||||||
pub struct ExternalPositionPayload {
|
pub struct ExternalPositionPayload {
|
||||||
pub uuid: String,
|
pub uuid: String,
|
||||||
@@ -13,47 +13,89 @@ pub struct ExternalPositionPayload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FromArma for ExternalPositionPayload {
|
impl FromArma for ExternalPositionPayload {
|
||||||
fn from_arma(data: String) -> Result<ExternalPositionPayload, FromArmaError> {
|
fn from_arma(data: String) -> Result<ExternalPositionPayload, FromArmaError> {
|
||||||
let (
|
let (
|
||||||
uuid,
|
uuid,
|
||||||
point_lat,
|
point_lat,
|
||||||
point_lon,
|
point_lon,
|
||||||
point_hae,
|
point_hae,
|
||||||
contact_callsign,
|
contact_callsign,
|
||||||
track_course,
|
track_course,
|
||||||
track_speed,
|
track_speed,
|
||||||
remarker,
|
remarker,
|
||||||
) = <(String, f64, f64, f32, String, i32, f32, String)>::from_arma(data)?;
|
) = <(String, f64, f64, f32, String, i32, f32, String)>::from_arma(data)?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
uuid,
|
uuid,
|
||||||
point_lat,
|
point_lat,
|
||||||
point_lon,
|
point_lon,
|
||||||
point_hae,
|
point_hae,
|
||||||
contact_callsign,
|
contact_callsign,
|
||||||
track_course,
|
track_course,
|
||||||
track_speed,
|
track_speed,
|
||||||
remarker,
|
remarker,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ExternalPositionPayload {
|
impl ExternalPositionPayload {
|
||||||
pub fn to_cot(&self) -> CursorOverTime {
|
pub fn to_cot(&self) -> CursorOverTime {
|
||||||
CursorOverTime {
|
CursorOverTime {
|
||||||
uuid: Some(self.uuid.clone()),
|
uuid: Some(self.uuid.clone()),
|
||||||
r#type: None,
|
r#type: None,
|
||||||
point_lat: self.point_lat,
|
point_lat: self.point_lat,
|
||||||
point_lon: self.point_lon,
|
point_lon: self.point_lon,
|
||||||
point_hae: self.point_hae,
|
point_hae: self.point_hae,
|
||||||
point_ce: None,
|
point_ce: None,
|
||||||
point_le: None,
|
point_le: None,
|
||||||
contact_callsign: self.contact_callsign.clone(),
|
contact_callsign: self.contact_callsign.clone(),
|
||||||
group_name: None,
|
group_name: None,
|
||||||
group_role: None,
|
group_role: None,
|
||||||
track_course: Some(self.track_course),
|
track_course: Some(self.track_course),
|
||||||
track_speed: Some(self.track_speed),
|
track_speed: Some(self.track_speed),
|
||||||
link_uid: None,
|
link_uid: None,
|
||||||
remarker: Some(self.remarker.clone()),
|
remarker: Some(self.remarker.clone()),
|
||||||
}
|
video_url: None,
|
||||||
}
|
stale_seconds: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::ExternalPositionPayload;
|
||||||
|
use arma_rs::FromArma;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_external_position_and_maps_it_to_generic_cot() {
|
||||||
|
let payload = ExternalPositionPayload::from_arma(
|
||||||
|
r#"["gps-1",-30.1,-51.2,75.0,"Falcon",270,11.5,"external GPS"]"#
|
||||||
|
.to_string(),
|
||||||
|
)
|
||||||
|
.expect("external position should parse");
|
||||||
|
|
||||||
|
assert_eq!(payload.uuid, "gps-1");
|
||||||
|
assert_eq!(payload.point_lat, -30.1);
|
||||||
|
assert_eq!(payload.point_lon, -51.2);
|
||||||
|
assert_eq!(payload.point_hae, 75.0);
|
||||||
|
assert_eq!(payload.contact_callsign, "Falcon");
|
||||||
|
assert_eq!(payload.track_course, 270);
|
||||||
|
assert_eq!(payload.track_speed, 11.5);
|
||||||
|
assert_eq!(payload.remarker, "external GPS");
|
||||||
|
|
||||||
|
let cot = payload.to_cot();
|
||||||
|
assert_eq!(cot.uuid.as_deref(), Some("gps-1"));
|
||||||
|
assert_eq!(cot.r#type, None);
|
||||||
|
assert_eq!(cot.point_lat, -30.1);
|
||||||
|
assert_eq!(cot.point_lon, -51.2);
|
||||||
|
assert_eq!(cot.point_hae, 75.0);
|
||||||
|
assert_eq!(cot.contact_callsign, "Falcon");
|
||||||
|
assert_eq!(cot.track_course, Some(270));
|
||||||
|
assert_eq!(cot.track_speed, Some(11.5));
|
||||||
|
assert_eq!(cot.remarker.as_deref(), Some("external GPS"));
|
||||||
|
assert!(cot.group_name.is_none());
|
||||||
|
assert!(cot.group_role.is_none());
|
||||||
|
assert!(cot.link_uid.is_none());
|
||||||
|
assert!(cot.video_url.is_none());
|
||||||
|
assert!(cot.stale_seconds.is_none());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+104
@@ -0,0 +1,104 @@
|
|||||||
|
use arma_rs::{FromArma, FromArmaError};
|
||||||
|
use chrono::{SecondsFormat, Utc};
|
||||||
|
|
||||||
|
pub struct LaserRangeFinderPayload {
|
||||||
|
pub uid: String,
|
||||||
|
pub distance_meters: f64,
|
||||||
|
pub azimuth_degrees: f64,
|
||||||
|
pub elevation_degrees: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromArma for LaserRangeFinderPayload {
|
||||||
|
fn from_arma(data: String) -> Result<LaserRangeFinderPayload, FromArmaError> {
|
||||||
|
let (uid, distance_meters, azimuth_degrees, elevation_degrees) =
|
||||||
|
<(String, f64, f64, f64)>::from_arma(data)?;
|
||||||
|
Ok(Self {
|
||||||
|
uid,
|
||||||
|
distance_meters,
|
||||||
|
azimuth_degrees,
|
||||||
|
elevation_degrees,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LaserRangeFinderPayload {
|
||||||
|
pub fn to_lrf_message(&self) -> String {
|
||||||
|
let timestamp = Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true);
|
||||||
|
|
||||||
|
format!(
|
||||||
|
"1,{},{},{:.2},{:.2},{:.2}",
|
||||||
|
self.uid,
|
||||||
|
timestamp,
|
||||||
|
self.distance_meters.max(0.0),
|
||||||
|
normalize_degrees(self.azimuth_degrees),
|
||||||
|
self.elevation_degrees
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct LaserRangeFinderClearPayload {
|
||||||
|
pub uid: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromArma for LaserRangeFinderClearPayload {
|
||||||
|
fn from_arma(data: String) -> Result<LaserRangeFinderClearPayload, FromArmaError> {
|
||||||
|
let uid = String::from_arma(data)?;
|
||||||
|
Ok(Self { uid })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LaserRangeFinderClearPayload {
|
||||||
|
pub fn to_lrf_message(&self) -> String {
|
||||||
|
let timestamp = Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true);
|
||||||
|
format!("1,{},{},RANGE_ERROR", self.uid, timestamp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn normalize_degrees(degrees: f64) -> f64 {
|
||||||
|
degrees.rem_euclid(360.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::{LaserRangeFinderClearPayload, LaserRangeFinderPayload};
|
||||||
|
use arma_rs::FromArma;
|
||||||
|
use chrono::DateTime;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_lrf_payload_and_serializes_normalized_message() {
|
||||||
|
let payload = LaserRangeFinderPayload::from_arma(
|
||||||
|
r#"["laser-1",-5,-10,2.5]"#.to_string(),
|
||||||
|
)
|
||||||
|
.expect("LRF payload should parse");
|
||||||
|
|
||||||
|
assert_eq!(payload.uid, "laser-1");
|
||||||
|
assert_eq!(payload.distance_meters, -5.0);
|
||||||
|
assert_eq!(payload.azimuth_degrees, -10.0);
|
||||||
|
assert_eq!(payload.elevation_degrees, 2.5);
|
||||||
|
|
||||||
|
let message = payload.to_lrf_message();
|
||||||
|
let fields: Vec<_> = message.split(',').collect();
|
||||||
|
assert_eq!(fields.len(), 6);
|
||||||
|
assert_eq!(fields[0], "1");
|
||||||
|
assert_eq!(fields[1], "laser-1");
|
||||||
|
assert!(DateTime::parse_from_rfc3339(fields[2]).is_ok());
|
||||||
|
assert_eq!(fields[3], "0.00");
|
||||||
|
assert_eq!(fields[4], "350.00");
|
||||||
|
assert_eq!(fields[5], "2.50");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_clear_payload_and_serializes_range_error() {
|
||||||
|
let payload = LaserRangeFinderClearPayload::from_arma(r#""laser-2""#.to_string())
|
||||||
|
.expect("clear LRF payload should parse");
|
||||||
|
assert_eq!(payload.uid, "laser-2");
|
||||||
|
|
||||||
|
let message = payload.to_lrf_message();
|
||||||
|
let fields: Vec<_> = message.split(',').collect();
|
||||||
|
assert_eq!(fields.len(), 4);
|
||||||
|
assert_eq!(fields[0], "1");
|
||||||
|
assert_eq!(fields[1], "laser-2");
|
||||||
|
assert!(DateTime::parse_from_rfc3339(fields[2]).is_ok());
|
||||||
|
assert_eq!(fields[3], "RANGE_ERROR");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
use arma_rs::{FromArma, FromArmaError};
|
||||||
|
use chrono::{Duration, SecondsFormat, Utc};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
pub struct MessagePayload {
|
||||||
|
pub sender_callsign: String,
|
||||||
|
pub chatroom: String,
|
||||||
|
pub message_text: String,
|
||||||
|
pub point_lat: f64,
|
||||||
|
pub point_lon: f64,
|
||||||
|
pub point_hae: f32,
|
||||||
|
pub sender_uid: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromArma for MessagePayload {
|
||||||
|
fn from_arma(data: String) -> Result<Self, FromArmaError> {
|
||||||
|
let (sender_callsign, chatroom, message_text, point_lat, point_lon, point_hae, sender_uid) =
|
||||||
|
<(String, String, String, f64, f64, f32, String)>::from_arma(data)?;
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
|
sender_callsign,
|
||||||
|
chatroom,
|
||||||
|
message_text,
|
||||||
|
point_lat,
|
||||||
|
point_lon,
|
||||||
|
point_hae,
|
||||||
|
sender_uid,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct MessageCot {
|
||||||
|
pub sender_callsign: String,
|
||||||
|
pub chatroom: String,
|
||||||
|
pub message_text: String,
|
||||||
|
pub point_lat: f64,
|
||||||
|
pub point_lon: f64,
|
||||||
|
pub point_hae: f32,
|
||||||
|
pub sender_uid: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MessageCot {
|
||||||
|
pub fn from_payload(p: MessagePayload) -> Self {
|
||||||
|
Self {
|
||||||
|
sender_callsign: p.sender_callsign,
|
||||||
|
chatroom: p.chatroom,
|
||||||
|
message_text: p.message_text,
|
||||||
|
point_lat: p.point_lat,
|
||||||
|
point_lon: p.point_lon,
|
||||||
|
point_hae: p.point_hae,
|
||||||
|
sender_uid: p.sender_uid,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn to_xml(&self) -> String {
|
||||||
|
let created_time = Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true);
|
||||||
|
let stale_time =
|
||||||
|
(Utc::now() + Duration::days(1)).to_rfc3339_opts(SecondsFormat::Millis, true);
|
||||||
|
|
||||||
|
// MESSAGE ID (random UUID)
|
||||||
|
let message_uuid = Uuid::new_v4().to_string();
|
||||||
|
|
||||||
|
// FULL EVENT UID
|
||||||
|
// format: GeoChat.{sender}.{chatroom}.{uuid}
|
||||||
|
let event_uid = format!(
|
||||||
|
"GeoChat.{}.{}.{}",
|
||||||
|
self.sender_uid,
|
||||||
|
self.chatroom.replace(" ", "_"),
|
||||||
|
message_uuid,
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut xml = String::new();
|
||||||
|
|
||||||
|
xml.push_str("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||||
|
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<event version=\"2.0\" uid=\"{}\" type=\"b-t-f\" time=\"{}\" start=\"{}\" stale=\"{}\" how=\"h-g-i-g-o\" access=\"Undefined\">",
|
||||||
|
event_uid, created_time, created_time, stale_time
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<point lat=\"{}\" lon=\"{}\" hae=\"{}\" ce=\"10.3\" le=\"9999999.0\"/>",
|
||||||
|
self.point_lat, self.point_lon, self.point_hae
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
xml.push_str("<detail>");
|
||||||
|
|
||||||
|
// ========== CHAT OBJECT ==========
|
||||||
|
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<__chat parent=\"RootContactGroup\" groupOwner=\"false\" \
|
||||||
|
messageId=\"{}\" chatroom=\"{}\" id=\"{}\" senderCallsign=\"{}\">",
|
||||||
|
message_uuid, self.chatroom, self.chatroom, self.sender_callsign,
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<chatgrp uid0=\"{}\" uid1=\"{}\" id=\"{}\" />",
|
||||||
|
self.sender_uid, self.chatroom, self.chatroom
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
xml.push_str("</__chat>");
|
||||||
|
|
||||||
|
// ========== LINK ELEMENT ==========
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<link uid=\"{}\" type=\"a-f-G-U-C\" relation=\"p-p\" />",
|
||||||
|
self.sender_uid
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// ========== SERVER DEST ==========
|
||||||
|
// This is optional — you may remove or customize it
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<__serverdestination destinations=\"0.0.0.0:0:tcp:{}\" />",
|
||||||
|
self.sender_uid
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// ========== MESSAGE REMARKS ==========
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<remarks source=\"ARMATAK.{}\" to=\"{}\" time=\"{}\">{}</remarks>",
|
||||||
|
self.sender_uid, self.chatroom, created_time, self.message_text
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
xml.push_str("</detail></event>");
|
||||||
|
|
||||||
|
xml
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::{MessageCot, MessagePayload};
|
||||||
|
use arma_rs::FromArma;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_chat_payload_and_serializes_geochat_event() {
|
||||||
|
let payload = MessagePayload::from_arma(
|
||||||
|
r#"["Falcon","Operations Room","Message received",-30.1,-51.2,15.0,"sender-1"]"#
|
||||||
|
.to_string(),
|
||||||
|
)
|
||||||
|
.expect("chat payload should parse");
|
||||||
|
|
||||||
|
assert_eq!(payload.sender_callsign, "Falcon");
|
||||||
|
assert_eq!(payload.chatroom, "Operations Room");
|
||||||
|
assert_eq!(payload.message_text, "Message received");
|
||||||
|
assert_eq!(payload.sender_uid, "sender-1");
|
||||||
|
|
||||||
|
let cot = MessageCot::from_payload(payload);
|
||||||
|
let xml = cot.to_xml();
|
||||||
|
|
||||||
|
assert!(xml.starts_with("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||||
|
assert!(xml.contains("type=\"b-t-f\""));
|
||||||
|
assert!(xml.contains("uid=\"GeoChat.sender-1.Operations_Room."));
|
||||||
|
assert!(xml.contains("lat=\"-30.1\" lon=\"-51.2\" hae=\"15\""));
|
||||||
|
assert!(xml.contains("chatroom=\"Operations Room\""));
|
||||||
|
assert!(xml.contains("senderCallsign=\"Falcon\""));
|
||||||
|
assert!(xml.contains("<chatgrp uid0=\"sender-1\" uid1=\"Operations Room\" id=\"Operations Room\" />"));
|
||||||
|
assert!(xml.contains("<link uid=\"sender-1\" type=\"a-f-G-U-C\" relation=\"p-p\" />"));
|
||||||
|
assert!(xml.contains("<__serverdestination destinations=\"0.0.0.0:0:tcp:sender-1\" />"));
|
||||||
|
assert!(xml.contains("<remarks source=\"ARMATAK.sender-1\" to=\"Operations Room\""));
|
||||||
|
assert!(xml.contains(">Message received</remarks>"));
|
||||||
|
assert!(xml.ends_with("</detail></event>"));
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
-1
@@ -1,5 +1,12 @@
|
|||||||
pub mod cot;
|
pub mod cot;
|
||||||
|
pub mod delete;
|
||||||
pub mod digital_pointer;
|
pub mod digital_pointer;
|
||||||
|
pub mod draws;
|
||||||
pub mod eud;
|
pub mod eud;
|
||||||
pub mod gps;
|
pub mod gps;
|
||||||
pub mod nato;
|
pub mod lrf;
|
||||||
|
pub mod message;
|
||||||
|
pub mod nato;
|
||||||
|
pub mod report_marker;
|
||||||
|
pub mod uas;
|
||||||
|
pub mod video;
|
||||||
|
|||||||
@@ -11,10 +11,40 @@ pub struct MarkerCoTPayload {
|
|||||||
pub contact_callsign: String,
|
pub contact_callsign: String,
|
||||||
pub track_course: i32,
|
pub track_course: i32,
|
||||||
pub track_speed: f32,
|
pub track_speed: f32,
|
||||||
|
pub video_url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromArma for MarkerCoTPayload {
|
impl FromArma for MarkerCoTPayload {
|
||||||
fn from_arma(data: String) -> Result<MarkerCoTPayload, FromArmaError> {
|
fn from_arma(data: String) -> Result<MarkerCoTPayload, FromArmaError> {
|
||||||
|
if let Ok((
|
||||||
|
uuid,
|
||||||
|
r#type,
|
||||||
|
point_lat,
|
||||||
|
point_lon,
|
||||||
|
point_hae,
|
||||||
|
contact_callsign,
|
||||||
|
track_course,
|
||||||
|
track_speed,
|
||||||
|
video_url,
|
||||||
|
)) = <(String, String, f64, f64, f32, String, i32, f32, String)>::from_arma(data.clone())
|
||||||
|
{
|
||||||
|
return Ok(Self {
|
||||||
|
uuid,
|
||||||
|
r#type,
|
||||||
|
point_lat,
|
||||||
|
point_lon,
|
||||||
|
point_hae,
|
||||||
|
contact_callsign,
|
||||||
|
track_course,
|
||||||
|
track_speed,
|
||||||
|
video_url: if video_url.trim().is_empty() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(video_url)
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let (
|
let (
|
||||||
uuid,
|
uuid,
|
||||||
r#type,
|
r#type,
|
||||||
@@ -34,6 +64,7 @@ impl FromArma for MarkerCoTPayload {
|
|||||||
contact_callsign,
|
contact_callsign,
|
||||||
track_course,
|
track_course,
|
||||||
track_speed,
|
track_speed,
|
||||||
|
video_url: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,6 +86,65 @@ impl MarkerCoTPayload {
|
|||||||
track_speed: Some(self.track_speed),
|
track_speed: Some(self.track_speed),
|
||||||
link_uid: None,
|
link_uid: None,
|
||||||
remarker: None,
|
remarker: None,
|
||||||
|
video_url: self.video_url.clone(),
|
||||||
|
stale_seconds: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::MarkerCoTPayload;
|
||||||
|
use arma_rs::FromArma;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_marker_with_video_and_maps_it_to_cot() {
|
||||||
|
let payload = MarkerCoTPayload::from_arma(
|
||||||
|
r#"["marker-1","a-f-G-U-C",-30.1,-51.2,100.0,"Falcon",180,10.5,"rtsp://video.example.test:8554/live"]"#
|
||||||
|
.to_string(),
|
||||||
|
)
|
||||||
|
.expect("marker with video should parse");
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
payload.video_url.as_deref(),
|
||||||
|
Some("rtsp://video.example.test:8554/live")
|
||||||
|
);
|
||||||
|
|
||||||
|
let cot = payload.to_cot();
|
||||||
|
assert_eq!(cot.uuid.as_deref(), Some("marker-1"));
|
||||||
|
assert_eq!(cot.r#type.as_deref(), Some("a-f-G-U-C"));
|
||||||
|
assert_eq!(cot.point_lat, -30.1);
|
||||||
|
assert_eq!(cot.point_lon, -51.2);
|
||||||
|
assert_eq!(cot.point_hae, 100.0);
|
||||||
|
assert_eq!(cot.contact_callsign, "Falcon");
|
||||||
|
assert_eq!(cot.track_course, Some(180));
|
||||||
|
assert_eq!(cot.track_speed, Some(10.5));
|
||||||
|
assert_eq!(
|
||||||
|
cot.video_url.as_deref(),
|
||||||
|
Some("rtsp://video.example.test:8554/live")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn treats_blank_video_url_as_absent() {
|
||||||
|
let payload = MarkerCoTPayload::from_arma(
|
||||||
|
r#"["marker-2","a-f-G-U-C",1,2,3,"Raven",90,5," "]"#.to_string(),
|
||||||
|
)
|
||||||
|
.expect("marker with blank video should parse");
|
||||||
|
|
||||||
|
assert!(payload.video_url.is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn accepts_legacy_marker_payload_without_video_field() {
|
||||||
|
let payload = MarkerCoTPayload::from_arma(
|
||||||
|
r#"["marker-3","a-f-G-U-C",1,2,3,"Viper",45,2.5]"#.to_string(),
|
||||||
|
)
|
||||||
|
.expect("legacy marker should parse");
|
||||||
|
|
||||||
|
assert_eq!(payload.uuid, "marker-3");
|
||||||
|
assert_eq!(payload.r#type, "a-f-G-U-C");
|
||||||
|
assert_eq!(payload.contact_callsign, "Viper");
|
||||||
|
assert!(payload.video_url.is_none());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user