mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 14:58:33 +08:00
[xplane] Added display of simulation time ratio in simulator component
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user