swift
xswiftbusserviceproxy.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #include <QLatin1String>
7 #include <QPointer>
8 
9 #include "simulatorxplane.h"
10 
11 class QDBusConnection;
12 
13 #define XSWIFTBUS_SERVICE_SERVICENAME "org.swift-project.xswiftbus"
14 
15 namespace swift::simplugin::xplane
16 {
17  CXSwiftBusServiceProxy::CXSwiftBusServiceProxy(QDBusConnection &connection, QObject *parent, bool dummy)
18  : QObject(parent)
19  {
20  m_dbusInterface = new swift::misc::CGenericDBusInterface(XSWIFTBUS_SERVICE_SERVICENAME, ObjectPath(),
21  InterfaceName(), connection, this);
22  if (!dummy)
23  {
24  bool s;
25  s = connection.connect(
26  QString(), "/xswiftbus/service", "org.swift_project.xswiftbus.service", "aircraftModelChanged", this,
27  SIGNAL(aircraftModelChanged(QString, QString, QString, QString, QString, QString, QString)));
28  Q_ASSERT(s);
29 
30  s = connection.connect(
31  QString(), "/xswiftbus/service", "org.swift_project.xswiftbus.service", "airportsInRangeUpdated", this,
32  SIGNAL(airportsInRangeUpdated(QStringList, QStringList, QList<double>, QList<double>, QList<double>)));
33  Q_ASSERT(s);
34 
35  s = connection.connect(QString(), "/xswiftbus/service", "org.swift_project.xswiftbus.service",
36  "sceneryLoaded", this, SIGNAL(sceneryLoaded()));
37  Q_ASSERT(s);
38  }
39  }
40 
42  {
43  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getVersionNumber"));
44  }
45 
47  {
48  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getCommitHash"));
49  }
50 
52  {
53  if (!o_xplaneData) { return; }
54  QPointer<CXSwiftBusServiceProxy> myself(this);
55  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
56  if (!myself) { return; }
57  QDBusPendingReply<double, double, double, double, double, double, double, double> reply = *watcher;
58  if (!reply.isError())
59  {
60  o_xplaneData->latitudeDeg = reply.argumentAt<0>();
61  o_xplaneData->longitudeDeg = reply.argumentAt<1>();
62  o_xplaneData->altitudeM = reply.argumentAt<2>();
63  o_xplaneData->groundspeedMs = reply.argumentAt<3>();
64  o_xplaneData->pitchDeg = reply.argumentAt<4>();
65  o_xplaneData->rollDeg = reply.argumentAt<5>();
66  o_xplaneData->trueHeadingDeg = reply.argumentAt<6>();
67  o_xplaneData->seaLevelPressureInHg = reply.argumentAt<7>();
68  }
69  watcher->deleteLater();
70  };
71  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftSituationData"), callback);
72  }
73 
75  {
76  if (!o_xplaneData) { return; }
77  QPointer<CXSwiftBusServiceProxy> myself(this);
78  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
79  if (!myself) { return; }
80  QDBusPendingReply<double, double, double, double, double, double> reply = *watcher;
81  if (!reply.isError())
82  {
83  o_xplaneData->localXVelocityMs = reply.argumentAt<0>();
84  o_xplaneData->localYVelocityMs = reply.argumentAt<1>();
85  o_xplaneData->localZVelocityMs = -reply.argumentAt<2>();
86  o_xplaneData->pitchRadPerSec = -reply.argumentAt<3>();
87  o_xplaneData->rollRadPerSec = -reply.argumentAt<4>();
88  o_xplaneData->headingRadPerSec = reply.argumentAt<5>();
89  }
90  };
91  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftVelocityData"), callback);
92  }
93 
95  {
96  if (!o_xplaneData) { return; }
97  QPointer<CXSwiftBusServiceProxy> myself(this);
98  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
99  if (!myself) { return; }
100  QDBusPendingReply<int, int, double, bool, bool> reply = *watcher;
101  if (!reply.isError())
102  {
103  o_xplaneData->com1ActiveKhz = reply.argumentAt<0>();
104  o_xplaneData->com1StandbyKhz = reply.argumentAt<1>();
105  o_xplaneData->com1Volume = reply.argumentAt<2>();
106  o_xplaneData->isCom1Receiving = reply.argumentAt<3>();
107  o_xplaneData->isCom1Transmitting = reply.argumentAt<4>();
108  }
109  watcher->deleteLater();
110  };
111  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftCom1Data"), callback);
112  }
113 
115  {
116  if (!o_xplaneData) { return; }
117  QPointer<CXSwiftBusServiceProxy> myself(this);
118  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
119  if (!myself) { return; }
120  QDBusPendingReply<int, int, double, bool, bool> reply = *watcher;
121  if (!reply.isError())
122  {
123  o_xplaneData->com2ActiveKhz = reply.argumentAt<0>();
124  o_xplaneData->com2StandbyKhz = reply.argumentAt<1>();
125  o_xplaneData->com2Volume = reply.argumentAt<2>();
126  o_xplaneData->isCom2Receiving = reply.argumentAt<3>();
127  o_xplaneData->isCom2Transmitting = reply.argumentAt<4>();
128  }
129  watcher->deleteLater();
130  };
131  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftCom2Data"), callback);
132  }
133 
135  {
136  if (!o_xplaneData) { return; }
137  QPointer<CXSwiftBusServiceProxy> myself(this);
138  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
139  if (!myself) { return; }
140  QDBusPendingReply<int, int, bool> reply = *watcher;
141  if (!reply.isError())
142  {
143  o_xplaneData->xpdrCode = reply.argumentAt<0>();
144  o_xplaneData->xpdrMode = reply.argumentAt<1>();
145  o_xplaneData->xpdrIdent = reply.argumentAt<2>();
146  }
147  watcher->deleteLater();
148  };
149  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftXpdr"), callback);
150  }
151 
153  {
154  if (!o_xplaneData) { return; }
155  QPointer<CXSwiftBusServiceProxy> myself(this);
156  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
157  if (!myself) { return; }
158  QDBusPendingReply<bool, bool, bool, bool, bool> reply = *watcher;
159  if (!reply.isError())
160  {
161  o_xplaneData->beaconLightsOn = reply.argumentAt<0>();
162  o_xplaneData->landingLightsOn = reply.argumentAt<1>();
163  o_xplaneData->navLightsOn = reply.argumentAt<2>();
164  o_xplaneData->strobeLightsOn = reply.argumentAt<3>();
165  o_xplaneData->taxiLightsOn = reply.argumentAt<4>();
166  }
167  watcher->deleteLater();
168  };
169  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftLights"), callback);
170  }
171 
173  {
174  if (!o_xplaneData) { return; }
175  QPointer<CXSwiftBusServiceProxy> myself(this);
176  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
177  if (!myself) { return; }
178  QDBusPendingReply<double, double, double, QList<double>> reply = *watcher;
179  if (!reply.isError())
180  {
181  o_xplaneData->flapsDeployRatio = reply.argumentAt<0>();
182  o_xplaneData->gearDeployRatio = reply.argumentAt<1>();
183  o_xplaneData->speedBrakeRatio = reply.argumentAt<2>();
184  o_xplaneData->enginesN1Percentage = reply.argumentAt<3>();
185  }
186  watcher->deleteLater();
187  };
188  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftParts"), callback);
189  }
190 
192  {
193  if (!o_xplaneData) { return; }
194  QPointer<CXSwiftBusServiceProxy> myself(this);
195  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
196  if (!myself) { return; }
197  QDBusPendingReply<QString, QString> reply = *watcher;
198  if (!reply.isError())
199  {
200  o_xplaneData->aircraftModelPath = reply.argumentAt<0>(); // this is NOT the model string
201  o_xplaneData->aircraftIcaoCode = reply.argumentAt<1>();
202  }
203  watcher->deleteLater();
204  };
205  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftModelData"), callback);
206  }
207 
208  void CXSwiftBusServiceProxy::addTextMessage(const QString &text, double red, double green, double blue)
209  {
210  m_dbusInterface->callDBus(QLatin1String("addTextMessage"), text, red, green, blue);
211  }
212 
214  {
215  m_dbusInterface->callDBus(QLatin1String("updateAirportsInRange"));
216  }
217 
219  {
220  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelPath"));
221  }
223  {
224  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelPath"), setterCallback(o_modelPath));
225  }
226 
228  {
229  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelFilename"));
230  }
232  {
233  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelFilename"), setterCallback(o_modelFilename));
234  }
235 
237  {
238  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftLivery"));
239  }
241  {
242  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftLivery"), setterCallback(o_modelLivery));
243  }
244 
246  {
247  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftIcaoCode"));
248  }
250  {
251  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftIcaoCode"), setterCallback(o_icaoCode));
252  }
253 
255  {
256  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftDescription"));
257  }
259  {
260  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftDescription"), setterCallback(o_description));
261  }
262 
264  {
265  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelString"));
266  }
268  {
269  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelString"), setterCallback(o_modelString));
270  }
271 
273  {
274  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftName"));
275  }
277  {
278  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftName"), setterCallback(o_name));
279  }
280 
282  {
283  return m_dbusInterface->callDBusRet<int>(QLatin1String("getXPlaneVersionMajor"));
284  }
286  {
287  m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneVersionMajor"), setterCallback(o_versionMajor));
288  }
289 
291  {
292  return m_dbusInterface->callDBusRet<int>(QLatin1String("getXPlaneVersionMinor"));
293  }
295  {
296  m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneVersionMinor"), setterCallback(o_versionMinor));
297  }
298 
300  {
301  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getXPlaneInstallationPath"));
302  }
304  {
305  m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneInstallationPath"), setterCallback(o_installPath));
306  }
307 
309  {
310  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getXPlanePreferencesPath"));
311  }
313  {
314  m_dbusInterface->callDBusAsync(QLatin1String("getXPlanePreferencesPath"), setterCallback(o_prefsPath));
315  }
316 
318  {
319  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isPaused"));
320  }
322  {
323  m_dbusInterface->callDBusAsync(QLatin1String("isPaused"), setterCallback(o_paused));
324  }
325 
327  {
328  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isUsingRealTime"));
329  }
331  {
332  m_dbusInterface->callDBusAsync(QLatin1String("isUsingRealTime"), setterCallback(o_isRealTime));
333  }
334 
335  void CXSwiftBusServiceProxy::getFrameStats(double *o_averageFps, double *o_simTimeRatio, double *o_trackMilesShort,
336  double *o_minutesLate) const
337  {
338  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
339  QDBusPendingReply<double, double, double, double> reply = *watcher;
340  if (!reply.isError())
341  {
342  *o_averageFps = reply.argumentAt<0>();
343  *o_simTimeRatio = reply.argumentAt<1>();
344  *o_trackMilesShort = reply.argumentAt<2>();
345  *o_minutesLate = reply.argumentAt<3>();
346  }
347  watcher->deleteLater();
348  };
349  m_dbusInterface->callDBusAsync(QLatin1String("getFrameStats"), callback)->waitForFinished();
350  }
351 
352  void CXSwiftBusServiceProxy::getFrameStatsAsync(double *o_averageFps, double *o_simTimeRatio,
353  double *o_trackMilesShort, double *o_minutesLate)
354  {
355  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
356  QDBusPendingReply<double, double, double, double> reply = *watcher;
357  if (!reply.isError())
358  {
359  *o_averageFps = reply.argumentAt<0>();
360  *o_simTimeRatio = reply.argumentAt<1>();
361  *o_trackMilesShort = reply.argumentAt<2>();
362  *o_minutesLate = reply.argumentAt<3>();
363  }
364  watcher->deleteLater();
365  };
366  m_dbusInterface->callDBusAsync(QLatin1String("getFrameStats"), callback);
367  }
368 
369  void CXSwiftBusServiceProxy::resetFrameTotals() { m_dbusInterface->callDBus(QLatin1String("resetFrameTotals")); }
370 
372  {
373  return m_dbusInterface->callDBusRet<double>(QLatin1String("getLatitudeDeg"));
374  }
376  {
377  m_dbusInterface->callDBusAsync(QLatin1String("getLatitudeDeg"), setterCallback(o_latitude));
378  }
379 
381  {
382  return m_dbusInterface->callDBusRet<double>(QLatin1String("getLongitudeDeg"));
383  }
385  {
386  m_dbusInterface->callDBusAsync(QLatin1String("getLongitudeDeg"), setterCallback(o_longitude));
387  }
388 
390  {
391  return m_dbusInterface->callDBusRet<double>(QLatin1String("getAltitudeMslM"));
392  }
394  {
395  m_dbusInterface->callDBusAsync(QLatin1String("getAltitudeMslM"), setterCallback(o_altitude));
396  }
397 
399  {
400  return m_dbusInterface->callDBusRet<double>(QLatin1String("getPressureAltitudeFt"));
401  }
403  {
404  m_dbusInterface->callDBusAsync(QLatin1String("getPressureAltitudeFt"), setterCallback(o_altitude));
405  }
406 
408  {
409  return m_dbusInterface->callDBusRet<double>(QLatin1String("getHeightAglM"));
410  }
412  {
413  m_dbusInterface->callDBusAsync(QLatin1String("getHeightAglM"), setterCallback(o_height));
414  }
415 
417  {
418  return m_dbusInterface->callDBusRet<double>(QLatin1String("getGroundSpeedMps"));
419  }
421  {
422  m_dbusInterface->callDBusAsync(QLatin1String("getGroundSpeedMps"), setterCallback(o_groundspeed));
423  }
424 
426  {
427  return m_dbusInterface->callDBusRet<double>(QLatin1String("getIndicatedAirspeedKias"));
428  }
430  {
431  m_dbusInterface->callDBusAsync(QLatin1String("getIndicatedAirspeedKias"), setterCallback(o_ias));
432  }
433 
435  {
436  return m_dbusInterface->callDBusRet<double>(QLatin1String("getTrueAirspeedKias"));
437  }
439  {
440  m_dbusInterface->callDBusAsync(QLatin1String("getTrueAirspeedKias"), setterCallback(o_tas));
441  }
442 
444  {
445  return m_dbusInterface->callDBusRet<double>(QLatin1String("getPitchDeg"));
446  }
448  {
449  m_dbusInterface->callDBusAsync(QLatin1String("getPitchDeg"), setterCallback(o_pitch));
450  }
451 
453  {
454  return m_dbusInterface->callDBusRet<double>(QLatin1String("getRollDeg"));
455  }
457  {
458  m_dbusInterface->callDBusAsync(QLatin1String("getRollDeg"), setterCallback(o_roll));
459  }
460 
462  {
463  return m_dbusInterface->callDBusRet<double>(QLatin1String("getTrueHeadingDeg"));
464  }
466  {
467  m_dbusInterface->callDBusAsync(QLatin1String("getTrueHeadingDeg"), setterCallback(o_heading));
468  }
469 
471  {
472  return m_dbusInterface->callDBusRet<double>(QLatin1String("getLocalXVelocityMps"));
473  }
475  {
476  m_dbusInterface->callDBusAsync(QLatin1String("getLocalXVelocityMps"), setterCallback(o_velocity));
477  }
478 
480  {
481  return m_dbusInterface->callDBusRet<double>(QLatin1String("getLocalYVelocityMps"));
482  }
484  {
485  m_dbusInterface->callDBusAsync(QLatin1String("getLocalYVelocityMps"), setterCallback(o_velocity));
486  }
487 
489  {
490  return m_dbusInterface->callDBusRet<double>(QLatin1String("getLocalZVelocityMps"));
491  }
493  {
494  m_dbusInterface->callDBusAsync(QLatin1String("getLocalZVelocityMps"), setterCallback(o_velocity));
495  }
496 
498  {
499  return m_dbusInterface->callDBusRet<double>(QLatin1String("getPitchRadPerSec"));
500  }
502  {
503  m_dbusInterface->callDBusAsync(QLatin1String("getPitchRadPerSec"), setterCallback(o_radPerSec));
504  }
505 
507  {
508  return m_dbusInterface->callDBusRet<double>(QLatin1String("getRollRadPerSec"));
509  }
511  {
512  m_dbusInterface->callDBusAsync(QLatin1String("getRollRadPerSec"), setterCallback(o_radPerSec));
513  }
514 
516  {
517  return m_dbusInterface->callDBusRet<double>(QLatin1String("getHeadingRadPerSec"));
518  }
520  {
521  m_dbusInterface->callDBusAsync(QLatin1String("getHeadingRadPerSec"), setterCallback(o_radPerSec));
522  }
523 
525  {
526  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getAnyWheelOnGround"));
527  }
529  {
530  m_dbusInterface->callDBusAsync(QLatin1String("getAnyWheelOnGround"), setterCallback(o_anyWheel));
531  }
532 
534  {
535  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getAllWheelsOnGround"));
536  }
538  {
539  m_dbusInterface->callDBusAsync(QLatin1String("getAllWheelsOnGround"), setterCallback(o_allWheels));
540  }
541 
543  {
544  return m_dbusInterface->callDBusRet<double>(QLatin1String("getGroundElevation"));
545  }
546 
548  {
549  m_dbusInterface->callDBusAsync(QLatin1String("getGroundElevation"), setterCallback(o_elevationM));
550  }
551 
553  {
554  return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom1ActiveKhz"));
555  }
557  {
558  m_dbusInterface->callDBusAsync(QLatin1String("getCom1ActiveKhz"), setterCallback(o_com1Active));
559  }
560 
562  {
563  return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom1StandbyKhz"));
564  }
565 
567  {
568  m_dbusInterface->callDBusAsync(QLatin1String("getCom1StandbyKhz"), setterCallback(o_com1Standby));
569  }
570 
572  {
573  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom1Receiving"));
574  }
575 
577  {
578  m_dbusInterface->callDBusAsync(QLatin1String("isCom1Receiving"), setterCallback(o_com1Rec));
579  }
580 
582  {
583  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom1Transmitting"));
584  }
585 
587  {
588  m_dbusInterface->callDBusAsync(QLatin1String("isCom1Transmitting"), setterCallback(o_com1Tx));
589  }
590 
592  {
593  return m_dbusInterface->callDBusRet<double>(QLatin1String("getCom1Volume"));
594  }
595 
597  {
598  m_dbusInterface->callDBusAsync(QLatin1String("getCom1Volume"), setterCallback(o_com1Volume));
599  }
600 
602  {
603  return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom2ActiveKhz"));
604  }
606  {
607  m_dbusInterface->callDBusAsync(QLatin1String("getCom2ActiveKhz"), setterCallback(o_com2Active));
608  }
609 
611  {
612  return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom2StandbyKhz"));
613  }
615  {
616  m_dbusInterface->callDBusAsync(QLatin1String("getCom2StandbyKhz"), setterCallback(o_com2Standby));
617  }
618 
620  {
621  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom2Receiving"));
622  }
623 
625  {
626  m_dbusInterface->callDBusAsync(QLatin1String("isCom2Receiving"), setterCallback(o_com2Rec));
627  }
628 
630  {
631  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom2Transmitting"));
632  }
633 
635  {
636  m_dbusInterface->callDBusAsync(QLatin1String("isCom2Transmitting"), setterCallback(o_com2Tx));
637  }
638 
640  {
641  return m_dbusInterface->callDBusRet<double>(QLatin1String("getCom2Volume"));
642  }
643 
645  {
646  m_dbusInterface->callDBusAsync(QLatin1String("getCom2Volume"), setterCallback(o_com2Volume));
647  }
648 
650  {
651  return m_dbusInterface->callDBusRet<int>(QLatin1String("getTransponderCode"));
652  }
654  {
655  m_dbusInterface->callDBusAsync(QLatin1String("getTransponderCode"), setterCallback(o_xpdrCode));
656  }
657 
659  {
660  return m_dbusInterface->callDBusRet<int>(QLatin1String("getTransponderMode"));
661  }
663  {
664  m_dbusInterface->callDBusAsync(QLatin1String("getTransponderMode"), setterCallback(o_xpdrMode));
665  }
666 
668  {
669  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getTransponderIdent"));
670  }
672  {
673  m_dbusInterface->callDBusAsync(QLatin1String("getTransponderIdent"), setterCallback(o_ident));
674  }
675 
677  {
678  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getBeaconLightsOn"));
679  }
680 
682  {
683  m_dbusInterface->callDBusAsync(QLatin1String("getBeaconLightsOn"), setterCallback(o_beaconLightsOn));
684  }
685 
687  {
688  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getLandingLightsOn"));
689  }
690 
692  {
693  m_dbusInterface->callDBusAsync(QLatin1String("getLandingLightsOn"), setterCallback(o_landingLightsOn));
694  }
695 
697  {
698  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getNavLightsOn"));
699  }
700 
702  {
703  m_dbusInterface->callDBusAsync(QLatin1String("getNavLightsOn"), setterCallback(o_navLightsOn));
704  }
705 
707 
708  {
709  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getStrobeLightsOn"));
710  }
711 
713  {
714  m_dbusInterface->callDBusAsync(QLatin1String("getStrobeLightsOn"), setterCallback(o_strobeLightsOn));
715  }
716 
718  {
719  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getTaxiLightsOn"));
720  }
721 
723  {
724  m_dbusInterface->callDBusAsync(QLatin1String("getTaxiLightsOn"), setterCallback(o_taxiLightsOn));
725  }
726 
728  {
729  return m_dbusInterface->callDBusRet<double>(QLatin1String("getQNHInHg"));
730  }
731 
733  {
734  m_dbusInterface->callDBusAsync(QLatin1String("getQNHInHg"), setterCallback(o_qnh));
735  }
736 
738  {
739  m_dbusInterface->callDBus(QLatin1String("setCom1ActiveKhz"), freq);
740  }
741 
743  {
744  m_dbusInterface->callDBus(QLatin1String("setCom1StandbyKhz"), freq);
745  }
746 
748  {
749  m_dbusInterface->callDBus(QLatin1String("setCom2ActiveKhz"), freq);
750  }
751 
753  {
754  m_dbusInterface->callDBus(QLatin1String("setCom2StandbyKhz"), freq);
755  }
756 
758  {
759  m_dbusInterface->callDBus(QLatin1String("setTransponderCode"), code);
760  }
761 
763  {
764  m_dbusInterface->callDBus(QLatin1String("setTransponderMode"), mode);
765  }
767  {
768  return m_dbusInterface->callDBusRet<double>(QLatin1String("getFlapsDeployRatio"));
769  }
770 
771  void CXSwiftBusServiceProxy::getFlapsDeployRatioAsync(double *o_flapsDeployRatio)
772  {
773  m_dbusInterface->callDBusAsync(QLatin1String("getFlapsDeployRatio"), setterCallback(o_flapsDeployRatio));
774  }
775 
777  {
778  return m_dbusInterface->callDBusRet<double>(QLatin1String("getGearDeployRatio"));
779  }
780 
781  void CXSwiftBusServiceProxy::getGearDeployRatioAsync(double *o_gearDeployRatio)
782  {
783  m_dbusInterface->callDBusAsync(QLatin1String("getGearDeployRatio"), setterCallback(o_gearDeployRatio));
784  }
785 
787  {
788  return m_dbusInterface->callDBusRet<int>(QLatin1String("getNumberOfEngines"));
789  }
790 
791  void CXSwiftBusServiceProxy::getNumberOfEnginesAsync(double *o_numberOfEngines)
792  {
793  m_dbusInterface->callDBusAsync(QLatin1String("getNumberOfEngines"), setterCallback(o_numberOfEngines));
794  }
795 
797  {
798  return m_dbusInterface->callDBusRet<QList<double>>(QLatin1String("getEngineN1Percentage"));
799  }
800 
801  void CXSwiftBusServiceProxy::getEngineN1PercentageAsync(QList<double> *o_engineN1Percentage)
802  {
803  m_dbusInterface->callDBusAsync(QLatin1String("getEngineN1Percentage"), setterCallback(o_engineN1Percentage));
804  }
805 
807  {
808  return m_dbusInterface->callDBusRet<double>(QLatin1String("getSpeedBrakeRatio"));
809  }
810 
811  void CXSwiftBusServiceProxy::getSpeedBrakeRatioAsync(double *o_speedBrakeRatio)
812  {
813  m_dbusInterface->callDBusAsync(QLatin1String("getSpeedBrakeRatio"), setterCallback(o_speedBrakeRatio));
814  }
815 
817  {
818  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getSettingsJson"));
819  }
820 
821  void CXSwiftBusServiceProxy::getSettingsJsonAsync(QString *o_jsonSettings)
822  {
823  m_dbusInterface->callDBusAsync(QLatin1String("getSettingsJson"), setterCallback(o_jsonSettings));
824  }
825 
826  void CXSwiftBusServiceProxy::setSettingsJson(const QString &json)
827  {
828  m_dbusInterface->callDBus(QLatin1String("setSettingsJson"), json);
829  }
830 } // namespace swift::simplugin::xplane
Used for hand written interface based on virtual methods.
void callDBus(QLatin1String method, Args &&...args)
Call DBus, no return value.
Ret callDBusRet(QLatin1String method, Args &&...args)
Call DBus with synchronous return value.
QDBusPendingCallWatcher * callDBusAsync(QLatin1String method, Func callback, Args &&...args)
Call DBus with asynchronous return value Callback can be any callable object taking a single argument...
double getLocalXVelocityMps() const
Get aircraft local velocity in world coordinates meters per second.
QString getCommitHash()
Get SHA1 of the last commit that could influence xswiftbus.
static const QString & InterfaceName()
Service name.
bool getBeaconLightsOn() const
Get whether landing lights are on.
void isUsingRealTimeAsync(bool *o_isRealTime)
True if sim time is tracking operating system time.
void getOwnAircraftModelDataAsync(swift::simplugin::xplane::XPlaneData *o_xplaneData)
Get own model data.
void getOwnAircraftCom2DataAsync(swift::simplugin::xplane::XPlaneData *o_xplaneData)
Get own aircraft COM2 data.
void setTransponderMode(int mode)
Set the current transponder mode (depends on the aircraft, 0 and 1 usually mean standby,...
void getAircraftLiveryAsync(QString *o_modelLivery)
Get current aircraft livery.
double getLocalYVelocityMps() const
Get aircraft local velocity in world coordinates meters per second.
void getTransponderModeAsync(int *o_xpdrMode)
Get the current transponder mode (depends on the aircraft, 0 and 1 usually mean standby,...
void getAltitudeMslMAsync(double *o_altitude)
Get aircraft altitude in meters.
void getEngineN1PercentageAsync(QList< double > *o_engineN1Percentage)
Get the N1 speed as percent of max (per engine)
int getNumberOfEngines() const
Get the number of engines of current aircraft.
double getLatitudeDeg() const
Get aircraft latitude in degrees.
QString getAircraftModelFilename() const
Get base filename of current aircraft model.
QString getXPlaneInstallationPath() const
Get root of X-Plane install path.
void getAircraftIcaoCodeAsync(QString *o_icaoCode)
Get the ICAO code of the current aircraft model.
bool getTaxiLightsOn() const
Get whether taxi lights are on.
void getAircraftModelPathAsync(QString *o_modelPath)
Get full path to current aircraft model.
void getAircraftModelFilenameAsync(QString *o_modelFilename)
Get base filename of current aircraft model.
void getPitchDegAsync(double *o_pitch)
Get aircraft pitch in degrees above horizon.
int getXPlaneVersionMajor() const
Get major version number.
void setCom2ActiveKhz(int freq)
Set the current COM2 active frequency in kHz.
QString getXPlanePreferencesPath() const
Get full path to X-Plane preferences file.
double getRollDeg() const
Get aircraft roll in degrees.
void getPitchRadPerSecAsync(double *o_radPerSec)
Get aircraft angular velocity in radians per second.
void getAllWheelsOnGroundAsync(bool *o_allWheels)
Get whether all wheels are on the ground.
double getCom2Volume() const
Get the COM2 volume 0..1.
static const QString & ObjectPath()
Service path.
double getGearDeployRatio() const
Get gear deploy ratio, where 0 is up and 1 is down.
QString getAircraftLivery() const
Get current aircraft livery.
void getBeaconLightsOnAsync(bool *o_beaconLightsOn)
Get whether landing lights are on.
void getLocalZVelocityMpsAsync(double *o_velocity)
Get aircraft local velocity in world coordinates meters per second.
double getLongitudeDeg() const
Get aircraft longitude in degrees.
void setTransponderCode(int code)
Set the current transponder code in decimal.
void getSpeedBrakeRatioAsync(double *o_speedBrakeRatio)
Get the ratio how much the speedbrakes surfaces are extended (0.0 is fully retracted,...
bool getLandingLightsOn() const
Get whether landing lights are on.
void getIndicatedAirspeedKiasAsync(double *o_ias)
Get aircraft IAS in knots.
void getTaxiLightsOnAsync(bool *o_taxiLightsOn)
Get whether taxi lights are on.
void addTextMessage(const QString &text, double red, double green, double blue)
Add a text message to the on-screen display, with RGB components in the range [0,1].
void getGroundElevationAsync(double *o_elevationM)
Get elevation of ground under the plane (in meters)
void getRollRadPerSecAsync(double *o_radPerSec)
Get aircraft angular velocity in radians per second.
void setCom1StandbyKhz(int freq)
Set the current COM1 standby frequency in kHz.
void isCom1ReceivingAsync(bool *o_com1Rec)
Is COM1 receiving?
double getTrueAirspeedKias() const
Get aircraft TAS in meters per second.
void getOwnAircraftLightsAsync(swift::simplugin::xplane::XPlaneData *o_xplaneData)
Get own lights data.
void getCom1StandbyKhzAsync(int *o_com1Standby)
Get the current COM1 standby frequency in kHz.
void getOwnAircraftVelocityDataAsync(swift::simplugin::xplane::XPlaneData *o_xplaneData)
Get own aircraft velocity data.
void getAnyWheelOnGroundAsync(bool *o_anyWheel)
Get whether any wheel is on the ground.
void setCom1ActiveKhz(int freq)
Set the current COM1 active frequency in kHz.
void getOwnAircraftXpdrAsync(swift::simplugin::xplane::XPlaneData *o_xplaneData)
Get own XPDR data.
void getLandingLightsOnAsync(bool *o_landingLightsOn)
Get whether landing lights are on.
int getCom1StandbyKhz() const
Get the current COM1 standby frequency in kHz.
QString getAircraftDescription() const
Get the description of the current aircraft model.
void getXPlaneVersionMinorAsync(int *o_versionMinor)
Get minor version number.
void getStrobeLightsOnAsync(bool *o_strobeLightsOn)
Get whether strobe lights are on.
QString getAircraftName() const
Get name of current aircraft model.
bool getTransponderIdent() const
Get whether we are currently squawking ident.
void isPausedAsync(bool *o_paused)
True if sim is paused.
double getPitchDeg() const
Get aircraft pitch in degrees above horizon.
void isCom2TransmittingAsync(bool *o_com2Tx)
Is COM2 transmitting?
void getGroundSpeedMpsAsync(double *o_groundspeed)
Get aircraft groundspeed in meters per second.
double getCom1Volume() const
Get the COM1 volume 0..1.
int getTransponderMode() const
Get the current transponder mode (depends on the aircraft, 0 and 1 usually mean standby,...
void getTrueAirspeedKiasAsync(double *o_tas)
Get aircraft TAS in meters per second.
void getCom2VolumeAsync(double *o_com2Volume)
Get the COM2 volume 0..1.
bool isUsingRealTime() const
True if sim time is tracking operating system time.
int getCom2ActiveKhz() const
Get the current COM2 active frequency in kHz.
int getCom2StandbyKhz() const
Get the current COM2 standby frequency in kHz.
void isCom2ReceivingAsync(bool *o_com2Rec)
Is COM2 receiving?
void setSettingsJson(const QString &json)
Set settings.
void getCom2StandbyKhzAsync(int *o_com2Standby)
Get the current COM2 standby frequency in kHz.
QString getAircraftModelString() const
Get canonical swift model string of current aircraft model.
bool getStrobeLightsOn() const
Get whether strobe lights are on.
QString getAircraftIcaoCode() const
Get the ICAO code of the current aircraft model.
void getFlapsDeployRatioAsync(double *o_flapsDeployRatio)
Get flaps deploy ratio, where 0.0 is flaps fully retracted, and 1.0 is flaps fully extended.
void getGearDeployRatioAsync(double *o_gearDeployRatio)
Get gear deploy ratio, where 0 is up and 1 is down.
QString getAircraftModelPath() const
Get full path to current aircraft model.
QList< double > getEngineN1Percentage() const
Get the N1 speed as percent of max (per engine)
double getIndicatedAirspeedKias() const
Get aircraft IAS in knots.
void getXPlaneVersionMajorAsync(int *o_versionMajor)
Get major version number.
bool getNavLightsOn() const
Get whether nav lights are on.
void getLocalXVelocityMpsAsync(double *o_velocity)
Get aircraft local velocity in world coordinates meters per second.
double getRollRadPerSec() const
Get aircraft angular velocity in radians per second.
double getGroundElevation() const
Get elevation of ground under the plane (in meters)
double getFlapsDeployRatio() const
Get flaps deploy ratio, where 0.0 is flaps fully retracted, and 1.0 is flaps fully extended.
void getPressureAltitudeFtAsync(double *o_altitude)
Get aircraft pressure altitude in feet in standard atmosphere in X-Plane 12. NaN in earlier versions ...
void getTransponderCodeAsync(int *o_xpdrCode)
Get the current transponder code in decimal.
int getCom1ActiveKhz() const
Get the current COM1 active frequency in kHz.
int getTransponderCode() const
Get the current transponder code in decimal.
CXSwiftBusServiceProxy(QDBusConnection &connection, QObject *parent=nullptr, bool dummy=false)
Constructor.
void getAircraftModelStringAsync(QString *o_modelString)
Get canonical swift model string of current aircraft model.
void getFrameStats(double *o_averageFps, double *o_simTimeRatio, double *o_trackMilesShort, double *o_minutesLate) const
Frames-per-second, averaged over the last 500 frames, or since this function was last called,...
void getRollDegAsync(double *o_roll)
Get aircraft roll in degrees.
bool getAnyWheelOnGround() const
Get whether any wheel is on the ground.
void getOwnAircraftPartsAsync(swift::simplugin::xplane::XPlaneData *o_xplaneData)
Get own parts such as gear, flaps.
void getSettingsJsonAsync(QString *o_jsonSettings)
Get settings.
double getPressureAltitudeFt() const
Get aircraft pressure altitude in feet in standard atmosphere in X-Plane 12. NaN in earlier versions ...
void getCom2ActiveKhzAsync(int *o_com2Active)
Get the current COM2 active frequency in kHz.
void isCom1TransmittingAsync(bool *o_com1Tx)
Is COM1 transmitting?
double getTrueHeadingDeg() const
Get aircraft true heading in degrees.
void getNavLightsOnAsync(bool *o_navLightsOn)
Get whether nav lights are on.
void getHeightAglMAsync(double *o_height)
Get aircraft height in meters.
void aircraftModelChanged(const QString &path, const QString &filename, const QString &livery, const QString &icao, const QString &modelString, const QString &name, const QString &description)
Own aircraft model changed.
void getQNHInHgAsync(double *o_qnh)
Get barometric pressure at sea level in inches of mercury.
void getAircraftNameAsync(QString *o_name)
Get name of current aircraft model.
double getLocalZVelocityMps() const
Get aircraft local velocity in world coordinates meters per second.
void getLatitudeDegAsync(double *o_latitude)
Get aircraft latitude in degrees.
void getAircraftDescriptionAsync(QString *o_description)
Get the description of the current aircraft model.
void getCom1VolumeAsync(double *o_com1Volume)
Get the COM1 volume 0..1.
double getQNHInHg() const
Get barometric pressure at sea level in inches of mercury.
void getOwnAircraftSituationDataAsync(swift::simplugin::xplane::XPlaneData *o_xplaneData)
Get own aircraft situation data.
void getNumberOfEnginesAsync(double *o_numberOfEngines)
Get the number of engines of current aircraft.
double getGroundSpeedMps() const
Get aircraft groundspeed in meters per second.
void setCom2StandbyKhz(int freq)
Set the current COM2 standby frequency in kHz.
void getXPlaneInstallationPathAsync(QString *o_installPath)
Get root of X-Plane install path.
void resetFrameTotals()
Reset the monitoring of total miles and minutes lost due to low frame rate.
double getSpeedBrakeRatio() const
Get the ratio how much the speedbrakes surfaces are extended (0.0 is fully retracted,...
double getHeightAglM() const
Get aircraft height in meters.
void getLongitudeDegAsync(double *o_longitude)
Get aircraft longitude in degrees.
void getCom1ActiveKhzAsync(int *o_com1Active)
Get the current COM1 active frequency in kHz.
double getAltitudeMslM() const
Get aircraft altitude in meters.
int getXPlaneVersionMinor() const
Get minor version number.
bool getAllWheelsOnGround() const
Get whether all wheels are on the ground.
double getPitchRadPerSec() const
Get aircraft angular velocity in radians per second.
QString getVersionNumber()
Get xswiftbus version number.
void getOwnAircraftCom1DataAsync(swift::simplugin::xplane::XPlaneData *o_xplaneData)
Get own aircraft COM1 data.
void getLocalYVelocityMpsAsync(double *o_velocity)
Get aircraft local velocity in world coordinates meters per second.
double getHeadingRadPerSec() const
Get aircraft angular velocity in radians per second.
void getXPlanePreferencesPathAsync(QString *o_prefsPath)
Get full path to X-Plane preferences file.
void getHeadingRadPerSecAsync(double *o_radPerSec)
Get aircraft angular velocity in radians per second.
void getTrueHeadingDegAsync(double *o_heading)
Get aircraft true heading in degrees.
void getFrameStatsAsync(double *o_averageFps, double *o_simTimeRatio, double *o_trackMilesShort, double *o_minutesLate)
Frames-per-second, averaged over the last 500 frames, or since this function was last called,...
void getTransponderIdentAsync(bool *o_ident)
Get whether we are currently squawking ident.
int com2StandbyKhz
COM2 standby [kHz].
double headingRadPerSec
Heading angular velocity [rad/s].
double groundspeedMs
Ground speed [m/s].
double com2Volume
COM2 volume 0..1.
double com1Volume
COM1 volume 0..1.
double localXVelocityMs
Local x velocity [m/s].
int xpdrMode
Transponder mode (off=0,stdby=1,on=2,test=3)
bool isCom1Transmitting
COM1 transmittings.
QString aircraftModelPath
Aircraft model path.
double flapsDeployRatio
Flaps deployment ratio [%].
double localZVelocityMs
Local z velocity [m/s].
bool isCom2Transmitting
COM2 transmittings.
double rollRadPerSec
Roll angular velocity [rad/s].
double gearDeployRatio
Gear deployment ratio [%].
double trueHeadingDeg
True heading [deg].
bool xpdrIdent
Is transponder in ident?
QString aircraftIcaoCode
Aircraft ICAO code.
double latitudeDeg
Longitude [deg].
double pitchRadPerSec
Pitch angular velocity [rad/s].
QList< double > enginesN1Percentage
N1 per engine [%].
double speedBrakeRatio
Speed break ratio [%].
double seaLevelPressureInHg
Sea level pressure [inhg].
int com1StandbyKhz
COM1 standby [kHz].
bool landingLightsOn
Landing lights on?
double localYVelocityMs
Local y velocity [m/s].