mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 16:03:31 +00:00
refactored armatak core module to initiate the TCP Client with the provided address
This commit is contained in:
@@ -27,7 +27,7 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
class armatak_module_core: Module_F {
|
class armatak_module_core: Module_F {
|
||||||
scope = 2;
|
scope = 2;
|
||||||
displayname = "ARMATAK Core";
|
displayname = "ARMATAK CoT Router";
|
||||||
icon = "\a3\Modules_F_Curator\Data\iconRadio_ca.paa";
|
icon = "\a3\Modules_F_Curator\Data\iconRadio_ca.paa";
|
||||||
category = "armatak_module_category";
|
category = "armatak_module_category";
|
||||||
function = "armatak_fnc_init";
|
function = "armatak_fnc_init";
|
||||||
@@ -52,63 +52,25 @@ class CfgVehicles {
|
|||||||
class Units: Units {
|
class Units: Units {
|
||||||
property = "armatak_module_attached_units";
|
property = "armatak_module_attached_units";
|
||||||
};
|
};
|
||||||
class armatak_module_api_instance: Combo {
|
class armatak_module_tak_server_instance_address: Edit {
|
||||||
property = "armatak_module_api_instance";
|
property = "armatak_module_tak_server_instance_address";
|
||||||
displayname = "TAK API Instance";
|
displayname = "TAK Server Address";
|
||||||
tooltip = "Used TAK Server Instance";
|
tooltip = "TAK Server Instance Address";
|
||||||
typeName = "STRING";
|
|
||||||
defaultValue = "ots";
|
|
||||||
|
|
||||||
class Values {
|
|
||||||
class ots { name = "Open TAK Server"; value = "ots"; default = 1; };
|
|
||||||
class fts { name = "Free TAK Server"; value = "fts"; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
class armatak_module_api_instance_protocol: Combo {
|
|
||||||
property = "armatak_module_api_instance_protocol";
|
|
||||||
displayname = "OTS Protocol";
|
|
||||||
tooltip = "OpenTAKServer instance protocol";
|
|
||||||
typeName = "STRING";
|
|
||||||
defaultValue = "http";
|
|
||||||
|
|
||||||
class Values {
|
|
||||||
class http { name = "HTTP"; value = "http"; default = 1; };
|
|
||||||
class https { name = "HTTPS"; value = "https"; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
class armatak_module_api_instance_address: Edit {
|
|
||||||
property = "armatak_module_api_instance_address";
|
|
||||||
displayname = "OTS Address";
|
|
||||||
tooltip = "OpenTAKServer Instance Address";
|
|
||||||
typeName = "STRING";
|
typeName = "STRING";
|
||||||
defaultValue = "localhost";
|
defaultValue = "localhost";
|
||||||
};
|
};
|
||||||
class armatak_module_api_instance_port: Edit {
|
class armatak_module_tak_server_instance_port: Edit {
|
||||||
property = "armatak_module_api_instance_port";
|
property = "armatak_module_tak_server_instance_port";
|
||||||
displayname = "OTS Port";
|
displayname = "TAK Server TCP Port";
|
||||||
tooltip = "OpenTAKServer Instance Port";
|
tooltip = "TAK Server instance Port for TCP connection";
|
||||||
typeName = "NUMBER";
|
typeName = "NUMBER";
|
||||||
defaultValue = "8080";
|
defaultValue = "8080";
|
||||||
};
|
};
|
||||||
class armatak_module_api_instance_username: Edit {
|
|
||||||
property = "armatak_module_api_instance_username";
|
|
||||||
displayname = "API Username";
|
|
||||||
tooltip = "API Username for authorization";
|
|
||||||
typeName = "STRING";
|
|
||||||
defaultValue = "administrator";
|
|
||||||
};
|
|
||||||
class armatak_module_api_instance_password: Edit {
|
|
||||||
property = "armatak_module_api_instance_password";
|
|
||||||
displayname = "API Password";
|
|
||||||
tooltip = "API Password for authorization";
|
|
||||||
typeName = "STRING";
|
|
||||||
defaultValue = "password";
|
|
||||||
};
|
|
||||||
class ModuleDescription: ModuleDescription {};
|
class ModuleDescription: ModuleDescription {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModuleDescription: ModuleDescription {
|
class ModuleDescription: ModuleDescription {
|
||||||
description = "Generate the initial ARMATAK configuration, syncronizing all players to the OTS instance";
|
description = "Generate the initial ARMATAK configuration, syncronizing all players to the TAK server instance";
|
||||||
sync[] = {"LocationArea_F"};
|
sync[] = {"LocationArea_F"};
|
||||||
|
|
||||||
class LocationArea_F {
|
class LocationArea_F {
|
||||||
|
|||||||
@@ -5,56 +5,39 @@ params [
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (isServer) exitWith {
|
if (isServer) exitWith {
|
||||||
_warning = format ["<t color='#FF8021'>ARMATAK</t><br/> %1", "Connecting to API Provider..."];
|
_warning = format ["<t color='#FF8021'>ARMATAK</t><br/> %1", "Connecting to TAK Server TCP Socket..."];
|
||||||
[[_warning, 1.5]] call CBA_fnc_notify;
|
[[_warning, 1.5]] call CBA_fnc_notify;
|
||||||
|
|
||||||
_atak_instance = _logic getVariable "armatak_module_api_instance";
|
_tak_server_instance_address = _logic getVariable "armatak_module_tak_server_instance_address";
|
||||||
_atak_instance_protocol = _logic getVariable "armatak_module_api_instance_protocol";
|
_tak_server_instance_port = _logic getVariable "armatak_module_tak_server_instance_port";
|
||||||
_atak_instance_address = _logic getVariable "armatak_module_api_instance_address";
|
|
||||||
_atak_instance_port = _logic getVariable "armatak_module_api_instance_port";
|
|
||||||
|
|
||||||
_atak_fulladdress = _atak_instance_protocol + ":" + "/" + "/" + _atak_instance_address + ":" + (str _atak_instance_port);
|
_tak_server_fulladdress = _tak_server_instance_address + ":" + (str _tak_server_instance_port);
|
||||||
_atak_api_username = _logic getVariable "armatak_module_api_instance_username";
|
|
||||||
_atak_api_password = _logic getVariable "armatak_module_api_instance_password";
|
|
||||||
|
|
||||||
if (_atak_instance == "ots") then {
|
missionNamespace setVariable ["_atak_server_instance", _tak_server_fulladdress];
|
||||||
missionNamespace setVariable ["_atak_server_instance", _atak_fulladdress];
|
missionNamespace setVariable ["_group_colors", ["White", "Yellow", "Orange", "Magenta", "Red", "Maroon", "Purple", "DarkBlue", "Blue", "Cyan", "Teal", "Green", "DarkGreen", "Brown"]];
|
||||||
missionNamespace setVariable ["_atak_server_instance_username", _atak_api_username];
|
|
||||||
missionNamespace setVariable ["_atak_server_instance_password", _atak_api_password];
|
|
||||||
|
|
||||||
_atak_server_instance_token = call armatak_fnc_ots_extract_auth_token;
|
"armatak" callExtension ["cot_router:start", [_tak_server_fulladdress]];
|
||||||
|
|
||||||
if ((_atak_server_instance_token == "") and !(["ERROR", _atak_server_instance_token, false] call BIS_fnc_inString)) then {
|
|
||||||
private _warning = format ["<t color='#FF0000'>ARMATAK</t><br/> %1", "Connection Failed"];
|
|
||||||
[[_warning, 2]] call CBA_fnc_notify;
|
|
||||||
} else {
|
|
||||||
private _warning = format ["<t color='#2B7319'>ARMATAK</t><br/> %1", "Connected"];
|
|
||||||
[[_warning, 2]] call CBA_fnc_notify;
|
|
||||||
};
|
|
||||||
|
|
||||||
_syncUnits = synchronizedObjects _logic;
|
|
||||||
|
|
||||||
missionNamespace setVariable ["_armatak_marked_units", _syncUnits];
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
[{
|
||||||
[{
|
[{
|
||||||
[{
|
_syncedUnits = missionNamespace getVariable "_armatak_marked_units";
|
||||||
_syncedUnits = missionNamespace getVariable "_armatak_marked_units";
|
_markers = [];
|
||||||
_markers = [];
|
|
||||||
|
|
||||||
{
|
{
|
||||||
if (unitIsUAV _x) then {
|
if (unitIsUAV _x) then {
|
||||||
_marker = _x call armatak_fnc_extract_drone_info;
|
_marker = _x call armatak_fnc_extract_drone_info;
|
||||||
_markers append [_marker];
|
_markers append [_marker];
|
||||||
} else {
|
} else {
|
||||||
_marker = _x call armatak_fnc_extract_info;
|
_marker = _x call armatak_fnc_extract_info;
|
||||||
_markers append [_marker];
|
_markers append [_marker];
|
||||||
};
|
};
|
||||||
} forEach _syncedUnits;
|
} forEach _syncedUnits;
|
||||||
|
|
||||||
_request = "armatak" callExtension ["ots_api:post", [_markers]];
|
_request = "armatak" callExtension ["ots_api:post", [_markers]];
|
||||||
}, 1, []] call CBA_fnc_addPerFrameHandler;
|
}, 1, []] call CBA_fnc_addPerFrameHandler;
|
||||||
}, [], 1] call CBA_fnc_waitAndExecute;
|
}, [], 1] call CBA_fnc_waitAndExecute;
|
||||||
};
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
true;
|
true;
|
||||||
|
|||||||
Reference in New Issue
Block a user