mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 17:58:43 -05:00
BFM demod: RDS GUI part #8: group14 parsing into memebers implementation
This commit is contained in:
parent
4387136420
commit
9fe292f162
@ -256,6 +256,7 @@ void RDSParser::clearUpdateFlags()
|
|||||||
m_g12_updated = false;
|
m_g12_updated = false;
|
||||||
m_g13_updated = false;
|
m_g13_updated = false;
|
||||||
m_g14_updated = false;
|
m_g14_updated = false;
|
||||||
|
m_g14_data_available = false;
|
||||||
m_g15_updated = false;
|
m_g15_updated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,13 +322,25 @@ void RDSParser::clearAllFields()
|
|||||||
m_g8_label_index = -1;
|
m_g8_label_index = -1;
|
||||||
m_g8_content = 0;
|
m_g8_content = 0;
|
||||||
|
|
||||||
// Group 09..15 data
|
// Group 09..13 data
|
||||||
m_g9_count = 0;
|
m_g9_count = 0;
|
||||||
m_g10_count = 0;
|
m_g10_count = 0;
|
||||||
m_g11_count = 0;
|
m_g11_count = 0;
|
||||||
m_g12_count = 0;
|
m_g12_count = 0;
|
||||||
m_g13_count = 0;
|
m_g13_count = 0;
|
||||||
|
|
||||||
|
// Group 14
|
||||||
m_g14_count = 0;
|
m_g14_count = 0;
|
||||||
|
m_g14_program_service_names.clear();
|
||||||
|
m_g14_alt_freqs.clear();
|
||||||
|
m_g14_mapped_freqs.clear();
|
||||||
|
std::memset(m_g14_program_service_name, ' ', sizeof(m_g14_program_service_name));
|
||||||
|
m_g14_alt_freq_set.clear();
|
||||||
|
m_g14_mapped_freq_set.clear();
|
||||||
|
m_g14_psn_updated = false;
|
||||||
|
m_g14_data_available = false;
|
||||||
|
|
||||||
|
// Group 15
|
||||||
m_g15_count = 0;
|
m_g15_count = 0;
|
||||||
|
|
||||||
clearUpdateFlags();
|
clearUpdateFlags();
|
||||||
@ -952,15 +965,18 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
|||||||
case 2: // PS(ON)
|
case 2: // PS(ON)
|
||||||
case 3: // PS(ON)
|
case 3: // PS(ON)
|
||||||
{
|
{
|
||||||
ps_on[variant_code * 2 ] = (information >> 8) & 0xff;
|
m_g14_program_service_name[variant_code * 2 ] = (information >> 8) & 0xff;
|
||||||
ps_on[variant_code * 2 + 1] = information & 0xff;
|
m_g14_program_service_name[variant_code * 2 + 1] = information & 0xff;
|
||||||
qDebug() << "RDSParser::decode_type14: PS(ON): \"" << std::string(ps_on, 8).c_str() << "\"";
|
m_g14_psn_updated = true;
|
||||||
|
qDebug() << "RDSParser::decode_type14: PS(ON): \"" << std::string(m_g14_program_service_name, 8).c_str() << "\"";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: // AF
|
case 4: // AF
|
||||||
{
|
{
|
||||||
af_1 = 100.0 * (((information >> 8) & 0xff) + 875);
|
af_1 = 100.0 * (((information >> 8) & 0xff) + 875);
|
||||||
af_2 = 100.0 * ((information & 0xff) + 875);
|
af_2 = 100.0 * ((information & 0xff) + 875);
|
||||||
|
m_g14_alt_freq_set.insert(af_1/1000.0);
|
||||||
|
m_g14_alt_freq_set.insert(af_2/1000.0);
|
||||||
std::string s = str(boost::format("AF:%3.2fMHz %3.2fMHz") % (af_1/1000) % (af_2/1000));
|
std::string s = str(boost::format("AF:%3.2fMHz %3.2fMHz") % (af_1/1000) % (af_2/1000));
|
||||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
||||||
break;
|
break;
|
||||||
@ -972,6 +988,7 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
|||||||
{
|
{
|
||||||
af_1 = 100.0 * (((information >> 8) & 0xff) + 875);
|
af_1 = 100.0 * (((information >> 8) & 0xff) + 875);
|
||||||
af_2 = 100.0 * ((information & 0xff) + 875);
|
af_2 = 100.0 * ((information & 0xff) + 875);
|
||||||
|
m_g14_mapped_freq_set.insert(af_2/1000.0);
|
||||||
std::string s = str(boost::format("TN:%3.2fMHz - ON:%3.2fMHz") % (af_1/1000) % (af_2/1000));
|
std::string s = str(boost::format("TN:%3.2fMHz - ON:%3.2fMHz") % (af_1/1000) % (af_2/1000));
|
||||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
||||||
break;
|
break;
|
||||||
@ -980,6 +997,7 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
|||||||
{
|
{
|
||||||
af_1 = 100.0 * (((information >> 8) & 0xff) + 875);
|
af_1 = 100.0 * (((information >> 8) & 0xff) + 875);
|
||||||
af_2 = 9.0 * ((information & 0xff) - 16) + 531;
|
af_2 = 9.0 * ((information & 0xff) - 16) + 531;
|
||||||
|
m_g14_mapped_freq_set.insert(af_2/1000.0);
|
||||||
std::string s = str(boost::format("TN:%3.2fMHz - ON:%ikHz") % (af_1/1000) % int(af_2));
|
std::string s = str(boost::format("TN:%3.2fMHz - ON:%ikHz") % (af_1/1000) % int(af_2));
|
||||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
||||||
break;
|
break;
|
||||||
@ -990,6 +1008,28 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
|||||||
break;
|
break;
|
||||||
case 12: // linkage information
|
case 12: // linkage information
|
||||||
{
|
{
|
||||||
|
if (m_g14_psn_updated)
|
||||||
|
{
|
||||||
|
std::pair<psns_map_t::iterator, bool> ret = m_g14_program_service_names.insert(psns_map_kv_t(pi_on, std::string(m_g14_program_service_name)));
|
||||||
|
std::memset(m_g14_program_service_name, ' ', sizeof(m_g14_program_service_name));
|
||||||
|
m_g14_psn_updated = false;
|
||||||
|
m_g14_data_available = ret.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_g14_alt_freq_set.size() > 0)
|
||||||
|
{
|
||||||
|
std::pair<freqs_map_t::iterator, bool> ret = m_g14_alt_freqs.insert(freqs_map_kv_t(pi_on, m_g14_alt_freq_set));
|
||||||
|
m_g14_alt_freq_set.clear();
|
||||||
|
m_g14_data_available = ret.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_g14_mapped_freq_set.size() > 0)
|
||||||
|
{
|
||||||
|
std::pair<freqs_map_t::iterator, bool> ret = m_g14_mapped_freqs.insert(freqs_map_kv_t(pi_on, m_g14_mapped_freq_set));
|
||||||
|
m_g14_mapped_freq_set.clear();
|
||||||
|
m_g14_data_available = ret.second;
|
||||||
|
}
|
||||||
|
|
||||||
std::string s = str(boost::format("Linkage information: %x%x") % ((information >> 8) & 0xff) % (information & 0xff));
|
std::string s = str(boost::format("Linkage information: %x%x") % ((information >> 8) & 0xff) % (information & 0xff));
|
||||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
||||||
break;
|
break;
|
||||||
|
@ -20,10 +20,16 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
class RDSParser
|
class RDSParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef std::map<unsigned int, std::string> psns_map_t;
|
||||||
|
typedef std::pair<unsigned int, std::string> psns_map_kv_t;
|
||||||
|
typedef std::map<unsigned int, std::set<double> > freqs_map_t;
|
||||||
|
typedef std::pair<unsigned int, std::set<double> > freqs_map_kv_t;
|
||||||
|
|
||||||
RDSParser();
|
RDSParser();
|
||||||
~RDSParser();
|
~RDSParser();
|
||||||
|
|
||||||
@ -107,20 +113,32 @@ public:
|
|||||||
int m_g8_label_index; //!< negative if not received
|
int m_g8_label_index; //!< negative if not received
|
||||||
int m_g8_content;
|
int m_g8_content;
|
||||||
|
|
||||||
// G9..G15 data
|
// G9..G13 data
|
||||||
bool m_g9_updated;
|
bool m_g9_updated;
|
||||||
bool m_g10_updated;
|
bool m_g10_updated;
|
||||||
bool m_g11_updated;
|
bool m_g11_updated;
|
||||||
bool m_g12_updated;
|
bool m_g12_updated;
|
||||||
bool m_g13_updated;
|
bool m_g13_updated;
|
||||||
bool m_g14_updated;
|
|
||||||
bool m_g15_updated;
|
|
||||||
unsigned int m_g9_count;
|
unsigned int m_g9_count;
|
||||||
unsigned int m_g10_count;
|
unsigned int m_g10_count;
|
||||||
unsigned int m_g11_count;
|
unsigned int m_g11_count;
|
||||||
unsigned int m_g12_count;
|
unsigned int m_g12_count;
|
||||||
unsigned int m_g13_count;
|
unsigned int m_g13_count;
|
||||||
|
|
||||||
|
// G14 data
|
||||||
|
bool m_g14_updated;
|
||||||
unsigned int m_g14_count;
|
unsigned int m_g14_count;
|
||||||
|
psns_map_t m_g14_program_service_names; //!< key: PI, value: PSN
|
||||||
|
freqs_map_t m_g14_alt_freqs; //!< key: PI, value: set of alternate frequencies (MHz)
|
||||||
|
freqs_map_t m_g14_mapped_freqs; //!< key: PI, value: set of mapped frequencies (MHz)
|
||||||
|
char m_g14_program_service_name[8+1];
|
||||||
|
std::set<double> m_g14_alt_freq_set;
|
||||||
|
std::set<double> m_g14_mapped_freq_set;
|
||||||
|
bool m_g14_psn_updated;
|
||||||
|
bool m_g14_data_available;
|
||||||
|
|
||||||
|
// G15 data
|
||||||
|
bool m_g15_updated;
|
||||||
unsigned int m_g15_count;
|
unsigned int m_g15_count;
|
||||||
|
|
||||||
// Static tables
|
// Static tables
|
||||||
|
Loading…
Reference in New Issue
Block a user