diff --git a/C/src/xplaneConnect.c b/C/src/xplaneConnect.c index b065bd0..ec44366 100755 --- a/C/src/xplaneConnect.c +++ b/C/src/xplaneConnect.c @@ -362,7 +362,7 @@ int readDATA(XPCSocket sock, float data[][9], int rows) /*****************************************************************************/ /**** DREF functions ****/ /*****************************************************************************/ -int setDREF(XPCSocket sock, const char* dref, float value[], int size) +int sendDREF(XPCSocket sock, const char* dref, float value[], int size) { // Setup command // 5 byte header + max 255 char dref name + max 255 values * 4 bytes per value = 1279 diff --git a/C/src/xplaneConnect.h b/C/src/xplaneConnect.h index 3a2a02e..8b38193 100644 --- a/C/src/xplaneConnect.h +++ b/C/src/xplaneConnect.h @@ -133,7 +133,7 @@ int sendDATA(XPCSocket sock, float data[][9], int rows); /// \param values An array of values representing the data to set. /// \param size The number of elements in values. /// \returns 0 if successful, otherwise a negative value. -int setDREF(XPCSocket sock, const char* dref, float value[], int size); +int sendDREF(XPCSocket sock, const char* dref, float value[], int size); /// Gets the value of the specified dataref. /// diff --git a/C/xpcExample/xpcExample/src/main.cpp b/C/xpcExample/xpcExample/src/main.cpp index 325622d..acc9219 100644 --- a/C/xpcExample/xpcExample/src/main.cpp +++ b/C/xpcExample/xpcExample/src/main.cpp @@ -93,7 +93,7 @@ int main() const char* dref = "sim/cockpit/switches/gear_handle_status"; // Gear handle data reference float gear = 0; // Stow gear - setDREF(sock, dref, &gear, 1); // Set gear to stow + sendDREF(sock, dref, &gear, 1); // Set gear to stow // Simulate for 10 seconds sleep(10); diff --git a/Java/Examples/BasicOperation/src/Main.java b/Java/Examples/BasicOperation/src/Main.java index 86d0648..1ab5bcc 100644 --- a/Java/Examples/BasicOperation/src/Main.java +++ b/Java/Examples/BasicOperation/src/Main.java @@ -71,7 +71,7 @@ public class Main try { Thread.sleep(10000); } catch (InterruptedException ex) {} System.out.println("Stowing landing gear"); - xpc.setDREF("sim/cockpit/switches/gear_handle_status", 1); + xpc.sendDREF("sim/cockpit/switches/gear_handle_status", 1); //Let sim run for 10 seconds try { Thread.sleep(10000); } catch (InterruptedException ex) {} diff --git a/Java/src/XPlaneConnect.java b/Java/src/XPlaneConnect.java index f59e18c..faa2204 100644 --- a/Java/src/XPlaneConnect.java +++ b/Java/src/XPlaneConnect.java @@ -306,9 +306,9 @@ public class XPlaneConnect implements AutoCloseable throw new IOException("No response received."); } - public void setDREF(String dref, float value) throws IOException + public void sendDREF(String dref, float value) throws IOException { - setDREF(dref, new float[] {value}); + sendDREF(dref, new float[] {value}); } /** @@ -318,7 +318,7 @@ public class XPlaneConnect implements AutoCloseable * @param value An array of floating point values whose structure depends on the dref specified. * @throws IOException If the command cannot be sent. */ - public void setDREF(String dref, float[] value) throws IOException + public void sendDREF(String dref, float[] value) throws IOException { //Preconditions if(dref == null) diff --git a/MATLAB/+XPlaneConnect/XPlaneConnect.jar b/MATLAB/+XPlaneConnect/XPlaneConnect.jar index edf9b73..495f222 100644 Binary files a/MATLAB/+XPlaneConnect/XPlaneConnect.jar and b/MATLAB/+XPlaneConnect/XPlaneConnect.jar differ diff --git a/MATLAB/+XPlaneConnect/setDREF.m b/MATLAB/+XPlaneConnect/sendDREF.m similarity index 96% rename from MATLAB/+XPlaneConnect/setDREF.m rename to MATLAB/+XPlaneConnect/sendDREF.m index 13e6f00..65e23aa 100644 --- a/MATLAB/+XPlaneConnect/setDREF.m +++ b/MATLAB/+XPlaneConnect/sendDREF.m @@ -1,4 +1,4 @@ -function setDREF( dref, value, socket ) +function sendDREF( dref, value, socket ) % sendDREF Sends a command to X-Plane that sets the given DREF. % % Inputs diff --git a/TestScripts/C Tests/main.c b/TestScripts/C Tests/main.c index dca0291..487b351 100644 --- a/TestScripts/C Tests/main.c +++ b/TestScripts/C Tests/main.c @@ -150,7 +150,7 @@ int sendDREFTest() // sendDREF test } // Execution - setDREF(sock, drefs[0], &value, 1); + sendDREF(sock, drefs[0], &value, 1); int result = getDREFs(sock, drefs, data, 1, sizes); // Close diff --git a/TestScripts/Java Tests/XPlaneConnectTest.java b/TestScripts/Java Tests/XPlaneConnectTest.java index 8eb2b69..aed0883 100644 --- a/TestScripts/Java Tests/XPlaneConnectTest.java +++ b/TestScripts/Java Tests/XPlaneConnectTest.java @@ -308,7 +308,7 @@ public class XPlaneConnectTest float gearHandle = xpc.getDREF(dref)[0]; float value = gearHandle > 0.5 ? 0 : 1; - xpc.setDREF(dref, value); + xpc.sendDREF(dref, value); float result = xpc.getDREF(dref)[0]; assertEquals(value, result, 1e-4); @@ -320,7 +320,7 @@ public class XPlaneConnectTest { try(XPlaneConnect xpc = new XPlaneConnect()) { - xpc.setDREF(null, 0); + xpc.sendDREF(null, 0); fail(); } } @@ -332,7 +332,7 @@ public class XPlaneConnectTest try(XPlaneConnect xpc = new XPlaneConnect()) { - xpc.setDREF(dref, null); + xpc.sendDREF(dref, null); fail(); } } @@ -343,7 +343,7 @@ public class XPlaneConnectTest String dref = "sim/cockpit/switches/gear_handle_status"; try(XPlaneConnect xpc = new XPlaneConnect()) { - xpc.setDREF(dref, new float[0]); + xpc.sendDREF(dref, new float[0]); fail(); } } @@ -358,7 +358,7 @@ public class XPlaneConnectTest String dref = "sim/cockpit/switches/gear_handle_status"; try(XPlaneConnect xpc = new XPlaneConnect()) { - xpc.setDREF(dref, new float[200]); + xpc.sendDREF(dref, new float[200]); } } @@ -368,7 +368,7 @@ public class XPlaneConnectTest String dref = "sim/cockpit/switches/i/am/a/very/long/fake/dref/that/is/over/255/characters/./which/means/that/my/length/cant/be/encoded/in/the/single/byte/allocated/by/the/message/format/,/so/i/should/cause/an/exception/instead/./i/am/still/not/long/enough/./almost/there"; try(XPlaneConnect xpc = new XPlaneConnect()) { - xpc.setDREF(dref, 0); + xpc.sendDREF(dref, 0); fail(); } } @@ -379,7 +379,7 @@ public class XPlaneConnectTest String dref = ""; try(XPlaneConnect xpc = new XPlaneConnect()) { - xpc.setDREF(dref, 0); + xpc.sendDREF(dref, 0); fail(); } } diff --git a/TestScripts/MATLAB Tests/setDREFTest.m b/TestScripts/MATLAB Tests/sendDREFTest.m similarity index 89% rename from TestScripts/MATLAB Tests/setDREFTest.m rename to TestScripts/MATLAB Tests/sendDREFTest.m index 70077b3..33741c2 100644 --- a/TestScripts/MATLAB Tests/setDREFTest.m +++ b/TestScripts/MATLAB Tests/sendDREFTest.m @@ -1,4 +1,4 @@ -function setDREFTest( ) +function sendDREFTest( ) %SENDREADTEST Summary of this function goes here % Detailed explanation goes here addpath('../../MATLAB') @@ -7,7 +7,7 @@ import XPlaneConnect.* DREFS = {'sim/cockpit/switches/gear_handle_status'}; value = randi([0 10]); -setDREF(DREFS{1},value); +sendDREF(DREFS{1},value); result = getDREFs(DREFS); assert(isequal(length(result),1),'setDREFTest: requestDREF unsucessful-wrong number of elements returned'); diff --git a/TestScripts/MATLAB Tests/tests.m b/TestScripts/MATLAB Tests/tests.m index ec2329f..6871686 100644 --- a/TestScripts/MATLAB Tests/tests.m +++ b/TestScripts/MATLAB Tests/tests.m @@ -13,7 +13,7 @@ disp(['XPC Tests-MATLAB (', os, ')']); theTests = {{@openCloseTest, 'Open/Close Test', 0},... {@sendTEXTTest,'TEXT Test', 0},... {@getDREFsTest,'Request DREF Test', 0},... - {@setDREFTest,'Send DREF Test', 0},... + {@sendDREFTest,'Send DREF Test', 0},... {@DATATest,'DATA Test', 0},... {@CTRLTest,'CTRL Test', 0},... {@POSITest,'POSI Test', 0},...