From 952a32172da8c4eacd4c2bde67dcb5ad2e757bbb Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 20 Feb 2016 10:10:11 +0100 Subject: [PATCH] SDRdaemon plugin: update settings after deserialization --- Readme.md | 2 - .../samplesource/sdrdaemon/sdrdaemongui.cpp | 43 ++++++++++++++----- .../sdrdaemon/sdrdaemonudphandler.cpp | 2 +- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/Readme.md b/Readme.md index 6bd609853..3ee82d939 100644 --- a/Readme.md +++ b/Readme.md @@ -109,8 +109,6 @@ Note that this plugin does not require any of the hardware support libraries nor

SDRdaemon input

-Warning: this is experimental and not fulle debugged yet. - This is the client side of the SDRdaemon server. See the [SDRdaemon](https://github.com/f4exb/sdrdaemon) project in this Github repository. You must specify the address and UDP port to which the server connects and samples will flow into the SDRangel application (default is `127.0.0.1`port `9090`). It uses the meta data to retrieve the sample flow characteristics such as sample rate and receiveng center frequency. Note that this plugin does not require any of the hardware support libraries nor the libusb library. It is alwasys available in the list of devices as `SDRdaemon[0]` even if no physical device is connected. diff --git a/plugins/samplesource/sdrdaemon/sdrdaemongui.cpp b/plugins/samplesource/sdrdaemon/sdrdaemongui.cpp index 93dbfbfc7..926fbadff 100644 --- a/plugins/samplesource/sdrdaemon/sdrdaemongui.cpp +++ b/plugins/samplesource/sdrdaemon/sdrdaemongui.cpp @@ -114,33 +114,54 @@ bool SDRdaemonGui::deserialize(const QByteArray& data) QString address; uint32_t uintval; quint16 port; + bool dcBlock; + bool iqCorrection; - if(!d.isValid()) { + if (!d.isValid()) + { resetToDefaults(); + displaySettings(); return false; } - if(d.getVersion() == 1) { + if (d.getVersion() == 1) + { uint32_t uintval; - d.readString(1, &m_address, "127.0.0.1"); + d.readString(1, &address, "127.0.0.1"); d.readU32(2, &uintval, 9090); if ((uintval > 1024) && (uintval < 65536)) { - m_port = uintval; + port = uintval; } else { - m_port = 9090; + port = 9090; } - d.readBool(3, &m_dcBlock, false); - d.readBool(4, &m_iqCorrection, false); + d.readBool(3, &dcBlock, false); + d.readBool(4, &iqCorrection, false); + if ((address != m_address) || (port != m_port)) + { + m_address = address; + m_port = port; + configureUDPLink(); + } + + if ((dcBlock != m_dcBlock) || (iqCorrection != m_iqCorrection)) + { + m_dcBlock = dcBlock; + m_iqCorrection = iqCorrection; + configureAutoCorrections(); + } + + displaySettings(); return true; - } else { + } + else + { resetToDefaults(); + displaySettings(); return false; } - - displaySettings(); } qint64 SDRdaemonGui::getCenterFrequency() const @@ -260,7 +281,7 @@ void SDRdaemonGui::updateWithAcquisition() void SDRdaemonGui::updateWithStreamData() { - ui->centerFrequency->setValue(m_centerFrequency); + ui->centerFrequency->setValue(m_centerFrequency / 1000); QString s = QString::number(m_sampleRate/1000.0, 'f', 0); ui->sampleRateText->setText(tr("%1k").arg(s)); updateWithStreamTime(); // TODO: remove when time data is implemented diff --git a/plugins/samplesource/sdrdaemon/sdrdaemonudphandler.cpp b/plugins/samplesource/sdrdaemon/sdrdaemonudphandler.cpp index 4cbefe34d..a1dc0690f 100644 --- a/plugins/samplesource/sdrdaemon/sdrdaemonudphandler.cpp +++ b/plugins/samplesource/sdrdaemon/sdrdaemonudphandler.cpp @@ -136,7 +136,7 @@ void SDRdaemonUDPHandler::processData() DSPEngine::instance()->getInputMessageQueue()->push(notif); SDRdaemonInput::MsgReportSDRdaemonStreamData *report = SDRdaemonInput::MsgReportSDRdaemonStreamData::create( m_samplerate, - m_centerFrequency, // Frequency in kHz for the GUI + m_centerFrequency * 1000, // Frequency in Hz for the GUI m_tv_sec, m_tv_usec); m_outputMessageQueueToGUI->push(report);