diff --git a/plugins/samplesource/bladerf2input/bladerf2inputgui.cpp b/plugins/samplesource/bladerf2input/bladerf2inputgui.cpp
index 14c126aa7..02e78775a 100644
--- a/plugins/samplesource/bladerf2input/bladerf2inputgui.cpp
+++ b/plugins/samplesource/bladerf2input/bladerf2inputgui.cpp
@@ -385,7 +385,7 @@ void BladeRF2InputGui::on_transverter_clicked()
{
m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive();
m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency();
- qDebug("LimeSDRInputGUI::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
+ qDebug("BladeRF2InputGui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
updateFrequencyLimits();
setCenterFrequencySetting(ui->centerFrequency->getValueNew());
sendSettings();
diff --git a/plugins/samplesource/soapysdrinput/soapysdrinput.h b/plugins/samplesource/soapysdrinput/soapysdrinput.h
index 7bde0a771..e7c184f62 100644
--- a/plugins/samplesource/soapysdrinput/soapysdrinput.h
+++ b/plugins/samplesource/soapysdrinput/soapysdrinput.h
@@ -32,29 +32,67 @@ class SoapySDRInputThread;
class SoapySDRInput : public DeviceSampleSource
{
public:
- class MsgConfigureSoapySDR : public Message {
+ class MsgConfigureSoapySDRInput : public Message {
MESSAGE_CLASS_DECLARATION
public:
const SoapySDRInputSettings& getSettings() const { return m_settings; }
bool getForce() const { return m_force; }
- static MsgConfigureSoapySDR* create(const SoapySDRInputSettings& settings, bool force)
+ static MsgConfigureSoapySDRInput* create(const SoapySDRInputSettings& settings, bool force)
{
- return new MsgConfigureSoapySDR(settings, force);
+ return new MsgConfigureSoapySDRInput(settings, force);
}
private:
SoapySDRInputSettings m_settings;
bool m_force;
- MsgConfigureSoapySDR(const SoapySDRInputSettings& settings, bool force) :
+ MsgConfigureSoapySDRInput(const SoapySDRInputSettings& settings, bool force) :
Message(),
m_settings(settings),
m_force(force)
{ }
};
+ class MsgFileRecord : public Message {
+ MESSAGE_CLASS_DECLARATION
+
+ public:
+ bool getStartStop() const { return m_startStop; }
+
+ static MsgFileRecord* create(bool startStop) {
+ return new MsgFileRecord(startStop);
+ }
+
+ protected:
+ bool m_startStop;
+
+ MsgFileRecord(bool startStop) :
+ Message(),
+ m_startStop(startStop)
+ { }
+ };
+
+ class MsgStartStop : public Message {
+ MESSAGE_CLASS_DECLARATION
+
+ public:
+ bool getStartStop() const { return m_startStop; }
+
+ static MsgStartStop* create(bool startStop) {
+ return new MsgStartStop(startStop);
+ }
+
+ protected:
+ bool m_startStop;
+
+ MsgStartStop(bool startStop) :
+ Message(),
+ m_startStop(startStop)
+ { }
+ };
+
SoapySDRInput(DeviceSourceAPI *deviceAPI);
virtual ~SoapySDRInput();
virtual void destroy();
diff --git a/plugins/samplesource/soapysdrinput/soapysdrinputgui.cpp b/plugins/samplesource/soapysdrinput/soapysdrinputgui.cpp
index 1cc18b2b7..6c0ea16de 100644
--- a/plugins/samplesource/soapysdrinput/soapysdrinputgui.cpp
+++ b/plugins/samplesource/soapysdrinput/soapysdrinputgui.cpp
@@ -14,11 +14,14 @@
// along with this program. If not, see . //
///////////////////////////////////////////////////////////////////////////////////
+#include
+
#include "dsp/dspengine.h"
#include "dsp/dspcommands.h"
#include "device/devicesourceapi.h"
#include "device/deviceuiset.h"
#include "util/simpleserializer.h"
+#include "gui/glspectrum.h"
#include "ui_soapysdrinputgui.h"
#include "discreterangegui.h"
@@ -174,3 +177,175 @@ void SoapySDRInputGui::sampleRateChanged(double sampleRate)
{
qDebug("SoapySDRInputGui::sampleRateChanged: %lf", sampleRate);
}
+
+void SoapySDRInputGui::on_centerFrequency_changed(quint64 value)
+{
+ qDebug("SoapySDRInputGui::on_centerFrequency_changed: %llu", value);
+}
+
+void SoapySDRInputGui::on_dcOffset_toggled(bool checked)
+{
+ m_settings.m_dcBlock = checked;
+ sendSettings();
+}
+
+void SoapySDRInputGui::on_iqImbalance_toggled(bool checked)
+{
+ m_settings.m_iqCorrection = checked;
+ sendSettings();
+}
+
+void SoapySDRInputGui::on_decim_currentIndexChanged(int index)
+{
+ if ((index <0) || (index > 6))
+ return;
+ m_settings.m_log2Decim = index;
+ sendSettings();
+}
+
+void SoapySDRInputGui::on_fcPos_currentIndexChanged(int index)
+{
+ if (index == 0) {
+ m_settings.m_fcPos = SoapySDRInputSettings::FC_POS_INFRA;
+ sendSettings();
+ } else if (index == 1) {
+ m_settings.m_fcPos = SoapySDRInputSettings::FC_POS_SUPRA;
+ sendSettings();
+ } else if (index == 2) {
+ m_settings.m_fcPos = SoapySDRInputSettings::FC_POS_CENTER;
+ sendSettings();
+ }
+}
+
+void SoapySDRInputGui::on_transverter_clicked()
+{
+ m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive();
+ m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency();
+ qDebug("SoapySDRInputGui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
+ updateFrequencyLimits();
+ setCenterFrequencySetting(ui->centerFrequency->getValueNew());
+ sendSettings();
+}
+
+void SoapySDRInputGui::on_startStop_toggled(bool checked)
+{
+ if (m_doApplySettings)
+ {
+ SoapySDRInput::MsgStartStop *message = SoapySDRInput::MsgStartStop::create(checked);
+ m_sampleSource->getInputMessageQueue()->push(message);
+ }
+}
+
+void SoapySDRInputGui::on_record_toggled(bool checked)
+{
+ if (checked) {
+ ui->record->setStyleSheet("QToolButton { background-color : red; }");
+ } else {
+ ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
+ }
+
+ SoapySDRInput::MsgFileRecord* message = SoapySDRInput::MsgFileRecord::create(checked);
+ m_sampleSource->getInputMessageQueue()->push(message);
+}
+
+void SoapySDRInputGui::displaySettings()
+{
+ blockApplySettings(true);
+
+ ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
+ m_sampleRateGUI->setValue(m_settings.m_devSampleRate);
+
+ ui->dcOffset->setChecked(m_settings.m_dcBlock);
+ ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
+
+ ui->decim->setCurrentIndex(m_settings.m_log2Decim);
+ ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
+
+ blockApplySettings(false);
+}
+
+void SoapySDRInputGui::sendSettings()
+{
+ if (!m_updateTimer.isActive()) {
+ m_updateTimer.start(100);
+ }
+}
+
+void SoapySDRInputGui::updateSampleRateAndFrequency()
+{
+ m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
+ m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
+ ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_sampleRate / 1000.0f, 'g', 5)));
+}
+
+void SoapySDRInputGui::updateFrequencyLimits()
+{
+ // values in kHz
+ uint64_t f_min, f_max;
+ qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
+ m_sampleSource->getFrequencyRange(f_min, f_max);
+ qint64 minLimit = f_min/1000 + deltaFrequency;
+ qint64 maxLimit = f_max/1000 + deltaFrequency;
+
+ minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
+ maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
+
+ qDebug("SoapySDRInputGui::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
+
+ ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
+}
+
+void SoapySDRInputGui::setCenterFrequencySetting(uint64_t kHzValue)
+{
+ int64_t centerFrequency = kHzValue*1000;
+
+ m_settings.m_centerFrequency = centerFrequency < 0 ? 0 : (uint64_t) centerFrequency;
+ ui->centerFrequency->setToolTip(QString("Main center frequency in kHz (LO: %1 kHz)").arg(centerFrequency/1000));
+}
+
+void SoapySDRInputGui::blockApplySettings(bool block)
+{
+ m_doApplySettings = !block;
+}
+
+void SoapySDRInputGui::updateHardware()
+{
+ if (m_doApplySettings)
+ {
+ qDebug() << "SoapySDRInputGui::updateHardware";
+ SoapySDRInput::MsgConfigureSoapySDRInput* message = SoapySDRInput::MsgConfigureSoapySDRInput::create(m_settings, m_forceSettings);
+ m_sampleSource->getInputMessageQueue()->push(message);
+ m_forceSettings = false;
+ m_updateTimer.stop();
+ }
+}
+
+void SoapySDRInputGui::updateStatus()
+{
+ int state = m_deviceUISet->m_deviceSourceAPI->state();
+
+ if(m_lastEngineState != state)
+ {
+ switch(state)
+ {
+ case DSPDeviceSourceEngine::StNotStarted:
+ ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
+ break;
+ case DSPDeviceSourceEngine::StIdle:
+ ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
+ break;
+ case DSPDeviceSourceEngine::StRunning:
+ ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
+ break;
+ case DSPDeviceSourceEngine::StError:
+ ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
+ QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceSourceAPI->errorMessage());
+ break;
+ default:
+ break;
+ }
+
+ m_lastEngineState = state;
+ }
+}
+
diff --git a/plugins/samplesource/soapysdrinput/soapysdrinputgui.h b/plugins/samplesource/soapysdrinput/soapysdrinputgui.h
index 7517e610d..1c86d5fbb 100644
--- a/plugins/samplesource/soapysdrinput/soapysdrinputgui.h
+++ b/plugins/samplesource/soapysdrinput/soapysdrinputgui.h
@@ -60,6 +60,7 @@ private:
DeviceUISet* m_deviceUISet;
bool m_forceSettings;
bool m_doApplySettings;
+ SoapySDRInputSettings m_settings;
QTimer m_updateTimer;
QTimer m_statusTimer;
SoapySDRInput* m_sampleSource;
@@ -70,8 +71,25 @@ private:
ItemSettingGUI *m_sampleRateGUI;
+ void displaySettings();
+ void sendSettings();
+ void updateSampleRateAndFrequency();
+ void updateFrequencyLimits();
+ void setCenterFrequencySetting(uint64_t kHzValue);
+ void blockApplySettings(bool block);
+
private slots:
+ void on_centerFrequency_changed(quint64 value);
void sampleRateChanged(double sampleRate);
+ void on_dcOffset_toggled(bool checked);
+ void on_iqImbalance_toggled(bool checked);
+ void on_decim_currentIndexChanged(int index);
+ void on_fcPos_currentIndexChanged(int index);
+ void on_transverter_clicked();
+ void on_startStop_toggled(bool checked);
+ void on_record_toggled(bool checked);
+ void updateHardware();
+ void updateStatus();
};
diff --git a/plugins/samplesource/soapysdrinput/soapysdrinputgui.ui b/plugins/samplesource/soapysdrinput/soapysdrinputgui.ui
index 0da6bc007..2bb580f7a 100644
--- a/plugins/samplesource/soapysdrinput/soapysdrinputgui.ui
+++ b/plugins/samplesource/soapysdrinput/soapysdrinputgui.ui
@@ -166,6 +166,159 @@
+ -
+
+
+ 6
+
+
+ 6
+
+
-
+
+
+ Auto
+
+
+
+ -
+
+
+ Software DC block
+
+
+ DC
+
+
+
+ -
+
+
+ Software IQ correction
+
+
+ IQ
+
+
+
+ -
+
+
+ Fp
+
+
+
+ -
+
+
+
+ 50
+ 0
+
+
+
+ Relative position of device center frequency
+
+
-
+
+ Inf
+
+
+ -
+
+ Sup
+
+
+ -
+
+ Cen
+
+
+
+
+ -
+
+
+ Dec
+
+
+
+ -
+
+
+
+ 30
+ 0
+
+
+
+ Software decimation factor
+
+
-
+
+ 1
+
+
+ -
+
+ 2
+
+
+ -
+
+ 4
+
+
+ -
+
+ 8
+
+
+ -
+
+ 16
+
+
+ -
+
+ 32
+
+
+ -
+
+ 64
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 24
+ 24
+
+
+
+ X
+
+
+
+
+
-
@@ -358,6 +511,11 @@
QToolButton
+
+ TransverterButton
+ QPushButton
+
+