mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 09:45:44 +08:00
refs #403, #411 Klaus reverted part of the shared libs changes (commit:4aa5f806) during rebase, so I reverted the reversion.
This commit is contained in:
@@ -23,6 +23,12 @@ namespace BlackMisc
|
|||||||
namespace Aviation
|
namespace Aviation
|
||||||
{
|
{
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
bool CModulator<AVIO>::isDefaultValue() const
|
||||||
|
{
|
||||||
|
return (this->m_frequencyActive == FrequencyNotSet());
|
||||||
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
void CModulator<AVIO>::toggleActiveStandby()
|
void CModulator<AVIO>::toggleActiveStandby()
|
||||||
{
|
{
|
||||||
@@ -31,6 +37,72 @@ namespace BlackMisc
|
|||||||
this->m_frequencyStandby = a;
|
this->m_frequencyStandby = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
BlackMisc::PhysicalQuantities::CFrequency CModulator<AVIO>::getFrequencyActive() const
|
||||||
|
{
|
||||||
|
return this->m_frequencyActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
BlackMisc::PhysicalQuantities::CFrequency CModulator<AVIO>::getFrequencyStandby() const
|
||||||
|
{
|
||||||
|
return this->m_frequencyStandby;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
void CModulator<AVIO>::setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||||
|
{
|
||||||
|
this->m_frequencyActive = frequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
void CModulator<AVIO>::setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||||
|
{
|
||||||
|
this->m_frequencyStandby = frequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
qint32 CModulator<AVIO>::getVolumeOutput() const
|
||||||
|
{
|
||||||
|
return this->m_volumeOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
qint32 CModulator<AVIO>::getVolumeInput() const
|
||||||
|
{
|
||||||
|
return this->m_volumeInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
void CModulator<AVIO>::setVolumeOutput(qint32 volume)
|
||||||
|
{
|
||||||
|
this->m_volumeOutput = volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
void CModulator<AVIO>::setVolumeInput(qint32 volume)
|
||||||
|
{
|
||||||
|
this->m_volumeInput = volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
bool CModulator<AVIO>::isEnabled() const
|
||||||
|
{
|
||||||
|
return this->m_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
void CModulator<AVIO>::setEnabled(bool enable)
|
||||||
|
{
|
||||||
|
this->m_enabled = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
QString CModulator<AVIO>::getName() const
|
||||||
|
{
|
||||||
|
return this->m_name;
|
||||||
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
CVariant CModulator<AVIO>::propertyByIndex(const CPropertyIndex &index) const
|
CVariant CModulator<AVIO>::propertyByIndex(const CPropertyIndex &index) const
|
||||||
{
|
{
|
||||||
@@ -85,6 +157,14 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
CModulator<AVIO>::CModulator() :
|
||||||
|
m_name("default") {}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
CModulator<AVIO>::CModulator(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency) :
|
||||||
|
m_name(name), m_frequencyActive(activeFrequency), m_frequencyStandby(standbyFrequency) {}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
QString CModulator<AVIO>::convertToQString(bool i18n) const
|
QString CModulator<AVIO>::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
@@ -94,6 +174,108 @@ namespace BlackMisc
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
void CModulator<AVIO>::setFrequencyActiveKHz(double frequencyKHz)
|
||||||
|
{
|
||||||
|
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
void CModulator<AVIO>::setFrequencyStandbyKHz(double frequencyKHz)
|
||||||
|
{
|
||||||
|
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
void CModulator<AVIO>::setFrequencyActiveMHz(double frequencyMHz)
|
||||||
|
{
|
||||||
|
frequencyMHz = Math::CMathUtils::round(frequencyMHz, 3);
|
||||||
|
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
void CModulator<AVIO>::setFrequencyStandbyMHz(double frequencyMHz)
|
||||||
|
{
|
||||||
|
frequencyMHz = Math::CMathUtils::round(frequencyMHz, 3);
|
||||||
|
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
const QString &CModulator<AVIO>::NameCom1()
|
||||||
|
{
|
||||||
|
static QString n("COM1");
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
const QString &CModulator<AVIO>::NameCom2()
|
||||||
|
{
|
||||||
|
static QString n("COM2");
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
const QString &CModulator<AVIO>::NameCom3()
|
||||||
|
{
|
||||||
|
static QString n("COM3");
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
const QString &CModulator<AVIO>::NameNav1()
|
||||||
|
{
|
||||||
|
static QString n("NAV1");
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
const QString &CModulator<AVIO>::NameNav2()
|
||||||
|
{
|
||||||
|
static QString n("NAV2");
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
const QString &CModulator<AVIO>::NameNav3()
|
||||||
|
{
|
||||||
|
static QString n("NAV3");
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
const QString &CModulator<AVIO>::NameAdf1()
|
||||||
|
{
|
||||||
|
static QString n("ADF1");
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
const QString &CModulator<AVIO>::NameAdf2()
|
||||||
|
{
|
||||||
|
static QString n("ADF2");
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
const BlackMisc::PhysicalQuantities::CFrequency &CModulator<AVIO>::FrequencyNotSet()
|
||||||
|
{
|
||||||
|
static BlackMisc::PhysicalQuantities::CFrequency f;
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
AVIO const *CModulator<AVIO>::derived() const
|
||||||
|
{
|
||||||
|
return static_cast<AVIO const *>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
AVIO *CModulator<AVIO>::derived()
|
||||||
|
{
|
||||||
|
return static_cast<AVIO *>(this);
|
||||||
|
}
|
||||||
|
|
||||||
// see here for the reason of thess forward instantiations
|
// see here for the reason of thess forward instantiations
|
||||||
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
||||||
template class CModulator<CComSystem>;
|
template class CModulator<CComSystem>;
|
||||||
|
|||||||
@@ -38,58 +38,43 @@ namespace BlackMisc
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Default value?
|
//! Default value?
|
||||||
virtual bool isDefaultValue() const
|
virtual bool isDefaultValue() const;
|
||||||
{
|
|
||||||
return (this->m_frequencyActive == FrequencyNotSet());
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Toggle active and standby frequencies
|
//! Toggle active and standby frequencies
|
||||||
void toggleActiveStandby();
|
void toggleActiveStandby();
|
||||||
|
|
||||||
//! Active frequency
|
//! Active frequency
|
||||||
BlackMisc::PhysicalQuantities::CFrequency getFrequencyActive() const
|
BlackMisc::PhysicalQuantities::CFrequency getFrequencyActive() const;
|
||||||
{
|
|
||||||
return this->m_frequencyActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Standby frequency
|
//! Standby frequency
|
||||||
BlackMisc::PhysicalQuantities::CFrequency getFrequencyStandby() const
|
BlackMisc::PhysicalQuantities::CFrequency getFrequencyStandby() const;
|
||||||
{
|
|
||||||
return this->m_frequencyStandby;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Set active frequency
|
//! Set active frequency
|
||||||
virtual void setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
virtual void setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency);
|
||||||
{
|
|
||||||
this->m_frequencyActive = frequency;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Set standby frequency
|
//! Set standby frequency
|
||||||
virtual void setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
virtual void setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency);
|
||||||
{
|
|
||||||
this->m_frequencyStandby = frequency;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Output volume 0..100
|
//! Output volume 0..100
|
||||||
int getVolumeOutput() const { return this->m_volumeOutput; }
|
qint32 getVolumeOutput() const;
|
||||||
|
|
||||||
//! Input volume 0..100
|
//! Input volume 0..100
|
||||||
int getVolumeInput() const { return this->m_volumeInput; }
|
qint32 getVolumeInput() const;
|
||||||
|
|
||||||
//! Output volume 0.100
|
//! Output volume 0.100
|
||||||
void setVolumeOutput(int volume) { this->m_volumeOutput = volume; }
|
void setVolumeOutput(qint32 volume);
|
||||||
|
|
||||||
//! Input volume 0..100
|
//! Input volume 0..100
|
||||||
void setVolumeInput(int volume) { this->m_volumeInput = volume; }
|
void setVolumeInput(qint32 volume);
|
||||||
|
|
||||||
//! Name
|
//! Name
|
||||||
QString getName() const { return this->m_name; }
|
QString getName() const;
|
||||||
|
|
||||||
//! Enabled?
|
//! Enabled?
|
||||||
bool isEnabled() const { return this->m_enabled;}
|
bool isEnabled() const;
|
||||||
|
|
||||||
//! Enabled?
|
//! Enabled?
|
||||||
void setEnabled(bool enable) { this->m_enabled = enable;}
|
void setEnabled(bool enable);
|
||||||
|
|
||||||
//! Are set values valid?
|
//! Are set values valid?
|
||||||
virtual bool validValues() const { return true; }
|
virtual bool validValues() const { return true; }
|
||||||
@@ -105,100 +90,49 @@ namespace BlackMisc
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
CModulator() : m_name("default") {}
|
CModulator();
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CModulator(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency) :
|
CModulator(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency);
|
||||||
m_name(name), m_frequencyActive(activeFrequency), m_frequencyStandby(standbyFrequency) {}
|
|
||||||
|
|
||||||
//! Set active frequency
|
//! Set active frequency
|
||||||
void setFrequencyActiveKHz(double frequencyKHz)
|
void setFrequencyActiveKHz(double frequencyKHz);
|
||||||
{
|
|
||||||
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Set standby frequency
|
//! Set standby frequency
|
||||||
void setFrequencyStandbyKHz(double frequencyKHz)
|
void setFrequencyStandbyKHz(double frequencyKHz);
|
||||||
{
|
|
||||||
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Set active frequency
|
//! Set active frequency
|
||||||
virtual void setFrequencyActiveMHz(double frequencyMHz)
|
virtual void setFrequencyActiveMHz(double frequencyMHz);
|
||||||
{
|
|
||||||
frequencyMHz = Math::CMathUtils::round(frequencyMHz, 3);
|
|
||||||
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Set standby frequency
|
//! Set standby frequency
|
||||||
virtual void setFrequencyStandbyMHz(double frequencyMHz)
|
virtual void setFrequencyStandbyMHz(double frequencyMHz);
|
||||||
{
|
|
||||||
frequencyMHz = Math::CMathUtils::round(frequencyMHz, 3);
|
|
||||||
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
|
|
||||||
}
|
|
||||||
|
|
||||||
//! COM1
|
//! COM1
|
||||||
static const QString &NameCom1()
|
static const QString &NameCom1();
|
||||||
{
|
|
||||||
static const QString n("COM1");
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! COM2
|
//! COM2
|
||||||
static const QString &NameCom2()
|
static const QString &NameCom2();
|
||||||
{
|
|
||||||
static const QString n("COM2");
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! COM3
|
//! COM3
|
||||||
static const QString &NameCom3()
|
static const QString &NameCom3();
|
||||||
{
|
|
||||||
static const QString n("COM3");
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! NAV1
|
//! NAV1
|
||||||
static const QString &NameNav1()
|
static const QString &NameNav1();
|
||||||
{
|
|
||||||
static const QString n("NAV1");
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! NAV2
|
//! NAV2
|
||||||
static const QString &NameNav2()
|
static const QString &NameNav2();
|
||||||
{
|
|
||||||
static const QString n("NAV2");
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! NAV3
|
//! NAV3
|
||||||
static const QString &NameNav3()
|
static const QString &NameNav3();
|
||||||
{
|
|
||||||
static const QString n("NAV3");
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! ADF1
|
//! ADF1
|
||||||
static const QString &NameAdf1()
|
static const QString &NameAdf1();
|
||||||
{
|
|
||||||
static QString n("ADF1");
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! ADF2
|
//! ADF2
|
||||||
static const QString &NameAdf2()
|
static const QString &NameAdf2();
|
||||||
{
|
|
||||||
static QString n("ADF2");
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Frequency not set
|
//! Frequency not set
|
||||||
static const BlackMisc::PhysicalQuantities::CFrequency &FrequencyNotSet()
|
static const BlackMisc::PhysicalQuantities::CFrequency &FrequencyNotSet();
|
||||||
{
|
|
||||||
static const BlackMisc::PhysicalQuantities::CFrequency f(0, BlackMisc::PhysicalQuantities::CFrequencyUnit::nullUnit());
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BLACK_ENABLE_TUPLE_CONVERSION(CModulator)
|
BLACK_ENABLE_TUPLE_CONVERSION(CModulator)
|
||||||
@@ -210,11 +144,10 @@ namespace BlackMisc
|
|||||||
bool m_enabled = true; //!< is enabled, used e.g. for mute etc.
|
bool m_enabled = true; //!< is enabled, used e.g. for mute etc.
|
||||||
|
|
||||||
//! Easy access to derived class (CRTP template parameter)
|
//! Easy access to derived class (CRTP template parameter)
|
||||||
AVIO const *derived() const { return static_cast<AVIO const *>(this); }
|
AVIO const *derived() const;
|
||||||
|
|
||||||
//! Easy access to derived class (CRTP template parameter)
|
//! Easy access to derived class (CRTP template parameter)
|
||||||
AVIO *derived() { return static_cast<AVIO *>(this); }
|
AVIO *derived();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! \cond PRIVATE
|
//! \cond PRIVATE
|
||||||
|
|||||||
Reference in New Issue
Block a user