mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T298, get/set matching setup in context plus some minor style fixes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -263,5 +263,15 @@ namespace BlackCore
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<CMatchingStatistics>(QLatin1String("getCurrentMatchingStatistics"), missingOnly);
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::setMatchingSetup(const CAircraftMatcherSetup &setup)
|
||||
{
|
||||
m_dBusInterface->callDBus(QLatin1String("setMatchingSetup"), setup);
|
||||
}
|
||||
|
||||
CAircraftMatcherSetup CContextSimulatorProxy::getMatchingSetup() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<CAircraftMatcherSetup>(QLatin1String("getMatchingSetup"));
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user