From a48a875e4297303de63bdb309f8ef953057871bf Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Mon, 2 Feb 2015 17:50:15 +0100 Subject: [PATCH] refs #369, use SimulatedAircraftList (instead of CAircraftList) --- src/blackcore/context_network.h | 4 +- src/blackcore/context_network_empty.h | 4 +- src/blackcore/context_network_impl.cpp | 85 ------------------------- src/blackcore/context_network_impl.h | 5 +- src/blackcore/context_network_proxy.cpp | 4 +- src/blackcore/context_network_proxy.h | 2 +- 6 files changed, 10 insertions(+), 94 deletions(-) diff --git a/src/blackcore/context_network.h b/src/blackcore/context_network.h index 24c58d417..88aaa06dc 100644 --- a/src/blackcore/context_network.h +++ b/src/blackcore/context_network.h @@ -14,7 +14,7 @@ #include "blackcore/context.h" #include "blackmisc/avatcstationlist.h" -#include "blackmisc/avaircraftlist.h" +#include "blackmisc/simulation/simulatedaircraftlist.h" #include "blackmisc/statusmessage.h" #include "blackmisc/statusmessagelist.h" #include "blackmisc/nwtextmessagelist.h" @@ -131,7 +131,7 @@ namespace BlackCore virtual BlackMisc::Aviation::CAtcStationList getAtcStationsBooked() const = 0 ; //! Aircraft list - virtual BlackMisc::Aviation::CAircraftList getAircraftInRange() const = 0; + virtual BlackMisc::Simulation::CSimulatedAircraftList getAircraftInRange() const = 0; //! Get all users virtual BlackMisc::Network::CUserList getUsers() const = 0; diff --git a/src/blackcore/context_network_empty.h b/src/blackcore/context_network_empty.h index d776fa70a..403190709 100644 --- a/src/blackcore/context_network_empty.h +++ b/src/blackcore/context_network_empty.h @@ -54,10 +54,10 @@ namespace BlackCore } //! \copydoc IContextNetwork::getAircraftInRange() - virtual BlackMisc::Aviation::CAircraftList getAircraftInRange() const override + virtual BlackMisc::Simulation::CSimulatedAircraftList getAircraftInRange() const override { logEmptyContextWarning(Q_FUNC_INFO); - return BlackMisc::Aviation::CAircraftList(); + return BlackMisc::Simulation::CSimulatedAircraftList(); } //! \copydoc IContextNetwork::connectToNetwork diff --git a/src/blackcore/context_network_impl.cpp b/src/blackcore/context_network_impl.cpp index 687b306e6..8c82b42cc 100644 --- a/src/blackcore/context_network_impl.cpp +++ b/src/blackcore/context_network_impl.cpp @@ -36,10 +36,6 @@ using namespace BlackMisc::Simulation; namespace BlackCore { - - /* - * Init this context - */ CContextNetwork::CContextNetwork(CRuntimeConfig::ContextMode mode, CRuntime *runtime) : IContextNetwork(mode, runtime) { @@ -89,17 +85,11 @@ namespace BlackCore // connect(this->getIContextSimulator(), &IContextSimulator::ownAircraftModelChanged, this->m_airspace, &CAirspaceMonitor::setOwnAircraftModel); } - /* - * Cleanup - */ CContextNetwork::~CContextNetwork() { this->gracefulShutdown(); } - /* - * Stop, going down - */ void CContextNetwork::gracefulShutdown() { if (this->m_vatsimBookingReader) { this->m_vatsimBookingReader->quit(); } @@ -107,9 +97,6 @@ namespace BlackCore if (this->isConnected()) { this->disconnectFromNetwork(); } } - /* - * Connect to network - */ CStatusMessage CContextNetwork::connectToNetwork(const CServer &server, uint loginMode) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; @@ -149,9 +136,6 @@ namespace BlackCore } } - /* - * Disconnect from network - */ CStatusMessage CContextNetwork::disconnectFromNetwork() { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; @@ -172,18 +156,12 @@ namespace BlackCore } } - /* - * Connected - */ bool CContextNetwork::isConnected() const { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; return this->m_network->isConnected(); } - /* - * Pending connection - */ bool CContextNetwork::isPendingConnection() const { // if underlying class says pending, we believe it. But not all states (e.g. disconnecting) are covered @@ -193,27 +171,18 @@ namespace BlackCore return INetwork::isPendingStatus(this->m_currentStatus); } - /* - * Command line entered - */ bool CContextNetwork::parseCommandLine(const QString &commandLine) { Q_UNUSED(commandLine); return false; } - /* - * Send text messages - */ void CContextNetwork::sendTextMessages(const CTextMessageList &textMessages) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << textMessages; this->m_network->sendTextMessages(textMessages); } - /* - * Flight plan - */ void CContextNetwork::sendFlightPlan(const CFlightPlan &flightPlan) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << flightPlan; @@ -227,17 +196,11 @@ namespace BlackCore return this->m_airspace->loadFlightPlanFromNetwork(callsign); } - /* - * All users - */ CUserList CContextNetwork::getUsers() const { return this->m_airspace->getUsers(); } - /* - * Users with callsigns - */ CUserList CContextNetwork::getUsersForCallsigns(const CCallsignList &callsigns) const { CUserList users; @@ -245,9 +208,6 @@ namespace BlackCore return this->m_airspace->getUsersForCallsigns(callsigns); } - /* - * User for callsign - */ CUser CContextNetwork::getUserForCallsign(const CCallsign &callsign) const { CCallsignList callsigns; @@ -257,25 +217,16 @@ namespace BlackCore return users[0]; } - /* - * Other clients - */ CClientList CContextNetwork::getOtherClients() const { return this->m_airspace->getOtherClients(); } - /* - * Other clients for callsign - */ CClientList CContextNetwork::getOtherClientsForCallsigns(const CCallsignList &callsigns) const { return this->m_airspace->getOtherClientsForCallsigns(callsigns); } - /* - * VATSIM FSD servers - */ CServerList CContextNetwork::getVatsimFsdServers() const { Q_ASSERT(this->m_vatsimDataFileReader); @@ -283,9 +234,6 @@ namespace BlackCore return this->m_vatsimDataFileReader->getFsdServers(); } - /* - * VATSIM Voice servers - */ CServerList CContextNetwork::getVatsimVoiceServers() const { Q_ASSERT(this->m_vatsimDataFileReader); @@ -293,9 +241,6 @@ namespace BlackCore return this->m_vatsimDataFileReader->getVoiceServers(); } - /* - * Connection status changed - */ void CContextNetwork::ps_fsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << from << to; @@ -329,9 +274,6 @@ namespace BlackCore emit this->connectionStatusChanged(from, to); } - /* - * Data file (VATSIM) has been read - */ void CContextNetwork::ps_dataFileRead() { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; @@ -339,9 +281,6 @@ namespace BlackCore emit vatsimDataFileRead(); } - /* - * Radio text message received - */ void CContextNetwork::ps_fsdTextMessageReceived(const CTextMessageList &messages) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << messages; @@ -355,18 +294,12 @@ namespace BlackCore return this->getRuntime()->getCContextOwnAircraft()->ownAircraft(); } - /* - * Reload bookings - */ void CContextNetwork::readAtcBookingsFromSource() const { Q_ASSERT(this->m_vatsimBookingReader); this->m_vatsimBookingReader->read(); } - /* - * Updated bookings - */ void CContextNetwork::ps_receivedBookings(const CAtcStationList &) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; @@ -374,9 +307,6 @@ namespace BlackCore emit vatsimBookingsRead(); } - /* - * Update data - */ void CContextNetwork::requestDataUpdates() { Q_ASSERT(this->m_network); @@ -386,9 +316,6 @@ namespace BlackCore this->m_airspace->requestDataUpdates(); } - /* - * Request new ATIS data - */ void CContextNetwork::requestAtisUpdates() { Q_ASSERT(this->m_network); @@ -397,26 +324,17 @@ namespace BlackCore this->m_airspace->requestAtisUpdates(); } - /* - * Create dummy ATC stations - */ void CContextNetwork::testCreateDummyOnlineAtcStations(int number) { this->m_airspace->testCreateDummyOnlineAtcStations(number); } - /* - * Request METAR - */ BlackMisc::Aviation::CInformationMessage CContextNetwork::getMetar(const BlackMisc::Aviation::CAirportIcao &airportIcaoCode) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << airportIcaoCode; return m_airspace->getMetar(airportIcaoCode); } - /* - * Selected voice rooms - */ CAtcStationList CContextNetwork::getSelectedAtcStations() const { CAtcStation com1Station = this->m_airspace->getAtcStationForComUnit(this->ownAircraft().getCom1System()); @@ -428,9 +346,6 @@ namespace BlackCore return selectedStations; } - /* - * Selected voice rooms - */ CVoiceRoomList CContextNetwork::getSelectedVoiceRooms() const { CAtcStationList stations = this->getSelectedAtcStations(); diff --git a/src/blackcore/context_network_impl.h b/src/blackcore/context_network_impl.h index ae6beffec..b31569264 100644 --- a/src/blackcore/context_network_impl.h +++ b/src/blackcore/context_network_impl.h @@ -66,7 +66,7 @@ namespace BlackCore } //! \copydoc IContextNetwork::getAircraftInRange() - virtual BlackMisc::Aviation::CAircraftList getAircraftInRange() const override + virtual BlackMisc::Simulation::CSimulatedAircraftList getAircraftInRange() const override { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; return this->m_airspace->getAircraftInRange(); @@ -159,6 +159,7 @@ namespace BlackCore BlackCore::INetwork *m_network = nullptr; INetwork::ConnectionStatus m_currentStatus = INetwork::Disconnected; //!< used to detect pending connections + // Digest signals, only sending after some time BlackMisc::CDigestSignal m_dsAtcStationsBookedChanged { this, &IContextNetwork::changedAtcStationsBooked, &IContextNetwork::changedAtcStationsBookedDigest, 750, 2 }; BlackMisc::CDigestSignal m_dsAtcStationsOnlineChanged { this, &IContextNetwork::changedAtcStationsOnline, &IContextNetwork::changedAtcStationsOnlineDigest, 750, 4 }; BlackMisc::CDigestSignal m_dsAircraftsInRangeChanged { this, &IContextNetwork::changedAircraftInRange, &IContextNetwork::changedAircraftInRangeDigest, 750, 4 }; @@ -176,7 +177,7 @@ namespace BlackCore return this->getRuntime()->getIContextSettings()->getNetworkSettings(); } - //! Own aircraft + //! Own aircraft from \sa CContextOwnAircraft const BlackMisc::Aviation::CAircraft &ownAircraft() const; private slots: diff --git a/src/blackcore/context_network_proxy.cpp b/src/blackcore/context_network_proxy.cpp index c76cd6356..d6da499a8 100644 --- a/src/blackcore/context_network_proxy.cpp +++ b/src/blackcore/context_network_proxy.cpp @@ -90,9 +90,9 @@ namespace BlackCore return this->m_dBusInterface->callDBusRet(QLatin1Literal("getAtcStationsBooked")); } - BlackMisc::Aviation::CAircraftList CContextNetworkProxy::getAircraftInRange() const + Simulation::CSimulatedAircraftList CContextNetworkProxy::getAircraftInRange() const { - return this->m_dBusInterface->callDBusRet(QLatin1Literal("getAircraftInRange")); + return this->m_dBusInterface->callDBusRet(QLatin1Literal("getAircraftInRange")); } BlackMisc::Network::CUserList CContextNetworkProxy::getUsers() const diff --git a/src/blackcore/context_network_proxy.h b/src/blackcore/context_network_proxy.h index 618be100b..0e4f28d7a 100644 --- a/src/blackcore/context_network_proxy.h +++ b/src/blackcore/context_network_proxy.h @@ -63,7 +63,7 @@ namespace BlackCore virtual BlackMisc::Aviation::CAtcStationList getAtcStationsBooked() const override; //! \copydoc IContextNetwork::getAircraftInRange() - virtual BlackMisc::Aviation::CAircraftList getAircraftInRange() const override; + virtual BlackMisc::Simulation::CSimulatedAircraftList getAircraftInRange() const override; //! \copydoc IContextNetwork::connectToNetwork virtual BlackMisc::CStatusMessage connectToNetwork(const BlackMisc::Network::CServer &server, uint mode) override;