mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
@@ -51,6 +51,15 @@ namespace BlackCore
|
||||
//! Returns true when simulator is connected and available
|
||||
virtual bool isConnected() const = 0;
|
||||
|
||||
//! \brief Can we connect?
|
||||
virtual bool canConnect() = 0;
|
||||
|
||||
//! \brief Connect to simulator
|
||||
virtual bool connectTo() = 0;
|
||||
|
||||
//! \brief Disconnect from simulator
|
||||
virtual bool disconnectFrom() = 0;
|
||||
|
||||
//! Get user aircraft value object
|
||||
virtual BlackMisc::Aviation::CAircraft getOwnAircraft() const = 0;
|
||||
|
||||
|
||||
@@ -24,9 +24,13 @@ namespace BlackCore
|
||||
m_updateTimer = new QTimer(this);
|
||||
loadPlugins();
|
||||
connect(m_updateTimer, &QTimer::timeout, this, &CContextSimulator::updateOwnAircraft);
|
||||
connectTo();
|
||||
}
|
||||
|
||||
CContextSimulator::~CContextSimulator() {}
|
||||
CContextSimulator::~CContextSimulator()
|
||||
{
|
||||
disconnectFrom();
|
||||
}
|
||||
|
||||
bool CContextSimulator::isConnected() const
|
||||
{
|
||||
@@ -35,6 +39,27 @@ namespace BlackCore
|
||||
return m_simulator->isConnected();
|
||||
}
|
||||
|
||||
bool CContextSimulator::canConnect()
|
||||
{
|
||||
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||
if (!m_simulator) return false;
|
||||
return m_simulator->canConnect();
|
||||
}
|
||||
|
||||
bool CContextSimulator::connectTo()
|
||||
{
|
||||
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||
if (!m_simulator) return false;
|
||||
return m_simulator->connectTo();
|
||||
}
|
||||
|
||||
bool CContextSimulator::disconnectFrom()
|
||||
{
|
||||
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||
if (!m_simulator) return false;
|
||||
return m_simulator->disconnectFrom();
|
||||
}
|
||||
|
||||
BlackMisc::Aviation::CAircraft CContextSimulator::getOwnAircraft() const
|
||||
{
|
||||
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||
|
||||
@@ -29,9 +29,19 @@ namespace BlackCore
|
||||
virtual ~CContextSimulator();
|
||||
|
||||
public slots:
|
||||
|
||||
//! \copydoc IContextSimulator::isConnected()
|
||||
virtual bool isConnected() const override;
|
||||
|
||||
//! \brief Can we connect?
|
||||
virtual bool canConnect() override;
|
||||
|
||||
//! \brief Connect to simulator
|
||||
virtual bool connectTo() override;
|
||||
|
||||
//! \brief Disconnect from simulator
|
||||
virtual bool disconnectFrom() override;
|
||||
|
||||
//! \copydoc IContextSimulator::getOwnAircraft()
|
||||
virtual BlackMisc::Aviation::CAircraft getOwnAircraft() const override;
|
||||
|
||||
|
||||
@@ -32,6 +32,21 @@ namespace BlackCore
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isConnected"));
|
||||
}
|
||||
|
||||
bool CContextSimulatorProxy::canConnect()
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("canConnect"));
|
||||
}
|
||||
|
||||
bool CContextSimulatorProxy::connectTo()
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("connectTo"));
|
||||
}
|
||||
|
||||
bool CContextSimulatorProxy::disconnectFrom()
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("disconnectFrom"));
|
||||
}
|
||||
|
||||
BlackMisc::Aviation::CAircraft CContextSimulatorProxy::getOwnAircraft() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<BlackMisc::Aviation::CAircraft>(QLatin1Literal("getOwnAircraft"));
|
||||
|
||||
@@ -35,9 +35,19 @@ namespace BlackCore
|
||||
CContextSimulatorProxy(const QString &serviceName, QDBusConnection &connection, CRuntimeConfig::ContextMode mode, CRuntime *runtime);
|
||||
|
||||
public slots:
|
||||
|
||||
//! \copydoc IContextSimulator::isConnected()
|
||||
virtual bool isConnected() const override;
|
||||
|
||||
//! \brief Can we connect?
|
||||
virtual bool canConnect() override;
|
||||
|
||||
//! \brief Connect to simulator
|
||||
virtual bool connectTo() override;
|
||||
|
||||
//! \brief Disconnect from simulator
|
||||
virtual bool disconnectFrom() override;
|
||||
|
||||
//! \copydoc IContextSimulator::getOwnAircraft()
|
||||
virtual BlackMisc::Aviation::CAircraft getOwnAircraft() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user