-
Notifications
You must be signed in to change notification settings - Fork 278
Network Information
The X-Plane Connect network protocol is designed to extend the UDP data protocol provided by X-Plane. XPC's protocol is a strict superset of the X-Plane protocol.
Detailed information about the commands added by XPC are provided below.
The primary purpose of this page is to document the format of data as it travels over the network. For more information about the commands themselves, there is usually an obvious one-to-one mapping between these datagrams and commands described in the XPC Client Reference.
The following section describes commands using the following format:
Each command is presented as a table with 3 rows. The first row shows the byte number of the packet. The second row indicates the type of the data field. Finally, the third row gives a descriptor of the field. Interesting descriptors are described in more detail below the table. The first 4 bytes of each command are always ASCII characters, and their descriptors are character literals.
Symbol | Data Type |
---|---|
x | Padding byte |
C | ASCII Character |
B | Byte |
U16 | Unsigned 16-bit integer |
U32 | Unsigned 32-bit integer |
U64 | Unsigned 64-bit integer |
I16 | Signed 16-bit integer |
I32 | Signed 32-bit integer |
I64 | Signed 64-bit integer |
F | 32-bit float |
D | 64-bit float |
S | ASCII string |
ASCII strings are always preceded by a single byte indicating their length. Strings are not null terminated.
All multi-byte fields are transmitted in little-endian byte order.
BCOM | CONF | COMM | CONN | CTRL | DATA | DREF | ECOM | GETC | GETD | GETP | POSI | RESP | SIMU | TEXT | VIEW | WYPT
Summary: Sent in response to the CONN command on the new port.
Format:
0 | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
C | C | C | C | x | B |
C | O | N | F | - | id |
id
: The internal id of the client. Because this value is not exposed to the
client anywhere else, it is not actually useful. It is kept for legacy
compatibility.
Summary: Executes a momentary X-Plane command.
Format:
0 | 1 | 2 | 3 | 4 | 5 | 6 |
---|---|---|---|---|---|---|
C | C | C | C | x | B | S |
C | O | M | M | - | n |
cmd |
n
: The length of cmd.
cmd
: The name of the command to execute.
Summary: Begins an X-Plane command. Format:
0 | 1 | 2 | 3 | 4 | 5 | 6 |
---|---|---|---|---|---|---|
C | C | C | C | x | B | S |
B | C | O | M | - | n |
cmd |
n
: The length of cmd.
cmd
: The name of the command to begin executing.
Summary: Ends an X-Plane command.
Format:
0 | 1 | 2 | 3 | 4 | 5 | 6 |
---|---|---|---|---|---|---|
C | C | C | C | x | B | S |
E | C | O | M | - | n |
cmd |
n
: The length of cmd.
cmd
: The name of the command to stop executing.
Summary: Sets the port used to send data back to the sending client.
Format:
0 | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
C | C | C | C | x | U16 |
C | O | N | N | - | port |
port
: The port on which future data will be sent.
Summary: Sets the control surfaces of the specified aircraft.
Format:
0 | 1 | 2 | 3 | 4 | 5 | 9 | 13 | 17 | 21 | 22 | 26 | 27 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
C | C | C | C | x | F | F | F | F | B | F | B | F |
C | T | R | L | - | e |
a |
r |
t |
g |
f |
ac |
sb |
e
: Elevator. Value should be in the range [-1, 1].
a
: Aileron. Value should be in the range [-1, 1].
r
: Rudder. Value should be in the range [-1, 1].
t
: Throttle. Value should be in the range [0, 1].
g
: Gear. Value should be 0, 1, or -1 (-1 toggles).
f
: Flaps. Value should be in the range [0, 1].
ac
: Aircraft number.
sb
: Speed brakes. Value should be in the range [-0.5, 1.5].
Summary: Sets data rows.
Format:
0 | 1 | 2 | 3 | 4 | 5 | 9 | ... | 37 | ... |
---|---|---|---|---|---|---|---|---|---|
C | C | C | C | x | U32 | F | F | F | - |
D | A | T | A | - | r1 |
v1^1 |
... | v1^8 |
... |
The DATA
command consists of any number of rows. No length byte is used; the
length is determined by dividing the packet length by 36 instead.
Summary: Sets the value of an X-Plane dataref.
Format:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 6+n | 7+n | ... | 7+n+4(m-1) |
---|---|---|---|---|---|---|---|---|---|---|
C | C | C | C | x | B | S | B | F | F | F |
D | R | E | F | - | n |
dref |
m |
v^1 |
... | v^m |
n
: The length of dref
.
dref
: The name of the dataref being set.
m
: The number of values in the dataref.
v^1 to v^m
: The values of the dataref.
Summary: Sends a request to the plugin to get the control surface
information for a specific plane. The plugin will respond with a CTRL
packet.
Format:
0 | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
C | C | C | C | x | B |
G | E | T | C | - | n |
n
: The aircraft number to get information for.
Summary: Gets the value of one or more datarefs. This command's structure is difficult to represent in tabular form, but is fairly straightforward in practice. In short, the command has the standard header, followed by the number of datarefs being requested, followed by the dataref names.
Format:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 7+n^1+1 | ... | Complicated | |
---|---|---|---|---|---|---|---|---|---|---|---|
C | C | C | C | x | B | B | S | B | S | B | S |
G | E | T | D | - | c |
n^1 |
dref^1 |
... | ... | n^c |
dref^c |
c
: The number of datarefs.
n^1 to n^c
: The length of each dref
.
dref^1 to dref^c
: The name of each dataref.
Summary: Sends a request to the plugin to get the position of a specific
plane. The plugin will respond with a POSI
packet.
Format:
0 | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
C | C | C | C | x | B |
G | E | T | P | - | n |
n
: The aircraft number to get information for.
Summary: Sets the position and orientation of an aircraft
Format:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 10 | 14 | 18 | 22 | 26 | 30 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
C | C | C | C | x | B | D | D | D | F | F | F | F |
P | O | S | I | - | ac |
lat |
lon |
asl |
r |
p |
h |
g |
ac
: Aircraft number.
lat
: Latitude
lon
: Longitude
asl
: Altitude (meters above sea level)
r
: Roll (degrees)
p
: Pitch (degrees)
r
: Roll (degrees)
h
: Heading (degrees)
g
: Gear (0 to retract, 1 to extend)
Summary: Returns value of one or more datarefs in response to the GETD command. This command's structure is difficult to represent in tabular form, but is fairly straightforward in practice. In short, the command has the standard header, followed by the number of datarefs that were requested requested, followed by the data itself
Format:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Complicated |
---|---|---|---|---|---|---|---|---|
C | C | C | C | x | B | B | F[] | ... |
G | E | T | D | - | c |
n^1 |
data^1 |
... |
c
: The number of datarefs.
n^1 to n^c
: The number of values in the result.
data^1 to data^c
: The result for each data ref. Values are always float, even
if the actual type of the dataref is int
or double
.
Summary: Enables or disables the physics simulation in X-Plane.
Format:
0 | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
C | C | C | C | x | B |
S | I | M | U | - | op |
op
: The operation to perform. 0 disables physics, 1 enables, and 2 toggles.
Summary: Sends a string to be drawn on the screen.
Format:
0 | 1 | 2 | 3 | 4 | 5 | 9 | 13 | 14 |
---|---|---|---|---|---|---|---|---|
C | C | C | C | x | I32 | I32 | B | S |
T | E | X | T | - | x |
y |
n |
str |
x
: The x coordinate where the string will be drawn.
y
: The y coordinate where the string will be drawn.
n
: The length of the string. Setting this to 0 will clear the current string
and disable drawing.
str
: The string itself.
Summary: Changes the camera mode in X-Plane
Format:
0 | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
C | C | C | C | x | I32 |
V | I | E | W | - | type |
type
: The command key associated with the desired view.
Summary: Manipulates a sequence of waypoints drawn in the world.
NOTE: This command relies on OpenGL. It will not work if using Vulkan.
Format:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ... | 6+4(3n-1) |
---|---|---|---|---|---|---|---|---|---|
C | C | C | C | x | B | B | F | F | F |
W | Y | P | T | - | op |
n |
v^1 |
... | v^3n |
op
: The operation to perform. 1 to add, 2 to remove, 3 to clear.
n
: The number of points.
v^1 to v^3n
: Values representing each point. Each triplet in this sequence is
treated as a (lat, lon, alt) point.
##GETT Summary: Request terrain information at AC location or specified coordinates
Format:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 14 | 22 |
---|---|---|---|---|---|---|---|---|
C | C | C | C | x | B | D | D | D |
G | E | T | T | - | ac |
lat |
lng |
alt |
ac
: Aircraft number
lat
: The latitude of the point to probe, or -998
to probe the aircraft's current location.
lng
: The longitude of the point to probe, or -998
to probe the aircraft's current location.
alt
: The altitude of the point to probe. Note that the altitude must be below the terrain height.
##TERR
Summary: Response to a GETT
query
Format:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 14 | 22 | 30 | 34 | 38 | 42 | 46 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
C | C | C | C | x | B | D | D | D | F | F | F | F | F |
T | E | R | R | - | ac |
lat |
lng |
alt |
nx |
ny |
nz |
wet |
status |
ac
: Aircraft number
lat
: Probe latitude. Either the value given to GETT
or the current aircraft latitude.
lng
: Probe longitude. Either the value given to GETT
or the current aircraft latitude.
alt
: Terrain height above msl at the coordinates specified by (lat
, lng
).
nx
: Terrain normal X.
ny
: Terrain normal Y.
nz
: Terrain normal Z.
wet
: 0.0
if the terrain above the point is dry land.
status
: Terrain probe status.