diff --git a/src/blackcore/airspacemonitor.cpp b/src/blackcore/airspacemonitor.cpp index a115451e3..90a2ccb1b 100644 --- a/src/blackcore/airspacemonitor.cpp +++ b/src/blackcore/airspacemonitor.cpp @@ -602,12 +602,16 @@ namespace BlackCore { Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this)); if (!this->isConnectedAndNotShuttingDown() || callsign.isEmpty()) return; - CPropertyIndexVariantMap vm(CAtcStation::IndexAtis, CVariant::from(atisMessage)); - this->updateOnlineStation(callsign, vm); + const int changedAtis = m_atcStationsOnline.updateIfMessageChanged(atisMessage, true); // receiving an ATIS means station is online, update in bookings - vm.addValue(CAtcStation::IndexIsOnline, true); - this->updateBookedStation(callsign, vm); + m_atcStationsBooked.setOnline(callsign, true); + + // signal + if (changedAtis > 0) + { + emit this->changedAtisReceived(callsign); + } } void CAirspaceMonitor::onAtisVoiceRoomReceived(const CCallsign &callsign, const QString &url) @@ -759,7 +763,7 @@ namespace BlackCore if (airlineIcao.isLoadedFromDb() && !knownAircraftIcao) { // we have no valid aircraft ICAO, so we do a fuzzy search among those - CAircraftIcaoCode foundIcao = CAircraftMatcher::searchAmongAirlineAircraft(aircraftIcaoString, airlineIcao, callsign, log); + const CAircraftIcaoCode foundIcao = CAircraftMatcher::searchAmongAirlineAircraft(aircraftIcaoString, airlineIcao, callsign, log); if (foundIcao.isLoadedFromDb()) { aircraftIcao = foundIcao; } } @@ -773,7 +777,7 @@ namespace BlackCore const CCallsign callsign = aircraft.getCallsign(); Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Missing callsign"); - if (!sApp || sApp->isShuttingDown()) { return false; } + if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return false; } CSimulatedAircraft newAircraft(aircraft); newAircraft.setRendered(false); // reset rendering diff --git a/src/blackcore/airspacemonitor.h b/src/blackcore/airspacemonitor.h index 2eebdf3ba..0a6fa78f6 100644 --- a/src/blackcore/airspacemonitor.h +++ b/src/blackcore/airspacemonitor.h @@ -160,7 +160,7 @@ namespace BlackCore void readyForModelMatching(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft); //! An ATIS has been received - void atisReceived(const BlackMisc::Aviation::CCallsign &callsign); + void changedAtisReceived(const BlackMisc::Aviation::CCallsign &callsign); private: //! Used to temporary store FsInn data diff --git a/src/blackcore/context/contextnetworkimpl.cpp b/src/blackcore/context/contextnetworkimpl.cpp index 13e0175a6..49c0e202c 100644 --- a/src/blackcore/context/contextnetworkimpl.cpp +++ b/src/blackcore/context/contextnetworkimpl.cpp @@ -82,14 +82,14 @@ namespace BlackCore Q_ASSERT_X(this->getRuntime()->getCContextOwnAircraft(), Q_FUNC_INFO, "this and own aircraft context must be local"); m_airspace = new CAirspaceMonitor(this->getRuntime()->getCContextOwnAircraft(), m_network, this); m_network->setClientProvider(m_airspace); - connect(m_airspace, &CAirspaceMonitor::changedAtcStationsOnline, this, &CContextNetwork::changedAtcStationsOnline); - connect(m_airspace, &CAirspaceMonitor::changedAtcStationsBooked, this, &CContextNetwork::changedAtcStationsBooked); - connect(m_airspace, &CAirspaceMonitor::changedAtcStationOnlineConnectionStatus, this, &CContextNetwork::changedAtcStationOnlineConnectionStatus); - connect(m_airspace, &CAirspaceMonitor::changedAircraftInRange, this, &CContextNetwork::changedAircraftInRange); - connect(m_airspace, &CAirspaceMonitor::removedAircraft, this, &IContextNetwork::removedAircraft); // DBus - connect(m_airspace, &CAirspaceMonitor::readyForModelMatching, this, &CContextNetwork::readyForModelMatching); - connect(m_airspace, &CAirspaceMonitor::addedAircraft, this, &CContextNetwork::addedAircraft); - connect(m_airspace, &CAirspaceMonitor::atisReceived, this, &CContextNetwork::onAtisReceived); + connect(m_airspace, &CAirspaceMonitor::changedAtcStationsOnline, this, &CContextNetwork::changedAtcStationsOnline, Qt::QueuedConnection); + connect(m_airspace, &CAirspaceMonitor::changedAtcStationsBooked, this, &CContextNetwork::changedAtcStationsBooked, Qt::QueuedConnection); + connect(m_airspace, &CAirspaceMonitor::changedAtcStationOnlineConnectionStatus, this, &CContextNetwork::changedAtcStationOnlineConnectionStatus, Qt::QueuedConnection); + connect(m_airspace, &CAirspaceMonitor::changedAircraftInRange, this, &CContextNetwork::changedAircraftInRange, Qt::QueuedConnection); + connect(m_airspace, &CAirspaceMonitor::removedAircraft, this, &IContextNetwork::removedAircraft, Qt::QueuedConnection); // DBus + connect(m_airspace, &CAirspaceMonitor::readyForModelMatching, this, &CContextNetwork::readyForModelMatching, Qt::QueuedConnection); + connect(m_airspace, &CAirspaceMonitor::addedAircraft, this, &CContextNetwork::addedAircraft, Qt::QueuedConnection); + connect(m_airspace, &CAirspaceMonitor::changedAtisReceived, this, &CContextNetwork::onChangedAtisReceived, Qt::QueuedConnection); } CContextNetwork *CContextNetwork::registerWithDBus(BlackMisc::CDBusServer *server) @@ -569,7 +569,7 @@ namespace BlackCore CLogMessage(this).info("%1 METARs updated") << metars.size(); } - void CContextNetwork::onAtisReceived(const CCallsign &callsign) + void CContextNetwork::onChangedAtisReceived(const CCallsign &callsign) { Q_UNUSED(callsign); m_dsAtcStationsOnlineChanged.inputSignal(); // the ATIS data are stored in the station object diff --git a/src/blackcore/context/contextnetworkimpl.h b/src/blackcore/context/contextnetworkimpl.h index 815ebba9a..ad2cc8a02 100644 --- a/src/blackcore/context/contextnetworkimpl.h +++ b/src/blackcore/context/contextnetworkimpl.h @@ -281,7 +281,7 @@ namespace BlackCore void updateMetars(const BlackMisc::Weather::CMetarList &metars); //! An ATIS has been received - void onAtisReceived(const BlackMisc::Aviation::CCallsign &callsign); + void onChangedAtisReceived(const BlackMisc::Aviation::CCallsign &callsign); //! Check if a supervisor message was received void checkForSupervisiorTextMessage(const BlackMisc::Network::CTextMessageList &messages);