mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
* Before this commit, only the true altitude was known for an aircraft situation. The pressure altitude was not available anywhere yet. * This caused a wrong altitude in radar clients. * We fix this reading the pressure altitude from the simulators and set it in the own aircraft situation. * MS Flight Simulators have the pressure altitude in the APIs available. * For X-Plane and emulated simulator, we need to calculate it from the pressure at sea level. * Finally, we use the new available pressure altitude to send it to the FSD server. Maniphest Tasks: Ref T223
96 lines
4.2 KiB
C++
96 lines
4.2 KiB
C++
/* Copyright (C) 2013
|
|
* swift Project Community / Contributors
|
|
*
|
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
|
* contained in the LICENSE file.
|
|
*/
|
|
|
|
//! \file
|
|
|
|
#ifndef BLACKCORE_CONTEXT_OWNAIRCRAFT_PROXY_H
|
|
#define BLACKCORE_CONTEXT_OWNAIRCRAFT_PROXY_H
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
|
|
#include "blackcore/blackcoreexport.h"
|
|
#include "blackcore/context/contextownaircraft.h"
|
|
#include "blackcore/corefacadeconfig.h"
|
|
#include "blackmisc/aviation/airlineicaocode.h"
|
|
#include "blackmisc/aviation/comsystem.h"
|
|
#include "blackmisc/aviation/selcal.h"
|
|
#include "blackmisc/geo/coordinategeodetic.h"
|
|
#include "blackmisc/identifier.h"
|
|
#include "blackmisc/network/user.h"
|
|
#include "blackmisc/pq/frequency.h"
|
|
#include "blackmisc/simulation/simulatedaircraft.h"
|
|
|
|
class QDBusConnection;
|
|
|
|
namespace BlackMisc
|
|
{
|
|
class CGenericDBusInterface;
|
|
namespace Aviation
|
|
{
|
|
class CAircraftIcaoCode;
|
|
class CAltitude;
|
|
class CCallsign;
|
|
class CTransponder;
|
|
}
|
|
}
|
|
namespace BlackCore
|
|
{
|
|
class CCoreFacade;
|
|
namespace Context
|
|
{
|
|
//! Own aircraft context proxy
|
|
//! \ingroup dbus
|
|
class BLACKCORE_EXPORT CContextOwnAircraftProxy : public IContextOwnAircraft
|
|
{
|
|
Q_OBJECT
|
|
friend class IContextOwnAircraft;
|
|
|
|
public:
|
|
//! Destructor
|
|
virtual ~CContextOwnAircraftProxy() {}
|
|
|
|
//! Unit test relay signals
|
|
//! \private
|
|
static void unitTestRelaySignals();
|
|
|
|
public slots:
|
|
//! \publicsection
|
|
//! @{
|
|
virtual BlackMisc::Simulation::CSimulatedAircraft getOwnAircraft() const override;
|
|
virtual bool updateOwnPosition(const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::Aviation::CAltitude &altitude, const BlackMisc::Aviation::CAltitude &pressureAltitude) override;
|
|
virtual bool updateCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const BlackMisc::Aviation::CTransponder &transponder, const BlackMisc::CIdentifier &originator) override;
|
|
virtual bool updateActiveComFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ComUnit comUnit, const BlackMisc::CIdentifier &originator) override;
|
|
virtual bool updateOwnAircraftPilot(const BlackMisc::Network::CUser &pilot) override;
|
|
virtual bool updateSelcal(const BlackMisc::Aviation::CSelcal &selcal, const BlackMisc::CIdentifier &originator) override;
|
|
virtual bool updateOwnCallsign(const BlackMisc::Aviation::CCallsign &callsign) override;
|
|
virtual bool updateOwnIcaoCodes(const BlackMisc::Aviation::CAircraftIcaoCode &aircraftIcaoCode, const BlackMisc::Aviation::CAirlineIcaoCode &airlineIcaoCode) override;
|
|
virtual void setAudioOutputVolume(int outputVolume) override;
|
|
virtual void setAudioVoiceRoomOverrideUrls(const QString &voiceRoom1Url, const QString &voiceRoom2Url) override;
|
|
virtual void enableAutomaticVoiceRoomResolution(bool enable) override;
|
|
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
|
//! @}
|
|
|
|
protected:
|
|
//! \brief Constructor
|
|
CContextOwnAircraftProxy(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) : IContextOwnAircraft(mode, runtime), m_dBusInterface(nullptr) {}
|
|
|
|
//! \brief DBus version constructor
|
|
CContextOwnAircraftProxy(const QString &serviceName, QDBusConnection &connection, CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime);
|
|
|
|
private:
|
|
BlackMisc::CGenericDBusInterface *m_dBusInterface; //!< DBus interface */
|
|
|
|
//! \brief Relay connection signals to local signals.
|
|
void relaySignals(const QString &serviceName, QDBusConnection &connection);
|
|
};
|
|
} // ns
|
|
} // ns
|
|
#endif // guard
|