refs #207, added simulator setup to CSimulatorInfo

* setup will provide some metadata about the flight simulator, such as path, version etc.
* there will be a sim independent setup class, providing common information such as path, is simulator installed, etc.
* a sim dependent class on top will provide the values specific to one sim
* setup will contain the logic to fetch its values: setup->init
This commit is contained in:
Klaus Basan
2014-04-14 12:12:09 +02:00
parent 9db245c843
commit 89cb48bbfc
8 changed files with 162 additions and 5 deletions

View File

@@ -0,0 +1,14 @@
#include "fsxsimulatorsetup.h"
#include "../fsx/simconnectutilities.h"
namespace BlackSim
{
namespace Fsx
{
void CFsxSimulatorSetup::init()
{
CSimulatorSetup::init();
this->m_setup.addValue(SetupSimConnectCfgFile, CSimConnectUtilities::getLocalSimConnectCfgFilename());
}
}
}

View File

@@ -0,0 +1,43 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BLACKSIM_FSX_SIMSETUP_H
#define BLACKSIM_FSX_SIMSETUP_H
#include "../simulatorsetup.h"
#include <QString>
namespace BlackSim
{
namespace Fsx
{
/*!
* \brief Simulator settings for FSX Flight sims
*/
class CFsxSimulatorSetup : public BlackSim::CSimulatorSetup
{
public:
enum
{
SetupSimConnectCfgFile = 1000
};
//! Default constructor
CFsxSimulatorSetup() : BlackSim::CSimulatorSetup() {}
//! Constructor
CFsxSimulatorSetup(const BlackMisc::CIndexVariantMap &map) : BlackSim::CSimulatorSetup(map) {}
//! Init, to be used where FSX runs
void init();
};
} // namespace
} // namespace
#endif // guard

View File

@@ -27,8 +27,12 @@ namespace BlackSimPlugin
m_isConnected(false),
m_simRunning(false),
m_hSimConnect(nullptr),
m_nextObjID(1)
m_nextObjID(1),
m_simulatorInfo(CSimulatorInfo::FSX())
{
CFsxSimulatorSetup setup;
setup.init(); // this fetches important setting on local side
this->m_simulatorInfo.setSimulatorSetup(setup.getSettings());
QTimer::singleShot(5000, this, SLOT(checkConnection()));
}
@@ -81,6 +85,11 @@ namespace BlackSimPlugin
// TODO
}
CSimulatorInfo CSimulatorFSX::getSimulatorInfo() const
{
return this->m_simulatorInfo;
}
void CALLBACK CSimulatorFSX::SimConnectProc(SIMCONNECT_RECV *pData, DWORD /* cbData */, void *pContext)
{
CSimulatorFSX *simulatorFsx = static_cast<CSimulatorFSX *>(pContext);