mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
@@ -77,6 +77,14 @@ namespace BlackCore
|
|||||||
//! \brief Aircraft list has been changed
|
//! \brief Aircraft list has been changed
|
||||||
void changedAircraftsInRange();
|
void changedAircraftsInRange();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Aircraft situation update
|
||||||
|
* \param callsign
|
||||||
|
* \param situation
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
void aircraftSituationUpdate(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation);
|
||||||
|
|
||||||
//! \brief Terminated connection
|
//! \brief Terminated connection
|
||||||
void connectionTerminated();
|
void connectionTerminated();
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ namespace BlackCore
|
|||||||
void CContextNetwork::psFsdAircraftUpdateReceived(const CCallsign &callsign, const CAircraftSituation &situation, const CTransponder &transponder)
|
void CContextNetwork::psFsdAircraftUpdateReceived(const CCallsign &callsign, const CAircraftSituation &situation, const CTransponder &transponder)
|
||||||
{
|
{
|
||||||
// this->log(Q_FUNC_INFO, callsign.toQString(), situation.toQString(), transponder.toQString());
|
// this->log(Q_FUNC_INFO, callsign.toQString(), situation.toQString(), transponder.toQString());
|
||||||
|
|
||||||
|
|
||||||
CAircraftList list = this->m_aircraftsInRange.findByCallsign(callsign);
|
CAircraftList list = this->m_aircraftsInRange.findByCallsign(callsign);
|
||||||
if (list.isEmpty())
|
if (list.isEmpty())
|
||||||
{
|
{
|
||||||
@@ -90,6 +92,8 @@ namespace BlackCore
|
|||||||
this->m_aircraftsInRange.applyIf(BlackMisc::Predicates::MemberEqual<CAircraft>(&CAircraft::getCallsign, callsign), vm);
|
this->m_aircraftsInRange.applyIf(BlackMisc::Predicates::MemberEqual<CAircraft>(&CAircraft::getCallsign, callsign), vm);
|
||||||
emit this->changedAircraftsInRange();
|
emit this->changedAircraftsInRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aircraftSituationUpdate(callsign, situation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ namespace BlackCore
|
|||||||
m_simulator = new BlackCore::FSX::CSimulatorFSX(this);
|
m_simulator = new BlackCore::FSX::CSimulatorFSX(this);
|
||||||
connect(m_simulator, &ISimulator::connectionChanged, this, &CContextSimulator::setConnectionStatus);
|
connect(m_simulator, &ISimulator::connectionChanged, this, &CContextSimulator::setConnectionStatus);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
connect(m_updateTimer, &QTimer::timeout, this, &CContextSimulator::updateOwnAircraft);
|
connect(m_updateTimer, &QTimer::timeout, this, &CContextSimulator::updateOwnAircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +51,17 @@ namespace BlackCore
|
|||||||
return m_ownAircraft;
|
return m_ownAircraft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CContextSimulator::init()
|
||||||
|
{
|
||||||
|
if (!m_contextNetwork)
|
||||||
|
{
|
||||||
|
m_contextNetwork = getRuntime()->getIContextNetwork();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_simulator)
|
||||||
|
connect(m_contextNetwork, &IContextNetwork::aircraftSituationUpdate, m_simulator, &ISimulator::addAircraftSituation);
|
||||||
|
}
|
||||||
|
|
||||||
void CContextSimulator::updateOwnAircraft()
|
void CContextSimulator::updateOwnAircraft()
|
||||||
{
|
{
|
||||||
if (!m_simulator)
|
if (!m_simulator)
|
||||||
@@ -59,10 +69,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
m_ownAircraft = m_simulator->getOwnAircraft();
|
m_ownAircraft = m_simulator->getOwnAircraft();
|
||||||
|
|
||||||
if (!m_contextNetwork)
|
|
||||||
{
|
|
||||||
m_contextNetwork = getRuntime()->getIContextNetwork();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_contextNetwork->updateOwnSituation(m_ownAircraft.getSituation());
|
m_contextNetwork->updateOwnSituation(m_ownAircraft.getSituation());
|
||||||
m_contextNetwork->updateOwnCockpit(m_ownAircraft.getCom1System(), m_ownAircraft.getCom2System(), m_ownAircraft.getTransponder());
|
m_contextNetwork->updateOwnCockpit(m_ownAircraft.getCom1System(), m_ownAircraft.getCom2System(), m_ownAircraft.getTransponder());
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ namespace BlackCore
|
|||||||
return static_cast<CCoreRuntime *>(this->parent());
|
return static_cast<CCoreRuntime *>(this->parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \brief Initialze the context
|
||||||
|
void init();
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::usingLocalObjects()
|
//! \copydoc IContextSimulator::usingLocalObjects()
|
||||||
virtual bool usingLocalObjects() const override { return true; }
|
virtual bool usingLocalObjects() const override { return true; }
|
||||||
|
|
||||||
@@ -67,6 +70,8 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextSimulator::getOwnAircraft()
|
//! \copydoc IContextSimulator::getOwnAircraft()
|
||||||
virtual BlackMisc::Aviation::CAircraft getOwnAircraft() const override;
|
virtual BlackMisc::Aviation::CAircraft getOwnAircraft() const override;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! \copydoc IContextSimulator::updateOwnAircraft()
|
//! \copydoc IContextSimulator::updateOwnAircraft()
|
||||||
virtual void updateOwnAircraft();
|
virtual void updateOwnAircraft();
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ void CCoreRuntime::init(bool withDbus)
|
|||||||
if (withDbus) this->m_contextAudio->registerWithDBus(this->m_dbusServer);
|
if (withDbus) this->m_contextAudio->registerWithDBus(this->m_dbusServer);
|
||||||
|
|
||||||
this->m_contextSimulator = new CContextSimulator(this);
|
this->m_contextSimulator = new CContextSimulator(this);
|
||||||
|
this->m_contextSimulator->init();
|
||||||
if (withDbus) this->m_contextSimulator->registerWithDBus(this->m_dbusServer);
|
if (withDbus) this->m_contextSimulator->registerWithDBus(this->m_dbusServer);
|
||||||
|
|
||||||
m_contextAudio->init();
|
m_contextAudio->init();
|
||||||
|
|||||||
Reference in New Issue
Block a user