Added support for GETP and GETC to MATLAB client.
This commit is contained in:
Binary file not shown.
29
MATLAB/+XPlaneConnect/getCTRL.m
Normal file
29
MATLAB/+XPlaneConnect/getCTRL.m
Normal file
@@ -0,0 +1,29 @@
|
||||
function ctrl = getCTRL(ac, socket)
|
||||
% getCTRL Gets control surface information for the specified aircraft
|
||||
%
|
||||
% Inputs
|
||||
% ac: The aircraft number to get control surface data for.
|
||||
% Outputs
|
||||
% posi: An array of values matching the the format used by sendCTRL
|
||||
|
||||
|
||||
import XPlaneConnect.*
|
||||
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(isequal(length(clients) < 2, 1), '[getCTRL] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
end
|
||||
|
||||
%% Validate input
|
||||
ac = int32(ac);
|
||||
|
||||
%% Send command
|
||||
ctrl = socket.getCTRL(ac);
|
||||
|
||||
end
|
||||
29
MATLAB/+XPlaneConnect/getPOSI.m
Normal file
29
MATLAB/+XPlaneConnect/getPOSI.m
Normal file
@@ -0,0 +1,29 @@
|
||||
function posi = getPOSI(ac, socket)
|
||||
% getPOSI Gets position information for the specified aircraft
|
||||
%
|
||||
% Inputs
|
||||
% ac: The aircraft number to get position data for.
|
||||
% Outputs
|
||||
% posi: An array of values matching the the format used by sendPOSI
|
||||
|
||||
|
||||
import XPlaneConnect.*
|
||||
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(isequal(length(clients) < 2, 1), '[getPOSI] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
end
|
||||
|
||||
%% Validate input
|
||||
ac = int32(ac);
|
||||
|
||||
%% Send command
|
||||
posi = socket.getPOSI(ac);
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user