Ref T422, functions to toggle/set XPDR mode

This commit is contained in:
Klaus Basan
2018-11-02 17:03:21 +01:00
parent 212460f676
commit 4172701586
8 changed files with 97 additions and 11 deletions

View File

@@ -128,6 +128,12 @@ namespace BlackCore
//! Update own cockpit
virtual bool updateCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const BlackMisc::Aviation::CTransponder &transponder, const BlackMisc::CIdentifier &originator) = 0;
//! Toggle XPDR mode
virtual void toggleTransponderMode() = 0;
//! Set XPDR mode
virtual bool setTransponderMode(BlackMisc::Aviation::CTransponder::TransponderMode mode) = 0;
//! Tune in a COM frequency
virtual bool updateActiveComFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ComUnit comUnit, const BlackMisc::CIdentifier &originator) = 0;

View File

@@ -113,6 +113,21 @@ namespace BlackCore
virtual void setAudioOutputVolume(int outputVolume) override
{
Q_UNUSED(outputVolume);
logEmptyContextWarning(Q_FUNC_INFO);
}
//! \copydoc IContextOwnAircraft::toggleTransponderMode
virtual void toggleTransponderMode() override
{
logEmptyContextWarning(Q_FUNC_INFO);
}
//! \copydoc IContextOwnAircraft::setTransponderMode
virtual bool setTransponderMode(BlackMisc::Aviation::CTransponder::TransponderMode mode) override
{
Q_UNUSED(mode);
logEmptyContextWarning(Q_FUNC_INFO);
return false;
}
//! \copydoc IContextOwnAircraft::setAudioVoiceRoomOverrideUrls

View File

@@ -206,9 +206,11 @@ namespace BlackCore
if (jumpDetected)
{
{
QWriteLocker wl(&m_lockAircraft);
m_situationHistory.clear();
}
emit this->movedAircraft();
QWriteLocker wl(&m_lockAircraft);
m_situationHistory.clear();
}
}
@@ -218,7 +220,7 @@ namespace BlackCore
CAircraftModel CContextOwnAircraft::reverseLookupModel(const CAircraftModel &model)
{
bool modified = false;
CAircraftModel reverseModel = CDatabaseUtils::consolidateOwnAircraftModelWithDbData(model, false, &modified);
const CAircraftModel reverseModel = CDatabaseUtils::consolidateOwnAircraftModelWithDbData(model, false, &modified);
return reverseModel;
}
@@ -298,7 +300,7 @@ namespace BlackCore
return changed;
}
bool CContextOwnAircraft::updateActiveComFrequency(const CFrequency &frequency, BlackMisc::Aviation::CComSystem::ComUnit unit, const CIdentifier &originator)
bool CContextOwnAircraft::updateActiveComFrequency(const CFrequency &frequency, CComSystem::ComUnit unit, const CIdentifier &originator)
{
if (unit != CComSystem::Com1 && unit != CComSystem::Com2) { return false; }
if (!CComSystem::isValidComFrequency(frequency)) { return false; }
@@ -318,7 +320,7 @@ namespace BlackCore
{
com2.setFrequencyActive(frequency);
}
return updateCockpit(com1, com2, xpdr, originator);
return this->updateCockpit(com1, com2, xpdr, originator);
}
bool CContextOwnAircraft::updateOwnAircraftPilot(const CUser &pilot)
@@ -332,6 +334,36 @@ namespace BlackCore
return true;
}
void CContextOwnAircraft::toggleTransponderMode()
{
CTransponder xpdr;
CComSystem com1;
CComSystem com2;
{
QReadLocker l(&m_lockAircraft);
com1 = m_ownAircraft.getCom1System();
com2 = m_ownAircraft.getCom2System();
xpdr = m_ownAircraft.getTransponder();
}
xpdr.toggleTransponderMode();
this->updateCockpit(com1, com2, xpdr, this->identifier());
}
bool CContextOwnAircraft::setTransponderMode(CTransponder::TransponderMode mode)
{
CTransponder xpdr;
CComSystem com1;
CComSystem com2;
{
QReadLocker l(&m_lockAircraft);
com1 = m_ownAircraft.getCom1System();
com2 = m_ownAircraft.getCom2System();
xpdr = m_ownAircraft.getTransponder();
}
xpdr.setTransponderMode(mode);
return this->updateCockpit(com1, com2, xpdr, this->identifier());
}
bool CContextOwnAircraft::updateOwnCallsign(const CCallsign &callsign)
{
{

View File

@@ -141,6 +141,12 @@ namespace BlackCore
//! \copydoc IContextOwnAircraft::updateOwnAircraftPilot
virtual bool updateOwnAircraftPilot(const BlackMisc::Network::CUser &pilot) override;
//! \copydoc IContextOwnAircraft::toggleTransponderMode
virtual void toggleTransponderMode() override;
//! \copydoc IContextOwnAircraft::setTransponderMode
virtual bool setTransponderMode(BlackMisc::Aviation::CTransponder::TransponderMode mode) override;
//! \copydoc IContextOwnAircraft::setAudioOutputVolume
virtual void setAudioOutputVolume(int outputVolume) override;

View File

@@ -136,6 +136,16 @@ namespace BlackCore
this->m_dBusInterface->callDBus(QLatin1String("enableAutomaticVoiceRoomResolution"), enable);
}
void CContextOwnAircraftProxy::toggleTransponderMode()
{
this->m_dBusInterface->callDBus(QLatin1String("toggleTransponderMode"));
}
bool CContextOwnAircraftProxy::setTransponderMode(CTransponder::TransponderMode mode)
{
return this->m_dBusInterface->callDBusRet<bool>(QLatin1String("setTransponderMode"), mode);
}
bool CContextOwnAircraftProxy::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
{
return this->m_dBusInterface->callDBusRet<bool>(QLatin1String("parseCommandLine"), commandLine, originator);

View File

@@ -75,6 +75,8 @@ namespace BlackCore
virtual void setAudioOutputVolume(int outputVolume) override;
virtual void setAudioVoiceRoomOverrideUrls(const QString &voiceRoom1Url, const QString &voiceRoom2Url) override;
virtual void enableAutomaticVoiceRoomResolution(bool enable) override;
virtual void toggleTransponderMode() override;
virtual bool setTransponderMode(BlackMisc::Aviation::CTransponder::TransponderMode mode) override;
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
//! @}