2018-08-31 17:29:53 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2019-01-22 18:44:13 -05:00
|
|
|
// Copyright (C) 2018-2019 Edouard Griffiths, F4EXB //
|
2018-08-31 17:29:53 -04: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 00:39:30 -04:00
|
|
|
// (at your option) any later version. //
|
2018-08-31 17:29:53 -04: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/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2020-11-04 02:59:16 -05:00
|
|
|
#include <QTime>
|
2019-01-22 18:44:13 -05:00
|
|
|
|
2019-05-08 16:11:53 -04:00
|
|
|
#include "device/deviceapi.h"
|
2018-08-31 17:29:53 -04:00
|
|
|
#include "device/deviceuiset.h"
|
2021-12-14 01:56:02 -05:00
|
|
|
#include "dsp/hbfilterchainconverter.h"
|
2018-08-31 18:18:35 -04:00
|
|
|
#include "gui/basicchannelsettingsdialog.h"
|
2019-11-17 05:09:07 -05:00
|
|
|
#include "gui/devicestreamselectiondialog.h"
|
2018-08-31 18:18:35 -04:00
|
|
|
#include "mainwindow.h"
|
2018-08-31 17:29:53 -04:00
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
#include "remotesource.h"
|
|
|
|
#include "ui_remotesourcegui.h"
|
2018-08-31 17:29:53 -04:00
|
|
|
|
2020-11-04 02:59:16 -05:00
|
|
|
#include "remotesourcegui.h"
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
RemoteSourceGUI* RemoteSourceGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx)
|
2018-08-31 17:29:53 -04:00
|
|
|
{
|
2019-01-22 18:44:13 -05:00
|
|
|
RemoteSourceGUI* gui = new RemoteSourceGUI(pluginAPI, deviceUISet, channelTx);
|
2018-08-31 17:29:53 -04:00
|
|
|
return gui;
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::destroy()
|
2018-08-31 17:29:53 -04:00
|
|
|
{
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::resetToDefaults()
|
2018-08-31 17:29:53 -04:00
|
|
|
{
|
|
|
|
m_settings.resetToDefaults();
|
|
|
|
displaySettings();
|
|
|
|
applySettings(true);
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
QByteArray RemoteSourceGUI::serialize() const
|
2018-08-31 17:29:53 -04:00
|
|
|
{
|
|
|
|
return m_settings.serialize();
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
bool RemoteSourceGUI::deserialize(const QByteArray& data)
|
2018-08-31 17:29:53 -04:00
|
|
|
{
|
|
|
|
if(m_settings.deserialize(data)) {
|
|
|
|
displaySettings();
|
|
|
|
applySettings(true);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
bool RemoteSourceGUI::handleMessage(const Message& message)
|
2018-08-31 17:29:53 -04:00
|
|
|
{
|
2021-12-14 01:56:02 -05:00
|
|
|
if (RemoteSource::MsgBasebandSampleRateNotification::match(message))
|
|
|
|
{
|
|
|
|
RemoteSource::MsgBasebandSampleRateNotification& notif = (RemoteSource::MsgBasebandSampleRateNotification&) message;
|
|
|
|
m_basebandSampleRate = notif.getBasebandSampleRate();
|
|
|
|
displayRateAndShift();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (RemoteSource::MsgConfigureRemoteSource::match(message))
|
2018-09-01 03:53:16 -04:00
|
|
|
{
|
2019-01-22 18:44:13 -05:00
|
|
|
const RemoteSource::MsgConfigureRemoteSource& cfg = (RemoteSource::MsgConfigureRemoteSource&) message;
|
2018-09-01 03:53:16 -04:00
|
|
|
m_settings = cfg.getSettings();
|
|
|
|
blockApplySettings(true);
|
2021-12-03 16:32:54 -05:00
|
|
|
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
|
2018-09-01 03:53:16 -04:00
|
|
|
displaySettings();
|
|
|
|
blockApplySettings(false);
|
|
|
|
return true;
|
|
|
|
}
|
2019-01-22 18:44:13 -05:00
|
|
|
else if (RemoteSource::MsgReportStreamData::match(message))
|
2018-09-02 13:12:03 -04:00
|
|
|
{
|
2019-01-22 18:44:13 -05:00
|
|
|
const RemoteSource::MsgReportStreamData& report = (RemoteSource::MsgReportStreamData&) message;
|
2019-11-14 19:04:24 -05:00
|
|
|
|
2020-11-14 16:08:06 -05:00
|
|
|
int remoteSampleRate = report.get_sampleRate();
|
2019-11-14 19:04:24 -05:00
|
|
|
|
|
|
|
if (remoteSampleRate != m_remoteSampleRate)
|
|
|
|
{
|
|
|
|
m_channelMarker.setBandwidth(remoteSampleRate);
|
|
|
|
m_remoteSampleRate = remoteSampleRate;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->sampleRate->setText(QString("%1").arg(remoteSampleRate));
|
2018-09-02 13:12:03 -04:00
|
|
|
QString nominalNbBlocksText = QString("%1/%2")
|
|
|
|
.arg(report.get_nbOriginalBlocks() + report.get_nbFECBlocks())
|
|
|
|
.arg(report.get_nbFECBlocks());
|
|
|
|
ui->nominalNbBlocksText->setText(nominalNbBlocksText);
|
|
|
|
QString queueLengthText = QString("%1/%2").arg(report.get_queueLength()).arg(report.get_queueSize());
|
|
|
|
ui->queueLengthText->setText(queueLengthText);
|
|
|
|
int queueLengthPercent = (report.get_queueLength()*100)/report.get_queueSize();
|
|
|
|
ui->queueLengthGauge->setValue(queueLengthPercent);
|
|
|
|
int unrecoverableCount = report.get_nbUncorrectableErrors();
|
|
|
|
int recoverableCount = report.get_nbCorrectableErrors();
|
|
|
|
uint64_t timestampUs = report.get_tv_sec()*1000000ULL + report.get_tv_usec();
|
|
|
|
|
|
|
|
if (!m_resetCounts)
|
|
|
|
{
|
|
|
|
int recoverableCountDelta = recoverableCount - m_lastCountRecovered;
|
|
|
|
int unrecoverableCountDelta = unrecoverableCount - m_lastCountUnrecoverable;
|
|
|
|
displayEventStatus(recoverableCountDelta, unrecoverableCountDelta);
|
|
|
|
m_countRecovered += recoverableCountDelta;
|
|
|
|
m_countUnrecoverable += unrecoverableCountDelta;
|
|
|
|
displayEventCounts();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t sampleCountDelta, sampleCount;
|
|
|
|
sampleCount = report.get_readSamplesCount();
|
|
|
|
|
|
|
|
if (sampleCount < m_lastSampleCount) {
|
|
|
|
sampleCountDelta = (0xFFFFFFFFU - sampleCount) + m_lastSampleCount + 1;
|
|
|
|
} else {
|
|
|
|
sampleCountDelta = sampleCount - m_lastSampleCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sampleCountDelta == 0) {
|
|
|
|
ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : blue; }");
|
|
|
|
}
|
|
|
|
|
|
|
|
double remoteStreamRate = sampleCountDelta*1e6 / (double) (timestampUs - m_lastTimestampUs);
|
|
|
|
|
|
|
|
if (remoteStreamRate != 0) {
|
|
|
|
ui->streamRateText->setText(QString("%1").arg(remoteStreamRate, 0, 'f', 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
m_resetCounts = false;
|
|
|
|
m_lastCountRecovered = recoverableCount;
|
|
|
|
m_lastCountUnrecoverable = unrecoverableCount;
|
|
|
|
m_lastSampleCount = sampleCount;
|
|
|
|
m_lastTimestampUs = timestampUs;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2018-09-01 03:53:16 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
2018-08-31 18:18:35 -04:00
|
|
|
}
|
2018-08-31 17:29:53 -04:00
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
RemoteSourceGUI::RemoteSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) :
|
2020-10-04 00:16:15 -04:00
|
|
|
ChannelGUI(parent),
|
2019-01-22 18:44:13 -05:00
|
|
|
ui(new Ui::RemoteSourceGUI),
|
2018-08-31 17:29:53 -04:00
|
|
|
m_pluginAPI(pluginAPI),
|
2018-09-02 13:12:03 -04:00
|
|
|
m_deviceUISet(deviceUISet),
|
2019-11-14 19:04:24 -05:00
|
|
|
m_remoteSampleRate(48000),
|
2021-12-14 01:56:02 -05:00
|
|
|
m_basebandSampleRate(48000),
|
|
|
|
m_shiftFrequencyFactor(0.0),
|
2018-09-02 13:12:03 -04:00
|
|
|
m_countUnrecoverable(0),
|
|
|
|
m_countRecovered(0),
|
|
|
|
m_lastCountUnrecoverable(0),
|
|
|
|
m_lastCountRecovered(0),
|
|
|
|
m_lastSampleCount(0),
|
|
|
|
m_lastTimestampUs(0),
|
|
|
|
m_resetCounts(true),
|
|
|
|
m_tickCount(0)
|
2018-08-31 17:29:53 -04:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) channelTx;
|
2018-08-31 17:29:53 -04:00
|
|
|
ui->setupUi(this);
|
2021-11-24 06:31:51 -05:00
|
|
|
m_helpURL = "plugins/channeltx/remotesource/readme.md";
|
2018-08-31 17:29:53 -04:00
|
|
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
|
|
|
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
2018-09-11 02:41:37 -04:00
|
|
|
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
2018-08-31 18:18:35 -04:00
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
m_remoteSrc = (RemoteSource*) channelTx;
|
|
|
|
m_remoteSrc->setMessageQueueToGUI(getInputMessageQueue());
|
2018-08-31 18:18:35 -04:00
|
|
|
|
2019-05-08 16:11:53 -04:00
|
|
|
connect(&(m_deviceUISet->m_deviceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
|
2018-09-11 02:41:37 -04:00
|
|
|
|
2018-08-31 18:18:35 -04:00
|
|
|
m_channelMarker.blockSignals(true);
|
|
|
|
m_channelMarker.setColor(m_settings.m_rgbColor);
|
|
|
|
m_channelMarker.setCenterFrequency(0);
|
2019-01-22 18:44:13 -05:00
|
|
|
m_channelMarker.setTitle("Remote source");
|
2019-05-30 12:38:10 -04:00
|
|
|
m_channelMarker.setSourceOrSinkStream(false);
|
2018-08-31 18:18:35 -04:00
|
|
|
m_channelMarker.blockSignals(false);
|
|
|
|
m_channelMarker.setVisible(true); // activate signal on the last setting only
|
|
|
|
|
|
|
|
m_settings.setChannelMarker(&m_channelMarker);
|
2022-01-08 23:27:12 -05:00
|
|
|
m_settings.setRollupState(&m_rollupState);
|
2018-08-31 18:18:35 -04:00
|
|
|
|
|
|
|
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
|
|
|
m_deviceUISet->addRollupWidget(this);
|
|
|
|
|
2018-09-11 02:41:37 -04:00
|
|
|
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
|
2018-08-31 18:18:35 -04:00
|
|
|
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
2018-09-02 13:12:03 -04:00
|
|
|
|
|
|
|
m_time.start();
|
2018-08-31 18:18:35 -04:00
|
|
|
|
|
|
|
displaySettings();
|
2021-12-14 01:56:02 -05:00
|
|
|
displayPosition();
|
|
|
|
displayRateAndShift();
|
2018-08-31 18:18:35 -04:00
|
|
|
applySettings(true);
|
2018-08-31 17:29:53 -04:00
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
RemoteSourceGUI::~RemoteSourceGUI()
|
2018-08-31 17:29:53 -04:00
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::blockApplySettings(bool block)
|
2018-08-31 17:29:53 -04:00
|
|
|
{
|
|
|
|
m_doApplySettings = !block;
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::applySettings(bool force)
|
2018-08-31 17:29:53 -04:00
|
|
|
{
|
2018-08-31 22:37:23 -04:00
|
|
|
if (m_doApplySettings)
|
|
|
|
{
|
|
|
|
setTitleColor(m_channelMarker.getColor());
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
RemoteSource::MsgConfigureRemoteSource* message = RemoteSource::MsgConfigureRemoteSource::create(m_settings, force);
|
|
|
|
m_remoteSrc->getInputMessageQueue()->push(message);
|
2018-08-31 22:37:23 -04:00
|
|
|
}
|
2018-08-31 17:29:53 -04:00
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::displaySettings()
|
2018-08-31 17:29:53 -04:00
|
|
|
{
|
2018-08-31 18:18:35 -04:00
|
|
|
m_channelMarker.blockSignals(true);
|
|
|
|
m_channelMarker.setCenterFrequency(0);
|
|
|
|
m_channelMarker.setTitle(m_settings.m_title);
|
2019-11-14 19:04:24 -05:00
|
|
|
m_channelMarker.setBandwidth(m_remoteSampleRate);
|
2018-08-31 18:18:35 -04:00
|
|
|
m_channelMarker.blockSignals(false);
|
|
|
|
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
|
|
|
|
|
|
|
|
setTitleColor(m_settings.m_rgbColor);
|
|
|
|
setWindowTitle(m_channelMarker.getTitle());
|
2019-11-17 05:09:07 -05:00
|
|
|
displayStreamIndex();
|
2018-08-31 18:18:35 -04:00
|
|
|
|
|
|
|
blockApplySettings(true);
|
|
|
|
ui->dataAddress->setText(m_settings.m_dataAddress);
|
|
|
|
ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort));
|
2022-01-08 23:27:12 -05:00
|
|
|
restoreState(m_rollupState);
|
2018-08-31 18:18:35 -04:00
|
|
|
blockApplySettings(false);
|
|
|
|
}
|
|
|
|
|
2021-12-14 01:56:02 -05:00
|
|
|
void RemoteSourceGUI::displayRateAndShift()
|
|
|
|
{
|
|
|
|
int shift = m_shiftFrequencyFactor * m_basebandSampleRate;
|
|
|
|
double channelSampleRate = ((double) m_basebandSampleRate) / (1<<m_settings.m_log2Interp);
|
|
|
|
QLocale loc;
|
|
|
|
ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift)));
|
|
|
|
ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5)));
|
|
|
|
m_channelMarker.setCenterFrequency(shift);
|
|
|
|
m_channelMarker.setBandwidth(channelSampleRate);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoteSourceGUI::displayPosition()
|
|
|
|
{
|
|
|
|
ui->filterChainIndex->setText(tr("%1").arg(m_settings.m_filterChainHash));
|
|
|
|
QString s;
|
|
|
|
HBFilterChainConverter::convertToString(m_settings.m_log2Interp, m_settings.m_filterChainHash, s);
|
|
|
|
ui->filterChainText->setText(s);
|
|
|
|
}
|
|
|
|
|
2019-11-17 05:09:07 -05:00
|
|
|
void RemoteSourceGUI::displayStreamIndex()
|
|
|
|
{
|
|
|
|
if (m_deviceUISet->m_deviceMIMOEngine) {
|
|
|
|
setStreamIndicator(tr("%1").arg(m_settings.m_streamIndex));
|
|
|
|
} else {
|
|
|
|
setStreamIndicator("S"); // single channel indicator
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::leaveEvent(QEvent*)
|
2018-08-31 18:18:35 -04:00
|
|
|
{
|
|
|
|
m_channelMarker.setHighlighted(false);
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::enterEvent(QEvent*)
|
2018-08-31 18:18:35 -04:00
|
|
|
{
|
|
|
|
m_channelMarker.setHighlighted(true);
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::handleSourceMessages()
|
2018-08-31 18:18:35 -04:00
|
|
|
{
|
|
|
|
Message* message;
|
|
|
|
|
|
|
|
while ((message = getInputMessageQueue()->pop()) != 0)
|
|
|
|
{
|
|
|
|
if (handleMessage(*message))
|
|
|
|
{
|
|
|
|
delete message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
2018-08-31 18:18:35 -04:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) widget;
|
|
|
|
(void) rollDown;
|
2021-11-24 04:50:42 -05:00
|
|
|
|
2022-01-08 23:27:12 -05:00
|
|
|
saveState(m_rollupState);
|
2021-11-24 04:50:42 -05:00
|
|
|
applySettings();
|
2018-08-31 18:18:35 -04:00
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::onMenuDialogCalled(const QPoint &p)
|
2018-08-31 18:18:35 -04:00
|
|
|
{
|
2019-05-09 15:07:05 -04:00
|
|
|
if (m_contextMenuType == ContextMenuChannelSettings)
|
|
|
|
{
|
|
|
|
BasicChannelSettingsDialog dialog(&m_channelMarker, 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);
|
|
|
|
dialog.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex);
|
|
|
|
|
|
|
|
dialog.move(p);
|
|
|
|
dialog.exec();
|
|
|
|
|
|
|
|
m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
|
|
|
|
m_settings.m_title = m_channelMarker.getTitle();
|
|
|
|
m_settings.m_useReverseAPI = dialog.useReverseAPI();
|
|
|
|
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
|
|
|
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
|
|
|
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
|
|
|
m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex();
|
|
|
|
|
|
|
|
setWindowTitle(m_settings.m_title);
|
|
|
|
setTitleColor(m_settings.m_rgbColor);
|
|
|
|
|
|
|
|
applySettings();
|
|
|
|
}
|
2019-11-17 05:09:07 -05:00
|
|
|
else if ((m_contextMenuType == ContextMenuStreamSettings) && (m_deviceUISet->m_deviceMIMOEngine))
|
|
|
|
{
|
|
|
|
DeviceStreamSelectionDialog dialog(this);
|
|
|
|
dialog.setNumberOfStreams(m_remoteSrc->getNumberOfDeviceStreams());
|
|
|
|
dialog.setStreamIndex(m_settings.m_streamIndex);
|
|
|
|
dialog.move(p);
|
|
|
|
dialog.exec();
|
|
|
|
|
|
|
|
m_settings.m_streamIndex = dialog.getSelectedStreamIndex();
|
|
|
|
m_channelMarker.clearStreamIndexes();
|
|
|
|
m_channelMarker.addStreamIndex(m_settings.m_streamIndex);
|
|
|
|
displayStreamIndex();
|
|
|
|
applySettings();
|
|
|
|
}
|
2018-08-31 18:18:35 -04:00
|
|
|
|
2019-05-09 15:07:05 -04:00
|
|
|
resetContextMenuType();
|
2018-08-31 17:29:53 -04:00
|
|
|
}
|
2018-08-31 22:37:23 -04:00
|
|
|
|
2021-12-14 01:56:02 -05:00
|
|
|
void RemoteSourceGUI::on_interpolationFactor_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_log2Interp = index;
|
|
|
|
applyInterpolation();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoteSourceGUI::on_position_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_filterChainHash = value;
|
|
|
|
applyPosition();
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::on_dataAddress_returnPressed()
|
2018-08-31 22:37:23 -04:00
|
|
|
{
|
|
|
|
m_settings.m_dataAddress = ui->dataAddress->text();
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::on_dataPort_returnPressed()
|
2018-08-31 22:37:23 -04:00
|
|
|
{
|
|
|
|
bool dataOk;
|
|
|
|
int dataPort = ui->dataPort->text().toInt(&dataOk);
|
|
|
|
|
2021-12-06 23:27:58 -05:00
|
|
|
if ((!dataOk) || (dataPort < 1024) || (dataPort > 65535)) {
|
2018-08-31 22:37:23 -04:00
|
|
|
return;
|
2021-12-06 23:27:58 -05:00
|
|
|
} else {
|
2018-08-31 22:37:23 -04:00
|
|
|
m_settings.m_dataPort = dataPort;
|
|
|
|
}
|
|
|
|
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::on_dataApplyButton_clicked(bool checked)
|
2018-08-31 22:37:23 -04:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) checked;
|
2018-08-31 22:37:23 -04:00
|
|
|
m_settings.m_dataAddress = ui->dataAddress->text();
|
|
|
|
|
|
|
|
bool dataOk;
|
|
|
|
int udpDataPort = ui->dataPort->text().toInt(&dataOk);
|
|
|
|
|
2021-12-06 23:27:58 -05:00
|
|
|
if ((dataOk) && (udpDataPort >= 1024) && (udpDataPort < 65535)) {
|
2018-08-31 22:37:23 -04:00
|
|
|
m_settings.m_dataPort = udpDataPort;
|
|
|
|
}
|
|
|
|
|
|
|
|
applySettings();
|
|
|
|
}
|
2018-09-02 13:12:03 -04:00
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::on_eventCountsReset_clicked(bool checked)
|
2018-09-02 13:12:03 -04:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) checked;
|
2018-09-02 13:12:03 -04:00
|
|
|
m_countUnrecoverable = 0;
|
|
|
|
m_countRecovered = 0;
|
|
|
|
m_time.start();
|
|
|
|
displayEventCounts();
|
|
|
|
displayEventTimer();
|
|
|
|
}
|
|
|
|
|
2021-12-14 01:56:02 -05:00
|
|
|
void RemoteSourceGUI::applyInterpolation()
|
|
|
|
{
|
|
|
|
uint32_t maxHash = 1;
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < m_settings.m_log2Interp; i++) {
|
|
|
|
maxHash *= 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->position->setMaximum(maxHash-1);
|
|
|
|
ui->position->setValue(m_settings.m_filterChainHash);
|
|
|
|
m_settings.m_filterChainHash = ui->position->value();
|
|
|
|
applyPosition();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoteSourceGUI::applyPosition()
|
|
|
|
{
|
|
|
|
ui->filterChainIndex->setText(tr("%1").arg(m_settings.m_filterChainHash));
|
|
|
|
QString s;
|
|
|
|
m_shiftFrequencyFactor = HBFilterChainConverter::convertToString(m_settings.m_log2Interp, m_settings.m_filterChainHash, s);
|
|
|
|
ui->filterChainText->setText(s);
|
|
|
|
|
|
|
|
displayRateAndShift();
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::displayEventCounts()
|
2018-09-02 13:12:03 -04: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-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::displayEventStatus(int recoverableCount, int unrecoverableCount)
|
2018-09-02 13:12:03 -04: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-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::displayEventTimer()
|
2018-09-02 13:12:03 -04:00
|
|
|
{
|
|
|
|
int elapsedTimeMillis = m_time.elapsed();
|
|
|
|
QTime recordLength(0, 0, 0, 0);
|
|
|
|
recordLength = recordLength.addSecs(elapsedTimeMillis/1000);
|
|
|
|
QString s_time = recordLength.toString("HH:mm:ss");
|
|
|
|
ui->eventCountsTimeText->setText(s_time);
|
|
|
|
}
|
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::tick()
|
2018-09-02 13:12:03 -04:00
|
|
|
{
|
|
|
|
if (++m_tickCount == 20) // once per second
|
|
|
|
{
|
2019-01-22 18:44:13 -05:00
|
|
|
RemoteSource::MsgQueryStreamData *msg = RemoteSource::MsgQueryStreamData::create();
|
|
|
|
m_remoteSrc->getInputMessageQueue()->push(msg);
|
2018-09-02 13:12:03 -04:00
|
|
|
|
|
|
|
displayEventTimer();
|
|
|
|
|
|
|
|
m_tickCount = 0;
|
|
|
|
}
|
|
|
|
}
|
2018-09-11 02:41:37 -04:00
|
|
|
|
2019-01-22 18:44:13 -05:00
|
|
|
void RemoteSourceGUI::channelMarkerChangedByCursor()
|
2018-09-11 02:41:37 -04:00
|
|
|
{
|
|
|
|
}
|