source: xplra/doc/overview.dox@ 114:0e60b2a26b42

Last change on this file since 114:0e60b2a26b42 was 86:f7714df5165f, checked in by István Váradi <ivaradi@…>, 12 years ago

Added the documentation of COMMAND_SAVE_SITUTATION

File size: 33.1 KB
Line 
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 \ref cppapi "C, C++" and \ref pythonapi "Python",
28 * the communication protocol between clients and the plugin is open
29 * and is \ref proto "described" in this documentation. So you can
30 * write your own client library, if you wish.
31 */
32/*! \page proto Protocol
33 *
34 * On Linux a Unix stream socket is created with the name
35 * \c /tmp/xplra-\<user name\>, where \c \<user name\> is the login
36 * account name of the user running X-Plane. On Windows a named pipe
37 * is created with the name \c \\\\\.\\pipe\\xplra. The usual methods
38 * provided by the OS can be used to connect to these.
39 *
40 * The protocol is a binary protocol. The client initiates commands
41 * which are executed by the plugin. Each command is a byte followed
42 * by the arguments of the command. The plugin responds with a result
43 * code, which is also a byte, which may be followed by the rest of
44 * the reply, e.g. the data queried or a parameter to an error code.
45 *
46 * \section protodata Types of protocol data elements
47 *
48 * The protocol's basic data elements are: 8-, 16- and 32-bit signed
49 * and unsigned integers, single and double precision floating point
50 * values and strings. The endianness of the values is that of the
51 * host operating system.
52
53 * Strings are encoded as a variable-length length followed by as many
54 * bytes making up the actual contents of the string. The
55 * variable-length length consists of bytes whose most-significant bit
56 * is 1, if there is another byte and 0 for the last byte. The first
57 * byte contains the least significant 7 bits of the length, the
58 * second byte contains bits 7-13, and so on. Some examples:
59 * - 12 => 0x0c
60 * - 123 => 0x7b
61 * - 128 => 0x80 0x01
62 * - 210 => 0xd2 0x01
63 * - 7345 => 0xb1 0x39
64 * - 90000 => 0x90 0xbf 0x05
65 *
66 * \section datatypes Data type codes
67 *
68 * Each dataref of X-Plane has a certain data type, and some datarefs
69 * can represent their values in multiple data types. Because of this
70 * ambiguity and the fact that users should know the data type anyway,
71 * especially when using a strongly typed language, the type should be
72 * sent with the dataref name in commands that refer to one or more
73 * datarefs.
74 *
75 * Each data type is represented as an 8-bit unsigned integer, whose
76 * possible values are given in the table below:
77 *
78 * Data type | Value | Constant name
79 * --------- | ----: | -------------
80 * 32-bit signed integer | 0x01 | \anchor TYPE_INT TYPE_INT
81 * single-precision floating-point value | 0x02 | \anchor TYPE_FLOAT TYPE_FLOAT
82 * double-precision floating-point value | 0x03 | \anchor TYPE_DOUBLE TYPE_DOUBLE
83 * array of single-precision floating-point values | 0x11 | \anchor TYPE_FLOAT_ARRAY TYPE_FLOAT_ARRAY
84 * array of 32-bit signed integers | 0x12 | \anchor TYPE_INT_ARRAY TYPE_INT_ARRAY
85 * array of 8-bit unsigned integers (bytes) | 0x13 | \anchor TYPE_BYTE_ARRAY TYPE_BYTE_ARRAY
86 *
87 * The constant name is the name used in both client APIs to identify
88 * the given type.
89 *
90 * The scalar data types are encoded as in the following table:
91 *
92 * Data type constant | Encoding
93 * ------------------ | --------
94 * \ref TYPE_INT | a 32-bit (4-byte) signed integer
95 * \ref TYPE_FLOAT | a 32-bit (4-byte) IEEE 754 single-precision floating point value
96 * \ref TYPE_DOUBLE | a 64-bit (8-byte) IEEE 754 double-precision floating point value
97 *
98 * The contents of an array is encoded as a sequence of values of the
99 * items' type. It is usually preceded by a 32-bit signed integer
100 * denoting the number of items and sometimes also by another 32-bit
101 * signed integer denoting the offset into the array.
102 *
103 * \section resultcodes Result codes
104 *
105 * The first byte of the reply message to each command is a result
106 * code. If the command could be executed properly, it is RESULT_OK
107 * followed by the results of the command if any, otherwise it is
108 * another code signifying some error. Most error codes are followed
109 * by no further data, but \ref RESULT_UNKNOWN_DATAREF may be followed by
110 * an index if a multi-dataref request is issued.
111 *
112 * The table summarizes the error codes:
113 *
114 * Meaning | Value | Constant name
115 * ------- | ----- | -------------
116 * Success, everything is OK | 0x00 | \anchor RESULT_OK RESULT_OK
117 * Invalid command | 0x01 | \anchor RESULT_INVALID_COMMAND RESULT_INVALID_COMMAND
118 * Unknown dataref | 0x02 | \anchor RESULT_UNKNOWN_DATAREF RESULT_UNKNOWN_DATAREF
119 * Invalid data type | 0x03 | \anchor RESULT_INVALID_TYPE RESULT_INVALID_TYPE
120 * Invalid length | 0x04 | \anchor RESULT_INVALID_LENGTH RESULT_INVALID_LENGTH
121 * Invalid offset | 0x05 | \anchor RESULT_INVALID_OFFSET RESULT_INVALID_OFFSET
122 * Invalid count | 0x06 | \anchor RESULT_INVALID_COUNT RESULT_INVALID_COUNT
123 * Invalid ID | 0x07 | \anchor RESULT_INVALID_ID RESULT_INVALID_ID
124 * Invalid duration | 0x08 | \anchor RESULT_INVALID_DURATION RESULT_INVALID_DURATION
125 * Other error | 0xff | \anchor RESULT_OTHER_ERROR RESULT_OTHER_ERROR
126 *
127 * \section limits Limits
128 *
129 * Certain parameters have limits, which are summarized in the
130 * following table:
131 *
132 * Description | Limit
133 * ------- | -----
134 * maximal number of array items | 2048
135 * maximal number of datarefs in a multi-dataref operation | 1024
136 * maximal duration of a message | 5 minutes
137 * maximal number of hotkeys that can be registered | 128
138 *
139 * \section commands Commands
140 *
141 * This section describes the commands of the protocol with their
142 * parameters and the possible replies. Each command is represented by
143 * an 8-bit unsigned value, which is the first byte of the
144 * message. The table below summarizes the commands with their command
145 * byte and constant names:
146 *
147 * Description | Command byte | Constant Name
148 * ----------- | -----------: | -------------
149 * \ref command_get_single "Query the value of a single dataref" | 0x01 | \anchor COMMAND_GET_SINGLE COMMAND_GET_SINGLE
150 * \ref command_set_single "Set the value of a single dataref" | 0x02 | \anchor COMMAND_SET_SINGLE COMMAND_SET_SINGLE
151 * \ref command_get_multi "Query the values of multiple datarefs" | 0x03 | \anchor COMMAND_GET_MULTI COMMAND_GET_MULTI
152 * \ref command_set_multi "Set the values of multiple datarefs" | 0x04 | \anchor COMMAND_SET_MULTI COMMAND_SET_MULTI
153 * \ref command_register_get_multi "Register a multi-dataref query" | 0x11 | \anchor COMMAND_REGISTER_GET_MULTI COMMAND_REGISTER_GET_MULTI
154 * \ref command_unregister_get_multi "Unregister a multi-dataref query" | 0x12 | \anchor COMMAND_UNREGISTER_GET_MULTI COMMAND_UNREGISTER_GET_MULTI
155 * \ref command_execute_get_multi "Execute a registered multi-dataref query" | 0x13 | \anchor COMMAND_EXECUTE_GET_MULTI COMMAND_EXECUTE_GET_MULTI
156 * \ref command_register_set_multi "Register a multi-dataref update request" | 0x21 | \anchor COMMAND_REGISTER_SET_MULTI COMMAND_REGISTER_SET_MULTI
157 * \ref command_unregister_set_multi "Unregister a multi-dataref update request" | 0x22 | \anchor COMMAND_UNREGISTER_SET_MULTI COMMAND_UNREGISTER_SET_MULTI
158 * \ref command_execute_set_multi "Execute a registered multi-dataref update request" | 0x23 | \anchor COMMAND_EXECUTE_SET_MULTI COMMAND_EXECUTE_SET_MULTI
159 * \ref command_get_versions "Query the versions of X-Plane, XPLM and XPLRA" | 0x31 | \anchor COMMAND_GET_VERSIONS COMMAND_GET_VERSIONS
160 * \ref command_reload_plugins "Reload the plugins in X-Plane" | 0x32 | \anchor COMMAND_RELOAD_PLUGINS COMMAND_RELOAD_PLUGINS
161 * \ref command_save_situation "Save the current situation" | 0x33 | \anchor COMMAND_SAVE_SITUATION COMMAND_SAVE_SITUATION
162 * \ref command_show_message "Show a message in X-Plane's window" | 0x41 | \anchor COMMAND_SHOW_MESSAGE COMMAND_SHOW_MESSAGE
163 * \ref command_register_hotkeys "Register hotkeys to be listened to" | 0x51 | \anchor COMMAND_REGISTER_HOTKEYS COMMAND_REGISTER_HOTKEYS
164 * \ref command_query_hotkeys "Query the sate of the registered hotkeys" | 0x52 | \anchor COMMAND_QUERY_HOTKEYS COMMAND_QUERY_HOTKEYS
165 * \ref command_unregister_hotkeys "Unregister the previously registered hotkets" | 0x53 | \anchor COMMAND_UNREGISTER_HOTKEYS COMMAND_UNREGISTER_HOTKEYS
166 *
167 * \subsection command_get_single The GET_SINGLE command
168 *
169 * This command can be used to query the value of a single
170 * dataref. Such a data can either be a scalar (integer, float or
171 * double) or an array of floats, integers or bytes.
172 *
173 * The format of the command is the following:
174 *
175 * Type | Description
176 * ---- | ------
177 * byte | 0x01 (\ref COMMAND_GET_SINGLE)
178 * dataref_query_info | information about the dataref to query
179 *
180 * \anchor dataref_query_info \c dataref_query_info has the following
181 * format for scalar types:
182 *
183 * Type | Description
184 * ---- | ------
185 * string | the name of the dataref to query
186 * byte | the type of the dataref, one of the \ref datatypes "TYPE_XXX" constants
187 *
188 * \c dataref_query_info has the following format for array types:
189 *
190 * Type | Description
191 * ---- | ------
192 * string | the name of the dataref to query
193 * byte | the type of the dataref, one of the \ref datatypes "TYPE_XXX_ARRAY" constants
194 * 32-bit signed integer | the number of items to query, -1 to query all items
195 * 32-bit signed integer | the offset of the data within the array to query
196 *
197 * If the command is executed successfully, the reply has the
198 * following format for scalar types:
199 *
200 * Type | Description
201 * ---- | ------
202 * byte | 0x00 (\ref RESULT_OK)
203 * dataref_value | the value of the dataref
204 *
205 * \anchor dataref_value dataref_value is encoded as follows for scalar types:
206 *
207 * Type | Description
208 * ---- | ------
209 * scalar type | the value of the dataref
210 *
211 * dataref_value is encoded as follows for array types:
212 *
213 * Type | Description
214 * ---- | ------
215 * 32-bit signed integer | n=the number of items returned
216 * n*type of the items | the data items themselves
217 *
218 * In case of an error:
219 *
220 * Type | Description
221 * ---- | ------
222 * byte | the error code
223 *
224 * The following error codes may be returned:
225 *
226 * Code | Meaning
227 * ---- | -------
228 * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
229 * \ref RESULT_INVALID_TYPE | an unknown type code was given
230 * \ref RESULT_INVALID_LENGTH | the length given for an array is too large
231 * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
232 *
233 * \subsection command_set_single The SET_SINGLE command
234 *
235 * This command can be used to set the value of a single
236 * dataref. Such a data can either be a scalar (integer, float or
237 * double) or an array of floats, integers or bytes.
238 *
239 * The format of the command is the following for scalar values:
240 *
241 * Type | Description
242 * ---- | ------
243 * byte | 0x02 (\ref COMMAND_SET_SINGLE)
244 * dataref_update_info | information about the dataref to set and the value itself
245 *
246 * \anchor dataref_update_info \c dataref_update_info has the
247 * following format for scalar values:
248 *
249 * Type | Description
250 * ---- | ------
251 * string | the name of the dataref to set
252 * byte | the type of the dataref, one of the \ref datatypes "TYPE_XXX" constants
253 * dataref's type | the value to set
254 *
255 * \c dataref_update_info has the following format for array values:
256 *
257 * Type | Description
258 * ---- | ------
259 * string | the name of the dataref to set
260 * byte | the type of the dataref, one of the \ref datatypes "TYPE_XXX_ARRAY" constants
261 * 32-bit signed integer | n=the number of items to set
262 * 32-bit signed integer | the offset from which to set the values
263 * n*type of the items | the actual values of the array
264 *
265 * If the command is executed successfully, the reply has the
266 * following format for scalar types:
267 *
268 * Type | Description
269 * ---- | ------
270 * byte | 0x00 (\ref RESULT_OK)
271 *
272 * If an error was encountered, the reply has the following format:
273 *
274 * Type | Description
275 * ---- | ------
276 * byte | the error code
277 *
278 * The following error codes may be returned:
279 *
280 * Code | Meaning
281 * ---- | -------
282 * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
283 * \ref RESULT_INVALID_TYPE | an unknown type code was given
284 * \ref RESULT_INVALID_LENGTH | the length given for an array is too large or not positive
285 * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
286 *
287 * \subsection command_get_multi The GET_MULTI command
288 *
289 * This command can be used to query the values of several datarefs in
290 * one call. It is encoded as follows:
291 *
292 * Type | Description
293 * ---- | ------
294 * byte | 0x03 (\ref COMMAND_GET_MULTI)
295 * 32-bit unsigned integer | n=the number of datarefs to query
296 * n*\ref dataref_query_info | information about the datarefs to query.
297 *
298 * In case of success, the reply is the following:
299 *
300 * Type | Description
301 * ---- | ------
302 * byte | 0x00 (\ref RESULT_OK)
303 * n*\ref dataref_value | the values of the datarefs
304 *
305 * If an error was encountered, the reply has the following format:
306 *
307 * Type | Description
308 * ---- | ------
309 * byte | the error code
310 * 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
311 *
312 * The following error codes may be returned:
313 *
314 * Code | Meaning
315 * ---- | -------
316 * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
317 * \ref RESULT_INVALID_TYPE | an unknown type code was given
318 * \ref RESULT_INVALID_LENGTH | the length given for an array is too large
319 * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
320 * \ref RESULT_INVALID_COUNT | the number of datarefs was either 0 or too large
321 *
322 * \subsection command_set_multi The SET_MULTI command
323 *
324 * This command can be used to set the values of several datarefs in
325 * one call. It is encoded as follows:
326 *
327 * Type | Description
328 * ---- | ------
329 * byte | 0x04 (\ref COMMAND_SET_MULTI)
330 * 32-bit unsigned integer | n=the number of datarefs to set
331 * n*\ref dataref_update_info | information about the datarefs to set
332 *
333 * In case of success, the reply is the following:
334 *
335 * Type | Description
336 * ---- | ------
337 * byte | 0x00 (\ref RESULT_OK)
338 *
339 * If an error was encountered, the reply has the following format:
340 *
341 * Type | Description
342 * ---- | ------
343 * byte | the error code
344 * 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
345 *
346 * The following error codes may be returned:
347 *
348 * Code | Meaning
349 * ---- | -------
350 * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
351 * \ref RESULT_INVALID_TYPE | an unknown type code was given
352 * \ref RESULT_INVALID_LENGTH | the length given for an array is too large or not positive
353 * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
354 * \ref RESULT_INVALID_COUNT | the number of datarefs was either 0 or too large
355 *
356 * \subsection command_register_get_multi The REGISTER_GET_MULTI command
357 *
358 * This command can be used to register a multi-dataref query. A
359 * multi-dataref query is a list of datarefs that are queried
360 * together. The query will be associated with an identifier that can
361 * be used later to refer to the query when actually querying the
362 * values or when unregistering it. The identifier is unique only for
363 * the client connection and among the multi-dataref queries.
364 *
365 * Type | Description
366 * ---- | ------
367 * byte | 0x11 (\ref COMMAND_REGISTER_GET_MULTI)
368 * 32-bit unsigned integer | n=the number of datarefs to query
369 * n*\ref dataref_query_info | information about the datarefs to query.
370 *
371 * In case of success, the reply is the following:
372 *
373 * Type | Description
374 * ---- | ------
375 * byte | 0x00 (\ref RESULT_OK)
376 * 32-bit unsigned integer | the identifier of the registered query
377 *
378 * If an error was encountered, the reply has the following format:
379 *
380 * Type | Description
381 * ---- | ------
382 * byte | the error code
383 *
384 * The following error codes may be returned:
385 *
386 * Code | Meaning
387 * ---- | -------
388 * \ref RESULT_INVALID_TYPE | an unknown type code was given
389 * \ref RESULT_INVALID_LENGTH | the length given for an array is too large
390 * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
391 * \ref RESULT_INVALID_COUNT | the number of datarefs was either 0 or too large
392 *
393 * \subsection command_unregister_get_multi The UNREGISTER_GET_MULTI command
394 *
395 * This command can be used to unregister a previously registered
396 * multi-dataref query.
397 *
398 * Type | Description
399 * ---- | ------
400 * byte | 0x12 (\ref COMMAND_UNREGISTER_GET_MULTI)
401 * 32-bit unsigned integer | the identifier of the query to unregister
402 *
403 * In case of success, the reply is the following:
404 *
405 * Type | Description
406 * ---- | ------
407 * byte | 0x00 (\ref RESULT_OK)
408 *
409 * If an error was encountered, the reply has the following format:
410 *
411 * Type | Description
412 * ---- | ------
413 * byte | the error code
414 *
415 * The following error codes may be returned:
416 *
417 * Code | Meaning
418 * ---- | -------
419 * \ref RESULT_INVALID_ID | an identifier was given that is not associated with any registered query
420 *
421 * \subsection command_execute_get_multi The EXECUTE_GET_MULTI command
422 *
423 * This command can be used to execute a previously registered
424 * multi-dataref query.
425 *
426 * Type | Description
427 * ---- | ------
428 * byte | 0x13 (\ref COMMAND_EXECUTE_GET_MULTI)
429 * 32-bit unsigned integer | the identifier of the query to execute
430 *
431 * In case of success, the reply is the following:
432 *
433 * Type | Description
434 * ---- | ------
435 * byte | 0x00 (\ref RESULT_OK)
436 * n*\ref dataref_value | the values of the datarefs, n is the number of them
437 *
438 * If an error was encountered, the reply has the following format:
439 *
440 * Type | Description
441 * ---- | ------
442 * byte | the error code
443 * 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
444 *
445 * The following error codes may be returned:
446 *
447 * Code | Meaning
448 * ---- | -------
449 * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
450 * \ref RESULT_INVALID_ID | an identifier was given that is not associated with any registered query
451 *
452 * \subsection command_register_set_multi The REGISTER_SET_MULTI command
453 *
454 * This command can be used to register a multi-dataref update. A
455 * multi-dataref update is a list of datarefs that are updated
456 * together with values supplied for each update. The update will be
457 * associated with an identifier that can be used later to refer to
458 * the update when actually updating the values or when unregistering
459 * it. The identifier is unique only for the client connection and
460 * among the multi-dataref updates.
461 *
462 * Type | Description
463 * ---- | ------
464 * byte | 0x21 (\ref COMMAND_REGISTER_SET_MULTI)
465 * 32-bit unsigned integer | n=the number of datarefs to query
466 * 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)
467 *
468 * In case of success, the reply is the following:
469 *
470 * Type | Description
471 * ---- | ------
472 * byte | 0x00 (\ref RESULT_OK)
473 * 32-bit unsigned integer | the identifier of the registered query
474 *
475 * If an error was encountered, the reply has the following format:
476 *
477 * Type | Description
478 * ---- | ------
479 * byte | the error code
480 *
481 * The following error codes may be returned:
482 *
483 * Code | Meaning
484 * ---- | -------
485 * \ref RESULT_INVALID_TYPE | an unknown type code was given
486 * \ref RESULT_INVALID_LENGTH | the length given for an array is too large or not positive
487 * \ref RESULT_INVALID_OFFSET | the offset given for an array is negative
488 * \ref RESULT_INVALID_COUNT | the number of datarefs was either 0 or too large
489 *
490 * \subsection command_unregister_set_multi The UNREGISTER_GET_MULTI command
491 *
492 * This command can be used to unregister a previously registered
493 * multi-dataref update.
494 *
495 * Type | Description
496 * ---- | ------
497 * byte | 0x22 (\ref COMMAND_UNREGISTER_SET_MULTI)
498 * 32-bit unsigned integer | the identifier of the update to unregister
499 *
500 * In case of success, the reply is the following:
501 *
502 * Type | Description
503 * ---- | ------
504 * byte | 0x00 (\ref RESULT_OK)
505 *
506 * If an error was encountered, the reply has the following format:
507 *
508 * Type | Description
509 * ---- | ------
510 * byte | the error code
511 *
512 * The following error codes may be returned:
513 *
514 * Code | Meaning
515 * ---- | -------
516 * \ref RESULT_INVALID_ID | an identifier was given that is not associated with any registered update
517 *
518 * \subsection command_execute_set_multi The EXECUTE_SET_MULTI command
519 *
520 * This command can be used to execute a previously registered
521 * multi-dataref update.
522 *
523 * Type | Description
524 * ---- | ------
525 * byte | 0x23 (\ref COMMAND_EXECUTE_SET_MULTI)
526 * 32-bit unsigned integer | the identifier of the update to execute
527 * n*\ref dataref_value | the values
528 *
529 * In case of success, the reply is the following:
530 *
531 * Type | Description
532 * ---- | ------
533 * byte | 0x00 (\ref RESULT_OK)
534 *
535 * If an error was encountered, the reply has the following format:
536 *
537 * Type | Description
538 * ---- | ------
539 * byte | the error code
540 * 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
541 *
542 * The following error codes may be returned:
543 *
544 * Code | Meaning
545 * ---- | -------
546 * \ref RESULT_UNKNOWN_DATAREF | the dataref with the given name was not found
547 * \ref RESULT_INVALID_ID | an identifier was given that is not associated with any registered query
548 *
549 * \subsection command_get_versions The GET_VERSIONS command
550 *
551 * This command can be used to query the versions of X-Plane, XPLM and
552 * XPLRA itself.
553 *
554 * Type | Description
555 * ---- | ------
556 * byte | 0x31 (\ref COMMAND_GET_VERSIONS)
557 *
558 * The reply is encoded the following way (it shall never fail):
559 *
560 * Type | Description
561 * ---- | ------
562 * byte | 0x00 (\ref RESULT_OK)
563 * 32-bit signed integer | the version of X-Plane. For 10.20r1 it is 10201.
564 * 32-bit signed integer | the version of XPLM. For 2.10 it is 210.
565 * 32-bit signed integer | the version of XPLRA. For 0.1 it is 10.
566 *
567 * \subsection command_reload_plugins The RELOAD_PLUGINS command
568 *
569 * This command can be used to reload the plugins in X-Plane. This is
570 * useful for debugging.
571 *
572 * Type | Description
573 * ---- | ------
574 * byte | 0x32 (\ref COMMAND_RELOAD_PLUGINS)
575 *
576 * The reply is encoded the following way (it shall never fail):
577 *
578 * Type | Description
579 * ---- | ------
580 * byte | 0x00 (\ref RESULT_OK)
581 *
582 * \subsection command_save_situation The SAVE_SITUATION command
583 *
584 * This command can be used to save the current situation into a file.
585 * It is available only on X-Plane 10 or later.
586 *
587 * Type | Description
588 * ---- | ------
589 * byte | 0x33 (\ref COMMAND_SAVE_SITUATION)
590 * string | the path of the file to save the situation into, relative to the X-Plane directory
591 *
592 * If successful, the reply is the following:
593 *
594 * Type | Description
595 * ---- | ------
596 * byte | 0x00 (\ref RESULT_OK)
597 *
598 * If an error was encountered, the reply is the following (no error could be produced yet,
599 * but it might fail).
600 *
601 * Type | Description
602 * ---- | ------
603 * byte | 0xff (\ref RESULT_OTHER_ERROR)
604 *
605 * \subsection command_get_versions The GET_VERSIONS command
606 *
607 * This command can be used to query the versions of X-Plane, XPLM and
608 * XPLRA itself.
609 *
610 * Type | Description
611 * ---- | ------
612 * byte | 0x31 (\ref COMMAND_GET_VERSIONS)
613 *
614 * The reply is encoded the following way (it shall never fail):
615 *
616 * Type | Description
617 * ---- | ------
618 * byte | 0x00 (\ref RESULT_OK)
619 * 32-bit signed integer | the version of X-Plane. For 10.20r1 it is 10201.
620 * 32-bit signed integer | the version of XPLM. For 2.10 it is 210.
621 * 32-bit signed integer | the version of XPLRA. For 0.1 it is 10.
622 *
623 * \subsection command_show_message The SHOW_MESSAGE command
624 *
625 * This command can be used to show a message in a window to the
626 * user. The window is a single line window around the top 1/3rd of
627 * the screen. It can be moved and resized by mouse actions. If a
628 * message is being displayed when this command is issued, that
629 * message will be replaced by the new one.
630 *
631 * Type | Description
632 * ---- | ------
633 * byte | 0x41 (\ref COMMAND_SHOW_MESSAGE)
634 * string | the message to show
635 * float | the duration of the message in seconds
636 *
637 * If successful, the reply is the following:
638 *
639 * Type | Description
640 * ---- | ------
641 * byte | 0x00 (\ref RESULT_OK)
642 *
643 * If an error was encountered, the reply has the following format:
644 *
645 * Type | Description
646 * ---- | ------
647 * byte | the error code
648 *
649 * The following error codes may be returned:
650 *
651 * Code | Meaning
652 * ---- | -------
653 * \ref RESULT_INVALID_DURATION | the duration is too large
654 *
655 * \subsection command_register_hotkeys The REGISTER_HOTKEYS command
656 *
657 * This command can be used to register a set of hotkeys to be
658 * monitored. If any other hotkeys have been registered by the current
659 * client previously, they are forgotten.
660 *
661 * Type | Description
662 * ---- | ------
663 * byte | 0x51 (\ref COMMAND_REGISTER_HOTKEYS)
664 * 32-bit unsigned integer | n=the number of the hotkeys
665 * n * 16-bit unsigned integer | the codes of the hotkeys
666 *
667 * The lower-byte of a hotkey code is the same as the X-Plane virtual
668 * key code. The upper byte is a logical OR of zero or more modifiers:
669 *
670 * Value | Description | Constant name
671 * --: | --- | ---
672 * 0x0100 | Shift modifier | HOTKEY_MODIFIER_SHIFT
673 * 0x0200 | Control modifier | HOTKEY_MODIFIER_CONTROL
674 *
675 * If successful, the reply is the following:
676 *
677 * Type | Description
678 * ---- | ------
679 * byte | 0x00 (\ref RESULT_OK)
680 *
681 * If an error was encountered, the reply has the following format:
682 *
683 * Type | Description
684 * ---- | ------
685 * byte | the error code
686 *
687 * The following error codes may be returned:
688 *
689 * Code | Meaning
690 * ---- | -------
691 * \ref RESULT_INVALID_LENGTH | too many hotkeys were given
692 *
693 * \subsection command_query_hotkeys The QUERY_HOTKEYS command
694 *
695 * This command can be used to query which hotkeys have been pressed
696 * since the last query.
697 *
698 * Type | Description
699 * ---- | ------
700 * byte | 0x52 (\ref COMMAND_QUERY_HOTKEYS)
701 *
702 * The reply is the following:
703 *
704 * Type | Description
705 * ---- | ------
706 * byte | 0x00 (\ref RESULT_OK)
707 * 32-bit unsigned integer | n = the number of hotkeys registered
708 * 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"
709 *
710 * \subsection command_unregister_hotkeys The UNREGISTER_HOTKEYS command
711 *
712 * This command can be used to unregister a previously registered set
713 * of hotkeys to be monitored.
714 *
715 * Type | Description
716 * ---- | ------
717 * byte | 0x53 (\ref COMMAND_UNREGISTER_HOTKEYS)
718 *
719 * The reply is the following:
720 *
721 * Type | Description
722 * ---- | ------
723 * byte | 0x00 (\ref RESULT_OK)
724 */
725/*! \page cppapi C/C++ Client API
726 *
727 * The C++ client API's central class is \ref
728 * hu::varadiistvan::xplra::XPlane. To communicate with the XPLRA
729 * plugin in X-Plane, create an instance of it. This, however, does
730 * not establish the connection yet. To actually connect, call the
731 * \ref hu::varadiistvan::xplra::XPlane::connect "connect" member
732 * function. If the connection is established, it returns otherwise it
733 * throws a \ref hu::varadiistvan::xplra::IOException.
734 *
735 * \c IOException is part of the exception hierarchy of the client
736 * API. The hierarchy begins with \ref
737 * hu::varadiistvan::xplra::Exception. The \c what function is
738 * implemented for all exception classes, so you can always get a
739 * string representation of the problem for logging or to display
740 * it. \c IOException further makes available an error code, which is
741 * the standard operating system-specific fault code of the I/O error
742 * that occured.
743 *
744 * \ref hu::varadiistvan::xplra::ProtocolException is thrown for
745 * errors returned by the plugin usually due to some incorrect
746 * parameter. See also the \ref proto description for the meaning
747 * and applicability of these error codes.
748 *
749 * The \c XPlane object can be reused in the sense, that after you
750 * have made a connection, you can disconnect and then connect
751 * again. This may be useful, if X-Plane crashes for some reason, and
752 * you can then reconnect if the user has restarted it.
753 *
754 * The \ref hu::varadiistvan::xplra::XPlane::createMultiGetter
755 * "createMultiGetter" function can be used to create a multi-dataref
756 * query object. It returns an instance of
757 * \ref hu::varadiistvan::xplra::MultiGetter "MultiGetter", which can
758 * be used to store a number of datarefs and then execute a
759 * multi-dataref query for those datarefs. Before execution, the query
760 * can be \ref hu::varadiistvan::xplra::MultiBuffer::registerInXPlane
761 * "registered" in the plugin, so that the client does not have to send
762 * all the dataref information whenever the query is executed.
763 *
764 * The \c XPlane object knows about any multi-dataref query objects.
765 * Therefore if you register such a multi-dataref query, and then the
766 * connection breaks, and then you reconnect, the query will-be
767 * re-registered too, i.e. you don't have to do it yourself.
768 *
769 * Similarly, the \ref hu::varadiistvan::xplra::XPlane::createMultiSetter
770 * "createMultiSetter" function can be used to create a multi-dataref
771 * update object. They are handled the same way by \c XPlane as the
772 * query objects when it comes to registration and re-registration.
773 *
774 * The other functions of \c XPlane are mostly self-explanatory: they
775 * perform the operations defined by the protocol. Several operations
776 * have more than one corresponding functions with different
777 * parameters for convenience.
778 *
779 * The \ref src/client/c/hu/varadiistvan/xplra/xplra.h "C API" is
780 * a wrapper over the C++ one, so its logic is essentially the
781 * same. To connect to X-Plane, call \ref xplra_connect. It returns a
782 * non-negative handle, which can be used to refer to the connection
783 * (i.e. the underlying \c XPlane object) in the other functions.
784 *
785 * In case of error, it, and most other functions of the C returns
786 * -1. To check what the last error was, call \ref
787 * xplra_get_last_error or \ref xplra_get_last_error_string.
788 *
789 * You can create multi-dataref buffers with C API as well with
790 * \ref xplra_multi_create_getter and \ref
791 * xplra_multi_create_setter. These return a buffer ID on success, and
792 * you should use that buffer ID later on to manipulate the buffer.
793 */
794/*! \page pythonapi Python Client API
795 *
796 * The Python client API is implemented as a single module. Its
797 * central class is \ref xplra.XPlane. To communicate with the plugin
798 * in X-Plane, create an instance of it and call its \ref
799 * xplra.XPlane.connect "connect" function. This tries to establish
800 * the connection, and throws the standard I/O exceptions if it fails.
801 *
802 * The class can be used to perform the various operations provided by
803 * the plugin. In case of a failure and exception is thrown. If the
804 * plugin signals an error, a \ref xplra.ProtocolException
805 * "ProtocolException" is thrown with the error information provided
806 * by the plugin. In other cases some standard exception is thrown,
807 * which is mostly IOError if a communication error occurs.
808 *
809 * The \c XPlane object can be reused in the sense, that after you
810 * have made a connection, you can disconnect and then connect
811 * again. This may be useful, if X-Plane crashes for some reason, and
812 * you can then reconnect if the user has restarted it.
813 *
814 * Objects to store information about multi-dataref queries can be
815 * created by the \ref xplra.XPlane.createMultiGetter
816 * "createMultiGetter" function. It returns an instance of \ref
817 * xplra.MultiGetter, which can be used to store a number of datarefs
818 * and then execute a multi-dataref query for those datarefs. Before
819 * execution, the query can be \ref xplra.MultiBuffer.register
820 * "registered" in the plugin, so that the client does not have to send
821 * all the dataref information whenever the query is executed.
822 *
823 * The \c XPlane object knows about any multi-dataref query objects.
824 * Therefore if you register such a multi-dataref query, and then the
825 * connection breaks, and then you reconnect, the query will-be
826 * re-registered too, i.e. you don't have to do it yourself.
827 *
828 * Similarly, the \ref xplra.XPlane.createMultiSetter
829 * "createMultiSetter" function can be used to create a multi-dataref
830 * update object. They are handled the same way by \c XPlane as the
831 * query objects when it comes to registration and re-registration.
832 *
833 * The other functions of \c XPlane are mostly self-explanatory: they
834 * perform the operations defined by the protocol.
835 */
Note: See TracBrowser for help on using the repository browser.