refs #207, added simulator info to interface, plugin

This commit is contained in:
Klaus Basan
2014-04-14 12:13:32 +02:00
parent 89cb48bbfc
commit f2f9ffafa5
4 changed files with 33 additions and 39 deletions

View File

@@ -7,20 +7,22 @@ TARGET = simulator_fsx
TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackmisc blackcore
CONFIG += blackmisc blackcore blacksim
LIBS += -lSimConnect
DEPENDPATH += . ../../../src
INCLUDEPATH += . ../../../src
SOURCES += *.cpp
HEADERS += *.h
win32:!win32-g++*: PRE_TARGETDEPS += ../../../lib/blackmisc.lib
win32:!win32-g++*: PRE_TARGETDEPS += ../../../lib/blackcore.lib
win32:!win32-g++*: PRE_TARGETDEPS += ../../../lib/blackmisc.lib \
../../../lib/blacksim.lib \
../../../lib/blackcore.lib
else: PRE_TARGETDEPS += ../../../lib/libblackmisc.a \
../../../lib/libblacksim.a \
../../../lib/libblackcore.a
DESTDIR = ../../../bin/plugins
include (../../../libraries.pri)

View File

@@ -3,6 +3,7 @@
* 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/. */
#include "blacksim/fsx/fsxsimulatorsetup.h"
#include "simulator_fsx.h"
#include "simconnect_datadefinition.h"
#include "simconnect_exception.h"
@@ -12,6 +13,8 @@
using namespace BlackMisc::Aviation;
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackMisc::Geo;
using namespace BlackSim;
using namespace BlackSim::Fsx;
namespace BlackSimPlugin
{
@@ -258,7 +261,7 @@ namespace BlackSimPlugin
{
if (FAILED(SimConnect_Open(&m_hSimConnect, "BlackBox", nullptr, 0, 0, 0)))
{
QTimer::singleShot(5000, this, SLOT(checkConnection()));
// QTimer::singleShot(5000, this, SLOT(checkConnection()));
return;
}

View File

@@ -31,13 +31,15 @@ namespace BlackSimPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID "net.vatsim.PilotClient.BlackCore.SimulatorInterface")
Q_INTERFACES(BlackCore::ISimulatorFactory)
public:
//! \copydoc BlackCore::ISimulatorFactory::create()
virtual BlackCore::ISimulator* create(QObject *parent) override;
virtual BlackCore::ISimulator *create(QObject *parent) override;
};
//! \brief SimConnect Event ID's
enum EVENT_ID {
enum EVENT_ID
{
EVENT_SIM_STATUS,
EVENT_OBJECT_ADDED,
EVENT_OBJECT_REMOVED,
@@ -71,13 +73,16 @@ namespace BlackSimPlugin
//! \copydoc ISimulator::removeRemoteAircraft()
virtual void removeRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
//! \copydoc ISimulator::getSimulatorInfo()
virtual BlackSim::CSimulatorInfo getSimulatorInfo() const override;
/*!
* \brief SimConnect Callback
* \param pData
* \param cbData
* \param pContext
*/
static void CALLBACK SimConnectProc(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext);
static void CALLBACK SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext);
//! \brief Called when sim has started
void onSimRunning();
@@ -143,11 +148,9 @@ namespace BlackSimPlugin
bool m_simRunning; //!< Sim running.
HANDLE m_hSimConnect; //!< Handle to SimConnect object
uint m_nextObjID;
BlackSim::CSimulatorInfo m_simulatorInfo;
BlackMisc::Aviation::CAircraft m_ownAircraft; //!< Object representing our own aircraft from simulator
QHash<BlackMisc::Aviation::CCallsign, SimConnectObject> m_simConnectObjects;
};
}