Fixed issues resolving Java classes.
- XPlaneConnect.jar is now only added once in openUDP. - Fully qualified all Java identifiers to resolve import issues.
This commit is contained in:
@@ -29,10 +29,11 @@ addOptional(p,'port',0,@isnumeric);
|
|||||||
parse(p,varargin{:});
|
parse(p,varargin{:});
|
||||||
|
|
||||||
%% Create client
|
%% Create client
|
||||||
[folder, ~, ~] = fileparts(which('XPlaneConnect.openUDP'));
|
if ~exist('gov.nasa.xpc.XPlaneConnect', 'class')
|
||||||
javaaddpath([folder, filesep, 'XPlaneConnect.jar']);
|
[folder, ~, ~] = fileparts(which('XPlaneConnect.openUDP'));
|
||||||
import gov.nasa.xpc.*;
|
javaaddpath(fullfile(folder, 'XPlaneConnect.jar'));
|
||||||
socket = XPlaneConnect(p.Results.xpHost, p.Results.xpPort, p.Results.port);
|
end
|
||||||
|
socket = gov.nasa.xpc.XPlaneConnect(p.Results.xpHost, p.Results.xpPort, p.Results.port);
|
||||||
|
|
||||||
%% Track open clients
|
%% Track open clients
|
||||||
global clients;
|
global clients;
|
||||||
|
|||||||
@@ -33,19 +33,14 @@ if ~exist('socket', 'var')
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
%% Get WaypointOp class
|
|
||||||
[folder, ~, ~] = fileparts(which('XPlaneConnect.openUDP'));
|
|
||||||
javaaddpath([folder, filesep, 'XPlaneConnect.jar']);
|
|
||||||
import gov.nasa.xpc.*;
|
|
||||||
|
|
||||||
%% Validate input
|
%% Validate input
|
||||||
len = uint32(length(points));
|
len = uint32(length(points));
|
||||||
assert(op > 0 && op < 4);
|
assert(op > 0 && op < 4);
|
||||||
wyptOp = WaypointOp.Add;
|
wyptOp = gov.nasa.xpc.WaypointOp.Add;
|
||||||
if isequal(op, 2)
|
if isequal(op, 2)
|
||||||
wyptOp = WaypointOp.Del;
|
wyptOp = gov.nasa.xpc.WaypointOp.Del;
|
||||||
elseif isequal(op, 3)
|
elseif isequal(op, 3)
|
||||||
wyptOp = WaypointOp.Clr;
|
wyptOp = gov.nasa.xpc.WaypointOp.Clr;
|
||||||
end
|
end
|
||||||
assert(mod(len, 3) == 0);
|
assert(mod(len, 3) == 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user