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 {
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,
28  Q_ASSERT(s);
29 
30  s = connection.connect(QString(), "/xswiftbus/service", "org.swift_project.xswiftbus.service",
31  "sceneryLoaded", this, SIGNAL(sceneryLoaded()));
32  Q_ASSERT(s);
33  }
34  }
35 
37  {
38  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getVersionNumber"));
39  }
40 
42  {
43  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getCommitHash"));
44  }
45 
47  {
48  if (!o_xplaneData) { return; }
50  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
51  if (!myself) { return; }
53  if (!reply.isError())
54  {
55  o_xplaneData->latitudeDeg = reply.argumentAt<0>();
56  o_xplaneData->longitudeDeg = reply.argumentAt<1>();
57  o_xplaneData->altitudeM = reply.argumentAt<2>();
58  o_xplaneData->groundspeedMs = reply.argumentAt<3>();
59  o_xplaneData->pitchDeg = reply.argumentAt<4>();
60  o_xplaneData->rollDeg = reply.argumentAt<5>();
61  o_xplaneData->trueHeadingDeg = reply.argumentAt<6>();
62  o_xplaneData->seaLevelPressureInHg = reply.argumentAt<7>();
63  }
64  watcher->deleteLater();
65  };
66  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftSituationData"), callback);
67  }
68 
70  {
71  if (!o_xplaneData) { return; }
73  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
74  if (!myself) { return; }
76  if (!reply.isError())
77  {
78  o_xplaneData->localXVelocityMs = reply.argumentAt<0>();
79  o_xplaneData->localYVelocityMs = reply.argumentAt<1>();
80  o_xplaneData->localZVelocityMs = -reply.argumentAt<2>();
81  o_xplaneData->pitchRadPerSec = -reply.argumentAt<3>();
82  o_xplaneData->rollRadPerSec = -reply.argumentAt<4>();
83  o_xplaneData->headingRadPerSec = reply.argumentAt<5>();
84  }
85  };
86  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftVelocityData"), callback);
87  }
88 
90  {
91  if (!o_xplaneData) { return; }
93  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
94  if (!myself) { return; }
96  if (!reply.isError())
97  {
98  o_xplaneData->com1ActiveKhz = reply.argumentAt<0>();
99  o_xplaneData->com1StandbyKhz = reply.argumentAt<1>();
100  o_xplaneData->com1Volume = reply.argumentAt<2>();
101  o_xplaneData->isCom1Receiving = reply.argumentAt<3>();
102  o_xplaneData->isCom1Transmitting = reply.argumentAt<4>();
103  }
104  watcher->deleteLater();
105  };
106  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftCom1Data"), callback);
107  }
108 
110  {
111  if (!o_xplaneData) { return; }
113  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
114  if (!myself) { return; }
116  if (!reply.isError())
117  {
118  o_xplaneData->com2ActiveKhz = reply.argumentAt<0>();
119  o_xplaneData->com2StandbyKhz = reply.argumentAt<1>();
120  o_xplaneData->com2Volume = reply.argumentAt<2>();
121  o_xplaneData->isCom2Receiving = reply.argumentAt<3>();
122  o_xplaneData->isCom2Transmitting = reply.argumentAt<4>();
123  }
124  watcher->deleteLater();
125  };
126  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftCom2Data"), callback);
127  }
128 
130  {
131  if (!o_xplaneData) { return; }
133  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
134  if (!myself) { return; }
135  QDBusPendingReply<int, int, bool> reply = *watcher;
136  if (!reply.isError())
137  {
138  o_xplaneData->xpdrCode = reply.argumentAt<0>();
139  o_xplaneData->xpdrMode = reply.argumentAt<1>();
140  o_xplaneData->xpdrIdent = reply.argumentAt<2>();
141  }
142  watcher->deleteLater();
143  };
144  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftXpdr"), callback);
145  }
146 
148  {
149  if (!o_xplaneData) { return; }
151  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
152  if (!myself) { return; }
154  if (!reply.isError())
155  {
156  o_xplaneData->beaconLightsOn = reply.argumentAt<0>();
157  o_xplaneData->landingLightsOn = reply.argumentAt<1>();
158  o_xplaneData->navLightsOn = reply.argumentAt<2>();
159  o_xplaneData->strobeLightsOn = reply.argumentAt<3>();
160  o_xplaneData->taxiLightsOn = reply.argumentAt<4>();
161  }
162  watcher->deleteLater();
163  };
164  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftLights"), callback);
165  }
166 
168  {
169  if (!o_xplaneData) { return; }
171  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
172  if (!myself) { return; }
174  if (!reply.isError())
175  {
176  o_xplaneData->flapsDeployRatio = reply.argumentAt<0>();
177  o_xplaneData->gearDeployRatio = reply.argumentAt<1>();
178  o_xplaneData->speedBrakeRatio = reply.argumentAt<2>();
179  o_xplaneData->enginesN1Percentage = reply.argumentAt<3>();
180  }
181  watcher->deleteLater();
182  };
183  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftParts"), callback);
184  }
185 
187  {
188  if (!o_xplaneData) { return; }
190  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
191  if (!myself) { return; }
192  QDBusPendingReply<QString, QString> reply = *watcher;
193  if (!reply.isError())
194  {
195  o_xplaneData->aircraftModelPath = reply.argumentAt<0>(); // this is NOT the model string
196  o_xplaneData->aircraftIcaoCode = reply.argumentAt<1>();
197  }
198  watcher->deleteLater();
199  };
200  m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftModelData"), callback);
201  }
202 
203  void CXSwiftBusServiceProxy::addTextMessage(const QString &text, double red, double green, double blue)
204  {
205  m_dbusInterface->callDBus(QLatin1String("addTextMessage"), text, red, green, blue);
206  }
207 
209  {
210  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelPath"));
211  }
213  {
214  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelPath"), setterCallback(o_modelPath));
215  }
216 
218  {
219  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelFilename"));
220  }
222  {
223  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelFilename"), setterCallback(o_modelFilename));
224  }
225 
227  {
228  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftLivery"));
229  }
231  {
232  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftLivery"), setterCallback(o_modelLivery));
233  }
234 
236  {
237  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftIcaoCode"));
238  }
240  {
241  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftIcaoCode"), setterCallback(o_icaoCode));
242  }
243 
245  {
246  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftDescription"));
247  }
249  {
250  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftDescription"), setterCallback(o_description));
251  }
252 
254  {
255  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelString"));
256  }
258  {
259  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelString"), setterCallback(o_modelString));
260  }
261 
263  {
264  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftName"));
265  }
267  {
268  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftName"), setterCallback(o_name));
269  }
270 
272  {
273  return m_dbusInterface->callDBusRet<int>(QLatin1String("getXPlaneVersionMajor"));
274  }
276  {
277  m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneVersionMajor"), setterCallback(o_versionMajor));
278  }
279 
281  {
282  return m_dbusInterface->callDBusRet<int>(QLatin1String("getXPlaneVersionMinor"));
283  }
285  {
286  m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneVersionMinor"), setterCallback(o_versionMinor));
287  }
288 
290  {
291  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getXPlaneInstallationPath"));
292  }
294  {
295  m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneInstallationPath"), setterCallback(o_installPath));
296  }
297 
299  {
300  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getXPlanePreferencesPath"));
301  }
303  {
304  m_dbusInterface->callDBusAsync(QLatin1String("getXPlanePreferencesPath"), setterCallback(o_prefsPath));
305  }
306 
308  {
309  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isPaused"));
310  }
312  {
313  m_dbusInterface->callDBusAsync(QLatin1String("isPaused"), setterCallback(o_paused));
314  }
315 
317  {
318  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isUsingRealTime"));
319  }
321  {
322  m_dbusInterface->callDBusAsync(QLatin1String("isUsingRealTime"), setterCallback(o_isRealTime));
323  }
324 
325  void CXSwiftBusServiceProxy::getFrameStats(double *o_averageFps, double *o_simTimeRatio, double *o_trackMilesShort,
326  double *o_minutesLate) const
327  {
328  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
330  if (!reply.isError())
331  {
332  *o_averageFps = reply.argumentAt<0>();
333  *o_simTimeRatio = reply.argumentAt<1>();
334  *o_trackMilesShort = reply.argumentAt<2>();
335  *o_minutesLate = reply.argumentAt<3>();
336  }
337  watcher->deleteLater();
338  };
339  m_dbusInterface->callDBusAsync(QLatin1String("getFrameStats"), callback)->waitForFinished();
340  }
341 
342  void CXSwiftBusServiceProxy::getFrameStatsAsync(double *o_averageFps, double *o_simTimeRatio,
343  double *o_trackMilesShort, double *o_minutesLate)
344  {
345  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
347  if (!reply.isError())
348  {
349  *o_averageFps = reply.argumentAt<0>();
350  *o_simTimeRatio = reply.argumentAt<1>();
351  *o_trackMilesShort = reply.argumentAt<2>();
352  *o_minutesLate = reply.argumentAt<3>();
353  }
354  watcher->deleteLater();
355  };
356  m_dbusInterface->callDBusAsync(QLatin1String("getFrameStats"), callback);
357  }
358 
359  void CXSwiftBusServiceProxy::resetFrameTotals() { m_dbusInterface->callDBus(QLatin1String("resetFrameTotals")); }
360 
362  {
363  m_dbusInterface->callDBus(QLatin1String("setFlightNetworkConnected"), connected);
364  }
365 
367  {
368  m_dbusInterface->callDBus(QLatin1String("setOwnCallsign"), callsign);
369  }
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 
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 
822  {
823  m_dbusInterface->callDBusAsync(QLatin1String("getSettingsJson"), setterCallback(o_jsonSettings));
824  }
825 
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 setOwnCallsign(const QString &callsign)
Set the current own callsign.
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.
void setFlightNetworkConnected(bool connected)
Set the current connection state.
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.
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
QVariant argumentAt(int index) const const
bool isError() const const
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].