1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

BFM demod: RDS: really improve PSN decoding and display

This commit is contained in:
f4exb 2015-12-23 04:27:25 +01:00
parent 00ae3babbd
commit b877907785
3 changed files with 7 additions and 6 deletions

View File

@ -568,7 +568,7 @@ void BFMDemodGUI::rdsUpdate(bool 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_rdsParser.m_g0_count);
if (m_rdsParser.m_g0_psn_complete) { if (m_rdsParser.m_g0_psn_bitmap == 0b1111) {
ui->g00ProgServiceName->setText(QString(m_rdsParser.m_g0_program_service_name)); ui->g00ProgServiceName->setText(QString(m_rdsParser.m_g0_program_service_name));
} }

View File

@ -273,7 +273,7 @@ void RDSParser::clearAllFields()
m_g0_count = 0; m_g0_count = 0;
std::memset(m_g0_program_service_name, ' ', sizeof(m_g0_program_service_name)); std::memset(m_g0_program_service_name, ' ', sizeof(m_g0_program_service_name));
m_g0_program_service_name[sizeof(m_g0_program_service_name) - 1] = '\0'; m_g0_program_service_name[sizeof(m_g0_program_service_name) - 1] = '\0';
m_g0_psn_complete = true; m_g0_psn_bitmap = 0;
m_g0_traffic_announcement = false; m_g0_traffic_announcement = false;
m_g0_music_speech = false; m_g0_music_speech = false;
m_g0_mono_stereo = false; m_g0_mono_stereo = false;
@ -478,11 +478,12 @@ void RDSParser::decode_type0(unsigned int *group, bool B)
{ {
std::memset(m_g0_program_service_name, ' ', sizeof(m_g0_program_service_name)); std::memset(m_g0_program_service_name, ' ', sizeof(m_g0_program_service_name));
m_g0_program_service_name[sizeof(m_g0_program_service_name) - 1] = '\0'; m_g0_program_service_name[sizeof(m_g0_program_service_name) - 1] = '\0';
m_g0_psn_bitmap = 0;
} }
m_g0_program_service_name[segment_address * 2] = (group[3] >> 8) & 0xff; m_g0_program_service_name[segment_address * 2] = (group[3] >> 8) & 0xff;
m_g0_program_service_name[segment_address * 2 + 1] = group[3] & 0xff; m_g0_program_service_name[segment_address * 2 + 1] = group[3] & 0xff;
m_g0_psn_complete = (segment_address == 3); m_g0_psn_bitmap |= 1<<segment_address;
/* see page 41, table 9 of the standard */ /* see page 41, table 9 of the standard */
switch (segment_address) switch (segment_address)
@ -1083,7 +1084,7 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
freqs_set_t::iterator sIt = m_g14_alt_freq_set.begin(); freqs_set_t::iterator sIt = m_g14_alt_freq_set.begin();
const freqs_set_t::iterator sItEnd = m_g14_alt_freq_set.end(); const freqs_set_t::iterator sItEnd = m_g14_alt_freq_set.end();
for (sIt; sIt != sItEnd; ++sIt) for (; sIt != sItEnd; ++sIt)
{ {
retSet = (mIt->second).insert(*sIt); retSet = (mIt->second).insert(*sIt);
updated |= retSet.second; updated |= retSet.second;
@ -1114,7 +1115,7 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
freqs_set_t::iterator sIt = m_g14_mapped_freq_set.begin(); freqs_set_t::iterator sIt = m_g14_mapped_freq_set.begin();
const freqs_set_t::iterator sItEnd = m_g14_mapped_freq_set.end(); const freqs_set_t::iterator sItEnd = m_g14_mapped_freq_set.end();
for (sIt; sIt != sItEnd; ++sIt) for (; sIt != sItEnd; ++sIt)
{ {
retSet = (mIt->second).insert(*sIt); retSet = (mIt->second).insert(*sIt);
updated |= retSet.second; updated |= retSet.second;

View File

@ -56,7 +56,7 @@ public:
bool m_g0_af_updated; bool m_g0_af_updated;
unsigned int m_g0_count; unsigned int m_g0_count;
char m_g0_program_service_name[8+1]; char m_g0_program_service_name[8+1];
bool m_g0_psn_complete; unsigned char m_g0_psn_bitmap;
bool m_g0_traffic_announcement; bool m_g0_traffic_announcement;
bool m_g0_music_speech; bool m_g0_music_speech;
bool m_g0_mono_stereo; bool m_g0_mono_stereo;