Changeset 66:f7c8521991df in xplra


Ignore:
Timestamp:
04/09/13 15:41:24 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added the Doxygen configuration file and updated the documentation to eliminate the warnings

Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • .hgignore

    r63 r66  
    1414build
    1515dist
     16doc/html
  • src/client/c/hu/varadiistvan/xplra/MultiBuffer.cc

    r57 r66  
    259259//------------------------------------------------------------------------------
    260260
    261 size_t MultiBuffer::addInt(const string& name) throw()
     261size_t MultiBuffer::addInt(const std::string& name) throw()
    262262{
    263263    unfinalize();
     
    268268//------------------------------------------------------------------------------
    269269
    270 size_t MultiBuffer::addFloat(const string& name) throw()
     270size_t MultiBuffer::addFloat(const std::string& name) throw()
    271271{
    272272    unfinalize();
     
    277277//------------------------------------------------------------------------------
    278278
    279 size_t MultiBuffer::addDouble(const string& name) throw()
     279size_t MultiBuffer::addDouble(const std::string& name) throw()
    280280{
    281281    unfinalize();
     
    286286//------------------------------------------------------------------------------
    287287
    288 size_t MultiBuffer::addFloatArray(const string& name, size_t length,
     288size_t MultiBuffer::addFloatArray(const std::string& name, size_t length,
    289289                                  size_t offset) throw()
    290290{
     
    297297//------------------------------------------------------------------------------
    298298
    299 size_t MultiBuffer::addIntArray(const string& name, size_t length,
     299size_t MultiBuffer::addIntArray(const std::string& name, size_t length,
    300300                                size_t offset) throw()
    301301{
     
    308308//------------------------------------------------------------------------------
    309309
    310 size_t MultiBuffer::addByteArray(const string& name, size_t length,
     310size_t MultiBuffer::addByteArray(const std::string& name, size_t length,
    311311                                 size_t offset) throw()
    312312{
  • src/client/c/hu/varadiistvan/xplra/MultiBuffer.h

    r57 r66  
    329329     * Set the value of the float array dataref with the given ID.
    330330     *
     331     * @param id the ID of the float array dataref
     332     * @param value the source buffer
    331333     * @param length the amount of data, i.e. you can set only a part
    332334     * of the data in the buffer. If 0, it is assumed to be the length
     
    344346     * Get the value of the float array dataref with the given ID
    345347     *
     348     * @param id the ID of the float array dataref
     349     * @param value the destination buffer
    346350     * @param length the size of the buffer. If 0, it is assumed to be
    347351     * the length of the data in the buffer minus the offset (see
     
    360364     * buffer.
    361365     *
     366     * @param id the ID of the float array dataref
    362367     * @param offset the offset within the buffer. If it is not less
    363368     * than the length of the buffer, 0 is returned.
     
    369374     * Set the value of the integer array dataref with the given ID.
    370375     *
     376     * @param id the ID of the integer array dataref
     377     * @param value the source buffer
    371378     * @param length the amount of data, i.e. you can set only a part
    372379     * of the data in the buffer. If 0, it is assumed to be the length
     
    384391     * Get the value of the integer array dataref with the given ID
    385392     *
     393     * @param id the ID of the integer array dataref
     394     * @param value the destination buffer
    386395     * @param length the size of the buffer. If 0, it is assumed to be
    387396     * the length of the data in the buffer minus the offset (see
     
    399408     * Get the array of integer values as a directly readable buffer.
    400409     *
     410     * @param id the ID of the float array dataref
    401411     * @param offset the offset within the buffer. If it is not less
    402412     * than the length of the buffer, 0 is returned.
     
    409419     * Set the value of the byte array dataref with the given ID.
    410420     *
     421     * @param id the ID of the byte array dataref
     422     * @param value the source buffer
    411423     * @param length the amount of data, i.e. you can set only a part
    412424     * of the data in the buffer. If 0, it is assumed to be the length
     
    424436     * Get the value of the byte array dataref with the given ID
    425437     *
     438     * @param id the ID of the byte array dataref
     439     * @param value the destination buffer
    426440     * @param length the size of the buffer. If 0, it is assumed to be
    427441     * the length of the data in the buffer minus the offset (see
     
    433447     */
    434448    size_t getByteArray(size_t id, uint8_t* value,
    435                        size_t length = 0, size_t offset = 0) const
     449                        size_t length = 0, size_t offset = 0) const
    436450        throw(InvalidIDException, TypeMismatchException);
    437451
     
    439453     * Get the array of byte values as a directly readable buffer.
    440454     *
     455     * @param id the ID of the byte array dataref
    441456     * @param offset the offset within the buffer. If it is not less
    442457     * than the length of the buffer, 0 is returned.
  • src/client/c/hu/varadiistvan/xplra/XPlane.h

    r54 r66  
    173173     * Get a possibly partial array of floats.
    174174     *
     175     * @param name the name of the dataref
     176     * @param dest the destination buffer
    175177     * @param length the length of the destination buffer
    176178     * @param offset the offset from which to get the array
     
    185187     * be created with a length needed to hold the returned value.
    186188     *
     189     * @param name the name of the dataref
     190     * @param length will contain the number of floats read
    187191     * @param offset the offset from which to get the array
    188192     */
     
    193197     * Get a possibly partial array of integers.
    194198     *
     199     * @param name the name of the dataref
     200     * @param dest the destination buffer
    195201     * @param length the length of the destination buffer
    196202     * @param offset the offset from which to get the array
     
    205211     * be created with a length needed to hold the returned value.
    206212     *
     213     * @param name the name of the dataref
     214     * @param length will contain the number of integers read
    207215     * @param offset the offset from which to get the array
    208216     */
     
    213221     * Get a possibly partial array of bytes.
    214222     *
     223     * @param name the name of the dataref
     224     * @param dest the destination buffer
    215225     * @param length the length of the destination buffer
    216226     * @param offset the offset from which to get the array
     
    225235     * be created with a length needed to hold the returned value.
    226236     *
    227      * @param offset the offset from which to get the array
    228      */
    229     uint8_t* getByteArray(const char* name, size_t& lengyh,
     237     * @param name the name of the dataref
     238     * @param length will contain the number of bytes read on return
     239     * @param offset the offset from which to get the array
     240     */
     241    uint8_t* getByteArray(const char* name, size_t& length,
    230242                          size_t offset = 0) throw(Exception);
    231243
  • src/client/python/xplra.py

    r64 r66  
    88#-------------------------------------------------------------------------------
    99
     10## @package xplra
     11#
     12# Python client module and C/C++ client library for the X-Plane Remote
     13# Access plugin
     14
     15#-------------------------------------------------------------------------------
     16
     17## Protocol command: query the value of a single dataref
    1018COMMAND_GET_SINGLE = 0x01
    1119
     20## Protocol command: set the value of a single dataref
    1221COMMAND_SET_SINGLE = 0x02
    1322
     23## Protocol command: query the value of several datarefs
    1424COMMAND_GET_MULTI = 0x03
    1525
     26## Protocol command: set the value of several datarefs
    1627COMMAND_SET_MULTI = 0x04
    1728
     29## Protocol command: register a multi-dataref getter
    1830COMMAND_REGISTER_GET_MULTI = 0x11
    1931
     32## Protocol command: unregister a multi-dataref getter
    2033COMMAND_UNREGISTER_GET_MULTI = 0x12
    2134
     35## Protocol command: execute a registered multi-dataref getter
    2236COMMAND_EXECUTE_GET_MULTI = 0x13
    2337
     38## Protocol command: register a multi-dataref setter
    2439COMMAND_REGISTER_SET_MULTI = 0x21
    2540
     41## Protocol command: unregister a multi-dataref setter
    2642COMMAND_UNREGISTER_SET_MULTI = 0x22
    2743
     44## Protocol command: execute a registered multi-dataref setter
    2845COMMAND_EXECUTE_SET_MULTI = 0x23
    2946
     47## Protocol command: get the versions of X-Plane, XPLM and XPLRA
    3048COMMAND_GET_VERSIONS = 0x31
    3149
     50## Protocol command: reload all plugins
    3251COMMAND_RELOAD_PLUGINS = 0x32
    3352
     53## Protocol command: show a message to the pilot
    3454COMMAND_SHOW_MESSAGE = 0x41
    3555
     56## Protocol command: register hotkeys
    3657COMMAND_REGISTER_HOTKEYS = 0x51
    3758
     59## Protocol command: query the status of registered hotkeys
    3860COMMAND_QUERY_HOTKEYS = 0x52
    3961
     62## Protocol command: unregister hotkeys
    4063COMMAND_UNREGISTER_HOTKEYS = 0x53
    4164
     65## Protocol type constant: integer
    4266TYPE_INT = 0x01
    4367
     68## Protocol type constant: single-precision floating point
    4469TYPE_FLOAT = 0x02
    4570
     71## Protocol type constant: double-precision floating point
    4672TYPE_DOUBLE = 0x03
    4773
     74## Protocol type constant: array of single-precision floating point values
    4875TYPE_FLOAT_ARRAY = 0x11
    4976
     77## Protocol type constant: array of integers
    5078TYPE_INT_ARRAY = 0x12
    5179
     80## Protocol type constant: array of bytes
    5281TYPE_BYTE_ARRAY = 0x13
    5382
     83## Protocol result: OK
    5484RESULT_OK = 0x00
    5585
     86## Protocol result: an invalid command was sent
    5687RESULT_INVALID_COMMAND = 0x01
    5788
     89## Protocol result: an unknown dataref was attempted to query or set
    5890RESULT_UNKNOWN_DATAREF = 0x02
    5991
     92## Protocol result: invalid type
    6093RESULT_INVALID_TYPE = 0x03
    6194
     95## Protocol result: invalid length
    6296RESULT_INVALID_LENGTH = 0x04
    6397
     98## Protocol result: invalid offset
    6499RESULT_INVALID_OFFSET = 0x05
    65100
     101## Protocol result: invalid count
    66102RESULT_INVALID_COUNT = 0x06
    67103
     104## Protocol result: invalid ID
    68105RESULT_INVALID_ID = 0x07
    69106
     107## Protocol result: invalid duration
    70108RESULT_INVALID_DURATION = 0x08
    71109
     110## Protocol result: other error
    72111RESULT_OTHER_ERROR = 0xff
    73112
     113## Hotkey modifier: Shift
    74114HOTKEY_MODIFIER_SHIFT = 0x0100
    75115
     116## Hotkey modifier: Control
    76117HOTKEY_MODIFIER_CONTROL = 0x0200
    77118
     
    80121class ProtocolException(Exception):
    81122    """Exception to signify protocol errors."""
     123
     124    ## mapping from result codes to their string representation
    82125    _message = { RESULT_INVALID_COMMAND : "invalid command",
    83126                 RESULT_UNKNOWN_DATAREF : "unknown dataref",
     
    90133                 RESULT_OTHER_ERROR : "other error" }
    91134
     135    ## @var resultCode
     136    # the result code, one of the RESULT_XXX constants
     137    ## @var parameter
     138    # an optional parameter for the result
     139
    92140    @staticmethod
    93141    def getMessage(resultCode):
     
    99147
    100148    def __init__(self, resultCode, parameter = None):
     149        """Construct the exception."""
    101150        message = "xplra.ProtocolException: " + self.getMessage(resultCode)
    102151        if parameter is not None:
     
    116165    class Win32NamedPipe(io.RawIOBase):
    117166        """A stream object to represent a Win32 named pipe."""
     167        ## @var _handle
     168        # the Windows file handle for the pipe
     169
    118170        def __init__(self, name):
    119171            """Construct the pipe with the given name."""
     
    211263class XPlane(object):
    212264    """The main class representing the connection to X-Plane."""
     265
     266    ## @var _stream
     267    # the data stream used to communicate with the plugin
     268    ## @var _multiBuffers
     269    # the list of multi-dataref buffers belonging to this object
    213270
    214271    @staticmethod
     
    574631class MultiBuffer(object):
    575632    """Buffer for querying or setting multi-dataref values."""
     633
     634    ## @var _xplane
     635    # the \ref XPlane object this buffer belongs to
     636
     637    ## @var _registerCommand
     638    # the command used to perform the registration of this buffer
     639    # (\ref COMMAND_REGISTER_GET_MULTI or \ref COMMAND_REGISTER_SET_MULTI)
     640
     641    ## @var _unregisterCommand
     642    # the command used to perform the registration of this buffer
     643    # (\ref COMMAND_UNREGISTER_GET_MULTI or \ref COMMAND_UNREGISTER_SET_MULTI)
     644
     645    ## @var _dataRefs
     646    # the datarefs belonging to the buffer
     647
     648    ## @var _values
     649    # the value of the datarefs before setting or after querying
     650
     651    ## @var _registeredID
     652    # the ID with which the buffer is registered in X-Plane
     653
    576654    @staticmethod
    577655    def _getDefault(type, length):
  • src/plugin/src/xplra/GetDataRefTask.h

    r13 r66  
    246246     * Construct the task for the dataref with the given name.
    247247     *
     248     * @param name the name of the dataref
    248249     * @param maxCount the maximal number of items to retrieve. If <0,
    249250     * the function will perform an extra query to retrieve the size of
    250251     * of the dataref's data, which it will store in the task, so
    251252     * later on it can be reused.
     253     * @param offset the offset from which to query the array
    252254     */
    253255    GetArrayDataRefTask(const std::string& name,
     
    257259     * Construct the task for the given dataref
    258260     *
     261     * @param dataRef the dataref
    259262     * @param maxCount the maximal number of items to retrieve. If <0,
    260263     * the function will perform an extra query to retrieve the size
    261264     * of the dataref's data, which it will store in the task, so
    262265     * later on it can be reused.
     266     * @param offset the offset from which to query the array
    263267     */
    264268    GetArrayDataRefTask(XPLMDataRef dataRef,
     
    313317     * Construct the task for the dataref with the given name.
    314318     *
     319     * @param name the name of the dataref
    315320     * @param maxCount the maximal number of data items to
    316321     * retrieve. If <0, the function will perform an extra query to
    317322     * retrieve the size of the dataref's data, which it will store in
    318323     * the task, so later on it can be reused.
     324     * @param offset the offset from which to query the array
    319325     */
    320326    GetFloatArrayDataRefTask(const std::string& name,
     
    324330     * Construct the task for the given dataref
    325331     *
    326      * @param maxBytes the maximal number of data items to
    327      * retrieve. If <0, the function will perform an extra query to
    328      * retrieve the size of the dataref's data, which it will store in
    329      * the task, so later on it can be reused.
    330      */
    331     GetFloatArrayDataRefTask(XPLMDataRef dataRef,
    332                              int maxCount = -1, int offset = 0);
    333 };
    334 
    335 //------------------------------------------------------------------------------
    336 //------------------------------------------------------------------------------
    337 
    338 /**
    339  * A dataref task which retrieves the value of an integer array.
    340  */
    341 class GetIntArrayDataRefTask :
    342         public GetArrayDataRefTask<int, GetIntArrayDataRefTask>
    343 {
    344 public:
    345     /**
    346      * Get the data via XPLM
    347      */
    348     static int queryData(XPLMDataRef dataRef, int* dest,
    349                          int offset, int count);
    350 
    351 public:
    352     /**
    353      * Construct the task for the dataref with the given name.
    354      *
     332     * @param dataRef the dataref
    355333     * @param maxCount the maximal number of data items to
    356334     * retrieve. If <0, the function will perform an extra query to
    357335     * retrieve the size of the dataref's data, which it will store in
    358336     * the task, so later on it can be reused.
    359      */
    360     GetIntArrayDataRefTask(const std::string& name,
    361                            int maxCount = -1, int offset = 0);
    362 
    363     /**
    364      * Construct the task for the given dataref
    365      *
    366      * @param maxBytes the maximal number of data items to
     337     * @param offset the offset from which to query the array
     338     */
     339    GetFloatArrayDataRefTask(XPLMDataRef dataRef,
     340                             int maxCount = -1, int offset = 0);
     341};
     342
     343//------------------------------------------------------------------------------
     344//------------------------------------------------------------------------------
     345
     346/**
     347 * A dataref task which retrieves the value of an integer array.
     348 */
     349class GetIntArrayDataRefTask :
     350        public GetArrayDataRefTask<int, GetIntArrayDataRefTask>
     351{
     352public:
     353    /**
     354     * Get the data via XPLM
     355     */
     356    static int queryData(XPLMDataRef dataRef, int* dest,
     357                         int offset, int count);
     358
     359public:
     360    /**
     361     * Construct the task for the dataref with the given name.
     362     *
     363     * @param name the name of the dataref
     364     * @param maxCount the maximal number of data items to
    367365     * retrieve. If <0, the function will perform an extra query to
    368366     * retrieve the size of the dataref's data, which it will store in
    369367     * the task, so later on it can be reused.
     368     * @param offset the offset from which to query the array
     369     */
     370    GetIntArrayDataRefTask(const std::string& name,
     371                           int maxCount = -1, int offset = 0);
     372
     373    /**
     374     * Construct the task for the given dataref
     375     *
     376     * @param dataRef the dataref
     377     * @param maxCount the maximal number of data items to
     378     * retrieve. If <0, the function will perform an extra query to
     379     * retrieve the size of the dataref's data, which it will store in
     380     * the task, so later on it can be reused.
     381     * @param offset the offset from which to query the array
    370382     */
    371383    GetIntArrayDataRefTask(XPLMDataRef dataRef,
     
    393405     * Construct the task for the dataref with the given name.
    394406     *
     407     * @param name the name of the dataref
    395408     * @param maxBytes the maximal number of bytes to retrieve. If <0,
    396409     * the function will perform an extra query to retrieve the size
    397410     * of the dataref's data, which it will store in the task, so
    398411     * later on it can be reused.
     412     * @param offset the offset from which to query the array
    399413     */
    400414    GetByteArrayDataRefTask(const std::string& name,
     
    404418     * Construct the task for the given dataref
    405419     *
     420     * @param dataRef the dataref
    406421     * @param maxBytes the maximal number of bytes to retrieve. If <0,
    407422     * the function will perform an extra query to retrieve the size
    408423     * of the dataref's data, which it will store in the task, so
    409424     * later on it can be reused.
     425     * @param offset the offset from which to query the array
    410426     */
    411427    GetByteArrayDataRefTask(XPLMDataRef dataRef,
  • src/plugin/src/xplra/SetDataRefTask.h

    r13 r66  
    6262     * signifies an error only, if some wrong data is read. If the
    6363     * stream fails, it will indicate RESULT_OK.
     64     * @param stream the stream to read from
    6465     *
    6566     * @return the new instance or 0 on error.
Note: See TracChangeset for help on using the changeset viewer.