diff --git a/addons/client/dialog.hpp b/addons/client/dialog.hpp index a31840b..773cbd9 100644 --- a/addons/client/dialog.hpp +++ b/addons/client/dialog.hpp @@ -10,44 +10,61 @@ class armatak_udp_socket_start_dialog { class armatak_gui_module_udp_socket_dialog_main_frame: RscBackground { idc = 16960; x = "0.386562 * safezoneW + safezoneX"; - y = "0.401 * safezoneH + safezoneY"; + y = "0.357 * safezoneH + safezoneY"; w = "0.216563 * safezoneW"; - h = "0.242 * safezoneH"; + h = "0.319 * safezoneH"; colorBackground[]={0,0,0,0.45}; }; }; class Controls { class armatak_gui_module_udp_socket_dialog_address_edit: RscEdit { idc = 16961; - text = "168.15.0.3"; + text = "192.168.15.121"; x = "0.391719 * safezoneW + safezoneX"; - y = "0.445 * safezoneH + safezoneY"; + y = "0.401 * safezoneH + safezoneY"; w = "0.20625 * safezoneW"; h = "0.044 * safezoneH"; 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; text = "4349"; x = "0.391719 * safezoneW + safezoneX"; - y = "0.522 * safezoneH + safezoneY"; + y = "0.478 * safezoneH + safezoneY"; + w = "0.20625 * safezoneW"; + h = "0.044 * safezoneH"; + 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_address_text: RscText { idc = 16963; - text = "Phone's Socket Local Address"; + text = "EUD's Address"; x = "0.391719 * safezoneW + safezoneX"; - y = "0.412 * safezoneH + safezoneY"; + y = "0.368 * safezoneH + safezoneY"; w = "0.20625 * safezoneW"; 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; - text = "Phone's Socket Local Port"; + text = "Network GNSS Port"; 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"; }; @@ -56,7 +73,7 @@ class armatak_udp_socket_start_dialog { text = "Cancel"; action = "closeDialog 2;"; x = "0.551563 * safezoneW + safezoneX"; - y = "0.577 * safezoneH + safezoneY"; + y = "0.632 * safezoneH + safezoneY"; w = "0.0464063 * safezoneW"; h = "0.055 * safezoneH"; }; @@ -65,7 +82,7 @@ class armatak_udp_socket_start_dialog { text = "Ok"; action = QUOTE(call FUNC(startUDPSocket)); x = "0.5 * safezoneW + safezoneX"; - y = "0.577 * safezoneH + safezoneY"; + y = "0.632 * safezoneH + safezoneY"; w = "0.0464063 * safezoneW"; h = "0.055 * safezoneH"; }; diff --git a/addons/client/functions/fnc_startUDPSocket.sqf b/addons/client/functions/fnc_startUDPSocket.sqf index 20bf9de..3381eac 100644 --- a/addons/client/functions/fnc_startUDPSocket.sqf +++ b/addons/client/functions/fnc_startUDPSocket.sqf @@ -2,7 +2,7 @@ params ["_logic"]; -_socket_is_running = player getVariable [QGVAR(eudConnected), false]; +private _socket_is_running = player getVariable [QGVAR(eudConnected), false]; if (_socket_is_running) exitWith { ["Socket is already running", "error", "UDP Socket"] call EFUNC(main,notify); @@ -11,20 +11,29 @@ if (_socket_is_running) exitWith { disableSerialization; -_udp_socket_instance_address = ctrlText 16961; -_udp_socket_instance_port = ctrlText 16962; +private _eud_address = ctrlText 16961; +private _gnss_port = ctrlText 16962; +private _mavlink_port = ctrlText 16967; -_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; player setVariable [QGVAR(udp_socket_address), _udp_socket_fulladdress]; +player setVariable [QGVAR(mavlink_address), _mavlink_address]; player setVariable [QGVAR(eudConnected), true]; "armatak" callExtension ["udp_socket:start", [_udp_socket_fulladdress]]; +private _mdnsInstanceName = format ["ArmaTAK-%1", name player]; +"armatak" callExtension ["mdns:start_uas_advertisement", [_mdnsInstanceName, parseNumber _mavlink_port, "rtp://0.0.0.0:5600"]]; +"armatak" callExtension ["log", [["info", format ["Client UDP socket started for %1 and MAVLink target set to %2", _udp_socket_fulladdress, _mavlink_address]]]]; + +call EFUNC(uav,startMavlinkBroadcast); + [{ - if (player getVariable [QGVAR(eudConnected), false]) then { - "armatak" callExtension ["udp_socket:send_gps_cot", [player call FUNC(extractClientPosition)]]; - }; + if !(player getVariable [QGVAR(eudConnected), false]) exitWith {}; + + "armatak" callExtension ["udp_socket:send_gps_cot", [player call FUNC(extractClientPosition)]]; }, 0.5, []] call CBA_fnc_addPerFrameHandler; deleteVehicle _logic;