mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 16:55:36 +08:00
Renaming, header, Doxygen, formatting (during refs #314)
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
/* Copyright (C) 2013 VATSIM Community / contributors
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/* 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 BLACKMISC_AVIOMODULATORUNIT_H
|
||||
#define BLACKMISC_AVIOMODULATORUNIT_H
|
||||
@@ -18,27 +24,86 @@ namespace BlackMisc
|
||||
{
|
||||
|
||||
/*!
|
||||
* \brief Base class for COM, NAV, Squawk units.
|
||||
* Base class for COM, NAV, Squawk units.
|
||||
*/
|
||||
template <class AVIO> class CModulator : public CAvionicsBase
|
||||
{
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CModulator)
|
||||
BlackMisc::PhysicalQuantities::CFrequency m_frequencyActive; //!< active frequency
|
||||
BlackMisc::PhysicalQuantities::CFrequency m_frequencyStandby; //!< standby frequency
|
||||
qint32 m_volumeInput; //!< volume input
|
||||
qint32 m_volumeOutput; //!< volume output
|
||||
bool m_enabled; //!< is enabled, used e.g. for mute etc.
|
||||
|
||||
public:
|
||||
//! Virtual destructor
|
||||
virtual ~CModulator() {}
|
||||
|
||||
//! Default value?
|
||||
virtual bool isDefaultValue() const
|
||||
{
|
||||
return this->m_frequencyActive == CModulator::FrequencyNotSet();
|
||||
}
|
||||
|
||||
//! Toggle active and standby frequencies
|
||||
void toggleActiveStandby();
|
||||
|
||||
//! Active frequency
|
||||
BlackMisc::PhysicalQuantities::CFrequency getFrequencyActive() const
|
||||
{
|
||||
return this->m_frequencyActive;
|
||||
}
|
||||
|
||||
//! Standby frequency
|
||||
BlackMisc::PhysicalQuantities::CFrequency getFrequencyStandby() const
|
||||
{
|
||||
return this->m_frequencyStandby;
|
||||
}
|
||||
|
||||
//! Set active frequency
|
||||
void setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||
{
|
||||
this->m_frequencyActive = frequency;
|
||||
}
|
||||
|
||||
//! Set standby frequency
|
||||
void setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||
{
|
||||
this->m_frequencyStandby = frequency;
|
||||
}
|
||||
|
||||
//! Output volume
|
||||
qint32 getVolumeOutput() const { return this->m_volumeOutput; }
|
||||
|
||||
//! Input volume
|
||||
qint32 getVolumeInput() const { return this->m_volumeInput; }
|
||||
|
||||
//! Output volume
|
||||
void setVolumeOutput(qint32 volume) { this->m_volumeOutput = volume; }
|
||||
|
||||
//! Input volume
|
||||
void setVolumeInput(qint32 volume) { this->m_volumeInput = volume; }
|
||||
|
||||
//! Enabled?
|
||||
bool isEnabled() const { return this->m_enabled;}
|
||||
|
||||
//! Enabled?
|
||||
void setEnabled(bool enable) { this->m_enabled = enable;}
|
||||
|
||||
//! \copydoc CValueObject::toJson
|
||||
virtual QJsonObject toJson() const override;
|
||||
|
||||
//! \copydoc CValueObject::fromJson
|
||||
virtual void fromJson(const QJsonObject &json) override;
|
||||
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
//! Members
|
||||
static const QStringList &jsonMembers();
|
||||
|
||||
protected:
|
||||
int m_digits; //!< digits used
|
||||
|
||||
protected:
|
||||
//! \brief Default constructor
|
||||
//! Default constructor
|
||||
CModulator() :
|
||||
CAvionicsBase("default"), m_volumeInput(0), m_volumeOutput(0), m_enabled(true), m_digits(2) {}
|
||||
|
||||
//! \brief Constructor
|
||||
//! Constructor
|
||||
CModulator(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency, int digits) :
|
||||
CAvionicsBase(name), m_frequencyActive(activeFrequency), m_frequencyStandby(standbyFrequency), m_volumeInput(0), m_volumeOutput(0), m_enabled(true), m_digits(digits) {}
|
||||
|
||||
@@ -51,98 +116,98 @@ namespace BlackMisc
|
||||
return s;
|
||||
}
|
||||
|
||||
//! \brief Set active frequency
|
||||
//! Set active frequency
|
||||
void setFrequencyActiveKHz(double frequencyKHz)
|
||||
{
|
||||
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
|
||||
}
|
||||
|
||||
//! \brief Set standby frequency
|
||||
//! Set standby frequency
|
||||
void setFrequencyStandbyKHz(double frequencyKHz)
|
||||
{
|
||||
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
|
||||
}
|
||||
|
||||
//! \brief Set active frequency
|
||||
//! Set active frequency
|
||||
void setFrequencyActiveMHz(double frequencyMHz)
|
||||
{
|
||||
frequencyMHz = CMath::round(frequencyMHz, 3);
|
||||
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
|
||||
}
|
||||
|
||||
//! \brief Set standby frequency
|
||||
//! Set standby frequency
|
||||
void setFrequencyStandbyMHz(double frequencyMHz)
|
||||
{
|
||||
frequencyMHz = CMath::round(frequencyMHz, 3);
|
||||
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
|
||||
}
|
||||
|
||||
//! \brief operator ==
|
||||
//! operator ==
|
||||
bool operator ==(const CModulator &other) const;
|
||||
|
||||
//! \brief operator !=
|
||||
//! operator !=
|
||||
bool operator !=(const CModulator &other) const;
|
||||
|
||||
//! \copydoc CValueObject::compareImpl(otherBase)
|
||||
virtual int compareImpl(const CValueObject &otherBase) const override;
|
||||
|
||||
//! \brief COM1
|
||||
//! COM1
|
||||
static const QString &NameCom1()
|
||||
{
|
||||
static QString n("COM1");
|
||||
return n;
|
||||
}
|
||||
|
||||
//! \brief COM2
|
||||
//! COM2
|
||||
static const QString &NameCom2()
|
||||
{
|
||||
static QString n("COM2");
|
||||
return n;
|
||||
}
|
||||
|
||||
//! \brief COM3
|
||||
//! COM3
|
||||
static const QString &NameCom3()
|
||||
{
|
||||
static QString n("COM3");
|
||||
return n;
|
||||
}
|
||||
|
||||
//! \brief NAV1
|
||||
//! NAV1
|
||||
static const QString &NameNav1()
|
||||
{
|
||||
static QString n("NAV1");
|
||||
return n;
|
||||
}
|
||||
|
||||
//! \brief NAV2
|
||||
//! NAV2
|
||||
static const QString &NameNav2()
|
||||
{
|
||||
static QString n("NAV2");
|
||||
return n;
|
||||
}
|
||||
|
||||
//! \brief NAV3
|
||||
//! NAV3
|
||||
static const QString &NameNav3()
|
||||
{
|
||||
static QString n("NAV3");
|
||||
return n;
|
||||
}
|
||||
|
||||
//! \brief ADF1
|
||||
//! ADF1
|
||||
static const QString &NameAdf1()
|
||||
{
|
||||
static QString n("ADF1");
|
||||
return n;
|
||||
}
|
||||
|
||||
//! \brief ADF2
|
||||
//! ADF2
|
||||
static const QString &NameAdf2()
|
||||
{
|
||||
static QString n("ADF2");
|
||||
return n;
|
||||
}
|
||||
|
||||
//! \brief Frequency not set
|
||||
//! Frequency not set
|
||||
static const BlackMisc::PhysicalQuantities::CFrequency &FrequencyNotSet()
|
||||
{
|
||||
static BlackMisc::PhysicalQuantities::CFrequency f;
|
||||
@@ -158,72 +223,14 @@ namespace BlackMisc
|
||||
//! \copydoc CValueObject::getValueHash()
|
||||
virtual uint getValueHash() const override;
|
||||
|
||||
public:
|
||||
//! \brief Virtual destructor
|
||||
virtual ~CModulator() {}
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CModulator)
|
||||
BlackMisc::PhysicalQuantities::CFrequency m_frequencyActive; //!< active frequency
|
||||
BlackMisc::PhysicalQuantities::CFrequency m_frequencyStandby; //!< standby frequency
|
||||
qint32 m_volumeInput; //!< volume input
|
||||
qint32 m_volumeOutput; //!< volume output
|
||||
bool m_enabled; //!< is enabled, used e.g. for mute etc.
|
||||
|
||||
//! \brief Default value?
|
||||
virtual bool isDefaultValue() const
|
||||
{
|
||||
return this->m_frequencyActive == CModulator::FrequencyNotSet();
|
||||
}
|
||||
|
||||
//! \brief Toggle active and standby frequencies
|
||||
void toggleActiveStandby();
|
||||
|
||||
//! \brief Active frequency
|
||||
BlackMisc::PhysicalQuantities::CFrequency getFrequencyActive() const
|
||||
{
|
||||
return this->m_frequencyActive;
|
||||
}
|
||||
|
||||
//! \brief Standby frequency
|
||||
BlackMisc::PhysicalQuantities::CFrequency getFrequencyStandby() const
|
||||
{
|
||||
return this->m_frequencyStandby;
|
||||
}
|
||||
|
||||
//! \brief Set active frequency
|
||||
void setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||
{
|
||||
this->m_frequencyActive = frequency;
|
||||
}
|
||||
|
||||
//! \brief Set standby frequency
|
||||
void setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||
{
|
||||
this->m_frequencyStandby = frequency;
|
||||
}
|
||||
|
||||
//! \brief Output volume
|
||||
qint32 getVolumeOutput() const { return this->m_volumeOutput; }
|
||||
|
||||
//! \brief Input volume
|
||||
qint32 getVolumeInput() const { return this->m_volumeInput; }
|
||||
|
||||
//! \brief Output volume
|
||||
void setVolumeOutput(qint32 volume) { this->m_volumeOutput = volume; }
|
||||
|
||||
//! \brief Input volume
|
||||
void setVolumeInput(qint32 volume) { this->m_volumeInput = volume; }
|
||||
|
||||
//! \brief Enabled?
|
||||
bool isEnabled() const { return this->m_enabled;}
|
||||
|
||||
//! \brief Enabled?
|
||||
void setEnabled(bool enable) { this->m_enabled = enable;}
|
||||
|
||||
//! \copydoc CValueObject::toJson
|
||||
virtual QJsonObject toJson() const override;
|
||||
|
||||
//! \copydoc CValueObject::fromJson
|
||||
virtual void fromJson(const QJsonObject &json) override;
|
||||
|
||||
//! \brief Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
//! \brief Members
|
||||
static const QStringList &jsonMembers();
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user