SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
rdsparser.h
Go to the documentation of this file.
1 // Copyright (C) 2015 F4EXB //
3 // written by Edouard Griffiths //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // This program is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #ifndef PLUGINS_CHANNEL_BFM_RDSPARSER_H_
20 #define PLUGINS_CHANNEL_BFM_RDSPARSER_H_
21 
22 #include <string>
23 #include <set>
24 #include <map>
25 
26 class RDSParser
27 {
28 public:
29  typedef std::map<unsigned int, std::string> psns_map_t;
30  typedef std::pair<unsigned int, std::string> psns_map_kv_t;
31  typedef std::map<unsigned int, std::set<double> > freqs_map_t;
32  typedef std::pair<unsigned int, std::set<double> > freqs_map_kv_t;
33  typedef std::set<double> freqs_set_t;
34 
35  RDSParser();
36  ~RDSParser();
37 
41  void parseGroup(unsigned int *group);
42 
43  void clearAllFields();
44  void clearUpdateFlags();
45 
46  // PI data
48  unsigned int m_pi_count;
50  unsigned char m_pi_program_type;
54 
55  // G0 data
58  unsigned int m_g0_count;
60  unsigned char m_g0_psn_bitmap;
67  std::set<double> m_g0_alt_freq;
68 
69  // G1 data
71  unsigned int m_g1_count;
75  unsigned int m_g1_pin_day;
76  unsigned int m_g1_pin_hour;
77  unsigned int m_g1_pin_minute;
78 
79  // G2 data
81  unsigned int m_g2_count;
82  char m_g2_radiotext[64+1];
83 
84  // G3 data
86  unsigned int m_g3_count;
88  unsigned int m_g3_appGroup;
89  unsigned int m_g3_message;
90  unsigned int m_g3_aid;
91 
92  // G4 data
94  unsigned int m_g4_count;
95  unsigned int m_g4_hours;
96  unsigned int m_g4_minutes;
97  unsigned int m_g4_seconds;
98  unsigned int m_g4_year;
99  unsigned int m_g4_month;
100  unsigned int m_g4_day;
102 
103  // G5..G7 data
107  unsigned int m_g5_count;
108  unsigned int m_g6_count;
109  unsigned int m_g7_count;
110 
111  // G8 data
113  unsigned int m_g8_count;
115  unsigned int m_g8_dp_ci;
116  bool m_g8_sign;
117  unsigned int m_g8_extent;
118  unsigned int m_g8_event;
119  unsigned int m_g8_location;
122 
123  // G9 data
125  unsigned int m_g9_count;
126  unsigned int m_g9_varA;
127  unsigned int m_g9_cA;
128  unsigned int m_g9_dA;
129  unsigned int m_g9_varB;
130  unsigned int m_g9_dB;
131 
132  // G10..G13 data
137  unsigned int m_g10_count;
138  unsigned int m_g11_count;
139  unsigned int m_g12_count;
140  unsigned int m_g13_count;
141 
142  // G14 data
144  unsigned int m_g14_count;
146  freqs_map_t m_g14_alt_freqs;
147  freqs_map_t m_g14_mapped_freqs;
149  std::set<double> m_g14_alt_freq_set;
150  std::set<double> m_g14_mapped_freq_set;
151  unsigned int m_g14_psn_counter;
153 
154  // G15 data
156  unsigned int m_g15_count;
157 
158  // Static tables
159  static const unsigned int offset_pos[5];
160  static const unsigned int offset_word[5];
161  static const unsigned int syndrome[5];
162  static const char * const offset_name[];
163  static const std::string pty_table[32];
164  static const std::string pi_country_codes[15][5];
165  static const std::string coverage_area_codes[16];
166  static const std::string rds_group_acronyms[16];
167  static const std::string rds_group_acronym_tags[16];
168  static const std::string language_codes[44];
169  static const std::string tmc_duration[8][2];
170  static const int optional_content_lengths[16];
171  static const std::string label_descriptions[16];
172 
173 private:
174  double decode_af(unsigned int);
175  void decode_optional_content(int, unsigned long int *);
176  void decode_type0( unsigned int* group, bool B);
177  void decode_type1( unsigned int* group, bool B);
178  void decode_type2( unsigned int* group, bool B);
179  void decode_type3( unsigned int* group, bool B);
180  void decode_type4( unsigned int* group, bool B);
181  void decode_type5( unsigned int* group, bool B);
182  void decode_type6( unsigned int* group, bool B);
183  void decode_type7( unsigned int* group, bool B);
184  void decode_type8( unsigned int* group, bool B);
185  void decode_type9( unsigned int* group, bool B);
186  void decode_type10(unsigned int* group, bool B);
187  void decode_type11(unsigned int* group, bool B);
188  void decode_type12(unsigned int* group, bool B);
189  void decode_type13(unsigned int* group, bool B);
190  void decode_type14(unsigned int* group, bool B);
191  void decode_type15(unsigned int* group, bool B);
192 
195 
197  bool debug;
198  bool log;
199 
200 };
201 
202 
203 
204 #endif /* PLUGINS_CHANNEL_BFM_RDSPARSER_H_ */
unsigned int m_g0_count
Definition: rdsparser.h:58
unsigned int m_g6_count
Definition: rdsparser.h:108
unsigned int m_g8_event
Definition: rdsparser.h:118
unsigned int m_pi_program_identification
Definition: rdsparser.h:49
std::map< unsigned int, std::set< double > > freqs_map_t
Definition: rdsparser.h:31
static const std::string rds_group_acronyms[16]
Definition: rdsparser.h:166
void decode_type0(unsigned int *group, bool B)
Definition: rdsparser.cpp:467
unsigned int m_g14_count
Definition: rdsparser.h:144
int m_g8_content
Definition: rdsparser.h:121
bool m_g11_updated
Definition: rdsparser.h:134
unsigned int m_pi_count
Definition: rdsparser.h:48
unsigned int m_g9_cA
Definition: rdsparser.h:127
bool m_g0_mono_stereo
Definition: rdsparser.h:63
unsigned int m_g4_seconds
Definition: rdsparser.h:97
void parseGroup(unsigned int *group)
Definition: rdsparser.cpp:374
unsigned int m_g2_count
Definition: rdsparser.h:81
bool log
Definition: rdsparser.h:198
bool m_g3_groupB
Definition: rdsparser.h:87
unsigned int m_g9_dB
Definition: rdsparser.h:130
void decode_type8(unsigned int *group, bool B)
Definition: rdsparser.cpp:852
unsigned int m_g9_dA
Definition: rdsparser.h:128
bool m_g10_updated
Definition: rdsparser.h:133
void clearAllFields()
Definition: rdsparser.cpp:270
static const std::string pty_table[32]
Definition: rdsparser.h:163
unsigned int m_g9_count
Definition: rdsparser.h:125
bool m_g1_updated
Definition: rdsparser.h:70
bool m_g7_updated
Definition: rdsparser.h:106
unsigned int m_g4_year
Definition: rdsparser.h:98
void decode_type12(unsigned int *group, bool B)
Definition: rdsparser.cpp:995
bool m_g6_updated
Definition: rdsparser.h:105
bool m_g0_compressed
Definition: rdsparser.h:65
std::set< double > m_g14_mapped_freq_set
Definition: rdsparser.h:150
psns_map_t m_g14_program_service_names
key: PI, value: PSN
Definition: rdsparser.h:145
void decode_type14(unsigned int *group, bool B)
Definition: rdsparser.cpp:1013
char m_g0_program_service_name[8+1]
Definition: rdsparser.h:59
unsigned int m_g10_count
Definition: rdsparser.h:137
bool debug
Definition: rdsparser.h:197
bool m_pi_traffic_program
Definition: rdsparser.h:51
unsigned int m_g14_psn_counter
Definition: rdsparser.h:151
bool m_g14_updated
Definition: rdsparser.h:143
void decode_type11(unsigned int *group, bool B)
Definition: rdsparser.cpp:986
freqs_map_t m_g14_mapped_freqs
key: PI, value: set of mapped frequencies (MHz)
Definition: rdsparser.h:147
bool m_g9_updated
Definition: rdsparser.h:124
bool m_g8_diversion_recommended
Definition: rdsparser.h:114
freqs_map_t m_g14_alt_freqs
key: PI, value: set of alternate frequencies (MHz)
Definition: rdsparser.h:146
void decode_type3(unsigned int *group, bool B)
Definition: rdsparser.cpp:728
static const unsigned int offset_pos[5]
Definition: rdsparser.h:159
unsigned char pi_country_identification
Definition: rdsparser.h:193
void decode_type1(unsigned int *group, bool B)
Definition: rdsparser.cpp:627
unsigned int m_g1_count
Definition: rdsparser.h:71
unsigned char m_pi_program_type
Definition: rdsparser.h:50
void decode_type9(unsigned int *group, bool B)
Definition: rdsparser.cpp:959
bool m_g2_updated
Definition: rdsparser.h:80
void decode_type10(unsigned int *group, bool B)
Definition: rdsparser.cpp:977
unsigned int m_g8_location
Definition: rdsparser.h:119
std::set< double > m_g14_alt_freq_set
Definition: rdsparser.h:149
unsigned int m_g1_pin_minute
Definition: rdsparser.h:77
unsigned int m_g8_extent
Definition: rdsparser.h:117
static const std::string rds_group_acronym_tags[16]
Definition: rdsparser.h:167
bool m_g14_data_available
Definition: rdsparser.h:152
static const std::string label_descriptions[16]
Definition: rdsparser.h:171
static const unsigned int syndrome[5]
Definition: rdsparser.h:161
static const std::string language_codes[44]
Definition: rdsparser.h:168
unsigned int m_g1_pin_day
Definition: rdsparser.h:75
bool m_g0_traffic_announcement
Definition: rdsparser.h:61
std::map< unsigned int, std::string > psns_map_t
Definition: rdsparser.h:29
unsigned int m_g9_varB
Definition: rdsparser.h:129
unsigned int m_g11_count
Definition: rdsparser.h:138
int m_g1_country_index
negative if not received
Definition: rdsparser.h:73
bool m_g0_updated
Definition: rdsparser.h:56
unsigned int m_g4_minutes
Definition: rdsparser.h:96
void decode_type2(unsigned int *group, bool B)
Definition: rdsparser.cpp:694
unsigned char m_g0_psn_bitmap
Definition: rdsparser.h:60
std::set< double > freqs_set_t
Definition: rdsparser.h:33
unsigned char pi_program_reference_number
Definition: rdsparser.h:194
std::set< double > m_g0_alt_freq
Definition: rdsparser.h:67
unsigned int m_g7_count
Definition: rdsparser.h:109
unsigned int m_g4_month
Definition: rdsparser.h:99
char m_g2_radiotext[64+1]
Definition: rdsparser.h:82
double decode_af(unsigned int)
Definition: rdsparser.cpp:588
static const std::string pi_country_codes[15][5]
Definition: rdsparser.h:164
static const unsigned int offset_word[5]
Definition: rdsparser.h:160
bool m_g0_af_updated
Definition: rdsparser.h:57
unsigned int m_g8_dp_ci
Definition: rdsparser.h:115
unsigned int m_g3_appGroup
Definition: rdsparser.h:88
void decode_type13(unsigned int *group, bool B)
Definition: rdsparser.cpp:1004
unsigned int m_g8_count
Definition: rdsparser.h:113
static const std::string coverage_area_codes[16]
Definition: rdsparser.h:165
unsigned int m_g9_varA
Definition: rdsparser.h:126
static const char *const offset_name[]
Definition: rdsparser.h:162
int m_g8_label_index
negative if not received
Definition: rdsparser.h:120
bool radiotext_AB_flag
Definition: rdsparser.h:196
static const int optional_content_lengths[16]
Definition: rdsparser.h:170
unsigned int m_g3_message
Definition: rdsparser.h:89
std::pair< unsigned int, std::string > psns_map_kv_t
Definition: rdsparser.h:30
unsigned int m_g4_day
Definition: rdsparser.h:100
bool m_g5_updated
Definition: rdsparser.h:104
bool m_pi_updated
Definition: rdsparser.h:47
bool m_g3_updated
Definition: rdsparser.h:85
int m_g1_language_index
negative if not received
Definition: rdsparser.h:74
unsigned int m_g12_count
Definition: rdsparser.h:139
unsigned int m_g5_count
Definition: rdsparser.h:107
unsigned int m_g1_pin_hour
Definition: rdsparser.h:76
int m_pi_area_coverage_index
Definition: rdsparser.h:53
bool m_g8_updated
Definition: rdsparser.h:112
unsigned int m_g15_count
Definition: rdsparser.h:156
bool m_g4_updated
Definition: rdsparser.h:93
bool m_g0_music_speech
Definition: rdsparser.h:62
unsigned int m_g3_aid
Definition: rdsparser.h:90
bool m_g0_static_pty
Definition: rdsparser.h:66
void decode_type6(unsigned int *group, bool B)
Definition: rdsparser.cpp:836
unsigned int m_g3_count
Definition: rdsparser.h:86
unsigned int m_g4_count
Definition: rdsparser.h:94
static const std::string tmc_duration[8][2]
Definition: rdsparser.h:169
void clearUpdateFlags()
Definition: rdsparser.cpp:244
int m_g1_country_page_index
negative if not received
Definition: rdsparser.h:72
bool m_g8_sign
Definition: rdsparser.h:116
void decode_type4(unsigned int *group, bool B)
Definition: rdsparser.cpp:791
int m_pi_country_identification
Definition: rdsparser.h:52
unsigned int m_g13_count
Definition: rdsparser.h:140
bool m_g15_updated
Definition: rdsparser.h:155
char m_g14_program_service_name[8+1]
Definition: rdsparser.h:148
double m_g4_local_time_offset
Definition: rdsparser.h:101
void decode_type7(unsigned int *group, bool B)
Definition: rdsparser.cpp:844
unsigned int m_g4_hours
Definition: rdsparser.h:95
void decode_optional_content(int, unsigned long int *)
Definition: rdsparser.cpp:932
std::pair< unsigned int, std::set< double > > freqs_map_kv_t
Definition: rdsparser.h:32
void decode_type15(unsigned int *group, bool B)
Definition: rdsparser.cpp:1194
void decode_type5(unsigned int *group, bool B)
Definition: rdsparser.cpp:828
bool m_g12_updated
Definition: rdsparser.h:135
bool m_g0_artificial_head
Definition: rdsparser.h:64
bool m_g13_updated
Definition: rdsparser.h:136