| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2016 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:39:30 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +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/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QDebug>
 | 
					
						
							|  |  |  | #include <QTime>
 | 
					
						
							|  |  |  | #include <QDateTime>
 | 
					
						
							|  |  |  | #include <QString>
 | 
					
						
							|  |  |  | #include <QMessageBox>
 | 
					
						
							| 
									
										
										
										
											2022-04-21 19:24:40 +02:00
										 |  |  | #include <QResizeEvent>
 | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-04 11:43:26 +02:00
										 |  |  | #include <boost/algorithm/string.hpp>
 | 
					
						
							| 
									
										
										
										
											2017-06-05 01:18:35 +02:00
										 |  |  | #include <boost/lexical_cast.hpp>
 | 
					
						
							| 
									
										
										
										
											2017-06-04 11:43:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | #include "ui_remoteoutputgui.h"
 | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | #include "plugin/pluginapi.h"
 | 
					
						
							|  |  |  | #include "gui/colormapper.h"
 | 
					
						
							|  |  |  | #include "gui/glspectrum.h"
 | 
					
						
							| 
									
										
										
										
											2018-12-26 22:30:35 +01:00
										 |  |  | #include "gui/basicdevicesettingsdialog.h"
 | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | #include "dsp/dspengine.h"
 | 
					
						
							|  |  |  | #include "dsp/dspcommands.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "mainwindow.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"
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | #include "remoteoutputgui.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  | #include "channel/remotedatablock.h"
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | RemoteOutputSinkGui::RemoteOutputSinkGui(DeviceUISet *deviceUISet, QWidget* parent) : | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | 	DeviceGUI(parent), | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | 	ui(new Ui::RemoteOutputGui), | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 	m_settings(), | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  | 	m_remoteOutput(0), | 
					
						
							| 
									
										
										
										
											2018-09-07 00:58:09 +02:00
										 |  |  | 	m_deviceCenterFrequency(0), | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 	m_samplesCount(0), | 
					
						
							|  |  |  | 	m_tickCount(0), | 
					
						
							| 
									
										
										
										
											2017-06-05 01:18:35 +02:00
										 |  |  | 	m_nbSinceLastFlowCheck(0), | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  | 	m_lastEngineState(DeviceAPI::StNotStarted), | 
					
						
							| 
									
										
										
										
											2017-05-23 01:41:30 +02:00
										 |  |  | 	m_doApplySettings(true), | 
					
						
							| 
									
										
										
										
											2021-12-12 19:54:57 +01:00
										 |  |  | 	m_forceSettings(true), | 
					
						
							|  |  |  |     m_remoteAPIConnected(false) | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02: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); | 
					
						
							| 
									
										
										
										
											2017-06-06 01:53:21 +02:00
										 |  |  |     m_countUnrecoverable = 0; | 
					
						
							|  |  |  |     m_countRecovered = 0; | 
					
						
							| 
									
										
										
										
											2018-08-30 08:45:57 +02:00
										 |  |  |     m_lastCountUnrecoverable = 0; | 
					
						
							|  |  |  |     m_lastCountRecovered = 0; | 
					
						
							| 
									
										
										
										
											2018-08-30 19:14:34 +02:00
										 |  |  |     m_lastSampleCount = 0; | 
					
						
							| 
									
										
										
										
											2017-06-06 01:53:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-05 23:00:28 +02:00
										 |  |  |     m_paletteGreenText.setColor(QPalette::WindowText, Qt::green); | 
					
						
							|  |  |  |     m_paletteRedText.setColor(QPalette::WindowText, Qt::red); | 
					
						
							|  |  |  |     m_paletteWhiteText.setColor(QPalette::WindowText, Qt::white); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     ui->setupUi(getContents()); | 
					
						
							| 
									
										
										
										
											2022-04-21 19:24:40 +02:00
										 |  |  |     setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); | 
					
						
							| 
									
										
										
										
											2022-04-24 02:13:18 +02:00
										 |  |  |     getContents()->setStyleSheet("#RemoteOutputGui { background-color: rgb(64, 64, 64); }"); | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     m_helpURL = "plugins/samplesink/remoteoutput/readme.md"; | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  | 	connect(&(m_deviceUISet->m_deviceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick())); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 	connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); | 
					
						
							|  |  |  | 	connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); | 
					
						
							|  |  |  | 	m_statusTimer.start(500); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  | 	m_remoteOutput = (RemoteOutput*) m_deviceUISet->m_deviceAPI->getSampleSink(); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  | 	connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-07 00:58:09 +02:00
										 |  |  | 	m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-06 01:53:21 +02:00
										 |  |  |     m_time.start(); | 
					
						
							|  |  |  |     displayEventCounts(); | 
					
						
							|  |  |  |     displayEventTimer(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02:00
										 |  |  |     connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &))); | 
					
						
							| 
									
										
										
										
											2018-12-26 22:30:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  |     displaySettings(); | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     makeUIConnections(); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | RemoteOutputSinkGui::~RemoteOutputSinkGui() | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  | 	delete ui; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::blockApplySettings(bool block) | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     m_doApplySettings = !block; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::destroy() | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  | 	delete this; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::resetToDefaults() | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  |     blockApplySettings(true); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 	m_settings.resetToDefaults(); | 
					
						
							|  |  |  | 	displaySettings(); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | 	blockApplySettings(false); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | QByteArray RemoteOutputSinkGui::serialize() const | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return m_settings.serialize(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | bool RemoteOutputSinkGui::deserialize(const QByteArray& data) | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  |     blockApplySettings(true); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if(m_settings.deserialize(data)) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 		displaySettings(); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | 	    blockApplySettings(false); | 
					
						
							| 
									
										
										
										
											2017-05-23 01:41:30 +02:00
										 |  |  | 		m_forceSettings = true; | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 		sendSettings(); | 
					
						
							|  |  |  | 		return true; | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  |         blockApplySettings(false); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-21 19:24:40 +02:00
										 |  |  | void RemoteOutputSinkGui::resizeEvent(QResizeEvent* size) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     adjustSize(); | 
					
						
							|  |  |  |     size->accept(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | bool RemoteOutputSinkGui::handleMessage(const Message& message) | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  |     if (RemoteOutput::MsgConfigureRemoteOutput::match(message)) | 
					
						
							| 
									
										
										
										
											2017-12-28 04:04:50 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  |         const RemoteOutput::MsgConfigureRemoteOutput& cfg = (RemoteOutput::MsgConfigureRemoteOutput&) message; | 
					
						
							| 
									
										
										
										
											2017-12-28 04:04:50 +01:00
										 |  |  |         m_settings = cfg.getSettings(); | 
					
						
							|  |  |  |         blockApplySettings(true); | 
					
						
							|  |  |  |         displaySettings(); | 
					
						
							|  |  |  |         blockApplySettings(false); | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  |     else if (RemoteOutput::MsgStartStop::match(message)) | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  |         RemoteOutput::MsgStartStop& notif = (RemoteOutput::MsgStartStop&) message; | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |         blockApplySettings(true); | 
					
						
							|  |  |  |         ui->startStop->setChecked(notif.getStartStop()); | 
					
						
							|  |  |  |         blockApplySettings(false); | 
					
						
							|  |  |  |         return true; | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     } | 
					
						
							|  |  |  |     else if (RemoteOutput::MsgReportRemoteData::match(message)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         const RemoteOutput::MsgReportRemoteData& report = (const RemoteOutput::MsgReportRemoteData&) message; | 
					
						
							|  |  |  |         displayRemoteData(report.getData()); | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (RemoteOutput::MsgReportRemoteFixedData::match(message)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         const RemoteOutput::MsgReportRemoteFixedData& report = (const RemoteOutput::MsgReportRemoteFixedData&) message; | 
					
						
							|  |  |  |         displayRemoteFixedData(report.getData()); | 
					
						
							|  |  |  |         return true; | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 	else | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::handleInputMessages() | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Message* message; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |     while ((message = m_inputMessageQueue.pop()) != 0) | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (DSPSignalNotification::match(*message)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             DSPSignalNotification* notif = (DSPSignalNotification*) message; | 
					
						
							|  |  |  |             m_sampleRate = notif->getSampleRate(); | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  |             qDebug("RemoteOutputSinkGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency()); | 
					
						
							| 
									
										
										
										
											2018-09-07 00:58:09 +02:00
										 |  |  |             updateSampleRate(); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |             delete message; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |         else | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |             if (handleMessage(*message)) { | 
					
						
							|  |  |  |                 delete message; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::updateSampleRate() | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-30 01:11:35 +01:00
										 |  |  |     m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate); | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |     ui->deviceRateText->setText(tr("%1k").arg((float)(m_sampleRate) / 1000)); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::displaySettings() | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-08-29 22:08:58 +02:00
										 |  |  |     blockApplySettings(true); | 
					
						
							| 
									
										
										
										
											2021-12-12 10:44:58 +01:00
										 |  |  |     ui->centerFrequency->setText(QString("%L1").arg(m_deviceCenterFrequency)); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  |     ui->nbFECBlocks->setValue(m_settings.m_nbFECBlocks); | 
					
						
							| 
									
										
										
										
											2021-12-19 11:30:48 +01:00
										 |  |  |     ui->nbTxBytes->setCurrentIndex(log2(m_settings.m_nbTxBytes)); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QString s0 = QString::number(128 + m_settings.m_nbFECBlocks, 'f', 0); | 
					
						
							|  |  |  |     QString s1 = QString::number(m_settings.m_nbFECBlocks, 'f', 0); | 
					
						
							|  |  |  |     ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s0).arg(s1)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-02 19:12:03 +02:00
										 |  |  |     ui->deviceIndex->setText(tr("%1").arg(m_settings.m_deviceIndex)); | 
					
						
							|  |  |  |     ui->channelIndex->setText(tr("%1").arg(m_settings.m_channelIndex)); | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |     ui->apiAddress->setText(m_settings.m_apiAddress); | 
					
						
							|  |  |  |     ui->apiPort->setText(tr("%1").arg(m_settings.m_apiPort)); | 
					
						
							|  |  |  |     ui->dataAddress->setText(m_settings.m_dataAddress); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  |     ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort)); | 
					
						
							| 
									
										
										
										
											2018-08-29 22:08:58 +02:00
										 |  |  |     blockApplySettings(false); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::sendSettings() | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     if(!m_updateTimer.isActive()) | 
					
						
							|  |  |  |         m_updateTimer.start(100); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::updateHardware() | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  |     qDebug() << "RemoteOutputSinkGui::updateHardware"; | 
					
						
							|  |  |  |     RemoteOutput::MsgConfigureRemoteOutput* message = RemoteOutput::MsgConfigureRemoteOutput::create(m_settings, m_forceSettings); | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     m_remoteOutput->getInputMessageQueue()->push(message); | 
					
						
							| 
									
										
										
										
											2017-05-23 01:41:30 +02:00
										 |  |  |     m_forceSettings = false; | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  |     m_updateTimer.stop(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::updateStatus() | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |     int state = m_deviceUISet->m_deviceAPI->state(); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if(m_lastEngineState != state) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         switch(state) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StNotStarted: | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StIdle: | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02: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-05-15 00:58:56 +02: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-05-15 00:58:56 +02:00
										 |  |  |                 break; | 
					
						
							|  |  |  |             default: | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         m_lastEngineState = state; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::on_nbFECBlocks_valueChanged(int value) | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     m_settings.m_nbFECBlocks = value; | 
					
						
							|  |  |  |     int nbOriginalBlocks = 128; | 
					
						
							|  |  |  |     int nbFECBlocks = value; | 
					
						
							|  |  |  |     QString s = QString::number(nbOriginalBlocks + nbFECBlocks, 'f', 0); | 
					
						
							|  |  |  |     QString s1 = QString::number(nbFECBlocks, 'f', 0); | 
					
						
							|  |  |  |     ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s).arg(s1)); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::on_deviceIndex_returnPressed() | 
					
						
							| 
									
										
										
										
											2018-09-01 10:44:12 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     bool dataOk; | 
					
						
							|  |  |  |     int deviceIndex = ui->deviceIndex->text().toInt(&dataOk); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ((!dataOk) || (deviceIndex < 0)) { | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         m_settings.m_deviceIndex = deviceIndex; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::on_channelIndex_returnPressed() | 
					
						
							| 
									
										
										
										
											2018-09-01 10:44:12 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     bool dataOk; | 
					
						
							|  |  |  |     int channelIndex = ui->channelIndex->text().toInt(&dataOk); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ((!dataOk) || (channelIndex < 0)) { | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         m_settings.m_channelIndex = channelIndex; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-19 11:30:48 +01:00
										 |  |  | void RemoteOutputSinkGui::on_nbTxBytes_currentIndexChanged(int index) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_nbTxBytes = 1 << index; | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::on_apiAddress_returnPressed() | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |     m_settings.m_apiAddress = ui->apiAddress->text(); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2018-08-30 19:14:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     RemoteOutput::MsgRequestFixedData *msg = RemoteOutput::MsgRequestFixedData::create(); | 
					
						
							|  |  |  |     m_remoteOutput->getInputMessageQueue()->push(msg); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::on_apiPort_returnPressed() | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     bool dataOk; | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |     int apiPort = ui->apiPort->text().toInt(&dataOk); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-01 10:44:12 +02:00
										 |  |  |     if((!dataOk) || (apiPort < 1024) || (apiPort > 65535)) { | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2018-09-01 10:44:12 +02:00
										 |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |         m_settings.m_apiPort = apiPort; | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2018-08-30 19:14:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     RemoteOutput::MsgRequestFixedData *msg = RemoteOutput::MsgRequestFixedData::create(); | 
					
						
							|  |  |  |     m_remoteOutput->getInputMessageQueue()->push(msg); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::on_dataAddress_returnPressed() | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     m_settings.m_dataAddress = ui->dataAddress->text(); | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::on_dataPort_returnPressed() | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |     bool dataOk; | 
					
						
							|  |  |  |     int dataPort = ui->dataPort->text().toInt(&dataOk); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-01 10:44:12 +02:00
										 |  |  |     if((!dataOk) || (dataPort < 1024) || (dataPort > 65535)) { | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2018-09-01 10:44:12 +02:00
										 |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |         m_settings.m_dataPort = dataPort; | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::on_apiApplyButton_clicked(bool checked) | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-11-13 08:51:14 +01:00
										 |  |  |     (void) checked; | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |     m_settings.m_apiAddress = ui->apiAddress->text(); | 
					
						
							| 
									
										
										
										
											2017-05-28 10:13:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |     bool apiOk; | 
					
						
							|  |  |  |     int apiPort = ui->apiPort->text().toInt(&apiOk); | 
					
						
							| 
									
										
										
										
											2017-05-28 10:13:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |     if((apiOk) && (apiPort >= 1024) && (apiPort < 65535)) | 
					
						
							| 
									
										
										
										
											2017-05-28 10:13:54 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-08-29 18:39:40 +02:00
										 |  |  |         m_settings.m_apiPort = apiPort; | 
					
						
							| 
									
										
										
										
											2017-05-28 10:13:54 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-30 01:56:53 +02:00
										 |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2018-08-30 19:14:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     RemoteOutput::MsgRequestFixedData *msg = RemoteOutput::MsgRequestFixedData::create(); | 
					
						
							|  |  |  |     m_remoteOutput->getInputMessageQueue()->push(msg); | 
					
						
							| 
									
										
										
										
											2018-08-30 01:56:53 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::on_dataApplyButton_clicked(bool checked) | 
					
						
							| 
									
										
										
										
											2018-08-30 01:56:53 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-11-13 08:51:14 +01:00
										 |  |  |     (void) checked; | 
					
						
							| 
									
										
										
										
											2018-08-30 01:56:53 +02:00
										 |  |  |     m_settings.m_dataAddress = ui->dataAddress->text(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-28 10:13:54 +02:00
										 |  |  |     bool dataOk; | 
					
						
							|  |  |  |     int udpDataPort = ui->dataPort->text().toInt(&dataOk); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if((dataOk) && (udpDataPort >= 1024) && (udpDataPort < 65535)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         m_settings.m_dataPort = udpDataPort; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-08-28 06:29:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2017-05-21 19:45:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::on_startStop_toggled(bool checked) | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |     if (m_doApplySettings) | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  |         RemoteOutput::MsgStartStop *message = RemoteOutput::MsgStartStop::create(checked); | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |         m_remoteOutput->getInputMessageQueue()->push(message); | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::on_eventCountsReset_clicked(bool checked) | 
					
						
							| 
									
										
										
										
											2017-06-06 01:53:21 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-11-13 08:51:14 +01:00
										 |  |  |     (void) checked; | 
					
						
							| 
									
										
										
										
											2017-06-06 01:53:21 +02:00
										 |  |  |     m_countUnrecoverable = 0; | 
					
						
							|  |  |  |     m_countRecovered = 0; | 
					
						
							|  |  |  |     m_time.start(); | 
					
						
							|  |  |  |     displayEventCounts(); | 
					
						
							|  |  |  |     displayEventTimer(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::displayEventCounts() | 
					
						
							| 
									
										
										
										
											2017-06-06 01:53:21 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     QString nstr = QString("%1").arg(m_countUnrecoverable, 3, 10, QChar('0')); | 
					
						
							|  |  |  |     ui->eventUnrecText->setText(nstr); | 
					
						
							|  |  |  |     nstr = QString("%1").arg(m_countRecovered, 3, 10, QChar('0')); | 
					
						
							|  |  |  |     ui->eventRecText->setText(nstr); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::displayEventStatus(int recoverableCount, int unrecoverableCount) | 
					
						
							| 
									
										
										
										
											2018-08-30 08:45:57 +02:00
										 |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (unrecoverableCount == 0) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (recoverableCount == 0) { | 
					
						
							|  |  |  |             ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : green; }"); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             ui->allFramesDecoded->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : red; }"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::displayEventTimer() | 
					
						
							| 
									
										
										
										
											2017-06-06 01:53:21 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     int elapsedTimeMillis = m_time.elapsed(); | 
					
						
							|  |  |  |     QTime recordLength(0, 0, 0, 0); | 
					
						
							|  |  |  |     recordLength = recordLength.addSecs(elapsedTimeMillis/1000); | 
					
						
							| 
									
										
										
										
											2018-05-11 11:00:08 +02:00
										 |  |  |     QString s_time = recordLength.toString("HH:mm:ss"); | 
					
						
							| 
									
										
										
										
											2017-06-06 01:53:21 +02:00
										 |  |  |     ui->eventCountsTimeText->setText(s_time); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::tick() | 
					
						
							| 
									
										
										
										
											2017-05-15 00:58:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-12-12 19:54:57 +01:00
										 |  |  |     if (++m_tickCount == 20) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (m_remoteAPIConnected) { | 
					
						
							|  |  |  |             ui->apiAddressLabel->setStyleSheet("QLabel { background-color: green; }"); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         m_remoteAPIConnected = false; | 
					
						
							|  |  |  |         m_tickCount = 0; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-08-30 02:58:10 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  | void RemoteOutputSinkGui::displayRemoteData(const RemoteOutput::MsgReportRemoteData::RemoteData& remoteData) | 
					
						
							| 
									
										
										
										
											2018-08-30 02:58:10 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     m_deviceCenterFrequency = remoteData.m_centerFrequency; | 
					
						
							|  |  |  |     m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); | 
					
						
							|  |  |  |     ui->centerFrequency->setText(QString("%L1").arg(m_deviceCenterFrequency)); | 
					
						
							|  |  |  |     ui->remoteRateText->setText(tr("%1k").arg((float)(remoteData.m_sampleRate) / 1000)); | 
					
						
							|  |  |  |     QString queueLengthText = QString("%1/%2").arg(remoteData.m_queueLength).arg(remoteData.m_queueSize); | 
					
						
							|  |  |  |     ui->queueLengthText->setText(queueLengthText); | 
					
						
							|  |  |  |     int queueLengthPercent = (remoteData.m_queueLength*100)/remoteData.m_queueSize; | 
					
						
							|  |  |  |     ui->queueLengthGauge->setValue(queueLengthPercent); | 
					
						
							| 
									
										
										
										
											2021-12-12 13:45:14 +01:00
										 |  |  |     int recoverableCountDelta = remoteData.m_recoverableCount - m_lastCountRecovered; | 
					
						
							|  |  |  |     int unrecoverableCountDelta = remoteData.m_unrecoverableCount - m_lastCountUnrecoverable; | 
					
						
							|  |  |  |     displayEventStatus(recoverableCountDelta, unrecoverableCountDelta); | 
					
						
							|  |  |  |     m_countRecovered += recoverableCountDelta; | 
					
						
							|  |  |  |     m_countUnrecoverable += unrecoverableCountDelta; | 
					
						
							|  |  |  |     displayEventCounts(); | 
					
						
							|  |  |  |     displayEventTimer(); | 
					
						
							| 
									
										
										
										
											2021-12-12 19:54:57 +01:00
										 |  |  |     m_remoteAPIConnected = true; | 
					
						
							| 
									
										
										
										
											2018-08-31 07:38:30 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     uint32_t sampleCountDelta; | 
					
						
							| 
									
										
										
										
											2018-08-30 19:14:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     if (remoteData.m_sampleCount < m_lastSampleCount) { | 
					
						
							|  |  |  |         sampleCountDelta = (0xFFFFFFFFU - m_lastSampleCount) + remoteData.m_sampleCount + 1; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         sampleCountDelta = remoteData.m_sampleCount - m_lastSampleCount; | 
					
						
							| 
									
										
										
										
											2018-08-30 19:14:34 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     if (sampleCountDelta == 0) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : blue; }"); | 
					
						
							| 
									
										
										
										
											2018-08-30 19:14:34 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     double remoteStreamRate = sampleCountDelta*1e6 / (double) (remoteData.m_timestampUs - m_lastTimestampUs); | 
					
						
							| 
									
										
										
										
											2018-08-30 19:14:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     if (remoteStreamRate != 0) { | 
					
						
							|  |  |  |         ui->remoteStreamRateText->setText(QString("%1").arg(remoteStreamRate, 0, 'f', 0)); | 
					
						
							| 
									
										
										
										
											2018-08-30 19:14:34 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  |     m_lastCountRecovered = remoteData.m_recoverableCount; | 
					
						
							|  |  |  |     m_lastCountUnrecoverable = remoteData.m_unrecoverableCount; | 
					
						
							|  |  |  |     m_lastSampleCount = remoteData.m_sampleCount; | 
					
						
							|  |  |  |     m_lastTimestampUs = remoteData.m_timestampUs; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2018-08-30 19:14:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-12 12:54:22 +01:00
										 |  |  | void RemoteOutputSinkGui::displayRemoteFixedData(const RemoteOutput::MsgReportRemoteFixedData::RemoteData& remoteData) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QString infoLine = "v" + remoteData.m_version; | 
					
						
							|  |  |  |     infoLine += " Qt" + remoteData.m_qtVersion; | 
					
						
							|  |  |  |     infoLine += " " + remoteData.m_architecture; | 
					
						
							|  |  |  |     infoLine += " " + remoteData.m_os; | 
					
						
							|  |  |  |     infoLine +=  QString(" %1/%2b").arg(remoteData.m_rxBits).arg(remoteData.m_txBits); | 
					
						
							| 
									
										
										
										
											2021-12-12 19:54:57 +01:00
										 |  |  |     m_remoteAPIConnected = true; | 
					
						
							| 
									
										
										
										
											2018-08-30 19:14:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (infoLine.size() > 0) { | 
					
						
							|  |  |  |         ui->infoText->setText(infoLine); | 
					
						
							| 
									
										
										
										
											2018-08-30 02:58:10 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2018-12-26 22:30:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 22:58:42 +01:00
										 |  |  | void RemoteOutputSinkGui::openDeviceSettingsDialog(const QPoint& p) | 
					
						
							| 
									
										
										
										
											2018-12-26 22:30:35 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											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 22:30:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02:00
										 |  |  |         dialog.move(p); | 
					
						
							|  |  |  |         dialog.exec(); | 
					
						
							| 
									
										
										
										
											2018-12-26 22:30:35 +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(); | 
					
						
							| 
									
										
										
										
											2018-12-26 22:30:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02:00
										 |  |  |         sendSettings(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     resetContextMenuType(); | 
					
						
							| 
									
										
										
										
											2018-12-26 22:30:35 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void RemoteOutputSinkGui::makeUIConnections() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QObject::connect(ui->nbFECBlocks, &QDial::valueChanged, this, &RemoteOutputSinkGui::on_nbFECBlocks_valueChanged); | 
					
						
							|  |  |  |     QObject::connect(ui->deviceIndex, &QLineEdit::returnPressed, this, &RemoteOutputSinkGui::on_deviceIndex_returnPressed); | 
					
						
							|  |  |  |     QObject::connect(ui->channelIndex, &QLineEdit::returnPressed, this, &RemoteOutputSinkGui::on_channelIndex_returnPressed); | 
					
						
							|  |  |  |     QObject::connect(ui->nbTxBytes, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &RemoteOutputSinkGui::on_nbTxBytes_currentIndexChanged); | 
					
						
							|  |  |  |     QObject::connect(ui->apiAddress, &QLineEdit::returnPressed, this, &RemoteOutputSinkGui::on_apiAddress_returnPressed); | 
					
						
							|  |  |  |     QObject::connect(ui->apiPort, &QLineEdit::returnPressed, this, &RemoteOutputSinkGui::on_apiPort_returnPressed); | 
					
						
							|  |  |  |     QObject::connect(ui->dataAddress, &QLineEdit::returnPressed, this, &RemoteOutputSinkGui::on_dataAddress_returnPressed); | 
					
						
							|  |  |  |     QObject::connect(ui->dataPort, &QLineEdit::returnPressed, this, &RemoteOutputSinkGui::on_dataPort_returnPressed); | 
					
						
							|  |  |  |     QObject::connect(ui->apiApplyButton, &QPushButton::clicked, this, &RemoteOutputSinkGui::on_apiApplyButton_clicked); | 
					
						
							|  |  |  |     QObject::connect(ui->dataApplyButton, &QPushButton::clicked, this, &RemoteOutputSinkGui::on_dataApplyButton_clicked); | 
					
						
							|  |  |  |     QObject::connect(ui->startStop, &ButtonSwitch::toggled, this, &RemoteOutputSinkGui::on_startStop_toggled); | 
					
						
							|  |  |  |     QObject::connect(ui->eventCountsReset, &QPushButton::clicked, this, &RemoteOutputSinkGui::on_eventCountsReset_clicked); | 
					
						
							|  |  |  | } |