mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 17:58:43 -05:00
BFM demod: RDS GUI part #9: group14 full implementation. Separate clear RDS data button
This commit is contained in:
parent
9fe292f162
commit
044e0bfc27
@ -250,12 +250,60 @@ void BFMDemodGUI::on_showPilot_clicked()
|
||||
|
||||
void BFMDemodGUI::on_rds_clicked()
|
||||
{
|
||||
if (ui->rds->isChecked()) {
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void BFMDemodGUI::on_clearData_clicked(bool checked)
|
||||
{
|
||||
if (ui->rds->isChecked())
|
||||
{
|
||||
m_rdsParser.clearAllFields();
|
||||
|
||||
ui->g14ProgServiceNames->clear();
|
||||
ui->g14MappedFrequencies->clear();
|
||||
ui->g14AltFrequencies->clear();
|
||||
|
||||
rdsUpdate(true);
|
||||
}
|
||||
}
|
||||
|
||||
applySettings();
|
||||
void BFMDemodGUI::on_g14ProgServiceNames_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < m_g14ComboIndex.size())
|
||||
{
|
||||
unsigned int piKey = m_g14ComboIndex[index];
|
||||
RDSParser::freqs_map_t::const_iterator mIt = m_rdsParser.m_g14_mapped_freqs.find(piKey);
|
||||
|
||||
if (mIt != m_rdsParser.m_g14_mapped_freqs.end())
|
||||
{
|
||||
ui->g14MappedFrequencies->clear();
|
||||
RDSParser::freqs_set_t::iterator sIt = (mIt->second).begin();
|
||||
const RDSParser::freqs_set_t::iterator sItEnd = (mIt->second).end();
|
||||
|
||||
for (sIt; sIt != sItEnd; ++sIt)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << std::fixed << std::showpoint << std::setprecision(2) << *sIt;
|
||||
ui->g14MappedFrequencies->addItem(os.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
mIt = m_rdsParser.m_g14_alt_freqs.find(piKey);
|
||||
|
||||
if (mIt != m_rdsParser.m_g14_alt_freqs.end())
|
||||
{
|
||||
ui->g14AltFrequencies->clear();
|
||||
RDSParser::freqs_set_t::iterator sIt = (mIt->second).begin();
|
||||
const RDSParser::freqs_set_t::iterator sItEnd = (mIt->second).end();
|
||||
|
||||
for (sIt; sIt != sItEnd; ++sIt)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << std::fixed << std::showpoint << std::setprecision(2) << *sIt;
|
||||
ui->g14AltFrequencies->addItem(os.str().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||
@ -431,7 +479,7 @@ void BFMDemodGUI::rdsUpdateFixedFields()
|
||||
//ui->g07Label->setText(m_rdsParser.rds_group_acronym_tags[7].c_str());
|
||||
ui->g08Label->setText(m_rdsParser.rds_group_acronym_tags[8].c_str());
|
||||
//ui->g09Label->setText(m_rdsParser.rds_group_acronym_tags[9].c_str());
|
||||
//ui->g14Label->setText(m_rdsParser.rds_group_acronym_tags[14].c_str());
|
||||
ui->g14Label->setText(m_rdsParser.rds_group_acronym_tags[14].c_str());
|
||||
|
||||
ui->g00CountLabel->setText(m_rdsParser.rds_group_acronym_tags[0].c_str());
|
||||
ui->g01CountLabel->setText(m_rdsParser.rds_group_acronym_tags[1].c_str());
|
||||
@ -625,6 +673,28 @@ void BFMDemodGUI::rdsUpdate(bool force)
|
||||
if (m_rdsParser.m_g14_updated || force)
|
||||
{
|
||||
ui->g14CountText->setNum((int) m_rdsParser.m_g14_count);
|
||||
|
||||
if (m_rdsParser.m_g14_data_available)
|
||||
{
|
||||
ui->g14Label->setStyleSheet("QLabel { background-color : green; }");
|
||||
m_g14ComboIndex.clear();
|
||||
ui->g14ProgServiceNames->clear();
|
||||
|
||||
RDSParser::psns_map_t::iterator it = m_rdsParser.m_g14_program_service_names.begin();
|
||||
const RDSParser::psns_map_t::iterator itEnd = m_rdsParser.m_g14_program_service_names.end();
|
||||
int i = 0;
|
||||
|
||||
for (it; it != itEnd; ++it, i++)
|
||||
{
|
||||
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); }");
|
||||
}
|
||||
}
|
||||
|
||||
m_rdsParser.clearUpdateFlags();
|
||||
|
@ -65,6 +65,8 @@ private slots:
|
||||
void on_audioStereo_toggled(bool stereo);
|
||||
void on_showPilot_clicked();
|
||||
void on_rds_clicked();
|
||||
void on_g14ProgServiceNames_currentIndexChanged(int index);
|
||||
void on_clearData_clicked(bool checked);
|
||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||
void onMenuDoubleClicked();
|
||||
void tick();
|
||||
@ -85,6 +87,7 @@ private:
|
||||
BFMDemod* m_bfmDemod;
|
||||
MovingAverage<Real> m_channelPowerDbAvg;
|
||||
int m_rate;
|
||||
std::vector<unsigned int> m_g14ComboIndex;
|
||||
|
||||
static const int m_rfBW[];
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>676</width>
|
||||
<width>712</width>
|
||||
<height>729</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -436,7 +436,7 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>150</y>
|
||||
<width>561</width>
|
||||
<width>661</width>
|
||||
<height>301</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -665,6 +665,20 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearData">
|
||||
<property name="toolTip">
|
||||
<string>Clear RDS data</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/recycle.png</normaloff>:/recycle.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -1195,9 +1209,15 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="g00ProgServiceName">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -1280,7 +1300,7 @@
|
||||
<widget class="QComboBox" name="g00AltFrequenciesBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -1357,7 +1377,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="row3Sep1">
|
||||
<widget class="Line" name="row3Separator1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@ -1367,13 +1387,13 @@
|
||||
<widget class="QLabel" name="g04Time">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<width>160</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -1395,6 +1415,78 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="row3Separator2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="g14Label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>G14</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="row3Separator3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="g14ProgServiceNames">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Stations (PI and Program service names)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="g14MappedFrequencies">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Station mapped frequencies</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="g14AltFrequencies">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Station altermate freqiuencies</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -338,7 +338,6 @@ void RDSParser::clearAllFields()
|
||||
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;
|
||||
@ -968,7 +967,7 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
||||
m_g14_program_service_name[variant_code * 2 ] = (information >> 8) & 0xff;
|
||||
m_g14_program_service_name[variant_code * 2 + 1] = information & 0xff;
|
||||
m_g14_psn_updated = true;
|
||||
qDebug() << "RDSParser::decode_type14: PS(ON): \"" << std::string(m_g14_program_service_name, 8).c_str() << "\"";
|
||||
//qDebug() << "RDSParser::decode_type14: PS(ON): \"" << std::string(m_g14_program_service_name, 8).c_str() << "\"";
|
||||
break;
|
||||
}
|
||||
case 4: // AF
|
||||
@ -977,8 +976,9 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
||||
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));
|
||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();*/
|
||||
break;
|
||||
}
|
||||
case 5: // mapped frequencies
|
||||
@ -989,8 +989,9 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
||||
af_1 = 100.0 * (((information >> 8) & 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));
|
||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();*/
|
||||
break;
|
||||
}
|
||||
case 9: // mapped frequencies (AM)
|
||||
@ -998,8 +999,9 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
||||
af_1 = 100.0 * (((information >> 8) & 0xff) + 875);
|
||||
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));
|
||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();*/
|
||||
break;
|
||||
}
|
||||
case 10: // unallocated
|
||||
@ -1010,6 +1012,7 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
||||
{
|
||||
if (m_g14_psn_updated)
|
||||
{
|
||||
qDebug("RDSParser::decode_type14: 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;
|
||||
@ -1018,36 +1021,87 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
||||
|
||||
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));
|
||||
qDebug("RDSParser::decode_type14: m_g14_alt_freq_set updated");
|
||||
|
||||
std::pair<freqs_map_t::iterator, bool> retMap;
|
||||
std::pair<freqs_set_t::iterator, bool> retSet;
|
||||
bool updated = false;
|
||||
|
||||
freqs_map_t::iterator mIt = m_g14_alt_freqs.find(pi_on);
|
||||
|
||||
if (mIt == m_g14_alt_freqs.end()) // key does not exist yet => insert the whole set
|
||||
{
|
||||
retMap = m_g14_alt_freqs.insert(freqs_map_kv_t(pi_on, m_g14_alt_freq_set));
|
||||
updated |= retMap.second;
|
||||
}
|
||||
else // merge sets
|
||||
{
|
||||
freqs_set_t::iterator sIt = m_g14_alt_freq_set.begin();
|
||||
const freqs_set_t::iterator sItEnd = m_g14_alt_freq_set.end();
|
||||
|
||||
for (sIt; sIt != sItEnd; ++sIt)
|
||||
{
|
||||
retSet = (mIt->second).insert(*sIt);
|
||||
updated |= retSet.second;
|
||||
}
|
||||
}
|
||||
|
||||
m_g14_alt_freq_set.clear();
|
||||
m_g14_data_available = ret.second;
|
||||
m_g14_data_available |= updated;
|
||||
}
|
||||
|
||||
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));
|
||||
qDebug("RDSParser::decode_type14: m_g14_mapped_freq_set updated");
|
||||
|
||||
std::pair<freqs_map_t::iterator, bool> retMap;
|
||||
std::pair<freqs_set_t::iterator, bool> retSet;
|
||||
bool updated = false;
|
||||
|
||||
freqs_map_t::iterator mIt = m_g14_mapped_freqs.find(pi_on);
|
||||
|
||||
if (mIt == m_g14_mapped_freqs.end()) // key does not exist yet => insert the whole set
|
||||
{
|
||||
retMap = m_g14_mapped_freqs.insert(freqs_map_kv_t(pi_on, m_g14_mapped_freq_set));
|
||||
updated |= retMap.second;
|
||||
}
|
||||
else // merge sets
|
||||
{
|
||||
freqs_set_t::iterator sIt = m_g14_mapped_freq_set.begin();
|
||||
const freqs_set_t::iterator sItEnd = m_g14_mapped_freq_set.end();
|
||||
|
||||
for (sIt; sIt != sItEnd; ++sIt)
|
||||
{
|
||||
retSet = (mIt->second).insert(*sIt);
|
||||
updated |= retSet.second;
|
||||
}
|
||||
}
|
||||
|
||||
m_g14_mapped_freq_set.clear();
|
||||
m_g14_data_available = ret.second;
|
||||
m_g14_data_available |= updated;
|
||||
}
|
||||
|
||||
/*
|
||||
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;
|
||||
}
|
||||
case 13: // PTY(ON), TA(ON)
|
||||
{
|
||||
ta_on = information & 0x01;
|
||||
pty_on = (information >> 11) & 0x1f;
|
||||
/*
|
||||
qDebug() << "RDSParser::decode_type14: PTY(ON):" << pty_table[int(pty_on)].c_str();
|
||||
if(ta_on) {
|
||||
qDebug() << "RDSParser::decode_type14: - TA";
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
case 14: // PIN(ON)
|
||||
{
|
||||
/*
|
||||
std::string s = str(boost::format("PIN(ON):%x%x") % ((information >> 8) & 0xff) % (information & 0xff));
|
||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();
|
||||
qDebug() << "RDSParser::decode_type14: " << s.c_str();*/
|
||||
break;
|
||||
}
|
||||
case 15: // Reserved for broadcasters use
|
||||
@ -1058,6 +1112,7 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (pi_on)
|
||||
{
|
||||
std::string pistring = str(boost::format("%04X") % pi_on);
|
||||
@ -1066,7 +1121,7 @@ void RDSParser::decode_type14(unsigned int *group, bool B)
|
||||
if (tp_on) {
|
||||
qDebug() << "RDSParser::decode_type14: TP(ON)";
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void RDSParser::decode_type15(unsigned int *group, bool B){
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
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;
|
||||
typedef std::set<double> freqs_set_t;
|
||||
|
||||
RDSParser();
|
||||
~RDSParser();
|
||||
|
BIN
sdrbase/resources/recycle.png
Normal file
BIN
sdrbase/resources/recycle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 791 B |
@ -47,5 +47,6 @@
|
||||
<file>flip_rl.png</file>
|
||||
<file>carrier.png</file>
|
||||
<file>rds.png</file>
|
||||
<file>recycle.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
Reference in New Issue
Block a user