diff --git a/src/blackcore/context/contextsimulatorempty.h b/src/blackcore/context/contextsimulatorempty.h index 81d290805..7e6f57e51 100644 --- a/src/blackcore/context/contextsimulatorempty.h +++ b/src/blackcore/context/contextsimulatorempty.h @@ -183,14 +183,14 @@ namespace BlackCore return BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign(); } - //! \copydoc ISimulator::setInterpolationAndRenderingSetup + //! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupGlobal virtual void setInterpolationAndRenderingSetupGlobal(const BlackMisc::Simulation::CInterpolationAndRenderingSetupGlobal &setup) override { Q_UNUSED(setup); logEmptyContextWarning(Q_FUNC_INFO); } - //! \copydoc ISimulator::setInterpolationSetupPerCallsign + //! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupsPerCallsign virtual bool setInterpolationAndRenderingSetupsPerCallsign(const BlackMisc::Simulation::CInterpolationSetupList &setups, bool ignoreSameAsGlobal) override { Q_UNUSED(setups); diff --git a/src/blackcore/context/contextsimulatorimpl.cpp b/src/blackcore/context/contextsimulatorimpl.cpp index eb6f837b1..4f4204bef 100644 --- a/src/blackcore/context/contextsimulatorimpl.cpp +++ b/src/blackcore/context/contextsimulatorimpl.cpp @@ -133,13 +133,13 @@ namespace BlackCore return m_simulatorPlugin.second->getSimulatorStatus(); } - BlackMisc::Simulation::CSimulatorPluginInfo CContextSimulator::getSimulatorPluginInfo() const + CSimulatorPluginInfo CContextSimulator::getSimulatorPluginInfo() const { if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } - if (m_simulatorPlugin.first.isUnspecified()) { return BlackMisc::Simulation::CSimulatorPluginInfo(); } + if (m_simulatorPlugin.first.isUnspecified()) { return CSimulatorPluginInfo(); } Q_ASSERT(m_simulatorPlugin.second); - if (m_simulatorPlugin.first.getSimulator() == "emulated") { return m_simulatorPlugin.second->getSimulatorPluginInfo(); } + if (m_simulatorPlugin.first.getSimulator().contains("emulated", Qt::CaseInsensitive)) { return m_simulatorPlugin.second->getSimulatorPluginInfo(); } return m_simulatorPlugin.first; } diff --git a/src/blackcore/simulatorcommon.h b/src/blackcore/simulatorcommon.h index ecafe3f20..e7fcb436d 100644 --- a/src/blackcore/simulatorcommon.h +++ b/src/blackcore/simulatorcommon.h @@ -322,7 +322,7 @@ namespace BlackCore bool m_blinkCycle = false; //!< used for highlighting qint64 m_highlightEndTimeMsEpoch = 0; //!< end highlighting int m_timerCounter = 0; //!< allows to calculate n seconds - QTimer m_oneSecondTimer; //!< multi purpose timer + QTimer m_oneSecondTimer; //!< multi purpose timer with 1 sec. interval BlackMisc::Simulation::CSimulatedAircraftList m_highlightedAircraft; //!< all other aircraft are to be ignored BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered BlackMisc::CConnectionGuard m_remoteAircraftProviderConnections; //!< connected signal/slots diff --git a/src/blackmisc/network/url.h b/src/blackmisc/network/url.h index c4a287642..88dcafd79 100644 --- a/src/blackmisc/network/url.h +++ b/src/blackmisc/network/url.h @@ -36,7 +36,7 @@ namespace BlackMisc //! Properties by index enum ColumnIndex { - IndexScheme = BlackMisc::CPropertyIndex::GlobalIndexCUrl, + IndexScheme = CPropertyIndex::GlobalIndexCUrl, IndexHost, IndexPort, IndexPath, diff --git a/src/blackmisc/simulation/fscommon/bcdconversions.cpp b/src/blackmisc/simulation/fscommon/bcdconversions.cpp index 4620679ac..cdf8947a2 100644 --- a/src/blackmisc/simulation/fscommon/bcdconversions.cpp +++ b/src/blackmisc/simulation/fscommon/bcdconversions.cpp @@ -20,12 +20,11 @@ namespace BlackMisc { namespace FsCommon { - quint32 CBcdConversions::comFrequencyToBcdHz(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency) { // FSX documentation is wrong, we need to use kHz + 2 digits, not Hz - double f = comFrequency.valueRounded(CFrequencyUnit::kHz(), 0) / 10; - quint32 fInt = dec2Bcd(static_cast(f)); + const double f = comFrequency.valueRounded(CFrequencyUnit::kHz(), 0) / 10; + const quint32 fInt = dec2Bcd(static_cast(f)); return fInt; } @@ -48,7 +47,6 @@ namespace BlackMisc } return result; } - } // namespace } // namespace } // namespacee diff --git a/src/blackmisc/simulation/fscommon/bcdconversions.h b/src/blackmisc/simulation/fscommon/bcdconversions.h index 7c4514562..f03addc6b 100644 --- a/src/blackmisc/simulation/fscommon/bcdconversions.h +++ b/src/blackmisc/simulation/fscommon/bcdconversions.h @@ -14,18 +14,15 @@ #include "blackmisc/blackmiscexport.h" #include "blackmisc/pq/frequency.h" - #include namespace BlackMisc { namespace Aviation { class CTransponder; } - namespace Simulation { namespace FsCommon { - //! BCD conversions for FS class BLACKMISC_EXPORT CBcdConversions { @@ -49,7 +46,6 @@ namespace BlackMisc //! Horner scheme static quint32 hornerScheme(quint32 num, quint32 divider, quint32 factor); }; - } // ns } // ns } // ns diff --git a/src/blackmisc/simulation/simulatorinternals.h b/src/blackmisc/simulation/simulatorinternals.h index 823b7c3de..325622d07 100644 --- a/src/blackmisc/simulation/simulatorinternals.h +++ b/src/blackmisc/simulation/simulatorinternals.h @@ -38,7 +38,7 @@ namespace BlackMisc //! Specific values enum ColumnIndex { - IndexData = BlackMisc::CPropertyIndex::GlobalIndexCSimulatorInternals + IndexData = CPropertyIndex::GlobalIndexCSimulatorInternals }; //! Default constructor @@ -81,10 +81,10 @@ namespace BlackMisc void setSimulatorInstallationDirectory(const QString &fullFilePath); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + CVariant propertyByIndex(const CPropertyIndex &index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); //! Register metadata static void registerMetadata(); diff --git a/src/plugins/simulator/fsxcommon/fsxsettingscomponent.cpp b/src/plugins/simulator/fsxcommon/fsxsettingscomponent.cpp index ad3c7b605..6618214a4 100644 --- a/src/plugins/simulator/fsxcommon/fsxsettingscomponent.cpp +++ b/src/plugins/simulator/fsxcommon/fsxsettingscomponent.cpp @@ -48,7 +48,7 @@ namespace BlackSimPlugin if (!sGui || !sGui->getISimulator()) { return nullptr; } ISimulator *sim = sGui->getISimulator(); if (!sim->getSimulatorInfo().isFsxP3DFamily()) { return nullptr; } - if (sim->getSimulatorInfo() != m_simulator) { return nullptr; } + if (sim->getSimulatorInfo() != m_simulator) { return nullptr; } CSimulatorFsxCommon *fsx = static_cast(sim); // wonder why qobject_cast does not work here return fsx; } diff --git a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp index 920b638b9..6f6b1cbd4 100644 --- a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp +++ b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp @@ -96,7 +96,6 @@ namespace BlackSimPlugin this->initDataDefinitionsWhenConnected(); m_timerId = this->startTimer(DispatchIntervalMs); // do not start m_addPendingAircraftTimer here, it will be started when object was added - return true; } @@ -411,7 +410,7 @@ namespace BlackSimPlugin void CSimulatorFsxCommon::onSimStopped() { // stopping events in FSX: Load menu, weather and season - CLogMessage(this).info("Simulator stopped: %1") << this->m_simulatorDetails; + CLogMessage(this).info("Simulator stopped: %1") << m_simulatorDetails; const SimulatorStatus oldStatus = this->getSimulatorStatus(); m_simSimulating = false; m_simulatingChangedTs = QDateTime::currentMSecsSinceEpoch(); @@ -432,7 +431,7 @@ namespace BlackSimPlugin void CSimulatorFsxCommon::onSimExit() { - CLogMessage(this).info("Simulator exit: %1") << this->m_simulatorDetails; + CLogMessage(this).info("Simulator exit: %1") << m_simulatorDetails; // reset complete state, we are going down m_simulatingChangedTs = QDateTime::currentMSecsSinceEpoch(); @@ -1725,7 +1724,7 @@ namespace BlackSimPlugin if (!simObject.hasValidRequestAndObjectId()) { return false; } if (!m_hSimConnect) { return false; } - // always request, not only when something has changed + // stop by setting SIMCONNECT_PERIOD_NEVER HRESULT result = SimConnect_RequestDataOnSimObject( m_hSimConnect, simObject.getRequestId() + RequestSimDataOffset, CSimConnectDefinitions::DataRemoteAircraftGetPosition, diff --git a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.h b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.h index 3a0ab4382..418a7be91 100644 --- a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.h +++ b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.h @@ -312,6 +312,7 @@ namespace BlackSimPlugin void updateProbeFromSimulator(const BlackMisc::Aviation::CCallsign &callsign, const DataDefinitionRemoteAircraftSimData &remoteAircraftData); //! Update from SB client area + //! \threadsafe void updateOwnAircraftFromSimulator(const DataDefinitionClientAreaSb &sbDataArea); //! An AI aircraft was added in the simulator @@ -412,15 +413,15 @@ namespace BlackSimPlugin static constexpr int DeferSimulatingFlagMs = 1500; //!< simulating can jitter at startup (simulating->stopped->simulating, multiple start events), so we defer detection static constexpr int DeferResendingLights = 2500; //!< Resend light state when aircraft light state was not yet available - QString m_simConnectVersion; //!< SimConnect version - bool m_simConnected = false; //!< Is simulator connected? - bool m_simSimulating = false; //!< Simulator running? - bool m_useSbOffsets = true; //!< with SB offsets - bool m_traceSendId = false; //!< trace the send ids, meant for debugging - qint64 m_traceAutoTs = -1; //!< allows to automatically trace for some time - qint64 m_simulatingChangedTs = -1; //!< timestamp, when simulating changed (used to avoid jitter) - int m_syncDeferredCounter = 0; //!< Set when synchronized, used to wait some time - int m_skipCockpitUpdateCycles = 0; //!< skip some update cycles to allow changes in simulator cockpit to be set + QString m_simConnectVersion; //!< SimConnect version + bool m_simConnected = false; //!< Is simulator connected? + bool m_simSimulating = false; //!< Simulator running? + bool m_useSbOffsets = true; //!< with SB offsets + bool m_traceSendId = false; //!< trace the send ids, meant for debugging + qint64 m_traceAutoTs = -1; //!< allows to automatically trace for some time + qint64 m_simulatingChangedTs = -1; //!< timestamp, when simulating changed (used to avoid jitter) + int m_syncDeferredCounter = 0; //!< Set when synchronized, used to wait some time + int m_skipCockpitUpdateCycles = 0; //!< skip some update cycles to allow changes in simulator cockpit to be set // tracing dispatch performance int m_dispatchErrors = 0; //!< number of dispatched failed, \sa dispatch @@ -428,6 +429,7 @@ namespace BlackSimPlugin qint64 m_dispatchMaxTimeMs = -1; qint64 m_dispatchProcTimeMs = -1; qint64 m_dispatchProcMaxTimeMs = -1; + SIMCONNECT_RECV_ID m_dispatchLastReceiveId = SIMCONNECT_RECV_ID_NULL; //!< last receive id from dispatching SIMCONNECT_RECV_ID m_dispatchMaxTimeReceiveId = SIMCONNECT_RECV_ID_NULL; //!< receive id corresponding to max.time CSimConnectDefinitions::Request m_dispatchLastRequest = CSimConnectDefinitions::RequestEndMarker; //!< request id if any