mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -05:00
RTL-SDR: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
b58d5b0a82
commit
b129349b02
@ -88,18 +88,21 @@ void RTLSDRGui::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void RTLSDRGui::on_dcOffset_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_dcBlock = checked;
|
||||
m_settingsKeys.append("dcBlock");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void RTLSDRGui::on_iqImbalance_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_iqImbalance = checked;
|
||||
m_settingsKeys.append("iqImbalance");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -136,7 +139,13 @@ bool RTLSDRGui::handleMessage(const Message& message)
|
||||
if (RTLSDRInput::MsgConfigureRTLSDR::match(message))
|
||||
{
|
||||
const RTLSDRInput::MsgConfigureRTLSDR& cfg = (RTLSDRInput::MsgConfigureRTLSDR&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
|
||||
if (cfg.getForce()) {
|
||||
m_settings = cfg.getSettings();
|
||||
} else {
|
||||
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||
}
|
||||
|
||||
blockApplySettings(true);
|
||||
displayGains();
|
||||
displaySettings();
|
||||
@ -321,8 +330,7 @@ void RTLSDRGui::displaySettings()
|
||||
|
||||
void RTLSDRGui::sendSettings()
|
||||
{
|
||||
if(!m_updateTimer.isActive())
|
||||
{
|
||||
if (!m_updateTimer.isActive()) {
|
||||
m_updateTimer.start(100);
|
||||
}
|
||||
}
|
||||
@ -330,6 +338,7 @@ void RTLSDRGui::sendSettings()
|
||||
void RTLSDRGui::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_centerFrequency = value * 1000;
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -348,6 +357,8 @@ void RTLSDRGui::on_decim_currentIndexChanged(int index)
|
||||
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Decim);
|
||||
}
|
||||
|
||||
m_settingsKeys.append("log2Decim");
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -355,32 +366,33 @@ void RTLSDRGui::on_fcPos_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_fcPos = (RTLSDRSettings::fcPos_t) (index < 0 ? 0 : index > 2 ? 2 : index);
|
||||
displayFcTooltip();
|
||||
m_settingsKeys.append("fcPos");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void RTLSDRGui::on_ppm_valueChanged(int value)
|
||||
{
|
||||
if ((value > 200) || (value < -200))
|
||||
{
|
||||
if ((value > 200) || (value < -200)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ui->ppmText->setText(tr("%1").arg(value));
|
||||
m_settings.m_loPpmCorrection = value;
|
||||
m_settingsKeys.append("loPpmCorrection");
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void RTLSDRGui::on_gain_valueChanged(int value)
|
||||
{
|
||||
if (value > (int)m_gains.size())
|
||||
{
|
||||
if (value > (int)m_gains.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int gain = m_gains[value];
|
||||
ui->gainText->setText(tr("%1.%2").arg(gain / 10).arg(abs(gain % 10)));
|
||||
m_settings.m_gain = gain;
|
||||
m_settingsKeys.append("gain");
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
@ -402,6 +414,10 @@ void RTLSDRGui::on_transverter_clicked()
|
||||
qDebug("RTLSDRGui::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();
|
||||
}
|
||||
|
||||
@ -414,6 +430,7 @@ void RTLSDRGui::on_sampleRateMode_toggled(bool checked)
|
||||
void RTLSDRGui::on_biasT_stateChanged(int state)
|
||||
{
|
||||
m_settings.m_biasTee = (state == Qt::Checked);
|
||||
m_settingsKeys.append("biasTee");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -421,9 +438,10 @@ void RTLSDRGui::updateHardware()
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
RTLSDRInput::MsgConfigureRTLSDR* message = RTLSDRInput::MsgConfigureRTLSDR::create(m_settings, m_forceSettings);
|
||||
RTLSDRInput::MsgConfigureRTLSDR* message = RTLSDRInput::MsgConfigureRTLSDR::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||
m_sampleSource->getInputMessageQueue()->push(message);
|
||||
m_forceSettings = false;
|
||||
m_settingsKeys.clear();
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
}
|
||||
@ -477,12 +495,15 @@ void RTLSDRGui::on_checkBox_stateChanged(int state)
|
||||
m_settings.m_centerFrequency = 435000 * 1000;
|
||||
}
|
||||
|
||||
m_settingsKeys.append("noModMode");
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void RTLSDRGui::on_agc_stateChanged(int state)
|
||||
{
|
||||
m_settings.m_agc = (state == Qt::Checked);
|
||||
m_settingsKeys.append("agc");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -495,18 +516,21 @@ void RTLSDRGui::on_sampleRate_changed(quint64 value)
|
||||
}
|
||||
|
||||
displayFcTooltip();
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void RTLSDRGui::on_offsetTuning_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_offsetTuning = checked;
|
||||
m_settingsKeys.append("offsetTuning");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void RTLSDRGui::on_rfBW_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_rfBandwidth = value * 1000;
|
||||
m_settingsKeys.append("rfBandwidth");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -524,6 +548,8 @@ void RTLSDRGui::on_lowSampleRate_toggled(bool checked)
|
||||
|
||||
qDebug("RTLSDRGui::on_lowSampleRate_toggled: %d S/s", m_settings.m_devSampleRate);
|
||||
|
||||
m_settingsKeys.append("lowSampleRate");
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -544,6 +570,10 @@ void RTLSDRGui::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;
|
||||
RTLSDRSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
|
||||
QTimer m_updateTimer;
|
||||
std::vector<int> m_gains;
|
||||
|
@ -196,7 +196,7 @@ bool RTLSDRInput::openDevice()
|
||||
|
||||
void RTLSDRInput::init()
|
||||
{
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
}
|
||||
|
||||
bool RTLSDRInput::start()
|
||||
@ -218,7 +218,7 @@ bool RTLSDRInput::start()
|
||||
|
||||
mutexLocker.unlock();
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
m_running = true;
|
||||
|
||||
return true;
|
||||
@ -264,12 +264,12 @@ bool RTLSDRInput::deserialize(const QByteArray& data)
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureRTLSDR* message = MsgConfigureRTLSDR::create(m_settings, true);
|
||||
MsgConfigureRTLSDR* message = MsgConfigureRTLSDR::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureRTLSDR* messageToGUI = MsgConfigureRTLSDR::create(m_settings, true);
|
||||
MsgConfigureRTLSDR* messageToGUI = MsgConfigureRTLSDR::create(m_settings, QList<QString>(), true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
@ -297,12 +297,12 @@ void RTLSDRInput::setCenterFrequency(qint64 centerFrequency)
|
||||
RTLSDRSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureRTLSDR* message = MsgConfigureRTLSDR::create(settings, false);
|
||||
MsgConfigureRTLSDR* message = MsgConfigureRTLSDR::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureRTLSDR* messageToGUI = MsgConfigureRTLSDR::create(settings, false);
|
||||
MsgConfigureRTLSDR* messageToGUI = MsgConfigureRTLSDR::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
@ -314,7 +314,7 @@ bool RTLSDRInput::handleMessage(const Message& message)
|
||||
MsgConfigureRTLSDR& conf = (MsgConfigureRTLSDR&) message;
|
||||
qDebug() << "RTLSDRInput::handleMessage: MsgConfigureRTLSDR";
|
||||
|
||||
bool success = applySettings(conf.getSettings(), conf.getForce());
|
||||
bool success = applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
||||
|
||||
if (!success)
|
||||
{
|
||||
@ -351,15 +351,13 @@ bool RTLSDRInput::handleMessage(const Message& message)
|
||||
}
|
||||
}
|
||||
|
||||
bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
qDebug() << "RTLSDRInput::applySettings: force: " << force << settings.getDebugString(settingsKeys, force);
|
||||
bool forwardChange = false;
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
if ((m_settings.m_agc != settings.m_agc) || force)
|
||||
if (settingsKeys.contains("agc") || force)
|
||||
{
|
||||
reverseAPIKeys.append("agc");
|
||||
|
||||
if (rtlsdr_set_agc_mode(m_dev, settings.m_agc ? 1 : 0) < 0) {
|
||||
qCritical("RTLSDRInput::applySettings: could not set AGC mode %s", settings.m_agc ? "on" : "off");
|
||||
} else {
|
||||
@ -367,20 +365,16 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_dcBlock != settings.m_dcBlock) || (m_settings.m_iqImbalance != settings.m_iqImbalance) || force)
|
||||
if (settingsKeys.contains("dcBlock") || settingsKeys.contains("iqImbalance") || force)
|
||||
{
|
||||
reverseAPIKeys.append("dcBlock");
|
||||
reverseAPIKeys.append("iqImbalance");
|
||||
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqImbalance);
|
||||
qDebug("RTLSDRInput::applySettings: corrections: DC block: %s IQ imbalance: %s",
|
||||
settings.m_dcBlock ? "true" : "false",
|
||||
settings.m_iqImbalance ? "true" : "false");
|
||||
}
|
||||
|
||||
if ((m_settings.m_loPpmCorrection != settings.m_loPpmCorrection) || force)
|
||||
if (settingsKeys.contains("loPpmCorrection") || force)
|
||||
{
|
||||
reverseAPIKeys.append("loPpmCorrection");
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
if (rtlsdr_set_freq_correction(m_dev, settings.m_loPpmCorrection) < 0) {
|
||||
@ -391,9 +385,8 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force)
|
||||
if (settingsKeys.contains("devSampleRate") || force)
|
||||
{
|
||||
reverseAPIKeys.append("devSampleRate");
|
||||
forwardChange = true;
|
||||
|
||||
if(m_dev != 0)
|
||||
@ -413,9 +406,8 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
|
||||
if (settingsKeys.contains("log2Decim") || force)
|
||||
{
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_rtlSDRThread) {
|
||||
@ -425,10 +417,8 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
qDebug("RTLSDRInput::applySettings: log2decim set to %d", settings.m_log2Decim);
|
||||
}
|
||||
|
||||
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
|
||||
if (settingsKeys.contains("fcPos") || force)
|
||||
{
|
||||
reverseAPIKeys.append("fcPos");
|
||||
|
||||
if (m_rtlSDRThread) {
|
||||
m_rtlSDRThread->setFcPos((int) settings.m_fcPos);
|
||||
}
|
||||
@ -436,34 +426,19 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
qDebug() << "RTLSDRInput::applySettings: set fc pos (enum) to " << (int) settings.m_fcPos;
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force) {
|
||||
reverseAPIKeys.append("devSampleRate");
|
||||
}
|
||||
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_rtlSDRThread) {
|
||||
m_rtlSDRThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||
|| (m_settings.m_fcPos != settings.m_fcPos)
|
||||
|| (m_settings.m_log2Decim != settings.m_log2Decim)
|
||||
|| (m_settings.m_devSampleRate != settings.m_devSampleRate)
|
||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency) || force)
|
||||
if (settingsKeys.contains("centerFrequency")
|
||||
|| settingsKeys.contains("fcPos")
|
||||
|| settingsKeys.contains("log2Decim")
|
||||
|| settingsKeys.contains("devSampleRate")
|
||||
|| settingsKeys.contains("transverterMode")
|
||||
|| settingsKeys.contains("transverterDeltaFrequency") || force)
|
||||
{
|
||||
qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency(
|
||||
settings.m_centerFrequency,
|
||||
@ -486,9 +461,8 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_noModMode != settings.m_noModMode) || force)
|
||||
if (settingsKeys.contains("noModMode") || force)
|
||||
{
|
||||
reverseAPIKeys.append("noModMode");
|
||||
qDebug() << "RTLSDRInput::applySettings: set noModMode to " << settings.m_noModMode;
|
||||
|
||||
// Direct Modes: 0: off, 1: I, 2: Q, 3: NoMod.
|
||||
@ -499,13 +473,8 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_lowSampleRate != settings.m_lowSampleRate) || force) {
|
||||
reverseAPIKeys.append("lowSampleRate");
|
||||
}
|
||||
|
||||
if ((m_settings.m_rfBandwidth != settings.m_rfBandwidth) || force)
|
||||
if (settingsKeys.contains("rfBandwidth") || force)
|
||||
{
|
||||
reverseAPIKeys.append("rfBandwidth");
|
||||
m_settings.m_rfBandwidth = settings.m_rfBandwidth;
|
||||
|
||||
if (m_dev != 0)
|
||||
@ -518,10 +487,8 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_offsetTuning != settings.m_offsetTuning) || force)
|
||||
if (settingsKeys.contains("offsetTuning") || force)
|
||||
{
|
||||
reverseAPIKeys.append("offsetTuning");
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
if (rtlsdr_set_offset_tuning(m_dev, m_settings.m_offsetTuning ? 0 : 1) != 0) {
|
||||
@ -532,10 +499,8 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_gain != settings.m_gain) || force)
|
||||
if (settingsKeys.contains("gain") || force)
|
||||
{
|
||||
reverseAPIKeys.append("gain");
|
||||
|
||||
if(m_dev != 0)
|
||||
{
|
||||
qDebug() << "Set tuner gain " << settings.m_gain;
|
||||
@ -547,10 +512,8 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_biasTee != settings.m_biasTee) || force)
|
||||
if (settingsKeys.contains("biasTee") || force)
|
||||
{
|
||||
reverseAPIKeys.append("biasTee");
|
||||
|
||||
if(m_dev != 0)
|
||||
{
|
||||
if (rtlsdr_set_bias_tee(m_dev, settings.m_biasTee ? 1 : 0) != 0) {
|
||||
@ -561,16 +524,20 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -608,12 +575,12 @@ int RTLSDRInput::webapiSettingsPutPatch(
|
||||
RTLSDRSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureRTLSDR *msg = MsgConfigureRTLSDR::create(settings, force);
|
||||
MsgConfigureRTLSDR *msg = MsgConfigureRTLSDR::create(settings, deviceSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureRTLSDR *msgToGUI = MsgConfigureRTLSDR::create(settings, force);
|
||||
MsgConfigureRTLSDR *msgToGUI = MsgConfigureRTLSDR::create(settings, deviceSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@ -773,7 +740,7 @@ void RTLSDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respons
|
||||
}
|
||||
}
|
||||
|
||||
void RTLSDRInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const RTLSDRSettings& settings, bool force)
|
||||
void RTLSDRInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RTLSDRSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||
swgDeviceSettings->setDirection(0); // single Rx
|
||||
|
@ -40,20 +40,23 @@ public:
|
||||
|
||||
public:
|
||||
const RTLSDRSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureRTLSDR* create(const RTLSDRSettings& settings, bool force)
|
||||
static MsgConfigureRTLSDR* create(const RTLSDRSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
return new MsgConfigureRTLSDR(settings, force);
|
||||
return new MsgConfigureRTLSDR(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
RTLSDRSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureRTLSDR(const RTLSDRSettings& settings, bool force) :
|
||||
MsgConfigureRTLSDR(const RTLSDRSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -155,9 +158,9 @@ private:
|
||||
|
||||
bool openDevice();
|
||||
void closeDevice();
|
||||
bool applySettings(const RTLSDRSettings& settings, bool force);
|
||||
bool applySettings(const RTLSDRSettings& settings, const QList<QString>& settingsKeys, bool force);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const RTLSDRSettings& settings, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RTLSDRSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
private slots:
|
||||
|
@ -131,4 +131,143 @@ bool RTLSDRSettings::deserialize(const QByteArray& data)
|
||||
}
|
||||
}
|
||||
|
||||
void RTLSDRSettings::applySettings(const QStringList& settingsKeys, const RTLSDRSettings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("centerFrequency")) {
|
||||
m_centerFrequency = settings.m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate")) {
|
||||
m_devSampleRate = settings.m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("lowSampleRate")) {
|
||||
m_lowSampleRate = settings.m_lowSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("gain")) {
|
||||
m_gain = settings.m_gain;
|
||||
}
|
||||
if (settingsKeys.contains("loPpmCorrection")) {
|
||||
m_loPpmCorrection = settings.m_loPpmCorrection;
|
||||
}
|
||||
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("iqImbalance")) {
|
||||
m_iqImbalance = settings.m_iqImbalance;
|
||||
}
|
||||
if (settingsKeys.contains("agc")) {
|
||||
m_agc = settings.m_agc;
|
||||
}
|
||||
if (settingsKeys.contains("noModMode")) {
|
||||
m_noModMode = settings.m_noModMode;
|
||||
}
|
||||
if (settingsKeys.contains("transverterMode")) {
|
||||
m_transverterMode = settings.m_transverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("iqOrder")) {
|
||||
m_iqOrder = settings.m_iqOrder;
|
||||
}
|
||||
if (settingsKeys.contains("centerFrequency")) {
|
||||
m_centerFrequency = settings.m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("transverterDeltaFrequency")) {
|
||||
m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("rfBandwidth")) {
|
||||
m_rfBandwidth = settings.m_rfBandwidth;
|
||||
}
|
||||
if (settingsKeys.contains("offsetTuning")) {
|
||||
m_offsetTuning = settings.m_offsetTuning;
|
||||
}
|
||||
if (settingsKeys.contains("biasTee")) {
|
||||
m_biasTee = settings.m_biasTee;
|
||||
}
|
||||
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 RTLSDRSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
||||
if (settingsKeys.contains("centerFrequency") || force) {
|
||||
ostr << " m_centerFrequency: " << m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate") || force) {
|
||||
ostr << " m_devSampleRate: " << m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("lowSampleRate") || force) {
|
||||
ostr << " m_lowSampleRate: " << m_lowSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("gain") || force) {
|
||||
ostr << " m_gain: " << m_gain;
|
||||
}
|
||||
if (settingsKeys.contains("loPpmCorrection") || force) {
|
||||
ostr << " m_loPpmCorrection: " << m_loPpmCorrection;
|
||||
}
|
||||
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("iqImbalance") || force) {
|
||||
ostr << " m_iqImbalance: " << m_iqImbalance;
|
||||
}
|
||||
if (settingsKeys.contains("mgc") || force) {
|
||||
ostr << " m_agc: " << m_agc;
|
||||
}
|
||||
if (settingsKeys.contains("noModMode") || force) {
|
||||
ostr << " m_noModMode: " << m_noModMode;
|
||||
}
|
||||
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("rfBandwidth") || force) {
|
||||
ostr << " m_rfBandwidth: " << m_rfBandwidth;
|
||||
}
|
||||
if (settingsKeys.contains("offsetTuning") || force) {
|
||||
ostr << " m_offsetTuning: " << m_offsetTuning;
|
||||
}
|
||||
if (settingsKeys.contains("biasTee") || force) {
|
||||
ostr << " m_biasTee: " << m_biasTee;
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ struct RTLSDRSettings {
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void applySettings(const QStringList& settingsKeys, const RTLSDRSettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user