1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

FCDPro: Make settings assignments atomic. Part of #1329

This commit is contained in:
f4exb 2022-10-23 02:07:59 +02:00
parent 1f7f2085fd
commit c4e963a307
6 changed files with 296 additions and 110 deletions

View File

@ -211,7 +211,13 @@ bool FCDProGui::handleMessage(const Message& message)
if (FCDProInput::MsgConfigureFCDPro::match(message))
{
const FCDProInput::MsgConfigureFCDPro& cfg = (FCDProInput::MsgConfigureFCDPro&) message;
if (cfg.getForce()) {
m_settings = cfg.getSettings();
} else {
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
}
blockApplySettings(true);
displaySettings();
blockApplySettings(false);
@ -330,6 +336,7 @@ void FCDProGui::sendSettings()
void FCDProGui::on_centerFrequency_changed(quint64 value)
{
m_settings.m_centerFrequency = value * 1000;
m_settingsKeys.append("centerFrequency");
sendSettings();
}
@ -337,114 +344,133 @@ void FCDProGui::on_ppm_valueChanged(int value)
{
m_settings.m_LOppmTenths = value;
displaySettings();
m_settingsKeys.append("LOppmTenths");
sendSettings();
}
void FCDProGui::on_dcOffset_toggled(bool checked)
{
m_settings.m_dcBlock = checked;
m_settingsKeys.append("dcBlock");
sendSettings();
}
void FCDProGui::on_iqImbalance_toggled(bool checked)
{
m_settings.m_iqCorrection = checked;
m_settingsKeys.append("iqCorrection");
sendSettings();
}
void FCDProGui::on_lnaGain_currentIndexChanged(int index)
{
m_settings.m_lnaGainIndex = index;
m_settingsKeys.append("lnaGainIndex");
sendSettings();
}
void FCDProGui::on_rfFilter_currentIndexChanged(int index)
{
m_settings.m_rfFilterIndex = index;
m_settingsKeys.append("rfFilterIndex");
sendSettings();
}
void FCDProGui::on_lnaEnhance_currentIndexChanged(int index)
{
m_settings.m_lnaEnhanceIndex = index;
m_settingsKeys.append("lnaEnhanceIndex");
sendSettings();
}
void FCDProGui::on_band_currentIndexChanged(int index)
{
m_settings.m_bandIndex = index;
m_settingsKeys.append("bandIndex");
sendSettings();
}
void FCDProGui::on_mixGain_currentIndexChanged(int index)
{
m_settings.m_mixerGainIndex = index;
m_settingsKeys.append("mixerGainIndex");
sendSettings();
}
void FCDProGui::on_mixFilter_currentIndexChanged(int index)
{
m_settings.m_mixerFilterIndex = index;
m_settingsKeys.append("mixerFilterIndex");
sendSettings();
}
void FCDProGui::on_bias_currentIndexChanged(int index)
{
m_settings.m_biasCurrentIndex = index;
m_settingsKeys.append("biasCurrentIndex");
sendSettings();
}
void FCDProGui::on_mode_currentIndexChanged(int index)
{
m_settings.m_modeIndex = index;
m_settingsKeys.append("modeIndex");
sendSettings();
}
void FCDProGui::on_gain1_currentIndexChanged(int index)
{
m_settings.m_gain1Index = index;
m_settingsKeys.append("gain1Index");
sendSettings();
}
void FCDProGui::on_rcFilter_currentIndexChanged(int index)
{
m_settings.m_rcFilterIndex = index;
m_settingsKeys.append("rcFilterIndex");
sendSettings();
}
void FCDProGui::on_gain2_currentIndexChanged(int index)
{
m_settings.m_gain2Index = index;
m_settingsKeys.append("gain2Index");
sendSettings();
}
void FCDProGui::on_gain3_currentIndexChanged(int index)
{
m_settings.m_gain3Index = index;
m_settingsKeys.append("gain3Index");
sendSettings();
}
void FCDProGui::on_gain4_currentIndexChanged(int index)
{
m_settings.m_gain4Index = index;
m_settingsKeys.append("gain4Index");
sendSettings();
}
void FCDProGui::on_ifFilter_currentIndexChanged(int index)
{
m_settings.m_ifFilterIndex = index;
m_settingsKeys.append("ifFilterIndex");
sendSettings();
}
void FCDProGui::on_gain5_currentIndexChanged(int index)
{
m_settings.m_gain5Index = index;
m_settingsKeys.append("gain5Index");
sendSettings();
}
void FCDProGui::on_gain6_currentIndexChanged(int index)
{
m_settings.m_gain6Index = index;
m_settingsKeys.append("gain6Index");
sendSettings();
}
@ -455,6 +481,7 @@ void FCDProGui::on_decim_currentIndexChanged(int index)
}
m_settings.m_log2Decim = index;
m_settingsKeys.append("log2Decim");
sendSettings();
}
@ -490,6 +517,20 @@ void FCDProGui::on_setDefaults_clicked(bool checked)
m_settings.m_lnaEnhanceIndex = 0; // Off
m_settings.m_biasCurrentIndex = 3; // V/U band
m_settings.m_modeIndex = 0; // Linearity
m_settingsKeys.append("lnaGainIndex");
m_settingsKeys.append("mixerGainIndex");
m_settingsKeys.append("mixerFilterIndex");
m_settingsKeys.append("gain1Index");
m_settingsKeys.append("rcFilterIndex");
m_settingsKeys.append("gain2Index");
m_settingsKeys.append("gain3Index");
m_settingsKeys.append("gain4Index");
m_settingsKeys.append("ifFilterIndex");
m_settingsKeys.append("gain5Index");
m_settingsKeys.append("gain6Index");
m_settingsKeys.append("lnaEnhanceIndex");
m_settingsKeys.append("biasCurrentIndex");
m_settingsKeys.append("modeIndex");
displaySettings();
sendSettings();
}
@ -511,6 +552,9 @@ void FCDProGui::on_transverter_clicked()
qDebug("FCDProGui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
updateFrequencyLimits();
m_settings.m_centerFrequency = ui->centerFrequency->getValueNew()*1000;
m_settingsKeys.append("transverterMode");
m_settingsKeys.append("transverterDeltaFrequency");
m_settingsKeys.append("iqOrder");
sendSettings();
}
@ -545,9 +589,10 @@ void FCDProGui::updateStatus()
void FCDProGui::updateHardware()
{
FCDProInput::MsgConfigureFCDPro* message = FCDProInput::MsgConfigureFCDPro::create(m_settings, m_forceSettings);
FCDProInput::MsgConfigureFCDPro* message = FCDProInput::MsgConfigureFCDPro::create(m_settings, m_settingsKeys, m_forceSettings);
m_sampleSource->getInputMessageQueue()->push(message);
m_forceSettings = false;
m_settingsKeys.clear();
m_updateTimer.stop();
}

View File

@ -52,6 +52,7 @@ private:
bool m_doApplySettings;
bool m_forceSettings;
FCDProSettings m_settings;
QList<QString> m_settingsKeys;
QTimer m_updateTimer;
QTimer m_statusTimer;
std::vector<int> m_gains;

View File

@ -111,7 +111,7 @@ bool FCDProInput::openDevice()
void FCDProInput::init()
{
applySettings(m_settings, true);
applySettings(m_settings, QList<QString>(), true);
}
bool FCDProInput::start()
@ -146,7 +146,7 @@ bool FCDProInput::start()
m_FCDThread->startWork();
// mutexLocker.unlock();
applySettings(m_settings, true);
applySettings(m_settings, QList<QString>(), true);
qDebug("FCDProInput::started");
m_running = true;
@ -225,12 +225,12 @@ bool FCDProInput::deserialize(const QByteArray& data)
success = false;
}
MsgConfigureFCDPro* message = MsgConfigureFCDPro::create(m_settings, true);
MsgConfigureFCDPro* message = MsgConfigureFCDPro::create(m_settings, QList<QString>(), true);
m_inputMessageQueue.push(message);
if (m_guiMessageQueue)
{
MsgConfigureFCDPro* messageToGUI = MsgConfigureFCDPro::create(m_settings, true);
MsgConfigureFCDPro* messageToGUI = MsgConfigureFCDPro::create(m_settings, QList<QString>(), true);
m_guiMessageQueue->push(messageToGUI);
}
@ -257,12 +257,12 @@ void FCDProInput::setCenterFrequency(qint64 centerFrequency)
FCDProSettings settings = m_settings;
settings.m_centerFrequency = centerFrequency;
MsgConfigureFCDPro* message = MsgConfigureFCDPro::create(settings, false);
MsgConfigureFCDPro* message = MsgConfigureFCDPro::create(settings, QList<QString>{"centerFrequency"}, false);
m_inputMessageQueue.push(message);
if (m_guiMessageQueue)
{
MsgConfigureFCDPro* messageToGUI = MsgConfigureFCDPro::create(settings, false);
MsgConfigureFCDPro* messageToGUI = MsgConfigureFCDPro::create(settings, QList<QString>{"centerFrequency"}, false);
m_guiMessageQueue->push(messageToGUI);
}
}
@ -273,7 +273,7 @@ bool FCDProInput::handleMessage(const Message& message)
{
qDebug() << "FCDProInput::handleMessage: MsgConfigureFCD";
MsgConfigureFCDPro& conf = (MsgConfigureFCDPro&) message;
applySettings(conf.getSettings(), conf.getForce());
applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
return true;
}
else if (MsgStartStop::match(message))
@ -283,8 +283,7 @@ bool FCDProInput::handleMessage(const Message& message)
if (cmd.getStartStop())
{
if (m_deviceAPI->initDeviceEngine())
{
if (m_deviceAPI->initDeviceEngine()) {
m_deviceAPI->startDeviceEngine();
}
}
@ -305,30 +304,17 @@ bool FCDProInput::handleMessage(const Message& message)
}
}
void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
void FCDProInput::applySettings(const FCDProSettings& settings, const QList<QString>& settingsKeys, bool force)
{
qDebug() << "FCDProInput::applySettings: force: " << force << settings.getDebugString(settingsKeys, force);
bool forwardChange = false;
QList<QString> reverseAPIKeys;
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)) {
reverseAPIKeys.append("centerFrequency");
}
if (force || (m_settings.m_transverterMode != settings.m_transverterMode)) {
reverseAPIKeys.append("transverterMode");
}
if (force || (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)) {
reverseAPIKeys.append("transverterDeltaFrequency");
}
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) {
reverseAPIKeys.append("LOppmTenths");
}
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_log2Decim != settings.m_log2Decim)
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
if (force || settingsKeys.contains("centerFrequency")
|| settingsKeys.contains("LOppmTenths")
|| settingsKeys.contains("fcPos")
|| settingsKeys.contains("log2Decim")
|| settingsKeys.contains("transverterMode")
|| settingsKeys.contains("transverterDeltaFrequency"))
{
qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency(
settings.m_centerFrequency,
@ -339,8 +325,7 @@ void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
DeviceSampleSource::FrequencyShiftScheme::FSHIFT_STD,
settings.m_transverterMode);
if (m_dev != 0)
{
if (m_dev != 0) {
set_center_freq((double) deviceCenterFrequency);
}
@ -352,9 +337,8 @@ void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
m_settings.m_centerFrequency = settings.m_centerFrequency;
}
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
if (settingsKeys.contains("log2Decim") || force)
{
reverseAPIKeys.append("log2Decim");
forwardChange = true;
if (m_FCDThread)
@ -364,10 +348,8 @@ void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
}
}
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
if (settingsKeys.contains("fcPos") || force)
{
reverseAPIKeys.append("fcPos");
if (m_FCDThread) {
m_FCDThread->setFcPos((int) settings.m_fcPos);
}
@ -375,10 +357,8 @@ void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
qDebug() << "FCDProInput::applySettings: set fc pos (enum) to " << (int) settings.m_fcPos;
}
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
if (settingsKeys.contains("iqOrder") || force)
{
reverseAPIKeys.append("iqOrder");
if (m_FCDThread) {
m_FCDThread->setIQOrder((int) settings.m_iqOrder);
}
@ -386,172 +366,142 @@ void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
qDebug() << "FCDProInput::applySettings: set IQ order to %s" << (settings.m_iqOrder ? "IQ" : "QI");
}
if ((m_settings.m_lnaGainIndex != settings.m_lnaGainIndex) || force)
if (settingsKeys.contains("lnaGainIndex") || force)
{
reverseAPIKeys.append("lnaGainIndex");
if (m_dev != 0) {
set_lnaGain(settings.m_lnaGainIndex);
}
}
if ((m_settings.m_rfFilterIndex != settings.m_rfFilterIndex) || force)
if (settingsKeys.contains("rfFilterIndex") || force)
{
reverseAPIKeys.append("rfFilterIndex");
if (m_dev != 0) {
set_rfFilter(settings.m_rfFilterIndex);
}
}
if ((m_settings.m_lnaEnhanceIndex != settings.m_lnaEnhanceIndex) || force)
if (settingsKeys.contains("lnaEnhanceIndex") || force)
{
reverseAPIKeys.append("lnaEnhanceIndex");
if (m_dev != 0) {
set_lnaEnhance(settings.m_lnaEnhanceIndex);
}
}
if ((m_settings.m_bandIndex != settings.m_bandIndex) || force)
if (settingsKeys.contains("bandIndex") || force)
{
reverseAPIKeys.append("bandIndex");
if (m_dev != 0) {
set_band(settings.m_bandIndex);
}
}
if ((m_settings.m_mixerGainIndex != settings.m_mixerGainIndex) || force)
if (settingsKeys.contains("mixerGainIndex") || force)
{
reverseAPIKeys.append("mixerGainIndex");
if (m_dev != 0) {
set_mixerGain(settings.m_mixerGainIndex);
}
}
if ((m_settings.m_mixerFilterIndex != settings.m_mixerFilterIndex) || force)
if (settingsKeys.contains("mixerFilterIndex") || force)
{
reverseAPIKeys.append("mixerFilterIndex");
if (m_dev != 0) {
set_mixerFilter(settings.m_mixerFilterIndex);
}
}
if ((m_settings.m_biasCurrentIndex != settings.m_biasCurrentIndex) || force)
if (settingsKeys.contains("biasCurrentIndex") || force)
{
reverseAPIKeys.append("biasCurrentIndex");
if (m_dev != 0) {
set_biasCurrent(settings.m_biasCurrentIndex);
}
}
if ((m_settings.m_modeIndex != settings.m_modeIndex) || force)
if (settingsKeys.contains("modeIndex") || force)
{
reverseAPIKeys.append("modeIndex");
if (m_dev != 0) {
set_mode(settings.m_modeIndex);
}
}
if ((m_settings.m_gain1Index != settings.m_gain1Index) || force)
if (settingsKeys.contains("gain1Index") || force)
{
reverseAPIKeys.append("gain1Index");
if (m_dev != 0) {
set_gain1(settings.m_gain1Index);
}
}
if ((m_settings.m_rcFilterIndex != settings.m_rcFilterIndex) || force)
if (settingsKeys.contains("rcFilterIndex") || force)
{
reverseAPIKeys.append("rcFilterIndex");
if (m_dev != 0) {
set_rcFilter(settings.m_rcFilterIndex);
}
}
if ((m_settings.m_gain2Index != settings.m_gain2Index) || force)
if (settingsKeys.contains("gain2Index") || force)
{
reverseAPIKeys.append("gain2Index");
if (m_dev != 0) {
set_gain2(settings.m_gain2Index);
}
}
if ((m_settings.m_gain3Index != settings.m_gain3Index) || force)
if (settingsKeys.contains("gain3Index") || force)
{
reverseAPIKeys.append("gain3Index");
if (m_dev != 0) {
set_gain3(settings.m_gain3Index);
}
}
if ((m_settings.m_gain4Index != settings.m_gain4Index) || force)
if (settingsKeys.contains("gain4Index") || force)
{
reverseAPIKeys.append("gain4Index");
if (m_dev != 0) {
set_gain4(settings.m_gain4Index);
}
}
if ((m_settings.m_ifFilterIndex != settings.m_ifFilterIndex) || force)
if (settingsKeys.contains("ifFilterIndex") || force)
{
reverseAPIKeys.append("ifFilterIndex");
if (m_dev != 0) {
set_ifFilter(settings.m_ifFilterIndex);
}
}
if ((m_settings.m_gain5Index != settings.m_gain5Index) || force)
if (settingsKeys.contains("gain5Index") || force)
{
reverseAPIKeys.append("gain5Index");
if (m_dev != 0) {
set_gain5(settings.m_gain5Index);
}
}
if ((m_settings.m_gain6Index != settings.m_gain6Index) || force)
if (settingsKeys.contains("gain6Index") || force)
{
reverseAPIKeys.append("gain6Index");
if (m_dev != 0) {
set_gain6(settings.m_gain6Index);
}
}
if ((m_settings.m_dcBlock != settings.m_dcBlock) || force)
if (settingsKeys.contains("dcBlock") || force)
{
reverseAPIKeys.append("dcBlock");
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection);
}
if ((m_settings.m_iqCorrection != settings.m_iqCorrection) || force)
if (settingsKeys.contains("iqCorrection") || force)
{
reverseAPIKeys.append("iqCorrection");
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection);
}
if (settings.m_useReverseAPI)
if (settingsKeys.contains("useReverseAPI"))
{
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex);
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
settingsKeys.contains("reverseAPIAddress") ||
settingsKeys.contains("reverseAPIPort") ||
settingsKeys.contains("reverseAPIDeviceIndex");
webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force);
}
if (force) {
m_settings = settings;
} else {
m_settings.applySettings(settingsKeys, settings);
}
if (forwardChange)
{
@ -870,12 +820,12 @@ int FCDProInput::webapiSettingsPutPatch(
FCDProSettings settings = m_settings;
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
MsgConfigureFCDPro *msg = MsgConfigureFCDPro::create(settings, force);
MsgConfigureFCDPro *msg = MsgConfigureFCDPro::create(settings, deviceSettingsKeys, force);
m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgConfigureFCDPro *msgToGUI = MsgConfigureFCDPro::create(settings, force);
MsgConfigureFCDPro *msgToGUI = MsgConfigureFCDPro::create(settings, deviceSettingsKeys, force);
m_guiMessageQueue->push(msgToGUI);
}
@ -1017,7 +967,7 @@ void FCDProInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& res
response.getFcdProSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
}
void FCDProInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const FCDProSettings& settings, bool force)
void FCDProInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const FCDProSettings& settings, bool force)
{
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
swgDeviceSettings->setDirection(0); // single Rx

View File

@ -49,20 +49,22 @@ public:
public:
const FCDProSettings& getSettings() const { return m_settings; }
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
bool getForce() const { return m_force; }
static MsgConfigureFCDPro* create(const FCDProSettings& settings, bool force)
{
return new MsgConfigureFCDPro(settings, force);
static MsgConfigureFCDPro* create(const FCDProSettings& settings, const QList<QString>& settingsKeys, bool force) {
return new MsgConfigureFCDPro(settings, settingsKeys, force);
}
private:
FCDProSettings m_settings;
QList<QString> m_settingsKeys;
bool m_force;
MsgConfigureFCDPro(const FCDProSettings& settings, bool force) :
MsgConfigureFCDPro(const FCDProSettings& settings, const QList<QString>& settingsKeys, bool force) :
Message(),
m_settings(settings),
m_settingsKeys(settingsKeys),
m_force(force)
{ }
};
@ -170,9 +172,9 @@ private:
void closeDevice();
bool openFCDAudio(const char *filename);
void closeFCDAudio();
void applySettings(const FCDProSettings& settings, bool force);
void applySettings(const FCDProSettings& settings, const QList<QString>& settingsKeys, bool force);
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const FCDProSettings& settings, bool force);
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const FCDProSettings& settings, bool force);
void webapiReverseSendStartStop(bool start);
private slots:

View File

@ -154,3 +154,189 @@ bool FCDProSettings::deserialize(const QByteArray& data)
return false;
}
}
void FCDProSettings::applySettings(const QStringList& settingsKeys, const FCDProSettings& settings)
{
if (settingsKeys.contains("centerFrequency")) {
m_centerFrequency = settings.m_centerFrequency;
}
if (settingsKeys.contains("dcBlock")) {
m_dcBlock = settings.m_dcBlock;
}
if (settingsKeys.contains("iqCorrection")) {
m_iqCorrection = settings.m_iqCorrection;
}
if (settingsKeys.contains("LOppmTenths")) {
m_LOppmTenths = settings.m_LOppmTenths;
}
if (settingsKeys.contains("lnaGainIndex")) {
m_lnaGainIndex = settings.m_lnaGainIndex;
}
if (settingsKeys.contains("rfFilterIndex")) {
m_rfFilterIndex = settings.m_rfFilterIndex;
}
if (settingsKeys.contains("lnaEnhanceIndex")) {
m_lnaEnhanceIndex = settings.m_lnaEnhanceIndex;
}
if (settingsKeys.contains("bandIndex")) {
m_bandIndex = settings.m_bandIndex;
}
if (settingsKeys.contains("mixerGainIndex")) {
m_mixerGainIndex = settings.m_mixerGainIndex;
}
if (settingsKeys.contains("mixerFilterIndex")) {
m_mixerFilterIndex = settings.m_mixerFilterIndex;
}
if (settingsKeys.contains("biasCurrentIndex")) {
m_biasCurrentIndex = settings.m_biasCurrentIndex;
}
if (settingsKeys.contains("modeIndex")) {
m_modeIndex = settings.m_modeIndex;
}
if (settingsKeys.contains("gain1Index")) {
m_gain1Index = settings.m_gain1Index;
}
if (settingsKeys.contains("rcFilterIndex")) {
m_rcFilterIndex = settings.m_rcFilterIndex;
}
if (settingsKeys.contains("gain2Index")) {
m_gain2Index = settings.m_gain2Index;
}
if (settingsKeys.contains("gain3Index")) {
m_gain3Index = settings.m_gain3Index;
}
if (settingsKeys.contains("gain4Index")) {
m_gain4Index = settings.m_gain4Index;
}
if (settingsKeys.contains("ifFilterIndex")) {
m_ifFilterIndex = settings.m_ifFilterIndex;
}
if (settingsKeys.contains("gain5Index")) {
m_gain5Index = settings.m_gain5Index;
}
if (settingsKeys.contains("gain6Index")) {
m_gain6Index = settings.m_gain6Index;
}
if (settingsKeys.contains("log2Decim")) {
m_log2Decim = settings.m_log2Decim;
}
if (settingsKeys.contains("fcPos")) {
m_fcPos = settings.m_fcPos;
}
if (settingsKeys.contains("transverterMode")) {
m_transverterMode = settings.m_transverterMode;
}
if (settingsKeys.contains("transverterDeltaFrequency")) {
m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
}
if (settingsKeys.contains("iqOrder")) {
m_iqOrder = settings.m_iqOrder;
}
if (settingsKeys.contains("useReverseAPI")) {
m_useReverseAPI = settings.m_useReverseAPI;
}
if (settingsKeys.contains("reverseAPIAddress")) {
m_reverseAPIAddress = settings.m_reverseAPIAddress;
}
if (settingsKeys.contains("reverseAPIPort")) {
m_reverseAPIPort = settings.m_reverseAPIPort;
}
if (settingsKeys.contains("reverseAPIDeviceIndex")) {
m_reverseAPIDeviceIndex = settings.m_reverseAPIDeviceIndex;
}
}
QString FCDProSettings::getDebugString(const QStringList& settingsKeys, bool force) const
{
std::ostringstream ostr;
if (settingsKeys.contains("centerFrequency") || force) {
ostr << " m_centerFrequency: " << m_centerFrequency;
}
if (settingsKeys.contains("dcBlock") || force) {
ostr << " m_dcBlock: " << m_dcBlock;
}
if (settingsKeys.contains("iqCorrection") || force) {
ostr << " m_iqCorrection: " << m_iqCorrection;
}
if (settingsKeys.contains("LOppmTenths") || force) {
ostr << " m_LOppmTenths: " << m_LOppmTenths;
}
if (settingsKeys.contains("lnaGainIndex") || force) {
ostr << " m_lnaGainIndex: " << m_lnaGainIndex;
}
if (settingsKeys.contains("rfFilterIndex") || force) {
ostr << " m_rfFilterIndex: " << m_rfFilterIndex;
}
if (settingsKeys.contains("lnaEnhanceIndex") || force) {
ostr << " m_lnaEnhanceIndex: " << m_lnaEnhanceIndex;
}
if (settingsKeys.contains("bandIndex") || force) {
ostr << " m_bandIndex: " << m_bandIndex;
}
if (settingsKeys.contains("mixerGainIndex") || force) {
ostr << " m_mixerGainIndex: " << m_mixerGainIndex;
}
if (settingsKeys.contains("mixerFilterIndex") || force) {
ostr << " m_mixerFilterIndex: " << m_mixerFilterIndex;
}
if (settingsKeys.contains("biasCurrentIndex") || force) {
ostr << " m_biasCurrentIndex: " << m_biasCurrentIndex;
}
if (settingsKeys.contains("modeIndex") || force) {
ostr << " m_modeIndex: " << m_modeIndex;
}
if (settingsKeys.contains("gain1Index") || force) {
ostr << " m_gain1Index: " << m_gain1Index;
}
if (settingsKeys.contains("rcFilterIndex") || force) {
ostr << " m_rcFilterIndex: " << m_rcFilterIndex;
}
if (settingsKeys.contains("gain2Index") || force) {
ostr << " m_gain2Index: " << m_gain2Index;
}
if (settingsKeys.contains("gain3Index") || force) {
ostr << " m_gain3Index: " << m_gain3Index;
}
if (settingsKeys.contains("gain4Index") || force) {
ostr << " m_gain4Index: " << m_gain4Index;
}
if (settingsKeys.contains("ifFilterIndex") || force) {
ostr << " m_ifFilterIndex: " << m_ifFilterIndex;
}
if (settingsKeys.contains("gain5Index") || force) {
ostr << " m_gain5Index: " << m_gain5Index;
}
if (settingsKeys.contains("gain6Index") || force) {
ostr << " m_gain6Index: " << m_gain6Index;
}
if (settingsKeys.contains("log2Decim") || force) {
ostr << " m_log2Decim: " << m_log2Decim;
}
if (settingsKeys.contains("fcPos") || force) {
ostr << " m_fcPos: " << m_fcPos;
}
if (settingsKeys.contains("transverterMode") || force) {
ostr << " m_transverterMode: " << m_transverterMode;
}
if (settingsKeys.contains("transverterDeltaFrequency") || force) {
ostr << " m_transverterDeltaFrequency: " << m_transverterDeltaFrequency;
}
if (settingsKeys.contains("iqOrder") || force) {
ostr << " m_iqOrder: " << m_iqOrder;
}
if (settingsKeys.contains("useReverseAPI") || force) {
ostr << " m_useReverseAPI: " << m_useReverseAPI;
}
if (settingsKeys.contains("reverseAPIAddress") || force) {
ostr << " m_reverseAPIAddress: " << m_reverseAPIAddress.toStdString();
}
if (settingsKeys.contains("reverseAPIPort") || force) {
ostr << " m_reverseAPIPort: " << m_reverseAPIPort;
}
if (settingsKeys.contains("reverseAPIDeviceIndex") || force) {
ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex;
}
return QString(ostr.str().c_str());
}

View File

@ -61,6 +61,8 @@ struct FCDProSettings {
void resetToDefaults();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
void applySettings(const QStringList& settingsKeys, const FCDProSettings& settings);
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
};