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(
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; }
55  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
56  if (!myself) { return; }
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; }
78  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
79  if (!myself) { return; }
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; }
98  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
99  if (!myself) { return; }
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; }
118  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
119  if (!myself) { return; }
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; }
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; }
156  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
157  if (!myself) { return; }
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; }
176  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
177  if (!myself) { return; }
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; }
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  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelPath"));
216  }
218  {
219  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelPath"), setterCallback(o_modelPath));
220  }
221 
223  {
224  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelFilename"));
225  }
227  {
228  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelFilename"), setterCallback(o_modelFilename));
229  }
230 
232  {
233  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftLivery"));
234  }
236  {
237  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftLivery"), setterCallback(o_modelLivery));
238  }
239 
241  {
242  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftIcaoCode"));
243  }
245  {
246  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftIcaoCode"), setterCallback(o_icaoCode));
247  }
248 
250  {
251  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftDescription"));
252  }
254  {
255  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftDescription"), setterCallback(o_description));
256  }
257 
259  {
260  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelString"));
261  }
263  {
264  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelString"), setterCallback(o_modelString));
265  }
266 
268  {
269  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftName"));
270  }
272  {
273  m_dbusInterface->callDBusAsync(QLatin1String("getAircraftName"), setterCallback(o_name));
274  }
275 
277  {
278  return m_dbusInterface->callDBusRet<int>(QLatin1String("getXPlaneVersionMajor"));
279  }
281  {
282  m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneVersionMajor"), setterCallback(o_versionMajor));
283  }
284 
286  {
287  return m_dbusInterface->callDBusRet<int>(QLatin1String("getXPlaneVersionMinor"));
288  }
290  {
291  m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneVersionMinor"), setterCallback(o_versionMinor));
292  }
293 
295  {
296  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getXPlaneInstallationPath"));
297  }
299  {
300  m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneInstallationPath"), setterCallback(o_installPath));
301  }
302 
304  {
305  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getXPlanePreferencesPath"));
306  }
308  {
309  m_dbusInterface->callDBusAsync(QLatin1String("getXPlanePreferencesPath"), setterCallback(o_prefsPath));
310  }
311 
313  {
314  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isPaused"));
315  }
317  {
318  m_dbusInterface->callDBusAsync(QLatin1String("isPaused"), setterCallback(o_paused));
319  }
320 
322  {
323  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isUsingRealTime"));
324  }
326  {
327  m_dbusInterface->callDBusAsync(QLatin1String("isUsingRealTime"), setterCallback(o_isRealTime));
328  }
329 
330  void CXSwiftBusServiceProxy::getFrameStats(double *o_averageFps, double *o_simTimeRatio, double *o_trackMilesShort,
331  double *o_minutesLate) const
332  {
333  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
335  if (!reply.isError())
336  {
337  *o_averageFps = reply.argumentAt<0>();
338  *o_simTimeRatio = reply.argumentAt<1>();
339  *o_trackMilesShort = reply.argumentAt<2>();
340  *o_minutesLate = reply.argumentAt<3>();
341  }
342  watcher->deleteLater();
343  };
344  m_dbusInterface->callDBusAsync(QLatin1String("getFrameStats"), callback)->waitForFinished();
345  }
346 
347  void CXSwiftBusServiceProxy::getFrameStatsAsync(double *o_averageFps, double *o_simTimeRatio,
348  double *o_trackMilesShort, double *o_minutesLate)
349  {
350  std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
352  if (!reply.isError())
353  {
354  *o_averageFps = reply.argumentAt<0>();
355  *o_simTimeRatio = reply.argumentAt<1>();
356  *o_trackMilesShort = reply.argumentAt<2>();
357  *o_minutesLate = reply.argumentAt<3>();
358  }
359  watcher->deleteLater();
360  };
361  m_dbusInterface->callDBusAsync(QLatin1String("getFrameStats"), callback);
362  }
363 
364  void CXSwiftBusServiceProxy::resetFrameTotals() { m_dbusInterface->callDBus(QLatin1String("resetFrameTotals")); }
365 
367  {
368  return m_dbusInterface->callDBusRet<double>(QLatin1String("getLatitudeDeg"));
369  }
371  {
372  m_dbusInterface->callDBusAsync(QLatin1String("getLatitudeDeg"), setterCallback(o_latitude));
373  }
374 
376  {
377  return m_dbusInterface->callDBusRet<double>(QLatin1String("getLongitudeDeg"));
378  }
380  {
381  m_dbusInterface->callDBusAsync(QLatin1String("getLongitudeDeg"), setterCallback(o_longitude));
382  }
383 
385  {
386  return m_dbusInterface->callDBusRet<double>(QLatin1String("getAltitudeMslM"));
387  }
389  {
390  m_dbusInterface->callDBusAsync(QLatin1String("getAltitudeMslM"), setterCallback(o_altitude));
391  }
392 
394  {
395  return m_dbusInterface->callDBusRet<double>(QLatin1String("getPressureAltitudeFt"));
396  }
398  {
399  m_dbusInterface->callDBusAsync(QLatin1String("getPressureAltitudeFt"), setterCallback(o_altitude));
400  }
401 
403  {
404  return m_dbusInterface->callDBusRet<double>(QLatin1String("getHeightAglM"));
405  }
407  {
408  m_dbusInterface->callDBusAsync(QLatin1String("getHeightAglM"), setterCallback(o_height));
409  }
410 
412  {
413  return m_dbusInterface->callDBusRet<double>(QLatin1String("getGroundSpeedMps"));
414  }
416  {
417  m_dbusInterface->callDBusAsync(QLatin1String("getGroundSpeedMps"), setterCallback(o_groundspeed));
418  }
419 
421  {
422  return m_dbusInterface->callDBusRet<double>(QLatin1String("getIndicatedAirspeedKias"));
423  }
425  {
426  m_dbusInterface->callDBusAsync(QLatin1String("getIndicatedAirspeedKias"), setterCallback(o_ias));
427  }
428 
430  {
431  return m_dbusInterface->callDBusRet<double>(QLatin1String("getTrueAirspeedKias"));
432  }
434  {
435  m_dbusInterface->callDBusAsync(QLatin1String("getTrueAirspeedKias"), setterCallback(o_tas));
436  }
437 
439  {
440  return m_dbusInterface->callDBusRet<double>(QLatin1String("getPitchDeg"));
441  }
443  {
444  m_dbusInterface->callDBusAsync(QLatin1String("getPitchDeg"), setterCallback(o_pitch));
445  }
446 
448  {
449  return m_dbusInterface->callDBusRet<double>(QLatin1String("getRollDeg"));
450  }
452  {
453  m_dbusInterface->callDBusAsync(QLatin1String("getRollDeg"), setterCallback(o_roll));
454  }
455 
457  {
458  return m_dbusInterface->callDBusRet<double>(QLatin1String("getTrueHeadingDeg"));
459  }
461  {
462  m_dbusInterface->callDBusAsync(QLatin1String("getTrueHeadingDeg"), setterCallback(o_heading));
463  }
464 
466  {
467  return m_dbusInterface->callDBusRet<double>(QLatin1String("getLocalXVelocityMps"));
468  }
470  {
471  m_dbusInterface->callDBusAsync(QLatin1String("getLocalXVelocityMps"), setterCallback(o_velocity));
472  }
473 
475  {
476  return m_dbusInterface->callDBusRet<double>(QLatin1String("getLocalYVelocityMps"));
477  }
479  {
480  m_dbusInterface->callDBusAsync(QLatin1String("getLocalYVelocityMps"), setterCallback(o_velocity));
481  }
482 
484  {
485  return m_dbusInterface->callDBusRet<double>(QLatin1String("getLocalZVelocityMps"));
486  }
488  {
489  m_dbusInterface->callDBusAsync(QLatin1String("getLocalZVelocityMps"), setterCallback(o_velocity));
490  }
491 
493  {
494  return m_dbusInterface->callDBusRet<double>(QLatin1String("getPitchRadPerSec"));
495  }
497  {
498  m_dbusInterface->callDBusAsync(QLatin1String("getPitchRadPerSec"), setterCallback(o_radPerSec));
499  }
500 
502  {
503  return m_dbusInterface->callDBusRet<double>(QLatin1String("getRollRadPerSec"));
504  }
506  {
507  m_dbusInterface->callDBusAsync(QLatin1String("getRollRadPerSec"), setterCallback(o_radPerSec));
508  }
509 
511  {
512  return m_dbusInterface->callDBusRet<double>(QLatin1String("getHeadingRadPerSec"));
513  }
515  {
516  m_dbusInterface->callDBusAsync(QLatin1String("getHeadingRadPerSec"), setterCallback(o_radPerSec));
517  }
518 
520  {
521  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getAnyWheelOnGround"));
522  }
524  {
525  m_dbusInterface->callDBusAsync(QLatin1String("getAnyWheelOnGround"), setterCallback(o_anyWheel));
526  }
527 
529  {
530  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getAllWheelsOnGround"));
531  }
533  {
534  m_dbusInterface->callDBusAsync(QLatin1String("getAllWheelsOnGround"), setterCallback(o_allWheels));
535  }
536 
538  {
539  return m_dbusInterface->callDBusRet<double>(QLatin1String("getGroundElevation"));
540  }
541 
543  {
544  m_dbusInterface->callDBusAsync(QLatin1String("getGroundElevation"), setterCallback(o_elevationM));
545  }
546 
548  {
549  return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom1ActiveKhz"));
550  }
552  {
553  m_dbusInterface->callDBusAsync(QLatin1String("getCom1ActiveKhz"), setterCallback(o_com1Active));
554  }
555 
557  {
558  return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom1StandbyKhz"));
559  }
560 
562  {
563  m_dbusInterface->callDBusAsync(QLatin1String("getCom1StandbyKhz"), setterCallback(o_com1Standby));
564  }
565 
567  {
568  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom1Receiving"));
569  }
570 
572  {
573  m_dbusInterface->callDBusAsync(QLatin1String("isCom1Receiving"), setterCallback(o_com1Rec));
574  }
575 
577  {
578  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom1Transmitting"));
579  }
580 
582  {
583  m_dbusInterface->callDBusAsync(QLatin1String("isCom1Transmitting"), setterCallback(o_com1Tx));
584  }
585 
587  {
588  return m_dbusInterface->callDBusRet<double>(QLatin1String("getCom1Volume"));
589  }
590 
592  {
593  m_dbusInterface->callDBusAsync(QLatin1String("getCom1Volume"), setterCallback(o_com1Volume));
594  }
595 
597  {
598  return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom2ActiveKhz"));
599  }
601  {
602  m_dbusInterface->callDBusAsync(QLatin1String("getCom2ActiveKhz"), setterCallback(o_com2Active));
603  }
604 
606  {
607  return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom2StandbyKhz"));
608  }
610  {
611  m_dbusInterface->callDBusAsync(QLatin1String("getCom2StandbyKhz"), setterCallback(o_com2Standby));
612  }
613 
615  {
616  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom2Receiving"));
617  }
618 
620  {
621  m_dbusInterface->callDBusAsync(QLatin1String("isCom2Receiving"), setterCallback(o_com2Rec));
622  }
623 
625  {
626  return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom2Transmitting"));
627  }
628 
630  {
631  m_dbusInterface->callDBusAsync(QLatin1String("isCom2Transmitting"), setterCallback(o_com2Tx));
632  }
633 
635  {
636  return m_dbusInterface->callDBusRet<double>(QLatin1String("getCom2Volume"));
637  }
638 
640  {
641  m_dbusInterface->callDBusAsync(QLatin1String("getCom2Volume"), setterCallback(o_com2Volume));
642  }
643 
645  {
646  return m_dbusInterface->callDBusRet<int>(QLatin1String("getTransponderCode"));
647  }
649  {
650  m_dbusInterface->callDBusAsync(QLatin1String("getTransponderCode"), setterCallback(o_xpdrCode));
651  }
652 
654  {
655  return m_dbusInterface->callDBusRet<int>(QLatin1String("getTransponderMode"));
656  }
658  {
659  m_dbusInterface->callDBusAsync(QLatin1String("getTransponderMode"), setterCallback(o_xpdrMode));
660  }
661 
663  {
664  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getTransponderIdent"));
665  }
667  {
668  m_dbusInterface->callDBusAsync(QLatin1String("getTransponderIdent"), setterCallback(o_ident));
669  }
670 
672  {
673  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getBeaconLightsOn"));
674  }
675 
677  {
678  m_dbusInterface->callDBusAsync(QLatin1String("getBeaconLightsOn"), setterCallback(o_beaconLightsOn));
679  }
680 
682  {
683  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getLandingLightsOn"));
684  }
685 
687  {
688  m_dbusInterface->callDBusAsync(QLatin1String("getLandingLightsOn"), setterCallback(o_landingLightsOn));
689  }
690 
692  {
693  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getNavLightsOn"));
694  }
695 
697  {
698  m_dbusInterface->callDBusAsync(QLatin1String("getNavLightsOn"), setterCallback(o_navLightsOn));
699  }
700 
702 
703  {
704  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getStrobeLightsOn"));
705  }
706 
708  {
709  m_dbusInterface->callDBusAsync(QLatin1String("getStrobeLightsOn"), setterCallback(o_strobeLightsOn));
710  }
711 
713  {
714  return m_dbusInterface->callDBusRet<bool>(QLatin1String("getTaxiLightsOn"));
715  }
716 
718  {
719  m_dbusInterface->callDBusAsync(QLatin1String("getTaxiLightsOn"), setterCallback(o_taxiLightsOn));
720  }
721 
723  {
724  return m_dbusInterface->callDBusRet<double>(QLatin1String("getQNHInHg"));
725  }
726 
728  {
729  m_dbusInterface->callDBusAsync(QLatin1String("getQNHInHg"), setterCallback(o_qnh));
730  }
731 
733  {
734  m_dbusInterface->callDBus(QLatin1String("setCom1ActiveKhz"), freq);
735  }
736 
738  {
739  m_dbusInterface->callDBus(QLatin1String("setCom1StandbyKhz"), freq);
740  }
741 
743  {
744  m_dbusInterface->callDBus(QLatin1String("setCom2ActiveKhz"), freq);
745  }
746 
748  {
749  m_dbusInterface->callDBus(QLatin1String("setCom2StandbyKhz"), freq);
750  }
751 
753  {
754  m_dbusInterface->callDBus(QLatin1String("setTransponderCode"), code);
755  }
756 
758  {
759  m_dbusInterface->callDBus(QLatin1String("setTransponderMode"), mode);
760  }
762  {
763  return m_dbusInterface->callDBusRet<double>(QLatin1String("getFlapsDeployRatio"));
764  }
765 
766  void CXSwiftBusServiceProxy::getFlapsDeployRatioAsync(double *o_flapsDeployRatio)
767  {
768  m_dbusInterface->callDBusAsync(QLatin1String("getFlapsDeployRatio"), setterCallback(o_flapsDeployRatio));
769  }
770 
772  {
773  return m_dbusInterface->callDBusRet<double>(QLatin1String("getGearDeployRatio"));
774  }
775 
776  void CXSwiftBusServiceProxy::getGearDeployRatioAsync(double *o_gearDeployRatio)
777  {
778  m_dbusInterface->callDBusAsync(QLatin1String("getGearDeployRatio"), setterCallback(o_gearDeployRatio));
779  }
780 
782  {
783  return m_dbusInterface->callDBusRet<int>(QLatin1String("getNumberOfEngines"));
784  }
785 
786  void CXSwiftBusServiceProxy::getNumberOfEnginesAsync(double *o_numberOfEngines)
787  {
788  m_dbusInterface->callDBusAsync(QLatin1String("getNumberOfEngines"), setterCallback(o_numberOfEngines));
789  }
790 
792  {
793  return m_dbusInterface->callDBusRet<QList<double>>(QLatin1String("getEngineN1Percentage"));
794  }
795 
797  {
798  m_dbusInterface->callDBusAsync(QLatin1String("getEngineN1Percentage"), setterCallback(o_engineN1Percentage));
799  }
800 
802  {
803  return m_dbusInterface->callDBusRet<double>(QLatin1String("getSpeedBrakeRatio"));
804  }
805 
806  void CXSwiftBusServiceProxy::getSpeedBrakeRatioAsync(double *o_speedBrakeRatio)
807  {
808  m_dbusInterface->callDBusAsync(QLatin1String("getSpeedBrakeRatio"), setterCallback(o_speedBrakeRatio));
809  }
810 
812  {
813  return m_dbusInterface->callDBusRet<QString>(QLatin1String("getSettingsJson"));
814  }
815 
817  {
818  m_dbusInterface->callDBusAsync(QLatin1String("getSettingsJson"), setterCallback(o_jsonSettings));
819  }
820 
822  {
823  m_dbusInterface->callDBus(QLatin1String("setSettingsJson"), json);
824  }
825 } // 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.
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].