X-Plane Remote Access Plugin and Client Library
Macros | Functions
xplra.h File Reference
#include <stdlib.h>
#include <inttypes.h>

Go to the source code of this file.

Macros

#define ERROR_NONE   0
 
#define ERROR_IO   1
 
#define ERROR_PROTOCOL   2
 
#define ERROR_PROTOCOL_INVALID_COMMAND   = 1
 
#define ERROR_PROTOCOL_UNKNOWN_DATAREF   = 2
 
#define ERROR_PROTOCOL_INVALID_TYPE   = 3
 
#define ERROR_PROTOCOL_INVALID_LENGTH   = 4
 
#define ERROR_PROTOCOL_INVALID_OFFSET   = 5
 
#define ERROR_PROTOCOL_INVALID_COUNT   = 6
 
#define ERROR_PROTOCOL_INVALID_ID   = 7
 
#define ERROR_PROTOCOL_INVALID_DURATION   = 8
 
#define ERROR_PROTOCOL_OTHER   = 255
 
#define ERROR_NOT_CONNECTED   3
 
#define ERROR_TYPE_MISMATCH   4
 
#define ERROR_INVALID_ID   5
 
#define ERROR_OTHER   255
 
#define HOTKEY_MODIFIER_SHIFT   0x01
 
#define HOTKEY_MODIFIER_CONTROL   0x02
 
#define INVALID_DATAREF_ID   ((size_t)-1)
 

Functions

int xplra_get_last_error (int connectionID, unsigned long *subCode)
 
const char * xplra_get_last_error_string (int connectionID)
 
void xplra_clear_last_error (int connectionID)
 
int xplra_connect ()
 
int xplra_connect_tcp (const char *address)
 
int xplra_connect_tcp_port (const char *address, unsigned short port)
 
int xplra_get_versions (int connectionID, int *xplaneVersion, int *xplmVersion, int *xplraVersion)
 
int xplra_reload_plugins (int connectionID)
 
int xplra_save_situation (int connectionID, const char *path)
 
int xplra_get_int (int *value, int connectionID, const char *name)
 
int xplra_get_float (float *value, int connectionID, const char *name)
 
int xplra_get_double (double *value, int connectionID, const char *name)
 
ssize_t xplra_get_float_array (float *dest, size_t length, size_t offset, int connectionID, const char *name)
 
float * xplra_get_float_array_new (size_t *length, size_t offset, int connectionID, const char *name)
 
ssize_t xplra_get_int_array (int32_t *dest, size_t length, size_t offset, int connectionID, const char *name)
 
int32_t * xplra_get_int_array_new (size_t *length, size_t offset, int connectionID, const char *name)
 
ssize_t xplra_get_byte_array (void *dest, size_t length, size_t offset, int connectionID, const char *name)
 
uint8_t * xplra_get_byte_array_new (size_t *length, size_t offset, int connectionID, const char *name)
 
int xplra_set_int (int connectionID, const char *name, int value)
 
int xplra_set_float (int connectionID, const char *name, float value)
 
int xplra_set_double (int connectionID, const char *name, double value)
 
int xplra_set_float_array (int connectionID, const char *name, const float *values, size_t length, size_t offset)
 
int xplra_set_int_array (int connectionID, const char *name, const int32_t *values, size_t length, size_t offset)
 
int xplra_set_byte_array (int connectionID, const char *name, const void *values, size_t length, size_t offset)
 
int xplra_set_string (int connectionID, const char *name, const char *value, size_t length, size_t offset)
 
int xplra_multi_create_getter (int connectionID)
 
int xplra_multi_create_setter (int connectionID)
 
size_t xplra_multi_add_int (int bufferID, const char *name)
 
size_t xplra_multi_add_float (int bufferID, const char *name)
 
size_t xplra_multi_add_double (int bufferID, const char *name)
 
size_t xplra_multi_add_float_array (int bufferID, const char *name, size_t length, size_t offset)
 
size_t xplra_multi_add_int_array (int bufferID, const char *name, size_t length, size_t offset)
 
size_t xplra_multi_add_byte_array (int bufferID, const char *name, size_t length, size_t offset)
 
int xplra_multi_finalize (int bufferID)
 
int xplra_multi_register (int bufferID)
 
int xplra_multi_unregister (int bufferID)
 
int xplra_multi_unregister_safely (int bufferID)
 
int xplra_multi_execute (int bufferID)
 
int xplra_multi_set_int (int bufferID, size_t datarefID, int value)
 
int xplra_multi_get_int (int *dest, int bufferID, size_t datarefID)
 
const int32_t * xplra_multi_get_int_const_ptr (int bufferID, size_t datarefID)
 
int32_t * xplra_multi_get_int_ptr (int bufferID, size_t datarefID)
 
int xplra_multi_set_float (int bufferID, size_t datarefID, float value)
 
int xplra_multi_get_float (float *dest, int bufferID, size_t datarefID)
 
const float * xplra_multi_get_float_const_ptr (int bufferID, size_t datarefID)
 
float * xplra_multi_get_float_ptr (int bufferID, size_t datarefID)
 
int xplra_multi_set_double (int bufferID, size_t datarefID, double value)
 
int xplra_multi_get_double (double *dest, int bufferID, size_t datarefID)
 
const double * xplra_multi_get_double_const_ptr (int bufferID, size_t datarefID)
 
double * xplra_multi_get_double_ptr (int bufferID, size_t datarefID)
 
ssize_t xplra_multi_set_float_array (int bufferID, size_t datarefID, const float *value, size_t length, size_t offset)
 
ssize_t xplra_multi_get_float_array (float *value, size_t length, size_t offset, int bufferID, size_t datarefID)
 
const float * xplra_multi_get_float_array_ptr (int bufferID, size_t datarefID, size_t offset)
 
ssize_t xplra_multi_set_int_array (int bufferID, size_t datarefID, const int32_t *value, size_t length, size_t offset)
 
ssize_t xplra_multi_get_int_array (int32_t *value, size_t length, size_t offset, int bufferID, size_t datarefID)
 
const int32_t * xplra_multi_get_int_array_ptr (int bufferID, size_t datarefID, size_t offset)
 
ssize_t xplra_multi_set_byte_array (int bufferID, size_t datarefID, const void *value, size_t length, size_t offset)
 
ssize_t xplra_multi_get_byte_array (void *value, size_t length, size_t offset, int bufferID, size_t datarefID)
 
const uint8_t * xplra_multi_get_byte_array_ptr (int bufferID, size_t datarefID, size_t offset)
 
ssize_t xplra_multi_set_string (int bufferID, size_t datarefID, const char *value, size_t offset)
 
const char * xplra_multi_get_string_ptr (int bufferID, size_t datarefID, size_t offset)
 
int xplra_multi_destroy_buffer (int connectionID, int bufferID)
 
int xplra_show_message (int connectionID, const char *message, float duration)
 
int xplra_register_hotkeys (int connectionID, const uint16_t *codes, size_t length)
 
int xplra_query_hotkeys (int connectionID, uint8_t *states, size_t length)
 
int xplra_unregister_hotkeys (int connectionID)
 
int xplra_disconnect (int connectionID)
 
int xplra_reconnect (int connectionID)
 
int xplra_destroy (int connectionID)
 

Macro Definition Documentation

◆ ERROR_INVALID_ID

#define ERROR_INVALID_ID   5

An invalid ID was passed to a function

Definition at line 98 of file xplra.h.

◆ ERROR_IO

#define ERROR_IO   1

An I/O error has occured. The subcode is the errno value on Linux, or the Windows error code.

Definition at line 56 of file xplra.h.

◆ ERROR_NONE

#define ERROR_NONE   0

No error occured

Definition at line 50 of file xplra.h.

◆ ERROR_NOT_CONNECTED

#define ERROR_NOT_CONNECTED   3

A function requiring a connection is called without a connection

Definition at line 92 of file xplra.h.

◆ ERROR_OTHER

#define ERROR_OTHER   255

Some other error

Definition at line 101 of file xplra.h.

◆ ERROR_PROTOCOL

#define ERROR_PROTOCOL   2

A protocol error has occured. The subcode is one of the ERROR_PROTOCOL_XXX values.

Definition at line 62 of file xplra.h.

◆ ERROR_PROTOCOL_INVALID_COMMAND

#define ERROR_PROTOCOL_INVALID_COMMAND   = 1

Invalid command was passed to the plugin

Definition at line 65 of file xplra.h.

◆ ERROR_PROTOCOL_INVALID_COUNT

#define ERROR_PROTOCOL_INVALID_COUNT   = 6

An invalid count was specified

Definition at line 80 of file xplra.h.

◆ ERROR_PROTOCOL_INVALID_DURATION

#define ERROR_PROTOCOL_INVALID_DURATION   = 8

An invalid duration was specified

Definition at line 86 of file xplra.h.

◆ ERROR_PROTOCOL_INVALID_ID

#define ERROR_PROTOCOL_INVALID_ID   = 7

An invalid ID was specified

Definition at line 83 of file xplra.h.

◆ ERROR_PROTOCOL_INVALID_LENGTH

#define ERROR_PROTOCOL_INVALID_LENGTH   = 4

An invalid length was specified

Definition at line 74 of file xplra.h.

◆ ERROR_PROTOCOL_INVALID_OFFSET

#define ERROR_PROTOCOL_INVALID_OFFSET   = 5

An invalid offset was specified

Definition at line 77 of file xplra.h.

◆ ERROR_PROTOCOL_INVALID_TYPE

#define ERROR_PROTOCOL_INVALID_TYPE   = 3

An invalid type was specified

Definition at line 71 of file xplra.h.

◆ ERROR_PROTOCOL_OTHER

#define ERROR_PROTOCOL_OTHER   = 255

Other protocol error

Definition at line 89 of file xplra.h.

◆ ERROR_PROTOCOL_UNKNOWN_DATAREF

#define ERROR_PROTOCOL_UNKNOWN_DATAREF   = 2

An unknown dataref was specified

Definition at line 68 of file xplra.h.

◆ ERROR_TYPE_MISMATCH

#define ERROR_TYPE_MISMATCH   4

A type-specific function was called for a dataref of a different type

Definition at line 95 of file xplra.h.

◆ HOTKEY_MODIFIER_CONTROL

#define HOTKEY_MODIFIER_CONTROL   0x02

Hotkey modifier: Control

Definition at line 109 of file xplra.h.

◆ HOTKEY_MODIFIER_SHIFT

#define HOTKEY_MODIFIER_SHIFT   0x01

Hotkey modifier: Shift

Definition at line 106 of file xplra.h.

◆ INVALID_DATAREF_ID

#define INVALID_DATAREF_ID   ((size_t)-1)

This ID is returned by multi-dataref buffer functions when the buffer is not found, this the dataref cannot be assigned an ID

Definition at line 117 of file xplra.h.

Function Documentation

◆ xplra_clear_last_error()

void xplra_clear_last_error ( int  connectionID)

Clear the last error.

Definition at line 479 of file xplra.cc.

◆ xplra_connect()

int xplra_connect ( )

Connect to the simulator locally.

Returns
an ID for the created connection, or -1 on error.

Definition at line 487 of file xplra.cc.

◆ xplra_connect_tcp()

int xplra_connect_tcp ( const char *  address)

Connect to the simulator via TCP using the default port.

Returns
an ID for the created connection, or -1 on error.

Definition at line 500 of file xplra.cc.

◆ xplra_connect_tcp_port()

int xplra_connect_tcp_port ( const char *  address,
unsigned short  port 
)

Connect to the simulator via TCP using the given port.

Returns
an ID for the created connection, or -1 on error.

Definition at line 513 of file xplra.cc.

◆ xplra_destroy()

int xplra_destroy ( int  connectionID)

Destroy the connection with the given ID.

Returns
0 on success, -1 on error.

Definition at line 1440 of file xplra.cc.

◆ xplra_disconnect()

int xplra_disconnect ( int  connectionID)

Disconnect the connection with the given ID.

Returns
0 on success, -1 on error.

Definition at line 1411 of file xplra.cc.

◆ xplra_get_byte_array()

ssize_t xplra_get_byte_array ( void *  dest,
size_t  length,
size_t  offset,
int  connectionID,
const char *  name 
)

Get an array of bytes into a buffer.

Parameters
destthe array into which to get the data
lengththe length of the destination buffer
offsetthe offset from which to query the array
connectionIDthe ID of the connection to use
namethe name of the dataref
Returns
the actual number of elements returned in case of success, -1 on error

Definition at line 679 of file xplra.cc.

◆ xplra_get_byte_array_new()

uint8_t* xplra_get_byte_array_new ( size_t *  length,
size_t  offset,
int  connectionID,
const char *  name 
)

Get an array of bytes into a newly allocated buffer.

Parameters
lengthpointer to a variable containing the length to query. On return it will be set to the actual length, which can be less than or equal to the input value.
offsetthe offset from which to query the array
connectionIDthe ID of the connection to use
namethe name of the dataref
Returns
the new array on success, 0 on error

Definition at line 695 of file xplra.cc.

◆ xplra_get_double()

int xplra_get_double ( double *  value,
int  connectionID,
const char *  name 
)

Get a double value from the simulator.

Returns
0 on success, -1 on error

Definition at line 603 of file xplra.cc.

◆ xplra_get_float()

int xplra_get_float ( float *  value,
int  connectionID,
const char *  name 
)

Get a float value from the simulator.

Returns
0 on success, -1 on error

Definition at line 588 of file xplra.cc.

◆ xplra_get_float_array()

ssize_t xplra_get_float_array ( float *  dest,
size_t  length,
size_t  offset,
int  connectionID,
const char *  name 
)

Get an array of floats into a buffer.

Parameters
destthe array into which to get the data
lengththe length of the destination buffer
offsetthe offset from which to query the array
connectionIDthe ID of the connection to use
namethe name of the dataref
Returns
the actual number of elements returned in case of success, -1 on error

Definition at line 619 of file xplra.cc.

◆ xplra_get_float_array_new()

float* xplra_get_float_array_new ( size_t *  length,
size_t  offset,
int  connectionID,
const char *  name 
)

Get an array of floats into a newly allocated buffer.

Parameters
lengthpointer to a variable containing the length to query. On return it will be set to the actual length, which can be less than or equal to the input value.
offsetthe offset from which to query the array
connectionIDthe ID of the connection to use
namethe name of the dataref
Returns
the new array on success, 0 on error

Definition at line 634 of file xplra.cc.

◆ xplra_get_int()

int xplra_get_int ( int *  value,
int  connectionID,
const char *  name 
)

Get an integer value from the simulator.

Returns
0 on success, -1 on error

Definition at line 573 of file xplra.cc.

◆ xplra_get_int_array()

ssize_t xplra_get_int_array ( int32_t *  dest,
size_t  length,
size_t  offset,
int  connectionID,
const char *  name 
)

Get an array of integers into a buffer.

Parameters
destthe array into which to get the data
lengththe length of the destination buffer
offsetthe offset from which to query the array
connectionIDthe ID of the connection to use
namethe name of the dataref
Returns
the actual number of elements returned in case of success, -1 on error

Definition at line 649 of file xplra.cc.

◆ xplra_get_int_array_new()

int32_t* xplra_get_int_array_new ( size_t *  length,
size_t  offset,
int  connectionID,
const char *  name 
)

Get an array of integers into a newly allocated buffer.

Parameters
lengthpointer to a variable containing the length to query. On return it will be set to the actual length, which can be less than or equal to the input value.
offsetthe offset from which to query the array
connectionIDthe ID of the connection to use
namethe name of the dataref
Returns
the new array on success, 0 on error

Definition at line 664 of file xplra.cc.

◆ xplra_get_last_error()

int xplra_get_last_error ( int  connectionID,
unsigned long *  subCode 
)

Get the last error code with the subcode.

Returns
the last error code, or -1 if the given connection ID is invalid.

Definition at line 463 of file xplra.cc.

◆ xplra_get_last_error_string()

const char* xplra_get_last_error_string ( int  connectionID)

Get a string representation of the last error.

Returns
the string representation of the last error, or 0 if there was no last error, or the connection ID is invalid.

Definition at line 471 of file xplra.cc.

◆ xplra_get_versions()

int xplra_get_versions ( int  connectionID,
int *  xplaneVersion,
int *  xplmVersion,
int *  xplraVersion 
)

Get the versions of X-Plane, the XPLM library and XPLRA

Definition at line 526 of file xplra.cc.

◆ xplra_multi_add_byte_array()

size_t xplra_multi_add_byte_array ( int  bufferID,
const char *  name,
size_t  length,
size_t  offset 
)

Add a byte array dataref to a multi-dataref buffer.

Returns
the ID of the dataref that can be used later. If the buffer ID is invalid, INVALID_DATAREF_ID is returned.

Definition at line 886 of file xplra.cc.

◆ xplra_multi_add_double()

size_t xplra_multi_add_double ( int  bufferID,
const char *  name 
)

Add a double dataref to a multi-dataref buffer.

Returns
the ID of the dataref that can be used later. If the buffer ID is invalid, INVALID_DATAREF_ID is returned.

Definition at line 858 of file xplra.cc.

◆ xplra_multi_add_float()

size_t xplra_multi_add_float ( int  bufferID,
const char *  name 
)

Add a float dataref to a multi-dataref buffer.

Returns
the ID of the dataref that can be used later. If the buffer ID is invalid, INVALID_DATAREF_ID is returned.

Definition at line 850 of file xplra.cc.

◆ xplra_multi_add_float_array()

size_t xplra_multi_add_float_array ( int  bufferID,
const char *  name,
size_t  length,
size_t  offset 
)

Add a float array dataref to a multi-dataref buffer.

Returns
the ID of the dataref that can be used later. If the buffer ID is invalid, INVALID_DATAREF_ID is returned.

Definition at line 866 of file xplra.cc.

◆ xplra_multi_add_int()

size_t xplra_multi_add_int ( int  bufferID,
const char *  name 
)

Add an integer dataref to a multi-dataref buffer.

Returns
the ID of the dataref that can be used later. If the buffer ID is invalid, INVALID_DATAREF_ID is returned.

Definition at line 842 of file xplra.cc.

◆ xplra_multi_add_int_array()

size_t xplra_multi_add_int_array ( int  bufferID,
const char *  name,
size_t  length,
size_t  offset 
)

Add an integer array dataref to a multi-dataref buffer.

Returns
the ID of the dataref that can be used later. If the buffer ID is invalid, INVALID_DATAREF_ID is returned.

Definition at line 876 of file xplra.cc.

◆ xplra_multi_create_getter()

int xplra_multi_create_getter ( int  connectionID)

Create a multi-dataref getter for the given connection.

Returns
the ID of the new getter, or -1 on error

Definition at line 826 of file xplra.cc.

◆ xplra_multi_create_setter()

int xplra_multi_create_setter ( int  connectionID)

Create a multi-dataref setter for the given connection.

Returns
the ID of the new setter, or -1 on error

Definition at line 834 of file xplra.cc.

◆ xplra_multi_destroy_buffer()

int xplra_multi_destroy_buffer ( int  connectionID,
int  bufferID 
)

Destroy a multi-dataref buffer for the given connection.

Parameters
connectionIDthe ID of the connection for which the buffer has been created.
bufferIDthe ID of the buffer to destroy
Returns
0 on success, -1 on error.

Definition at line 1326 of file xplra.cc.

◆ xplra_multi_execute()

int xplra_multi_execute ( int  bufferID)

Execute the buffer with the given ID. If the buffer is not finalized, it will be finalized. If it is not finalized, but registered, the registration will be cleared, and it will be re-registered after finalizing.

Returns
0 on success, -1 on error

Definition at line 942 of file xplra.cc.

◆ xplra_multi_finalize()

int xplra_multi_finalize ( int  bufferID)

Finalize the given buffer, if not finalized yet.

Returns
-1 on error (if the buffer ID is invalid), 0 if there is no data in the buffer, 1 if there is data in it.

Definition at line 896 of file xplra.cc.

◆ xplra_multi_get_byte_array()

ssize_t xplra_multi_get_byte_array ( void *  value,
size_t  length,
size_t  offset,
int  bufferID,
size_t  datarefID 
)

Get the contents of the byte array with the given ID.

Parameters
valuethe destination buffer
lengththe amount of data. If 0, it is assumed to be the length of the data in the buffer minus the offset.
offsetthe offset within the buffer to get the data from
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be retrieved
Returns
the number of data items retrieved, or -1 on error.

Definition at line 1261 of file xplra.cc.

◆ xplra_multi_get_byte_array_ptr()

const uint8_t* xplra_multi_get_byte_array_ptr ( int  bufferID,
size_t  datarefID,
size_t  offset 
)

Get a pointer to the byte array with the given ID.

Parameters
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be retrieved
offsetthe offset within the buffer.
Returns
the pointer on success, 0 on error.

Definition at line 1280 of file xplra.cc.

◆ xplra_multi_get_double()

int xplra_multi_get_double ( double *  dest,
int  bufferID,
size_t  datarefID 
)

Get the value of a double dataref with the given ID.

Parameters
destpointer to the variable that will receive the value
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be retrieved
Returns
0 on success, -1 on error.

Definition at line 1096 of file xplra.cc.

◆ xplra_multi_get_double_const_ptr()

const double* xplra_multi_get_double_const_ptr ( int  bufferID,
size_t  datarefID 
)

Get a const pointer to the double dataref with the given ID

Returns
the pointer or success, 0 on error.

Definition at line 1112 of file xplra.cc.

◆ xplra_multi_get_double_ptr()

double* xplra_multi_get_double_ptr ( int  bufferID,
size_t  datarefID 
)

Get a pointer to the double dataref with the given ID

Returns
the pointer or success, 0 on error.

Definition at line 1127 of file xplra.cc.

◆ xplra_multi_get_float()

int xplra_multi_get_float ( float *  dest,
int  bufferID,
size_t  datarefID 
)

Get the value of a float dataref with the given ID.

Parameters
destpointer to the variable that will receive the value
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be retrieved
Returns
0 on success, -1 on error.

Definition at line 1034 of file xplra.cc.

◆ xplra_multi_get_float_array()

ssize_t xplra_multi_get_float_array ( float *  value,
size_t  length,
size_t  offset,
int  bufferID,
size_t  datarefID 
)

Get the contents of the float array with the given ID.

Parameters
valuethe destination buffer
lengththe amount of data. If 0, it is assumed to be the length of the data in the buffer minus the offset.
offsetthe offset within the buffer to get the data from
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be retrieved
Returns
the number of data items retrieved, or -1 on error.

Definition at line 1159 of file xplra.cc.

◆ xplra_multi_get_float_array_ptr()

const float* xplra_multi_get_float_array_ptr ( int  bufferID,
size_t  datarefID,
size_t  offset 
)

Get a pointer to the float array with the given ID.

Parameters
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be retrieved
offsetthe offset within the buffer.
Returns
the pointer on success, 0 on error.

Definition at line 1176 of file xplra.cc.

◆ xplra_multi_get_float_const_ptr()

const float* xplra_multi_get_float_const_ptr ( int  bufferID,
size_t  datarefID 
)

Get a const pointer to the float dataref with the given ID

Returns
the pointer or success, 0 on error.

Definition at line 1050 of file xplra.cc.

◆ xplra_multi_get_float_ptr()

float* xplra_multi_get_float_ptr ( int  bufferID,
size_t  datarefID 
)

Get a pointer to the float dataref with the given ID

Returns
the pointer or success, 0 on error.

Definition at line 1065 of file xplra.cc.

◆ xplra_multi_get_int()

int xplra_multi_get_int ( int *  dest,
int  bufferID,
size_t  datarefID 
)

Get the value of an integer dataref with the given ID.

Parameters
destpointer to the variable that will receive the value
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be retrieved
Returns
0 on success, -1 on error.

Definition at line 972 of file xplra.cc.

◆ xplra_multi_get_int_array()

ssize_t xplra_multi_get_int_array ( int32_t *  value,
size_t  length,
size_t  offset,
int  bufferID,
size_t  datarefID 
)

Get the contents of the integer array with the given ID.

Parameters
valuethe destination buffer
lengththe amount of data. If 0, it is assumed to be the length of the data in the buffer minus the offset.
offsetthe offset within the buffer to get the data from
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be retrieved
Returns
the number of data items retrieved, or -1 on error.

Definition at line 1209 of file xplra.cc.

◆ xplra_multi_get_int_array_ptr()

const int32_t* xplra_multi_get_int_array_ptr ( int  bufferID,
size_t  datarefID,
size_t  offset 
)

Get a pointer to the integer array with the given ID.

Parameters
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be retrieved
offsetthe offset within the buffer.
Returns
the pointer on success, 0 on error.

Definition at line 1226 of file xplra.cc.

◆ xplra_multi_get_int_const_ptr()

const int32_t* xplra_multi_get_int_const_ptr ( int  bufferID,
size_t  datarefID 
)

Get a const pointer to the integer dataref with the given ID

Returns
the pointer or success, 0 on error.

Definition at line 988 of file xplra.cc.

◆ xplra_multi_get_int_ptr()

int32_t* xplra_multi_get_int_ptr ( int  bufferID,
size_t  datarefID 
)

Get a pointer to the integer dataref with the given ID

Returns
the pointer or success, 0 on error.

Definition at line 1003 of file xplra.cc.

◆ xplra_multi_get_string_ptr()

const char* xplra_multi_get_string_ptr ( int  bufferID,
size_t  datarefID,
size_t  offset 
)

Get a pointer as a string pointer to the byte array with the given ID.

Returns
the pointer on success, 0 on error.

Definition at line 1311 of file xplra.cc.

◆ xplra_multi_register()

int xplra_multi_register ( int  bufferID)

Register the buffer with the given ID in X-Plane. If needed, it will be finalized too.

Returns
0 on success, -1 on error

Definition at line 904 of file xplra.cc.

◆ xplra_multi_set_byte_array()

ssize_t xplra_multi_set_byte_array ( int  bufferID,
size_t  datarefID,
const void *  value,
size_t  length,
size_t  offset 
)

Set the contents of the byte array dataref with the given ID.

Parameters
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be set
valuethe array to set
lengththe amount of data. If 0, it is assumed to be the length of the data in the buffer minus the offset.
offsetthe offset within the buffer to set the data from
Returns
the number of data items set, or -1 on error.

Definition at line 1242 of file xplra.cc.

◆ xplra_multi_set_double()

int xplra_multi_set_double ( int  bufferID,
size_t  datarefID,
double  value 
)

Set the value of a double dataref with the given ID.

Returns
0 on success, -1 on error.

Definition at line 1080 of file xplra.cc.

◆ xplra_multi_set_float()

int xplra_multi_set_float ( int  bufferID,
size_t  datarefID,
float  value 
)

Set the value of a float dataref with the given ID.

Returns
0 on success, -1 on error.

Definition at line 1018 of file xplra.cc.

◆ xplra_multi_set_float_array()

ssize_t xplra_multi_set_float_array ( int  bufferID,
size_t  datarefID,
const float *  value,
size_t  length,
size_t  offset 
)

Set the contents of the float array dataref with the given ID.

Parameters
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be set
valuethe array to set
lengththe amount of data. If 0, it is assumed to be the length of the data in the buffer minus the offset.
offsetthe offset within the buffer to set the data from
Returns
the number of data items set, or -1 on error.

Definition at line 1142 of file xplra.cc.

◆ xplra_multi_set_int()

int xplra_multi_set_int ( int  bufferID,
size_t  datarefID,
int  value 
)

Set the value of an integer dataref with the given ID.

Returns
0 on success, -1 on error.

Definition at line 957 of file xplra.cc.

◆ xplra_multi_set_int_array()

ssize_t xplra_multi_set_int_array ( int  bufferID,
size_t  datarefID,
const int32_t *  value,
size_t  length,
size_t  offset 
)

Set the contents of the integer array dataref with the given ID.

Parameters
bufferIDthe ID of the buffer to use
datarefIDthe ID of the dataref whose value is to be set
valuethe array to set
lengththe amount of data. If 0, it is assumed to be the length of the data in the buffer minus the offset.
offsetthe offset within the buffer to set the data from
Returns
the number of data items set, or -1 on error.

Definition at line 1192 of file xplra.cc.

◆ xplra_multi_set_string()

ssize_t xplra_multi_set_string ( int  bufferID,
size_t  datarefID,
const char *  value,
size_t  offset 
)

Set the value of the byte array with the given ID from the given string. If the string is shorter than the array, the rest will be filled with 0s.

Returns
the number of bytes set, or -1 on error

Definition at line 1295 of file xplra.cc.

◆ xplra_multi_unregister()

int xplra_multi_unregister ( int  bufferID)

Unregister the buffer with the given ID from X-Plane.

Returns
0 on success, -1 on error

Definition at line 919 of file xplra.cc.

◆ xplra_multi_unregister_safely()

int xplra_multi_unregister_safely ( int  bufferID)

Unregister the buffer with the given ID from X-Plane safely, i.e. the registration ID will be cleared anyway to support re-registration.

Returns
-1 if the buffer ID is invalid, 0 if the unregistration call failed, 1 if it was successful.

Definition at line 934 of file xplra.cc.

◆ xplra_query_hotkeys()

int xplra_query_hotkeys ( int  connectionID,
uint8_t *  states,
size_t  length 
)

Query the registered hotkeys whether they were pressed.

Definition at line 1377 of file xplra.cc.

◆ xplra_reconnect()

int xplra_reconnect ( int  connectionID)

Reconnect the connection with the given ID. If it is already connected, nothing happens.

Returns
0 on success, -1 on error.

Definition at line 1424 of file xplra.cc.

◆ xplra_register_hotkeys()

int xplra_register_hotkeys ( int  connectionID,
const uint16_t *  codes,
size_t  length 
)

Register the given hotkey codes for listening. If there is an existing set of hotkeys registered, those will be overwritten.

Definition at line 1360 of file xplra.cc.

◆ xplra_reload_plugins()

int xplra_reload_plugins ( int  connectionID)

Reload the plugins in X-Plane. After this the connection fails.

Definition at line 543 of file xplra.cc.

◆ xplra_save_situation()

int xplra_save_situation ( int  connectionID,
const char *  path 
)

Save the current situation into the file with the given path relative to X-Plane's directory.

Definition at line 558 of file xplra.cc.

◆ xplra_set_byte_array()

int xplra_set_byte_array ( int  connectionID,
const char *  name,
const void *  values,
size_t  length,
size_t  offset 
)

Set the array of byte values with the given name from the given buffer.

Returns
0 on success, -1 on error.

Definition at line 790 of file xplra.cc.

◆ xplra_set_double()

int xplra_set_double ( int  connectionID,
const char *  name,
double  value 
)

Set the double dataref with the given name to the given value.

Returns
0 on success, -1 on error.

Definition at line 740 of file xplra.cc.

◆ xplra_set_float()

int xplra_set_float ( int  connectionID,
const char *  name,
float  value 
)

Set the float dataref with the given name to the given value.

Returns
0 on success, -1 on error.

Definition at line 725 of file xplra.cc.

◆ xplra_set_float_array()

int xplra_set_float_array ( int  connectionID,
const char *  name,
const float *  values,
size_t  length,
size_t  offset 
)

Set the array of float values with the given name from the given buffer.

Returns
0 on success, -1 on error.

Definition at line 756 of file xplra.cc.

◆ xplra_set_int()

int xplra_set_int ( int  connectionID,
const char *  name,
int  value 
)

Set the integer dataref with the given name to the given value.

Returns
0 on success, -1 on error.

Definition at line 710 of file xplra.cc.

◆ xplra_set_int_array()

int xplra_set_int_array ( int  connectionID,
const char *  name,
const int32_t *  values,
size_t  length,
size_t  offset 
)

Set the array of integer values with the given name from the given buffer.

Returns
0 on success, -1 on error.

Definition at line 773 of file xplra.cc.

◆ xplra_set_string()

int xplra_set_string ( int  connectionID,
const char *  name,
const char *  value,
size_t  length,
size_t  offset 
)

Set the array of byte values with the given name from the given string. The string will be padded with 0 if it has a length less than the given length.

Returns
0 on success, -1 on error.

Definition at line 808 of file xplra.cc.

◆ xplra_show_message()

int xplra_show_message ( int  connectionID,
const char *  message,
float  duration 
)

Show a message in the simulator window for the given duration.

Definition at line 1342 of file xplra.cc.

◆ xplra_unregister_hotkeys()

int xplra_unregister_hotkeys ( int  connectionID)

Unregister the hotkeys.

Definition at line 1394 of file xplra.cc.