mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 12:35:43 +08:00
* new signal sending all 3 states together (connected, running, paused) * renamed ISimulator::Status to ConnectionStatus * consolidated some member / signal names * for FS9/XPlane implemented stub functions
This commit is contained in:
committed by
Roland Winklmeier
parent
326ae96def
commit
a94bceddab
@@ -13,8 +13,8 @@ namespace BlackCore
|
|||||||
void registerMetadata()
|
void registerMetadata()
|
||||||
{
|
{
|
||||||
// for some reasons (ask RW) these are registered twice
|
// for some reasons (ask RW) these are registered twice
|
||||||
qRegisterMetaType<ISimulator::Status>();
|
qRegisterMetaType<ISimulator::ConnectionStatus>();
|
||||||
qRegisterMetaType<ISimulator::Status>("Status");
|
qRegisterMetaType<ISimulator::ConnectionStatus>("Status");
|
||||||
qRegisterMetaType<IVoiceChannel::ConnectionStatus>();
|
qRegisterMetaType<IVoiceChannel::ConnectionStatus>();
|
||||||
qRegisterMetaType<IVoiceChannel::ConnectionStatus>("ConnectionStatus");
|
qRegisterMetaType<IVoiceChannel::ConnectionStatus>("ConnectionStatus");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,5 +23,4 @@ namespace BlackCore
|
|||||||
return nullptr; // simulator not mandatory
|
return nullptr; // simulator not mandatory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // namespace
|
||||||
}
|
|
||||||
|
|||||||
@@ -70,7 +70,14 @@ namespace BlackCore
|
|||||||
//! Emitted when the simulator connection changes
|
//! Emitted when the simulator connection changes
|
||||||
void connectionChanged(bool connected);
|
void connectionChanged(bool connected);
|
||||||
|
|
||||||
//! Emitted when own aircraft model changes (TODO move to own aircraft context?)
|
//! Simulator started or stopped
|
||||||
|
void startedChanged(bool startedChanged);
|
||||||
|
|
||||||
|
//! Simulator combined status
|
||||||
|
void simulatorStatusChanged(bool connected, bool running, bool paused);
|
||||||
|
|
||||||
|
//! Emitted when own aircraft model changes
|
||||||
|
//! \todo move to own aircraft context?
|
||||||
void ownAircraftModelChanged(BlackMisc::Network::CAircraftModel model);
|
void ownAircraftModelChanged(BlackMisc::Network::CAircraftModel model);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@@ -82,7 +89,7 @@ namespace BlackCore
|
|||||||
virtual bool isConnected() const = 0;
|
virtual bool isConnected() const = 0;
|
||||||
|
|
||||||
//! Can we connect?
|
//! Can we connect?
|
||||||
virtual bool canConnect() = 0;
|
virtual bool canConnect() const = 0;
|
||||||
|
|
||||||
//! Connect to simulator
|
//! Connect to simulator
|
||||||
virtual bool connectTo() = 0;
|
virtual bool connectTo() = 0;
|
||||||
@@ -93,6 +100,9 @@ namespace BlackCore
|
|||||||
//! Disconnect from simulator
|
//! Disconnect from simulator
|
||||||
virtual bool disconnectFrom() = 0;
|
virtual bool disconnectFrom() = 0;
|
||||||
|
|
||||||
|
//! Returns true when simulator is running
|
||||||
|
virtual bool isRunning() const = 0;
|
||||||
|
|
||||||
//! Simulator info
|
//! Simulator info
|
||||||
virtual BlackSim::CSimulatorInfo getSimulatorInfo() const = 0;
|
virtual BlackSim::CSimulatorInfo getSimulatorInfo() const = 0;
|
||||||
|
|
||||||
@@ -125,7 +135,7 @@ namespace BlackCore
|
|||||||
bool isSimulatorAvailable() const { return BlackMisc::CProject::isCompiledWithFlightSimulatorSupport() && !getSimulatorInfo().isUnspecified(); }
|
bool isSimulatorAvailable() const { return BlackMisc::CProject::isCompiledWithFlightSimulatorSupport() && !getSimulatorInfo().isUnspecified(); }
|
||||||
|
|
||||||
//! Simulator paused?
|
//! Simulator paused?
|
||||||
virtual bool isSimulatorPaused() const = 0;
|
virtual bool isPaused() const = 0;
|
||||||
|
|
||||||
//! Settings have been changed
|
//! Settings have been changed
|
||||||
virtual void settingsChanged(uint type) = 0;
|
virtual void settingsChanged(uint type) = 0;
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ using namespace BlackSim::Settings;
|
|||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
CContextSimulator::CContextSimulator(CRuntimeConfig::ContextMode mode, CRuntime *runtime) : IContextSimulator(mode, runtime),
|
CContextSimulator::CContextSimulator(CRuntimeConfig::ContextMode mode, CRuntime *runtime) : IContextSimulator(mode, runtime)
|
||||||
m_simulator(nullptr), m_updateTimer(nullptr)
|
|
||||||
{
|
{
|
||||||
m_updateTimer = new QTimer(this);
|
m_updateTimer = new QTimer(this);
|
||||||
findSimulatorPlugins();
|
findSimulatorPlugins();
|
||||||
@@ -63,7 +62,7 @@ namespace BlackCore
|
|||||||
return m_simulator->isConnected();
|
return m_simulator->isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CContextSimulator::canConnect()
|
bool CContextSimulator::canConnect() const
|
||||||
{
|
{
|
||||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||||
if (!m_simulator) return false;
|
if (!m_simulator) return false;
|
||||||
@@ -168,11 +167,15 @@ namespace BlackCore
|
|||||||
this->unloadSimulatorPlugin(); // old plugin unloaded
|
this->unloadSimulatorPlugin(); // old plugin unloaded
|
||||||
m_simulator = newSimulator;
|
m_simulator = newSimulator;
|
||||||
|
|
||||||
connect(m_simulator, &ISimulator::statusChanged, this, &CContextSimulator::ps_onConnectionStatusChanged);
|
connect(m_simulator, &ISimulator::connectionStatusChanged, this, &CContextSimulator::ps_onConnectionStatusChanged);
|
||||||
|
connect(m_simulator, &ISimulator::simulatorStatusChanged, this, &CContextSimulator::simulatorStatusChanged);
|
||||||
connect(m_simulator, &ISimulator::aircraftModelChanged, this, &IContextSimulator::ownAircraftModelChanged);
|
connect(m_simulator, &ISimulator::aircraftModelChanged, this, &IContextSimulator::ownAircraftModelChanged);
|
||||||
|
|
||||||
|
// log
|
||||||
connect(CLogHandler::instance(), &CLogHandler::localMessageLogged, m_simulator, &ISimulator::displayStatusMessage);
|
connect(CLogHandler::instance(), &CLogHandler::localMessageLogged, m_simulator, &ISimulator::displayStatusMessage);
|
||||||
connect(CLogHandler::instance(), &CLogHandler::remoteMessageLogged, m_simulator, &ISimulator::displayStatusMessage);
|
connect(CLogHandler::instance(), &CLogHandler::remoteMessageLogged, m_simulator, &ISimulator::displayStatusMessage);
|
||||||
|
|
||||||
|
// connect with network
|
||||||
CAirspaceMonitor *airspace = this->getRuntime()->getCContextNetwork()->getAirspaceMonitor();
|
CAirspaceMonitor *airspace = this->getRuntime()->getCContextNetwork()->getAirspaceMonitor();
|
||||||
connect(airspace, &CAirspaceMonitor::addedAircraft, this, &CContextSimulator::ps_addRemoteAircraft);
|
connect(airspace, &CAirspaceMonitor::addedAircraft, this, &CContextSimulator::ps_addRemoteAircraft);
|
||||||
connect(airspace, &CAirspaceMonitor::changedAircraftSituation, this, &CContextSimulator::ps_addAircraftSituation);
|
connect(airspace, &CAirspaceMonitor::changedAircraftSituation, this, &CContextSimulator::ps_addAircraftSituation);
|
||||||
@@ -292,18 +295,20 @@ namespace BlackCore
|
|||||||
this->m_simulator->updateOwnSimulatorCockpit(ownAircraft);
|
this->m_simulator->updateOwnSimulatorCockpit(ownAircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextSimulator::ps_onConnectionStatusChanged(ISimulator::Status status)
|
void CContextSimulator::ps_onConnectionStatusChanged(ISimulator::ConnectionStatus status)
|
||||||
{
|
{
|
||||||
|
bool connected;
|
||||||
if (status == ISimulator::Connected)
|
if (status == ISimulator::Connected)
|
||||||
{
|
{
|
||||||
|
connected = true;
|
||||||
m_updateTimer->start(100);
|
m_updateTimer->start(100);
|
||||||
emit connectionChanged(true);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
connected = false;
|
||||||
m_updateTimer->stop();
|
m_updateTimer->stop();
|
||||||
emit connectionChanged(false);
|
|
||||||
}
|
}
|
||||||
|
emit connectionChanged(connected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextSimulator::ps_statusMessageReceived(const CStatusMessage &statusMessage)
|
void CContextSimulator::ps_statusMessageReceived(const CStatusMessage &statusMessage)
|
||||||
@@ -363,10 +368,16 @@ namespace BlackCore
|
|||||||
this->m_simulator->setTimeSynchronization(timeSync, syncOffset);
|
this->m_simulator->setTimeSynchronization(timeSync, syncOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CContextSimulator::isSimulatorPaused() const
|
bool CContextSimulator::isPaused() const
|
||||||
{
|
{
|
||||||
if (!this->m_simulator) return false;
|
if (!this->m_simulator) return false;
|
||||||
return this->m_simulator->isSimPaused();
|
return this->m_simulator->isPaused();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CContextSimulator::isRunning() const
|
||||||
|
{
|
||||||
|
if (!this->m_simulator) return false;
|
||||||
|
return this->m_simulator->isRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextSimulator::findSimulatorPlugins()
|
void CContextSimulator::findSimulatorPlugins()
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace BlackCore
|
|||||||
virtual bool isConnected() const override;
|
virtual bool isConnected() const override;
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::canConnect
|
//! \copydoc IContextSimulator::canConnect
|
||||||
virtual bool canConnect() override;
|
virtual bool canConnect() const override;
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::connectTo
|
//! \copydoc IContextSimulator::connectTo
|
||||||
virtual bool connectTo() override;
|
virtual bool connectTo() override;
|
||||||
@@ -59,6 +59,12 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextSimulator::disconnectFrom
|
//! \copydoc IContextSimulator::disconnectFrom
|
||||||
virtual bool disconnectFrom() override;
|
virtual bool disconnectFrom() override;
|
||||||
|
|
||||||
|
//! \copydoc IContextSimulator::isPaused
|
||||||
|
virtual bool isPaused() const override;
|
||||||
|
|
||||||
|
//! \copydoc IContextSimulator::isRunning
|
||||||
|
virtual bool isRunning() const override;
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::getSimulatorInfo()
|
//! \copydoc IContextSimulator::getSimulatorInfo()
|
||||||
virtual BlackSim::CSimulatorInfo getSimulatorInfo() const override;
|
virtual BlackSim::CSimulatorInfo getSimulatorInfo() const override;
|
||||||
|
|
||||||
@@ -89,9 +95,6 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextSimulator::settingsChanged
|
//! \copydoc IContextSimulator::settingsChanged
|
||||||
virtual void settingsChanged(uint type) override;
|
virtual void settingsChanged(uint type) override;
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::isSimulatorPaused
|
|
||||||
virtual bool isSimulatorPaused() const override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! \brief Constructor
|
//! \brief Constructor
|
||||||
CContextSimulator(CRuntimeConfig::ContextMode, CRuntime *runtime);
|
CContextSimulator(CRuntimeConfig::ContextMode, CRuntime *runtime);
|
||||||
@@ -122,7 +125,7 @@ namespace BlackCore
|
|||||||
void ps_updateCockpitFromContext(const BlackMisc::Aviation::CAircraft &ownAircraft, const QString &originator);
|
void ps_updateCockpitFromContext(const BlackMisc::Aviation::CAircraft &ownAircraft, const QString &originator);
|
||||||
|
|
||||||
//! Handle new connection status
|
//! Handle new connection status
|
||||||
void ps_onConnectionStatusChanged(ISimulator::Status status);
|
void ps_onConnectionStatusChanged(ISimulator::ConnectionStatus status);
|
||||||
|
|
||||||
//! Status message received
|
//! Status message received
|
||||||
void ps_statusMessageReceived(const BlackMisc::CStatusMessage &statusMessage);
|
void ps_statusMessageReceived(const BlackMisc::CStatusMessage &statusMessage);
|
||||||
@@ -139,10 +142,10 @@ namespace BlackCore
|
|||||||
|
|
||||||
BlackMisc::Network::CAircraftModel m_aircraftModel;
|
BlackMisc::Network::CAircraftModel m_aircraftModel;
|
||||||
BlackMisc::Aviation::CAircraft m_ownAircraft;
|
BlackMisc::Aviation::CAircraft m_ownAircraft;
|
||||||
BlackCore::ISimulator *m_simulator;
|
BlackCore::ISimulator *m_simulator = nullptr;
|
||||||
|
|
||||||
QTimer *m_updateTimer;
|
QTimer *m_updateTimer = nullptr;
|
||||||
QDir m_pluginsDir;
|
QDir m_pluginsDir = nullptr;
|
||||||
QSet<ISimulatorFactory *> m_simulatorFactories;
|
QSet<ISimulatorFactory *> m_simulatorFactories;
|
||||||
QFuture<bool> m_canConnectResult;
|
QFuture<bool> m_canConnectResult;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,8 +25,23 @@ namespace BlackCore
|
|||||||
this->relaySignals(serviceName, connection);
|
this->relaySignals(serviceName, connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextSimulatorProxy::relaySignals(const QString &/*serviceName*/, QDBusConnection &/*connection*/)
|
void CContextSimulatorProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||||
{ }
|
{
|
||||||
|
bool s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
|
||||||
|
"connectionChanged", this, SIGNAL(connectionChanged(bool)));
|
||||||
|
Q_ASSERT(s);
|
||||||
|
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
|
||||||
|
"startedChanged", this, SIGNAL(startedChanged(bool)));
|
||||||
|
|
||||||
|
Q_ASSERT(s);
|
||||||
|
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
|
||||||
|
"simulatorStatusChanged", this, SIGNAL(simulatorStatusChanged(bool,bool,bool)));
|
||||||
|
Q_ASSERT(s);
|
||||||
|
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
|
||||||
|
"ownAircraftModelChanged", this, SIGNAL(ownAircraftModelChanged(BlackMisc::Network::CAircraftModel)));
|
||||||
|
Q_ASSERT(s);
|
||||||
|
Q_UNUSED(s);
|
||||||
|
}
|
||||||
|
|
||||||
CSimulatorInfoList CContextSimulatorProxy::getAvailableSimulatorPlugins() const
|
CSimulatorInfoList CContextSimulatorProxy::getAvailableSimulatorPlugins() const
|
||||||
{
|
{
|
||||||
@@ -38,7 +53,7 @@ namespace BlackCore
|
|||||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isConnected"));
|
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isConnected"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CContextSimulatorProxy::canConnect()
|
bool CContextSimulatorProxy::canConnect() const
|
||||||
{
|
{
|
||||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("canConnect"));
|
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("canConnect"));
|
||||||
}
|
}
|
||||||
@@ -108,9 +123,14 @@ namespace BlackCore
|
|||||||
m_dBusInterface->callDBus(QLatin1Literal("settingsChanged"), type);
|
m_dBusInterface->callDBus(QLatin1Literal("settingsChanged"), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CContextSimulatorProxy::isSimulatorPaused() const
|
bool CContextSimulatorProxy::isPaused() const
|
||||||
{
|
{
|
||||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isSimulatorPaused"));
|
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isPaused"));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CContextSimulatorProxy::isRunning() const
|
||||||
|
{
|
||||||
|
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isRunning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace BlackCore
|
} // namespace BlackCore
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace BlackCore
|
|||||||
virtual bool isConnected() const override;
|
virtual bool isConnected() const override;
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::canConnect
|
//! \copydoc IContextSimulator::canConnect
|
||||||
virtual bool canConnect() override;
|
virtual bool canConnect() const override;
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::connectTo
|
//! \copydoc IContextSimulator::connectTo
|
||||||
virtual bool connectTo() override;
|
virtual bool connectTo() override;
|
||||||
@@ -61,6 +61,12 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextSimulator::disconnectFrom
|
//! \copydoc IContextSimulator::disconnectFrom
|
||||||
virtual bool disconnectFrom() override;
|
virtual bool disconnectFrom() override;
|
||||||
|
|
||||||
|
//! \copydoc IContextSimulator::isRunning
|
||||||
|
virtual bool isRunning() const override;
|
||||||
|
|
||||||
|
//! \copydoc IContextSimulator::isPaused
|
||||||
|
virtual bool isPaused() const override;
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::getAircraftModel()
|
//! \copydoc IContextSimulator::getAircraftModel()
|
||||||
virtual BlackMisc::Network::CAircraftModel getOwnAircraftModel() const override;
|
virtual BlackMisc::Network::CAircraftModel getOwnAircraftModel() const override;
|
||||||
|
|
||||||
@@ -91,9 +97,6 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextSimulator::settingsChanged
|
//! \copydoc IContextSimulator::settingsChanged
|
||||||
virtual void settingsChanged(uint type) override;
|
virtual void settingsChanged(uint type) override;
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::isSimulatorPaused
|
|
||||||
virtual bool isSimulatorPaused() const override;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace BlackCore
|
} // namespace BlackCore
|
||||||
|
|||||||
@@ -13,4 +13,9 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
ISimulator::ISimulator(QObject *parent) : QObject(parent)
|
ISimulator::ISimulator(QObject *parent) : QObject(parent)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
void ISimulator::emitSimulatorCombinedStatus()
|
||||||
|
{
|
||||||
|
emit simulatorStatusChanged(isConnected(), isRunning(), isPaused());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ namespace BlackCore
|
|||||||
class ISimulator : public QObject
|
class ISimulator : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(Status)
|
Q_ENUMS(ConnectionStatus)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! ISimulator connection
|
//! ISimulator connection
|
||||||
enum Status
|
enum ConnectionStatus
|
||||||
{
|
{
|
||||||
Disconnected,
|
Disconnected,
|
||||||
Connected,
|
Connected,
|
||||||
@@ -49,7 +49,17 @@ namespace BlackCore
|
|||||||
virtual bool isConnected() const = 0;
|
virtual bool isConnected() const = 0;
|
||||||
|
|
||||||
//! Can we connect?
|
//! Can we connect?
|
||||||
virtual bool canConnect() = 0;
|
//! \todo currently some code in XPlane implementation prevents to make the function const, can we fix this
|
||||||
|
virtual bool canConnect() const = 0;
|
||||||
|
|
||||||
|
//! Is time synchronization on?
|
||||||
|
virtual bool isTimeSynchronized() const = 0;
|
||||||
|
|
||||||
|
//! Simulator paused?
|
||||||
|
virtual bool isPaused() const = 0;
|
||||||
|
|
||||||
|
//! Simulator running?
|
||||||
|
virtual bool isRunning() const = 0;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
@@ -100,27 +110,31 @@ namespace BlackCore
|
|||||||
//! \remarks not all drivers implement this, e.g. if it is an intrinsic simulator feature
|
//! \remarks not all drivers implement this, e.g. if it is an intrinsic simulator feature
|
||||||
virtual void setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset) = 0;
|
virtual void setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset) = 0;
|
||||||
|
|
||||||
//! Is time synchronization on?
|
|
||||||
virtual bool isTimeSynchronized() const = 0;
|
|
||||||
|
|
||||||
//! Time synchronization offset
|
//! Time synchronization offset
|
||||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const = 0;
|
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const = 0;
|
||||||
|
|
||||||
//! Simulator paused?
|
|
||||||
virtual bool isSimPaused() const = 0;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Emitted when the connection status has changed
|
//! Emitted when the connection status has changed
|
||||||
void statusChanged(ISimulator::Status status);
|
void connectionStatusChanged(ISimulator::ConnectionStatus status);
|
||||||
|
|
||||||
//! Emitted when own aircraft model has changed
|
//! Emitted when own aircraft model has changed
|
||||||
void aircraftModelChanged(BlackMisc::Network::CAircraftModel model);
|
void aircraftModelChanged(BlackMisc::Network::CAircraftModel model);
|
||||||
|
|
||||||
|
//! Simulator combined status
|
||||||
|
void simulatorStatusChanged(bool connected, bool running, bool paused);
|
||||||
|
|
||||||
//! Simulator started
|
//! Simulator started
|
||||||
void simulatorStarted();
|
void simulatorStarted();
|
||||||
|
|
||||||
//! Simulator stopped;
|
//! Simulator stopped;
|
||||||
void simulatorStopped();
|
void simulatorStopped();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Emit the combined status
|
||||||
|
//! \sa simulatorStatusChanged;
|
||||||
|
void emitSimulatorCombinedStatus();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Factory pattern class to create instances of ISimulator
|
//! Factory pattern class to create instances of ISimulator
|
||||||
@@ -142,6 +156,6 @@ namespace BlackCore
|
|||||||
|
|
||||||
// TODO: Use CProject to store this string
|
// TODO: Use CProject to store this string
|
||||||
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "net.vatsim.PilotClient.BlackCore.SimulatorInterface")
|
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "net.vatsim.PilotClient.BlackCore.SimulatorInterface")
|
||||||
Q_DECLARE_METATYPE(BlackCore::ISimulator::Status)
|
Q_DECLARE_METATYPE(BlackCore::ISimulator::ConnectionStatus)
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -59,11 +59,11 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (!this->isVisibleWidget()) return; // no updates on invisible widgets
|
if (!this->isVisibleWidget()) return; // no updates on invisible widgets
|
||||||
if (!this->getIContextOwnAircraft()) return;
|
if (!this->getIContextOwnAircraft()) return;
|
||||||
if (!this->getIContextSimulator()->isConnected())
|
if (!this->getIContextSimulator()->isRunning())
|
||||||
{
|
{
|
||||||
if (this->rowCount() == 1) return;
|
if (this->rowCount() == 1) return;
|
||||||
this->clear();
|
this->clear();
|
||||||
this->addOrUpdateByName("info", "sim not connected", CIcons::StandardIconWarning16);
|
this->addOrUpdateByName("info", "sim not running", CIcons::StandardIconWarning16);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,17 +97,12 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
// We tell the host to terminate and stop the thread afterwards
|
// We tell the host to terminate and stop the thread afterwards
|
||||||
QMetaObject::invokeMethod(m_fs9Host, "stopHosting");
|
QMetaObject::invokeMethod(m_fs9Host, "stopHosting");
|
||||||
emit statusChanged(ISimulator::Disconnected);
|
emit connectionStatusChanged(ISimulator::Disconnected);
|
||||||
m_fsuipc->disconnect();
|
m_fsuipc->disconnect();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFs9::canConnect()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSimulatorFs9::addRemoteAircraft(const CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &initialSituation)
|
void CSimulatorFs9::addRemoteAircraft(const CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &initialSituation)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -289,7 +284,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
m_isHosting = true;
|
m_isHosting = true;
|
||||||
startTimer(50);
|
startTimer(50);
|
||||||
emit statusChanged(Connected);
|
emit connectionStatusChanged(Connected);
|
||||||
if (m_startedLobbyConnection)
|
if (m_startedLobbyConnection)
|
||||||
{
|
{
|
||||||
m_lobbyClient->connectFs9ToHost(m_fs9Host->getHostAddress());
|
m_lobbyClient->connectFs9ToHost(m_fs9Host->getHostAddress());
|
||||||
@@ -304,7 +299,7 @@ namespace BlackSimPlugin
|
|||||||
connect(&m_hostThread, &QThread::finished, &m_hostThread, &QThread::deleteLater);
|
connect(&m_hostThread, &QThread::finished, &m_hostThread, &QThread::deleteLater);
|
||||||
m_hostThread.quit();
|
m_hostThread.quit();
|
||||||
m_isHosting = false;
|
m_isHosting = false;
|
||||||
emit statusChanged(Disconnected);
|
emit connectionStatusChanged(Disconnected);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -60,7 +60,17 @@ namespace BlackSimPlugin
|
|||||||
virtual bool isConnected() const override;
|
virtual bool isConnected() const override;
|
||||||
|
|
||||||
//! \copydoc ISimulator::canConnect()
|
//! \copydoc ISimulator::canConnect()
|
||||||
virtual bool canConnect() override;
|
virtual bool canConnect() const override { return true; }
|
||||||
|
|
||||||
|
//! \copydoc ISimulator::isPaused
|
||||||
|
virtual bool isPaused() const override { return m_simPaused; }
|
||||||
|
|
||||||
|
//! \copydoc ISimulator::isRunning
|
||||||
|
//! \todo RW fix, set better state here
|
||||||
|
virtual bool isRunning() const override { return true; }
|
||||||
|
|
||||||
|
//! Is time synchronization on?
|
||||||
|
virtual bool isTimeSynchronized() const override { return m_syncTime; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
@@ -111,15 +121,9 @@ namespace BlackSimPlugin
|
|||||||
//! \remarks not all drivers implement this, e.g. if it is an intrinsic simulator feature
|
//! \remarks not all drivers implement this, e.g. if it is an intrinsic simulator feature
|
||||||
virtual void setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset) override;
|
virtual void setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset) override;
|
||||||
|
|
||||||
//! Is time synchronization on?
|
|
||||||
virtual bool isTimeSynchronized() const override { return m_syncTime; }
|
|
||||||
|
|
||||||
//! Time synchronization offset
|
//! Time synchronization offset
|
||||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override { return m_syncTimeOffset; }
|
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override { return m_syncTimeOffset; }
|
||||||
|
|
||||||
//! Simulator paused?
|
|
||||||
virtual bool isSimPaused() const override { return m_simPaused; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Timer event
|
//! Timer event
|
||||||
virtual void timerEvent(QTimerEvent *event);
|
virtual void timerEvent(QTimerEvent *event);
|
||||||
@@ -138,6 +142,7 @@ namespace BlackSimPlugin
|
|||||||
//! Change DirectPlay host status
|
//! Change DirectPlay host status
|
||||||
void ps_changeHostStatus(BlackSimPlugin::Fs9::CFs9Host::HostStatus status);
|
void ps_changeHostStatus(BlackSimPlugin::Fs9::CFs9Host::HostStatus status);
|
||||||
|
|
||||||
|
//! Change client status for callsign
|
||||||
void ps_changeClientStatus(const QString &callsign, BlackSimPlugin::Fs9::CFs9Client::ClientStatus status);
|
void ps_changeClientStatus(const QString &callsign, BlackSimPlugin::Fs9::CFs9Client::ClientStatus status);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
CSimulatorFsx::CSimulatorFsx(QObject *parent) :
|
CSimulatorFsx::CSimulatorFsx(QObject *parent) :
|
||||||
ISimulator(parent),
|
ISimulator(parent),
|
||||||
m_isConnected(false),
|
m_simConnected(false),
|
||||||
m_simRunning(false),
|
m_simRunning(false),
|
||||||
m_syncTime(false),
|
m_simTimeSynced(false),
|
||||||
m_hSimConnect(nullptr),
|
m_hSimConnect(nullptr),
|
||||||
m_nextObjID(1),
|
m_nextObjID(1),
|
||||||
m_simulatorInfo(CSimulatorInfo::FSX()),
|
m_simulatorInfo(CSimulatorInfo::FSX()),
|
||||||
@@ -67,7 +67,12 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorFsx::isConnected() const
|
bool CSimulatorFsx::isConnected() const
|
||||||
{
|
{
|
||||||
return m_isConnected;
|
return m_simConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSimulatorFsx::isRunning() const
|
||||||
|
{
|
||||||
|
return m_simRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFsx::isFsuipcConnected() const
|
bool CSimulatorFsx::isFsuipcConnected() const
|
||||||
@@ -77,11 +82,12 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorFsx::connectTo()
|
bool CSimulatorFsx::connectTo()
|
||||||
{
|
{
|
||||||
if (m_isConnected) return true;
|
if (m_simConnected) return true;
|
||||||
|
|
||||||
if (FAILED(SimConnect_Open(&m_hSimConnect, BlackMisc::CProject::systemNameAndVersionChar(), nullptr, 0, 0, 0)))
|
if (FAILED(SimConnect_Open(&m_hSimConnect, BlackMisc::CProject::systemNameAndVersionChar(), nullptr, 0, 0, 0)))
|
||||||
{
|
{
|
||||||
emit statusChanged(ConnectionFailed);
|
emit connectionStatusChanged(ConnectionFailed);
|
||||||
|
emitSimulatorCombinedStatus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -92,9 +98,10 @@ namespace BlackSimPlugin
|
|||||||
initEvents();
|
initEvents();
|
||||||
initDataDefinitions();
|
initDataDefinitions();
|
||||||
m_simconnectTimerId = startTimer(10);
|
m_simconnectTimerId = startTimer(10);
|
||||||
m_isConnected = true;
|
m_simConnected = true;
|
||||||
|
|
||||||
emit statusChanged(Connected);
|
emit connectionStatusChanged(Connected);
|
||||||
|
emitSimulatorCombinedStatus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,9 +123,8 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorFsx::disconnectFrom()
|
bool CSimulatorFsx::disconnectFrom()
|
||||||
{
|
{
|
||||||
if (!m_isConnected) { return true; }
|
if (!m_simConnected) { return true; }
|
||||||
|
|
||||||
emit statusChanged(Disconnected);
|
|
||||||
if (m_hSimConnect)
|
if (m_hSimConnect)
|
||||||
{
|
{
|
||||||
SimConnect_Close(m_hSimConnect);
|
SimConnect_Close(m_hSimConnect);
|
||||||
@@ -126,26 +132,34 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_simconnectTimerId)
|
if (m_simconnectTimerId)
|
||||||
|
{
|
||||||
killTimer(m_simconnectTimerId);
|
killTimer(m_simconnectTimerId);
|
||||||
|
}
|
||||||
|
|
||||||
m_hSimConnect = nullptr;
|
m_hSimConnect = nullptr;
|
||||||
m_simconnectTimerId = -1;
|
m_simconnectTimerId = -1;
|
||||||
m_isConnected = false;
|
m_simConnected = false;
|
||||||
|
|
||||||
|
emit connectionStatusChanged(Disconnected);
|
||||||
|
emitSimulatorCombinedStatus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFsx::canConnect()
|
bool CSimulatorFsx::canConnect() const
|
||||||
{
|
{
|
||||||
if (m_isConnected)
|
if (m_simConnected) { return true; }
|
||||||
return true;
|
HANDLE hSimConnect; // temporary handle
|
||||||
|
bool connect = false;
|
||||||
if (FAILED(SimConnect_Open(&m_hSimConnect, BlackMisc::CProject::systemNameAndVersionChar(), nullptr, 0, 0, 0)))
|
if (FAILED(SimConnect_Open(&hSimConnect, BlackMisc::CProject::systemNameAndVersionChar(), nullptr, 0, 0, 0)))
|
||||||
{
|
{
|
||||||
return false;
|
connect = false;
|
||||||
}
|
}
|
||||||
SimConnect_Close(m_hSimConnect);
|
else
|
||||||
return true;
|
{
|
||||||
|
connect = true;
|
||||||
|
}
|
||||||
|
SimConnect_Close(hSimConnect);
|
||||||
|
return connect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFsx::addRemoteAircraft(const CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &initialSituation)
|
void CSimulatorFsx::addRemoteAircraft(const CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &initialSituation)
|
||||||
@@ -291,7 +305,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CSimulatorFsx::setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset)
|
void CSimulatorFsx::setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset)
|
||||||
{
|
{
|
||||||
this->m_syncTime = enable;
|
this->m_simTimeSynced = enable;
|
||||||
this->m_syncTimeOffset = offset;
|
this->m_syncTimeOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,6 +328,7 @@ namespace BlackSimPlugin
|
|||||||
SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
|
SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
|
||||||
|
|
||||||
emit simulatorStarted();
|
emit simulatorStarted();
|
||||||
|
emitSimulatorCombinedStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFsx::onSimStopped()
|
void CSimulatorFsx::onSimStopped()
|
||||||
@@ -321,6 +336,7 @@ namespace BlackSimPlugin
|
|||||||
if (!m_simRunning) return;
|
if (!m_simRunning) return;
|
||||||
m_simRunning = false;
|
m_simRunning = false;
|
||||||
emit simulatorStopped();
|
emit simulatorStopped();
|
||||||
|
emitSimulatorCombinedStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFsx::onSimFrame()
|
void CSimulatorFsx::onSimFrame()
|
||||||
@@ -414,12 +430,17 @@ namespace BlackSimPlugin
|
|||||||
initEvents();
|
initEvents();
|
||||||
initDataDefinitions();
|
initDataDefinitions();
|
||||||
m_simconnectTimerId = startTimer(50);
|
m_simconnectTimerId = startTimer(50);
|
||||||
m_isConnected = true;
|
m_simConnected = true;
|
||||||
|
|
||||||
emit statusChanged(Connected);
|
emit connectionStatusChanged(Connected);
|
||||||
|
emitSimulatorCombinedStatus();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
emit statusChanged(ConnectionFailed);
|
{
|
||||||
|
m_simConnected = false;
|
||||||
|
emit connectionStatusChanged(ConnectionFailed);
|
||||||
|
emitSimulatorCombinedStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFsx::removeRemoteAircraft(const CSimConnectObject &simObject)
|
void CSimulatorFsx::removeRemoteAircraft(const CSimConnectObject &simObject)
|
||||||
@@ -515,7 +536,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CSimulatorFsx::synchronizeTime(const CTime &zuluTimeSim, const CTime &localTimeSim)
|
void CSimulatorFsx::synchronizeTime(const CTime &zuluTimeSim, const CTime &localTimeSim)
|
||||||
{
|
{
|
||||||
if (!this->m_syncTime) return;
|
if (!this->m_simTimeSynced) return;
|
||||||
if (!this->isConnected()) return;
|
if (!this->isConnected()) return;
|
||||||
if (m_syncDeferredCounter > 0)
|
if (m_syncDeferredCounter > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,11 +92,14 @@ namespace BlackSimPlugin
|
|||||||
//! \copydoc ISimulator::isConnected()
|
//! \copydoc ISimulator::isConnected()
|
||||||
virtual bool isConnected() const override;
|
virtual bool isConnected() const override;
|
||||||
|
|
||||||
|
//! \copydoc ISimulator::isRunning
|
||||||
|
virtual bool isRunning() const override;
|
||||||
|
|
||||||
//! FSUIPC connected?
|
//! FSUIPC connected?
|
||||||
bool isFsuipcConnected() const;
|
bool isFsuipcConnected() const;
|
||||||
|
|
||||||
//! \copydoc ISimulator::canConnect()
|
//! \copydoc ISimulator::canConnect()
|
||||||
virtual bool canConnect() override;
|
virtual bool canConnect() const override;
|
||||||
|
|
||||||
//! SimConnect Callback
|
//! SimConnect Callback
|
||||||
static void CALLBACK SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext);
|
static void CALLBACK SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext);
|
||||||
@@ -150,13 +153,13 @@ namespace BlackSimPlugin
|
|||||||
virtual void setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset) override;
|
virtual void setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset) override;
|
||||||
|
|
||||||
//! \copydoc ISimulator::isTimeSynchronized
|
//! \copydoc ISimulator::isTimeSynchronized
|
||||||
virtual bool isTimeSynchronized() const override { return m_syncTime; }
|
virtual bool isTimeSynchronized() const override { return m_simTimeSynced; }
|
||||||
|
|
||||||
//! \copydoc ISimulator::getTimeSynchronizationOffset
|
//! \copydoc ISimulator::getTimeSynchronizationOffset
|
||||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override { return m_syncTimeOffset; }
|
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override { return m_syncTimeOffset; }
|
||||||
|
|
||||||
//! \copydoc ISimulator::isSimPaused
|
//! \copydoc ISimulator::isSimPaused
|
||||||
virtual bool isSimPaused() const override { return m_simPaused; }
|
virtual bool isPaused() const override { return m_simPaused; }
|
||||||
|
|
||||||
//! Called when sim has started
|
//! Called when sim has started
|
||||||
void onSimRunning();
|
void onSimRunning();
|
||||||
@@ -213,10 +216,10 @@ namespace BlackSimPlugin
|
|||||||
void synchronizeTime(const BlackMisc::PhysicalQuantities::CTime &zuluTimeSim, const BlackMisc::PhysicalQuantities::CTime &localTimeSim);
|
void synchronizeTime(const BlackMisc::PhysicalQuantities::CTime &zuluTimeSim, const BlackMisc::PhysicalQuantities::CTime &localTimeSim);
|
||||||
|
|
||||||
static const int SkipUpdateCyclesForCockpit = 10; //!< skip x cycles before updating cockpit again
|
static const int SkipUpdateCyclesForCockpit = 10; //!< skip x cycles before updating cockpit again
|
||||||
bool m_isConnected = false; //!< Is simulator connected?
|
bool m_simConnected = false; //!< Is simulator connected?
|
||||||
bool m_simRunning = false; //!< Simulator running?
|
bool m_simRunning = false; //!< Simulator running?
|
||||||
bool m_simPaused = false; //!< Simulator paused?
|
bool m_simPaused = false; //!< Simulator paused?
|
||||||
bool m_syncTime = false; //!< Time synchronized?
|
bool m_simTimeSynced = false; //!< Time synchronized?
|
||||||
int m_syncDeferredCounter = 0; //!< Set when synchronized, used to wait some time
|
int m_syncDeferredCounter = 0; //!< Set when synchronized, used to wait some time
|
||||||
BlackMisc::PhysicalQuantities::CTime m_syncTimeOffset;
|
BlackMisc::PhysicalQuantities::CTime m_syncTimeOffset;
|
||||||
HANDLE m_hSimConnect; //!< Handle to SimConnect object
|
HANDLE m_hSimConnect; //!< Handle to SimConnect object
|
||||||
|
|||||||
@@ -71,14 +71,12 @@ namespace BlackSimPlugin
|
|||||||
return m_service && m_traffic;
|
return m_service && m_traffic;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorXPlane::canConnect()
|
bool CSimulatorXPlane::canConnect() const
|
||||||
{
|
{
|
||||||
if (isConnected()) { return true; }
|
if (isConnected()) { return true; }
|
||||||
auto conn = QDBusConnection::sessionBus(); // TODO make this configurable
|
auto conn = QDBusConnection::sessionBus(); // TODO make this configurable
|
||||||
auto dummy = new CXBusServiceProxy(conn, this, true);
|
CXBusServiceProxy dummy(conn, nullptr, true);
|
||||||
bool ok = dummy->isValid();
|
return dummy.isValid();
|
||||||
delete dummy;
|
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorXPlane::connectTo()
|
bool CSimulatorXPlane::connectTo()
|
||||||
@@ -94,7 +92,7 @@ namespace BlackSimPlugin
|
|||||||
connect(m_service, &CXBusServiceProxy::airportsInRangeUpdated, this, &CSimulatorXPlane::ps_setAirportsInRange);
|
connect(m_service, &CXBusServiceProxy::airportsInRangeUpdated, this, &CSimulatorXPlane::ps_setAirportsInRange);
|
||||||
m_service->updateAirportsInRange();
|
m_service->updateAirportsInRange();
|
||||||
m_watcher->setConnection(m_conn);
|
m_watcher->setConnection(m_conn);
|
||||||
emit statusChanged(ISimulator::Connected);
|
emit connectionStatusChanged(ISimulator::Connected);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -116,7 +114,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
m_traffic->cleanup();
|
m_traffic->cleanup();
|
||||||
}
|
}
|
||||||
emit statusChanged(ISimulator::Disconnected);
|
emit connectionStatusChanged(ISimulator::Disconnected);
|
||||||
m_conn = QDBusConnection { "default" };
|
m_conn = QDBusConnection { "default" };
|
||||||
m_watcher->setConnection(m_conn);
|
m_watcher->setConnection(m_conn);
|
||||||
delete m_service;
|
delete m_service;
|
||||||
@@ -144,7 +142,7 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
if (m_service && m_traffic)
|
if (m_service && m_traffic)
|
||||||
{
|
{
|
||||||
emit statusChanged(ISimulator::Connected);
|
emit connectionStatusChanged(ISimulator::Connected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +152,7 @@ namespace BlackSimPlugin
|
|||||||
delete m_traffic;
|
delete m_traffic;
|
||||||
m_service = nullptr;
|
m_service = nullptr;
|
||||||
m_traffic = nullptr;
|
m_traffic = nullptr;
|
||||||
emit statusChanged(ISimulator::Disconnected);
|
emit connectionStatusChanged(ISimulator::Disconnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorXPlane::ps_emitAircraftModelChanged(const QString &path, const QString &filename, const QString &livery, const QString &icao)
|
void CSimulatorXPlane::ps_emitAircraftModelChanged(const QString &path, const QString &filename, const QString &livery, const QString &icao)
|
||||||
|
|||||||
@@ -36,7 +36,16 @@ namespace BlackSimPlugin
|
|||||||
virtual bool isConnected() const override;
|
virtual bool isConnected() const override;
|
||||||
|
|
||||||
//! \copydoc BlackCore::ISimulator::canConnect
|
//! \copydoc BlackCore::ISimulator::canConnect
|
||||||
virtual bool canConnect() override;
|
virtual bool canConnect() const override;
|
||||||
|
|
||||||
|
//! \copydoc ISimulator::isTimeSynchronized
|
||||||
|
virtual bool isTimeSynchronized() const override { return false; } // TODO: Can we query the XP intrinisc feature?
|
||||||
|
|
||||||
|
//! \copydoc ISimulator::isSimPaused
|
||||||
|
virtual bool isPaused() const override { return false; }
|
||||||
|
|
||||||
|
//! \copydoc ISimulator::isRunning
|
||||||
|
virtual bool isRunning() const override { return isConnected(); }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! \copydoc BlackCore::ISimulator::connectTo
|
//! \copydoc BlackCore::ISimulator::connectTo
|
||||||
@@ -86,15 +95,9 @@ namespace BlackSimPlugin
|
|||||||
//! \copydoc ISimulator::setTimeSynchronization
|
//! \copydoc ISimulator::setTimeSynchronization
|
||||||
virtual void setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset) override;
|
virtual void setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset) override;
|
||||||
|
|
||||||
//! \copydoc ISimulator::isTimeSynchronized
|
|
||||||
virtual bool isTimeSynchronized() const override { return false; } // TODO: Can we query the XP intrinisc feature?
|
|
||||||
|
|
||||||
//! \copydoc ISimulator::getTimeSynchronizationOffset
|
//! \copydoc ISimulator::getTimeSynchronizationOffset
|
||||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override { return BlackMisc::PhysicalQuantities::CTime(0, BlackMisc::PhysicalQuantities::CTimeUnit::hrmin()); }
|
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override { return BlackMisc::PhysicalQuantities::CTime(0, BlackMisc::PhysicalQuantities::CTimeUnit::hrmin()); }
|
||||||
|
|
||||||
//! \copydoc ISimulator::isSimPaused
|
|
||||||
virtual bool isSimPaused() const override { return false; }
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ps_serviceRegistered(const QString &serviceName);
|
void ps_serviceRegistered(const QString &serviceName);
|
||||||
void ps_serviceUnregistered();
|
void ps_serviceUnregistered();
|
||||||
|
|||||||
Reference in New Issue
Block a user