6#include <QDBusConnection>
7#include <QLatin1String>
9#define FGSWIFTBUS_SERVICENAME "org.swift-project.fgswiftbus"
11using namespace swift::misc::aviation;
12using namespace swift::misc::geo;
13using namespace swift::misc::physical_quantities;
15namespace swift::simplugin::flightgear
25 s = connection.
connect(
QString(),
"/fgswiftbus/traffic",
"org.swift_project.fgswiftbus.traffic",
"simFrame",
29 s = connection.
connect(
QString(),
"/fgswiftbus/traffic",
"org.swift_project.fgswiftbus.traffic",
33 s = connection.
connect(
QString(),
"/fgswiftbus/traffic",
"org.swift_project.fgswiftbus.traffic",
56 return m_dbusInterface->callDBusRet<
bool>(
QLatin1String(
"initialize"));
65 m_dbusInterface->callDBus(
QLatin1String(
"addPlane"), callsign, modelName, aircraftIcao, airlineIcao, livery);
70 m_dbusInterface->callDBus(
QLatin1String(
"removePlane"), callsign);
112 setter(callsigns, latitudesDeg, longitudesDeg, elevationsM, verticalOffsets);
114 watcher->deleteLater();
116 m_dbusInterface->callDBusAsync(
QLatin1String(
"getRemoteAircraftData"), callback, callsigns);
120 double longitudeDeg,
double altitudeMeters,
128 const double elevationMeters = reply.
argumentAt<1>();
129 const CAltitude elevationAlt = std::isnan(elevationMeters) ?
135 setter(elevation, cs);
137 watcher->deleteLater();
139 m_dbusInterface->callDBusAsync(
QLatin1String(
"getElevationAtPosition"), callback, callsign.
asString(),
140 latitudeDeg, longitudeDeg, altitudeMeters);
static CAngleUnit deg()
Degrees.
Used for hand written interface based on virtual methods.
Class for emitting a log message.
Derived & debug()
Set the severity to debug.
Altitude as used in aviation, can be AGL or MSL altitude.
static const CAltitude & null()
Null altitude (MSL).
Value object encapsulating information of a callsign.
const QString & asString() const
Get callsign (normalized).
Plane of same elevation, can be a single point or larger area (e.g. airport).
static const physical_quantities::CLength & singlePointRadius()
Radius for single point.
static CLengthUnit m()
Meter m.
static CLengthUnit ft()
Foot ft.
void remoteAircraftAdded(const QString &callsign)
Remote aircraft successfully added.
std::function< void( const QStringList &, const QDoubleList &, const QDoubleList &, const QDoubleList &, const QDoubleList &)> RemoteAircraftDataCallback
Remote aircrafts data callback.
void setPlanesTransponders(const swift::simplugin::flightgear::PlanesTransponders &planesTransponders)
Set the transponders of multiple traffic aircrafts.
void setPlanesSurfaces(const swift::simplugin::flightgear::PlanesSurfaces &planesSurfaces)
Set the surfaces of multiple traffic aircrafts.
static const QString & ObjectPath()
Service path.
void cleanup()
Reverse the actions of initialize().
static const QString & InterfaceName()
Service name.
std::function< void(const swift::misc::geo::CElevationPlane &, const swift::misc::aviation::CCallsign &)> ElevationCallback
Elevation callback.
void remoteAircraftAddingFailed(const QString &callsign)
Remote aircraft adding failed.
void addPlane(const QString &callsign, const QString &modelName, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery)
Introduce a new traffic aircraft.
bool initialize()
Initialize the multiplayer planes rendering and return true if successful.
void simFrame()
Simulator frame.
MultiplayerAcquireInfo acquireMultiplayerPlanes()
Returns whether multiplayer planes have been acquired. If not, owner will be set to the plugin that a...
void getElevationAtPosition(const swift::misc::aviation::CCallsign &callsign, double latitudeDeg, double longitudeDeg, double altitudeMeters, const ElevationCallback &setter) const
Get the ground elevation at an arbitrary position.
void getRemoteAircraftData(const QStringList &callsigns, const RemoteAircraftDataCallback &setter) const
Get remote aircrafts data (lat, lon, elevation and CG).
void removePlane(const QString &callsign)
Remove a traffic aircraft.
CFGSwiftBusTrafficProxy(QDBusConnection &connection, QObject *parent=nullptr, bool dummy=false)
Constructor.
void setPlanesPositions(const swift::simplugin::flightgear::PlanesPositions &planesPositions)
Set the position of multiple traffic aircrafts.
void removeAllPlanes()
Remove all traffic aircraft.
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
QString message() const const
QVariant argumentAt(int index) const const
QDBusError error() const const
bool isError() const const
QObject * parent() const const
Multiplayer Acquire Info.
QString owner
Name of the plugin having multiplayer planes acquired.
bool hasAcquired
Has FGSwiftBus acquired multiplayer planes?
QList< double > rollsDeg
List of rolls.
QList< bool > onGrounds
List of onGrounds.
QList< double > altitudesFt
List of altitudes.
QList< double > latitudesDeg
List of latitudes.
QList< double > longitudesDeg
List of longitudes.
QList< double > groundSpeedKts
List of groundspeeds.
QList< double > headingsDeg
List of headings.
QStringList callsigns
List of callsigns.
QList< double > pitchesDeg
List of pitches.
QList< bool > strobeLights
List of strobeLights.
QList< double > slats
List of slats.
QList< double > thrusts
List of thrusts.
QList< double > ailerons
List of ailerons.
QList< double > wingSweeps
List of wingSweeps.
QList< double > gears
List of gears.
QList< bool > taxiLights
List of taxi lights.
QList< double > spoilers
List of spoilers.
QList< int > lightPatterns
List of lightPatterns.
QList< double > speedBrakes
List of speedBrakes.
QList< double > rudders
List of rudders.
QList< double > elevators
List of elevators.
QStringList callsigns
List of callsigns.
QList< bool > landLights
List of landLights.
QList< bool > beaconLights
List of beaconLights.
QList< double > flaps
List of flaps.
QList< bool > navLights
List of navLights.
QStringList callsigns
List of callsigns.
QList< int > codes
List of transponder codes.
QList< bool > modeCs
List of active mode C's.
QList< bool > idents
List of active idents.