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{:});
|
||||
|
||||
%% Create client
|
||||
[folder, ~, ~] = fileparts(which('XPlaneConnect.openUDP'));
|
||||
javaaddpath([folder, filesep, 'XPlaneConnect.jar']);
|
||||
import gov.nasa.xpc.*;
|
||||
socket = XPlaneConnect(p.Results.xpHost, p.Results.xpPort, p.Results.port);
|
||||
if ~exist('gov.nasa.xpc.XPlaneConnect', 'class')
|
||||
[folder, ~, ~] = fileparts(which('XPlaneConnect.openUDP'));
|
||||
javaaddpath(fullfile(folder, 'XPlaneConnect.jar'));
|
||||
end
|
||||
socket = gov.nasa.xpc.XPlaneConnect(p.Results.xpHost, p.Results.xpPort, p.Results.port);
|
||||
|
||||
%% Track open clients
|
||||
global clients;
|
||||
|
||||
@@ -33,19 +33,14 @@ if ~exist('socket', 'var')
|
||||
end
|
||||
end
|
||||
|
||||
%% Get WaypointOp class
|
||||
[folder, ~, ~] = fileparts(which('XPlaneConnect.openUDP'));
|
||||
javaaddpath([folder, filesep, 'XPlaneConnect.jar']);
|
||||
import gov.nasa.xpc.*;
|
||||
|
||||
%% Validate input
|
||||
len = uint32(length(points));
|
||||
assert(op > 0 && op < 4);
|
||||
wyptOp = WaypointOp.Add;
|
||||
wyptOp = gov.nasa.xpc.WaypointOp.Add;
|
||||
if isequal(op, 2)
|
||||
wyptOp = WaypointOp.Del;
|
||||
wyptOp = gov.nasa.xpc.WaypointOp.Del;
|
||||
elseif isequal(op, 3)
|
||||
wyptOp = WaypointOp.Clr;
|
||||
wyptOp = gov.nasa.xpc.WaypointOp.Clr;
|
||||
end
|
||||
assert(mod(len, 3) == 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user