| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2023-11-18 09:58:55 +01:00
										 |  |  | // Copyright (C) 2015-2020, 2022-2023 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
 | 
					
						
							|  |  |  | // Copyright (C) 2022-2023 Jon Beniston, M7RCE <jon@beniston.com>                //
 | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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:39:30 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01: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/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QDebug>
 | 
					
						
							|  |  |  | #include <QMessageBox>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <libbladeRF.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 06:27:40 +02:00
										 |  |  | #include "ui_bladerf1outputgui.h"
 | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | #include "gui/colormapper.h"
 | 
					
						
							|  |  |  | #include "gui/glspectrum.h"
 | 
					
						
							| 
									
										
										
										
											2018-12-26 19:22:52 +01:00
										 |  |  | #include "gui/basicdevicesettingsdialog.h"
 | 
					
						
							| 
									
										
										
										
											2022-12-20 10:31:15 +00:00
										 |  |  | #include "gui/dialogpositioner.h"
 | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | #include "dsp/dspcommands.h"
 | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  | #include "device/deviceapi.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-30 01:11:35 +01:00
										 |  |  | #include "device/deviceuiset.h"
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | #include "bladerf1outputgui.h"
 | 
					
						
							| 
									
										
										
										
											2018-09-19 05:26:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | Bladerf1OutputGui::Bladerf1OutputGui(DeviceUISet *deviceUISet, QWidget* parent) : | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | 	DeviceGUI(parent), | 
					
						
							| 
									
										
										
										
											2018-09-19 06:27:40 +02:00
										 |  |  | 	ui(new Ui::Bladerf1OutputGui), | 
					
						
							| 
									
										
										
										
											2017-12-14 00:38:22 +01:00
										 |  |  | 	m_doApplySettings(true), | 
					
						
							| 
									
										
										
										
											2017-10-14 07:10:42 +02:00
										 |  |  | 	m_forceSettings(true), | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	m_settings(), | 
					
						
							| 
									
										
										
										
											2019-04-12 00:18:29 +02:00
										 |  |  |     m_sampleRateMode(true), | 
					
						
							|  |  |  | 	m_deviceSampleSink(nullptr), | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	m_sampleRate(0), | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  | 	m_lastEngineState(DeviceAPI::StNotStarted) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-05-13 22:24:48 +02:00
										 |  |  |     m_deviceUISet = deviceUISet; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     setAttribute(Qt::WA_DeleteOnClose, true); | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |     m_deviceSampleSink = (Bladerf1Output*) m_deviceUISet->m_deviceAPI->getSampleSink(); | 
					
						
							| 
									
										
										
										
											2017-04-13 20:34:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     ui->setupUi(getContents()); | 
					
						
							| 
									
										
										
										
											2022-11-09 15:53:44 +00:00
										 |  |  |     sizeToContents(); | 
					
						
							| 
									
										
										
										
											2022-04-24 02:13:18 +02:00
										 |  |  |     getContents()->setStyleSheet("#Bladerf1OutputGui { background-color: rgb(64, 64, 64); }"); | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     m_helpURL = "/plugins/samplesink/bladerf1output/readme.md";	ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); | 
					
						
							| 
									
										
										
										
											2022-10-17 13:43:32 +01:00
										 |  |  | 	ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN_XB200/1000, BLADERF_FREQUENCY_MAX/1000); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 18:27:36 +02:00
										 |  |  |     ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow)); | 
					
						
							| 
									
										
										
										
											2017-04-02 04:34:58 +02:00
										 |  |  |     ui->sampleRate->setValueRange(8, BLADERF_SAMPLERATE_MIN, BLADERF_SAMPLERATE_REC_MAX); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	ui->bandwidth->clear(); | 
					
						
							| 
									
										
										
										
											2017-05-25 20:13:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	for (unsigned int i = 0; i < BladerfBandwidths::getNbBandwidths(); i++) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		ui->bandwidth->addItem(QString::number(BladerfBandwidths::getBandwidth(i))); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); | 
					
						
							|  |  |  | 	connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); | 
					
						
							|  |  |  | 	m_statusTimer.start(500); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02:00
										 |  |  |     connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &))); | 
					
						
							| 
									
										
										
										
											2018-12-26 19:22:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	displaySettings(); | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     makeUIConnections(); | 
					
						
							| 
									
										
										
										
											2023-11-13 20:51:03 +00:00
										 |  |  |     m_resizer.enableChildMouseTracking(); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  | 	connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | Bladerf1OutputGui::~Bladerf1OutputGui() | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-10-05 15:40:09 +01:00
										 |  |  |     m_statusTimer.stop(); | 
					
						
							|  |  |  |     m_updateTimer.stop(); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	delete ui; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::destroy() | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	delete this; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::resetToDefaults() | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	m_settings.resetToDefaults(); | 
					
						
							|  |  |  | 	displaySettings(); | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     m_forceSettings = true; | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | QByteArray Bladerf1OutputGui::serialize() const | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	return m_settings.serialize(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | bool Bladerf1OutputGui::deserialize(const QByteArray& data) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 	if (m_settings.deserialize(data)) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 		displaySettings(); | 
					
						
							| 
									
										
										
										
											2017-10-14 07:10:42 +02:00
										 |  |  | 		m_forceSettings = true; | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 		sendSettings(); | 
					
						
							|  |  |  | 		return true; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 		resetToDefaults(); | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | bool Bladerf1OutputGui::handleMessage(const Message& message) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  |     if (Bladerf1Output::MsgConfigureBladerf1::match(message)) | 
					
						
							| 
									
										
										
										
											2017-12-28 04:04:50 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  |         const Bladerf1Output::MsgConfigureBladerf1& cfg = (Bladerf1Output::MsgConfigureBladerf1&) message; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if (cfg.getForce()) { | 
					
						
							|  |  |  |             m_settings = cfg.getSettings(); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings()); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-28 04:04:50 +01:00
										 |  |  |         blockApplySettings(true); | 
					
						
							|  |  |  |         displaySettings(); | 
					
						
							|  |  |  |         blockApplySettings(false); | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  |     else if (Bladerf1Output::MsgReportBladerf1::match(message)) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		displaySettings(); | 
					
						
							|  |  |  | 		return true; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  |     else if (Bladerf1Output::MsgStartStop::match(message)) | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  |         Bladerf1Output::MsgStartStop& notif = (Bladerf1Output::MsgStartStop&) message; | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |         blockApplySettings(true); | 
					
						
							|  |  |  |         ui->startStop->setChecked(notif.getStartStop()); | 
					
						
							|  |  |  |         blockApplySettings(false); | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	else | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::handleInputMessages() | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     Message* message; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |     while ((message = m_inputMessageQueue.pop()) != 0) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |         qDebug("BladerfOutputGui::handleInputMessages: message: %s", message->getIdentifier()); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if (DSPSignalNotification::match(*message)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             DSPSignalNotification* notif = (DSPSignalNotification*) message; | 
					
						
							|  |  |  |             m_sampleRate = notif->getSampleRate(); | 
					
						
							|  |  |  |             m_deviceCenterFrequency = notif->getCenterFrequency(); | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |             qDebug("BladerfOutputGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency()); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  |             updateSampleRateAndFrequency(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             delete message; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |         else | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |             if (handleMessage(*message)) { | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |                 delete message; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::updateSampleRateAndFrequency() | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-30 01:11:35 +01:00
										 |  |  |     m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate); | 
					
						
							|  |  |  |     m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); | 
					
						
							| 
									
										
										
										
											2019-04-12 00:18:29 +02:00
										 |  |  |     displaySampleRate(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void Bladerf1OutputGui::displaySampleRate() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ui->sampleRate->blockSignals(true); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_sampleRateMode) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(60,60,60); }"); | 
					
						
							|  |  |  |         ui->sampleRateMode->setText("SR"); | 
					
						
							|  |  |  |         ui->sampleRate->setValueRange(8, BLADERF_SAMPLERATE_MIN, BLADERF_SAMPLERATE_REC_MAX); | 
					
						
							|  |  |  |         ui->sampleRate->setValue(m_settings.m_devSampleRate); | 
					
						
							| 
									
										
										
										
											2019-04-13 23:00:02 +02:00
										 |  |  |         ui->sampleRate->setToolTip("Host to device sample rate (S/s)"); | 
					
						
							| 
									
										
										
										
											2019-04-12 00:18:29 +02:00
										 |  |  |         ui->deviceRateText->setToolTip("Baseband sample rate (S/s)"); | 
					
						
							|  |  |  |         uint32_t basebandSampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Interp); | 
					
						
							|  |  |  |         ui->deviceRateText->setText(tr("%1k").arg(QString::number(basebandSampleRate / 1000.0f, 'g', 5))); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(50,50,50); }"); | 
					
						
							|  |  |  |         ui->sampleRateMode->setText("BB"); | 
					
						
							|  |  |  |         ui->sampleRate->setValueRange(8, BLADERF_SAMPLERATE_MIN/(1<<m_settings.m_log2Interp), BLADERF_SAMPLERATE_REC_MAX/(1<<m_settings.m_log2Interp)); | 
					
						
							|  |  |  |         ui->sampleRate->setValue(m_settings.m_devSampleRate/(1<<m_settings.m_log2Interp)); | 
					
						
							|  |  |  |         ui->sampleRate->setToolTip("Baseband sample rate (S/s)"); | 
					
						
							| 
									
										
										
										
											2019-04-13 23:00:02 +02:00
										 |  |  |         ui->deviceRateText->setToolTip("Host to device sample rate (S/s)"); | 
					
						
							| 
									
										
										
										
											2019-04-12 00:18:29 +02:00
										 |  |  |         ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_settings.m_devSampleRate / 1000.0f, 'g', 5))); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->sampleRate->blockSignals(false); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::displaySettings() | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); | 
					
						
							| 
									
										
										
										
											2019-04-12 00:18:29 +02:00
										 |  |  | 	displaySampleRate(); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	unsigned int bandwidthIndex = BladerfBandwidths::getBandwidthIndex(m_settings.m_bandwidth); | 
					
						
							|  |  |  | 	ui->bandwidth->setCurrentIndex(bandwidthIndex); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ui->interp->setCurrentIndex(m_settings.m_log2Interp); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ui->vga1Text->setText(tr("%1dB").arg(m_settings.m_vga1)); | 
					
						
							|  |  |  | 	ui->vga1->setValue(m_settings.m_vga1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ui->vga2Text->setText(tr("%1dB").arg(m_settings.m_vga2)); | 
					
						
							|  |  |  | 	ui->vga2->setValue(m_settings.m_vga2); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ui->xb200->setCurrentIndex(getXb200Index(m_settings.m_xb200, m_settings.m_xb200Path, m_settings.m_xb200Filter)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::sendSettings() | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 	if (!m_updateTimer.isActive()) { | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 		m_updateTimer.start(100); | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::on_centerFrequency_changed(quint64 value) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	m_settings.m_centerFrequency = value * 1000; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     m_settingsKeys.append("centerFrequency"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::on_sampleRate_changed(quint64 value) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-12 00:18:29 +02:00
										 |  |  |     if (m_sampleRateMode) { | 
					
						
							|  |  |  |         m_settings.m_devSampleRate = value; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         m_settings.m_devSampleRate = value * (1 << m_settings.m_log2Interp); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     m_settingsKeys.append("devSampleRate"); | 
					
						
							| 
									
										
										
										
											2017-04-02 04:34:58 +02:00
										 |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::on_bandwidth_currentIndexChanged(int index) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	int newbw = BladerfBandwidths::getBandwidth(index); | 
					
						
							|  |  |  | 	m_settings.m_bandwidth = newbw * 1000; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     m_settingsKeys.append("bandwidth"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::on_interp_currentIndexChanged(int index) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-12 00:18:29 +02:00
										 |  |  | 	if ((index <0) || (index > 6)) { | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2019-04-12 00:18:29 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	m_settings.m_log2Interp = index; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     m_settingsKeys.append("log2Interp"); | 
					
						
							| 
									
										
										
										
											2019-04-12 00:18:29 +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_log2Interp); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     m_settingsKeys.append("devSampleRate"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::on_vga1_valueChanged(int value) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 	if ((value < BLADERF_TXVGA1_GAIN_MIN) || (value > BLADERF_TXVGA1_GAIN_MAX)) { | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	ui->vga1Text->setText(tr("%1dB").arg(value)); | 
					
						
							|  |  |  | 	m_settings.m_vga1 = value; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     m_settingsKeys.append("vga1"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::on_vga2_valueChanged(int value) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 	if ((value < BLADERF_TXVGA2_GAIN_MIN) || (value > BLADERF_TXVGA2_GAIN_MAX)) { | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	ui->vga2Text->setText(tr("%1dB").arg(value)); | 
					
						
							|  |  |  | 	m_settings.m_vga2 = value; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     m_settingsKeys.append("vga2"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::on_xb200_currentIndexChanged(int index) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     m_settingsKeys.append("xb200"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	if (index == 1) // bypass
 | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		m_settings.m_xb200 = true; | 
					
						
							|  |  |  | 		m_settings.m_xb200Path = BLADERF_XB200_BYPASS; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |         m_settingsKeys.append("xb200Path"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else if (index == 2) // Auto 1dB
 | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		m_settings.m_xb200 = true; | 
					
						
							|  |  |  | 		m_settings.m_xb200Path = BLADERF_XB200_MIX; | 
					
						
							|  |  |  | 		m_settings.m_xb200Filter = BLADERF_XB200_AUTO_1DB; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |         m_settingsKeys.append("xb200Path"); | 
					
						
							|  |  |  |         m_settingsKeys.append("m_xb200Filter"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else if (index == 3) // Auto 3dB
 | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		m_settings.m_xb200 = true; | 
					
						
							|  |  |  | 		m_settings.m_xb200Path = BLADERF_XB200_MIX; | 
					
						
							|  |  |  | 		m_settings.m_xb200Filter = BLADERF_XB200_AUTO_3DB; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |         m_settingsKeys.append("xb200Path"); | 
					
						
							|  |  |  |         m_settingsKeys.append("m_xb200Filter"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else if (index == 4) // Custom
 | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		m_settings.m_xb200 = true; | 
					
						
							|  |  |  | 		m_settings.m_xb200Path = BLADERF_XB200_MIX; | 
					
						
							|  |  |  | 		m_settings.m_xb200Filter = BLADERF_XB200_CUSTOM; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |         m_settingsKeys.append("xb200Path"); | 
					
						
							|  |  |  |         m_settingsKeys.append("m_xb200Filter"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else if (index == 5) // 50 MHz
 | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		m_settings.m_xb200 = true; | 
					
						
							|  |  |  | 		m_settings.m_xb200Path = BLADERF_XB200_MIX; | 
					
						
							|  |  |  | 		m_settings.m_xb200Filter = BLADERF_XB200_50M; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |         m_settingsKeys.append("xb200Path"); | 
					
						
							|  |  |  |         m_settingsKeys.append("m_xb200Filter"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else if (index == 6) // 144 MHz
 | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		m_settings.m_xb200 = true; | 
					
						
							|  |  |  | 		m_settings.m_xb200Path = BLADERF_XB200_MIX; | 
					
						
							|  |  |  | 		m_settings.m_xb200Filter = BLADERF_XB200_144M; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |         m_settingsKeys.append("xb200Path"); | 
					
						
							|  |  |  |         m_settingsKeys.append("m_xb200Filter"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else if (index == 7) // 222 MHz
 | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		m_settings.m_xb200 = true; | 
					
						
							|  |  |  | 		m_settings.m_xb200Path = BLADERF_XB200_MIX; | 
					
						
							|  |  |  | 		m_settings.m_xb200Filter = BLADERF_XB200_222M; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |         m_settingsKeys.append("xb200Path"); | 
					
						
							|  |  |  |         m_settingsKeys.append("m_xb200Filter"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else // no xb200
 | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		m_settings.m_xb200 = false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 	if (m_settings.m_xb200) { | 
					
						
							| 
									
										
										
										
											2022-10-17 15:04:01 +01:00
										 |  |  |         ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN_XB200/1000, BLADERF_FREQUENCY_MAX/1000); | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 	} else { | 
					
						
							| 
									
										
										
										
											2022-10-17 15:04:01 +01:00
										 |  |  |         ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN/1000, BLADERF_FREQUENCY_MAX/1000); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::on_startStop_toggled(bool checked) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-14 00:38:22 +01:00
										 |  |  |     if (m_doApplySettings) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  |         Bladerf1Output::MsgStartStop *message = Bladerf1Output::MsgStartStop::create(checked); | 
					
						
							| 
									
										
										
										
											2017-12-14 00:38:22 +01:00
										 |  |  |         m_deviceSampleSink->getInputMessageQueue()->push(message); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-12 00:18:29 +02:00
										 |  |  | void Bladerf1OutputGui::on_sampleRateMode_toggled(bool checked) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_sampleRateMode = checked; | 
					
						
							|  |  |  |     displaySampleRate(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::updateHardware() | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	qDebug() << "BladerfGui::updateHardware"; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 	Bladerf1Output::MsgConfigureBladerf1* message = Bladerf1Output::MsgConfigureBladerf1::create( m_settings, m_settingsKeys, m_forceSettings); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	m_deviceSampleSink->getInputMessageQueue()->push(message); | 
					
						
							| 
									
										
										
										
											2017-10-14 07:10:42 +02:00
										 |  |  | 	m_forceSettings = false; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |     m_settingsKeys.clear(); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 	m_updateTimer.stop(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | void Bladerf1OutputGui::updateStatus() | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |     int state = m_deviceUISet->m_deviceAPI->state(); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if(m_lastEngineState != state) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         switch(state) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StNotStarted: | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StIdle: | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background-color : blue; }"); | 
					
						
							|  |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StRunning: | 
					
						
							| 
									
										
										
										
											2017-06-05 23:00:28 +02:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background-color : green; }"); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StError: | 
					
						
							| 
									
										
										
										
											2017-06-05 23:00:28 +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()); | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  |                 break; | 
					
						
							|  |  |  |             default: | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         m_lastEngineState = state; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 08:42:59 +02:00
										 |  |  | unsigned int Bladerf1OutputGui::getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter) | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	if (xb_200) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		if (xb200Path == BLADERF_XB200_BYPASS) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			return 1; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 			if (xb200Filter == BLADERF_XB200_AUTO_1DB) { | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 				return 2; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 			} else if (xb200Filter == BLADERF_XB200_AUTO_3DB) { | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 				return 3; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 			} else if (xb200Filter == BLADERF_XB200_CUSTOM) { | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 				return 4; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 			} else if (xb200Filter == BLADERF_XB200_50M) { | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 				return 5; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 			} else if (xb200Filter == BLADERF_XB200_144M) { | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 				return 6; | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  | 			} else { // xb200Filter == BLADERF_XB200_222M
 | 
					
						
							| 
									
										
										
										
											2017-01-02 10:39:21 +01:00
										 |  |  | 				return 7; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2018-12-26 19:22:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | void Bladerf1OutputGui::openDeviceSettingsDialog(const QPoint& p) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02:00
										 |  |  |     if (m_contextMenuType == ContextMenuDeviceSettings) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         BasicDeviceSettingsDialog dialog(this); | 
					
						
							|  |  |  |         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-26 19:22:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02:00
										 |  |  |         dialog.move(p); | 
					
						
							| 
									
										
										
										
											2022-12-20 10:31:15 +00:00
										 |  |  |         new DialogPositioner(&dialog, false); | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02:00
										 |  |  |         dialog.exec(); | 
					
						
							| 
									
										
										
										
											2018-12-26 19:22:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02: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(); | 
					
						
							| 
									
										
										
										
											2022-10-29 23:56:46 +02:00
										 |  |  |         m_settingsKeys.append("useReverseAPI"); | 
					
						
							|  |  |  |         m_settingsKeys.append("reverseAPIAddress"); | 
					
						
							|  |  |  |         m_settingsKeys.append("reverseAPIPort"); | 
					
						
							|  |  |  |         m_settingsKeys.append("reverseAPIDeviceIndex"); | 
					
						
							| 
									
										
										
										
											2018-12-26 19:22:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02:00
										 |  |  |         sendSettings(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     resetContextMenuType(); | 
					
						
							| 
									
										
										
										
											2018-12-26 19:22:52 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void Bladerf1OutputGui::makeUIConnections() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QObject::connect(ui->centerFrequency, &ValueDial::changed, this, &Bladerf1OutputGui::on_centerFrequency_changed); | 
					
						
							|  |  |  |     QObject::connect(ui->sampleRate, &ValueDial::changed, this, &Bladerf1OutputGui::on_sampleRate_changed); | 
					
						
							|  |  |  |     QObject::connect(ui->bandwidth, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &Bladerf1OutputGui::on_bandwidth_currentIndexChanged); | 
					
						
							|  |  |  |     QObject::connect(ui->interp, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &Bladerf1OutputGui::on_interp_currentIndexChanged); | 
					
						
							|  |  |  |     QObject::connect(ui->startStop, &ButtonSwitch::toggled, this, &Bladerf1OutputGui::on_startStop_toggled); | 
					
						
							|  |  |  |     QObject::connect(ui->sampleRateMode, &QToolButton::toggled, this, &Bladerf1OutputGui::on_sampleRateMode_toggled); | 
					
						
							| 
									
										
										
										
											2022-12-17 06:42:28 +01:00
										 |  |  |     QObject::connect(ui->xb200, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &Bladerf1OutputGui::on_xb200_currentIndexChanged); | 
					
						
							| 
									
										
										
										
											2023-01-11 16:35:06 +01:00
										 |  |  |     QObject::connect(ui->vga1, &QSlider::valueChanged, this, &Bladerf1OutputGui::on_vga1_valueChanged); | 
					
						
							|  |  |  |     QObject::connect(ui->vga2, &QSlider::valueChanged, this, &Bladerf1OutputGui::on_vga2_valueChanged); | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | } |