From c4dd888fa7f1948cd0981c046046563432320049 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 17 Nov 2016 04:41:56 +0100 Subject: [PATCH] refs #808, added support for internals object * initInternalsObject * some formatting --- src/blackcore/simulatorcommon.cpp | 2 +- src/blackcore/simulatorcommon.h | 4 ++-- .../simulator/fscommon/simulatorfscommon.cpp | 16 ++++++++++++++++ .../simulator/fscommon/simulatorfscommon.h | 7 ++++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/blackcore/simulatorcommon.cpp b/src/blackcore/simulatorcommon.cpp index 8f7971958..a5fa4e6d6 100644 --- a/src/blackcore/simulatorcommon.cpp +++ b/src/blackcore/simulatorcommon.cpp @@ -240,7 +240,7 @@ namespace BlackCore const CSimulatorInternals &CSimulatorCommon::getSimulatorInternals() const { - return m_simulatorSetup; + return m_simulatorInternals; } void CSimulatorCommon::unload() diff --git a/src/blackcore/simulatorcommon.h b/src/blackcore/simulatorcommon.h index 066b1a0ec..31fd58a06 100644 --- a/src/blackcore/simulatorcommon.h +++ b/src/blackcore/simulatorcommon.h @@ -137,12 +137,12 @@ namespace BlackCore BlackMisc::IInterpolator *m_interpolator = nullptr; //!< interpolator instance bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold) - BlackMisc::Simulation::CSimulatorInternals m_simulatorSetup; //!< setup object - BlackMisc::CInterpolationAndRenderingSetup m_interpolationRenderingSetup; //!< debug messages, rendering etc. BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< default model qint64 m_statsUpdateAircraftTimeTotalMs = 0; //!< statistics update time qint64 m_statsUpdateAircraftTimeAvgMs = 0; //!< statistics update time int m_statsUpdateAircraftCountMs = 0; //!< statistics update time + BlackMisc::Simulation::CSimulatorInternals m_simulatorInternals; //!< setup object + BlackMisc::CInterpolationAndRenderingSetup m_interpolationRenderingSetup; //!< debug messages, rendering etc. // some optional functionality which can be used by the sims as needed BlackMisc::Simulation::CSimulatedAircraftList m_aircraftToAddAgainWhenRemoved; //!< add this model again when removed, normally used to change model diff --git a/src/plugins/simulator/fscommon/simulatorfscommon.cpp b/src/plugins/simulator/fscommon/simulatorfscommon.cpp index 8e1694c7d..7caf56332 100644 --- a/src/plugins/simulator/fscommon/simulatorfscommon.cpp +++ b/src/plugins/simulator/fscommon/simulatorfscommon.cpp @@ -9,6 +9,7 @@ #include "simulatorfscommon.h" #include "blackmisc/logmessage.h" +#include "blackmisc/stringutils.h" using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Simulation; @@ -35,6 +36,21 @@ namespace BlackSimPlugin CSimulatorFsCommon::~CSimulatorFsCommon() { } + void CSimulatorFsCommon::initInternalsObject() + { + CSimulatorInternals s; + s.setSimulatorName(this->m_simulatorName); + s.setSimulatorVersion(this->m_simulatorVersion); + s.setValue("fscommon/fsuipc", boolToOnOff(m_useFsuipc)); + if (m_fsuipc) + { + const QString v(m_fsuipc->getVersion()); + if (!v.isEmpty()) { s.setValue("fscommon/fsuipcversion", v); } + s.setValue("fscommon/fsuipcconnect", boolToYesNo(m_fsuipc->isConnected())); + } + this->m_simulatorInternals = s; + } + bool CSimulatorFsCommon::disconnectFrom() { if (this->m_fsuipc) { this->m_fsuipc->disconnect(); } diff --git a/src/plugins/simulator/fscommon/simulatorfscommon.h b/src/plugins/simulator/fscommon/simulatorfscommon.h index e6caf5221..b928913ec 100644 --- a/src/plugins/simulator/fscommon/simulatorfscommon.h +++ b/src/plugins/simulator/fscommon/simulatorfscommon.h @@ -53,7 +53,12 @@ namespace BlackSimPlugin BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider, QObject *parent = nullptr); - QString simulatorDetails; //!< describes version etc. + //! Init the internals objects + virtual void initInternalsObject(); + + QString m_simulatorName; //!< name of simulator + QString m_simulatorDetails; //!< describes version etc. + QString m_simulatorVersion; //!< Simulator version QScopedPointer m_fsuipc; //!< FSUIPC bool m_useFsuipc = true; //!< use FSUIPC bool m_simPaused = false; //!< Simulator paused?