mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 01:18:38 -05:00
SDRPlayV3: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
b3539c9292
commit
15d19ab482
@ -139,6 +139,7 @@ void SDRPlayV3Gui::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -174,7 +175,13 @@ bool SDRPlayV3Gui::handleMessage(const Message& message)
|
||||
if (SDRPlayV3Input::MsgConfigureSDRPlayV3::match(message))
|
||||
{
|
||||
const SDRPlayV3Input::MsgConfigureSDRPlayV3& cfg = (SDRPlayV3Input::MsgConfigureSDRPlayV3&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
|
||||
if (cfg.getForce()) {
|
||||
m_settings = cfg.getSettings();
|
||||
} else {
|
||||
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||
}
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
@ -329,8 +336,9 @@ void SDRPlayV3Gui::updateLNAValues()
|
||||
|
||||
void SDRPlayV3Gui::sendSettings()
|
||||
{
|
||||
if(!m_updateTimer.isActive())
|
||||
if (!m_updateTimer.isActive()) {
|
||||
m_updateTimer.start(100);
|
||||
}
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::updateHardware()
|
||||
@ -338,9 +346,10 @@ void SDRPlayV3Gui::updateHardware()
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
qDebug() << "SDRPlayV3Gui::updateHardware";
|
||||
SDRPlayV3Input::MsgConfigureSDRPlayV3* message = SDRPlayV3Input::MsgConfigureSDRPlayV3::create(m_settings, m_forceSettings);
|
||||
SDRPlayV3Input::MsgConfigureSDRPlayV3* message = SDRPlayV3Input::MsgConfigureSDRPlayV3::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||
m_sdrPlayV3Input->getInputMessageQueue()->push(message);
|
||||
m_forceSettings = false;
|
||||
m_settingsKeys.clear();
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
}
|
||||
@ -378,6 +387,7 @@ void SDRPlayV3Gui::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_centerFrequency = value * 1000;
|
||||
updateLNAValues();
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -385,12 +395,15 @@ void SDRPlayV3Gui::on_ppm_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_LOppmTenths = value;
|
||||
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
||||
m_settingsKeys.append("LOppmTenths");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_tuner_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_tuner = index;
|
||||
m_settingsKeys.append("tuner");
|
||||
|
||||
if (m_sdrPlayV3Input->getDeviceId() == SDRPLAY_RSPduo_ID)
|
||||
{
|
||||
ui->antenna->clear();
|
||||
@ -400,96 +413,112 @@ void SDRPlayV3Gui::on_tuner_currentIndexChanged(int index)
|
||||
ui->amNotch->setVisible(index == 0);
|
||||
ui->biasTee->setVisible(index == 1);
|
||||
}
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_antenna_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_antenna = index;
|
||||
m_settingsKeys.append("antenna");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_dcOffset_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_dcBlock = checked;
|
||||
m_settingsKeys.append("dcBlock");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_iqImbalance_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_iqCorrection = checked;
|
||||
m_settingsKeys.append("iqCorrection");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_extRef_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_extRef = checked;
|
||||
m_settingsKeys.append("extRef");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_biasTee_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_biasTee = checked;
|
||||
m_settingsKeys.append("biasTee");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_amNotch_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_amNotch = checked;
|
||||
m_settingsKeys.append("amNotch");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_fmNotch_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_fmNotch = checked;
|
||||
m_settingsKeys.append("fmNotch");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_dabNotch_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_dabNotch = checked;
|
||||
m_settingsKeys.append("dabNotch");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_bandwidth_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_bandwidthIndex = index;
|
||||
m_settingsKeys.append("bandwidthIndex");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_samplerate_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_devSampleRate = (uint32_t)value;
|
||||
m_settings.m_devSampleRate = (uint32_t) value;
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_ifFrequency_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_ifFrequencyIndex = index;
|
||||
m_settingsKeys.append("ifFrequencyIndex");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_decim_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_log2Decim = index;
|
||||
m_settingsKeys.append("log2Decim");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_fcPos_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_fcPos = (SDRPlayV3Settings::fcPos_t) index;
|
||||
m_settingsKeys.append("fcPos");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_gainLNA_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_lnaIndex = index;
|
||||
m_settingsKeys.append("lnaIndex");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::on_gainIFAGC_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_ifAGC = checked;
|
||||
m_settingsKeys.append("ifAGC");
|
||||
ui->gainIF->setEnabled(!checked);
|
||||
sendSettings();
|
||||
}
|
||||
@ -497,6 +526,7 @@ void SDRPlayV3Gui::on_gainIFAGC_toggled(bool checked)
|
||||
void SDRPlayV3Gui::on_gainIF_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_ifGain = value;
|
||||
m_settingsKeys.append("ifGain");
|
||||
|
||||
QString gainText = QStringLiteral("%1").arg(value, 2, 10, QLatin1Char('0'));
|
||||
ui->gainIFText->setText(gainText);
|
||||
@ -521,6 +551,10 @@ void SDRPlayV3Gui::on_transverter_clicked()
|
||||
qDebug("SDRPlayV3Gui::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");
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -541,6 +575,10 @@ void SDRPlayV3Gui::openDeviceSettingsDialog(const QPoint& p)
|
||||
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
||||
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
||||
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
||||
m_settingsKeys.append("useReverseAPI");
|
||||
m_settingsKeys.append("reverseAPIAddress");
|
||||
m_settingsKeys.append("reverseAPIPort");
|
||||
m_settingsKeys.append("reverseAPIDeviceIndex");
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ private:
|
||||
bool m_doApplySettings;
|
||||
bool m_forceSettings;
|
||||
SDRPlayV3Settings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
SDRPlayV3Input* m_sdrPlayV3Input;
|
||||
|
@ -158,7 +158,7 @@ bool SDRPlayV3Input::start()
|
||||
m_sdrPlayThread->startWork();
|
||||
|
||||
m_running = m_sdrPlayThread->isRunning();
|
||||
applySettings(m_settings, true, true);
|
||||
applySettings(m_settings, QList<QString>(), true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -176,7 +176,7 @@ void SDRPlayV3Input::closeDevice()
|
||||
|
||||
void SDRPlayV3Input::init()
|
||||
{
|
||||
applySettings(m_settings, true, true);
|
||||
applySettings(m_settings, QList<QString>(), true, true);
|
||||
}
|
||||
|
||||
void SDRPlayV3Input::stop()
|
||||
@ -209,12 +209,12 @@ bool SDRPlayV3Input::deserialize(const QByteArray& data)
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureSDRPlayV3* message = MsgConfigureSDRPlayV3::create(m_settings, true);
|
||||
MsgConfigureSDRPlayV3* message = MsgConfigureSDRPlayV3::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureSDRPlayV3* messageToGUI = MsgConfigureSDRPlayV3::create(m_settings, true);
|
||||
MsgConfigureSDRPlayV3* messageToGUI = MsgConfigureSDRPlayV3::create(m_settings, QList<QString>(), true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
@ -257,12 +257,12 @@ void SDRPlayV3Input::setCenterFrequency(qint64 centerFrequency)
|
||||
SDRPlayV3Settings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureSDRPlayV3* message = MsgConfigureSDRPlayV3::create(settings, false);
|
||||
MsgConfigureSDRPlayV3* message = MsgConfigureSDRPlayV3::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureSDRPlayV3* messageToGUI = MsgConfigureSDRPlayV3::create(settings, false);
|
||||
MsgConfigureSDRPlayV3* messageToGUI = MsgConfigureSDRPlayV3::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
@ -273,10 +273,10 @@ bool SDRPlayV3Input::handleMessage(const Message& message)
|
||||
{
|
||||
MsgConfigureSDRPlayV3& conf = (MsgConfigureSDRPlayV3&) message;
|
||||
qDebug() << "SDRPlayV3Input::handleMessage: MsgConfigureSDRPlayV3";
|
||||
const SDRPlayV3Settings& settings = conf.getSettings();
|
||||
|
||||
if (!applySettings(settings, false, conf.getForce()))
|
||||
if (!applySettings( conf.getSettings(), conf.getSettingsKeys(), false, conf.getForce())) {
|
||||
qDebug("SDRPlayV3Input::handleMessage: config error");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -309,14 +309,13 @@ bool SDRPlayV3Input::handleMessage(const Message& message)
|
||||
}
|
||||
}
|
||||
|
||||
bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwardChange, bool force)
|
||||
bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, const QList<QString>& settingsKeys, bool forwardChange, bool force)
|
||||
{
|
||||
qDebug() << "SDRPlayV3Input::applySettings";
|
||||
QList<QString> reverseAPIKeys;
|
||||
qDebug() << "SDRPlayV3Input::applySettings: forwardChange: " << forwardChange << " force: " << force << settings.getDebugString(settingsKeys, force);
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
sdrplay_api_ErrT err;
|
||||
|
||||
if ((m_settings.m_tuner != settings.m_tuner) || force)
|
||||
if (settingsKeys.contains("tuner") || force)
|
||||
{
|
||||
if (m_running)
|
||||
{
|
||||
@ -332,10 +331,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_dcBlock != settings.m_dcBlock) || force)
|
||||
if (settingsKeys.contains("dcBlock") || force)
|
||||
{
|
||||
reverseAPIKeys.append("dcBlock");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
if (m_dev->tuner == sdrplay_api_Tuner_A)
|
||||
@ -347,10 +344,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqCorrection != settings.m_iqCorrection) || force)
|
||||
if (settingsKeys.contains("iqCorrection") || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqCorrection");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
if (m_dev->tuner == sdrplay_api_Tuner_A)
|
||||
@ -362,20 +357,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if (m_settings.m_lnaIndex != settings.m_lnaIndex)
|
||||
if (settingsKeys.contains("ifAGC") || force)
|
||||
{
|
||||
reverseAPIKeys.append("lnaIndex");
|
||||
}
|
||||
|
||||
if (m_settings.m_ifGain != settings.m_ifGain)
|
||||
{
|
||||
reverseAPIKeys.append("ifGain");
|
||||
}
|
||||
|
||||
if ((m_settings.m_ifAGC != settings.m_ifAGC) || force)
|
||||
{
|
||||
reverseAPIKeys.append("ifAGC");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
if (m_dev->tuner == sdrplay_api_Tuner_A)
|
||||
@ -388,9 +371,9 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
|
||||
// Need to reset IF gain manual setting after AGC is disabled
|
||||
if ((m_settings.m_lnaIndex != settings.m_lnaIndex)
|
||||
|| (m_settings.m_ifGain != settings.m_ifGain)
|
||||
|| (m_settings.m_ifAGC != settings.m_ifAGC) || force)
|
||||
if (settingsKeys.contains("lnaIndex")
|
||||
|| settingsKeys.contains("ifGain")
|
||||
|| settingsKeys.contains("ifAGC") || force)
|
||||
{
|
||||
if (m_running)
|
||||
{
|
||||
@ -411,10 +394,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force)
|
||||
if (settingsKeys.contains("devSampleRate") || force)
|
||||
{
|
||||
reverseAPIKeys.append("devSampleRate");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
int sampleRate = settings.m_devSampleRate;
|
||||
@ -427,10 +408,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
|
||||
if (settingsKeys.contains("log2Decim") || force)
|
||||
{
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
|
||||
if (m_sdrPlayThread)
|
||||
{
|
||||
m_sdrPlayThread->setLog2Decimation(settings.m_log2Decim);
|
||||
@ -438,10 +417,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
|
||||
if (settingsKeys.contains("fcPos") || force)
|
||||
{
|
||||
reverseAPIKeys.append("fcPos");
|
||||
|
||||
if (m_sdrPlayThread)
|
||||
{
|
||||
m_sdrPlayThread->setFcPos((int) settings.m_fcPos);
|
||||
@ -449,34 +426,19 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) {
|
||||
reverseAPIKeys.append("LOppmTenths");
|
||||
}
|
||||
if ((m_settings.m_transverterMode != settings.m_transverterMode) || force) {
|
||||
reverseAPIKeys.append("transverterMode");
|
||||
}
|
||||
if ((m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency) || force) {
|
||||
reverseAPIKeys.append("transverterDeltaFrequency");
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
if (settingsKeys.contains("iqOrder") || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_sdrPlayThread) {
|
||||
m_sdrPlayThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((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) || force)
|
||||
if (settingsKeys.contains("centerFrequency")
|
||||
|| settingsKeys.contains("LOppmTenths")
|
||||
|| settingsKeys.contains("fcPos")
|
||||
|| settingsKeys.contains("log2Decim")
|
||||
|| settingsKeys.contains("transverterMode")
|
||||
|| settingsKeys.contains("transverterDeltaFrequency") || force)
|
||||
{
|
||||
qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency(
|
||||
settings.m_centerFrequency,
|
||||
@ -497,10 +459,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_bandwidthIndex != settings.m_bandwidthIndex) || force)
|
||||
if (settingsKeys.contains("bandwidthIndex") || force)
|
||||
{
|
||||
reverseAPIKeys.append("bandwidthIndex");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
if (m_dev->tuner == sdrplay_api_Tuner_A)
|
||||
@ -515,10 +475,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_ifFrequencyIndex != settings.m_ifFrequencyIndex) || force)
|
||||
if (settingsKeys.contains("ifFrequencyIndex") || force)
|
||||
{
|
||||
reverseAPIKeys.append("ifFrequencyIndex");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
if (m_dev->tuner == sdrplay_api_Tuner_A)
|
||||
@ -533,10 +491,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_biasTee != settings.m_biasTee) || force)
|
||||
if (settingsKeys.contains("biasTee") || force)
|
||||
{
|
||||
reverseAPIKeys.append("biasTee");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
sdrplay_api_ReasonForUpdateT update = sdrplay_api_Update_None;
|
||||
@ -572,10 +528,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_amNotch != settings.m_amNotch) || force)
|
||||
if (settingsKeys.contains("amNotch") || force)
|
||||
{
|
||||
reverseAPIKeys.append("amNotch");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
sdrplay_api_ReasonForUpdateT update = sdrplay_api_Update_None;
|
||||
@ -598,10 +552,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_fmNotch != settings.m_fmNotch) || force)
|
||||
if (settingsKeys.contains("fmNotch") || force)
|
||||
{
|
||||
reverseAPIKeys.append("fmNotch");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
sdrplay_api_ReasonForUpdateT update = sdrplay_api_Update_None;
|
||||
@ -636,10 +588,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_dabNotch != settings.m_dabNotch) || force)
|
||||
if (settingsKeys.contains("dabNotch") || force)
|
||||
{
|
||||
reverseAPIKeys.append("dabNotch");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
sdrplay_api_ReasonForUpdateT update = sdrplay_api_Update_None;
|
||||
@ -670,10 +620,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_antenna != settings.m_antenna) || force)
|
||||
if (settingsKeys.contains("antenna") || force)
|
||||
{
|
||||
reverseAPIKeys.append("antenna");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
sdrplay_api_ReasonForUpdateT update = sdrplay_api_Update_None;
|
||||
@ -705,10 +653,8 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_extRef != settings.m_extRef) || force)
|
||||
if (settingsKeys.contains("extRef") || force)
|
||||
{
|
||||
reverseAPIKeys.append("extRef");
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
sdrplay_api_ReasonForUpdateT update = sdrplay_api_Update_None;
|
||||
@ -732,16 +678,20 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, bool forwa
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
|
||||
if (forwardChange)
|
||||
{
|
||||
@ -830,12 +780,12 @@ int SDRPlayV3Input::webapiSettingsPutPatch(
|
||||
SDRPlayV3Settings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureSDRPlayV3 *msg = MsgConfigureSDRPlayV3::create(settings, force);
|
||||
MsgConfigureSDRPlayV3 *msg = MsgConfigureSDRPlayV3::create(settings, deviceSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureSDRPlayV3 *msgToGUI = MsgConfigureSDRPlayV3::create(settings, force);
|
||||
MsgConfigureSDRPlayV3 *msgToGUI = MsgConfigureSDRPlayV3::create(settings, deviceSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@ -1020,7 +970,7 @@ void SDRPlayV3Input::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
|
||||
}
|
||||
}
|
||||
|
||||
void SDRPlayV3Input::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const SDRPlayV3Settings& settings, bool force)
|
||||
void SDRPlayV3Input::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const SDRPlayV3Settings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||
swgDeviceSettings->setDirection(0); // single Rx
|
||||
|
@ -43,20 +43,22 @@ public:
|
||||
|
||||
public:
|
||||
const SDRPlayV3Settings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureSDRPlayV3* create(const SDRPlayV3Settings& settings, bool force)
|
||||
{
|
||||
return new MsgConfigureSDRPlayV3(settings, force);
|
||||
static MsgConfigureSDRPlayV3* create(const SDRPlayV3Settings& settings, const QList<QString>& settingsKeys, bool force) {
|
||||
return new MsgConfigureSDRPlayV3(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
SDRPlayV3Settings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureSDRPlayV3(const SDRPlayV3Settings& settings, bool force) :
|
||||
MsgConfigureSDRPlayV3(const SDRPlayV3Settings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -150,10 +152,10 @@ private:
|
||||
|
||||
bool openDevice();
|
||||
void closeDevice();
|
||||
bool applySettings(const SDRPlayV3Settings& settings, bool forwardChange, bool force);
|
||||
bool applySettings(const SDRPlayV3Settings& settings, const QList<QString>& settingsKeys, bool forwardChange, bool force);
|
||||
bool setDeviceCenterFrequency(quint64 freq);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const SDRPlayV3Settings& settings, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const SDRPlayV3Settings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
private slots:
|
||||
|
@ -147,3 +147,168 @@ bool SDRPlayV3Settings::deserialize(const QByteArray& data)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void SDRPlayV3Settings::applySettings(const QStringList& settingsKeys, const SDRPlayV3Settings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("centerFrequency")) {
|
||||
m_centerFrequency = settings.m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("LOppmTenths")) {
|
||||
m_LOppmTenths = settings.m_LOppmTenths;
|
||||
}
|
||||
if (settingsKeys.contains("ifFrequencyIndex")) {
|
||||
m_ifFrequencyIndex = settings.m_ifFrequencyIndex;
|
||||
}
|
||||
if (settingsKeys.contains("bandwidthIndex")) {
|
||||
m_bandwidthIndex = settings.m_bandwidthIndex;
|
||||
}
|
||||
if (settingsKeys.contains("log2Decim")) {
|
||||
m_log2Decim = settings.m_log2Decim;
|
||||
}
|
||||
if (settingsKeys.contains("fcPos")) {
|
||||
m_fcPos = settings.m_fcPos;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock")) {
|
||||
m_dcBlock = settings.m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqCorrection")) {
|
||||
m_iqCorrection = settings.m_iqCorrection;
|
||||
}
|
||||
if (settingsKeys.contains("lnaIndex")) {
|
||||
m_lnaIndex = settings.m_lnaIndex;
|
||||
}
|
||||
if (settingsKeys.contains("ifAGC")) {
|
||||
m_ifAGC = settings.m_ifAGC;
|
||||
}
|
||||
if (settingsKeys.contains("ifGain")) {
|
||||
m_ifGain = settings.m_ifGain;
|
||||
}
|
||||
if (settingsKeys.contains("amNotch")) {
|
||||
m_amNotch = settings.m_amNotch;
|
||||
}
|
||||
if (settingsKeys.contains("fmNotch")) {
|
||||
m_fmNotch = settings.m_fmNotch;
|
||||
}
|
||||
if (settingsKeys.contains("dabNotch")) {
|
||||
m_dabNotch = settings.m_dabNotch;
|
||||
}
|
||||
if (settingsKeys.contains("biasTee")) {
|
||||
m_biasTee = settings.m_biasTee;
|
||||
}
|
||||
if (settingsKeys.contains("tuner")) {
|
||||
m_tuner = settings.m_tuner;
|
||||
}
|
||||
if (settingsKeys.contains("antenna")) {
|
||||
m_antenna = settings.m_antenna;
|
||||
}
|
||||
if (settingsKeys.contains("extRef")) {
|
||||
m_extRef = settings.m_extRef;
|
||||
}
|
||||
if (settingsKeys.contains("transverterMode")) {
|
||||
m_transverterMode = settings.m_transverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("iqOrder")) {
|
||||
m_iqOrder = settings.m_iqOrder;
|
||||
}
|
||||
if (settingsKeys.contains("m_transverterDeltaFrequency")) {
|
||||
m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
|
||||
}
|
||||
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 SDRPlayV3Settings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
||||
if (settingsKeys.contains("centerFrequency") || force) {
|
||||
ostr << " m_centerFrequency: " << m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("LOppmTenths") || force) {
|
||||
ostr << " m_LOppmTenths: " << m_LOppmTenths;
|
||||
}
|
||||
if (settingsKeys.contains("ifFrequencyIndex") || force) {
|
||||
ostr << " m_ifFrequencyIndex: " << m_ifFrequencyIndex;
|
||||
}
|
||||
if (settingsKeys.contains("bandwidthIndex") || force) {
|
||||
ostr << " m_bandwidthIndex: " << m_bandwidthIndex;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate") || force) {
|
||||
ostr << " m_devSampleRate: " << m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("log2Decim") || force) {
|
||||
ostr << " m_log2Decim: " << m_log2Decim;
|
||||
}
|
||||
if (settingsKeys.contains("fcPos") || force) {
|
||||
ostr << " m_fcPos: " << m_fcPos;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock") || force) {
|
||||
ostr << " m_dcBlock: " << m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqCorrection") || force) {
|
||||
ostr << " m_iqCorrection: " << m_iqCorrection;
|
||||
}
|
||||
if (settingsKeys.contains("lnaIndex") || force) {
|
||||
ostr << " m_lnaIndex: " << m_lnaIndex;
|
||||
}
|
||||
if (settingsKeys.contains("ifAGC") || force) {
|
||||
ostr << " m_ifAGC: " << m_ifAGC;
|
||||
}
|
||||
if (settingsKeys.contains("ifGain") || force) {
|
||||
ostr << " m_ifGain: " << m_ifGain;
|
||||
}
|
||||
if (settingsKeys.contains("amNotch") || force) {
|
||||
ostr << " m_amNotch: " << m_amNotch;
|
||||
}
|
||||
if (settingsKeys.contains("fmNotch") || force) {
|
||||
ostr << " m_fmNotch: " << m_fmNotch;
|
||||
}
|
||||
if (settingsKeys.contains("dabNotch") || force) {
|
||||
ostr << " m_dabNotch: " << m_dabNotch;
|
||||
}
|
||||
if (settingsKeys.contains("biasTee") || force) {
|
||||
ostr << " m_biasTee: " << m_biasTee;
|
||||
}
|
||||
if (settingsKeys.contains("tuner") || force) {
|
||||
ostr << " m_tuner: " << m_tuner;
|
||||
}
|
||||
if (settingsKeys.contains("antenna") || force) {
|
||||
ostr << " m_antenna: " << m_antenna;
|
||||
}
|
||||
if (settingsKeys.contains("extRef") || force) {
|
||||
ostr << " m_extRef: " << m_extRef;
|
||||
}
|
||||
if (settingsKeys.contains("transverterMode") || force) {
|
||||
ostr << " m_transverterMode: " << m_transverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("iqOrder") || force) {
|
||||
ostr << " m_iqOrder: " << m_iqOrder;
|
||||
}
|
||||
if (settingsKeys.contains("transverterDeltaFrequency") || force) {
|
||||
ostr << " m_transverterDeltaFrequency: " << m_transverterDeltaFrequency;
|
||||
}
|
||||
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("everseAPIDeviceIndex") || force) {
|
||||
ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex;
|
||||
}
|
||||
|
||||
return QString(ostr.str().c_str());
|
||||
}
|
||||
|
@ -62,30 +62,8 @@ struct SDRPlayV3Settings {
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
|
||||
void debug(const char *title) const
|
||||
{
|
||||
qDebug() << QString(title)
|
||||
<< ": m_centerFrequency: " << m_centerFrequency
|
||||
<< " m_LOppmTenths: " << m_LOppmTenths
|
||||
<< " m_ifFrequencyIndex: " << m_ifFrequencyIndex
|
||||
<< " m_bandwidthIndex: " << m_bandwidthIndex
|
||||
<< " m_devSampleRate: " << m_devSampleRate
|
||||
<< " m_log2Decim: " << m_log2Decim
|
||||
<< " m_fcPos: " << m_fcPos
|
||||
<< " m_dcBlock: " << m_dcBlock
|
||||
<< " m_iqCorrection: " << m_iqCorrection
|
||||
<< " m_lnaIndex: " << m_lnaIndex
|
||||
<< " m_ifAGC: " << m_ifAGC
|
||||
<< " m_ifGain: " << m_ifGain
|
||||
<< " m_amNotch: " << m_amNotch
|
||||
<< " m_fmNotch: " << m_fmNotch
|
||||
<< " m_dabNotch: " << m_dabNotch
|
||||
<< " m_biasTee: " << m_biasTee
|
||||
<< " m_tuner: " << m_tuner
|
||||
<< " m_antenna: " << m_antenna
|
||||
<< " m_extRef: " << m_extRef;
|
||||
}
|
||||
void applySettings(const QStringList& settingsKeys, const SDRPlayV3Settings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
};
|
||||
|
||||
#endif /* _SDRPLAYV3_SDRPLAYV3SETTINGS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user