mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Ref T609, added send/receive flags for COM unit
This commit is contained in:
@@ -28,75 +28,87 @@ namespace BlackMisc
|
|||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
void CModulator<AVIO>::toggleActiveStandby()
|
void CModulator<AVIO>::toggleActiveStandby()
|
||||||
{
|
{
|
||||||
const CFrequency a = this->m_frequencyActive;
|
const CFrequency a = m_frequencyActive;
|
||||||
this->m_frequencyActive = this->m_frequencyStandby;
|
m_frequencyActive = m_frequencyStandby;
|
||||||
this->m_frequencyStandby = a;
|
m_frequencyStandby = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
BlackMisc::PhysicalQuantities::CFrequency CModulator<AVIO>::getFrequencyActive() const
|
BlackMisc::PhysicalQuantities::CFrequency CModulator<AVIO>::getFrequencyActive() const
|
||||||
{
|
{
|
||||||
return this->m_frequencyActive;
|
return m_frequencyActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
BlackMisc::PhysicalQuantities::CFrequency CModulator<AVIO>::getFrequencyStandby() const
|
BlackMisc::PhysicalQuantities::CFrequency CModulator<AVIO>::getFrequencyStandby() const
|
||||||
{
|
{
|
||||||
return this->m_frequencyStandby;
|
return m_frequencyStandby;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
void CModulator<AVIO>::setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
void CModulator<AVIO>::setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||||
{
|
{
|
||||||
this->m_frequencyActive = frequency;
|
m_frequencyActive = frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
void CModulator<AVIO>::setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
void CModulator<AVIO>::setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||||
{
|
{
|
||||||
this->m_frequencyStandby = frequency;
|
m_frequencyStandby = frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
int CModulator<AVIO>::getVolumeOutput() const
|
int CModulator<AVIO>::getVolumeOutput() const
|
||||||
{
|
{
|
||||||
return this->m_volumeOutput;
|
return m_volumeOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
int CModulator<AVIO>::getVolumeInput() const
|
int CModulator<AVIO>::getVolumeInput() const
|
||||||
{
|
{
|
||||||
return this->m_volumeInput;
|
return m_volumeInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
void CModulator<AVIO>::setVolumeOutput(int volume)
|
void CModulator<AVIO>::setVolumeOutput(int volume)
|
||||||
{
|
{
|
||||||
this->m_volumeOutput = volume;
|
m_volumeOutput = volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
void CModulator<AVIO>::setVolumeInput(int volume)
|
void CModulator<AVIO>::setVolumeInput(int volume)
|
||||||
{
|
{
|
||||||
this->m_volumeInput = volume;
|
m_volumeInput = volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
bool CModulator<AVIO>::isEnabled() const
|
bool CModulator<AVIO>::isSendEnabled() const
|
||||||
{
|
{
|
||||||
return this->m_enabled;
|
return m_sendEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class AVIO>
|
template<class AVIO>
|
||||||
void CModulator<AVIO>::setEnabled(bool enable)
|
bool CModulator<AVIO>::isReceiveEnabled() const
|
||||||
{
|
{
|
||||||
this->m_enabled = enable;
|
return m_receiveEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class AVIO>
|
||||||
|
void CModulator<AVIO>::setSendEnabled(bool enable)
|
||||||
|
{
|
||||||
|
m_sendEnabled = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class AVIO>
|
||||||
|
void CModulator<AVIO>::setReceiveEnabled(bool enable)
|
||||||
|
{
|
||||||
|
m_receiveEnabled = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
QString CModulator<AVIO>::getName() const
|
QString CModulator<AVIO>::getName() const
|
||||||
{
|
{
|
||||||
return this->m_name;
|
return m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
@@ -106,16 +118,12 @@ namespace BlackMisc
|
|||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexActiveFrequency:
|
case IndexActiveFrequency: return this->getFrequencyActive().propertyByIndex(index.copyFrontRemoved());
|
||||||
return this->getFrequencyActive().propertyByIndex(index.copyFrontRemoved());
|
case IndexStandbyFrequency: return this->getFrequencyStandby().propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexStandbyFrequency:
|
case IndexEnabledSend: return CVariant::from(this->isSendEnabled());
|
||||||
return this->getFrequencyStandby().propertyByIndex(index.copyFrontRemoved());
|
case IndexEnabledReceive: return CVariant::from(this->isReceiveEnabled());
|
||||||
case IndexEnabled:
|
case IndexInputVolume: return CVariant::from(this->getVolumeInput());
|
||||||
return CVariant::from(this->isEnabled());
|
case IndexOutputVolume: return CVariant::from(this->getVolumeOutput());
|
||||||
case IndexInputVolume:
|
|
||||||
return CVariant::from(this->getVolumeInput());
|
|
||||||
case IndexOutputVolume:
|
|
||||||
return CVariant::from(this->getVolumeOutput());
|
|
||||||
default:
|
default:
|
||||||
return CValueObject<CModulator<AVIO>>::propertyByIndex(index);
|
return CValueObject<CModulator<AVIO>>::propertyByIndex(index);
|
||||||
}
|
}
|
||||||
@@ -128,21 +136,12 @@ namespace BlackMisc
|
|||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexActiveFrequency:
|
case IndexActiveFrequency: m_frequencyActive.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
this->m_frequencyActive.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
case IndexStandbyFrequency: m_frequencyStandby.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
break;
|
case IndexEnabledSend: this->setSendEnabled(variant.toBool()); break;
|
||||||
case IndexStandbyFrequency:
|
case IndexEnabledReceive: this->setReceiveEnabled(variant.toBool()); break;
|
||||||
this->m_frequencyStandby.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
case IndexInputVolume: this->setVolumeInput(variant.toInt()); break;
|
||||||
break;
|
case IndexOutputVolume: this->setVolumeOutput(variant.toInt()); break;
|
||||||
case IndexEnabled:
|
|
||||||
this->setEnabled(variant.toBool());
|
|
||||||
break;
|
|
||||||
case IndexInputVolume:
|
|
||||||
this->setVolumeInput(variant.toInt());
|
|
||||||
break;
|
|
||||||
case IndexOutputVolume:
|
|
||||||
this->setVolumeOutput(variant.toInt());
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
CValueObject<CModulator<AVIO>>::setPropertyByIndex(index, variant);
|
CValueObject<CModulator<AVIO>>::setPropertyByIndex(index, variant);
|
||||||
break;
|
break;
|
||||||
@@ -152,22 +151,17 @@ namespace BlackMisc
|
|||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
int CModulator<AVIO>::comparePropertyByIndex(const CPropertyIndex &index, const AVIO &compareValue) const
|
int CModulator<AVIO>::comparePropertyByIndex(const CPropertyIndex &index, const AVIO &compareValue) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return this->m_frequencyActive.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.m_frequencyActive); }
|
if (index.isMyself()) { return m_frequencyActive.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.m_frequencyActive); }
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexActiveFrequency:
|
case IndexActiveFrequency: return m_frequencyActive.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.m_frequencyActive);
|
||||||
return this->m_frequencyActive.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.m_frequencyActive);
|
case IndexStandbyFrequency: return m_frequencyStandby.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.m_frequencyStandby);
|
||||||
case IndexStandbyFrequency:
|
case IndexEnabledSend: return Compare::compare(this->isSendEnabled(), compareValue.isSendEnabled());
|
||||||
return this->m_frequencyStandby.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.m_frequencyStandby);
|
case IndexEnabledReceive: return Compare::compare(this->isReceiveEnabled(), compareValue.isReceiveEnabled());
|
||||||
case IndexEnabled:
|
case IndexInputVolume: return Compare::compare(this->getVolumeInput(), compareValue.getVolumeInput());
|
||||||
return Compare::compare(this->isEnabled(), compareValue.isEnabled());
|
case IndexOutputVolume: return Compare::compare(this->getVolumeOutput(), compareValue.getVolumeOutput());
|
||||||
case IndexInputVolume:
|
default: break;
|
||||||
return Compare::compare(this->getVolumeInput(), compareValue.getVolumeInput());
|
|
||||||
case IndexOutputVolume:
|
|
||||||
return Compare::compare(this->getVolumeOutput(), compareValue.getVolumeOutput());
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Compare failed");
|
Q_ASSERT_X(false, Q_FUNC_INFO, "Compare failed");
|
||||||
return 0;
|
return 0;
|
||||||
@@ -190,21 +184,21 @@ namespace BlackMisc
|
|||||||
QString CModulator<AVIO>::convertToQString(bool i18n) const
|
QString CModulator<AVIO>::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
QString s(this->getName());
|
QString s(this->getName());
|
||||||
s.append(" Active: ").append(this->m_frequencyActive.valueRoundedWithUnit(3, i18n));
|
s.append(" Active: ").append(m_frequencyActive.valueRoundedWithUnit(3, i18n));
|
||||||
s.append(" Standby: ").append(this->m_frequencyStandby.valueRoundedWithUnit(3, i18n));
|
s.append(" Standby: ").append(m_frequencyStandby.valueRoundedWithUnit(3, i18n));
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
void CModulator<AVIO>::setFrequencyActiveKHz(double frequencyKHz)
|
void CModulator<AVIO>::setFrequencyActiveKHz(double frequencyKHz)
|
||||||
{
|
{
|
||||||
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
|
m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
void CModulator<AVIO>::setFrequencyStandbyKHz(double frequencyKHz)
|
void CModulator<AVIO>::setFrequencyStandbyKHz(double frequencyKHz)
|
||||||
{
|
{
|
||||||
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
|
m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ namespace BlackMisc
|
|||||||
IndexStandbyFrequency,
|
IndexStandbyFrequency,
|
||||||
IndexOutputVolume,
|
IndexOutputVolume,
|
||||||
IndexInputVolume,
|
IndexInputVolume,
|
||||||
IndexEnabled
|
IndexEnabledSend,
|
||||||
|
IndexEnabledReceive
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Toggle active and standby frequencies
|
//! Toggle active and standby frequencies
|
||||||
@@ -57,10 +58,16 @@ namespace BlackMisc
|
|||||||
QString getName() const;
|
QString getName() const;
|
||||||
|
|
||||||
//! Enabled?
|
//! Enabled?
|
||||||
bool isEnabled() const;
|
bool isSendEnabled() const;
|
||||||
|
|
||||||
//! Enabled?
|
//! Enabled?
|
||||||
void setEnabled(bool enable);
|
bool isReceiveEnabled() const;
|
||||||
|
|
||||||
|
//! Enabled?
|
||||||
|
void setSendEnabled(bool enable);
|
||||||
|
|
||||||
|
//! Enabled?
|
||||||
|
void setReceiveEnabled(bool enable);
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||||
@@ -123,7 +130,8 @@ namespace BlackMisc
|
|||||||
BlackMisc::PhysicalQuantities::CFrequency m_frequencyStandby; //!< standby frequency
|
BlackMisc::PhysicalQuantities::CFrequency m_frequencyStandby; //!< standby frequency
|
||||||
int m_volumeInput = 0; //!< volume input
|
int m_volumeInput = 0; //!< volume input
|
||||||
int m_volumeOutput = 0; //!< volume output
|
int m_volumeOutput = 0; //!< volume output
|
||||||
bool m_enabled = true; //!< is enabled, used e.g. for mute etc.
|
bool m_sendEnabled = true; //!< is enabled, used e.g. for mute etc.
|
||||||
|
bool m_receiveEnabled = 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
|
AVIO const *derived() const
|
||||||
@@ -144,7 +152,8 @@ namespace BlackMisc
|
|||||||
BLACK_METAMEMBER(frequencyStandby),
|
BLACK_METAMEMBER(frequencyStandby),
|
||||||
BLACK_METAMEMBER(volumeInput),
|
BLACK_METAMEMBER(volumeInput),
|
||||||
BLACK_METAMEMBER(volumeOutput),
|
BLACK_METAMEMBER(volumeOutput),
|
||||||
BLACK_METAMEMBER(enabled)
|
BLACK_METAMEMBER(sendEnabled),
|
||||||
|
BLACK_METAMEMBER(receiveEnabled)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user