Changeset 81:f28f1b8f3ef7 in xplra for src


Ignore:
Timestamp:
05/12/13 05:16:48 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added a command to save the current situation

Location:
src/plugin/src/xplra
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/plugin/src/xplra/Makefile.am

    r75 r81  
    1818        SetMultiDataRefRequest.cc       \
    1919        ReloadPluginsRequest.cc         \
     20        SaveSituationRequest.cc         \
    2021        Globals.cc                      \
    2122        MessageWindow.cc                \
     
    3940        SetMultiDataRefRequest.h        \
    4041        ReloadPluginsRequest.h          \
     42        SaveSituationRequest.h          \
    4143        Globals.h                       \
    4244        MessageWindow.h                 \
  • src/plugin/src/xplra/Protocol.h

    r45 r81  
    102102
    103103    /**
     104     * Command: save the current situation.
     105     *
     106     * Followed by a string containing the path of the file to save
     107     * relative to the X-System directory.
     108     */
     109    static const uint8_t COMMAND_SAVE_SITUATION = 0x33;
     110
     111    /**
    104112     * Command: show a message in the message window.
    105113     */
  • src/plugin/src/xplra/ServerThread.cc

    r46 r81  
    4040#include "SetMultiDataRefRequest.h"
    4141#include "ReloadPluginsRequest.h"
     42#ifdef XPLM200
     43#include "SaveSituationRequest.h"
     44#endif
    4245#include "MessageRequest.h"
    4346#include "Globals.h"
     
    170173        } else if (command==Protocol::COMMAND_RELOAD_PLUGINS) {
    171174            if (!handleReloadPlugins()) break;
     175#ifdef XPLM200
     176        } else if (command==Protocol::COMMAND_SAVE_SITUATION) {
     177            if (!handleSaveSituation()) break;
     178#endif
    172179        } else if (command==Protocol::COMMAND_SHOW_MESSAGE) {
    173180            if (!handleShowMessage()) break;
     
    446453//------------------------------------------------------------------------------
    447454
     455#ifdef XPLM200
     456
     457bool ServerThread::handleSaveSituation()
     458{
     459    string path = stream.readString();
     460    SaveSituationRequest request(path);
     461    if (!requestQueue.execute(&request)) return false;
     462
     463    stream.writeU8(request.getSuccess() ? Protocol::RESULT_OK :
     464                   Protocol::RESULT_OTHER_ERROR);
     465
     466    return true;
     467}
     468
     469#endif
     470
     471//------------------------------------------------------------------------------
     472
    448473bool ServerThread::handleShowMessage()
    449474{
  • src/plugin/src/xplra/ServerThread.h

    r45 r81  
    256256    bool handleReloadPlugins();
    257257
     258#ifdef XPLM200
     259    /**
     260     * Handle the COMMAND_SAVE_SITUATION command.
     261     *
     262     * @return true, if we can continue, false if the thread should quit
     263     */
     264    bool handleSaveSituation();
     265#endif
     266
    258267    /**
    259268     * Handle the COMMAND_SHOW_MESSAGE command
Note: See TracChangeset for help on using the changeset viewer.