| 
									
										
										
										
											2016-05-12 11:10:10 +02:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2015 Edouard Griffiths, F4EXB                                   //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify          //
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by          //
 | 
					
						
							|  |  |  | // the Free Software Foundation as version 3 of the License, or                  //
 | 
					
						
							| 
									
										
										
										
											2019-04-11 06:57:41 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2016-05-12 11:10:10 +02:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,               //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-26 02:03:20 +02:00
										 |  |  | #include <QDebug>
 | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  | #include <QMessageBox>
 | 
					
						
							| 
									
										
										
										
											2020-04-01 08:44:51 +02:00
										 |  |  | #include <QFileDialog>
 | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | #include "rtlsdrgui.h"
 | 
					
						
							| 
									
										
										
										
											2016-10-02 10:30:58 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  | #include "device/deviceapi.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-30 00:02:28 +01:00
										 |  |  | #include "device/deviceuiset.h"
 | 
					
						
							| 
									
										
										
										
											2016-10-02 10:30:58 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | #include "ui_rtlsdrgui.h"
 | 
					
						
							| 
									
										
										
										
											2015-08-02 01:45:53 +02:00
										 |  |  | #include "gui/colormapper.h"
 | 
					
						
							| 
									
										
										
										
											2016-05-12 11:10:10 +02:00
										 |  |  | #include "gui/glspectrum.h"
 | 
					
						
							| 
									
										
										
										
											2018-12-17 00:34:14 +01:00
										 |  |  | #include "gui/crightclickenabler.h"
 | 
					
						
							| 
									
										
										
										
											2018-12-17 01:25:54 +01:00
										 |  |  | #include "gui/basicdevicesettingsdialog.h"
 | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | #include "dsp/dspengine.h"
 | 
					
						
							| 
									
										
										
										
											2016-05-12 11:10:10 +02:00
										 |  |  | #include "dsp/dspcommands.h"
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-30 00:45:23 +01:00
										 |  |  | RTLSDRGui::RTLSDRGui(DeviceUISet *deviceUISet, QWidget* parent) : | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | 	DeviceGUI(parent), | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	ui(new Ui::RTLSDRGui), | 
					
						
							| 
									
										
										
										
											2017-10-30 00:02:28 +01:00
										 |  |  | 	m_deviceUISet(deviceUISet), | 
					
						
							| 
									
										
										
										
											2017-12-09 10:49:20 +01:00
										 |  |  | 	m_doApplySettings(true), | 
					
						
							| 
									
										
										
										
											2017-10-14 07:07:32 +02:00
										 |  |  | 	m_forceSettings(true), | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	m_settings(), | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  |     m_sampleRateMode(true), | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  | 	m_sampleSource(0), | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  | 	m_lastEngineState(DeviceAPI::StNotStarted) | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |     m_sampleSource = (RTLSDRInput*) m_deviceUISet->m_deviceAPI->getSampleSource(); | 
					
						
							| 
									
										
										
										
											2017-04-12 23:41:30 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ui->setupUi(this); | 
					
						
							| 
									
										
										
										
											2017-05-16 18:27:36 +02:00
										 |  |  | 	ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); | 
					
						
							| 
									
										
										
										
											2017-09-23 19:15:56 +02:00
										 |  |  | 	updateFrequencyLimits(); | 
					
						
							| 
									
										
										
										
											2016-03-29 16:22:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 18:27:36 +02:00
										 |  |  |     ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow)); | 
					
						
							| 
									
										
										
										
											2016-03-29 16:22:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-16 01:01:24 +01:00
										 |  |  |     ui->rfBW->setColorMapper(ColorMapper(ColorMapper::GrayYellow)); | 
					
						
							| 
									
										
										
										
											2021-01-31 17:20:46 +01:00
										 |  |  |     ui->rfBW->setValueRange(4, 0, 10000); | 
					
						
							| 
									
										
										
										
											2018-01-16 01:01:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  | 	connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); | 
					
						
							|  |  |  | 	m_statusTimer.start(500); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	displaySettings(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-24 19:58:26 +01:00
										 |  |  | 	m_gains = m_sampleSource->getGains(); | 
					
						
							|  |  |  | 	displayGains(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 01:23:54 +02:00
										 |  |  | 	connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection); | 
					
						
							| 
									
										
										
										
											2018-05-25 19:28:57 +02:00
										 |  |  |     m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue); | 
					
						
							| 
									
										
										
										
											2018-12-17 00:34:14 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop); | 
					
						
							|  |  |  |     connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &))); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | RTLSDRGui::~RTLSDRGui() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	delete ui; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void RTLSDRGui::destroy() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	delete this; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void RTLSDRGui::resetToDefaults() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_settings.resetToDefaults(); | 
					
						
							|  |  |  | 	displaySettings(); | 
					
						
							|  |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-01 05:05:46 +02:00
										 |  |  | void RTLSDRGui::on_dcOffset_toggled(bool checked) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_settings.m_dcBlock = checked; | 
					
						
							|  |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void RTLSDRGui::on_iqImbalance_toggled(bool checked) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_settings.m_iqImbalance = checked; | 
					
						
							|  |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | QByteArray RTLSDRGui::serialize() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-02-21 05:35:20 +01:00
										 |  |  |     return m_settings.serialize(); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool RTLSDRGui::deserialize(const QByteArray& data) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-02-21 05:35:20 +01:00
										 |  |  |     if(m_settings.deserialize(data)) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-04-13 01:21:25 +02:00
										 |  |  |         displayGains(); | 
					
						
							| 
									
										
										
										
											2017-02-21 05:35:20 +01:00
										 |  |  |         displaySettings(); | 
					
						
							| 
									
										
										
										
											2017-10-14 07:07:32 +02:00
										 |  |  |         m_forceSettings = true; | 
					
						
							| 
									
										
										
										
											2017-02-21 05:35:20 +01:00
										 |  |  |         sendSettings(); | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         resetToDefaults(); | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | bool RTLSDRGui::handleMessage(const Message& message) | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-24 19:58:26 +01:00
										 |  |  | 	if (RTLSDRInput::MsgConfigureRTLSDR::match(message)) | 
					
						
							| 
									
										
										
										
											2017-12-08 14:40:12 +01:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 	    const RTLSDRInput::MsgConfigureRTLSDR& cfg = (RTLSDRInput::MsgConfigureRTLSDR&) message; | 
					
						
							|  |  |  | 	    m_settings = cfg.getSettings(); | 
					
						
							| 
									
										
										
										
											2017-12-09 10:49:20 +01:00
										 |  |  | 	    blockApplySettings(true); | 
					
						
							|  |  |  | 	    displayGains(); | 
					
						
							| 
									
										
										
										
											2017-12-08 14:40:12 +01:00
										 |  |  | 	    displaySettings(); | 
					
						
							| 
									
										
										
										
											2017-12-09 10:49:20 +01:00
										 |  |  | 	    blockApplySettings(false); | 
					
						
							| 
									
										
										
										
											2017-12-08 14:40:12 +01:00
										 |  |  | 	    return true; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-12-28 03:21:48 +01:00
										 |  |  | 	else if (RTLSDRInput::MsgStartStop::match(message)) | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         RTLSDRInput::MsgStartStop& notif = (RTLSDRInput::MsgStartStop&) message; | 
					
						
							|  |  |  |         blockApplySettings(true); | 
					
						
							|  |  |  |         ui->startStop->setChecked(notif.getStartStop()); | 
					
						
							|  |  |  |         blockApplySettings(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 	else | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 01:23:54 +02:00
										 |  |  | void RTLSDRGui::handleInputMessages() | 
					
						
							| 
									
										
										
										
											2016-05-12 11:10:10 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Message* message; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 01:23:54 +02:00
										 |  |  |     while ((message = m_inputMessageQueue.pop()) != 0) | 
					
						
							| 
									
										
										
										
											2016-05-12 11:10:10 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-09-17 01:23:54 +02:00
										 |  |  |         qDebug("RTLSDRGui::handleInputMessages: message: %s", message->getIdentifier()); | 
					
						
							| 
									
										
										
										
											2016-05-12 11:10:10 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if (DSPSignalNotification::match(*message)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             DSPSignalNotification* notif = (DSPSignalNotification*) message; | 
					
						
							|  |  |  |             m_sampleRate = notif->getSampleRate(); | 
					
						
							|  |  |  |             m_deviceCenterFrequency = notif->getCenterFrequency(); | 
					
						
							| 
									
										
										
										
											2017-09-17 01:23:54 +02:00
										 |  |  |             qDebug("RTLSDRGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency()); | 
					
						
							| 
									
										
										
										
											2016-05-12 11:10:10 +02:00
										 |  |  |             updateSampleRateAndFrequency(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             delete message; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-09-17 01:23:54 +02:00
										 |  |  |         else | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             if (handleMessage(*message)) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 delete message; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-05-12 11:10:10 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void RTLSDRGui::updateSampleRateAndFrequency() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-30 00:02:28 +01:00
										 |  |  |     m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate); | 
					
						
							|  |  |  |     m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  |     displaySampleRate(); | 
					
						
							| 
									
										
										
										
											2016-05-12 11:10:10 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-23 19:15:56 +02:00
										 |  |  | void RTLSDRGui::updateFrequencyLimits() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     // values in kHz
 | 
					
						
							| 
									
										
										
										
											2017-09-24 02:08:08 +02:00
										 |  |  |     qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0; | 
					
						
							|  |  |  |     qint64 minLimit = (m_settings.m_noModMode ? RTLSDRInput::frequencyLowRangeMin : RTLSDRInput::frequencyHighRangeMin) + deltaFrequency; | 
					
						
							|  |  |  |     qint64 maxLimit = (m_settings.m_noModMode ? RTLSDRInput::frequencyLowRangeMax : RTLSDRInput::frequencyHighRangeMax) + deltaFrequency; | 
					
						
							| 
									
										
										
										
											2017-09-23 19:15:56 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit; | 
					
						
							|  |  |  |     maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-24 02:08:08 +02:00
										 |  |  |     qDebug("RTLSDRGui::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-23 19:15:56 +02:00
										 |  |  |     ui->centerFrequency->setValueRange(7, minLimit, maxLimit); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-13 01:21:25 +02:00
										 |  |  | void RTLSDRGui::displayGains() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (m_gains.size() > 0) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         int dist = abs(m_settings.m_gain - m_gains[0]); | 
					
						
							|  |  |  |         int pos = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for (uint i = 1; i < m_gains.size(); i++) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             if (abs(m_settings.m_gain - m_gains[i]) < dist) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 dist = abs(m_settings.m_gain - m_gains[i]); | 
					
						
							|  |  |  |                 pos = i; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ui->gainText->setText(tr("%1.%2").arg(m_gains[pos] / 10).arg(abs(m_gains[pos] % 10))); | 
					
						
							|  |  |  |         ui->gain->setMaximum(m_gains.size() - 1); | 
					
						
							|  |  |  |         ui->gain->setEnabled(true); | 
					
						
							|  |  |  |         ui->gain->setValue(pos); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         ui->gain->setMaximum(0); | 
					
						
							|  |  |  |         ui->gain->setEnabled(false); | 
					
						
							|  |  |  |         ui->gain->setValue(0); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  | void RTLSDRGui::displaySampleRate() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ui->sampleRate->blockSignals(true); | 
					
						
							| 
									
										
										
										
											2019-04-07 12:34:45 +02:00
										 |  |  |     displayFcTooltip(); | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (m_sampleRateMode) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-04-07 12:34:45 +02:00
										 |  |  |         ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(60,60,60); }"); | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  |         ui->sampleRateMode->setText("SR"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (m_settings.m_lowSampleRate) { | 
					
						
							|  |  |  |             ui->sampleRate->setValueRange(7, RTLSDRInput::sampleRateLowRangeMin, RTLSDRInput::sampleRateLowRangeMax); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             ui->sampleRate->setValueRange(7, RTLSDRInput::sampleRateHighRangeMin, RTLSDRInput::sampleRateHighRangeMax); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ui->sampleRate->setValue(m_settings.m_devSampleRate); | 
					
						
							|  |  |  |         ui->sampleRate->setToolTip("Device to host sample rate (S/s)"); | 
					
						
							|  |  |  |         ui->deviceRateText->setToolTip("Baseband sample rate (S/s)"); | 
					
						
							|  |  |  |         uint32_t basebandSampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim); | 
					
						
							|  |  |  |         ui->deviceRateText->setText(tr("%1k").arg(QString::number(basebandSampleRate / 1000.0f, 'g', 5))); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-04-07 12:34:45 +02:00
										 |  |  |         ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(50,50,50); }"); | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  |         ui->sampleRateMode->setText("BB"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (m_settings.m_lowSampleRate) { | 
					
						
							|  |  |  |             ui->sampleRate->setValueRange(7, RTLSDRInput::sampleRateLowRangeMin/(1<<m_settings.m_log2Decim), RTLSDRInput::sampleRateLowRangeMax/(1<<m_settings.m_log2Decim)); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             ui->sampleRate->setValueRange(7, RTLSDRInput::sampleRateHighRangeMin/(1<<m_settings.m_log2Decim), RTLSDRInput::sampleRateHighRangeMax/(1<<m_settings.m_log2Decim)); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ui->sampleRate->setValue(m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim)); | 
					
						
							|  |  |  |         ui->sampleRate->setToolTip("Baseband sample rate (S/s)"); | 
					
						
							|  |  |  |         ui->deviceRateText->setToolTip("Device to host sample rate (S/s)"); | 
					
						
							|  |  |  |         ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_settings.m_devSampleRate / 1000.0f, 'g', 5))); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->sampleRate->blockSignals(false); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-07 12:34:45 +02:00
										 |  |  | void RTLSDRGui::displayFcTooltip() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int32_t fShift = DeviceSampleSource::calculateFrequencyShift( | 
					
						
							|  |  |  |         m_settings.m_log2Decim, | 
					
						
							|  |  |  |         (DeviceSampleSource::fcPos_t) m_settings.m_fcPos, | 
					
						
							|  |  |  |         m_settings.m_devSampleRate, | 
					
						
							|  |  |  |         DeviceSampleSource::FrequencyShiftScheme::FSHIFT_STD | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     ui->fcPos->setToolTip(tr("Relative position of device center frequency: %1 kHz").arg(QString::number(fShift / 1000.0f, 'g', 5))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | void RTLSDRGui::displaySettings() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-09-24 02:44:20 +02:00
										 |  |  |     ui->transverter->setDeltaFrequency(m_settings.m_transverterDeltaFrequency); | 
					
						
							|  |  |  |     ui->transverter->setDeltaFrequencyActive(m_settings.m_transverterMode); | 
					
						
							| 
									
										
										
										
											2020-06-23 05:04:41 +02:00
										 |  |  |     ui->transverter->setIQOrder(m_settings.m_iqOrder); | 
					
						
							| 
									
										
										
										
											2017-09-24 02:44:20 +02:00
										 |  |  |     updateFrequencyLimits(); | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 	ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  | 	displaySampleRate(); | 
					
						
							| 
									
										
										
										
											2018-01-16 01:01:24 +01:00
										 |  |  | 	ui->rfBW->setValue(m_settings.m_rfBandwidth / 1000); | 
					
						
							| 
									
										
										
										
											2015-10-01 05:05:46 +02:00
										 |  |  | 	ui->dcOffset->setChecked(m_settings.m_dcBlock); | 
					
						
							|  |  |  | 	ui->iqImbalance->setChecked(m_settings.m_iqImbalance); | 
					
						
							| 
									
										
										
										
											2015-05-10 00:08:42 +02:00
										 |  |  | 	ui->ppm->setValue(m_settings.m_loPpmCorrection); | 
					
						
							|  |  |  | 	ui->ppmText->setText(tr("%1").arg(m_settings.m_loPpmCorrection)); | 
					
						
							| 
									
										
										
										
											2016-03-29 16:22:24 +02:00
										 |  |  | 	ui->decim->setCurrentIndex(m_settings.m_log2Decim); | 
					
						
							| 
									
										
										
										
											2015-10-01 06:30:50 +02:00
										 |  |  | 	ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos); | 
					
						
							| 
									
										
										
										
											2017-09-23 19:15:56 +02:00
										 |  |  | 	ui->checkBox->setChecked(m_settings.m_noModMode); | 
					
						
							| 
									
										
										
										
											2017-09-24 03:12:27 +02:00
										 |  |  | 	ui->agc->setChecked(m_settings.m_agc); | 
					
						
							| 
									
										
										
										
											2018-07-30 01:38:48 +02:00
										 |  |  | 	ui->lowSampleRate->setChecked(m_settings.m_lowSampleRate); | 
					
						
							| 
									
										
										
										
											2018-11-26 08:54:06 +01:00
										 |  |  | 	ui->offsetTuning->setChecked(m_settings.m_offsetTuning); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void RTLSDRGui::sendSettings() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if(!m_updateTimer.isActive()) | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 		m_updateTimer.start(100); | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void RTLSDRGui::on_centerFrequency_changed(quint64 value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 	m_settings.m_centerFrequency = value * 1000; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-29 16:22:24 +02:00
										 |  |  | void RTLSDRGui::on_decim_currentIndexChanged(int index) | 
					
						
							| 
									
										
										
										
											2015-05-09 16:44:26 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  | 	if ((index <0) || (index > 6)) { | 
					
						
							| 
									
										
										
										
											2015-05-09 16:44:26 +02:00
										 |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-29 16:22:24 +02:00
										 |  |  | 	m_settings.m_log2Decim = index; | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  |     displaySampleRate(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_sampleRateMode) { | 
					
						
							|  |  |  |         m_settings.m_devSampleRate = ui->sampleRate->getValueNew(); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Decim); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-09 16:44:26 +02:00
										 |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-01 06:30:50 +02:00
										 |  |  | void RTLSDRGui::on_fcPos_currentIndexChanged(int index) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-07 12:34:45 +02:00
										 |  |  |     m_settings.m_fcPos = (RTLSDRSettings::fcPos_t) (index < 0 ? 0 : index > 2 ? 2 : index); | 
					
						
							|  |  |  |     displayFcTooltip(); | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2015-10-01 06:30:50 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-09 00:54:01 +02:00
										 |  |  | void RTLSDRGui::on_ppm_valueChanged(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2021-02-23 06:56:26 +01:00
										 |  |  | 	if ((value > 200) || (value < -200)) | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2015-05-09 00:54:01 +02:00
										 |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-09 00:54:01 +02:00
										 |  |  | 	ui->ppmText->setText(tr("%1").arg(value)); | 
					
						
							|  |  |  | 	m_settings.m_loPpmCorrection = value; | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-09 00:54:01 +02:00
										 |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | void RTLSDRGui::on_gain_valueChanged(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 	if (value > (int)m_gains.size()) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	int gain = m_gains[value]; | 
					
						
							|  |  |  | 	ui->gainText->setText(tr("%1.%2").arg(gain / 10).arg(abs(gain % 10))); | 
					
						
							|  |  |  | 	m_settings.m_gain = gain; | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  | void RTLSDRGui::on_startStop_toggled(bool checked) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |     if (m_doApplySettings) | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |         RTLSDRInput::MsgStartStop *message = RTLSDRInput::MsgStartStop::create(checked); | 
					
						
							|  |  |  |         m_sampleSource->getInputMessageQueue()->push(message); | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-24 02:08:08 +02:00
										 |  |  | void RTLSDRGui::on_transverter_clicked() | 
					
						
							| 
									
										
										
										
											2017-09-23 19:15:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-09-24 02:08:08 +02:00
										 |  |  |     m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive(); | 
					
						
							|  |  |  |     m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency(); | 
					
						
							| 
									
										
										
										
											2020-06-23 05:04:41 +02:00
										 |  |  |     m_settings.m_iqOrder = ui->transverter->getIQOrder(); | 
					
						
							| 
									
										
										
										
											2017-09-24 02:08:08 +02:00
										 |  |  |     qDebug("RTLSDRGui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off"); | 
					
						
							| 
									
										
										
										
											2017-09-23 19:15:56 +02:00
										 |  |  |     updateFrequencyLimits(); | 
					
						
							| 
									
										
										
										
											2017-09-23 21:59:39 +02:00
										 |  |  |     m_settings.m_centerFrequency = ui->centerFrequency->getValueNew()*1000; | 
					
						
							| 
									
										
										
										
											2017-09-23 19:15:56 +02:00
										 |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  | void RTLSDRGui::on_sampleRateMode_toggled(bool checked) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_sampleRateMode = checked; | 
					
						
							|  |  |  |     displaySampleRate(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-27 06:13:48 +02:00
										 |  |  | void RTLSDRGui::on_biasT_stateChanged(int state) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_settings.m_biasTee = (state == Qt::Checked); | 
					
						
							|  |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | void RTLSDRGui::updateHardware() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-09 10:49:20 +01:00
										 |  |  |     if (m_doApplySettings) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         RTLSDRInput::MsgConfigureRTLSDR* message = RTLSDRInput::MsgConfigureRTLSDR::create(m_settings, m_forceSettings); | 
					
						
							|  |  |  |         m_sampleSource->getInputMessageQueue()->push(message); | 
					
						
							|  |  |  |         m_forceSettings = false; | 
					
						
							|  |  |  |         m_updateTimer.stop(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2014-11-07 19:26:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  | void RTLSDRGui::updateStatus() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |     int state = m_deviceUISet->m_deviceAPI->state(); | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if(m_lastEngineState != state) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         switch(state) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StNotStarted: | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StIdle: | 
					
						
							| 
									
										
										
										
											2016-05-12 10:31:57 +02:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background-color : blue; }"); | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StRunning: | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background-color : green; }"); | 
					
						
							|  |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StError: | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background-color : red; }"); | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |                 QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage()); | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  |                 break; | 
					
						
							|  |  |  |             default: | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         m_lastEngineState = state; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-09 10:49:20 +01:00
										 |  |  | void RTLSDRGui::blockApplySettings(bool block) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_doApplySettings = !block; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | void RTLSDRGui::on_checkBox_stateChanged(int state) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (state == Qt::Checked) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2014-11-07 19:26:02 +00:00
										 |  |  | 		ui->gain->setEnabled(false); | 
					
						
							| 
									
										
										
										
											2017-09-23 19:15:56 +02:00
										 |  |  |         m_settings.m_noModMode = true; | 
					
						
							|  |  |  | 	    updateFrequencyLimits(); | 
					
						
							| 
									
										
										
										
											2014-11-09 12:56:53 +00:00
										 |  |  | 		ui->centerFrequency->setValue(7000); | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 		m_settings.m_centerFrequency = 7000 * 1000; | 
					
						
							| 
									
										
										
										
											2014-11-07 19:26:02 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 	else | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2014-11-07 19:26:02 +00:00
										 |  |  | 		ui->gain->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2017-09-23 19:15:56 +02:00
										 |  |  |         m_settings.m_noModMode = false; | 
					
						
							|  |  |  | 	    updateFrequencyLimits(); | 
					
						
							| 
									
										
										
										
											2014-11-09 12:56:53 +00:00
										 |  |  | 		ui->centerFrequency->setValue(434000); | 
					
						
							|  |  |  | 		ui->gain->setValue(0); | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 		m_settings.m_centerFrequency = 435000 * 1000; | 
					
						
							| 
									
										
										
										
											2014-11-07 19:26:02 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-09 12:56:53 +00:00
										 |  |  | 	sendSettings(); | 
					
						
							| 
									
										
										
										
											2014-11-07 19:26:02 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-23 16:57:13 +02:00
										 |  |  | void RTLSDRGui::on_agc_stateChanged(int state) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_agc = (state == Qt::Checked); | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-02 03:34:03 +02:00
										 |  |  | void RTLSDRGui::on_sampleRate_changed(quint64 value) | 
					
						
							| 
									
										
										
										
											2015-05-10 00:08:42 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  |     if (m_sampleRateMode) { | 
					
						
							|  |  |  |         m_settings.m_devSampleRate = value; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         m_settings.m_devSampleRate = value * (1 << m_settings.m_log2Decim); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-07 12:34:45 +02:00
										 |  |  |     displayFcTooltip(); | 
					
						
							| 
									
										
										
										
											2017-04-02 02:00:05 +02:00
										 |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2015-05-10 00:08:42 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-26 08:54:06 +01:00
										 |  |  | void RTLSDRGui::on_offsetTuning_toggled(bool checked) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_offsetTuning = checked; | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-16 01:01:24 +01:00
										 |  |  | void RTLSDRGui::on_rfBW_changed(quint64 value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_rfBandwidth = value * 1000; | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-02 02:00:05 +02:00
										 |  |  | void RTLSDRGui::on_lowSampleRate_toggled(bool checked) | 
					
						
							| 
									
										
										
										
											2015-05-10 00:08:42 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-07-30 01:38:48 +02:00
										 |  |  |     m_settings.m_lowSampleRate = checked; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  |     displaySampleRate(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_sampleRateMode) { | 
					
						
							|  |  |  |         m_settings.m_devSampleRate = ui->sampleRate->getValueNew(); | 
					
						
							| 
									
										
										
										
											2017-04-02 02:00:05 +02:00
										 |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  |         m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Decim); | 
					
						
							| 
									
										
										
										
											2017-04-02 02:00:05 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-03-29 16:22:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-02 02:00:05 +02:00
										 |  |  |     qDebug("RTLSDRGui::on_lowSampleRate_toggled: %d S/s", m_settings.m_devSampleRate); | 
					
						
							| 
									
										
										
										
											2019-04-07 02:06:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-02 02:00:05 +02:00
										 |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2016-03-29 16:22:24 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-12-17 00:34:14 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | void RTLSDRGui::openDeviceSettingsDialog(const QPoint& p) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-12-17 01:25:54 +01:00
										 |  |  |     BasicDeviceSettingsDialog dialog(this); | 
					
						
							| 
									
										
										
										
											2018-12-17 08:51:59 +01:00
										 |  |  |     dialog.setUseReverseAPI(m_settings.m_useReverseAPI); | 
					
						
							|  |  |  |     dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress); | 
					
						
							|  |  |  |     dialog.setReverseAPIPort(m_settings.m_reverseAPIPort); | 
					
						
							|  |  |  |     dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-17 01:25:54 +01:00
										 |  |  |     dialog.move(p); | 
					
						
							|  |  |  |     dialog.exec(); | 
					
						
							| 
									
										
										
										
											2018-12-17 08:51:59 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     m_settings.m_useReverseAPI = dialog.useReverseAPI(); | 
					
						
							|  |  |  |     m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress(); | 
					
						
							|  |  |  |     m_settings.m_reverseAPIPort = dialog.getReverseAPIPort(); | 
					
						
							|  |  |  |     m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2018-12-17 00:34:14 +01:00
										 |  |  | } |