mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
Make FSUIPC optional
Summary: If FSUIPC is configured, its support will be enabled in swift and disabled otherwise. Ref T91 Reviewers: #swift_pilot_client, msutcliffe Reviewed By: #swift_pilot_client, msutcliffe Subscribers: msutcliffe, jenkins, kbasan Maniphest Tasks: T91 Differential Revision: https://dev.swift-project.org/D28
This commit is contained in:
@@ -22,6 +22,7 @@ BLACK_CONFIG *= PackageInstaller
|
|||||||
BLACK_CONFIG *= Doxygen
|
BLACK_CONFIG *= Doxygen
|
||||||
#BLACK_CONFIG *= SwiftDevBranch
|
#BLACK_CONFIG *= SwiftDevBranch
|
||||||
#BLACK_CONFIG *= SwiftStableBranch
|
#BLACK_CONFIG *= SwiftStableBranch
|
||||||
|
BLACK_CONFIG *= FSUIPC
|
||||||
|
|
||||||
isEmpty(BLACK_EOL): BLACK_EOL = "20180101"
|
isEmpty(BLACK_EOL): BLACK_EOL = "20180101"
|
||||||
|
|
||||||
@@ -42,6 +43,7 @@ include(vatsim.pri)
|
|||||||
!contains(BLACK_CONFIG, P3D) { DEFINE_WITH_P3D = "//" }
|
!contains(BLACK_CONFIG, P3D) { DEFINE_WITH_P3D = "//" }
|
||||||
!contains(BLACK_CONFIG, FSX) { DEFINE_WITH_FSX = "//" }
|
!contains(BLACK_CONFIG, FSX) { DEFINE_WITH_FSX = "//" }
|
||||||
!contains(BLACK_CONFIG, FS9) { DEFINE_WITH_FS9 = "//" }
|
!contains(BLACK_CONFIG, FS9) { DEFINE_WITH_FS9 = "//" }
|
||||||
|
!contains(BLACK_CONFIG, FSUIPC) { DEFINE_WITH_FSUIPC = "//" }
|
||||||
!contains(BLACK_CONFIG, XPlane) { DEFINE_WITH_XPLANE = "//" }
|
!contains(BLACK_CONFIG, XPlane) { DEFINE_WITH_XPLANE = "//" }
|
||||||
!contains(BLACK_CONFIG, SwiftDevBranch) { DEFINE_SWIFT_DEV_BRANCH = "//" }
|
!contains(BLACK_CONFIG, SwiftDevBranch) { DEFINE_SWIFT_DEV_BRANCH = "//" }
|
||||||
!contains(BLACK_CONFIG, SwiftStableBranch) { DEFINE_SWIFT_STABLE_BRANCH = "//" }
|
!contains(BLACK_CONFIG, SwiftStableBranch) { DEFINE_SWIFT_STABLE_BRANCH = "//" }
|
||||||
|
|||||||
@@ -32,13 +32,6 @@ blackcore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LIBS *= -lblackcore -lvatlib
|
LIBS *= -lblackcore -lvatlib
|
||||||
|
|
||||||
win32 {
|
|
||||||
contains(BLACK_CONFIG, FSX) {
|
|
||||||
LIBS *= -lSimConnect
|
|
||||||
LIBS *= -lFSUIPC_User
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blacksound {
|
blacksound {
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ namespace BlackConfig
|
|||||||
//! with P3D support?
|
//! with P3D support?
|
||||||
static bool isCompiledWithP3DSupport(); // defined in buildconfig_gen.cpp.in
|
static bool isCompiledWithP3DSupport(); // defined in buildconfig_gen.cpp.in
|
||||||
|
|
||||||
|
//! with Fsuipc support?
|
||||||
|
static bool isCompiledWithFsuipcSupport(); // defined in buildconfig_gen.cpp.in
|
||||||
|
|
||||||
//! Compiled with any MS Flight Simulator support (P3D, FSX, FS9)
|
//! Compiled with any MS Flight Simulator support (P3D, FSX, FS9)
|
||||||
static bool isCompiledWithMsFlightSimulatorSupport();
|
static bool isCompiledWithMsFlightSimulatorSupport();
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ $$DEFINE_WITH_SWIFTCORE#define WITH_SWIFTCORE
|
|||||||
$$DEFINE_WITH_FSX#define WITH_FSX
|
$$DEFINE_WITH_FSX#define WITH_FSX
|
||||||
$$DEFINE_WITH_P3D#define WITH_P3D
|
$$DEFINE_WITH_P3D#define WITH_P3D
|
||||||
$$DEFINE_WITH_FS9#define WITH_FS9
|
$$DEFINE_WITH_FS9#define WITH_FS9
|
||||||
|
$$DEFINE_WITH_FSUIPC#define WITH_FSUIPC
|
||||||
$$DEFINE_WITH_XPLANE#define WITH_XPLANE
|
$$DEFINE_WITH_XPLANE#define WITH_XPLANE
|
||||||
$$DEFINE_SWIFT_DEV_BRANCH#define SWIFT_DEV_BRANCH
|
$$DEFINE_SWIFT_DEV_BRANCH#define SWIFT_DEV_BRANCH
|
||||||
$$DEFINE_SWIFT_STABLE_BRANCH#define SWIFT_STABLE_BRANCH
|
$$DEFINE_SWIFT_STABLE_BRANCH#define SWIFT_STABLE_BRANCH
|
||||||
@@ -80,6 +81,15 @@ bool BlackConfig::CBuildConfig::isCompiledWithFsxSupport()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BlackConfig::CBuildConfig::isCompiledWithFsuipcSupport()
|
||||||
|
{
|
||||||
|
#ifdef WITH_FSUIPC
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool BlackConfig::CBuildConfig::isCompiledWithXPlaneSupport()
|
bool BlackConfig::CBuildConfig::isCompiledWithXPlaneSupport()
|
||||||
{
|
{
|
||||||
#ifdef WITH_XPLANE
|
#ifdef WITH_XPLANE
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#ifndef BLACKCORE_SIMULATOR_H
|
#ifndef BLACKCORE_SIMULATOR_H
|
||||||
#define BLACKCORE_SIMULATOR_H
|
#define BLACKCORE_SIMULATOR_H
|
||||||
|
|
||||||
|
#include "blackconfig/buildconfig.h"
|
||||||
#include "blackcore/blackcoreexport.h"
|
#include "blackcore/blackcoreexport.h"
|
||||||
#include "blackmisc/aviation/airportlist.h"
|
#include "blackmisc/aviation/airportlist.h"
|
||||||
#include "blackmisc/aviation/callsignset.h"
|
#include "blackmisc/aviation/callsignset.h"
|
||||||
@@ -173,7 +174,10 @@ namespace BlackCore
|
|||||||
if (BlackMisc::CSimpleCommandParser::registered("BlackCore::ISimulator")) { return; }
|
if (BlackMisc::CSimpleCommandParser::registered("BlackCore::ISimulator")) { return; }
|
||||||
BlackMisc::CSimpleCommandParser::registerCommand({".drv", "alias: .driver .plugin"});
|
BlackMisc::CSimpleCommandParser::registerCommand({".drv", "alias: .driver .plugin"});
|
||||||
BlackMisc::CSimpleCommandParser::registerCommand({".drv unload", "unload driver"});
|
BlackMisc::CSimpleCommandParser::registerCommand({".drv unload", "unload driver"});
|
||||||
BlackMisc::CSimpleCommandParser::registerCommand({".drv fsuipc on|off", "enable/disable FSUIPC (if applicable)"});
|
if (BlackConfig::CBuildConfig::isCompiledWithFsuipcSupport())
|
||||||
|
{
|
||||||
|
BlackMisc::CSimpleCommandParser::registerCommand({".drv fsuipc on|off", "enable/disable FSUIPC (if applicable)"});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Status to string
|
//! Status to string
|
||||||
|
|||||||
@@ -8,17 +8,19 @@ TEMPLATE = lib
|
|||||||
CONFIG += staticlib
|
CONFIG += staticlib
|
||||||
CONFIG += blackmisc
|
CONFIG += blackmisc
|
||||||
|
|
||||||
LIBS += -lFSUIPC_User
|
|
||||||
|
|
||||||
# required for FSUIPC
|
|
||||||
win32:!win32-g++*: QMAKE_LFLAGS += /NODEFAULTLIB:LIBC.lib
|
|
||||||
|
|
||||||
DEPENDPATH += . $$SourceRoot/src
|
DEPENDPATH += . $$SourceRoot/src
|
||||||
INCLUDEPATH += . $$SourceRoot/src
|
INCLUDEPATH += . $$SourceRoot/src
|
||||||
|
|
||||||
SOURCES += *.cpp
|
SOURCES += *.cpp
|
||||||
HEADERS += *.h
|
HEADERS += *.h
|
||||||
|
|
||||||
|
contains(BLACK_CONFIG, FSUIPC): DEFINES += SWIFT_USING_FSUIPC
|
||||||
|
|
||||||
|
LIBS += -lFSUIPC_User
|
||||||
|
|
||||||
|
# required for FSUIPC
|
||||||
|
win32:!win32-g++*: QMAKE_LFLAGS += /NODEFAULTLIB:LIBC.lib
|
||||||
|
|
||||||
DESTDIR = $$DestRoot/lib
|
DESTDIR = $$DestRoot/lib
|
||||||
|
|
||||||
load(common_post)
|
load(common_post)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CFsuipc();
|
CFsuipc(QObject *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CFsuipc();
|
virtual ~CFsuipc();
|
||||||
@@ -39,10 +39,7 @@ namespace BlackSimPlugin
|
|||||||
void disconnect();
|
void disconnect();
|
||||||
|
|
||||||
//! Is connected?
|
//! Is connected?
|
||||||
bool isConnected() const { return m_connected; }
|
bool isConnected() const;
|
||||||
|
|
||||||
//! Process reading and writing variables
|
|
||||||
void process(BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
|
||||||
|
|
||||||
//! Write variables
|
//! Write variables
|
||||||
bool write(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
bool write(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||||
@@ -51,7 +48,7 @@ namespace BlackSimPlugin
|
|||||||
bool write(const BlackMisc::Weather::CWeatherGrid &weatherGrid);
|
bool write(const BlackMisc::Weather::CWeatherGrid &weatherGrid);
|
||||||
|
|
||||||
//! Get the version
|
//! Get the version
|
||||||
QString getVersion() const { return m_fsuipcVersion; }
|
QString getVersion() const;
|
||||||
|
|
||||||
//! Read data from FSUIPC
|
//! Read data from FSUIPC
|
||||||
//! \param aircraft object to be updated
|
//! \param aircraft object to be updated
|
||||||
@@ -102,19 +99,13 @@ namespace BlackSimPlugin
|
|||||||
//! Log message category
|
//! Log message category
|
||||||
static QString getLogCategory() { return "swift.fscommon.fsuipc"; }
|
static QString getLogCategory() { return "swift.fscommon.fsuipc"; }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! \copydoc QObject::timerEvent
|
//! \copydoc QObject::timerEvent
|
||||||
void timerEvent(QTimerEvent *event);
|
void timerEvent(QTimerEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct FsuipcWeatherMessage
|
struct FsuipcWeatherMessage;
|
||||||
{
|
|
||||||
FsuipcWeatherMessage() = default;
|
|
||||||
FsuipcWeatherMessage(unsigned int offset, const QByteArray &data, int leftTrials);
|
|
||||||
int m_offset = 0;
|
|
||||||
QByteArray m_messageData;
|
|
||||||
int m_leftTrials = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
void clearAllWeather();
|
void clearAllWeather();
|
||||||
void processWeatherMessages();
|
void processWeatherMessages();
|
||||||
|
|||||||
78
src/plugins/simulator/fscommon/fsuipcdummy.cpp
Normal file
78
src/plugins/simulator/fscommon/fsuipcdummy.cpp
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/* Copyright (C) 2017
|
||||||
|
* swift Project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SWIFT_USING_FSUIPC
|
||||||
|
|
||||||
|
#include "fsuipc.h"
|
||||||
|
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
|
|
||||||
|
namespace BlackSimPlugin
|
||||||
|
{
|
||||||
|
namespace FsCommon
|
||||||
|
{
|
||||||
|
//! Dummy FsuipcWeatherMessage
|
||||||
|
struct CFsuipc::FsuipcWeatherMessage
|
||||||
|
{ };
|
||||||
|
|
||||||
|
CFsuipc::CFsuipc(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
CFsuipc::~CFsuipc()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
bool CFsuipc::connect()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFsuipc::disconnect()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
bool CFsuipc::isConnected() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFsuipc::write(const CSimulatedAircraft &aircraft)
|
||||||
|
{
|
||||||
|
Q_UNUSED(aircraft);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFsuipc::write(const BlackMisc::Weather::CWeatherGrid &weatherGrid)
|
||||||
|
{
|
||||||
|
Q_UNUSED(weatherGrid);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CFsuipc::getVersion() const
|
||||||
|
{
|
||||||
|
return "N/A";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFsuipc::read(CSimulatedAircraft &aircraft, bool cockpit, bool situation, bool aircraftParts)
|
||||||
|
{
|
||||||
|
Q_UNUSED(aircraft);
|
||||||
|
Q_UNUSED(cockpit);
|
||||||
|
Q_UNUSED(situation);
|
||||||
|
Q_UNUSED(aircraftParts);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFsuipc::timerEvent(QTimerEvent *event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif //SWIFT_USING_FSUIPC
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2014
|
/* Copyright (C) 2017
|
||||||
* swift Project Community / Contributors
|
* swift Project Community / Contributors
|
||||||
*
|
*
|
||||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef SWIFT_USING_FSUIPC
|
||||||
|
|
||||||
#ifndef NOMINMAX
|
#ifndef NOMINMAX
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#endif
|
#endif
|
||||||
@@ -36,7 +38,18 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
namespace FsCommon
|
namespace FsCommon
|
||||||
{
|
{
|
||||||
CFsuipc::CFsuipc()
|
//! Fsuipc weather message
|
||||||
|
struct CFsuipc::FsuipcWeatherMessage
|
||||||
|
{
|
||||||
|
FsuipcWeatherMessage() = default;
|
||||||
|
FsuipcWeatherMessage(unsigned int offset, const QByteArray &data, int leftTrials);
|
||||||
|
int m_offset = 0;
|
||||||
|
QByteArray m_messageData;
|
||||||
|
int m_leftTrials = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
CFsuipc::CFsuipc(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
startTimer(100);
|
startTimer(100);
|
||||||
}
|
}
|
||||||
@@ -84,6 +97,11 @@ namespace BlackSimPlugin
|
|||||||
this->m_connected = false;
|
this->m_connected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CFsuipc::isConnected() const
|
||||||
|
{
|
||||||
|
return m_connected;
|
||||||
|
}
|
||||||
|
|
||||||
bool CFsuipc::write(const CSimulatedAircraft &aircraft)
|
bool CFsuipc::write(const CSimulatedAircraft &aircraft)
|
||||||
{
|
{
|
||||||
if (!this->isConnected()) { return false; }
|
if (!this->isConnected()) { return false; }
|
||||||
@@ -224,6 +242,11 @@ namespace BlackSimPlugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CFsuipc::getVersion() const
|
||||||
|
{
|
||||||
|
return m_fsuipcVersion;
|
||||||
|
}
|
||||||
|
|
||||||
bool CFsuipc::read(CSimulatedAircraft &aircraft, bool cockpit, bool situation, bool aircraftParts)
|
bool CFsuipc::read(CSimulatedAircraft &aircraft, bool cockpit, bool situation, bool aircraftParts)
|
||||||
{
|
{
|
||||||
DWORD dwResult;
|
DWORD dwResult;
|
||||||
@@ -476,3 +499,5 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
#endif //SWIFT_USING_FSUIPC
|
||||||
@@ -33,7 +33,7 @@ namespace BlackSimPlugin
|
|||||||
Weather::IWeatherGridProvider *weatherGridProvider,
|
Weather::IWeatherGridProvider *weatherGridProvider,
|
||||||
QObject *parent) :
|
QObject *parent) :
|
||||||
CSimulatorCommon(info, ownAircraftProvider, renderedAircraftProvider, weatherGridProvider, parent),
|
CSimulatorCommon(info, ownAircraftProvider, renderedAircraftProvider, weatherGridProvider, parent),
|
||||||
m_fsuipc(new CFsuipc())
|
m_fsuipc(std::make_unique<CFsuipc>(this))
|
||||||
{
|
{
|
||||||
CSimulatorFsCommon::registerHelp();
|
CSimulatorFsCommon::registerHelp();
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorFsCommon::isFsuipcConnected() const
|
bool CSimulatorFsCommon::isFsuipcConnected() const
|
||||||
{
|
{
|
||||||
return !m_fsuipc.isNull() && m_fsuipc->isConnected();
|
return m_fsuipc && m_fsuipc->isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFsCommon::useFsuipc(bool on)
|
bool CSimulatorFsCommon::useFsuipc(bool on)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "fsuipc.h"
|
#include "fsuipc.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace BlackSimPlugin
|
namespace BlackSimPlugin
|
||||||
{
|
{
|
||||||
@@ -81,7 +82,7 @@ namespace BlackSimPlugin
|
|||||||
QString m_simulatorName; //!< name of simulator
|
QString m_simulatorName; //!< name of simulator
|
||||||
QString m_simulatorDetails; //!< describes version etc.
|
QString m_simulatorDetails; //!< describes version etc.
|
||||||
QString m_simulatorVersion; //!< Simulator version
|
QString m_simulatorVersion; //!< Simulator version
|
||||||
QScopedPointer<FsCommon::CFsuipc> m_fsuipc; //!< FSUIPC
|
std::unique_ptr<CFsuipc> m_fsuipc; //!< FSUIPC
|
||||||
bool m_useFsuipc = true; //!< use FSUIPC
|
bool m_useFsuipc = true; //!< use FSUIPC
|
||||||
bool m_simPaused = false; //!< Simulator paused?
|
bool m_simPaused = false; //!< Simulator paused?
|
||||||
bool m_simTimeSynced = false; //!< Time synchronized?
|
bool m_simTimeSynced = false; //!< Time synchronized?
|
||||||
|
|||||||
Reference in New Issue
Block a user