[xplane] Added display of simulation time ratio in simulator component

This commit is contained in:
Mat Sutcliffe
2020-01-12 17:34:48 +00:00
parent c88b05a734
commit 35cfaebc7d
9 changed files with 79 additions and 19 deletions

View File

@@ -369,7 +369,7 @@ namespace BlackSimPlugin
if ((m_slowTimerCalls % 5) == 0)
{
// reading FPS resets average, so we only monitor over some time
m_averageFps = m_serviceProxy->getAverageFPS();
m_serviceProxy->getFrameStats(&m_averageFps, &m_simTimeRatio);
}
}
}

View File

@@ -319,13 +319,34 @@ namespace BlackSimPlugin
m_dbusInterface->callDBusAsync(QLatin1String("isUsingRealTime"), setterCallback(o_isRealTime));
}
double CXSwiftBusServiceProxy::getAverageFPS() const
void CXSwiftBusServiceProxy::getFrameStats(double *o_averageFps, double *o_simTimeRatio) const
{
return m_dbusInterface->callDBusRet<double>(QLatin1String("getAverageFPS"));
std::function<void(QDBusPendingCallWatcher *)> callback = [ = ](QDBusPendingCallWatcher * watcher)
{
QDBusPendingReply<double, double> reply = *watcher;
if (!reply.isError())
{
*o_averageFps = reply.argumentAt<0>();
*o_simTimeRatio = reply.argumentAt<1>();
}
watcher->deleteLater();
};
m_dbusInterface->callDBusAsync(QLatin1String("getFrameStats"), callback)->waitForFinished();
}
void CXSwiftBusServiceProxy::getAverageFPSAsync(double *o_frameRate)
void CXSwiftBusServiceProxy::getFrameStatsAsync(double *o_averageFps, double *o_simTimeRatio)
{
m_dbusInterface->callDBusAsync(QLatin1String("getAverageFPS"), setterCallback(o_frameRate));
std::function<void(QDBusPendingCallWatcher *)> callback = [ = ](QDBusPendingCallWatcher * watcher)
{
QDBusPendingReply<double, double> reply = *watcher;
if (!reply.isError())
{
*o_averageFps = reply.argumentAt<0>();
*o_simTimeRatio = reply.argumentAt<1>();
}
watcher->deleteLater();
};
m_dbusInterface->callDBusAsync(QLatin1String("getFrameStats"), callback);
}
double CXSwiftBusServiceProxy::getLatitudeDeg() const

View File

@@ -208,10 +208,10 @@ namespace BlackSimPlugin
void isUsingRealTimeAsync(bool *o_isRealTime);
//! @}
//! \copydoc XSwiftBus::CService::getAverageFPS
//! \copydoc XSwiftBus::CService::getFrameStats
//! @{
double getAverageFPS() const;
void getAverageFPSAsync(double *o_frameRate);
void getFrameStats(double *o_averageFps, double *o_simTimeRatio) const;
void getFrameStatsAsync(double *o_averageFps, double *o_simTimeRatio);
//! @}
//! \copydoc XSwiftBus::CService::getLatitudeDeg