mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
Revert previous commit, as the corresponding changes have not yet been merged in FG
This commit is contained in:
@@ -87,26 +87,6 @@ namespace BlackSimPlugin
|
|||||||
planesPositions.headingsDeg, planesPositions.groundSpeedKts, planesPositions.onGrounds);
|
planesPositions.headingsDeg, planesPositions.groundSpeedKts, planesPositions.onGrounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFGSwiftBusTrafficProxy::setPlanesSurfaces(const PlanesSurfaces &planesSurfaces)
|
|
||||||
{
|
|
||||||
m_dbusInterface->callDBus(QLatin1String("setPlanesSurfaces"),
|
|
||||||
planesSurfaces.callsigns, planesSurfaces.gears, planesSurfaces.flaps,
|
|
||||||
planesSurfaces.spoilers, planesSurfaces.speedBrakes, planesSurfaces.slats,
|
|
||||||
planesSurfaces.wingSweeps, planesSurfaces.thrusts, planesSurfaces.elevators,
|
|
||||||
planesSurfaces.rudders, planesSurfaces.ailerons,
|
|
||||||
planesSurfaces.landLights, planesSurfaces.taxiLights,
|
|
||||||
planesSurfaces.beaconLights, planesSurfaces.strobeLights,
|
|
||||||
planesSurfaces.navLights, planesSurfaces.lightPatterns);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CFGSwiftBusTrafficProxy::setPlanesTransponders(const PlanesTransponders &planesTransponders)
|
|
||||||
{
|
|
||||||
m_dbusInterface->callDBus(QLatin1String("setPlanesTransponders"),
|
|
||||||
planesTransponders.callsigns, planesTransponders.codes,
|
|
||||||
planesTransponders.modeCs, planesTransponders.idents);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CFGSwiftBusTrafficProxy::getRemoteAircraftData(const QStringList &callsigns, const RemoteAircraftDataCallback &setter) const
|
void CFGSwiftBusTrafficProxy::getRemoteAircraftData(const QStringList &callsigns, const RemoteAircraftDataCallback &setter) const
|
||||||
{
|
{
|
||||||
std::function<void(QDBusPendingCallWatcher *)> callback = [ = ](QDBusPendingCallWatcher * watcher)
|
std::function<void(QDBusPendingCallWatcher *)> callback = [ = ](QDBusPendingCallWatcher * watcher)
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ namespace BlackSimPlugin
|
|||||||
this->pitchesDeg.push_back(situation.getPitch().value(BlackMisc::PhysicalQuantities::CAngleUnit::deg()));
|
this->pitchesDeg.push_back(situation.getPitch().value(BlackMisc::PhysicalQuantities::CAngleUnit::deg()));
|
||||||
this->rollsDeg.push_back(situation.getBank().value(BlackMisc::PhysicalQuantities::CAngleUnit::deg()));
|
this->rollsDeg.push_back(situation.getBank().value(BlackMisc::PhysicalQuantities::CAngleUnit::deg()));
|
||||||
this->headingsDeg.push_back(situation.getHeading().value(BlackMisc::PhysicalQuantities::CAngleUnit::deg()));
|
this->headingsDeg.push_back(situation.getHeading().value(BlackMisc::PhysicalQuantities::CAngleUnit::deg()));
|
||||||
this->groundSpeedKts.push_back(situation.getGroundSpeed().value(BlackMisc::PhysicalQuantities::CSpeedUnit::kts()));
|
|
||||||
this->onGrounds.push_back(situation.getOnGround() == BlackMisc::Aviation::CAircraftSituation::OnGround);
|
this->onGrounds.push_back(situation.getOnGround() == BlackMisc::Aviation::CAircraftSituation::OnGround);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +101,8 @@ namespace BlackSimPlugin
|
|||||||
this->rudders.push_back(0.0);
|
this->rudders.push_back(0.0);
|
||||||
this->ailerons.push_back(0.0);
|
this->ailerons.push_back(0.0);
|
||||||
this->landLights.push_back(parts.getLights().isLandingOn());
|
this->landLights.push_back(parts.getLights().isLandingOn());
|
||||||
this->taxiLights.push_back(parts.getLights().isTaxiOn());
|
//! \todo KB 2019-09 Missing taxi lights in FG
|
||||||
|
// this->taxiLights.push_back(parts.getLights().isTaxiOn());
|
||||||
this->beaconLights.push_back(parts.getLights().isBeaconOn());
|
this->beaconLights.push_back(parts.getLights().isBeaconOn());
|
||||||
this->strobeLights.push_back(parts.getLights().isStrobeOn());
|
this->strobeLights.push_back(parts.getLights().isStrobeOn());
|
||||||
this->navLights.push_back(parts.getLights().isNavOn());
|
this->navLights.push_back(parts.getLights().isNavOn());
|
||||||
@@ -121,7 +121,6 @@ namespace BlackSimPlugin
|
|||||||
QList<double> rudders; //!< List of rudders
|
QList<double> rudders; //!< List of rudders
|
||||||
QList<double> ailerons; //!< List of ailerons
|
QList<double> ailerons; //!< List of ailerons
|
||||||
QList<bool> landLights; //!< List of landLights
|
QList<bool> landLights; //!< List of landLights
|
||||||
QList<bool> taxiLights; //!< List of taxi lights
|
|
||||||
QList<bool> beaconLights; //!< List of beaconLights
|
QList<bool> beaconLights; //!< List of beaconLights
|
||||||
QList<bool> strobeLights; //!< List of strobeLights
|
QList<bool> strobeLights; //!< List of strobeLights
|
||||||
QList<bool> navLights; //!< List of navLights
|
QList<bool> navLights; //!< List of navLights
|
||||||
@@ -214,12 +213,6 @@ namespace BlackSimPlugin
|
|||||||
//! Set the position of multiple traffic aircrafts
|
//! Set the position of multiple traffic aircrafts
|
||||||
void setPlanesPositions(const BlackSimPlugin::Flightgear::PlanesPositions &planesPositions);
|
void setPlanesPositions(const BlackSimPlugin::Flightgear::PlanesPositions &planesPositions);
|
||||||
|
|
||||||
//! Set the surfaces of multiple traffic aircrafts
|
|
||||||
void setPlanesSurfaces(const BlackSimPlugin::Flightgear::PlanesSurfaces &planesSurfaces);
|
|
||||||
|
|
||||||
//! Set the transponders of multiple traffic aircrafts
|
|
||||||
void setPlanesTransponders(const BlackSimPlugin::Flightgear::PlanesTransponders &planesTransponders);
|
|
||||||
|
|
||||||
//! Get remote aircrafts data (lat, lon, elevation and CG)
|
//! Get remote aircrafts data (lat, lon, elevation and CG)
|
||||||
void getRemoteAircraftData(const QStringList &callsigns, const RemoteAircraftDataCallback &setter) const;
|
void getRemoteAircraftData(const QStringList &callsigns, const RemoteAircraftDataCallback &setter) const;
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define FGSWIFTBUS_API_VERSION 2
|
#define FGSWIFTBUS_API_VERSION 1
|
||||||
|
|
||||||
using namespace BlackConfig;
|
using namespace BlackConfig;
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
@@ -170,7 +170,8 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
PlanesSurfaces surfaces;
|
PlanesSurfaces surfaces;
|
||||||
surfaces.push_back(callsign, parts);
|
surfaces.push_back(callsign, parts);
|
||||||
m_trafficProxy->setPlanesSurfaces(surfaces);
|
//! \todo KB 2091-09 FG parts sending missing
|
||||||
|
// m_trafficProxy->setPlanesSurfaces(surfaces);
|
||||||
u++;
|
u++;
|
||||||
}
|
}
|
||||||
return u > 0;
|
return u > 0;
|
||||||
@@ -532,15 +533,6 @@ namespace BlackSimPlugin
|
|||||||
newRemoteAircraft.getAircraftIcaoCode().getDesignator(),
|
newRemoteAircraft.getAircraftIcaoCode().getDesignator(),
|
||||||
newRemoteAircraft.getAirlineIcaoCode().getDesignator(),
|
newRemoteAircraft.getAirlineIcaoCode().getDesignator(),
|
||||||
livery);
|
livery);
|
||||||
|
|
||||||
PlanesPositions pos;
|
|
||||||
pos.push_back(newRemoteAircraft.getSituation());
|
|
||||||
m_trafficProxy->setPlanesPositions(pos);
|
|
||||||
|
|
||||||
PlanesSurfaces surfaces;
|
|
||||||
surfaces.push_back(newRemoteAircraft.getCallsign(), newRemoteAircraft.getParts());
|
|
||||||
m_trafficProxy->setPlanesSurfaces(surfaces);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -631,25 +623,23 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
// interpolation for all remote aircraft
|
// interpolation for all remote aircraft
|
||||||
PlanesPositions planesPositions;
|
PlanesPositions planesPositions;
|
||||||
PlanesSurfaces planesSurfaces;
|
|
||||||
PlanesTransponders planesTransponders;
|
PlanesTransponders planesTransponders;
|
||||||
|
|
||||||
int aircraftNumber = 0;
|
int aircraftNumber = 0;
|
||||||
const bool updateAllAircraft = this->isUpdateAllRemoteAircraft(currentTimestamp);
|
const bool updateAllAircraft = this->isUpdateAllRemoteAircraft(currentTimestamp);
|
||||||
const CCallsignSet callsignsInRange = this->getAircraftInRangeCallsigns();
|
const CCallsignSet callsingsInRange = this->getAircraftInRangeCallsigns();
|
||||||
for (const CFlightgearMPAircraft &flightgearAircraft : m_flightgearAircraftObjects)
|
for (const CFlightgearMPAircraft &flightgearAircraft : m_flightgearAircraftObjects)
|
||||||
{
|
{
|
||||||
const CCallsign callsign(flightgearAircraft.getCallsign());
|
const CCallsign callsign(flightgearAircraft.getCallsign());
|
||||||
const bool hasCallsign = !callsign.isEmpty();
|
const bool hasCallsign = !callsign.isEmpty();
|
||||||
if (!hasCallsign)
|
if (!hasCallsign)
|
||||||
{
|
{
|
||||||
// does not make sense to continue here
|
|
||||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, "missing callsign");
|
BLACK_VERIFY_X(false, Q_FUNC_INFO, "missing callsign");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip no longer in range
|
// skip no longer in range
|
||||||
if (!callsignsInRange.contains(callsign)) { continue; }
|
if (!callsingsInRange.contains(callsign)) { continue; }
|
||||||
|
|
||||||
planesTransponders.callsigns.push_back(callsign.asString());
|
planesTransponders.callsigns.push_back(callsign.asString());
|
||||||
planesTransponders.codes.push_back(flightgearAircraft.getAircraft().getTransponderCode());
|
planesTransponders.codes.push_back(flightgearAircraft.getAircraft().getTransponderCode());
|
||||||
@@ -670,7 +660,15 @@ namespace BlackSimPlugin
|
|||||||
if (updateAllAircraft || !this->isEqualLastSent(interpolatedSituation))
|
if (updateAllAircraft || !this->isEqualLastSent(interpolatedSituation))
|
||||||
{
|
{
|
||||||
this->rememberLastSent(interpolatedSituation);
|
this->rememberLastSent(interpolatedSituation);
|
||||||
planesPositions.push_back(interpolatedSituation);
|
planesPositions.callsigns.push_back(interpolatedSituation.getCallsign().asString());
|
||||||
|
planesPositions.latitudesDeg.push_back(interpolatedSituation.latitude().value(CAngleUnit::deg()));
|
||||||
|
planesPositions.longitudesDeg.push_back(interpolatedSituation.longitude().value(CAngleUnit::deg()));
|
||||||
|
planesPositions.altitudesFt.push_back(interpolatedSituation.getAltitude().value(CLengthUnit::ft()));
|
||||||
|
planesPositions.pitchesDeg.push_back(interpolatedSituation.getPitch().value(CAngleUnit::deg()));
|
||||||
|
planesPositions.rollsDeg.push_back(interpolatedSituation.getBank().value(CAngleUnit::deg()));
|
||||||
|
planesPositions.headingsDeg.push_back(interpolatedSituation.getHeading().value(CAngleUnit::deg()));
|
||||||
|
planesPositions.groundSpeedKts.push_back(interpolatedSituation.getGroundSpeed().value(CSpeedUnit::kts()));
|
||||||
|
planesPositions.onGrounds.push_back(interpolatedSituation.getOnGround() == CAircraftSituation::OnGround);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -678,37 +676,17 @@ namespace BlackSimPlugin
|
|||||||
CLogMessage(this).warning(this->getInvalidSituationLogMessage(callsign, result.getInterpolationStatus()));
|
CLogMessage(this).warning(this->getInvalidSituationLogMessage(callsign, result.getInterpolationStatus()));
|
||||||
}
|
}
|
||||||
|
|
||||||
const CAircraftParts parts(result);
|
|
||||||
if (result.getPartsStatus().isSupportingParts() || parts.getPartsDetails() == CAircraftParts::GuessedParts)
|
|
||||||
{
|
|
||||||
if (updateAllAircraft || !this->isEqualLastSent(parts, callsign))
|
|
||||||
{
|
|
||||||
this->rememberLastSent(parts, callsign);
|
|
||||||
planesSurfaces.push_back(flightgearAircraft.getCallsign(), parts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // all callsigns
|
} // all callsigns
|
||||||
|
|
||||||
if (!planesTransponders.isEmpty())
|
|
||||||
{
|
|
||||||
m_trafficProxy->setPlanesTransponders(planesTransponders);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!planesPositions.isEmpty())
|
if (!planesPositions.isEmpty())
|
||||||
{
|
{
|
||||||
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
||||||
{
|
{
|
||||||
BLACK_VERIFY_X(planesPositions.hasSameSizes(), Q_FUNC_INFO, "Mismatching sizes");
|
Q_ASSERT_X(planesPositions.hasSameSizes(), Q_FUNC_INFO, "Mismatching sizes");
|
||||||
}
|
}
|
||||||
m_trafficProxy->setPlanesPositions(planesPositions);
|
m_trafficProxy->setPlanesPositions(planesPositions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! planesSurfaces.isEmpty())
|
|
||||||
{
|
|
||||||
m_trafficProxy->setPlanesSurfaces(planesSurfaces);
|
|
||||||
}
|
|
||||||
|
|
||||||
// stats
|
// stats
|
||||||
this->finishUpdateRemoteAircraftAndSetStatistics(currentTimestamp);
|
this->finishUpdateRemoteAircraftAndSetStatistics(currentTimestamp);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user