diff --git a/MATLAB/+XPlaneConnect/XPlaneConnect.jar b/MATLAB/+XPlaneConnect/XPlaneConnect.jar index 755bb29..e4c0af5 100644 Binary files a/MATLAB/+XPlaneConnect/XPlaneConnect.jar and b/MATLAB/+XPlaneConnect/XPlaneConnect.jar differ diff --git a/MATLAB/+XPlaneConnect/sendDREF.m b/MATLAB/+XPlaneConnect/sendDREF.m index cbf2119..e9a1b5c 100644 --- a/MATLAB/+XPlaneConnect/sendDREF.m +++ b/MATLAB/+XPlaneConnect/sendDREF.m @@ -1,17 +1,8 @@ function sendDREF( dref, value, socket ) -% sendDREF Sends a command to X-Plane that sets the given DREF. +% sendDREFs Sends a command to X-Plane that sets the given DREF. This +% function is now an alias to sendDREFs. It is kept only for backwards +% compatibility. % -% Inputs -% dref: The name of the X-Plane dataref to set. -% Value: An array of floating point values whose structure depends on the dref specified. -% socket (optional): The client to use when sending the command. -% -% Use -% 1. import XPlaneConnect.* -% 2. dataRef = 'sim/aircraft/parts/acf_gear_deploy'; // Landing Gear -% 3. Value = 0; -% 4. status = setDREF(dataRef, Value); -% % Contributors % [CT] Christopher Teubert (SGT, Inc.) % christopher.a.teubert@nasa.gov @@ -20,19 +11,8 @@ function sendDREF( dref, value, socket ) import XPlaneConnect.* -%% Get client -global clients; if ~exist('socket', 'var') - assert(isequal(length(clients) < 2, 1), '[setDREF] ERROR: Multiple clients open. You must specify which client to use.'); - if isempty(clients) - socket = openUDP(); - else - socket = clients(1); - end -end - -%% Validate input -value = single(value); - -%%Send command -socket.sendDREF(dref, value); \ No newline at end of file + sendDREFs(dref, value) +else + sendDREFs(dref, value, socket) +end \ No newline at end of file diff --git a/MATLAB/+XPlaneConnect/sendDREFs.m b/MATLAB/+XPlaneConnect/sendDREFs.m new file mode 100644 index 0000000..88fa3b2 --- /dev/null +++ b/MATLAB/+XPlaneConnect/sendDREFs.m @@ -0,0 +1,37 @@ +function sendDREFs( drefs, values, socket ) +% sendDREFs Sends a command to X-Plane that sets the given DREF(s). +% +% Inputs +% dref: The name or names of the X-Plane dataref(s) to set. +% Value: An array or an multidimensional array of floating point values +% whose structure depends on the dref specified. +% socket (optional): The client to use when sending the command. +% +% Use +% 1. import XPlaneConnect.* +% 2. dataRef = 'sim/aircraft/parts/acf_gear_deploy'; // Landing Gear +% 3. Value = 0; +% 4. status = setDREF(dataRef, Value); +% +% Contributors +% [JW] Jason Watkins +% jason.w.watkins@nasa.gov + +import XPlaneConnect.* + +%% Get client +global clients; +if ~exist('socket', 'var') + assert(isequal(length(clients) < 2, 1), '[setDREF] ERROR: Multiple clients open. You must specify which client to use.'); + if isempty(clients) + socket = openUDP(); + else + socket = clients(1); + end +end + +%% Validate input +values = single(values); + +%%Send command +socket.sendDREFs(drefs, values); \ No newline at end of file