X-Plane Remote Access Plugin and Client Library
|
#include <XPlane.h>
Public Member Functions | |
XPlane () noexcept | |
~XPlane () noexcept | |
void | connect () |
void | connectTCP (const std::string &address, unsigned short port=defaultTCPPort) |
bool | isConnected () const noexcept |
void | disconnect () noexcept |
MultiGetter & | createMultiGetter () noexcept |
MultiSetter & | createMultiSetter () noexcept |
bool | destroyMultiBuffer (MultiBuffer &buffer) |
void | getVersions (int &xplaneVersion, int &xplmVersion, int &xplraVersion) |
void | reloadPlugins () |
void | saveSituation (const char *path) |
int | getInt (const char *name) |
float | getFloat (const char *name) |
double | getDouble (const char *name) |
size_t | getFloatArray (const char *name, float *dest, size_t length, size_t offset=0) |
float * | getFloatArray (const char *name, size_t &length, size_t offset=0) |
size_t | getIntArray (const char *name, int32_t *dest, size_t length, size_t offset=0) |
int32_t * | getIntArray (const char *name, size_t &length, size_t offset=0) |
size_t | getByteArray (const char *name, uint8_t *dest, size_t length, size_t offset=0) |
uint8_t * | getByteArray (const char *name, size_t &length, size_t offset=0) |
std::string | getString (const char *name, size_t offset=0) |
void | setInt (const char *name, int value) |
void | setFloat (const char *name, float value) |
void | setDouble (const char *name, double value) |
void | setFloatArray (const char *name, const float *values, size_t length, size_t offset=0) |
void | setIntArray (const char *name, const int32_t *values, size_t length, size_t offset=0) |
void | setByteArray (const char *name, const uint8_t *values, size_t length, size_t offset=0) |
void | setString (const char *name, const char *value, size_t length, size_t offset=0) |
void | showMessage (const char *message, float duration) |
void | registerHotkeys (const uint16_t *codes, size_t length) |
void | queryHotkeys (uint8_t *states, size_t length) |
void | unregisterHotkeys () |
Private Types | |
typedef std::set< MultiBuffer * > | multiBuffers_t |
Private Member Functions | |
void | checkStream () |
void | checkResult (uint8_t result, bool hasParameter=false, long parameter=0) |
void | checkResult (bool multi=false) |
void | getScalar (const char *name, uint8_t type) |
size_t | getArray (const char *name, uint8_t type, ssize_t length, size_t offset) |
void | setScalar (const char *name, uint8_t type) |
void | setArray (const char *name, uint8_t type, size_t length, size_t offset) |
template<class ClientSocket > | |
void | connect (std::unique_ptr< ClientSocket > clientSocket) |
Private Attributes | |
scpl::io::Waiter | waiter |
scpl::io::BufferedStream * | socket |
scpl::io::DataStream * | stream |
multiBuffers_t | multiBuffers |
Static Private Attributes | |
static const unsigned short | defaultTCPPort = 0x5852 |
Friends | |
class | MultiBuffer |
class | MultiGetter |
class | MultiSetter |
The main class to access X-Plane.
The calls are synchronous and not thread-safe.
|
private |
|
inlinenoexcept |
|
noexcept |
|
private |
Read and check the result. If it signifies an error, throw a ProtocolException with the correct error code. If there is some problem with the stream, an IOException is thrown.
|
private |
Check the given protocol result. If it signifies an error, throw a ProtocolException with the correct error code.
|
private |
void XPlane::connect | ( | ) |
|
private |
void XPlane::connectTCP | ( | const std::string & | address, |
unsigned short | port = defaultTCPPort |
||
) |
|
noexcept |
|
noexcept |
bool XPlane::destroyMultiBuffer | ( | MultiBuffer & | buffer | ) |
|
noexcept |
|
private |
uint8_t * XPlane::getByteArray | ( | const char * | name, |
size_t & | length, | ||
size_t | offset = 0 |
||
) |
Get a possibly partial array of bytes. The result array will be created with a length needed to hold the returned value.
name | the name of the dataref |
length | will contain the number of bytes read on return |
offset | the offset from which to get the array |
size_t XPlane::getByteArray | ( | const char * | name, |
uint8_t * | dest, | ||
size_t | length, | ||
size_t | offset = 0 |
||
) |
double XPlane::getDouble | ( | const char * | name | ) |
float XPlane::getFloat | ( | const char * | name | ) |
size_t XPlane::getFloatArray | ( | const char * | name, |
float * | dest, | ||
size_t | length, | ||
size_t | offset = 0 |
||
) |
float * XPlane::getFloatArray | ( | const char * | name, |
size_t & | length, | ||
size_t | offset = 0 |
||
) |
int XPlane::getInt | ( | const char * | name | ) |
size_t XPlane::getIntArray | ( | const char * | name, |
int32_t * | dest, | ||
size_t | length, | ||
size_t | offset = 0 |
||
) |
int32_t * XPlane::getIntArray | ( | const char * | name, |
size_t & | length, | ||
size_t | offset = 0 |
||
) |
|
private |
string XPlane::getString | ( | const char * | name, |
size_t | offset = 0 |
||
) |
void XPlane::getVersions | ( | int & | xplaneVersion, |
int & | xplmVersion, | ||
int & | xplraVersion | ||
) |
|
inlinenoexcept |
void XPlane::queryHotkeys | ( | uint8_t * | states, |
size_t | length | ||
) |
void XPlane::registerHotkeys | ( | const uint16_t * | codes, |
size_t | length | ||
) |
void XPlane::reloadPlugins | ( | ) |
void XPlane::saveSituation | ( | const char * | path | ) |
|
private |
void XPlane::setByteArray | ( | const char * | name, |
const uint8_t * | values, | ||
size_t | length, | ||
size_t | offset = 0 |
||
) |
void XPlane::setDouble | ( | const char * | name, |
double | value | ||
) |
void XPlane::setFloat | ( | const char * | name, |
float | value | ||
) |
void XPlane::setFloatArray | ( | const char * | name, |
const float * | values, | ||
size_t | length, | ||
size_t | offset = 0 |
||
) |
void XPlane::setInt | ( | const char * | name, |
int | value | ||
) |
void XPlane::setIntArray | ( | const char * | name, |
const int32_t * | values, | ||
size_t | length, | ||
size_t | offset = 0 |
||
) |
|
private |
void XPlane::setString | ( | const char * | name, |
const char * | value, | ||
size_t | length, | ||
size_t | offset = 0 |
||
) |
void XPlane::showMessage | ( | const char * | message, |
float | duration | ||
) |
void XPlane::unregisterHotkeys | ( | ) |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |