1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-02-03 09:44:01 -05:00

BFM demod: RDS GUI part #4: group 4 implementation

This commit is contained in:
f4exb 2015-12-14 09:01:37 +01:00
parent 8717efef92
commit 9eb271b218
4 changed files with 95 additions and 14 deletions

View File

@ -485,7 +485,19 @@ void BFMDemodGUI::rdsUpdate()
ui->g00Label->setStyleSheet("QLabel { background:rgb(79,79,79); }");
}
// G1 group
// G4 group
if (m_rdsParser.m_g4_updated)
{
ui->g04Label->setStyleSheet("QLabel { background-color : green; }");
ui->g04CountText->setNum((int) m_rdsParser.m_g4_count);
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);
ui->g04Time->setText(QString(time.c_str()));
}
else
{
ui->g04Label->setStyleSheet("QLabel { background:rgb(79,79,79); }");
}
m_rdsParser.clearUpdateFlags();
}

View File

@ -437,7 +437,7 @@
<x>10</x>
<y>150</y>
<width>500</width>
<height>141</height>
<height>201</height>
</rect>
</property>
<property name="minimumSize">
@ -1083,6 +1083,56 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="g04DataLayout">
<item>
<widget class="QLabel" name="g04Label">
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>G04</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="g04Sep1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="g04Time">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>../../.. ..:..:..</string>
</property>
</widget>
</item>
<item>
<spacer name="g04Spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>

View File

@ -224,6 +224,7 @@ void RDSParser::clearUpdateFlags()
m_pi_updated = false;
m_g0_updated = false;
m_g0_af_updated = false;
m_g4_updated = false;
}
void RDSParser::clearAllFields()
@ -250,6 +251,9 @@ void RDSParser::clearAllFields()
std::memset(radiotext, ' ', sizeof(radiotext));
radiotext[sizeof(radiotext) - 1] = '\0';
// Group 04 data
m_g4_count = 0;
clearUpdateFlags();
}
@ -649,27 +653,31 @@ void RDSParser::decode_type4(unsigned int *group, bool B)
return;
}
unsigned int hours = ((group[2] & 0x1) << 4) | ((group[3] >> 12) & 0x0f);
unsigned int minutes = (group[3] >> 6) & 0x3f;
double local_time_offset = .5 * (group[3] & 0x1f);
m_g4_updated = true;
m_g4_count++;
m_g4_hours = ((group[2] & 0x1) << 4) | ((group[3] >> 12) & 0x0f);
m_g4_minutes = (group[3] >> 6) & 0x3f;
m_g4_local_time_offset = .5 * (group[3] & 0x1f);
if ((group[3] >> 5) & 0x1) {
local_time_offset *= -1;
m_g4_local_time_offset *= -1;
}
double modified_julian_date = ((group[1] & 0x03) << 15) | ((group[2] >> 1) & 0x7fff);
unsigned int year = int((modified_julian_date - 15078.2) / 365.25);
unsigned int month = int((modified_julian_date - 14956.1 - int(year * 365.25)) / 30.6001);
unsigned int day = modified_julian_date - 14956 - int(year * 365.25) - int(month * 30.6001);
bool K = ((month == 14) || (month == 15)) ? 1 : 0;
year += K;
month -= 1 + K * 12;
m_g4_year = int((modified_julian_date - 15078.2) / 365.25);
m_g4_month = int((modified_julian_date - 14956.1 - int(m_g4_year * 365.25)) / 30.6001);
m_g4_day = modified_julian_date - 14956 - int(m_g4_year * 365.25) - int(m_g4_month * 30.6001);
bool K = ((m_g4_month == 14) || (m_g4_month == 15)) ? 1 : 0;
m_g4_year += K;
m_g4_month -= 1 + K * 12;
/*
std::string time = str(boost::format("%02i.%02i.%4i, %02i:%02i (%+.1fh)")\
% day % month % (1900 + year) % hours % minutes % local_time_offset);
% m_g4_day % m_g4_month % (1900 + m_g4_year) % m_g4_hours % m_g4_minutes % m_g4_local_time_offset);
qDebug() << "RDSParser::decode_type4: Clocktime: " << time.c_str();
qDebug() << "RDSParser::decode_type4: Clocktime: " << time.c_str();*/
//send_message(5,time);
}

View File

@ -57,6 +57,17 @@ public:
bool m_g0_static_pty;
std::set<double> m_g0_alt_freq;
// G4 data
bool m_g4_updated;
unsigned int m_g4_count;
unsigned int m_g4_hours;
unsigned int m_g4_minutes;
unsigned int m_g4_seconds;
unsigned int m_g4_year;
unsigned int m_g4_month;
unsigned int m_g4_day;
double m_g4_local_time_offset;
// Static tables
static const unsigned int offset_pos[5];
static const unsigned int offset_word[5];