swift
Loading...
Searching...
No Matches
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
11class QDBusConnection;
12
13#define XSWIFTBUS_SERVICE_SERVICENAME "org.swift-project.xswiftbus"
14
15namespace swift::simplugin::xplane
16{
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)
49 {
50 return;
51 }
53 std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
54 if (!myself)
55 {
56 return;
57 }
59 if (!reply.isError())
60 {
61 o_xplaneData->latitudeDeg = reply.argumentAt<0>();
62 o_xplaneData->longitudeDeg = reply.argumentAt<1>();
63 o_xplaneData->altitudeM = reply.argumentAt<2>();
64 o_xplaneData->groundspeedMs = reply.argumentAt<3>();
65 o_xplaneData->pitchDeg = reply.argumentAt<4>();
66 o_xplaneData->rollDeg = reply.argumentAt<5>();
67 o_xplaneData->trueHeadingDeg = reply.argumentAt<6>();
68 o_xplaneData->seaLevelPressureInHg = reply.argumentAt<7>();
69 }
70 watcher->deleteLater();
71 };
72 m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftSituationData"), callback);
73 }
74
76 {
77 if (!o_xplaneData)
78 {
79 return;
80 }
82 std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
83 if (!myself)
84 {
85 return;
86 }
88 if (!reply.isError())
89 {
90 o_xplaneData->localXVelocityMs = reply.argumentAt<0>();
91 o_xplaneData->localYVelocityMs = reply.argumentAt<1>();
92 o_xplaneData->localZVelocityMs = -reply.argumentAt<2>();
93 o_xplaneData->pitchRadPerSec = -reply.argumentAt<3>();
94 o_xplaneData->rollRadPerSec = -reply.argumentAt<4>();
95 o_xplaneData->headingRadPerSec = reply.argumentAt<5>();
96 }
97 };
98 m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftVelocityData"), callback);
99 }
100
102 {
103 if (!o_xplaneData)
104 {
105 return;
106 }
108 std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
109 if (!myself)
110 {
111 return;
112 }
114 if (!reply.isError())
115 {
116 o_xplaneData->com1ActiveKhz = reply.argumentAt<0>();
117 o_xplaneData->com1StandbyKhz = reply.argumentAt<1>();
118 o_xplaneData->com1Volume = reply.argumentAt<2>();
119 o_xplaneData->isCom1Receiving = reply.argumentAt<3>();
120 o_xplaneData->isCom1Transmitting = reply.argumentAt<4>();
121 }
122 watcher->deleteLater();
123 };
124 m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftCom1Data"), callback);
125 }
126
128 {
129 if (!o_xplaneData)
130 {
131 return;
132 }
134 std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
135 if (!myself)
136 {
137 return;
138 }
140 if (!reply.isError())
141 {
142 o_xplaneData->com2ActiveKhz = reply.argumentAt<0>();
143 o_xplaneData->com2StandbyKhz = reply.argumentAt<1>();
144 o_xplaneData->com2Volume = reply.argumentAt<2>();
145 o_xplaneData->isCom2Receiving = reply.argumentAt<3>();
146 o_xplaneData->isCom2Transmitting = reply.argumentAt<4>();
147 }
148 watcher->deleteLater();
149 };
150 m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftCom2Data"), callback);
151 }
152
154 {
155 if (!o_xplaneData)
156 {
157 return;
158 }
160 std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
161 if (!myself)
162 {
163 return;
164 }
165 QDBusPendingReply<int, int, bool> reply = *watcher;
166 if (!reply.isError())
167 {
168 o_xplaneData->xpdrCode = reply.argumentAt<0>();
169 o_xplaneData->xpdrMode = reply.argumentAt<1>();
170 o_xplaneData->xpdrIdent = reply.argumentAt<2>();
171 }
172 watcher->deleteLater();
173 };
174 m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftXpdr"), callback);
175 }
176
178 {
179 if (!o_xplaneData)
180 {
181 return;
182 }
184 std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
185 if (!myself)
186 {
187 return;
188 }
190 if (!reply.isError())
191 {
192 o_xplaneData->beaconLightsOn = reply.argumentAt<0>();
193 o_xplaneData->landingLightsOn = reply.argumentAt<1>();
194 o_xplaneData->navLightsOn = reply.argumentAt<2>();
195 o_xplaneData->strobeLightsOn = reply.argumentAt<3>();
196 o_xplaneData->taxiLightsOn = reply.argumentAt<4>();
197 }
198 watcher->deleteLater();
199 };
200 m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftLights"), callback);
201 }
202
204 {
205 if (!o_xplaneData)
206 {
207 return;
208 }
210 std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
211 if (!myself)
212 {
213 return;
214 }
216 if (!reply.isError())
217 {
218 o_xplaneData->flapsDeployRatio = reply.argumentAt<0>();
219 o_xplaneData->gearDeployRatio = reply.argumentAt<1>();
220 o_xplaneData->speedBrakeRatio = reply.argumentAt<2>();
221 o_xplaneData->enginesN1Percentage = reply.argumentAt<3>();
222 }
223 watcher->deleteLater();
224 };
225 m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftParts"), callback);
226 }
227
229 {
230 if (!o_xplaneData)
231 {
232 return;
233 }
235 std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
236 if (!myself)
237 {
238 return;
239 }
241 if (!reply.isError())
242 {
243 o_xplaneData->aircraftModelPath = reply.argumentAt<0>(); // this is NOT the model string
244 o_xplaneData->aircraftIcaoCode = reply.argumentAt<1>();
245 }
246 watcher->deleteLater();
247 };
248 m_dbusInterface->callDBusAsync(QLatin1String("getOwnAircraftModelData"), callback);
249 }
250
251 void CXSwiftBusServiceProxy::addTextMessage(const QString &text, double red, double green, double blue)
252 {
253 m_dbusInterface->callDBus(QLatin1String("addTextMessage"), text, red, green, blue);
254 }
255
257 {
258 return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelPath"));
259 }
261 {
262 m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelPath"), setterCallback(o_modelPath));
263 }
264
266 {
267 return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelFilename"));
268 }
270 {
271 m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelFilename"), setterCallback(o_modelFilename));
272 }
273
275 {
276 return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftLivery"));
277 }
279 {
280 m_dbusInterface->callDBusAsync(QLatin1String("getAircraftLivery"), setterCallback(o_modelLivery));
281 }
282
284 {
285 return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftIcaoCode"));
286 }
288 {
289 m_dbusInterface->callDBusAsync(QLatin1String("getAircraftIcaoCode"), setterCallback(o_icaoCode));
290 }
291
293 {
294 return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftDescription"));
295 }
297 {
298 m_dbusInterface->callDBusAsync(QLatin1String("getAircraftDescription"), setterCallback(o_description));
299 }
300
302 {
303 return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftModelString"));
304 }
306 {
307 m_dbusInterface->callDBusAsync(QLatin1String("getAircraftModelString"), setterCallback(o_modelString));
308 }
309
311 {
312 return m_dbusInterface->callDBusRet<QString>(QLatin1String("getAircraftName"));
313 }
315 {
316 m_dbusInterface->callDBusAsync(QLatin1String("getAircraftName"), setterCallback(o_name));
317 }
318
320 {
321 return m_dbusInterface->callDBusRet<int>(QLatin1String("getXPlaneVersionMajor"));
322 }
324 {
325 m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneVersionMajor"), setterCallback(o_versionMajor));
326 }
327
329 {
330 return m_dbusInterface->callDBusRet<int>(QLatin1String("getXPlaneVersionMinor"));
331 }
333 {
334 m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneVersionMinor"), setterCallback(o_versionMinor));
335 }
336
338 {
339 return m_dbusInterface->callDBusRet<QString>(QLatin1String("getXPlaneInstallationPath"));
340 }
342 {
343 m_dbusInterface->callDBusAsync(QLatin1String("getXPlaneInstallationPath"), setterCallback(o_installPath));
344 }
345
347 {
348 return m_dbusInterface->callDBusRet<QString>(QLatin1String("getXPlanePreferencesPath"));
349 }
351 {
352 m_dbusInterface->callDBusAsync(QLatin1String("getXPlanePreferencesPath"), setterCallback(o_prefsPath));
353 }
354
356 {
357 return m_dbusInterface->callDBusRet<bool>(QLatin1String("isPaused"));
358 }
360 {
361 m_dbusInterface->callDBusAsync(QLatin1String("isPaused"), setterCallback(o_paused));
362 }
363
365 {
366 return m_dbusInterface->callDBusRet<bool>(QLatin1String("isUsingRealTime"));
367 }
369 {
370 m_dbusInterface->callDBusAsync(QLatin1String("isUsingRealTime"), setterCallback(o_isRealTime));
371 }
372
373 void CXSwiftBusServiceProxy::getFrameStats(double *o_averageFps, double *o_simTimeRatio, double *o_trackMilesShort,
374 double *o_minutesLate) const
375 {
376 std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
378 if (!reply.isError())
379 {
380 *o_averageFps = reply.argumentAt<0>();
381 *o_simTimeRatio = reply.argumentAt<1>();
382 *o_trackMilesShort = reply.argumentAt<2>();
383 *o_minutesLate = reply.argumentAt<3>();
384 }
385 watcher->deleteLater();
386 };
387 m_dbusInterface->callDBusAsync(QLatin1String("getFrameStats"), callback)->waitForFinished();
388 }
389
390 void CXSwiftBusServiceProxy::getFrameStatsAsync(double *o_averageFps, double *o_simTimeRatio,
391 double *o_trackMilesShort, double *o_minutesLate)
392 {
393 std::function<void(QDBusPendingCallWatcher *)> callback = [=](QDBusPendingCallWatcher *watcher) {
395 if (!reply.isError())
396 {
397 *o_averageFps = reply.argumentAt<0>();
398 *o_simTimeRatio = reply.argumentAt<1>();
399 *o_trackMilesShort = reply.argumentAt<2>();
400 *o_minutesLate = reply.argumentAt<3>();
401 }
402 watcher->deleteLater();
403 };
404 m_dbusInterface->callDBusAsync(QLatin1String("getFrameStats"), callback);
405 }
406
407 void CXSwiftBusServiceProxy::resetFrameTotals() { m_dbusInterface->callDBus(QLatin1String("resetFrameTotals")); }
408
410 {
411 m_dbusInterface->callDBus(QLatin1String("setFlightNetworkConnected"), connected);
412 }
413
415 {
416 m_dbusInterface->callDBus(QLatin1String("setOwnCallsign"), callsign);
417 }
418
420 {
421 return m_dbusInterface->callDBusRet<double>(QLatin1String("getLatitudeDeg"));
422 }
424 {
425 m_dbusInterface->callDBusAsync(QLatin1String("getLatitudeDeg"), setterCallback(o_latitude));
426 }
427
429 {
430 return m_dbusInterface->callDBusRet<double>(QLatin1String("getLongitudeDeg"));
431 }
433 {
434 m_dbusInterface->callDBusAsync(QLatin1String("getLongitudeDeg"), setterCallback(o_longitude));
435 }
436
438 {
439 return m_dbusInterface->callDBusRet<double>(QLatin1String("getAltitudeMslM"));
440 }
442 {
443 m_dbusInterface->callDBusAsync(QLatin1String("getAltitudeMslM"), setterCallback(o_altitude));
444 }
445
447 {
448 return m_dbusInterface->callDBusRet<double>(QLatin1String("getPressureAltitudeFt"));
449 }
451 {
452 m_dbusInterface->callDBusAsync(QLatin1String("getPressureAltitudeFt"), setterCallback(o_altitude));
453 }
454
456 {
457 return m_dbusInterface->callDBusRet<double>(QLatin1String("getHeightAglM"));
458 }
460 {
461 m_dbusInterface->callDBusAsync(QLatin1String("getHeightAglM"), setterCallback(o_height));
462 }
463
465 {
466 return m_dbusInterface->callDBusRet<double>(QLatin1String("getGroundSpeedMps"));
467 }
469 {
470 m_dbusInterface->callDBusAsync(QLatin1String("getGroundSpeedMps"), setterCallback(o_groundspeed));
471 }
472
474 {
475 return m_dbusInterface->callDBusRet<double>(QLatin1String("getIndicatedAirspeedKias"));
476 }
478 {
479 m_dbusInterface->callDBusAsync(QLatin1String("getIndicatedAirspeedKias"), setterCallback(o_ias));
480 }
481
483 {
484 return m_dbusInterface->callDBusRet<double>(QLatin1String("getTrueAirspeedKias"));
485 }
487 {
488 m_dbusInterface->callDBusAsync(QLatin1String("getTrueAirspeedKias"), setterCallback(o_tas));
489 }
490
492 {
493 return m_dbusInterface->callDBusRet<double>(QLatin1String("getPitchDeg"));
494 }
496 {
497 m_dbusInterface->callDBusAsync(QLatin1String("getPitchDeg"), setterCallback(o_pitch));
498 }
499
501 {
502 return m_dbusInterface->callDBusRet<double>(QLatin1String("getRollDeg"));
503 }
505 {
506 m_dbusInterface->callDBusAsync(QLatin1String("getRollDeg"), setterCallback(o_roll));
507 }
508
510 {
511 return m_dbusInterface->callDBusRet<double>(QLatin1String("getTrueHeadingDeg"));
512 }
514 {
515 m_dbusInterface->callDBusAsync(QLatin1String("getTrueHeadingDeg"), setterCallback(o_heading));
516 }
517
519 {
520 return m_dbusInterface->callDBusRet<double>(QLatin1String("getLocalXVelocityMps"));
521 }
523 {
524 m_dbusInterface->callDBusAsync(QLatin1String("getLocalXVelocityMps"), setterCallback(o_velocity));
525 }
526
528 {
529 return m_dbusInterface->callDBusRet<double>(QLatin1String("getLocalYVelocityMps"));
530 }
532 {
533 m_dbusInterface->callDBusAsync(QLatin1String("getLocalYVelocityMps"), setterCallback(o_velocity));
534 }
535
537 {
538 return m_dbusInterface->callDBusRet<double>(QLatin1String("getLocalZVelocityMps"));
539 }
541 {
542 m_dbusInterface->callDBusAsync(QLatin1String("getLocalZVelocityMps"), setterCallback(o_velocity));
543 }
544
546 {
547 return m_dbusInterface->callDBusRet<double>(QLatin1String("getPitchRadPerSec"));
548 }
550 {
551 m_dbusInterface->callDBusAsync(QLatin1String("getPitchRadPerSec"), setterCallback(o_radPerSec));
552 }
553
555 {
556 return m_dbusInterface->callDBusRet<double>(QLatin1String("getRollRadPerSec"));
557 }
559 {
560 m_dbusInterface->callDBusAsync(QLatin1String("getRollRadPerSec"), setterCallback(o_radPerSec));
561 }
562
564 {
565 return m_dbusInterface->callDBusRet<double>(QLatin1String("getHeadingRadPerSec"));
566 }
568 {
569 m_dbusInterface->callDBusAsync(QLatin1String("getHeadingRadPerSec"), setterCallback(o_radPerSec));
570 }
571
573 {
574 return m_dbusInterface->callDBusRet<bool>(QLatin1String("getAnyWheelOnGround"));
575 }
577 {
578 m_dbusInterface->callDBusAsync(QLatin1String("getAnyWheelOnGround"), setterCallback(o_anyWheel));
579 }
580
582 {
583 return m_dbusInterface->callDBusRet<bool>(QLatin1String("getAllWheelsOnGround"));
584 }
586 {
587 m_dbusInterface->callDBusAsync(QLatin1String("getAllWheelsOnGround"), setterCallback(o_allWheels));
588 }
589
591 {
592 return m_dbusInterface->callDBusRet<double>(QLatin1String("getGroundElevation"));
593 }
594
596 {
597 m_dbusInterface->callDBusAsync(QLatin1String("getGroundElevation"), setterCallback(o_elevationM));
598 }
599
601 {
602 return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom1ActiveKhz"));
603 }
605 {
606 m_dbusInterface->callDBusAsync(QLatin1String("getCom1ActiveKhz"), setterCallback(o_com1Active));
607 }
608
610 {
611 return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom1StandbyKhz"));
612 }
613
615 {
616 m_dbusInterface->callDBusAsync(QLatin1String("getCom1StandbyKhz"), setterCallback(o_com1Standby));
617 }
618
620 {
621 return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom1Receiving"));
622 }
623
625 {
626 m_dbusInterface->callDBusAsync(QLatin1String("isCom1Receiving"), setterCallback(o_com1Rec));
627 }
628
630 {
631 return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom1Transmitting"));
632 }
633
635 {
636 m_dbusInterface->callDBusAsync(QLatin1String("isCom1Transmitting"), setterCallback(o_com1Tx));
637 }
638
640 {
641 return m_dbusInterface->callDBusRet<double>(QLatin1String("getCom1Volume"));
642 }
643
645 {
646 m_dbusInterface->callDBusAsync(QLatin1String("getCom1Volume"), setterCallback(o_com1Volume));
647 }
648
650 {
651 return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom2ActiveKhz"));
652 }
654 {
655 m_dbusInterface->callDBusAsync(QLatin1String("getCom2ActiveKhz"), setterCallback(o_com2Active));
656 }
657
659 {
660 return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom2StandbyKhz"));
661 }
663 {
664 m_dbusInterface->callDBusAsync(QLatin1String("getCom2StandbyKhz"), setterCallback(o_com2Standby));
665 }
666
668 {
669 return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom2Receiving"));
670 }
671
673 {
674 m_dbusInterface->callDBusAsync(QLatin1String("isCom2Receiving"), setterCallback(o_com2Rec));
675 }
676
678 {
679 return m_dbusInterface->callDBusRet<bool>(QLatin1String("isCom2Transmitting"));
680 }
681
683 {
684 m_dbusInterface->callDBusAsync(QLatin1String("isCom2Transmitting"), setterCallback(o_com2Tx));
685 }
686
688 {
689 return m_dbusInterface->callDBusRet<double>(QLatin1String("getCom2Volume"));
690 }
691
693 {
694 m_dbusInterface->callDBusAsync(QLatin1String("getCom2Volume"), setterCallback(o_com2Volume));
695 }
696
698 {
699 return m_dbusInterface->callDBusRet<int>(QLatin1String("getTransponderCode"));
700 }
702 {
703 m_dbusInterface->callDBusAsync(QLatin1String("getTransponderCode"), setterCallback(o_xpdrCode));
704 }
705
707 {
708 return m_dbusInterface->callDBusRet<int>(QLatin1String("getTransponderMode"));
709 }
711 {
712 m_dbusInterface->callDBusAsync(QLatin1String("getTransponderMode"), setterCallback(o_xpdrMode));
713 }
714
716 {
717 return m_dbusInterface->callDBusRet<bool>(QLatin1String("getTransponderIdent"));
718 }
720 {
721 m_dbusInterface->callDBusAsync(QLatin1String("getTransponderIdent"), setterCallback(o_ident));
722 }
723
725 {
726 return m_dbusInterface->callDBusRet<bool>(QLatin1String("getBeaconLightsOn"));
727 }
728
730 {
731 m_dbusInterface->callDBusAsync(QLatin1String("getBeaconLightsOn"), setterCallback(o_beaconLightsOn));
732 }
733
735 {
736 return m_dbusInterface->callDBusRet<bool>(QLatin1String("getLandingLightsOn"));
737 }
738
740 {
741 m_dbusInterface->callDBusAsync(QLatin1String("getLandingLightsOn"), setterCallback(o_landingLightsOn));
742 }
743
745 {
746 return m_dbusInterface->callDBusRet<bool>(QLatin1String("getNavLightsOn"));
747 }
748
750 {
751 m_dbusInterface->callDBusAsync(QLatin1String("getNavLightsOn"), setterCallback(o_navLightsOn));
752 }
753
755
756 {
757 return m_dbusInterface->callDBusRet<bool>(QLatin1String("getStrobeLightsOn"));
758 }
759
761 {
762 m_dbusInterface->callDBusAsync(QLatin1String("getStrobeLightsOn"), setterCallback(o_strobeLightsOn));
763 }
764
766 {
767 return m_dbusInterface->callDBusRet<bool>(QLatin1String("getTaxiLightsOn"));
768 }
769
771 {
772 m_dbusInterface->callDBusAsync(QLatin1String("getTaxiLightsOn"), setterCallback(o_taxiLightsOn));
773 }
774
776 {
777 return m_dbusInterface->callDBusRet<double>(QLatin1String("getQNHInHg"));
778 }
779
781 {
782 m_dbusInterface->callDBusAsync(QLatin1String("getQNHInHg"), setterCallback(o_qnh));
783 }
784
786 {
787 m_dbusInterface->callDBus(QLatin1String("setCom1ActiveKhz"), freq);
788 }
789
791 {
792 m_dbusInterface->callDBus(QLatin1String("setCom1StandbyKhz"), freq);
793 }
794
796 {
797 m_dbusInterface->callDBus(QLatin1String("setCom2ActiveKhz"), freq);
798 }
799
801 {
802 m_dbusInterface->callDBus(QLatin1String("setCom2StandbyKhz"), freq);
803 }
804
806 {
807 m_dbusInterface->callDBus(QLatin1String("setTransponderCode"), code);
808 }
809
811 {
812 m_dbusInterface->callDBus(QLatin1String("setTransponderMode"), mode);
813 }
815 {
816 return m_dbusInterface->callDBusRet<double>(QLatin1String("getFlapsDeployRatio"));
817 }
818
820 {
821 m_dbusInterface->callDBusAsync(QLatin1String("getFlapsDeployRatio"), setterCallback(o_flapsDeployRatio));
822 }
823
825 {
826 return m_dbusInterface->callDBusRet<double>(QLatin1String("getGearDeployRatio"));
827 }
828
830 {
831 m_dbusInterface->callDBusAsync(QLatin1String("getGearDeployRatio"), setterCallback(o_gearDeployRatio));
832 }
833
835 {
836 return m_dbusInterface->callDBusRet<int>(QLatin1String("getNumberOfEngines"));
837 }
838
840 {
841 m_dbusInterface->callDBusAsync(QLatin1String("getNumberOfEngines"), setterCallback(o_numberOfEngines));
842 }
843
845 {
846 return m_dbusInterface->callDBusRet<QList<double>>(QLatin1String("getEngineN1Percentage"));
847 }
848
850 {
851 m_dbusInterface->callDBusAsync(QLatin1String("getEngineN1Percentage"), setterCallback(o_engineN1Percentage));
852 }
853
855 {
856 return m_dbusInterface->callDBusRet<double>(QLatin1String("getSpeedBrakeRatio"));
857 }
858
860 {
861 m_dbusInterface->callDBusAsync(QLatin1String("getSpeedBrakeRatio"), setterCallback(o_speedBrakeRatio));
862 }
863
865 {
866 return m_dbusInterface->callDBusRet<QString>(QLatin1String("getSettingsJson"));
867 }
868
870 {
871 m_dbusInterface->callDBusAsync(QLatin1String("getSettingsJson"), setterCallback(o_jsonSettings));
872 }
873
875 {
876 m_dbusInterface->callDBus(QLatin1String("setSettingsJson"), json);
877 }
878} // namespace swift::simplugin::xplane
Used for hand written interface based on virtual methods.
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.
bool getBeaconLightsOn() const
Get whether landing lights are on.
static const QString & InterfaceName()
Service name.
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.
static const QString & ObjectPath()
Service path.
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.
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
QObject(QObject *parent)
QObject * parent() const const
int com2StandbyKhz
COM2 standby [kHz].
double headingRadPerSec
Heading angular velocity [rad/s].
double groundspeedMs
Ground speed [m/s].
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 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].
double localYVelocityMs
Local y velocity [m/s].