From d034063978918cf72f912fe90445e47e6a1f8762 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 21 Dec 2015 02:35:57 +0100 Subject: [PATCH] BFM demod: RDS PSN update improvement --- plugins/channel/bfm/bfmdemodgui.cpp | 5 ++++- plugins/channel/bfm/rdsparser.cpp | 8 ++++++++ plugins/channel/bfm/rdsparser.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/channel/bfm/bfmdemodgui.cpp b/plugins/channel/bfm/bfmdemodgui.cpp index f019d11ed..e62464066 100644 --- a/plugins/channel/bfm/bfmdemodgui.cpp +++ b/plugins/channel/bfm/bfmdemodgui.cpp @@ -567,7 +567,10 @@ void BFMDemodGUI::rdsUpdate(bool force) { ui->g00Label->setStyleSheet("QLabel { background-color : green; }"); ui->g00CountText->setNum((int) m_rdsParser.m_g0_count); - ui->g00ProgServiceName->setText(QString(m_rdsParser.m_g0_program_service_name)); + + if (m_rdsParser.m_g0_psn_complete) { + ui->g00ProgServiceName->setText(QString(m_rdsParser.m_g0_program_service_name)); + } if (m_rdsParser.m_g0_traffic_announcement) { ui->g00TrafficAnnouncement->setStyleSheet("QLabel { background-color : green; }"); diff --git a/plugins/channel/bfm/rdsparser.cpp b/plugins/channel/bfm/rdsparser.cpp index 421a53633..28ff16489 100644 --- a/plugins/channel/bfm/rdsparser.cpp +++ b/plugins/channel/bfm/rdsparser.cpp @@ -273,6 +273,7 @@ void RDSParser::clearAllFields() m_g0_count = 0; 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_psn_complete = false; m_g0_traffic_announcement = false; m_g0_music_speech = false; m_g0_mono_stereo = false; @@ -473,8 +474,15 @@ void RDSParser::decode_type0(unsigned int *group, bool B) bool decoder_control_bit = (group[1] >> 2) & 0x01; // "DI" unsigned char segment_address = group[1] & 0x03; // "DI segment" + if (segment_address == 0) + { + 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[segment_address * 2] = (group[3] >> 8) & 0xff; m_g0_program_service_name[segment_address * 2 + 1] = group[3] & 0xff; + m_g0_psn_complete = (segment_address == 3); /* see page 41, table 9 of the standard */ switch (segment_address) diff --git a/plugins/channel/bfm/rdsparser.h b/plugins/channel/bfm/rdsparser.h index f7c498683..af52d6f4c 100644 --- a/plugins/channel/bfm/rdsparser.h +++ b/plugins/channel/bfm/rdsparser.h @@ -56,6 +56,7 @@ public: bool m_g0_af_updated; unsigned int m_g0_count; char m_g0_program_service_name[8+1]; + bool m_g0_psn_complete; bool m_g0_traffic_announcement; bool m_g0_music_speech; bool m_g0_mono_stereo;