1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-04 16:01:14 -05:00

BFM demod: moved RDS parser in the demod

This commit is contained in:
f4exb 2017-10-01 11:50:16 +02:00
parent b11cf719d6
commit a9d1b2ef65
4 changed files with 94 additions and 94 deletions

View File

@ -35,12 +35,12 @@ MESSAGE_CLASS_DEFINITION(BFMDemod::MsgConfigureBFMDemod, Message)
const Real BFMDemod::default_deemphasis = 50.0; // 50 us const Real BFMDemod::default_deemphasis = 50.0; // 50 us
const int BFMDemod::m_udpBlockSize = 512; const int BFMDemod::m_udpBlockSize = 512;
BFMDemod::BFMDemod(BasebandSampleSink* sampleSink, RDSParser *rdsParser) : BFMDemod::BFMDemod(DeviceSourceAPI *deviceAPI, BasebandSampleSink* sampleSink) :
m_deviceAPI(deviceAPI),
m_sampleSink(sampleSink), m_sampleSink(sampleSink),
m_audioFifo(250000), m_audioFifo(250000),
m_settingsMutex(QMutex::Recursive), m_settingsMutex(QMutex::Recursive),
m_pilotPLL(19000/384000, 50/384000, 0.01), m_pilotPLL(19000/384000, 50/384000, 0.01),
m_rdsParser(rdsParser),
m_deemphasisFilterX(default_deemphasis * 48000 * 1.0e-6), m_deemphasisFilterX(default_deemphasis * 48000 * 1.0e-6),
m_deemphasisFilterY(default_deemphasis * 48000 * 1.0e-6), m_deemphasisFilterY(default_deemphasis * 48000 * 1.0e-6),
m_fmExcursion(default_excursion) m_fmExcursion(default_excursion)
@ -182,10 +182,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
{ {
if (m_rdsDecoder.frameSync(bit)) if (m_rdsDecoder.frameSync(bit))
{ {
if (m_rdsParser) m_rdsParser.parseGroup(m_rdsDecoder.getGroup());
{
m_rdsParser->parseGroup(m_rdsDecoder.getGroup());
}
} }
} }

View File

@ -33,14 +33,15 @@
#include "util/message.h" #include "util/message.h"
#include "util/udpsink.h" #include "util/udpsink.h"
#include "rdsparser.h"
#include "rdsdecoder.h" #include "rdsdecoder.h"
#include "rdsdemod.h" #include "rdsdemod.h"
class RDSParser; class DeviceSourceAPI;
class BFMDemod : public BasebandSampleSink { class BFMDemod : public BasebandSampleSink {
public: public:
BFMDemod(BasebandSampleSink* sampleSink, RDSParser* rdsParser); BFMDemod(DeviceSourceAPI *deviceAPI, BasebandSampleSink* sampleSink);
virtual ~BFMDemod(); virtual ~BFMDemod();
void configure(MessageQueue* messageQueue, void configure(MessageQueue* messageQueue,
@ -85,6 +86,8 @@ public:
m_magsqCount = 0; m_magsqCount = 0;
} }
RDSParser& getRDSParser() { return m_rdsParser; }
private: private:
class MsgConfigureBFMDemod : public Message { class MsgConfigureBFMDemod : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
@ -214,6 +217,8 @@ private:
Config m_config; Config m_config;
Config m_running; Config m_running;
DeviceSourceAPI *m_deviceAPI;
NCO m_nco; NCO m_nco;
Interpolator m_interpolator; //!< Interpolator between fixed demod bandwidth and audio bandwidth (rational) Interpolator m_interpolator; //!< Interpolator between fixed demod bandwidth and audio bandwidth (rational)
Real m_interpolatorDistance; Real m_interpolatorDistance;
@ -254,7 +259,7 @@ private:
RDSDemod m_rdsDemod; RDSDemod m_rdsDemod;
RDSDecoder m_rdsDecoder; RDSDecoder m_rdsDecoder;
RDSParser *m_rdsParser; RDSParser m_rdsParser;
LowPassFilterRC m_deemphasisFilterX; LowPassFilterRC m_deemphasisFilterX;
LowPassFilterRC m_deemphasisFilterY; LowPassFilterRC m_deemphasisFilterY;

View File

@ -277,7 +277,7 @@ void BFMDemodGUI::on_clearData_clicked(bool checked __attribute__((unused)))
{ {
if (ui->rds->isChecked()) if (ui->rds->isChecked())
{ {
m_rdsParser.clearAllFields(); m_bfmDemod->getRDSParser().clearAllFields();
ui->g14ProgServiceNames->clear(); ui->g14ProgServiceNames->clear();
ui->g14MappedFrequencies->clear(); ui->g14MappedFrequencies->clear();
@ -298,9 +298,9 @@ void BFMDemodGUI::on_g14ProgServiceNames_currentIndexChanged(int _index)
if (index < m_g14ComboIndex.size()) if (index < m_g14ComboIndex.size())
{ {
unsigned int piKey = m_g14ComboIndex[index]; unsigned int piKey = m_g14ComboIndex[index];
RDSParser::freqs_map_t::const_iterator mIt = m_rdsParser.m_g14_mapped_freqs.find(piKey); RDSParser::freqs_map_t::const_iterator mIt = m_bfmDemod->getRDSParser().m_g14_mapped_freqs.find(piKey);
if (mIt != m_rdsParser.m_g14_mapped_freqs.end()) if (mIt != m_bfmDemod->getRDSParser().m_g14_mapped_freqs.end())
{ {
ui->g14MappedFrequencies->clear(); ui->g14MappedFrequencies->clear();
RDSParser::freqs_set_t::iterator sIt = (mIt->second).begin(); RDSParser::freqs_set_t::iterator sIt = (mIt->second).begin();
@ -316,9 +316,9 @@ void BFMDemodGUI::on_g14ProgServiceNames_currentIndexChanged(int _index)
ui->g14MappedFrequencies->setEnabled(ui->g14MappedFrequencies->count() > 0); ui->g14MappedFrequencies->setEnabled(ui->g14MappedFrequencies->count() > 0);
} }
mIt = m_rdsParser.m_g14_alt_freqs.find(piKey); mIt = m_bfmDemod->getRDSParser().m_g14_alt_freqs.find(piKey);
if (mIt != m_rdsParser.m_g14_alt_freqs.end()) if (mIt != m_bfmDemod->getRDSParser().m_g14_alt_freqs.end())
{ {
ui->g14AltFrequencies->clear(); ui->g14AltFrequencies->clear();
RDSParser::freqs_set_t::iterator sIt = (mIt->second).begin(); RDSParser::freqs_set_t::iterator sIt = (mIt->second).begin();
@ -387,7 +387,7 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &))); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
m_spectrumVis = new SpectrumVis(ui->glSpectrum); m_spectrumVis = new SpectrumVis(ui->glSpectrum);
m_bfmDemod = new BFMDemod(m_spectrumVis, &m_rdsParser); m_bfmDemod = new BFMDemod(m_deviceAPI, m_spectrumVis);
m_channelizer = new DownChannelizer(m_bfmDemod); m_channelizer = new DownChannelizer(m_bfmDemod);
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this); m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged())); connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged()));
@ -550,29 +550,29 @@ void BFMDemodGUI::channelSampleRateChanged()
void BFMDemodGUI::rdsUpdateFixedFields() void BFMDemodGUI::rdsUpdateFixedFields()
{ {
ui->g00Label->setText(m_rdsParser.rds_group_acronym_tags[0].c_str()); ui->g00Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[0].c_str());
ui->g01Label->setText(m_rdsParser.rds_group_acronym_tags[1].c_str()); ui->g01Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[1].c_str());
ui->g02Label->setText(m_rdsParser.rds_group_acronym_tags[2].c_str()); ui->g02Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[2].c_str());
ui->g03Label->setText(m_rdsParser.rds_group_acronym_tags[3].c_str()); ui->g03Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[3].c_str());
ui->g04Label->setText(m_rdsParser.rds_group_acronym_tags[4].c_str()); ui->g04Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[4].c_str());
//ui->g05Label->setText(m_rdsParser.rds_group_acronym_tags[5].c_str()); //ui->g05Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[5].c_str());
//ui->g06Label->setText(m_rdsParser.rds_group_acronym_tags[6].c_str()); //ui->g06Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[6].c_str());
//ui->g07Label->setText(m_rdsParser.rds_group_acronym_tags[7].c_str()); //ui->g07Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[7].c_str());
ui->g08Label->setText(m_rdsParser.rds_group_acronym_tags[8].c_str()); ui->g08Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[8].c_str());
ui->g09Label->setText(m_rdsParser.rds_group_acronym_tags[9].c_str()); ui->g09Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[9].c_str());
ui->g14Label->setText(m_rdsParser.rds_group_acronym_tags[14].c_str()); ui->g14Label->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[14].c_str());
ui->g00CountLabel->setText(m_rdsParser.rds_group_acronym_tags[0].c_str()); ui->g00CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[0].c_str());
ui->g01CountLabel->setText(m_rdsParser.rds_group_acronym_tags[1].c_str()); ui->g01CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[1].c_str());
ui->g02CountLabel->setText(m_rdsParser.rds_group_acronym_tags[2].c_str()); ui->g02CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[2].c_str());
ui->g03CountLabel->setText(m_rdsParser.rds_group_acronym_tags[3].c_str()); ui->g03CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[3].c_str());
ui->g04CountLabel->setText(m_rdsParser.rds_group_acronym_tags[4].c_str()); ui->g04CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[4].c_str());
ui->g05CountLabel->setText(m_rdsParser.rds_group_acronym_tags[5].c_str()); ui->g05CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[5].c_str());
ui->g06CountLabel->setText(m_rdsParser.rds_group_acronym_tags[6].c_str()); ui->g06CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[6].c_str());
ui->g07CountLabel->setText(m_rdsParser.rds_group_acronym_tags[7].c_str()); ui->g07CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[7].c_str());
ui->g08CountLabel->setText(m_rdsParser.rds_group_acronym_tags[8].c_str()); ui->g08CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[8].c_str());
ui->g09CountLabel->setText(m_rdsParser.rds_group_acronym_tags[9].c_str()); ui->g09CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[9].c_str());
ui->g14CountLabel->setText(m_rdsParser.rds_group_acronym_tags[14].c_str()); ui->g14CountLabel->setText(m_bfmDemod->getRDSParser().rds_group_acronym_tags[14].c_str());
} }
void BFMDemodGUI::rdsUpdate(bool force) void BFMDemodGUI::rdsUpdate(bool force)
@ -591,21 +591,21 @@ void BFMDemodGUI::rdsUpdate(bool force)
} }
// PI group // PI group
if (m_rdsParser.m_pi_updated || force) if (m_bfmDemod->getRDSParser().m_pi_updated || force)
{ {
ui->piLabel->setStyleSheet("QLabel { background-color : green; }"); ui->piLabel->setStyleSheet("QLabel { background-color : green; }");
ui->piCountText->setNum((int) m_rdsParser.m_pi_count); ui->piCountText->setNum((int) m_bfmDemod->getRDSParser().m_pi_count);
QString pistring(str(boost::format("%04X") % m_rdsParser.m_pi_program_identification).c_str()); QString pistring(str(boost::format("%04X") % m_bfmDemod->getRDSParser().m_pi_program_identification).c_str());
ui->piText->setText(pistring); ui->piText->setText(pistring);
if (m_rdsParser.m_pi_traffic_program) { if (m_bfmDemod->getRDSParser().m_pi_traffic_program) {
ui->piTPIndicator->setStyleSheet("QLabel { background-color : green; }"); ui->piTPIndicator->setStyleSheet("QLabel { background-color : green; }");
} else { } else {
ui->piTPIndicator->setStyleSheet("QLabel { background:rgb(79,79,79); }"); ui->piTPIndicator->setStyleSheet("QLabel { background:rgb(79,79,79); }");
} }
ui->piType->setText(QString(m_rdsParser.pty_table[m_rdsParser.m_pi_program_type].c_str())); ui->piType->setText(QString(m_bfmDemod->getRDSParser().pty_table[m_bfmDemod->getRDSParser().m_pi_program_type].c_str()));
ui->piCoverage->setText(QString(m_rdsParser.coverage_area_codes[m_rdsParser.m_pi_area_coverage_index].c_str())); ui->piCoverage->setText(QString(m_bfmDemod->getRDSParser().coverage_area_codes[m_bfmDemod->getRDSParser().m_pi_area_coverage_index].c_str()));
} }
else else
{ {
@ -613,29 +613,29 @@ void BFMDemodGUI::rdsUpdate(bool force)
} }
// G0 group // G0 group
if (m_rdsParser.m_g0_updated || force) if (m_bfmDemod->getRDSParser().m_g0_updated || force)
{ {
ui->g00Label->setStyleSheet("QLabel { background-color : green; }"); ui->g00Label->setStyleSheet("QLabel { background-color : green; }");
ui->g00CountText->setNum((int) m_rdsParser.m_g0_count); ui->g00CountText->setNum((int) m_bfmDemod->getRDSParser().m_g0_count);
if (m_rdsParser.m_g0_psn_bitmap == 0b1111) { if (m_bfmDemod->getRDSParser().m_g0_psn_bitmap == 0b1111) {
ui->g00ProgServiceName->setText(QString(m_rdsParser.m_g0_program_service_name)); ui->g00ProgServiceName->setText(QString(m_bfmDemod->getRDSParser().m_g0_program_service_name));
} }
if (m_rdsParser.m_g0_traffic_announcement) { if (m_bfmDemod->getRDSParser().m_g0_traffic_announcement) {
ui->g00TrafficAnnouncement->setStyleSheet("QLabel { background-color : green; }"); ui->g00TrafficAnnouncement->setStyleSheet("QLabel { background-color : green; }");
} else { } else {
ui->g00TrafficAnnouncement->setStyleSheet("QLabel { background:rgb(79,79,79); }"); ui->g00TrafficAnnouncement->setStyleSheet("QLabel { background:rgb(79,79,79); }");
} }
ui->g00MusicSpeech->setText(QString((m_rdsParser.m_g0_music_speech ? "Music" : "Speech"))); ui->g00MusicSpeech->setText(QString((m_bfmDemod->getRDSParser().m_g0_music_speech ? "Music" : "Speech")));
ui->g00MonoStereo->setText(QString((m_rdsParser.m_g0_mono_stereo ? "Mono" : "Stereo"))); ui->g00MonoStereo->setText(QString((m_bfmDemod->getRDSParser().m_g0_mono_stereo ? "Mono" : "Stereo")));
if (m_rdsParser.m_g0_af_updated) if (m_bfmDemod->getRDSParser().m_g0_af_updated)
{ {
ui->g00AltFrequenciesBox->clear(); ui->g00AltFrequenciesBox->clear();
for (std::set<double>::iterator it = m_rdsParser.m_g0_alt_freq.begin(); it != m_rdsParser.m_g0_alt_freq.end(); ++it) for (std::set<double>::iterator it = m_bfmDemod->getRDSParser().m_g0_alt_freq.begin(); it != m_bfmDemod->getRDSParser().m_g0_alt_freq.end(); ++it)
{ {
if (*it > 76.0) if (*it > 76.0)
{ {
@ -654,20 +654,20 @@ void BFMDemodGUI::rdsUpdate(bool force)
} }
// G1 group // G1 group
if (m_rdsParser.m_g1_updated || force) if (m_bfmDemod->getRDSParser().m_g1_updated || force)
{ {
ui->g01Label->setStyleSheet("QLabel { background-color : green; }"); ui->g01Label->setStyleSheet("QLabel { background-color : green; }");
ui->g01CountText->setNum((int) m_rdsParser.m_g1_count); ui->g01CountText->setNum((int) m_bfmDemod->getRDSParser().m_g1_count);
if ((m_rdsParser.m_g1_country_page_index >= 0) && (m_rdsParser.m_g1_country_index >= 0)) { if ((m_bfmDemod->getRDSParser().m_g1_country_page_index >= 0) && (m_bfmDemod->getRDSParser().m_g1_country_index >= 0)) {
ui->g01CountryCode->setText(QString((m_rdsParser.pi_country_codes[m_rdsParser.m_g1_country_page_index][m_rdsParser.m_g1_country_index]).c_str())); 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()));
} }
if (m_rdsParser.m_g1_language_index >= 0) { if (m_bfmDemod->getRDSParser().m_g1_language_index >= 0) {
ui->g01Language->setText(QString(m_rdsParser.language_codes[m_rdsParser.m_g1_language_index].c_str())); ui->g01Language->setText(QString(m_bfmDemod->getRDSParser().language_codes[m_bfmDemod->getRDSParser().m_g1_language_index].c_str()));
} }
ui->g01DHM->setText(QString(str(boost::format("%id:%i:%i") % m_rdsParser.m_g1_pin_day % m_rdsParser.m_g1_pin_hour % m_rdsParser.m_g1_pin_minute).c_str())); 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()));
} }
else else
{ {
@ -675,11 +675,11 @@ void BFMDemodGUI::rdsUpdate(bool force)
} }
// G2 group // G2 group
if (m_rdsParser.m_g2_updated || force) if (m_bfmDemod->getRDSParser().m_g2_updated || force)
{ {
ui->g02Label->setStyleSheet("QLabel { background-color : green; }"); ui->g02Label->setStyleSheet("QLabel { background-color : green; }");
ui->g02CountText->setNum((int) m_rdsParser.m_g2_count); ui->g02CountText->setNum((int) m_bfmDemod->getRDSParser().m_g2_count);
ui->go2Text->setText(QString(m_rdsParser.m_g2_radiotext)); ui->go2Text->setText(QString(m_bfmDemod->getRDSParser().m_g2_radiotext));
} }
else else
{ {
@ -687,11 +687,11 @@ void BFMDemodGUI::rdsUpdate(bool force)
} }
// G3 group // G3 group
if (m_rdsParser.m_g3_updated || force) if (m_bfmDemod->getRDSParser().m_g3_updated || force)
{ {
ui->g03Label->setStyleSheet("QLabel { background-color : green; }"); ui->g03Label->setStyleSheet("QLabel { background-color : green; }");
ui->g03CountText->setNum((int) m_rdsParser.m_g3_count); ui->g03CountText->setNum((int) m_bfmDemod->getRDSParser().m_g3_count);
std::string g3str = str(boost::format("%02X%c %04X %04X") % m_rdsParser.m_g3_appGroup % (m_rdsParser.m_g3_groupB ? 'B' : 'A') % m_rdsParser.m_g3_message % m_rdsParser.m_g3_aid); 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);
ui->g03Data->setText(QString(g3str.c_str())); ui->g03Data->setText(QString(g3str.c_str()));
} }
else else
@ -700,12 +700,12 @@ void BFMDemodGUI::rdsUpdate(bool force)
} }
// G4 group // G4 group
if (m_rdsParser.m_g4_updated || force) if (m_bfmDemod->getRDSParser().m_g4_updated || force)
{ {
ui->g04Label->setStyleSheet("QLabel { background-color : green; }"); ui->g04Label->setStyleSheet("QLabel { background-color : green; }");
ui->g04CountText->setNum((int) m_rdsParser.m_g4_count); ui->g04CountText->setNum((int) m_bfmDemod->getRDSParser().m_g4_count);
std::string time = str(boost::format("%02i.%02i.%4i, %02i:%02i (%+.1fh)")\ std::string time = str(boost::format("%02i.%02i.%4i, %02i:%02i (%+.1fh)")\
% m_rdsParser.m_g4_day % m_rdsParser.m_g4_month % (1900 + m_rdsParser.m_g4_year) % m_rdsParser.m_g4_hours % m_rdsParser.m_g4_minutes % m_rdsParser.m_g4_local_time_offset); % m_bfmDemod->getRDSParser().m_g4_day % m_bfmDemod->getRDSParser().m_g4_month % (1900 + m_bfmDemod->getRDSParser().m_g4_year) % m_bfmDemod->getRDSParser().m_g4_hours % m_bfmDemod->getRDSParser().m_g4_minutes % m_bfmDemod->getRDSParser().m_g4_local_time_offset);
ui->g04Time->setText(QString(time.c_str())); ui->g04Time->setText(QString(time.c_str()));
} }
else else
@ -714,42 +714,42 @@ void BFMDemodGUI::rdsUpdate(bool force)
} }
// G5 group // G5 group
if (m_rdsParser.m_g5_updated || force) if (m_bfmDemod->getRDSParser().m_g5_updated || force)
{ {
ui->g05CountText->setNum((int) m_rdsParser.m_g5_count); ui->g05CountText->setNum((int) m_bfmDemod->getRDSParser().m_g5_count);
} }
// G6 group // G6 group
if (m_rdsParser.m_g6_updated || force) if (m_bfmDemod->getRDSParser().m_g6_updated || force)
{ {
ui->g06CountText->setNum((int) m_rdsParser.m_g6_count); ui->g06CountText->setNum((int) m_bfmDemod->getRDSParser().m_g6_count);
} }
// G7 group // G7 group
if (m_rdsParser.m_g7_updated || force) if (m_bfmDemod->getRDSParser().m_g7_updated || force)
{ {
ui->g07CountText->setNum((int) m_rdsParser.m_g7_count); ui->g07CountText->setNum((int) m_bfmDemod->getRDSParser().m_g7_count);
} }
// G8 group // G8 group
if (m_rdsParser.m_g8_updated || force) if (m_bfmDemod->getRDSParser().m_g8_updated || force)
{ {
ui->g08Label->setStyleSheet("QLabel { background-color : green; }"); ui->g08Label->setStyleSheet("QLabel { background-color : green; }");
ui->g08CountText->setNum((int) m_rdsParser.m_g8_count); ui->g08CountText->setNum((int) m_bfmDemod->getRDSParser().m_g8_count);
std::ostringstream os; std::ostringstream os;
os << (m_rdsParser.m_g8_sign ? "-" : "+") << m_rdsParser.m_g8_extent + 1; os << (m_bfmDemod->getRDSParser().m_g8_sign ? "-" : "+") << m_bfmDemod->getRDSParser().m_g8_extent + 1;
ui->g08Extent->setText(QString(os.str().c_str())); ui->g08Extent->setText(QString(os.str().c_str()));
int event_line = RDSTMC::get_tmc_event_code_index(m_rdsParser.m_g8_event, 1); int event_line = RDSTMC::get_tmc_event_code_index(m_bfmDemod->getRDSParser().m_g8_event, 1);
ui->g08TMCEvent->setText(QString(RDSTMC::get_tmc_events(event_line, 1).c_str())); ui->g08TMCEvent->setText(QString(RDSTMC::get_tmc_events(event_line, 1).c_str()));
QString pistring(str(boost::format("%04X") % m_rdsParser.m_g8_location).c_str()); QString pistring(str(boost::format("%04X") % m_bfmDemod->getRDSParser().m_g8_location).c_str());
ui->g08Location->setText(pistring); ui->g08Location->setText(pistring);
if (m_rdsParser.m_g8_label_index >= 0) { if (m_bfmDemod->getRDSParser().m_g8_label_index >= 0) {
ui->g08Description->setText(QString(m_rdsParser.label_descriptions[m_rdsParser.m_g8_label_index].c_str())); ui->g08Description->setText(QString(m_bfmDemod->getRDSParser().label_descriptions[m_bfmDemod->getRDSParser().m_g8_label_index].c_str()));
} }
ui->g08Content->setNum(m_rdsParser.m_g8_content); ui->g08Content->setNum(m_bfmDemod->getRDSParser().m_g8_content);
} }
else else
{ {
@ -757,11 +757,11 @@ void BFMDemodGUI::rdsUpdate(bool force)
} }
// G9 group // G9 group
if (m_rdsParser.m_g9_updated || force) if (m_bfmDemod->getRDSParser().m_g9_updated || force)
{ {
ui->g09Label->setStyleSheet("QLabel { background-color : green; }"); ui->g09Label->setStyleSheet("QLabel { background-color : green; }");
ui->g09CountText->setNum((int) m_rdsParser.m_g9_count); ui->g09CountText->setNum((int) m_bfmDemod->getRDSParser().m_g9_count);
std::string g9str = str(boost::format("%02X %04X %04X %02X %04X") % m_rdsParser.m_g9_varA % m_rdsParser.m_g9_cA % m_rdsParser.m_g9_dA % m_rdsParser.m_g9_varB % m_rdsParser.m_g9_dB); 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);
ui->g09Data->setText(QString(g9str.c_str())); ui->g09Data->setText(QString(g9str.c_str()));
} }
else else
@ -770,18 +770,18 @@ void BFMDemodGUI::rdsUpdate(bool force)
} }
// G14 group // G14 group
if (m_rdsParser.m_g14_updated || force) if (m_bfmDemod->getRDSParser().m_g14_updated || force)
{ {
ui->g14CountText->setNum((int) m_rdsParser.m_g14_count); ui->g14CountText->setNum((int) m_bfmDemod->getRDSParser().m_g14_count);
if (m_rdsParser.m_g14_data_available) if (m_bfmDemod->getRDSParser().m_g14_data_available)
{ {
ui->g14Label->setStyleSheet("QLabel { background-color : green; }"); ui->g14Label->setStyleSheet("QLabel { background-color : green; }");
m_g14ComboIndex.clear(); m_g14ComboIndex.clear();
ui->g14ProgServiceNames->clear(); ui->g14ProgServiceNames->clear();
RDSParser::psns_map_t::iterator it = m_rdsParser.m_g14_program_service_names.begin(); RDSParser::psns_map_t::iterator it = m_bfmDemod->getRDSParser().m_g14_program_service_names.begin();
const RDSParser::psns_map_t::iterator itEnd = m_rdsParser.m_g14_program_service_names.end(); const RDSParser::psns_map_t::iterator itEnd = m_bfmDemod->getRDSParser().m_g14_program_service_names.end();
int i = 0; int i = 0;
for (; it != itEnd; ++it, i++) for (; it != itEnd; ++it, i++)
@ -797,7 +797,7 @@ void BFMDemodGUI::rdsUpdate(bool force)
} }
} }
m_rdsParser.clearUpdateFlags(); m_bfmDemod->getRDSParser().clearUpdateFlags();
} }
void BFMDemodGUI::changeFrequency(qint64 f) void BFMDemodGUI::changeFrequency(qint64 f)

View File

@ -24,10 +24,9 @@
#include "dsp/movingaverage.h" #include "dsp/movingaverage.h"
#include "util/messagequeue.h" #include "util/messagequeue.h"
#include "rdsparser.h"
class PluginAPI; class PluginAPI;
class DeviceSourceAPI; class DeviceSourceAPI;
class RDSParser;
class ThreadedBasebandSampleSink; class ThreadedBasebandSampleSink;
class DownChannelizer; class DownChannelizer;
@ -91,7 +90,6 @@ private:
ThreadedBasebandSampleSink* m_threadedChannelizer; ThreadedBasebandSampleSink* m_threadedChannelizer;
DownChannelizer* m_channelizer; DownChannelizer* m_channelizer;
SpectrumVis* m_spectrumVis; SpectrumVis* m_spectrumVis;
RDSParser m_rdsParser;
BFMDemod* m_bfmDemod; BFMDemod* m_bfmDemod;
MovingAverage<double> m_channelPowerDbAvg; MovingAverage<double> m_channelPowerDbAvg;