diff --git a/src/blackcore/airspace_monitor.cpp b/src/blackcore/airspace_monitor.cpp index 4d7603c99..933af3025 100644 --- a/src/blackcore/airspace_monitor.cpp +++ b/src/blackcore/airspace_monitor.cpp @@ -4,12 +4,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "airspace_monitor.h" +#include "blackcore/blackcorefreefunctions.h" #include "blackmisc/project.h" #include "blackmisc/indexvariantmap.h" -// KB_REMOVE with debug log message -#include - namespace BlackCore { @@ -22,24 +20,24 @@ namespace BlackCore CAirspaceMonitor::CAirspaceMonitor(QObject *parent, INetwork *network, CVatsimBookingReader *bookings, CVatsimDataFileReader *dataFile) : QObject(parent), m_network(network), m_vatsimBookingReader(bookings), m_vatsimDataFileReader(dataFile) { - this->connect(this->m_network, &INetwork::atcPositionUpdate, this, &CAirspaceMonitor::atcPositionUpdate); - this->connect(this->m_network, &INetwork::atisReplyReceived, this, &CAirspaceMonitor::atisReceived); - this->connect(this->m_network, &INetwork::atisVoiceRoomReplyReceived, this, &CAirspaceMonitor::atisVoiceRoomReceived); - this->connect(this->m_network, &INetwork::atisLogoffTimeReplyReceived, this, &CAirspaceMonitor::atisLogoffTimeReceived); - this->connect(this->m_network, &INetwork::metarReplyReceived, this, &CAirspaceMonitor::metarReceived); - this->connect(this->m_network, &INetwork::flightPlanReplyReceived, this, &CAirspaceMonitor::flightplanReceived); - this->connect(this->m_network, &INetwork::realNameReplyReceived, this, &CAirspaceMonitor::realNameReplyReceived); - this->connect(this->m_network, &INetwork::icaoCodesReplyReceived, this, &CAirspaceMonitor::icaoCodesReceived); - this->connect(this->m_network, &INetwork::pilotDisconnected, this, &CAirspaceMonitor::pilotDisconnected); - this->connect(this->m_network, &INetwork::atcDisconnected, this, &CAirspaceMonitor::atcControllerDisconnected); - this->connect(this->m_network, &INetwork::aircraftPositionUpdate, this, &CAirspaceMonitor::aircraftUpdateReceived); - this->connect(this->m_network, &INetwork::frequencyReplyReceived, this, &CAirspaceMonitor::frequencyReceived); - this->connect(this->m_network, &INetwork::capabilitiesReplyReceived, this, &CAirspaceMonitor::capabilitiesReplyReceived); - this->connect(this->m_network, &INetwork::fsipirCustomPacketReceived, this, &CAirspaceMonitor::fsipirCustomPacketReceived); - this->connect(this->m_network, &INetwork::serverReplyReceived, this, &CAirspaceMonitor::serverReplyReceived); + this->connect(this->m_network, &INetwork::atcPositionUpdate, this, &CAirspaceMonitor::ps_atcPositionUpdate); + this->connect(this->m_network, &INetwork::atisReplyReceived, this, &CAirspaceMonitor::ps_atisReceived); + this->connect(this->m_network, &INetwork::atisVoiceRoomReplyReceived, this, &CAirspaceMonitor::ps_atisVoiceRoomReceived); + this->connect(this->m_network, &INetwork::atisLogoffTimeReplyReceived, this, &CAirspaceMonitor::ps_atisLogoffTimeReceived); + this->connect(this->m_network, &INetwork::metarReplyReceived, this, &CAirspaceMonitor::ps_metarReceived); + this->connect(this->m_network, &INetwork::flightPlanReplyReceived, this, &CAirspaceMonitor::ps_flightplanReceived); + this->connect(this->m_network, &INetwork::realNameReplyReceived, this, &CAirspaceMonitor::ps_realNameReplyReceived); + this->connect(this->m_network, &INetwork::icaoCodesReplyReceived, this, &CAirspaceMonitor::ps_icaoCodesReceived); + this->connect(this->m_network, &INetwork::pilotDisconnected, this, &CAirspaceMonitor::ps_pilotDisconnected); + this->connect(this->m_network, &INetwork::atcDisconnected, this, &CAirspaceMonitor::ps_atcControllerDisconnected); + this->connect(this->m_network, &INetwork::aircraftPositionUpdate, this, &CAirspaceMonitor::ps_aircraftUpdateReceived); + this->connect(this->m_network, &INetwork::frequencyReplyReceived, this, &CAirspaceMonitor::ps_frequencyReceived); + this->connect(this->m_network, &INetwork::capabilitiesReplyReceived, this, &CAirspaceMonitor::ps_capabilitiesReplyReceived); + this->connect(this->m_network, &INetwork::fsipirCustomPacketReceived, this, &CAirspaceMonitor::ps_fsipirCustomPacketReceived); + this->connect(this->m_network, &INetwork::serverReplyReceived, this, &CAirspaceMonitor::ps_serverReplyReceived); // AutoConnection: this should also avoid race conditions by updating the bookings - this->connect(this->m_vatsimBookingReader, &CVatsimBookingReader::dataRead, this, &CAirspaceMonitor::receivedBookings); + this->connect(this->m_vatsimBookingReader, &CVatsimBookingReader::dataRead, this, &CAirspaceMonitor::ps_receivedBookings); } CFlightPlan CAirspaceMonitor::loadFlightPlanFromNetwork(const CCallsign &callsign) @@ -215,7 +213,7 @@ namespace BlackCore } } - void CAirspaceMonitor::realNameReplyReceived(const CCallsign &callsign, const QString &realname) + void CAirspaceMonitor::ps_realNameReplyReceived(const CCallsign &callsign, const QString &realname) { if (realname.isEmpty()) return; CIndexVariantMap vm(CAtcStation::IndexControllerRealName, realname); @@ -229,7 +227,7 @@ namespace BlackCore this->m_otherClients.applyIf(&CClient::getCallsign, callsign, vm); } - void CAirspaceMonitor::capabilitiesReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, quint32 flags) + void CAirspaceMonitor::ps_capabilitiesReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, quint32 flags) { if (callsign.isEmpty()) return; CIndexVariantMap capabilities; @@ -240,7 +238,7 @@ namespace BlackCore this->m_otherClients.applyIf(&CClient::getCallsign, callsign, vm); } - void CAirspaceMonitor::fsipirCustomPacketReceived(const CCallsign &callsign, const QString &, const QString &, const QString &, const QString &model) + void CAirspaceMonitor::ps_fsipirCustomPacketReceived(const CCallsign &callsign, const QString &, const QString &, const QString &, const QString &model) { if (callsign.isEmpty() || model.isEmpty()) return; @@ -256,14 +254,14 @@ namespace BlackCore this->sendFsipiCustomPacket(callsign); // response } - void CAirspaceMonitor::serverReplyReceived(const CCallsign &callsign, const QString &server) + void CAirspaceMonitor::ps_serverReplyReceived(const CCallsign &callsign, const QString &server) { if (callsign.isEmpty() || server.isEmpty()) return; CIndexVariantMap vm(CClient::IndexServer, QVariant(server)); this->m_otherClients.applyIf(&CClient::getCallsign, callsign, vm); } - void CAirspaceMonitor::metarReceived(const QString &metarMessage) + void CAirspaceMonitor::ps_metarReceived(const QString &metarMessage) { if (metarMessage.length() < 10) return; // invalid const QString icaoCode = metarMessage.left(4).toUpper(); @@ -280,7 +278,7 @@ namespace BlackCore if (this->m_atcStationsBooked.contains(&CAtcStation::getCallsign, callsignTower)) emit this->changedAtcStationsBooked(); } - void CAirspaceMonitor::flightplanReceived(const CCallsign &callsign, const CFlightPlan &flightPlan) + void CAirspaceMonitor::ps_flightplanReceived(const CCallsign &callsign, const CFlightPlan &flightPlan) { CFlightPlan plan(flightPlan); plan.setWhenLastSentOrLoaded(QDateTime::currentDateTimeUtc()); @@ -305,8 +303,9 @@ namespace BlackCore this->m_network->sendFsipirCustomPacket(recipientCallsign, icao.getAirlineDesignator(), icao.getAircraftDesignator(), icao.getAircraftCombinedType(), modelString); } - void CAirspaceMonitor::receivedBookings(const CAtcStationList &bookedStations) + void CAirspaceMonitor::ps_receivedBookings(const CAtcStationList &bookedStations) { + Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this)); this->m_atcStationsBooked.clear(); foreach(CAtcStation bookedStation, bookedStations) { @@ -319,8 +318,9 @@ namespace BlackCore } } - void CAirspaceMonitor::atcPositionUpdate(const CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency, const CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range) + void CAirspaceMonitor::ps_atcPositionUpdate(const CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency, const CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range) { + Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this)); CAtcStationList stationsWithCallsign = this->m_atcStationsOnline.findByCallsign(callsign); if (stationsWithCallsign.isEmpty()) { @@ -358,8 +358,9 @@ namespace BlackCore } } - void CAirspaceMonitor::atcControllerDisconnected(const CCallsign &callsign) + void CAirspaceMonitor::ps_atcControllerDisconnected(const CCallsign &callsign) { + Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this)); if (this->m_atcStationsOnline.contains(&CAtcStation::getCallsign, callsign)) { CAtcStation removeStation = this->m_atcStationsOnline.findByCallsign(callsign).front(); @@ -372,8 +373,9 @@ namespace BlackCore this->m_atcStationsBooked.applyIf(&CAtcStation::getCallsign, callsign, CIndexVariantMap(CAtcStation::IndexIsOnline, QVariant(false))); } - void CAirspaceMonitor::atisReceived(const CCallsign &callsign, const CInformationMessage &atisMessage) + void CAirspaceMonitor::ps_atisReceived(const CCallsign &callsign, const CInformationMessage &atisMessage) { + Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this)); if (callsign.isEmpty()) return; CIndexVariantMap vm(CAtcStation::IndexAtis, atisMessage.toQVariant()); this->m_atcStationsOnline.applyIf(&CAtcStation::getCallsign, callsign, vm); @@ -382,8 +384,9 @@ namespace BlackCore if (this->m_atcStationsBooked.contains(&CAtcStation::getCallsign, callsign)) emit this->changedAtcStationsBooked(); } - void CAirspaceMonitor::atisVoiceRoomReceived(const CCallsign &callsign, const QString &url) + void CAirspaceMonitor::ps_atisVoiceRoomReceived(const CCallsign &callsign, const QString &url) { + Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this)); QString trimmedUrl = url.trimmed(); CIndexVariantMap vm(CAtcStation::IndexVoiceRoomUrl, trimmedUrl); if (this->m_atcStationsBooked.contains(&CAtcStation::getCallsign, callsign)) @@ -402,8 +405,9 @@ namespace BlackCore this->m_otherClients.applyIf(&CClient::getCallsign, callsign, vm); } - void CAirspaceMonitor::atisLogoffTimeReceived(const CCallsign &callsign, const QString &zuluTime) + void CAirspaceMonitor::ps_atisLogoffTimeReceived(const CCallsign &callsign, const QString &zuluTime) { + Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this)); if (zuluTime.length() == 4) { // Logic to set logoff time @@ -422,8 +426,10 @@ namespace BlackCore } } - void CAirspaceMonitor::icaoCodesReceived(const CCallsign &callsign, const CAircraftIcao &icaoData) + void CAirspaceMonitor::ps_icaoCodesReceived(const CCallsign &callsign, const CAircraftIcao &icaoData) { + Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this)); + // update CIndexVariantMap vm(CAircraft::IndexIcao, icaoData.toQVariant()); if (!icaoData.hasAircraftDesignator()) @@ -438,8 +444,10 @@ namespace BlackCore emit this->changedAircraftsInRange(); } - void CAirspaceMonitor::aircraftUpdateReceived(const CCallsign &callsign, const CAircraftSituation &situation, const CTransponder &transponder) + void CAirspaceMonitor::ps_aircraftUpdateReceived(const CCallsign &callsign, const CAircraftSituation &situation, const CTransponder &transponder) { + Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this)); + CAircraftList list = this->m_aircraftsInRange.findByCallsign(callsign); if (list.isEmpty()) { @@ -487,14 +495,18 @@ namespace BlackCore emit changedAircraftSituation(callsign, situation); } - void CAirspaceMonitor::pilotDisconnected(const CCallsign &callsign) + void CAirspaceMonitor::ps_pilotDisconnected(const CCallsign &callsign) { + Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this)); + this->m_aircraftsInRange.removeIf(&CAircraft::getCallsign, callsign); this->m_otherClients.removeIf(&CClient::getCallsign, callsign); } - void CAirspaceMonitor::frequencyReceived(const CCallsign &callsign, const CFrequency &frequency) + void CAirspaceMonitor::ps_frequencyReceived(const CCallsign &callsign, const CFrequency &frequency) { + Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this)); + // update CIndexVariantMap vm(CAircraft::IndexFrequencyCom1, frequency.toQVariant()); this->m_aircraftsInRange.applyIf(BlackMisc::Predicates::MemberEqual(&CAircraft::getCallsign, callsign), vm); diff --git a/src/blackcore/airspace_monitor.h b/src/blackcore/airspace_monitor.h index 5ac9fddb7..74dea10f2 100644 --- a/src/blackcore/airspace_monitor.h +++ b/src/blackcore/airspace_monitor.h @@ -127,22 +127,22 @@ namespace BlackCore QStringList createFsipiCustomPacketData() const; private slots: - void realNameReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &realname); - void capabilitiesReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, quint32 flags); - void fsipirCustomPacketReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &, const QString &, const QString &, const QString &model); - void serverReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &server); - void metarReceived(const QString &metarMessage); - void flightplanReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CFlightPlan &flightPlan); - void receivedBookings(const BlackMisc::Aviation::CAtcStationList &bookedStations); - void atcPositionUpdate(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency, const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range); - void atcControllerDisconnected(const BlackMisc::Aviation::CCallsign &callsign); - void atisReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CInformationMessage &atisMessage); - void atisVoiceRoomReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &url); - void atisLogoffTimeReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &zuluTime); - void icaoCodesReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftIcao &icaoData); - void aircraftUpdateReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation, const BlackMisc::Aviation::CTransponder &transponder); - void pilotDisconnected(const BlackMisc::Aviation::CCallsign &callsign); - void frequencyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency); + void ps_realNameReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &realname); + void ps_capabilitiesReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, quint32 flags); + void ps_fsipirCustomPacketReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &, const QString &, const QString &, const QString &model); + void ps_serverReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &server); + void ps_metarReceived(const QString &metarMessage); + void ps_flightplanReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CFlightPlan &flightPlan); + void ps_receivedBookings(const BlackMisc::Aviation::CAtcStationList &bookedStations); + void ps_atcPositionUpdate(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency, const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range); + void ps_atcControllerDisconnected(const BlackMisc::Aviation::CCallsign &callsign); + void ps_atisReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CInformationMessage &atisMessage); + void ps_atisVoiceRoomReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &url); + void ps_atisLogoffTimeReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &zuluTime); + void ps_icaoCodesReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftIcao &icaoData); + void ps_aircraftUpdateReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation, const BlackMisc::Aviation::CTransponder &transponder); + void ps_pilotDisconnected(const BlackMisc::Aviation::CCallsign &callsign); + void ps_frequencyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency); }; } // namespace diff --git a/src/blackcore/blackcorefreefunctions.cpp b/src/blackcore/blackcorefreefunctions.cpp index 6a20ef687..88e280a23 100644 --- a/src/blackcore/blackcorefreefunctions.cpp +++ b/src/blackcore/blackcorefreefunctions.cpp @@ -6,6 +6,7 @@ #include "blackcorefreefunctions.h" #include "voice.h" #include "simulator.h" +#include namespace BlackCore { @@ -20,4 +21,11 @@ namespace BlackCore qRegisterMetaType("ConnectionStatus"); } + bool isCurrentThreadCreatingThread(QObject *toBeTested) + { + if (!toBeTested) return false; + if (!toBeTested->thread()) return false; + return (QThread::currentThreadId() == toBeTested->thread()->currentThreadId()); + } + } // namespace diff --git a/src/blackcore/blackcorefreefunctions.h b/src/blackcore/blackcorefreefunctions.h index 5862c3f9c..66636bde8 100644 --- a/src/blackcore/blackcorefreefunctions.h +++ b/src/blackcore/blackcorefreefunctions.h @@ -6,13 +6,17 @@ #ifndef BLACKCORE_FREEFUNCTIONS_H #define BLACKCORE_FREEFUNCTIONS_H +#include + namespace BlackCore { - /*! - * Register all relevant metadata in BlackCore - */ + //! Register all relevant metadata in BlackCore void registerMetadata(); + //! Is the current thread the one created the object + //! \remarks can be used as ASSERT check for threaded objects + bool isCurrentThreadCreatingThread(QObject *toBeTested); + } // BlackCore #endif // guard diff --git a/src/blackcore/vatsimbookingreader.cpp b/src/blackcore/vatsimbookingreader.cpp index d87fc6146..19e08c4be 100644 --- a/src/blackcore/vatsimbookingreader.cpp +++ b/src/blackcore/vatsimbookingreader.cpp @@ -1,3 +1,12 @@ +/* Copyright (C) 2013 + * 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. + */ + #include "blackmisc/sequence.h" #include "blackmisc/avatcstation.h" #include "blackmisc/nwuser.h" diff --git a/src/blackcore/vatsimbookingreader.h b/src/blackcore/vatsimbookingreader.h index 20b80eb9a..066ae7e12 100644 --- a/src/blackcore/vatsimbookingreader.h +++ b/src/blackcore/vatsimbookingreader.h @@ -1,7 +1,11 @@ -/* Copyright (C) 2013 VATSIM Community / authors - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/* Copyright (C) 2013 + * 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 BLACKCORE_VATSIMBOOKINGREADER_H #define BLACKCORE_VATSIMBOOKINGREADER_H diff --git a/src/blackcore/vatsimdatafilereader.cpp b/src/blackcore/vatsimdatafilereader.cpp index 315be9661..548299eb2 100644 --- a/src/blackcore/vatsimdatafilereader.cpp +++ b/src/blackcore/vatsimdatafilereader.cpp @@ -1,3 +1,12 @@ +/* Copyright (C) 2013 + * 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. + */ + #include "blackmisc/sequence.h" #include "blackmisc/avatcstation.h" #include "blackmisc/nwuser.h" @@ -42,19 +51,19 @@ namespace BlackCore this->setPendingNetworkReply(r); } - const CAircraftList &CVatsimDataFileReader::getAircrafts() + CAircraftList CVatsimDataFileReader::getAircrafts() const { QReadLocker rl(&this->m_lock); return this->m_aircrafts; } - const CAtcStationList &CVatsimDataFileReader::getAtcStations() + CAtcStationList CVatsimDataFileReader::getAtcStations() const { QReadLocker rl(&this->m_lock); return this->m_atcStations; } - const CServerList &CVatsimDataFileReader::getVoiceServers() + CServerList CVatsimDataFileReader::getVoiceServers() const { QReadLocker rl(&this->m_lock); return this->m_voiceServers; @@ -78,6 +87,11 @@ namespace BlackCore return aircraft.getIcaoInfo(); } + void CVatsimDataFileReader::updateWithVatsimDataFileData(CAircraft &aircraftToBeUdpated) const + { + this->getAircrafts().updateWithVatsimDataFileData(aircraftToBeUdpated); + } + CUserList CVatsimDataFileReader::getControllersForCallsign(const CCallsign &callsign) { CCallsignList callsigns; diff --git a/src/blackcore/vatsimdatafilereader.h b/src/blackcore/vatsimdatafilereader.h index 69e982e76..8f9bd786a 100644 --- a/src/blackcore/vatsimdatafilereader.h +++ b/src/blackcore/vatsimdatafilereader.h @@ -1,13 +1,17 @@ -/* Copyright (C) 2013 VATSIM Community / authors - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/* Copyright (C) 2013 + * 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. + */ + +//! \file #ifndef BLACKCORE_VATSIMDATAFILEREADER_H #define BLACKCORE_VATSIMDATAFILEREADER_H -//! \file - #include "blackmisc/threadedreader.h" #include "blackmisc/avatcstationlist.h" #include "blackmisc/avaircraftlist.h" @@ -37,37 +41,48 @@ namespace BlackCore void read(); //! Get aircrafts - const BlackMisc::Aviation::CAircraftList &getAircrafts(); + //! \threadsafe + BlackMisc::Aviation::CAircraftList getAircrafts() const; //! Get aircrafts - const BlackMisc::Aviation::CAtcStationList &getAtcStations(); + //! \threadsafe + BlackMisc::Aviation::CAtcStationList getAtcStations() const; //! Get all voice servers - const BlackMisc::Network::CServerList &getVoiceServers(); + //! \threadsafe + BlackMisc::Network::CServerList getVoiceServers() const; //! Users for callsign(s) + //! \threadsafe BlackMisc::Network::CUserList getUsersForCallsigns(const BlackMisc::Aviation::CCallsignList &callsigns); //! User for callsign + //! \threadsafe BlackMisc::Network::CUserList getUsersForCallsign(const BlackMisc::Aviation::CCallsign &callsign); //! Controllers for callsigns + //! \threadsafe BlackMisc::Network::CUserList getControllersForCallsigns(const BlackMisc::Aviation::CCallsignList &callsigns); //! Controllers for callsign + //! \threadsafe BlackMisc::Network::CUserList getControllersForCallsign(const BlackMisc::Aviation::CCallsign &callsign); //! Users for callsigns + //! \threadsafe BlackMisc::Network::CUserList getPilotsForCallsigns(const BlackMisc::Aviation::CCallsignList &callsigns); //! Users for callsign + //! \threadsafe BlackMisc::Network::CUserList getPilotsForCallsign(const BlackMisc::Aviation::CCallsign &callsign); //! ICAO info for callsign + //! \threadsafe BlackMisc::Aviation::CAircraftIcao getIcaoInfo(const BlackMisc::Aviation::CCallsign &callsign); - //! Update with VATSIM aircraft data from data file - void updateWithVatsimDataFileData(BlackMisc::Aviation::CAircraft &aircraftToBeUdpated) const { this->m_aircrafts.updateWithVatsimDataFileData(aircraftToBeUdpated); } + //! Update aircraft with VATSIM aircraft data from data file + //! \threadsafe + void updateWithVatsimDataFileData(BlackMisc::Aviation::CAircraft &aircraftToBeUdpated) const; private slots: //! Data have been read