User Guide(C).txt: Remove trailing whitespaces.
Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
This commit is contained in:
@@ -1,31 +1,31 @@
|
|||||||
X-Plane Connect-C (XPC-C) Readme
|
X-Plane Connect-C (XPC-C) Readme
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
XPC-C is a series of C functions that facilitate communication with X-Plane.
|
XPC-C is a series of C functions that facilitate communication with X-Plane.
|
||||||
|
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
SETUP
|
SETUP
|
||||||
Before using XPC Functions you must
|
Before using XPC Functions you must
|
||||||
1. Copy the file XPCPlugin.xpl to the "[X-Plane Directory]/Resources/plugins" directory.
|
1. Copy the file XPCPlugin.xpl to the "[X-Plane Directory]/Resources/plugins" directory.
|
||||||
2. Put in X-Plane CD 1 or X-Plane USB Key.
|
2. Put in X-Plane CD 1 or X-Plane USB Key.
|
||||||
3. Start X-Plane.
|
3. Start X-Plane.
|
||||||
4. #include "xplaneConnect.h"
|
4. #include "xplaneConnect.h"
|
||||||
|
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
BASIC FUNCTIONS
|
BASIC FUNCTIONS
|
||||||
1. openUDP opens a UDP Socket for communication. This is used to send data or receive.
|
1. openUDP opens a UDP Socket for communication. This is used to send data or receive.
|
||||||
INPUT:
|
INPUT:
|
||||||
port (unsigned short): Port Number (ex:49067)
|
port (unsigned short): Port Number (ex:49067)
|
||||||
xpIP (char *): IP Address of the computer running x-plane
|
xpIP (char *): IP Address of the computer running x-plane
|
||||||
xpPort (unsigned short): Port number that the X-Plane/ xpcPlugin Receives on (send -1 for default (49009), Typically xpcPlugin is 49009)
|
xpPort (unsigned short): Port number that the X-Plane/ xpcPlugin Receives on (send -1 for default (49009), Typically xpcPlugin is 49009)
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
socket (xpcSocket): The Opened Socket
|
socket (xpcSocket): The Opened Socket
|
||||||
|
|
||||||
USE:
|
USE:
|
||||||
unsigned short portNumber = 49067;
|
unsigned short portNumber = 49067;
|
||||||
struct xpcSocket theSocket = openUDP(portNumber, “127.0.0.1”, 49009);
|
struct xpcSocket theSocket = openUDP(portNumber, “127.0.0.1”, 49009);
|
||||||
|
|
||||||
2. closeUDP closes an opened UDP Socket for communication. This is to be done after the program has finished using that socket. Use opedUDP to open socket.
|
2. closeUDP closes an opened UDP Socket for communication. This is to be done after the program has finished using that socket. Use opedUDP to open socket.
|
||||||
INPUT:
|
INPUT:
|
||||||
socket (xpcSocket): The Opened Socket
|
socket (xpcSocket): The Opened Socket
|
||||||
@@ -37,10 +37,10 @@ BASIC FUNCTIONS
|
|||||||
INPUT:
|
INPUT:
|
||||||
socket (xpcSocket): Socket to use to send the command
|
socket (xpcSocket): Socket to use to send the command
|
||||||
recPort (unsigned Short): Port number for requested dataref values to be sent to
|
recPort (unsigned Short): Port number for requested dataref values to be sent to
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
status (short): 0 if successful
|
status (short): 0 if successful
|
||||||
|
|
||||||
USE:
|
USE:
|
||||||
char IP[16] = "127.0.0.1";
|
char IP[16] = "127.0.0.1";
|
||||||
struct xpcSocket theSocket = openUDP(49067);
|
struct xpcSocket theSocket = openUDP(49067);
|
||||||
@@ -50,7 +50,7 @@ BASIC FUNCTIONS
|
|||||||
INPUT:
|
INPUT:
|
||||||
socket (xpcSocket): Socket to use to send the command
|
socket (xpcSocket): Socket to use to send the command
|
||||||
pause (short): 1=Pause, 0=Resume
|
pause (short): 1=Pause, 0=Resume
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
status (short): 0 if successful
|
status (short): 0 if successful
|
||||||
|
|
||||||
@@ -58,22 +58,22 @@ BASIC FUNCTIONS
|
|||||||
char IP[16] = "127.0.0.1";
|
char IP[16] = "127.0.0.1";
|
||||||
struct xpcSocket theSocket = openUDP(49067);
|
struct xpcSocket theSocket = openUDP(49067);
|
||||||
pauseSim(theSocket, IP, 49009, 1);
|
pauseSim(theSocket, IP, 49009, 1);
|
||||||
|
|
||||||
5. sendDATA set the value of a state in the "DATA Input & Output" Table
|
5. sendDATA set the value of a state in the "DATA Input & Output" Table
|
||||||
INPUT:
|
INPUT:
|
||||||
socket (xpcSocket): Socket to use to send the command
|
socket (xpcSocket): Socket to use to send the command
|
||||||
dataArray (float[][9]): Array of data to be sent. The first element of each row is the item # (corresponding to the number on the X-Plane "DATA Input & Output" Screen). Send -999 to leave the value unchanged.
|
dataArray (float[][9]): Array of data to be sent. The first element of each row is the item # (corresponding to the number on the X-Plane "DATA Input & Output" Screen). Send -999 to leave the value unchanged.
|
||||||
rows (unsigned short): Number of rows of data being sent
|
rows (unsigned short): Number of rows of data being sent
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
status (short): 0 if successful
|
status (short): 0 if successful
|
||||||
|
|
||||||
USE:
|
USE:
|
||||||
char IP[16] = "127.0.0.1";
|
char IP[16] = "127.0.0.1";
|
||||||
struct xpcSocket theSocket = openUDP(49067);
|
struct xpcSocket theSocket = openUDP(49067);
|
||||||
float data[] = {{14, 1, -999, -999, -999, -999, -999, -999, -999},{25, 0.8, 0.8, -999, -999, -999, -999, -999, -999}}; // Gear and Throttle
|
float data[] = {{14, 1, -999, -999, -999, -999, -999, -999, -999},{25, 0.8, 0.8, -999, -999, -999, -999, -999, -999}}; // Gear and Throttle
|
||||||
sendDATA(theSocket,IP,49009,data,2);
|
sendDATA(theSocket,IP,49009,data,2);
|
||||||
|
|
||||||
6. sendPOSI set the position of an aircraft
|
6. sendPOSI set the position of an aircraft
|
||||||
INPUT:
|
INPUT:
|
||||||
socket (xpcSocket): Socket to use to send the command
|
socket (xpcSocket): Socket to use to send the command
|
||||||
@@ -87,7 +87,7 @@ BASIC FUNCTIONS
|
|||||||
position[4] = Pitch (deg)
|
position[4] = Pitch (deg)
|
||||||
position[5] = True Heading (deg)
|
position[5] = True Heading (deg)
|
||||||
position[6] = Gear (0=up, 1=down)
|
position[6] = Gear (0=up, 1=down)
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
status (short): 0 if successful
|
status (short): 0 if successful
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ BASIC FUNCTIONS
|
|||||||
struct xpcSocket theSocket = openUDP(49067);
|
struct xpcSocket theSocket = openUDP(49067);
|
||||||
float posit[] = {37.5242422, -122.06899, 2500, 0, 0, 0, 1};
|
float posit[] = {37.5242422, -122.06899, 2500, 0, 0, 0, 1};
|
||||||
sendPOSI(theSocket, IP, 49009, 7, posit);
|
sendPOSI(theSocket, IP, 49009, 7, posit);
|
||||||
|
|
||||||
7. sendCTRL send control commands to the aircraft
|
7. sendCTRL send control commands to the aircraft
|
||||||
INPUT:
|
INPUT:
|
||||||
socket (xpcSocket): Socket to use to send the command
|
socket (xpcSocket): Socket to use to send the command
|
||||||
@@ -108,16 +108,16 @@ BASIC FUNCTIONS
|
|||||||
control[3] = Throttle [-1, 1]
|
control[3] = Throttle [-1, 1]
|
||||||
control[4] = Gear (0=up, 1=down)
|
control[4] = Gear (0=up, 1=down)
|
||||||
control[5] = Flaps [0, 1]
|
control[5] = Flaps [0, 1]
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
status (short): 0 if successful
|
status (short): 0 if successful
|
||||||
|
|
||||||
USE:
|
USE:
|
||||||
char IP[16] = "127.0.0.1";
|
char IP[16] = "127.0.0.1";
|
||||||
struct xpcSocket theSocket = openUDP(49067);
|
struct xpcSocket theSocket = openUDP(49067);
|
||||||
float ctrl[] = {0, 0, 0, 0.8, 0, 1};
|
float ctrl[] = {0, 0, 0, 0.8, 0, 1};
|
||||||
sendCTRL(theSocket, IP, 49009, 6, ctrl);
|
sendCTRL(theSocket, IP, 49009, 6, ctrl);
|
||||||
|
|
||||||
8. sendDREF set the value of a specific dataref. Dataref list found at http://www.xsquawkbox.net/xpsdk/docs/DataRefs.html
|
8. sendDREF set the value of a specific dataref. Dataref list found at http://www.xsquawkbox.net/xpsdk/docs/DataRefs.html
|
||||||
INPUT:
|
INPUT:
|
||||||
socket (xpcSocket): Socket to use to send the command
|
socket (xpcSocket): Socket to use to send the command
|
||||||
@@ -125,7 +125,7 @@ BASIC FUNCTIONS
|
|||||||
length (short): length of dataref string
|
length (short): length of dataref string
|
||||||
values (float *): Array of values to be sent
|
values (float *): Array of values to be sent
|
||||||
length2 (short): Number of values in values array
|
length2 (short): Number of values in values array
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
status (short): 0 if successful
|
status (short): 0 if successful
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ BASIC FUNCTIONS
|
|||||||
char theDREF[] = "cockpit/switches/gear_handle_status";
|
char theDREF[] = "cockpit/switches/gear_handle_status";
|
||||||
float value = 1;
|
float value = 1;
|
||||||
sendDREF(theSocket, IP, 49009, theDREF, strlen(theDREF), &value, 1);
|
sendDREF(theSocket, IP, 49009, theDREF, strlen(theDREF), &value, 1);
|
||||||
|
|
||||||
9. requestDREF Request the value of specific dref(s). Dataref list found at http://www.xsquawkbox.net/xpsdk/docs/DataRefs.html
|
9. requestDREF Request the value of specific dref(s). Dataref list found at http://www.xsquawkbox.net/xpsdk/docs/DataRefs.html
|
||||||
INPUT:
|
INPUT:
|
||||||
outSocket (xpcSocket): Socket to use to send the command
|
outSocket (xpcSocket): Socket to use to send the command
|
||||||
@@ -145,7 +145,7 @@ BASIC FUNCTIONS
|
|||||||
listLength (short): Number of DataRefs in DREFArray
|
listLength (short): Number of DataRefs in DREFArray
|
||||||
result (*float[]): Array of pointers to the values returned
|
result (*float[]): Array of pointers to the values returned
|
||||||
arrayLen (short[]): Array where each element corresponds to the number of elements in the float array.
|
arrayLen (short[]): Array where each element corresponds to the number of elements in the float array.
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
length (short): Number of Values Returned
|
length (short): Number of Values Returned
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ BASIC FUNCTIONS
|
|||||||
struct xpcSocket theSocket = openUDP(49067);
|
struct xpcSocket theSocket = openUDP(49067);
|
||||||
char DREFArray[][100] = {"sim/cockpit/switches/gear_handle_status"};
|
char DREFArray[][100] = {"sim/cockpit/switches/gear_handle_status"};
|
||||||
requestDREF(theSocket, IP, 49009, DREFArray, strlen(DREFArray[0]),1);
|
requestDREF(theSocket, IP, 49009, DREFArray, strlen(DREFArray[0]),1);
|
||||||
|
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
ADVANCED FUNCTIONS (These are mostly used by the xpcPlugin to read requests)
|
ADVANCED FUNCTIONS (These are mostly used by the xpcPlugin to read requests)
|
||||||
1. sendUDP
|
1. sendUDP
|
||||||
|
|||||||
Reference in New Issue
Block a user