mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +08:00
Ref T270, also display update aircraft (interpolation) request time
* made some ISimulator functions public, so they can be used in UI * added members for request times * better "shutdown" / "disconnect" detection
This commit is contained in:
@@ -173,6 +173,15 @@ namespace BlackCore
|
||||
//! Driver will be unloaded
|
||||
virtual void unload() = 0;
|
||||
|
||||
//! Are we connected to the simulator?
|
||||
virtual bool isConnected() const = 0;
|
||||
|
||||
//! Simulator paused?
|
||||
virtual bool isPaused() const = 0;
|
||||
|
||||
//! Simulator running?
|
||||
virtual bool isSimulating() const = 0;
|
||||
|
||||
//! Clear all aircraft related data
|
||||
virtual void clearAllRemoteAircraftData() = 0;
|
||||
|
||||
@@ -252,15 +261,6 @@ namespace BlackCore
|
||||
BlackMisc::Network::IClientProvider *clientProvider,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
//! Are we connected to the simulator?
|
||||
virtual bool isConnected() const = 0;
|
||||
|
||||
//! Simulator paused?
|
||||
virtual bool isPaused() const = 0;
|
||||
|
||||
//! Simulator running?
|
||||
virtual bool isSimulating() const = 0;
|
||||
|
||||
//! Add new remote aircraft physically to the simulator
|
||||
//! \sa changeRemoteAircraftEnabled to hide a remote aircraft
|
||||
virtual bool physicallyAddRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft) = 0;
|
||||
|
||||
@@ -587,6 +587,8 @@ namespace BlackCore
|
||||
m_statsUpdateAircraftTimeTotalMs = 0;
|
||||
m_statsPhysicallyAddedAircraft = 0;
|
||||
m_statsPhysicallyRemovedAircraft = 0;
|
||||
m_statsLastUpdateAircraftRequested = 0;
|
||||
m_statsUpdateAircraftRequestedDeltaMs = 0;
|
||||
}
|
||||
|
||||
CStatusMessageList CSimulatorCommon::debugVerifyStateAfterAllAircraftRemoved() const
|
||||
@@ -638,11 +640,14 @@ namespace BlackCore
|
||||
|
||||
void CSimulatorCommon::setStatsRemoteAircraftUpdate(qint64 startTime)
|
||||
{
|
||||
const qint64 dt = QDateTime::currentMSecsSinceEpoch() - startTime;
|
||||
const qint64 now = QDateTime::currentMSecsSinceEpoch();
|
||||
const qint64 dt = now - startTime;
|
||||
m_statsUpdateAircraftTimeTotalMs += dt;
|
||||
m_statsUpdateAircraftRuns++;
|
||||
m_statsUpdateAircraftTimeAvgMs = static_cast<double>(m_statsUpdateAircraftTimeTotalMs) / static_cast<double>(m_statsUpdateAircraftRuns);
|
||||
m_updateRemoteAircraftInProgress = false;
|
||||
if (m_statsLastUpdateAircraftRequested > 0) { m_statsUpdateAircraftRequestedDeltaMs = startTime - m_statsLastUpdateAircraftRequested; }
|
||||
m_statsLastUpdateAircraftRequested = startTime;
|
||||
}
|
||||
|
||||
void CSimulatorCommon::onRecalculatedRenderedAircraft(const CAirspaceAircraftSnapshot &snapshot)
|
||||
|
||||
@@ -123,6 +123,9 @@ namespace BlackCore
|
||||
//! Total update time in ms
|
||||
qint64 getStatisticsTotalUpdateTimeMs() const { return m_statsUpdateAircraftTimeTotalMs; }
|
||||
|
||||
//! Time between two update requests
|
||||
qint64 getStatisticsAircraftUpdatedRequestedDeltaMs() const { return m_statsUpdateAircraftRequestedDeltaMs; }
|
||||
|
||||
//! Access to logger
|
||||
const BlackMisc::Simulation::CInterpolationLogger &interpolationLogger() const { return m_interpolationLogger; }
|
||||
|
||||
@@ -239,8 +242,11 @@ namespace BlackCore
|
||||
bool m_updateRemoteAircraftInProgress = false; //!< currently updating remote aircraft
|
||||
int m_timerId = -1; //!< dispatch timer id
|
||||
int m_statsUpdateAircraftRuns = 0; //!< statistics update count
|
||||
qint64 m_statsUpdateAircraftTimeTotalMs = 0; //!< statistics total update time
|
||||
double m_statsUpdateAircraftTimeAvgMs = 0; //!< statistics average update time
|
||||
qint64 m_statsUpdateAircraftTimeTotalMs = 0; //!< statistics total update time
|
||||
qint64 m_statsLastUpdateAircraftRequested = 0; //!< when was the last aircraft update requested
|
||||
qint64 m_statsUpdateAircraftRequestedDeltaMs = 0; //!< delta time between 2 aircrat updates
|
||||
|
||||
BlackMisc::Simulation::CSimulatorInternals m_simulatorInternals; //!< setup object
|
||||
BlackMisc::Simulation::CInterpolationLogger m_interpolationLogger; //!< log.interpolation
|
||||
QMap<BlackMisc::Aviation::CCallsign, qint64> m_clampedLogMsg; //!< when logged last so there, can be used so there is no log message overflow
|
||||
|
||||
Reference in New Issue
Block a user