Changeset 36:29e3b676c0c2 in xplra for src/client


Ignore:
Timestamp:
02/10/13 08:21:47 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 3 'hg:/home/ivaradi/xplane/hg/xplra' '/'>, 'public')
Message:

Added a new command to query the versions

Location:
src/client
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/client/c/hu/varadiistvan/xplra/XPlane.cc

    r30 r36  
    193193//------------------------------------------------------------------------------
    194194
     195void XPlane::getVersions(int& xplaneVersion, int& xplmVersion, int& xplraVersion)
     196    throw(Exception)
     197{
     198    stream->writeU8(Protocol::COMMAND_GET_VERSIONS);
     199    stream->flush();
     200    checkResult();
     201
     202    xplaneVersion = stream->readS32();
     203    xplmVersion = stream->readS32();
     204    xplraVersion = stream->readS32();
     205
     206    checkStream();
     207}
     208
     209//------------------------------------------------------------------------------
     210
    195211void XPlane::getScalar(const char* name, uint8_t type) throw(Exception)
    196212{
  • src/client/c/hu/varadiistvan/xplra/XPlane.h

    r30 r36  
    145145
    146146    /**
     147     * Get the versions of X-Plane, XPLM and the XPLRA plugin.
     148     */
     149    void getVersions(int& xplaneVersion, int& xplmVersion, int& xplraVersion) throw(Exception);
     150
     151    /**
    147152     * Get the integer value of the dataref with the given name.
    148153     */
  • src/client/c/hu/varadiistvan/xplra/xplra.cc

    r29 r36  
    498498//------------------------------------------------------------------------------
    499499
     500extern "C"int xplra_get_versions(int connectionID,
     501                                 int* xplaneVersion, int* xplmVersion,
     502                                 int* xplraVersion)
     503{
     504    Connection* connection = ConnectionSlot::getValue(connectionID);
     505    if (connection==0) return -1;
     506    try {
     507        connection->getVersions(*xplaneVersion, *xplmVersion, *xplraVersion);
     508        return 0;
     509    } catch (...) {
     510        connection->handleException();
     511        return -1;
     512    }
     513}
     514
     515//------------------------------------------------------------------------------
     516
    500517extern "C" int xplra_get_int(int* value, int connectionID, const char* name)
    501518{
  • src/client/c/hu/varadiistvan/xplra/xplra.h

    r29 r36  
    130130
    131131/*----------------------------------------------------------------------------*/
     132
     133/**
     134 * Get the versions of X-Plane, the XPLM library and XPLRA
     135 */
     136int xplra_get_versions(int connectionID,
     137                       int* xplaneVersion, int* xplmVersion,
     138                       int* xplraVersion);
     139
     140/*----------------------------------------------------------------------------*/
    132141/* Single dataref support                                                     */
    133142/*----------------------------------------------------------------------------*/
  • src/client/python/xplra.py

    r35 r36  
    2727
    2828COMMAND_EXECUTE_SET_MULTI = 0x23
     29
     30COMMAND_GET_VERSIONS = 0x31
    2931
    3032TYPE_INT = 0x01
     
    135137        """Create a new multi-dataref setter for this X-Plane object."""
    136138        return MultiSetter(self)
     139
     140    def getVersions(self):
     141        """Get the versions of X-Plane, XPLM and XPLRA as a tuple."""
     142        self._writeU8(COMMAND_GET_VERSIONS)
     143        self._flush()
     144        self._checkResult()
     145        return (self._readS32(), self._readS32(), self._readS32())
    137146
    138147    def getInt(self, name):
     
    392401
    393402        self._registeredID = None
     403
     404    @property
     405    def values(self):
     406        """Query the values as a list."""
     407        if self._values is None:
     408            self.finalize()
     409        return self._values
    394410
    395411    def addInt(self, name):
Note: See TracChangeset for help on using the changeset viewer.