1 | /*! \mainpage X-Plane Remote Access Plugin and Client Library Documentation
|
---|
2 | *
|
---|
3 | * \section intro Introduction
|
---|
4 | *
|
---|
5 | * The X-Plane Remote Access (XPLRA) plugin provides a gateway to external
|
---|
6 | * applications to access some internals of X-Plane. This document
|
---|
7 | * describes the plugin and its usage. It is assumed that the reader
|
---|
8 | * is somewhat familiar with the X-Plane plugin SDK. The plugin
|
---|
9 | * currently works on Linux and Windows, but porting to Mac should be
|
---|
10 | * easy. If you would volunteer, let me know! :)
|
---|
11 | *
|
---|
12 | * The XPLRA plugin allows the extern applications to perform the
|
---|
13 | * following:
|
---|
14 | * - Get and set the values of datarefs either individually or in
|
---|
15 | * batch. Batches can also be pre-registered in case the same set of
|
---|
16 | * datarefs is to be queried or modified several times. This avoids
|
---|
17 | * having to send and resolve the dataref names every time.
|
---|
18 | * - Query the versions of X-Plane, XPLM (the plugin manager) and
|
---|
19 | * XPLRA.
|
---|
20 | * - Show a message in a window for the pilot for a specified amount
|
---|
21 | * of time.
|
---|
22 | * - Register and then monitor hotkeys.
|
---|
23 | *
|
---|
24 | * Currently the plugin can be accessed locally, i.e. from the same
|
---|
25 | * computer that runs X-Plane, but extending it with TCP/IP-based or
|
---|
26 | * network access would not be difficult. While client libraries are
|
---|
27 | * provided for C, C++ and Python, the communication protocol between
|
---|
28 | * clients and the plugin is open and is \ref proto "described" in
|
---|
29 | * this documentation. So you can write your own client, if you wish.
|
---|
30 | */
|
---|
31 | /*! \page proto Protocol
|
---|
32 | *
|
---|
33 | * On Linux a Unix stream socket is created with the name
|
---|
34 | * \c /tmp/xplra-\<user name\>, where \c \<user name\> is the login
|
---|
35 | * account name of the user running X-Plane. On Windows a named pipe
|
---|
36 | * is created with the name \c \\\\\.\\pipe\\xplra. The usual methods
|
---|
37 | * provided by the OS can be used to connect to these.
|
---|
38 | *
|
---|
39 | * The protocol is a binary protocol. The client initiates commands
|
---|
40 | * which are executed by the plugin. Each command is a byte followed
|
---|
41 | * by the arguments of the command. The plugin responds with a result
|
---|
42 | * code, which is also a byte, which may be followed by the rest of
|
---|
43 | * the reply, e.g. the data queried or a parameter to an error code.
|
---|
44 | *
|
---|
45 | * \section protodata Types of protocol data elements
|
---|
46 | *
|
---|
47 | * The protocol's basic data elements are: 8-, 16- and 32-bit signed
|
---|
48 | * and unsigned integers, single and double precision floating point
|
---|
49 | * values and strings. The endianness of the values is that of the
|
---|
50 | * host operating system.
|
---|
51 |
|
---|
52 | * Strings are encoded as a variable-length length followed by as many
|
---|
53 | * bytes making up the actual contents of the string. The
|
---|
54 | * variable-length length consists of bytes whose most-significant bit
|
---|
55 | * is 1, if there is another byte and 0 for the last byte. The first
|
---|
56 | * byte contains the least significant 7 bits of the length, the
|
---|
57 | * second byte contains bits 7-13, and so on. Some examples:
|
---|
58 | * - 12 => 0x0c
|
---|
59 | * - 123 => 0x7b
|
---|
60 | * - 128 => 0x80 0x01
|
---|
61 | * - 210 => 0xd2 0x01
|
---|
62 | * - 7345 => 0xb1 0x39
|
---|
63 | * - 90000 => 0x90 0xbf 0x05
|
---|
64 | *
|
---|
65 | * \section datatypes Data type codes
|
---|
66 | *
|
---|
67 | * Each dataref of X-Plane has a certain data type, and some datarefs
|
---|
68 | * can represent their values in multiple data types. Because of this
|
---|
69 | * ambiguity and the fact that users should know the data type anyway,
|
---|
70 | * especially when using a strongly typed language, the type should be
|
---|
71 | * sent with the dataref name in commands that refer to one or more
|
---|
72 | * datarefs.
|
---|
73 | *
|
---|
74 | * Each data type is represented as an 8-bit unsigned integer, whose
|
---|
75 | * possible values are given in the table below:
|
---|
76 | *
|
---|
77 | * Data type | Value | Constant name
|
---|
78 | * --------- | ----: | -------------
|
---|
79 | * 32-bit signed integer | 0x01 | \anchor TYPE_INT TYPE_INT
|
---|
80 | * single-precision floating-point value | 0x02 | \anchor TYPE_FLOAT TYPE_FLOAT
|
---|
81 | * double-precision floating-point value | 0x03 | \anchor TYPE_DOUBLE TYPE_DOUBLE
|
---|
82 | * array of single-precision floating-point values | 0x11 | \anchor TYPE_FLOAT_ARRAY TYPE_FLOAT_ARRAY
|
---|
83 | * array of 32-bit signed integers | 0x12 | \anchor TYPE_INT_ARRAY TYPE_INT_ARRAY
|
---|
84 | * array of 8-bit unsigned integers (bytes) | 0x13 | \anchor TYPE_BYTE_ARRAY TYPE_BYTE_ARRAY
|
---|
85 | *
|
---|
86 | * The constant name is the name used in both client APIs to identify
|
---|
87 | * the given type.
|
---|
88 | *
|
---|
89 | * The scalar data types are encoded as in the following table:
|
---|
90 | *
|
---|
91 | * Data type constant | Encoding
|
---|
92 | * ------------------ | --------
|
---|
93 | * \ref TYPE_INT | a 32-bit (4-byte) signed integer
|
---|
94 | * \ref TYPE_FLOAT | a 32-bit (4-byte) IEEE 754 single-precision floating point value
|
---|
95 | * \ref TYPE_DOUBLE | a 64-bit (8-byte) IEEE 754 double-precision floating point value
|
---|
96 | *
|
---|
97 | * The contents of an array is encoded as a sequence of values of the
|
---|
98 | * items' type. It is usually preceded by a 32-bit signed integer
|
---|
99 | * denoting the number of items and sometimes also by another 32-bit
|
---|
100 | * signed integer denoting the offset into the array.
|
---|
101 | *
|
---|
102 | * \section resultcodes Result codes
|
---|
103 | *
|
---|
104 | * The first byte of the reply message to each command is a result
|
---|
105 | * code. If the command could be executed properly, it is RESULT_OK
|
---|
106 | * followed by the results of the command if any, otherwise it is
|
---|
107 | * another code signifying some error. Most error codes are followed
|
---|
108 | * by no further data, but \ref RESULT_UNKNOWN_DATAREF may be followed by
|
---|
109 | * an index if a multi-dataref request is issued.
|
---|
110 | *
|
---|
111 | * The table summarizes the error codes:
|
---|
112 | *
|
---|
113 | * Meaning | Value | Constant name
|
---|
114 | * ------- | ----- | -------------
|
---|
115 | * Success, everything is OK | 0x00 | \anchor RESULT_OK RESULT_OK
|
---|
116 | * Invalid command | 0x01 | \anchor RESULT_INVALID_COMMAND RESULT_INVALID_COMMAND
|
---|
117 | * Unknown dataref | 0x02 | \anchor RESULT_UNKNOWN_DATAREF RESULT_UNKNOWN_DATAREF
|
---|
118 | * Invalid data type | 0x03 | \anchor RESULT_INVALID_TYPE RESULT_INVALID_TYPE
|
---|
119 | * Invalid length | 0x04 | \anchor RESULT_INVALID_LENGTH RESULT_INVALID_LENGTH
|
---|
120 | * Invalid offset | 0x05 | \anchor RESULT_INVALID_OFFSET RESULT_INVALID_OFFSET
|
---|
121 | * Invalid count | 0x06 | \anchor RESULT_INVALID_COUNT RESULT_INVALID_COUNT
|
---|
122 | * Invalid ID | 0x07 | \anchor RESULT_INVALID_ID RESULT_INVALID_ID
|
---|
123 | * Invalid duration | 0x08 | \anchor RESULT_INVALID_DURATION RESULT_INVALID_DURATION
|
---|
124 | * Other error | 0xff | \anchor RESULT_OTHER_ERROR RESULT_OTHER_ERROR
|
---|
125 | *
|
---|
126 | * \section limits Limits
|
---|
127 | *
|
---|
128 | * Certain parameters have limits, which are summarized in the
|
---|
129 | * following table:
|
---|
130 | *
|
---|
131 | * Description | Limit
|
---|
132 | * ------- | -----
|
---|
133 | * maximal number of array items | 2048
|
---|
134 | * maximal number of datarefs in a multi-dataref operation | 1024
|
---|
135 | * maximal duration of a message | 5 minutes
|
---|
136 | * maximal number of hotkeys that can be registered | 128
|
---|
137 | *
|
---|
138 | * \section commands Commands
|
---|
139 | *
|
---|
140 | * This section describes the commands of the protocol with their
|
---|
141 | * parameters and the possible replies. Each command is represented by
|
---|
142 | * an 8-bit unsigned value, which is the first byte of the
|
---|
143 | * message. The table below summarizes the commands with their command
|
---|
144 | * byte and constant names:
|
---|
145 | *
|
---|
146 | * Description | Command byte | Constant Name
|
---|
147 | * ----------- | -----------: | -------------
|
---|
148 | * \ref command_get_single "Query the value of a single dataref" | 0x01 | \anchor COMMAND_GET_SINGLE COMMAND_GET_SINGLE
|
---|
149 | * \ref command_set_single "Set the value of a single dataref" | 0x02 | \anchor COMMAND_SET_SINGLE COMMAND_SET_SINGLE
|
---|
150 | * \ref command_get_multi "Query the values of multiple datarefs" | 0x03 | \anchor COMMAND_GET_MULTI COMMAND_GET_MULTI
|
---|
151 | * \ref command_set_multi "Set the values of multiple datarefs" | 0x04 | \anchor COMMAND_SET_MULTI COMMAND_SET_MULTI
|
---|
152 | * \ref command_register_get_multi "Register a multi-dataref query" | 0x11 | \anchor COMMAND_REGISTER_GET_MULTI COMMAND_REGISTER_GET_MULTI
|
---|
153 | * \ref command_unregister_get_multi "Unregister a multi-dataref query" | 0x12 | \anchor COMMAND_UNREGISTER_GET_MULTI COMMAND_UNREGISTER_GET_MULTI
|
---|
154 | * \ref command_execute_get_multi "Execute a registered multi-dataref query" | 0x13 | \anchor COMMAND_EXECUTE_GET_MULTI COMMAND_EXECUTE_GET_MULTI
|
---|
155 | * \ref command_register_set_multi "Register a multi-dataref update request" | 0x21 | \anchor COMMAND_REGISTER_SET_MULTI COMMAND_REGISTER_SET_MULTI
|
---|
156 | * \ref command_unregister_set_multi "Unregister a multi-dataref update request" | 0x22 | \anchor COMMAND_UNREGISTER_SET_MULTI COMMAND_UNREGISTER_SET_MULTI
|
---|
157 | * \ref command_execute_set_multi "Execute a registered multi-dataref update request" | 0x23 | \anchor COMMAND_EXECUTE_SET_MULTI COMMAND_EXECUTE_SET_MULTI
|
---|
158 | * \ref command_get_versions "Query the versions of X-Plane, XPLM and XPLRA" | 0x31 | \anchor COMMAND_GET_VERSIONS COMMAND_GET_VERSIONS
|
---|
159 | * \ref command_reload_plugins "Reload the plugins in X-Plane" | 0x32 | \anchor COMMAND_RELOAD_PLUGINS COMMAND_RELOAD_PLUGINS
|
---|
160 | * \ref command_show_message "Show a message in X-Plane's window" | 0x41 | \anchor COMMAND_SHOW_MESSAGE COMMAND_SHOW_MESSAGE
|
---|
161 | * \ref command_register_hotkeys "Register hotkeys to be listened to" | 0x51 | \anchor COMMAND_REGISTER_HOTKEYS COMMAND_REGISTER_HOTKEYS
|
---|
162 | * \ref command_query_hotkeys "Query the sate of the registered hotkeys" | 0x52 | \anchor COMMAND_QUERY_HOTKEYS COMMAND_QUERY_HOTKEYS
|
---|
163 | * \ref command_unregister_hotkeys "Unregister the previously registered hotkets" | 0x53 | \anchor COMMAND_UNREGISTER_HOTKEYS COMMAND_UNREGISTER_HOTKEYS
|
---|
164 | *
|
---|
165 | * \subsection command_get_single The GET_SINGLE command
|
---|
166 | *
|
---|
167 | * This command can be used to query the value of a single
|
---|
168 | * dataref. Such a data can either be a scalar (integer, float or
|
---|
169 | * double) or an array of floats, integers or bytes.
|
---|
170 | *
|
---|
171 | * The format of the command is the following:
|
---|
172 | *
|
---|
173 | * Type | Description
|
---|
174 | * ---- | ------
|
---|
175 | * byte | 0x01 (\ref COMMAND_GET_SINGLE)
|
---|
176 | * dataref_query_info | information about the dataref to query
|
---|
177 | *
|
---|
178 | * \anchor dataref_query_info \c dataref_query_info has the following
|
---|
179 | * format for scalar types:
|
---|
180 | *
|
---|
181 | * Type | Description
|
---|
182 | * ---- | ------
|
---|
183 | * string | the name of the dataref to query
|
---|
184 | * byte | the type of the dataref, one of the \ref datatypes "TYPE_XXX" constants
|
---|
185 | *
|
---|
186 | * \c dataref_query_info has the following format for array types:
|
---|
187 | *
|
---|
188 | * Type | Description
|
---|
189 | * ---- | ------
|
---|
190 | * string | the name of the dataref to query
|
---|
191 | * byte | the type of the dataref, one of the \ref datatypes "TYPE_XXX_ARRAY" constants
|
---|
192 | * 32-bit signed integer | the number of items to query, -1 to query all items
|
---|
193 | * 32-bit signed integer | the offset of the data within the array to query
|
---|
194 | *
|
---|
195 | * If the command is executed successfully, the reply has the
|
---|
196 | * following format for scalar types:
|
---|
197 | *
|
---|
198 | * Type | Description
|
---|
199 | * ---- | ------
|
---|
200 | * byte | 0x00 (\ref RESULT_OK)
|
---|
201 | * dataref_value | the value of the dataref
|
---|
202 | *
|
---|
203 | * \anchor dataref_value dataref_value is encoded as follows for scalar types:
|
---|
204 | *
|
---|
205 | * Type | Description
|
---|
206 | * ---- | ------
|
---|
207 | * scalar type | the value of the dataref
|
---|
208 | *
|
---|
209 | * dataref_value is encoded as follows for array types:
|
---|
210 | *
|
---|
211 | * Type | Description
|
---|
212 | * ---- | ------
|
---|
213 | * 32-bit signed integer | n=the number of items returned
|
---|
214 | * n*type of the items | the data items themselves
|
---|
215 | *
|
---|
216 | * In case of an error:
|
---|
217 | *
|
---|
218 | * Type | Description
|
---|
219 | * ---- | ------
|
---|
220 | * byte | the error code
|
---|
221 | *
|
---|
222 | * The following error codes may be returned:
|
---|
223 | *
|
---|
224 | * Code | Meaning
|
---|
225 | * ---- | -------
|
---|
226 | * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
|
---|
227 | * \ref RESULT_INVALID_TYPE | an unknown type code was given
|
---|
228 | * \ref RESULT_INVALID_LENGTH | the length given for an array is too large
|
---|
229 | * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
|
---|
230 | *
|
---|
231 | * \subsection command_set_single The SET_SINGLE command
|
---|
232 | *
|
---|
233 | * This command can be used to set the value of a single
|
---|
234 | * dataref. Such a data can either be a scalar (integer, float or
|
---|
235 | * double) or an array of floats, integers or bytes.
|
---|
236 | *
|
---|
237 | * The format of the command is the following for scalar values:
|
---|
238 | *
|
---|
239 | * Type | Description
|
---|
240 | * ---- | ------
|
---|
241 | * byte | 0x02 (\ref COMMAND_SET_SINGLE)
|
---|
242 | * dataref_update_info | information about the dataref to set and the value itself
|
---|
243 | *
|
---|
244 | * \anchor dataref_update_info \c dataref_update_info has the
|
---|
245 | * following format for scalar values:
|
---|
246 | *
|
---|
247 | * Type | Description
|
---|
248 | * ---- | ------
|
---|
249 | * string | the name of the dataref to set
|
---|
250 | * byte | the type of the dataref, one of the \ref datatypes "TYPE_XXX" constants
|
---|
251 | * dataref's type | the value to set
|
---|
252 | *
|
---|
253 | * \c dataref_update_info has the following format for array values:
|
---|
254 | *
|
---|
255 | * Type | Description
|
---|
256 | * ---- | ------
|
---|
257 | * string | the name of the dataref to set
|
---|
258 | * byte | the type of the dataref, one of the \ref datatypes "TYPE_XXX_ARRAY" constants
|
---|
259 | * 32-bit signed integer | n=the number of items to set
|
---|
260 | * 32-bit signed integer | the offset from which to set the values
|
---|
261 | * n*type of the items | the actual values of the array
|
---|
262 | *
|
---|
263 | * If the command is executed successfully, the reply has the
|
---|
264 | * following format for scalar types:
|
---|
265 | *
|
---|
266 | * Type | Description
|
---|
267 | * ---- | ------
|
---|
268 | * byte | 0x00 (\ref RESULT_OK)
|
---|
269 | *
|
---|
270 | * If an error was encountered, the reply has the following format:
|
---|
271 | *
|
---|
272 | * Type | Description
|
---|
273 | * ---- | ------
|
---|
274 | * byte | the error code
|
---|
275 | *
|
---|
276 | * The following error codes may be returned:
|
---|
277 | *
|
---|
278 | * Code | Meaning
|
---|
279 | * ---- | -------
|
---|
280 | * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
|
---|
281 | * \ref RESULT_INVALID_TYPE | an unknown type code was given
|
---|
282 | * \ref RESULT_INVALID_LENGTH | the length given for an array is too large or not positive
|
---|
283 | * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
|
---|
284 | *
|
---|
285 | * \subsection command_get_multi The GET_MULTI command
|
---|
286 | *
|
---|
287 | * This command can be used to query the values of several datarefs in
|
---|
288 | * one call. It is encoded as follows:
|
---|
289 | *
|
---|
290 | * Type | Description
|
---|
291 | * ---- | ------
|
---|
292 | * byte | 0x03 (\ref COMMAND_GET_MULTI)
|
---|
293 | * 32-bit unsigned integer | n=the number of datarefs to query
|
---|
294 | * n*\ref dataref_query_info | information about the datarefs to query.
|
---|
295 | *
|
---|
296 | * In case of success, the reply is the following:
|
---|
297 | *
|
---|
298 | * Type | Description
|
---|
299 | * ---- | ------
|
---|
300 | * byte | 0x00 (\ref RESULT_OK)
|
---|
301 | * n*\ref dataref_value | the values of the datarefs
|
---|
302 | *
|
---|
303 | * If an error was encountered, the reply has the following format:
|
---|
304 | *
|
---|
305 | * Type | Description
|
---|
306 | * ---- | ------
|
---|
307 | * byte | the error code
|
---|
308 | * 32-bit unsigned integer | if the error code is \ref RESULT_UNKNOWN_DATAREF : the 0-based index of the first dataref that was not found
|
---|
309 | *
|
---|
310 | * The following error codes may be returned:
|
---|
311 | *
|
---|
312 | * Code | Meaning
|
---|
313 | * ---- | -------
|
---|
314 | * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
|
---|
315 | * \ref RESULT_INVALID_TYPE | an unknown type code was given
|
---|
316 | * \ref RESULT_INVALID_LENGTH | the length given for an array is too large
|
---|
317 | * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
|
---|
318 | * \ref RESULT_INVALID_COUNT | the number of datarefs was either 0 or too large
|
---|
319 | *
|
---|
320 | * \subsection command_set_multi The SET_MULTI command
|
---|
321 | *
|
---|
322 | * This command can be used to set the values of several datarefs in
|
---|
323 | * one call. It is encoded as follows:
|
---|
324 | *
|
---|
325 | * Type | Description
|
---|
326 | * ---- | ------
|
---|
327 | * byte | 0x04 (\ref COMMAND_SET_MULTI)
|
---|
328 | * 32-bit unsigned integer | n=the number of datarefs to set
|
---|
329 | * n*\ref dataref_update_info | information about the datarefs to set
|
---|
330 | *
|
---|
331 | * In case of success, the reply is the following:
|
---|
332 | *
|
---|
333 | * Type | Description
|
---|
334 | * ---- | ------
|
---|
335 | * byte | 0x00 (\ref RESULT_OK)
|
---|
336 | *
|
---|
337 | * If an error was encountered, the reply has the following format:
|
---|
338 | *
|
---|
339 | * Type | Description
|
---|
340 | * ---- | ------
|
---|
341 | * byte | the error code
|
---|
342 | * 32-bit unsigned integer | if the error code is \ref RESULT_UNKNOWN_DATAREF : the 0-based index of the first dataref that was not found
|
---|
343 | *
|
---|
344 | * The following error codes may be returned:
|
---|
345 | *
|
---|
346 | * Code | Meaning
|
---|
347 | * ---- | -------
|
---|
348 | * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
|
---|
349 | * \ref RESULT_INVALID_TYPE | an unknown type code was given
|
---|
350 | * \ref RESULT_INVALID_LENGTH | the length given for an array is too large or not positive
|
---|
351 | * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
|
---|
352 | * \ref RESULT_INVALID_COUNT | the number of datarefs was either 0 or too large
|
---|
353 | *
|
---|
354 | * \subsection command_register_get_multi The REGISTER_GET_MULTI command
|
---|
355 | *
|
---|
356 | * This command can be used to register a multi-dataref query. A
|
---|
357 | * multi-dataref query is a list of datarefs that are queried
|
---|
358 | * together. The query will be associated with an identifier that can
|
---|
359 | * be used later to refer to the query when actually querying the
|
---|
360 | * values or when unregistering it. The identifier is unique only for
|
---|
361 | * the client connection and among the multi-dataref queries.
|
---|
362 | *
|
---|
363 | * Type | Description
|
---|
364 | * ---- | ------
|
---|
365 | * byte | 0x11 (\ref COMMAND_REGISTER_GET_MULTI)
|
---|
366 | * 32-bit unsigned integer | n=the number of datarefs to query
|
---|
367 | * n*\ref dataref_query_info | information about the datarefs to query.
|
---|
368 | *
|
---|
369 | * In case of success, the reply is the following:
|
---|
370 | *
|
---|
371 | * Type | Description
|
---|
372 | * ---- | ------
|
---|
373 | * byte | 0x00 (\ref RESULT_OK)
|
---|
374 | * 32-bit unsigned integer | the identifier of the registered query
|
---|
375 | *
|
---|
376 | * If an error was encountered, the reply has the following format:
|
---|
377 | *
|
---|
378 | * Type | Description
|
---|
379 | * ---- | ------
|
---|
380 | * byte | the error code
|
---|
381 | *
|
---|
382 | * The following error codes may be returned:
|
---|
383 | *
|
---|
384 | * Code | Meaning
|
---|
385 | * ---- | -------
|
---|
386 | * \ref RESULT_INVALID_TYPE | an unknown type code was given
|
---|
387 | * \ref RESULT_INVALID_LENGTH | the length given for an array is too large
|
---|
388 | * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
|
---|
389 | * \ref RESULT_INVALID_COUNT | the number of datarefs was either 0 or too large
|
---|
390 | *
|
---|
391 | * \subsection command_unregister_get_multi The UNREGISTER_GET_MULTI command
|
---|
392 | *
|
---|
393 | * This command can be used to unregister a previously registered
|
---|
394 | * multi-dataref query.
|
---|
395 | *
|
---|
396 | * Type | Description
|
---|
397 | * ---- | ------
|
---|
398 | * byte | 0x12 (\ref COMMAND_UNREGISTER_GET_MULTI)
|
---|
399 | * 32-bit unsigned integer | the identifier of the query to unregister
|
---|
400 | *
|
---|
401 | * In case of success, the reply is the following:
|
---|
402 | *
|
---|
403 | * Type | Description
|
---|
404 | * ---- | ------
|
---|
405 | * byte | 0x00 (\ref RESULT_OK)
|
---|
406 | *
|
---|
407 | * If an error was encountered, the reply has the following format:
|
---|
408 | *
|
---|
409 | * Type | Description
|
---|
410 | * ---- | ------
|
---|
411 | * byte | the error code
|
---|
412 | *
|
---|
413 | * The following error codes may be returned:
|
---|
414 | *
|
---|
415 | * Code | Meaning
|
---|
416 | * ---- | -------
|
---|
417 | * \ref RESULT_INVALID_ID | an identifier was given that is not associated with any registered query
|
---|
418 | *
|
---|
419 | * \subsection command_execute_get_multi The EXECUTE_GET_MULTI command
|
---|
420 | *
|
---|
421 | * This command can be used to execute a previously registered
|
---|
422 | * multi-dataref query.
|
---|
423 | *
|
---|
424 | * Type | Description
|
---|
425 | * ---- | ------
|
---|
426 | * byte | 0x13 (\ref COMMAND_EXECUTE_GET_MULTI)
|
---|
427 | * 32-bit unsigned integer | the identifier of the query to execute
|
---|
428 | *
|
---|
429 | * In case of success, the reply is the following:
|
---|
430 | *
|
---|
431 | * Type | Description
|
---|
432 | * ---- | ------
|
---|
433 | * byte | 0x00 (\ref RESULT_OK)
|
---|
434 | * n*\ref dataref_value | the values of the datarefs, n is the number of them
|
---|
435 | *
|
---|
436 | * If an error was encountered, the reply has the following format:
|
---|
437 | *
|
---|
438 | * Type | Description
|
---|
439 | * ---- | ------
|
---|
440 | * byte | the error code
|
---|
441 | * 32-bit unsigned integer | if the error code is \ref RESULT_UNKNOWN_DATAREF : the 0-based index of the first dataref that was not found
|
---|
442 | *
|
---|
443 | * The following error codes may be returned:
|
---|
444 | *
|
---|
445 | * Code | Meaning
|
---|
446 | * ---- | -------
|
---|
447 | * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
|
---|
448 | * \ref RESULT_INVALID_ID | an identifier was given that is not associated with any registered query
|
---|
449 | *
|
---|
450 | * \subsection command_register_set_multi The REGISTER_SET_MULTI command
|
---|
451 | *
|
---|
452 | * This command can be used to register a multi-dataref update. A
|
---|
453 | * multi-dataref update is a list of datarefs that are updated
|
---|
454 | * together with values supplied for each update. The update will be
|
---|
455 | * associated with an identifier that can be used later to refer to
|
---|
456 | * the update when actually updating the values or when unregistering
|
---|
457 | * it. The identifier is unique only for the client connection and
|
---|
458 | * among the multi-dataref updates.
|
---|
459 | *
|
---|
460 | * Type | Description
|
---|
461 | * ---- | ------
|
---|
462 | * byte | 0x21 (\ref COMMAND_REGISTER_SET_MULTI)
|
---|
463 | * 32-bit unsigned integer | n=the number of datarefs to query
|
---|
464 | * n*\ref dataref_query_info | information about the datarefs to update (this \a is \ref dataref_query_info, because the format is the same, since we don't supply any values)
|
---|
465 | *
|
---|
466 | * In case of success, the reply is the following:
|
---|
467 | *
|
---|
468 | * Type | Description
|
---|
469 | * ---- | ------
|
---|
470 | * byte | 0x00 (\ref RESULT_OK)
|
---|
471 | * 32-bit unsigned integer | the identifier of the registered query
|
---|
472 | *
|
---|
473 | * If an error was encountered, the reply has the following format:
|
---|
474 | *
|
---|
475 | * Type | Description
|
---|
476 | * ---- | ------
|
---|
477 | * byte | the error code
|
---|
478 | *
|
---|
479 | * The following error codes may be returned:
|
---|
480 | *
|
---|
481 | * Code | Meaning
|
---|
482 | * ---- | -------
|
---|
483 | * \ref RESULT_INVALID_TYPE | an unknown type code was given
|
---|
484 | * \ref RESULT_INVALID_LENGTH | the length given for an array is too large or not positive
|
---|
485 | * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
|
---|
486 | * \ref RESULT_INVALID_COUNT | the number of datarefs was either 0 or too large
|
---|
487 | *
|
---|
488 | * \subsection command_unregister_set_multi The UNREGISTER_GET_MULTI command
|
---|
489 | *
|
---|
490 | * This command can be used to unregister a previously registered
|
---|
491 | * multi-dataref update.
|
---|
492 | *
|
---|
493 | * Type | Description
|
---|
494 | * ---- | ------
|
---|
495 | * byte | 0x22 (\ref COMMAND_UNREGISTER_SET_MULTI)
|
---|
496 | * 32-bit unsigned integer | the identifier of the update to unregister
|
---|
497 | *
|
---|
498 | * In case of success, the reply is the following:
|
---|
499 | *
|
---|
500 | * Type | Description
|
---|
501 | * ---- | ------
|
---|
502 | * byte | 0x00 (\ref RESULT_OK)
|
---|
503 | *
|
---|
504 | * If an error was encountered, the reply has the following format:
|
---|
505 | *
|
---|
506 | * Type | Description
|
---|
507 | * ---- | ------
|
---|
508 | * byte | the error code
|
---|
509 | *
|
---|
510 | * The following error codes may be returned:
|
---|
511 | *
|
---|
512 | * Code | Meaning
|
---|
513 | * ---- | -------
|
---|
514 | * \ref RESULT_INVALID_ID | an identifier was given that is not associated with any registered update
|
---|
515 | *
|
---|
516 | * \subsection command_execute_set_multi The EXECUTE_SET_MULTI command
|
---|
517 | *
|
---|
518 | * This command can be used to execute a previously registered
|
---|
519 | * multi-dataref update.
|
---|
520 | *
|
---|
521 | * Type | Description
|
---|
522 | * ---- | ------
|
---|
523 | * byte | 0x23 (\ref COMMAND_EXECUTE_SET_MULTI)
|
---|
524 | * 32-bit unsigned integer | the identifier of the update to execute
|
---|
525 | * n*\ref dataref_value | the values
|
---|
526 | *
|
---|
527 | * In case of success, the reply is the following:
|
---|
528 | *
|
---|
529 | * Type | Description
|
---|
530 | * ---- | ------
|
---|
531 | * byte | 0x00 (\ref RESULT_OK)
|
---|
532 | *
|
---|
533 | * If an error was encountered, the reply has the following format:
|
---|
534 | *
|
---|
535 | * Type | Description
|
---|
536 | * ---- | ------
|
---|
537 | * byte | the error code
|
---|
538 | * 32-bit unsigned integer | if the error code is \ref RESULT_UNKNOWN_DATAREF : the 0-based index of the first dataref that was not found
|
---|
539 | *
|
---|
540 | * The following error codes may be returned:
|
---|
541 | *
|
---|
542 | * Code | Meaning
|
---|
543 | * ---- | -------
|
---|
544 | * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
|
---|
545 | * \ref RESULT_INVALID_ID | an identifier was given that is not associated with any registered query
|
---|
546 | *
|
---|
547 | * \subsection command_get_versions The GET_VERSIONS command
|
---|
548 | *
|
---|
549 | * This command can be used to query the versions of X-Plane, XPLM and
|
---|
550 | * XPLRA itself.
|
---|
551 | *
|
---|
552 | * Type | Description
|
---|
553 | * ---- | ------
|
---|
554 | * byte | 0x31 (\ref COMMAND_GET_VERSIONS)
|
---|
555 | *
|
---|
556 | * The reply is encoded the following way (it shall never fail):
|
---|
557 | *
|
---|
558 | * Type | Description
|
---|
559 | * ---- | ------
|
---|
560 | * byte | 0x00 (\ref RESULT_OK)
|
---|
561 | * 32-bit signed integer | the version of X-Plane. For 10.20r1 it is 10201.
|
---|
562 | * 32-bit signed integer | the version of XPLM. For 2.10 it is 210.
|
---|
563 | * 32-bit signed integer | the version of XPLRA. For 0.1 it is 10.
|
---|
564 | *
|
---|
565 | * \subsection command_reload_plugins The RELOAD_PLUGINS command
|
---|
566 | *
|
---|
567 | * This command can be used to reload the plugins in X-Plane. This is
|
---|
568 | * useful for debugging.
|
---|
569 | *
|
---|
570 | * Type | Description
|
---|
571 | * ---- | ------
|
---|
572 | * byte | 0x32 (\ref COMMAND_RELOAD_PLUGINS)
|
---|
573 | *
|
---|
574 | * The reply is encoded the following way (it shall never fail):
|
---|
575 | *
|
---|
576 | * Type | Description
|
---|
577 | * ---- | ------
|
---|
578 | * byte | 0x00 (\ref RESULT_OK)
|
---|
579 | *
|
---|
580 | * \subsection command_get_versions The GET_VERSIONS command
|
---|
581 | *
|
---|
582 | * This command can be used to query the versions of X-Plane, XPLM and
|
---|
583 | * XPLRA itself.
|
---|
584 | *
|
---|
585 | * Type | Description
|
---|
586 | * ---- | ------
|
---|
587 | * byte | 0x31 (\ref COMMAND_GET_VERSIONS)
|
---|
588 | *
|
---|
589 | * The reply is encoded the following way (it shall never fail):
|
---|
590 | *
|
---|
591 | * Type | Description
|
---|
592 | * ---- | ------
|
---|
593 | * byte | 0x00 (\ref RESULT_OK)
|
---|
594 | * 32-bit signed integer | the version of X-Plane. For 10.20r1 it is 10201.
|
---|
595 | * 32-bit signed integer | the version of XPLM. For 2.10 it is 210.
|
---|
596 | * 32-bit signed integer | the version of XPLRA. For 0.1 it is 10.
|
---|
597 | *
|
---|
598 | * \subsection command_show_message The SHOW_MESSAGE command
|
---|
599 | *
|
---|
600 | * This command can be used to show a message in a window to the
|
---|
601 | * user. The window is a single line window around the top 1/3rd of
|
---|
602 | * the screen. It can be moved and resized by mouse actions. If a
|
---|
603 | * message is being displayed when this command is issued, that
|
---|
604 | * message will be replaced by the new one.
|
---|
605 | *
|
---|
606 | * Type | Description
|
---|
607 | * ---- | ------
|
---|
608 | * byte | 0x41 (\ref COMMAND_SHOW_MESSAGE)
|
---|
609 | * string | the message to show
|
---|
610 | * float | the duration of the message in seconds
|
---|
611 | *
|
---|
612 | * If successful, the reply is the following:
|
---|
613 | *
|
---|
614 | * Type | Description
|
---|
615 | * ---- | ------
|
---|
616 | * byte | 0x00 (\ref RESULT_OK)
|
---|
617 | *
|
---|
618 | * If an error was encountered, the reply has the following format:
|
---|
619 | *
|
---|
620 | * Type | Description
|
---|
621 | * ---- | ------
|
---|
622 | * byte | the error code
|
---|
623 | *
|
---|
624 | * The following error codes may be returned:
|
---|
625 | *
|
---|
626 | * Code | Meaning
|
---|
627 | * ---- | -------
|
---|
628 | * \ref RESULT_INVALID_DURATION | the duration is too large
|
---|
629 | *
|
---|
630 | * \subsection command_register_hotkeys The REGISTER_HOTKEYS command
|
---|
631 | *
|
---|
632 | * This command can be used to register a set of hotkeys to be
|
---|
633 | * monitored. If any other hotkeys have been registered by the current
|
---|
634 | * client previously, they are forgotten.
|
---|
635 | *
|
---|
636 | * Type | Description
|
---|
637 | * ---- | ------
|
---|
638 | * byte | 0x51 (\ref COMMAND_REGISTER_HOTKEYS)
|
---|
639 | * 32-bit unsigned integer | n=the number of the hotkeys
|
---|
640 | * n * 16-bit unsigned integer | the codes of the hotkeys
|
---|
641 | *
|
---|
642 | * The lower-byte of a hotkey code is the same as the X-Plane virtual
|
---|
643 | * key code. The upper byte is a logical OR of zero or more modifiers:
|
---|
644 | *
|
---|
645 | * Value | Description | Constant name
|
---|
646 | * --: | --- | ---
|
---|
647 | * 0x0100 | Shift modifier | HOTKEY_MODIFIER_SHIFT
|
---|
648 | * 0x0200 | Control modifier | HOTKEY_MODIFIER_CONTROL
|
---|
649 | *
|
---|
650 | * If successful, the reply is the following:
|
---|
651 | *
|
---|
652 | * Type | Description
|
---|
653 | * ---- | ------
|
---|
654 | * byte | 0x00 (\ref RESULT_OK)
|
---|
655 | *
|
---|
656 | * If an error was encountered, the reply has the following format:
|
---|
657 | *
|
---|
658 | * Type | Description
|
---|
659 | * ---- | ------
|
---|
660 | * byte | the error code
|
---|
661 | *
|
---|
662 | * The following error codes may be returned:
|
---|
663 | *
|
---|
664 | * Code | Meaning
|
---|
665 | * ---- | -------
|
---|
666 | * \ref RESULT_INVALID_LENGTH | too many hotkeys were given
|
---|
667 | *
|
---|
668 | * \subsection command_query_hotkeys The QUERY_HOTKEYS command
|
---|
669 | *
|
---|
670 | * This command can be used to query which hotkeys have been pressed
|
---|
671 | * since the last query.
|
---|
672 | *
|
---|
673 | * Type | Description
|
---|
674 | * ---- | ------
|
---|
675 | * byte | 0x52 (\ref COMMAND_QUERY_HOTKEYS)
|
---|
676 | *
|
---|
677 | * The reply is the following:
|
---|
678 | *
|
---|
679 | * Type | Description
|
---|
680 | * ---- | ------
|
---|
681 | * byte | 0x00 (\ref RESULT_OK)
|
---|
682 | * 32-bit unsigned integer | n = the number of hotkeys registered
|
---|
683 | * n * 8-bit unsigned integer | each byte is 0 or 1 depending whether the corresponding hotkeys was pressed or not. The value at index i corresponds to the hotkey code at index i in the array passed with \ref command_register_hotkeys "COMMAND_REGISTER_HOTKEYS"
|
---|
684 | *
|
---|
685 | * \subsection command_unregister_hotkeys The UNREGISTER_HOTKEYS command
|
---|
686 | *
|
---|
687 | * This command can be used to unregister a previously registered set
|
---|
688 | * of hotkeys to be monitored.
|
---|
689 | *
|
---|
690 | * Type | Description
|
---|
691 | * ---- | ------
|
---|
692 | * byte | 0x53 (\ref COMMAND_UNREGISTER_HOTKEYS)
|
---|
693 | *
|
---|
694 | * The reply is the following:
|
---|
695 | *
|
---|
696 | * Type | Description
|
---|
697 | * ---- | ------
|
---|
698 | * byte | 0x00 (\ref RESULT_OK)
|
---|
699 | */
|
---|