2015-12-06 13:47:55 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2015 F4EXB //
|
|
|
|
// written by Edouard Griffiths //
|
|
|
|
// //
|
|
|
|
// 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. //
|
2015-12-06 13:47:55 -05: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/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-01-08 14:11:01 -05:00
|
|
|
#include "bfmdemodgui.h"
|
2016-10-02 07:18:07 -04:00
|
|
|
|
2017-10-31 03:24:05 -04:00
|
|
|
#include "device/deviceuiset.h"
|
2015-12-06 04:30:51 -05:00
|
|
|
#include <QDockWidget>
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QDebug>
|
2015-12-13 19:36:13 -05:00
|
|
|
#include "boost/format.hpp"
|
|
|
|
#include <sstream>
|
|
|
|
#include <iostream>
|
|
|
|
#include <iomanip>
|
|
|
|
|
2015-12-06 04:30:51 -05:00
|
|
|
#include "dsp/dspengine.h"
|
2015-12-06 13:47:55 -05:00
|
|
|
#include "dsp/spectrumvis.h"
|
2015-12-06 04:30:51 -05:00
|
|
|
#include "gui/glspectrum.h"
|
|
|
|
#include "plugin/pluginapi.h"
|
|
|
|
#include "util/simpleserializer.h"
|
|
|
|
#include "util/db.h"
|
2017-08-25 12:56:43 -04:00
|
|
|
#include "gui/basicchannelsettingsdialog.h"
|
2019-09-22 19:25:17 -04:00
|
|
|
#include "gui/devicestreamselectiondialog.h"
|
2018-03-27 17:57:29 -04:00
|
|
|
#include "gui/crightclickenabler.h"
|
|
|
|
#include "gui/audioselectdialog.h"
|
2020-10-12 15:59:04 -04:00
|
|
|
#include "maincore.h"
|
2015-12-06 04:30:51 -05:00
|
|
|
|
2019-12-03 12:49:52 -05:00
|
|
|
#include "bfmdemodreport.h"
|
2017-10-01 11:54:48 -04:00
|
|
|
#include "bfmdemodsettings.h"
|
2017-01-08 14:11:01 -05:00
|
|
|
#include "bfmdemod.h"
|
|
|
|
#include "rdstmc.h"
|
2015-12-06 04:30:51 -05:00
|
|
|
#include "ui_bfmdemodgui.h"
|
|
|
|
|
2017-11-08 19:03:05 -05:00
|
|
|
BFMDemodGUI* BFMDemodGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUIset, BasebandSampleSink *rxChannel)
|
2015-12-06 04:30:51 -05:00
|
|
|
{
|
2017-11-08 19:03:05 -05:00
|
|
|
BFMDemodGUI* gui = new BFMDemodGUI(pluginAPI, deviceUIset, rxChannel);
|
2015-12-06 04:30:51 -05:00
|
|
|
return gui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemodGUI::destroy()
|
|
|
|
{
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemodGUI::resetToDefaults()
|
|
|
|
{
|
2017-10-01 13:20:56 -04:00
|
|
|
m_settings.resetToDefaults();
|
|
|
|
displaySettings();
|
2015-12-06 04:30:51 -05:00
|
|
|
|
2017-10-01 13:20:56 -04:00
|
|
|
blockApplySettings(true);
|
2017-08-25 21:56:03 -04:00
|
|
|
ui->g00AltFrequenciesBox->setEnabled(false);
|
|
|
|
ui->g14MappedFrequencies->setEnabled(false);
|
|
|
|
ui->g14AltFrequencies->setEnabled(false);
|
2015-12-06 04:30:51 -05:00
|
|
|
blockApplySettings(false);
|
2017-10-01 13:20:56 -04:00
|
|
|
|
2015-12-06 04:30:51 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray BFMDemodGUI::serialize() const
|
|
|
|
{
|
2017-10-01 13:20:56 -04:00
|
|
|
return m_settings.serialize();
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BFMDemodGUI::deserialize(const QByteArray& data)
|
|
|
|
{
|
2017-10-01 13:20:56 -04:00
|
|
|
if(m_settings.deserialize(data)) {
|
|
|
|
displaySettings();
|
|
|
|
applySettings(true);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
2017-10-01 06:48:31 -04:00
|
|
|
bool BFMDemodGUI::handleMessage(const Message& message)
|
2015-12-06 04:30:51 -05:00
|
|
|
{
|
2019-12-03 12:49:52 -05:00
|
|
|
if (BFMDemodReport::MsgReportChannelSampleRateChanged::match(message))
|
2017-10-01 06:48:31 -04:00
|
|
|
{
|
2019-12-03 12:49:52 -05:00
|
|
|
BFMDemodReport::MsgReportChannelSampleRateChanged& report = (BFMDemodReport::MsgReportChannelSampleRateChanged&) message;
|
2017-10-01 06:48:31 -04:00
|
|
|
m_rate = report.getSampleRate();
|
2019-12-03 12:49:52 -05:00
|
|
|
qDebug("BFMDemodGUI::handleMessage: BFMDemodReport::MsgReportChannelSampleRateChanged: %d S/s", m_rate);
|
2017-10-01 06:48:31 -04:00
|
|
|
ui->glSpectrum->setCenterFrequency(m_rate / 4);
|
|
|
|
ui->glSpectrum->setSampleRate(m_rate / 2);
|
|
|
|
return true;
|
|
|
|
}
|
2018-05-23 08:56:29 -04:00
|
|
|
else if (BFMDemod::MsgConfigureBFMDemod::match(message))
|
|
|
|
{
|
|
|
|
qDebug("BFMDemodGUI::handleMessage: BFMDemod::MsgConfigureBFMDemod");
|
|
|
|
const BFMDemod::MsgConfigureBFMDemod& cfg = (BFMDemod::MsgConfigureBFMDemod&) message;
|
|
|
|
m_settings = cfg.getSettings();
|
|
|
|
blockApplySettings(true);
|
|
|
|
displaySettings();
|
|
|
|
blockApplySettings(false);
|
|
|
|
return true;
|
|
|
|
}
|
2017-10-01 06:48:31 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
2017-10-01 06:48:31 -04:00
|
|
|
void BFMDemodGUI::handleInputMessages()
|
|
|
|
{
|
|
|
|
Message* message;
|
|
|
|
|
|
|
|
while ((message = getInputMessageQueue()->pop()) != 0)
|
|
|
|
{
|
|
|
|
if (handleMessage(*message))
|
|
|
|
{
|
|
|
|
delete message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-13 19:23:01 -05:00
|
|
|
void BFMDemodGUI::channelMarkerChangedByCursor()
|
2015-12-06 04:30:51 -05:00
|
|
|
{
|
2017-11-13 19:23:01 -05:00
|
|
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
|
|
|
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
2017-08-25 12:56:43 -04:00
|
|
|
applySettings();
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
2017-11-14 16:58:35 -05:00
|
|
|
void BFMDemodGUI::channelMarkerHighlightedByCursor()
|
|
|
|
{
|
|
|
|
setHighlighted(m_channelMarker.getHighlighted());
|
|
|
|
}
|
|
|
|
|
2017-05-17 17:52:10 -04:00
|
|
|
void BFMDemodGUI::on_deltaFrequency_changed(qint64 value)
|
2015-12-06 04:30:51 -05:00
|
|
|
{
|
2017-05-17 17:52:10 -04:00
|
|
|
m_channelMarker.setCenterFrequency(value);
|
2017-10-01 13:20:56 -04:00
|
|
|
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
|
|
|
applySettings();
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemodGUI::on_rfBW_valueChanged(int value)
|
|
|
|
{
|
2017-10-01 11:54:48 -04:00
|
|
|
ui->rfBWText->setText(QString("%1 kHz").arg(BFMDemodSettings::getRFBW(value) / 1000.0));
|
|
|
|
m_channelMarker.setBandwidth(BFMDemodSettings::getRFBW(value));
|
2017-10-01 13:20:56 -04:00
|
|
|
m_settings.m_rfBandwidth = BFMDemodSettings::getRFBW(value);
|
2015-12-06 04:30:51 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemodGUI::on_afBW_valueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->afBWText->setText(QString("%1 kHz").arg(value));
|
2017-10-01 13:20:56 -04:00
|
|
|
m_settings.m_afBandwidth = value * 1000.0;
|
2015-12-06 04:30:51 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemodGUI::on_volume_valueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
|
2017-10-01 13:20:56 -04:00
|
|
|
m_settings.m_volume = value / 10.0;
|
2015-12-06 04:30:51 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemodGUI::on_squelch_valueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->squelchText->setText(QString("%1 dB").arg(value));
|
2017-10-01 13:20:56 -04:00
|
|
|
m_settings.m_squelch = value;
|
2015-12-06 04:30:51 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2015-12-06 21:36:56 -05:00
|
|
|
void BFMDemodGUI::on_audioStereo_toggled(bool stereo)
|
|
|
|
{
|
|
|
|
if (!stereo)
|
|
|
|
{
|
|
|
|
ui->audioStereo->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
|
|
|
}
|
2015-12-07 02:55:22 -05:00
|
|
|
|
2017-10-01 13:20:56 -04:00
|
|
|
m_settings.m_audioStereo = stereo;
|
2015-12-07 02:55:22 -05:00
|
|
|
applySettings();
|
2015-12-06 21:36:56 -05:00
|
|
|
}
|
2015-12-06 04:30:51 -05:00
|
|
|
|
2017-10-01 13:20:56 -04:00
|
|
|
void BFMDemodGUI::on_lsbStereo_toggled(bool lsb)
|
2015-12-25 14:12:50 -05:00
|
|
|
{
|
2017-10-01 13:20:56 -04:00
|
|
|
m_settings.m_lsbStereo = lsb;
|
2015-12-25 14:12:50 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2015-12-08 18:04:46 -05:00
|
|
|
void BFMDemodGUI::on_showPilot_clicked()
|
|
|
|
{
|
2017-10-01 13:20:56 -04:00
|
|
|
m_settings.m_showPilot = ui->showPilot->isChecked();
|
2015-12-08 18:04:46 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2015-12-08 22:13:13 -05:00
|
|
|
void BFMDemodGUI::on_rds_clicked()
|
|
|
|
{
|
2017-10-01 13:20:56 -04:00
|
|
|
m_settings.m_rdsActive = ui->rds->isChecked();
|
2015-12-15 21:12:38 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void BFMDemodGUI::on_clearData_clicked(bool checked)
|
2015-12-15 21:12:38 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) checked;
|
2015-12-15 21:12:38 -05:00
|
|
|
if (ui->rds->isChecked())
|
|
|
|
{
|
2017-10-01 05:50:16 -04:00
|
|
|
m_bfmDemod->getRDSParser().clearAllFields();
|
2015-12-15 21:12:38 -05:00
|
|
|
|
|
|
|
ui->g14ProgServiceNames->clear();
|
|
|
|
ui->g14MappedFrequencies->clear();
|
|
|
|
ui->g14AltFrequencies->clear();
|
|
|
|
|
2015-12-15 22:12:49 -05:00
|
|
|
ui->g00AltFrequenciesBox->setEnabled(false);
|
|
|
|
ui->g14MappedFrequencies->setEnabled(false);
|
|
|
|
ui->g14AltFrequencies->setEnabled(false);
|
|
|
|
|
2015-12-14 20:55:12 -05:00
|
|
|
rdsUpdate(true);
|
|
|
|
}
|
2015-12-15 21:12:38 -05:00
|
|
|
}
|
2015-12-14 20:55:12 -05:00
|
|
|
|
2017-05-25 14:13:34 -04:00
|
|
|
void BFMDemodGUI::on_g14ProgServiceNames_currentIndexChanged(int _index)
|
2015-12-15 21:12:38 -05:00
|
|
|
{
|
2017-05-25 14:13:34 -04:00
|
|
|
uint32_t index = _index & 0x7FFFFFF;
|
|
|
|
|
2015-12-15 21:12:38 -05:00
|
|
|
if (index < m_g14ComboIndex.size())
|
|
|
|
{
|
|
|
|
unsigned int piKey = m_g14ComboIndex[index];
|
2017-10-01 05:50:16 -04:00
|
|
|
RDSParser::freqs_map_t::const_iterator mIt = m_bfmDemod->getRDSParser().m_g14_mapped_freqs.find(piKey);
|
2015-12-15 21:12:38 -05:00
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
if (mIt != m_bfmDemod->getRDSParser().m_g14_mapped_freqs.end())
|
2015-12-15 21:12:38 -05:00
|
|
|
{
|
|
|
|
ui->g14MappedFrequencies->clear();
|
|
|
|
RDSParser::freqs_set_t::iterator sIt = (mIt->second).begin();
|
|
|
|
const RDSParser::freqs_set_t::iterator sItEnd = (mIt->second).end();
|
|
|
|
|
2016-11-21 12:01:55 -05:00
|
|
|
for (; sIt != sItEnd; ++sIt)
|
2015-12-15 21:12:38 -05:00
|
|
|
{
|
|
|
|
std::ostringstream os;
|
|
|
|
os << std::fixed << std::showpoint << std::setprecision(2) << *sIt;
|
|
|
|
ui->g14MappedFrequencies->addItem(os.str().c_str());
|
|
|
|
}
|
2015-12-15 22:12:49 -05:00
|
|
|
|
|
|
|
ui->g14MappedFrequencies->setEnabled(ui->g14MappedFrequencies->count() > 0);
|
2015-12-15 21:12:38 -05:00
|
|
|
}
|
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
mIt = m_bfmDemod->getRDSParser().m_g14_alt_freqs.find(piKey);
|
2015-12-15 21:12:38 -05:00
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
if (mIt != m_bfmDemod->getRDSParser().m_g14_alt_freqs.end())
|
2015-12-15 21:12:38 -05:00
|
|
|
{
|
|
|
|
ui->g14AltFrequencies->clear();
|
|
|
|
RDSParser::freqs_set_t::iterator sIt = (mIt->second).begin();
|
|
|
|
const RDSParser::freqs_set_t::iterator sItEnd = (mIt->second).end();
|
|
|
|
|
2016-11-21 12:01:55 -05:00
|
|
|
for (; sIt != sItEnd; ++sIt)
|
2015-12-15 21:12:38 -05:00
|
|
|
{
|
|
|
|
std::ostringstream os;
|
|
|
|
os << std::fixed << std::showpoint << std::setprecision(2) << *sIt;
|
|
|
|
ui->g14AltFrequencies->addItem(os.str().c_str());
|
|
|
|
}
|
2015-12-15 22:12:49 -05:00
|
|
|
|
|
|
|
ui->g14AltFrequencies->setEnabled(ui->g14AltFrequencies->count() > 0);
|
2015-12-15 21:12:38 -05:00
|
|
|
}
|
|
|
|
}
|
2015-12-08 22:13:13 -05:00
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void BFMDemodGUI::on_g00AltFrequenciesBox_activated(int index)
|
2015-12-15 22:12:49 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) index;
|
2015-12-15 22:12:49 -05:00
|
|
|
qint64 f = (qint64) ((ui->g00AltFrequenciesBox->currentText()).toDouble() * 1e6);
|
|
|
|
changeFrequency(f);
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void BFMDemodGUI::on_g14MappedFrequencies_activated(int index)
|
2015-12-15 22:12:49 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) index;
|
2015-12-15 22:12:49 -05:00
|
|
|
qint64 f = (qint64) ((ui->g14MappedFrequencies->currentText()).toDouble() * 1e6);
|
|
|
|
changeFrequency(f);
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void BFMDemodGUI::on_g14AltFrequencies_activated(int index)
|
2015-12-15 22:12:49 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) index;
|
2015-12-15 22:12:49 -05:00
|
|
|
qint64 f = (qint64) ((ui->g14AltFrequencies->currentText()).toDouble() * 1e6);
|
|
|
|
changeFrequency(f);
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void BFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
2015-12-06 04:30:51 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) widget;
|
|
|
|
(void) rollDown;
|
2021-11-24 04:50:42 -05:00
|
|
|
|
|
|
|
m_settings.m_rollupState = saveState();
|
|
|
|
applySettings();
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
2017-08-25 12:56:43 -04:00
|
|
|
void BFMDemodGUI::onMenuDialogCalled(const QPoint &p)
|
2015-12-06 04:30:51 -05: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_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
|
|
|
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-09-22 19:25:17 -04:00
|
|
|
else if ((m_contextMenuType == ContextMenuStreamSettings) && (m_deviceUISet->m_deviceMIMOEngine))
|
|
|
|
{
|
|
|
|
DeviceStreamSelectionDialog dialog(this);
|
|
|
|
dialog.setNumberOfStreams(m_bfmDemod->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();
|
|
|
|
}
|
2017-11-13 19:23:01 -05:00
|
|
|
|
2019-05-09 15:07:05 -04:00
|
|
|
resetContextMenuType();
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
2017-11-08 19:03:05 -05:00
|
|
|
BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent) :
|
2020-10-04 00:16:15 -04:00
|
|
|
ChannelGUI(parent),
|
2015-12-06 04:30:51 -05:00
|
|
|
ui(new Ui::BFMDemodGUI),
|
|
|
|
m_pluginAPI(pluginAPI),
|
2017-10-31 03:24:05 -04:00
|
|
|
m_deviceUISet(deviceUISet),
|
2015-12-06 04:30:51 -05:00
|
|
|
m_channelMarker(this),
|
2015-12-13 19:36:13 -05:00
|
|
|
m_rdsTimerCount(0),
|
2015-12-08 03:25:46 -05:00
|
|
|
m_rate(625000)
|
2015-12-06 04:30:51 -05:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2017-05-17 17:52:10 -04:00
|
|
|
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
|
|
|
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
2020-07-01 07:14:48 -04:00
|
|
|
ui->deltaFrequency->setValueRange(false, 8, -99999999, 99999999);
|
2016-12-06 13:06:38 -05:00
|
|
|
ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue);
|
2015-12-06 04:30:51 -05:00
|
|
|
|
2018-03-27 17:57:29 -04:00
|
|
|
CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioStereo);
|
2018-12-16 18:34:14 -05:00
|
|
|
connect(audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect()));
|
2018-03-27 17:57:29 -04:00
|
|
|
|
2015-12-06 04:30:51 -05:00
|
|
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
|
|
|
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
2017-08-25 12:56:43 -04:00
|
|
|
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
2017-10-01 06:48:31 -04:00
|
|
|
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
2015-12-06 04:30:51 -05:00
|
|
|
|
2020-10-14 16:07:48 -04:00
|
|
|
m_bfmDemod = (BFMDemod*) rxChannel;
|
2020-04-30 03:57:05 -04:00
|
|
|
m_spectrumVis = m_bfmDemod->getSpectrumVis();
|
|
|
|
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
|
2017-10-01 06:48:31 -04:00
|
|
|
m_bfmDemod->setMessageQueueToGUI(getInputMessageQueue());
|
2020-01-24 21:43:42 -05:00
|
|
|
m_bfmDemod->setBasebandMessageQueueToGUI(getInputMessageQueue());
|
2015-12-06 04:30:51 -05:00
|
|
|
|
2015-12-08 03:25:46 -05:00
|
|
|
ui->glSpectrum->setCenterFrequency(m_rate / 4);
|
|
|
|
ui->glSpectrum->setSampleRate(m_rate / 2);
|
2015-12-06 13:47:55 -05:00
|
|
|
ui->glSpectrum->setDisplayWaterfall(false);
|
|
|
|
ui->glSpectrum->setDisplayMaxHold(false);
|
|
|
|
ui->glSpectrum->setSsbSpectrum(true);
|
2020-10-12 15:59:04 -04:00
|
|
|
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
2015-12-06 04:30:51 -05:00
|
|
|
|
2017-11-13 19:23:01 -05:00
|
|
|
m_channelMarker.blockSignals(true);
|
|
|
|
m_channelMarker.setColor(m_settings.m_rgbColor);
|
2015-12-06 04:30:51 -05:00
|
|
|
m_channelMarker.setBandwidth(12500);
|
|
|
|
m_channelMarker.setCenterFrequency(0);
|
2017-11-13 19:23:01 -05:00
|
|
|
m_channelMarker.setTitle("Broadcast FM Demod");
|
|
|
|
m_channelMarker.blockSignals(false);
|
|
|
|
m_channelMarker.setVisible(true); // activate signal on the last setting only
|
|
|
|
|
2017-03-18 12:55:28 -04:00
|
|
|
setTitleColor(m_channelMarker.getColor());
|
2016-05-16 13:37:53 -04:00
|
|
|
|
2017-10-01 13:20:56 -04:00
|
|
|
m_settings.setChannelMarker(&m_channelMarker);
|
|
|
|
m_settings.setSpectrumGUI(ui->spectrumGUI);
|
|
|
|
|
2017-10-31 03:24:05 -04:00
|
|
|
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
|
|
|
m_deviceUISet->addRollupWidget(this);
|
2015-12-06 04:30:51 -05:00
|
|
|
|
2017-11-13 19:23:01 -05:00
|
|
|
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
|
2017-11-14 16:58:35 -05:00
|
|
|
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
2017-11-13 19:23:01 -05:00
|
|
|
|
2020-04-30 20:33:50 -04:00
|
|
|
ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum);
|
2015-12-06 13:47:55 -05:00
|
|
|
|
2015-12-15 22:12:49 -05:00
|
|
|
ui->g00AltFrequenciesBox->setEnabled(false);
|
|
|
|
ui->g14MappedFrequencies->setEnabled(false);
|
|
|
|
ui->g14AltFrequencies->setEnabled(false);
|
|
|
|
|
2015-12-14 09:15:31 -05:00
|
|
|
rdsUpdateFixedFields();
|
|
|
|
rdsUpdate(true);
|
2017-10-01 13:20:56 -04:00
|
|
|
displaySettings();
|
2017-08-25 12:56:43 -04:00
|
|
|
applySettings(true);
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
BFMDemodGUI::~BFMDemodGUI()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemodGUI::blockApplySettings(bool block)
|
|
|
|
{
|
|
|
|
m_doApplySettings = !block;
|
|
|
|
}
|
|
|
|
|
2017-08-25 12:56:43 -04:00
|
|
|
void BFMDemodGUI::applySettings(bool force)
|
2015-12-06 04:30:51 -05:00
|
|
|
{
|
|
|
|
if (m_doApplySettings)
|
|
|
|
{
|
2017-10-01 14:17:20 -04:00
|
|
|
BFMDemod::MsgConfigureBFMDemod* msgConfig = BFMDemod::MsgConfigureBFMDemod::create( m_settings, force);
|
|
|
|
m_bfmDemod->getInputMessageQueue()->push(msgConfig);
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-01 13:20:56 -04:00
|
|
|
void BFMDemodGUI::displaySettings()
|
|
|
|
{
|
2017-10-11 19:21:30 -04:00
|
|
|
m_channelMarker.blockSignals(true);
|
|
|
|
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
2017-11-13 19:23:01 -05:00
|
|
|
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
|
2017-11-18 21:38:07 -05:00
|
|
|
m_channelMarker.setTitle(m_settings.m_title);
|
2017-10-11 19:21:30 -04:00
|
|
|
m_channelMarker.blockSignals(false);
|
2017-11-13 19:23:01 -05:00
|
|
|
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
|
2017-10-11 19:21:30 -04:00
|
|
|
|
2017-11-13 19:23:01 -05:00
|
|
|
setTitleColor(m_settings.m_rgbColor);
|
2017-10-11 19:21:30 -04:00
|
|
|
setWindowTitle(m_channelMarker.getTitle());
|
2017-10-01 13:20:56 -04:00
|
|
|
|
2017-10-11 19:21:30 -04:00
|
|
|
blockApplySettings(true);
|
2017-10-01 13:20:56 -04:00
|
|
|
|
2017-11-13 19:23:01 -05:00
|
|
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
|
|
|
|
2017-10-01 13:20:56 -04:00
|
|
|
ui->rfBW->setValue(BFMDemodSettings::getRFBWIndex(m_settings.m_rfBandwidth));
|
|
|
|
ui->rfBWText->setText(QString("%1 kHz").arg(m_settings.m_rfBandwidth / 1000.0));
|
|
|
|
|
|
|
|
ui->afBW->setValue(m_settings.m_afBandwidth/1000.0);
|
|
|
|
ui->afBWText->setText(QString("%1 kHz").arg(m_settings.m_afBandwidth/1000.0));
|
|
|
|
|
|
|
|
ui->volume->setValue(m_settings.m_volume * 10.0);
|
|
|
|
ui->volumeText->setText(QString("%1").arg(m_settings.m_volume, 0, 'f', 1));
|
|
|
|
|
|
|
|
ui->squelch->setValue(m_settings.m_squelch);
|
|
|
|
ui->squelchText->setText(QString("%1 dB").arg(m_settings.m_squelch));
|
|
|
|
|
|
|
|
ui->audioStereo->setChecked(m_settings.m_audioStereo);
|
|
|
|
ui->lsbStereo->setChecked(m_settings.m_lsbStereo);
|
|
|
|
ui->showPilot->setChecked(m_settings.m_showPilot);
|
|
|
|
ui->rds->setChecked(m_settings.m_rdsActive);
|
2018-03-10 01:03:11 -05:00
|
|
|
|
2019-09-22 19:25:17 -04:00
|
|
|
displayStreamIndex();
|
|
|
|
|
2021-11-24 04:50:42 -05:00
|
|
|
restoreState(m_settings.m_rollupState);
|
2017-10-01 13:20:56 -04:00
|
|
|
blockApplySettings(false);
|
|
|
|
}
|
|
|
|
|
2019-09-22 19:25:17 -04:00
|
|
|
void BFMDemodGUI::displayStreamIndex()
|
|
|
|
{
|
|
|
|
if (m_deviceUISet->m_deviceMIMOEngine) {
|
|
|
|
setStreamIndicator(tr("%1").arg(m_settings.m_streamIndex));
|
|
|
|
} else {
|
|
|
|
setStreamIndicator("S"); // single channel indicator
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-06 04:30:51 -05:00
|
|
|
void BFMDemodGUI::leaveEvent(QEvent*)
|
|
|
|
{
|
|
|
|
m_channelMarker.setHighlighted(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemodGUI::enterEvent(QEvent*)
|
|
|
|
{
|
|
|
|
m_channelMarker.setHighlighted(true);
|
|
|
|
}
|
|
|
|
|
2018-03-27 17:57:29 -04:00
|
|
|
void BFMDemodGUI::audioSelect()
|
|
|
|
{
|
|
|
|
qDebug("BFMDemodGUI::audioSelect");
|
|
|
|
AudioSelectDialog audioSelect(DSPEngine::instance()->getAudioDeviceManager(), m_settings.m_audioDeviceName);
|
|
|
|
audioSelect.exec();
|
|
|
|
|
|
|
|
if (audioSelect.m_selected)
|
|
|
|
{
|
|
|
|
m_settings.m_audioDeviceName = audioSelect.m_audioDeviceName;
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-06 04:30:51 -05:00
|
|
|
void BFMDemodGUI::tick()
|
|
|
|
{
|
2017-05-16 17:39:49 -04:00
|
|
|
double magsqAvg, magsqPeak;
|
2016-12-06 13:06:38 -05:00
|
|
|
int nbMagsqSamples;
|
|
|
|
m_bfmDemod->getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
|
|
|
|
Real powDbAvg = CalcDb::dbPower(magsqAvg);
|
|
|
|
Real powDbPeak = CalcDb::dbPower(magsqPeak);
|
|
|
|
|
|
|
|
ui->channelPowerMeter->levelChanged(
|
|
|
|
(100.0f + powDbAvg) / 100.0f,
|
|
|
|
(100.0f + powDbPeak) / 100.0f,
|
|
|
|
nbMagsqSamples);
|
|
|
|
|
|
|
|
ui->channelPower->setText(QString::number(powDbAvg, 'f', 1));
|
|
|
|
|
2015-12-08 18:04:46 -05:00
|
|
|
Real pilotPowDb = CalcDb::dbPower(m_bfmDemod->getPilotLevel());
|
2020-11-04 02:59:16 -05:00
|
|
|
QString pilotPowDbStr = QString("%1%2").arg(pilotPowDb < 0 ? '-' : '+').arg(pilotPowDb, 3, 'f', 1, QLatin1Char('0'));
|
2015-12-08 18:04:46 -05:00
|
|
|
ui->pilotPower->setText(pilotPowDbStr);
|
|
|
|
|
2020-08-01 04:09:39 -04:00
|
|
|
if (m_bfmDemod->getAudioSampleRate() < 0)
|
|
|
|
{
|
|
|
|
ui->audioStereo->setStyleSheet("QToolButton { background-color : red; }");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_bfmDemod->getPilotLock())
|
|
|
|
{
|
|
|
|
if (ui->audioStereo->isChecked()) {
|
|
|
|
ui->audioStereo->setStyleSheet("QToolButton { background-color : green; }");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ui->audioStereo->isChecked()) {
|
|
|
|
ui->audioStereo->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-12-06 21:36:56 -05:00
|
|
|
|
2015-12-13 19:36:13 -05:00
|
|
|
if (ui->rds->isChecked() && (m_rdsTimerCount == 0))
|
|
|
|
{
|
2015-12-14 09:15:31 -05:00
|
|
|
rdsUpdate(false);
|
2015-12-13 19:36:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
m_rdsTimerCount = (m_rdsTimerCount + 1) % 25;
|
|
|
|
|
2015-12-06 20:18:31 -05:00
|
|
|
//qDebug() << "Pilot lock: " << m_bfmDemod->getPilotLock() << ":" << m_bfmDemod->getPilotLevel(); TODO: update a GUI item with status
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
2015-12-08 07:10:02 -05:00
|
|
|
|
2015-12-14 09:15:31 -05:00
|
|
|
void BFMDemodGUI::rdsUpdateFixedFields()
|
|
|
|
{
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g00Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[0].c_str());
|
|
|
|
ui->g01Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[1].c_str());
|
|
|
|
ui->g02Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[2].c_str());
|
|
|
|
ui->g03Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[3].c_str());
|
|
|
|
ui->g04Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[4].c_str());
|
|
|
|
//ui->g05Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[5].c_str());
|
|
|
|
//ui->g06Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[6].c_str());
|
|
|
|
//ui->g07Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[7].c_str());
|
|
|
|
ui->g08Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[8].c_str());
|
|
|
|
ui->g09Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[9].c_str());
|
|
|
|
ui->g14Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[14].c_str());
|
|
|
|
|
|
|
|
ui->g00CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[0].c_str());
|
|
|
|
ui->g01CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[1].c_str());
|
|
|
|
ui->g02CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[2].c_str());
|
|
|
|
ui->g03CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[3].c_str());
|
|
|
|
ui->g04CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[4].c_str());
|
|
|
|
ui->g05CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[5].c_str());
|
|
|
|
ui->g06CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[6].c_str());
|
|
|
|
ui->g07CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[7].c_str());
|
|
|
|
ui->g08CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[8].c_str());
|
|
|
|
ui->g09CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[9].c_str());
|
|
|
|
ui->g14CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[14].c_str());
|
2015-12-14 09:15:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemodGUI::rdsUpdate(bool force)
|
2015-12-13 19:36:13 -05:00
|
|
|
{
|
2015-12-13 21:01:44 -05:00
|
|
|
// Quality metrics
|
2015-12-13 22:01:41 -05:00
|
|
|
ui->demodQText->setText(QString("%1 %").arg(m_bfmDemod->getDemodQua(), 0, 'f', 0));
|
|
|
|
ui->decoderQText->setText(QString("%1 %").arg(m_bfmDemod->getDecoderQua(), 0, 'f', 0));
|
2015-12-13 21:01:44 -05:00
|
|
|
Real accDb = CalcDb::dbPower(std::fabs(m_bfmDemod->getDemodAcc()));
|
2015-12-13 22:01:41 -05:00
|
|
|
ui->accumText->setText(QString("%1 dB").arg(accDb, 0, 'f', 1));
|
|
|
|
ui->fclkText->setText(QString("%1 Hz").arg(m_bfmDemod->getDemodFclk(), 0, 'f', 2));
|
2015-12-13 21:01:44 -05:00
|
|
|
|
2015-12-14 20:55:12 -05:00
|
|
|
if (m_bfmDemod->getDecoderSynced()) {
|
|
|
|
ui->decoderQLabel->setStyleSheet("QLabel { background-color : green; }");
|
|
|
|
} else {
|
|
|
|
ui->decoderQLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
2015-12-13 19:36:13 -05:00
|
|
|
// PI group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_pi_updated || force)
|
2015-12-13 19:36:13 -05:00
|
|
|
{
|
|
|
|
ui->piLabel->setStyleSheet("QLabel { background-color : green; }");
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->piCountText->setNum((int) m_bfmDemod->getRDSParser().m_pi_count);
|
|
|
|
QString pistring(str(boost::format("%04X") % m_bfmDemod->getRDSParser().m_pi_program_identification).c_str());
|
2015-12-13 19:36:13 -05:00
|
|
|
ui->piText->setText(pistring);
|
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_pi_traffic_program) {
|
2015-12-13 19:36:13 -05:00
|
|
|
ui->piTPIndicator->setStyleSheet("QLabel { background-color : green; }");
|
|
|
|
} else {
|
|
|
|
ui->piTPIndicator->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->piType->setText(QString(m_bfmDemod->getRDSParser().pty_table[m_bfmDemod->getRDSParser().m_pi_program_type].c_str()));
|
|
|
|
ui->piCoverage->setText(QString(m_bfmDemod->getRDSParser().coverage_area_codes[m_bfmDemod->getRDSParser().m_pi_area_coverage_index].c_str()));
|
2015-12-13 19:36:13 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->piLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
|
|
|
// G0 group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g0_updated || force)
|
2015-12-13 19:36:13 -05:00
|
|
|
{
|
|
|
|
ui->g00Label->setStyleSheet("QLabel { background-color : green; }");
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g00CountText->setNum((int) m_bfmDemod->getRDSParser().m_g0_count);
|
2015-12-20 20:35:57 -05:00
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g0_psn_bitmap == 0b1111) {
|
|
|
|
ui->g00ProgServiceName->setText(QString(m_bfmDemod->getRDSParser().m_g0_program_service_name));
|
2015-12-20 20:35:57 -05:00
|
|
|
}
|
2015-12-13 19:36:13 -05:00
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g0_traffic_announcement) {
|
2015-12-13 19:36:13 -05:00
|
|
|
ui->g00TrafficAnnouncement->setStyleSheet("QLabel { background-color : green; }");
|
|
|
|
} else {
|
|
|
|
ui->g00TrafficAnnouncement->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g00MusicSpeech->setText(QString((m_bfmDemod->getRDSParser().m_g0_music_speech ? "Music" : "Speech")));
|
|
|
|
ui->g00MonoStereo->setText(QString((m_bfmDemod->getRDSParser().m_g0_mono_stereo ? "Mono" : "Stereo")));
|
2015-12-13 19:36:13 -05:00
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g0_af_updated)
|
2015-12-13 19:36:13 -05:00
|
|
|
{
|
2015-12-15 02:54:13 -05:00
|
|
|
ui->g00AltFrequenciesBox->clear();
|
2015-12-13 19:36:13 -05:00
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
for (std::set<double>::iterator it = m_bfmDemod->getRDSParser().m_g0_alt_freq.begin(); it != m_bfmDemod->getRDSParser().m_g0_alt_freq.end(); ++it)
|
2015-12-13 19:36:13 -05:00
|
|
|
{
|
|
|
|
if (*it > 76.0)
|
|
|
|
{
|
2015-12-15 02:54:13 -05:00
|
|
|
std::ostringstream os;
|
|
|
|
os << std::fixed << std::showpoint << std::setprecision(2) << *it;
|
|
|
|
ui->g00AltFrequenciesBox->addItem(QString(os.str().c_str()));
|
2015-12-13 19:36:13 -05:00
|
|
|
}
|
|
|
|
}
|
2015-12-15 22:12:49 -05:00
|
|
|
|
|
|
|
ui->g00AltFrequenciesBox->setEnabled(ui->g00AltFrequenciesBox->count() > 0);
|
2015-12-13 19:36:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->g00Label->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
2015-12-14 20:55:12 -05:00
|
|
|
// G1 group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g1_updated || force)
|
2015-12-14 20:55:12 -05:00
|
|
|
{
|
|
|
|
ui->g01Label->setStyleSheet("QLabel { background-color : green; }");
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g01CountText->setNum((int) m_bfmDemod->getRDSParser().m_g1_count);
|
2015-12-14 20:55:12 -05:00
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
if ((m_bfmDemod->getRDSParser().m_g1_country_page_index >= 0) && (m_bfmDemod->getRDSParser().m_g1_country_index >= 0)) {
|
|
|
|
ui->g01CountryCode->setText(QString((m_bfmDemod->getRDSParser().pi_country_codes[m_bfmDemod->getRDSParser().m_g1_country_page_index][m_bfmDemod->getRDSParser().m_g1_country_index]).c_str()));
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g1_language_index >= 0) {
|
|
|
|
ui->g01Language->setText(QString(m_bfmDemod->getRDSParser().language_codes[m_bfmDemod->getRDSParser().m_g1_language_index].c_str()));
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g01DHM->setText(QString(str(boost::format("%id:%i:%i") % m_bfmDemod->getRDSParser().m_g1_pin_day % m_bfmDemod->getRDSParser().m_g1_pin_hour % m_bfmDemod->getRDSParser().m_g1_pin_minute).c_str()));
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->g01Label->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
|
|
|
// G2 group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g2_updated || force)
|
2015-12-14 20:55:12 -05:00
|
|
|
{
|
|
|
|
ui->g02Label->setStyleSheet("QLabel { background-color : green; }");
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g02CountText->setNum((int) m_bfmDemod->getRDSParser().m_g2_count);
|
|
|
|
ui->go2Text->setText(QString(m_bfmDemod->getRDSParser().m_g2_radiotext));
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->g02Label->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
|
|
|
// G3 group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g3_updated || force)
|
2015-12-14 20:55:12 -05:00
|
|
|
{
|
2015-12-15 23:16:27 -05:00
|
|
|
ui->g03Label->setStyleSheet("QLabel { background-color : green; }");
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g03CountText->setNum((int) m_bfmDemod->getRDSParser().m_g3_count);
|
|
|
|
std::string g3str = str(boost::format("%02X%c %04X %04X") % m_bfmDemod->getRDSParser().m_g3_appGroup % (m_bfmDemod->getRDSParser().m_g3_groupB ? 'B' : 'A') % m_bfmDemod->getRDSParser().m_g3_message % m_bfmDemod->getRDSParser().m_g3_aid);
|
2015-12-15 23:16:27 -05:00
|
|
|
ui->g03Data->setText(QString(g3str.c_str()));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->g03Label->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
|
2015-12-14 03:01:37 -05:00
|
|
|
// G4 group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g4_updated || force)
|
2015-12-14 03:01:37 -05:00
|
|
|
{
|
|
|
|
ui->g04Label->setStyleSheet("QLabel { background-color : green; }");
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g04CountText->setNum((int) m_bfmDemod->getRDSParser().m_g4_count);
|
2018-05-11 05:35:10 -04:00
|
|
|
std::string time = str(boost::format("%4i-%02i-%02i %02i:%02i (%+.1fh)")\
|
|
|
|
% (1900 + m_bfmDemod->getRDSParser().m_g4_year) % m_bfmDemod->getRDSParser().m_g4_month % m_bfmDemod->getRDSParser().m_g4_day % m_bfmDemod->getRDSParser().m_g4_hours % m_bfmDemod->getRDSParser().m_g4_minutes % m_bfmDemod->getRDSParser().m_g4_local_time_offset);
|
2015-12-14 03:01:37 -05:00
|
|
|
ui->g04Time->setText(QString(time.c_str()));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->g04Label->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
2015-12-13 19:36:13 -05:00
|
|
|
|
2015-12-14 20:55:12 -05:00
|
|
|
// G5 group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g5_updated || force)
|
2015-12-14 20:55:12 -05:00
|
|
|
{
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g05CountText->setNum((int) m_bfmDemod->getRDSParser().m_g5_count);
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// G6 group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g6_updated || force)
|
2015-12-14 20:55:12 -05:00
|
|
|
{
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g06CountText->setNum((int) m_bfmDemod->getRDSParser().m_g6_count);
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// G7 group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g7_updated || force)
|
2015-12-14 20:55:12 -05:00
|
|
|
{
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g07CountText->setNum((int) m_bfmDemod->getRDSParser().m_g7_count);
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// G8 group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g8_updated || force)
|
2015-12-14 20:55:12 -05:00
|
|
|
{
|
|
|
|
ui->g08Label->setStyleSheet("QLabel { background-color : green; }");
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g08CountText->setNum((int) m_bfmDemod->getRDSParser().m_g8_count);
|
2015-12-14 20:55:12 -05:00
|
|
|
|
|
|
|
std::ostringstream os;
|
2017-10-01 05:50:16 -04:00
|
|
|
os << (m_bfmDemod->getRDSParser().m_g8_sign ? "-" : "+") << m_bfmDemod->getRDSParser().m_g8_extent + 1;
|
2015-12-14 20:55:12 -05:00
|
|
|
ui->g08Extent->setText(QString(os.str().c_str()));
|
2017-10-01 05:50:16 -04:00
|
|
|
int event_line = RDSTMC::get_tmc_event_code_index(m_bfmDemod->getRDSParser().m_g8_event, 1);
|
2015-12-14 20:55:12 -05:00
|
|
|
ui->g08TMCEvent->setText(QString(RDSTMC::get_tmc_events(event_line, 1).c_str()));
|
2017-10-01 05:50:16 -04:00
|
|
|
QString pistring(str(boost::format("%04X") % m_bfmDemod->getRDSParser().m_g8_location).c_str());
|
2015-12-15 02:54:13 -05:00
|
|
|
ui->g08Location->setText(pistring);
|
2015-12-14 20:55:12 -05:00
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g8_label_index >= 0) {
|
|
|
|
ui->g08Description->setText(QString(m_bfmDemod->getRDSParser().label_descriptions[m_bfmDemod->getRDSParser().m_g8_label_index].c_str()));
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g08Content->setNum(m_bfmDemod->getRDSParser().m_g8_content);
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->g08Label->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
|
|
|
// G9 group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g9_updated || force)
|
2015-12-14 20:55:12 -05:00
|
|
|
{
|
2015-12-15 22:43:29 -05:00
|
|
|
ui->g09Label->setStyleSheet("QLabel { background-color : green; }");
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g09CountText->setNum((int) m_bfmDemod->getRDSParser().m_g9_count);
|
|
|
|
std::string g9str = str(boost::format("%02X %04X %04X %02X %04X") % m_bfmDemod->getRDSParser().m_g9_varA % m_bfmDemod->getRDSParser().m_g9_cA % m_bfmDemod->getRDSParser().m_g9_dA % m_bfmDemod->getRDSParser().m_g9_varB % m_bfmDemod->getRDSParser().m_g9_dB);
|
2015-12-15 22:43:29 -05:00
|
|
|
ui->g09Data->setText(QString(g9str.c_str()));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->g09Label->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// G14 group
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g14_updated || force)
|
2015-12-14 20:55:12 -05:00
|
|
|
{
|
2017-10-01 05:50:16 -04:00
|
|
|
ui->g14CountText->setNum((int) m_bfmDemod->getRDSParser().m_g14_count);
|
2015-12-15 21:12:38 -05:00
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
if (m_bfmDemod->getRDSParser().m_g14_data_available)
|
2015-12-15 21:12:38 -05:00
|
|
|
{
|
|
|
|
ui->g14Label->setStyleSheet("QLabel { background-color : green; }");
|
|
|
|
m_g14ComboIndex.clear();
|
|
|
|
ui->g14ProgServiceNames->clear();
|
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
RDSParser::psns_map_t::iterator it = m_bfmDemod->getRDSParser().m_g14_program_service_names.begin();
|
|
|
|
const RDSParser::psns_map_t::iterator itEnd = m_bfmDemod->getRDSParser().m_g14_program_service_names.end();
|
2015-12-15 21:12:38 -05:00
|
|
|
int i = 0;
|
|
|
|
|
2016-11-21 12:01:55 -05:00
|
|
|
for (; it != itEnd; ++it, i++)
|
2015-12-15 21:12:38 -05:00
|
|
|
{
|
|
|
|
m_g14ComboIndex.push_back(it->first);
|
|
|
|
QString pistring(str(boost::format("%04X:%s") % it->first % it->second).c_str());
|
|
|
|
ui->g14ProgServiceNames->addItem(pistring);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->g14Label->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
2015-12-14 20:55:12 -05:00
|
|
|
}
|
|
|
|
|
2017-10-01 05:50:16 -04:00
|
|
|
m_bfmDemod->getRDSParser().clearUpdateFlags();
|
2015-12-13 19:36:13 -05:00
|
|
|
}
|
2015-12-15 22:12:49 -05:00
|
|
|
|
|
|
|
void BFMDemodGUI::changeFrequency(qint64 f)
|
|
|
|
{
|
|
|
|
qint64 df = m_channelMarker.getCenterFrequency();
|
|
|
|
qDebug() << "BFMDemodGUI::changeFrequency: " << f - df;
|
|
|
|
}
|