6 #include <QDBusConnection>
7 #include <QLatin1String>
9 #define FGSWIFTBUS_SERVICENAME "org.swift-project.fgswiftbus"
11 using namespace swift::misc::aviation;
12 using namespace swift::misc::geo;
13 using namespace swift::misc::physical_quantities;
15 namespace 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",
65 m_dbusInterface->
callDBus(
QLatin1String(
"addPlane"), callsign, modelName, aircraftIcao, airlineIcao, livery);
112 setter(callsigns, latitudesDeg, longitudesDeg, elevationsM, verticalOffsets);
114 watcher->deleteLater();
120 double longitudeDeg,
double altitudeMeters,
128 const double elevationMeters = reply.
argumentAt<1>();
129 const CAltitude elevationAlt = std::isnan(elevationMeters) ?
131 CAltitude(elevationMeters, CLengthUnit::m(), CLengthUnit::ft());
133 CLongitude(longitudeDeg, CAngleUnit::deg()), elevationAlt,
134 CElevationPlane::singlePointRadius());
135 setter(elevation, cs);
137 watcher->deleteLater();
140 latitudeDeg, longitudeDeg, altitudeMeters);
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...
Class for emitting a log message.
Derived & debug()
Set the severity to debug.
Altitude as used in aviation, can be AGL or MSL altitude.
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)
void remoteAircraftAdded(const QString &callsign)
Remote aircraft successfully added.
void setPlanesTransponders(const swift::simplugin::flightgear::PlanesTransponders &planesTransponders)
Set the transponders of multiple traffic aircrafts.
static const QString & ObjectPath()
Service path.
void setPlanesSurfaces(const swift::simplugin::flightgear::PlanesSurfaces &planesSurfaces)
Set the surfaces of multiple traffic aircrafts.
void cleanup()
Reverse the actions of initialize().
std::function< void(const QStringList &, const QDoubleList &, const QDoubleList &, const QDoubleList &, const QDoubleList &)> RemoteAircraftDataCallback
Remote aircrafts data 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.
std::function< void(const swift::misc::geo::CElevationPlane &, const swift::misc::aviation::CCallsign &)> ElevationCallback
Elevation callback.
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.
void setPlanesPositions(const swift::simplugin::flightgear::PlanesPositions &planesPositions)
Set the position of multiple traffic aircrafts.
static const QString & InterfaceName()
Service name.
void removeAllPlanes()
Remove all traffic aircraft.
QDBusPendingCall asyncCall(const QString &method, Args &&... args)
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
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.