mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
refs #207, added simulator info to interface, plugin
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user