mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
Group own aircraft DBus calls together
Previously all own aircraft values were request via single DBus calls. Since DBus allows up to 8 values in its reply, use this mechanism to group the requests and reduce the amount of single calls.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "xswiftbusserviceproxy.h"
|
||||
#include "simulatorxplane.h"
|
||||
|
||||
#include <QLatin1String>
|
||||
|
||||
@@ -25,6 +26,27 @@ namespace BlackSimPlugin
|
||||
if (!dummy) { m_dbusInterface->relayParentSignals(); }
|
||||
}
|
||||
|
||||
void CXSwiftBusServiceProxy::getOwnAircraftSituationData(XPlaneData *o_xplaneData)
|
||||
{
|
||||
std::function<void(QDBusPendingCallWatcher *)> callback = [this, o_xplaneData](QDBusPendingCallWatcher * watcher)
|
||||
{
|
||||
QDBusPendingReply<double, double, double, double, double, double, double, double> reply = *watcher;
|
||||
if (!reply.isError())
|
||||
{
|
||||
o_xplaneData->latitude = reply.argumentAt<0>();
|
||||
o_xplaneData->longitude = reply.argumentAt<1>();
|
||||
o_xplaneData->altitude = reply.argumentAt<2>();
|
||||
o_xplaneData->groundspeed = reply.argumentAt<3>();
|
||||
o_xplaneData->pitch = reply.argumentAt<4>();
|
||||
o_xplaneData->roll = reply.argumentAt<5>();
|
||||
o_xplaneData->trueHeading = reply.argumentAt<6>();
|
||||
o_xplaneData->seaLeveLPressure = reply.argumentAt<7>();
|
||||
}
|
||||
watcher->deleteLater();
|
||||
};
|
||||
m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftSituationData"), callback);
|
||||
}
|
||||
|
||||
void CXSwiftBusServiceProxy::addTextMessage(const QString &text, double red, double green, double blue)
|
||||
{
|
||||
m_dbusInterface->callDBus(QLatin1String("addTextMessage"), text, red, green, blue);
|
||||
|
||||
Reference in New Issue
Block a user