Fixed errors in MATLAB client and updated tests.
This commit is contained in:
Binary file not shown.
@@ -24,14 +24,15 @@ import XPlaneConnect.*
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(istrue(length(clients) < 2), '[getDREFs] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
assert(isequal(length(clients) < 2, 1), '[getDREFs] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
openUDP();
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
socket = clients(1);
|
||||
end
|
||||
|
||||
%% Send command
|
||||
result = socket.getDREF(drefs);
|
||||
result = socket.getDREFs(drefs);
|
||||
|
||||
end
|
||||
@@ -29,7 +29,8 @@ addOptional(p,'port',0,@isnumeric);
|
||||
parse(p,varargin{:});
|
||||
|
||||
%% Create client
|
||||
javaaddpath('XPlaneConnect.jar');
|
||||
[folder, ~, ~] = fileparts(which('XPlaneConnect.openUDP'));
|
||||
javaaddpath([folder, '\XPlaneConnect.jar']);
|
||||
import gov.nasa.xpc.*;
|
||||
socket = XPlaneConnect(p.Results.xpHost, p.Results.xpPort, p.Results.port);
|
||||
|
||||
|
||||
@@ -20,11 +20,12 @@ import XPlaneConnect.*
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(istrue(length(clients) < 2), '[pauseSim] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
assert(isequal(length(clients) < 2, 1), '[pauseSim] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
openUDP();
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
socket = clients(1);
|
||||
end
|
||||
|
||||
%% Validate input
|
||||
|
||||
@@ -37,11 +37,12 @@ import XPlaneConnect.*
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(istrue(length(clients) < 2), '[sendDATA] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
assert(istrue(length(clients) < 2), '[readDATA] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
openUDP();
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
socket = clients(1);
|
||||
end
|
||||
|
||||
%% Get data
|
||||
|
||||
@@ -19,11 +19,12 @@ import XPlaneConnect.*
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(istrue(length(clients) < 2), '[sendDATA] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
assert(istrue(length(clients) < 2), '[selectDATA] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
openUDP();
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
socket = clients(1);
|
||||
end
|
||||
|
||||
%% Validate input
|
||||
|
||||
@@ -32,11 +32,12 @@ import XPlaneConnect.*
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(istrue(length(clients) < 2), '[sendCTRL] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
assert(isequal(length(clients) < 2, 1), '[sendCTRL] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
openUDP();
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
socket = clients(1);
|
||||
end
|
||||
|
||||
%% Validate input
|
||||
|
||||
@@ -28,11 +28,12 @@ import XPlaneConnect.*
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(istrue(length(clients) < 2), '[sendDATA] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
assert(isequal(length(clients) < 2, 1), '[sendDATA] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
openUDP();
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
socket = clients(1);
|
||||
end
|
||||
|
||||
%% Validate input
|
||||
|
||||
@@ -31,11 +31,12 @@ import XPlaneConnect.*
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(istrue(length(clients) < 2), '[pauseSim] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
assert(isequal(length(clients) < 2, 1), '[sendPOSI] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
openUDP();
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
socket = clients(1);
|
||||
end
|
||||
|
||||
%% Validate input
|
||||
@@ -46,6 +47,6 @@ end
|
||||
ac = logical(ac);
|
||||
|
||||
%% Send command
|
||||
socket.sendCTRL(ctrl, ac);
|
||||
socket.sendPOSI(posi, ac);
|
||||
|
||||
end
|
||||
@@ -24,11 +24,12 @@ import XPlaneConnect.*
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(istrue(length(clients) < 2), '[sendCTRL] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
assert(isequal(length(clients) < 2, 1), '[sendTEXT] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
openUDP();
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
socket = clients(1);
|
||||
end
|
||||
|
||||
%% Validate input
|
||||
|
||||
@@ -25,19 +25,31 @@ import XPlaneConnect.*
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(istrue(length(clients) < 2), '[sendCTRL] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
assert(isequal(length(clients) < 2, 1), '[sendWYPT] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
openUDP();
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
socket = clients(1);
|
||||
end
|
||||
|
||||
%% Get WaypointOp class
|
||||
[folder, ~, ~] = fileparts(which('XPlaneConnect.openUDP'));
|
||||
javaaddpath([folder, '\XPlaneConnect.jar']);
|
||||
import gov.nasa.xpc.*;
|
||||
|
||||
%% Validate input
|
||||
len = uint32(length(points));
|
||||
assert(op > 0 && op < 4);
|
||||
wyptOp = WaypointOp.Add;
|
||||
if isequal(op, 2)
|
||||
wyptOp = WaypointOp.Del;
|
||||
elseif isequal(op, 3)
|
||||
wyptOp = WaypointOp.Clr;
|
||||
end
|
||||
assert(mod(len, 3) == 0);
|
||||
|
||||
%% Send command
|
||||
socket.sendCTRL(ctrl, ac);
|
||||
socket.sendWYPT(wyptOp, points);
|
||||
|
||||
end
|
||||
@@ -19,11 +19,12 @@ import XPlaneConnect.*
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(istrue(length(clients) < 2), '[sendCTRL] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
assert(isequal(length(clients) < 2, 1), '[setCONN] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
openUDP();
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
socket = clients(1);
|
||||
end
|
||||
|
||||
%% Validate input
|
||||
|
||||
@@ -23,11 +23,12 @@ import XPlaneConnect.*
|
||||
%% Get client
|
||||
global clients;
|
||||
if ~exist('socket', 'var')
|
||||
assert(istrue(length(clients) < 2), '[setDREF] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
assert(isequal(length(clients) < 2, 1), '[setDREF] ERROR: Multiple clients open. You must specify which client to use.');
|
||||
if isempty(clients)
|
||||
openUDP();
|
||||
socket = openUDP();
|
||||
else
|
||||
socket = clients(1);
|
||||
end
|
||||
socket = clients(1);
|
||||
end
|
||||
|
||||
%% Validate input
|
||||
|
||||
Reference in New Issue
Block a user