diff --git a/src/blackcore/aircraftmatcher.h b/src/blackcore/aircraftmatcher.h index ad834f105..0dca3d5ef 100644 --- a/src/blackcore/aircraftmatcher.h +++ b/src/blackcore/aircraftmatcher.h @@ -57,6 +57,9 @@ namespace BlackCore //! Set the setup void setSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup) { m_setup = setup; } + //! Get the setup + BlackMisc::Simulation::CAircraftMatcherSetup getSetup() const { return m_setup; } + //! Get the closest matching aircraft model from set. //! Result depends on enabled modes. //! \sa MatchingModeFlag diff --git a/src/blackcore/context/contextsimulator.h b/src/blackcore/context/contextsimulator.h index e7c1b0201..98e06330f 100644 --- a/src/blackcore/context/contextsimulator.h +++ b/src/blackcore/context/contextsimulator.h @@ -31,6 +31,7 @@ #include "blackcore/simulator.h" #include "blackmisc/weather/weathergrid.h" #include "blackmisc/simulation/aircraftmodellist.h" +#include "blackmisc/simulation/aircraftmatchersetup.h" #include "blackmisc/simulation/matchingstatistics.h" #include "blackmisc/simulation/simulatorplugininfo.h" #include "blackmisc/simulation/simulatorplugininfolist.h" @@ -240,6 +241,12 @@ namespace BlackCore //! Current matching statistics virtual BlackMisc::Simulation::CMatchingStatistics getCurrentMatchingStatistics(bool missingOnly) const = 0; + //! Set matching setup + virtual void setMatchingSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup) = 0; + + //! Get matching setup + virtual BlackMisc::Simulation::CAircraftMatcherSetup getMatchingSetup() const = 0; + protected: //! Constructor IContextSimulator(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) : CContext(mode, runtime) {} diff --git a/src/blackcore/context/contextsimulatorempty.h b/src/blackcore/context/contextsimulatorempty.h index 7e6f57e51..f0707c37e 100644 --- a/src/blackcore/context/contextsimulatorempty.h +++ b/src/blackcore/context/contextsimulatorempty.h @@ -290,6 +290,18 @@ namespace BlackCore Q_UNUSED(missingOnly); return BlackMisc::Simulation::CMatchingStatistics(); } + + //! \copydoc IContextSimulator::setMatchingSetup + virtual void setMatchingSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup) override + { + Q_UNUSED(setup); + } + + //! \copydoc IContextSimulator::setMatchingSetup + virtual BlackMisc::Simulation::CAircraftMatcherSetup getMatchingSetup() const override + { + return BlackMisc::Simulation::CAircraftMatcherSetup(); + } }; } // namespace } // namespace diff --git a/src/blackcore/context/contextsimulatorimpl.cpp b/src/blackcore/context/contextsimulatorimpl.cpp index bd4459227..4b963e03f 100644 --- a/src/blackcore/context/contextsimulatorimpl.cpp +++ b/src/blackcore/context/contextsimulatorimpl.cpp @@ -752,6 +752,18 @@ namespace BlackCore statistics; } + void CContextSimulator::setMatchingSetup(const CAircraftMatcherSetup &setup) + { + if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << setup.toQString(); } + m_aircraftMatcher.setSetup(setup); + } + + CAircraftMatcherSetup CContextSimulator::getMatchingSetup() const + { + if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } + return m_aircraftMatcher.getSetup(); + } + bool CContextSimulator::parseCommandLine(const QString &commandLine, const CIdentifier &originator) { Q_UNUSED(originator); diff --git a/src/blackcore/context/contextsimulatorimpl.h b/src/blackcore/context/contextsimulatorimpl.h index c83744079..c553a77f9 100644 --- a/src/blackcore/context/contextsimulatorimpl.h +++ b/src/blackcore/context/contextsimulatorimpl.h @@ -103,7 +103,9 @@ namespace BlackCore virtual BlackMisc::CStatusMessageList getMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign) const override; virtual bool isMatchingMessagesEnabled() const override; virtual void enableMatchingMessages(bool enabled) override; - BlackMisc::Simulation::CMatchingStatistics getCurrentMatchingStatistics(bool missingOnly) const override; + virtual BlackMisc::Simulation::CMatchingStatistics getCurrentMatchingStatistics(bool missingOnly) const override; + virtual void setMatchingSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup) override; + virtual BlackMisc::Simulation::CAircraftMatcherSetup getMatchingSetup() const override; //! @} //! \addtogroup swiftdotcommands diff --git a/src/blackcore/context/contextsimulatorproxy.cpp b/src/blackcore/context/contextsimulatorproxy.cpp index 14a322a6b..169af674c 100644 --- a/src/blackcore/context/contextsimulatorproxy.cpp +++ b/src/blackcore/context/contextsimulatorproxy.cpp @@ -263,5 +263,15 @@ namespace BlackCore { return m_dBusInterface->callDBusRet(QLatin1String("getCurrentMatchingStatistics"), missingOnly); } + + void CContextSimulatorProxy::setMatchingSetup(const CAircraftMatcherSetup &setup) + { + m_dBusInterface->callDBus(QLatin1String("setMatchingSetup"), setup); + } + + CAircraftMatcherSetup CContextSimulatorProxy::getMatchingSetup() const + { + return m_dBusInterface->callDBusRet(QLatin1String("getMatchingSetup")); + } } // namespace } // namespace diff --git a/src/blackcore/context/contextsimulatorproxy.h b/src/blackcore/context/contextsimulatorproxy.h index 8cd9f6b21..12bf7027a 100644 --- a/src/blackcore/context/contextsimulatorproxy.h +++ b/src/blackcore/context/contextsimulatorproxy.h @@ -48,7 +48,7 @@ namespace BlackCore public: //! Destructor - virtual ~CContextSimulatorProxy() {} + virtual ~CContextSimulatorProxy() override {} //! Unit test relay signals //! \private @@ -92,17 +92,19 @@ namespace BlackCore virtual void enableMatchingMessages(bool enabled) override; virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override; virtual BlackMisc::Simulation::CMatchingStatistics getCurrentMatchingStatistics(bool missingOnly) const override; + virtual void setMatchingSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup) override; + virtual BlackMisc::Simulation::CAircraftMatcherSetup getMatchingSetup() const override; //! @} private: - BlackMisc::CGenericDBusInterface *m_dBusInterface; + BlackMisc::CGenericDBusInterface *m_dBusInterface = nullptr; //! Relay connection signals to local signals void relaySignals(const QString &serviceName, QDBusConnection &connection); protected: //! Constructor - CContextSimulatorProxy(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) : IContextSimulator(mode, runtime), m_dBusInterface(0) {} + CContextSimulatorProxy(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) : IContextSimulator(mode, runtime) {} //! DBus version constructor CContextSimulatorProxy(const QString &serviceName, QDBusConnection &connection, CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime);