X-Plane Remote Access Plugin and Client Library
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
xplra.XPlane Class Reference
Inheritance diagram for xplra.XPlane:

Public Member Functions

def __init__ (self)
 
def connect (self, address=None)
 
def isConnected (self)
 
def createMultiGetter (self)
 
def createMultiSetter (self)
 
def destroyMultiBuffer (self, multiBuffer)
 
def getVersions (self)
 
def reloadPlugins (self)
 
def saveSituation (self, path)
 
def getInt (self, name)
 
def getFloat (self, name)
 
def getDouble (self, name)
 
def getFloatArray (self, name, length=-1, offset=0)
 
def getIntArray (self, name, length=-1, offset=0)
 
def getByteArray (self, name, length=-1, offset=0)
 
def getString (self, name, offset=0)
 
def setInt (self, name, value)
 
def setFloat (self, name, value)
 
def setDouble (self, name, value)
 
def setFloatArray (self, name, value, offset=0)
 
def setIntArray (self, name, value, offset=0)
 
def setByteArray (self, name, value, offset=0)
 
def setString (self, name, value, length, offset=0)
 
def showMessage (self, message, duration)
 
def registerHotkeys (self, hotkeyCodes)
 
def queryHotkeys (self)
 
def unregisterHotkeys (self)
 
def disconnect (self)
 

Private Member Functions

def _checkResult (self, resultCode=None, parameter=None, multi=False)
 
def _getSingle (self, name, type, length=None, offset=None)
 
def _readValue (self, type)
 
def _setSingle (self, name, type, value, offset=None)
 
def _writeValue (self, type, value)
 
def _writeU8 (self, x)
 
def _writeU16 (self, x)
 
def _writeS32 (self, x)
 
def _writeU32 (self, x)
 
def _writeFloat (self, x)
 
def _writeDouble (self, x)
 
def _writeLength (self, length)
 
def _writeString (self, str)
 
def _flush (self)
 
def _readU8 (self)
 
def _readS32 (self)
 
def _readU32 (self)
 
def _readFloat (self)
 
def _readDouble (self)
 
def _readLength (self)
 
def _readString (self)
 

Static Private Member Functions

def _packLength (x)
 
def _packString (s)
 

Private Attributes

 _stream
 the data stream used to communicate with the plugin
 
 _multiBuffers
 the list of multi-dataref buffers belonging to this object
 

Detailed Description

The main class representing the connection to X-Plane.

Definition at line 273 of file xplra.py.

Constructor & Destructor Documentation

◆ __init__()

def xplra.XPlane.__init__ (   self)
Construct the object.

Definition at line 298 of file xplra.py.

Member Function Documentation

◆ _checkResult()

def xplra.XPlane._checkResult (   self,
  resultCode = None,
  parameter = None,
  multi = False 
)
private
Check the given result code.

If it is None, it will be read first.

If it is not RESULT_OK, a ProtocolException is thrown.

Definition at line 507 of file xplra.py.

◆ _flush()

def xplra.XPlane._flush (   self)
private
Flush our stream.

Definition at line 622 of file xplra.py.

◆ _getSingle()

def xplra.XPlane._getSingle (   self,
  name,
  type,
  length = None,
  offset = None 
)
private
Get the single value of the given name and type.

Definition at line 522 of file xplra.py.

◆ _packLength()

def xplra.XPlane._packLength (   x)
staticprivate
Pack the given integer as a variable-length value.

Definition at line 282 of file xplra.py.

◆ _packString()

def xplra.XPlane._packString (   s)
staticprivate
Pack the given string.

Definition at line 294 of file xplra.py.

◆ _readDouble()

def xplra.XPlane._readDouble (   self)
private
Read a double-precision floating point value from the stream.

Definition at line 646 of file xplra.py.

◆ _readFloat()

def xplra.XPlane._readFloat (   self)
private
Read a single-precision floating point value from the stream.

Definition at line 641 of file xplra.py.

◆ _readLength()

def xplra.XPlane._readLength (   self)
private
Read a variable-length value from our stream.

Definition at line 651 of file xplra.py.

◆ _readS32()

def xplra.XPlane._readS32 (   self)
private
Read a signed, 32-bit value from the stream.

Definition at line 631 of file xplra.py.

◆ _readString()

def xplra.XPlane._readString (   self)
private
Read a string from our stream.

Definition at line 661 of file xplra.py.

◆ _readU32()

def xplra.XPlane._readU32 (   self)
private
Read an unsigned, 32-bit value from the stream.

Definition at line 636 of file xplra.py.

◆ _readU8()

def xplra.XPlane._readU8 (   self)
private
Read an unsigned, 8-bit value from the stream.

Definition at line 626 of file xplra.py.

◆ _readValue()

def xplra.XPlane._readValue (   self,
  type 
)
private
Read the value of the given type from the stream.

Definition at line 535 of file xplra.py.

◆ _setSingle()

def xplra.XPlane._setSingle (   self,
  name,
  type,
  value,
  offset = None 
)
private
Set the single value of the given name and type.

Definition at line 558 of file xplra.py.

◆ _writeDouble()

def xplra.XPlane._writeDouble (   self,
  x 
)
private
Write the given value as a double-precision floating point.

Definition at line 610 of file xplra.py.

◆ _writeFloat()

def xplra.XPlane._writeFloat (   self,
  x 
)
private
Write the given value as a single-precision floating point.

Definition at line 606 of file xplra.py.

◆ _writeLength()

def xplra.XPlane._writeLength (   self,
  length 
)
private
Write the given value is a variable-length value into our stream.

Definition at line 614 of file xplra.py.

◆ _writeS32()

def xplra.XPlane._writeS32 (   self,
  x 
)
private
Write the given value as a signed, 32-bit value.

Definition at line 598 of file xplra.py.

◆ _writeString()

def xplra.XPlane._writeString (   self,
  str 
)
private
Write the given string into the stream.

Definition at line 618 of file xplra.py.

◆ _writeU16()

def xplra.XPlane._writeU16 (   self,
  x 
)
private
Write the given value as an unsigned, 16-bit value.

Definition at line 594 of file xplra.py.

◆ _writeU32()

def xplra.XPlane._writeU32 (   self,
  x 
)
private
Write the given value as an unsigned, 32-bit value.

Definition at line 602 of file xplra.py.

◆ _writeU8()

def xplra.XPlane._writeU8 (   self,
  x 
)
private
Write the given value as an unsigned, 8-bit value.

Definition at line 590 of file xplra.py.

◆ _writeValue()

def xplra.XPlane._writeValue (   self,
  type,
  value 
)
private
Write a value of the given type.

Definition at line 571 of file xplra.py.

◆ connect()

def xplra.XPlane.connect (   self,
  address = None 
)
Try to connect to X-Plane.

Definition at line 303 of file xplra.py.

◆ createMultiGetter()

def xplra.XPlane.createMultiGetter (   self)
Create a new multi-dataref getter for this X-Plane object.

Definition at line 345 of file xplra.py.

◆ createMultiSetter()

def xplra.XPlane.createMultiSetter (   self)
Create a new multi-dataref setter for this X-Plane object.

Definition at line 351 of file xplra.py.

◆ destroyMultiBuffer()

def xplra.XPlane.destroyMultiBuffer (   self,
  multiBuffer 
)
Destroy the given multi-dataref buffer.

It actually removes it from the list of multiple buffers and
unregisters it safely.

Returns the result of the safe unregistration if the buffer was found,
None otherwise.

Definition at line 357 of file xplra.py.

◆ disconnect()

def xplra.XPlane.disconnect (   self)
Disconnect from X-Plane.

Definition at line 499 of file xplra.py.

◆ getByteArray()

def xplra.XPlane.getByteArray (   self,
  name,
  length = -1,
  offset = 0 
)
Get the value of the byte array dataref with the given name.

Definition at line 414 of file xplra.py.

◆ getDouble()

def xplra.XPlane.getDouble (   self,
  name 
)
Get the value of the double dataref with the given name.

Definition at line 402 of file xplra.py.

◆ getFloat()

def xplra.XPlane.getFloat (   self,
  name 
)
Get the value of the float dataref with the given name.

Definition at line 398 of file xplra.py.

◆ getFloatArray()

def xplra.XPlane.getFloatArray (   self,
  name,
  length = -1,
  offset = 0 
)
Get the value of the float array dataref with the given name.

Definition at line 406 of file xplra.py.

◆ getInt()

def xplra.XPlane.getInt (   self,
  name 
)
Get the value of the integer dataref with the given name.

Definition at line 394 of file xplra.py.

◆ getIntArray()

def xplra.XPlane.getIntArray (   self,
  name,
  length = -1,
  offset = 0 
)
Get the value of the integer array dataref with the given name.

Definition at line 410 of file xplra.py.

◆ getString()

def xplra.XPlane.getString (   self,
  name,
  offset = 0 
)
Get the value of the byte array dataref with the given name as a
string.

Definition at line 418 of file xplra.py.

◆ getVersions()

def xplra.XPlane.getVersions (   self)
Get the versions of X-Plane, XPLM and XPLRA as a tuple.

Definition at line 372 of file xplra.py.

◆ isConnected()

def xplra.XPlane.isConnected (   self)
Determine if we are connected to the simulator.

Definition at line 341 of file xplra.py.

◆ queryHotkeys()

def xplra.XPlane.queryHotkeys (   self)
Query the state of the hotkeys registered previously

Definition at line 480 of file xplra.py.

◆ registerHotkeys()

def xplra.XPlane.registerHotkeys (   self,
  hotkeyCodes 
)
Register the given hotkey codes for watching.

Definition at line 471 of file xplra.py.

◆ reloadPlugins()

def xplra.XPlane.reloadPlugins (   self)
Reload the plugins in X-Plane.

After this, this connection becomes invalid.

Definition at line 379 of file xplra.py.

◆ saveSituation()

def xplra.XPlane.saveSituation (   self,
  path 
)
Save the current situation into the given path.

Definition at line 387 of file xplra.py.

◆ setByteArray()

def xplra.XPlane.setByteArray (   self,
  name,
  value,
  offset = 0 
)
Set the value of the byte array dataref with the given name.

Definition at line 447 of file xplra.py.

◆ setDouble()

def xplra.XPlane.setDouble (   self,
  name,
  value 
)
Set the value of the double dataref with the given name.

Definition at line 435 of file xplra.py.

◆ setFloat()

def xplra.XPlane.setFloat (   self,
  name,
  value 
)
Set the value of the float dataref with the given name.

Definition at line 431 of file xplra.py.

◆ setFloatArray()

def xplra.XPlane.setFloatArray (   self,
  name,
  value,
  offset = 0 
)
Set the value of the float array dataref with the given name.

Definition at line 439 of file xplra.py.

◆ setInt()

def xplra.XPlane.setInt (   self,
  name,
  value 
)
Set the value of the integer dataref with the given name.

Definition at line 427 of file xplra.py.

◆ setIntArray()

def xplra.XPlane.setIntArray (   self,
  name,
  value,
  offset = 0 
)
Set the value of the integer array dataref with the given name.

Definition at line 443 of file xplra.py.

◆ setString()

def xplra.XPlane.setString (   self,
  name,
  value,
  length,
  offset = 0 
)
Set the value of the byte array dataref with the given name from a
string.

The string will be padded with 0's so that its length is the given
one.

Definition at line 451 of file xplra.py.

◆ showMessage()

def xplra.XPlane.showMessage (   self,
  message,
  duration 
)
Show a message in the simulator window for the given duration.

The duration is a floating-point number denoting seconds.

Definition at line 461 of file xplra.py.

◆ unregisterHotkeys()

def xplra.XPlane.unregisterHotkeys (   self)
Unregister the previously registered hotkeys.

Definition at line 493 of file xplra.py.


The documentation for this class was generated from the following file: