@@ -156,7 +156,7 @@ namespace rds {
156156 // Acquire lock
157157 std::lock_guard<std::mutex> lck (blockBMtx);
158158
159- // If it didn't decode properly return
159+ // If it didn't decode properly return (TODO: Make sure this is not needed)
160160 if (!blockAvail[BLOCK_TYPE_B]) { return ; }
161161
162162 // Decode group type and version
@@ -240,13 +240,57 @@ namespace rds {
240240 group2LastUpdate = std::chrono::high_resolution_clock::now ();
241241 }
242242
243+ void Decoder::decodeGroup10 () {
244+ // Acquire lock
245+ std::lock_guard<std::mutex> lck (group10Mtx);
246+
247+ // Check if the text needs to be cleared
248+ bool ab = (blocks[BLOCK_TYPE_B] >> 14 ) & 1 ;
249+ if (ab != ptnAB) {
250+ programTypeName = " " ;
251+ }
252+ ptnAB = ab;
253+
254+ // Decode segment address
255+ bool addr = (blocks[BLOCK_TYPE_B] >> 10 ) & 1 ;
256+
257+ // Save text depending on address
258+ if (addr) {
259+ if (blockAvail[BLOCK_TYPE_C]) {
260+ programTypeName[4 ] = (blocks[BLOCK_TYPE_C] >> 18 ) & 0xFF ;
261+ programTypeName[5 ] = (blocks[BLOCK_TYPE_C] >> 10 ) & 0xFF ;
262+ }
263+ if (blockAvail[BLOCK_TYPE_D]) {
264+ programTypeName[6 ] = (blocks[BLOCK_TYPE_D] >> 18 ) & 0xFF ;
265+ programTypeName[7 ] = (blocks[BLOCK_TYPE_D] >> 10 ) & 0xFF ;
266+ }
267+ }
268+ else {
269+ if (blockAvail[BLOCK_TYPE_C]) {
270+ programTypeName[0 ] = (blocks[BLOCK_TYPE_C] >> 18 ) & 0xFF ;
271+ programTypeName[1 ] = (blocks[BLOCK_TYPE_C] >> 10 ) & 0xFF ;
272+ }
273+ if (blockAvail[BLOCK_TYPE_D]) {
274+ programTypeName[2 ] = (blocks[BLOCK_TYPE_D] >> 18 ) & 0xFF ;
275+ programTypeName[3 ] = (blocks[BLOCK_TYPE_D] >> 10 ) & 0xFF ;
276+ }
277+ }
278+
279+ flog::debug (" PTN: '{}'" , programTypeName);
280+
281+ // Update timeout
282+ group10LastUpdate = std::chrono::high_resolution_clock::now ();
283+ }
284+
243285 void Decoder::decodeGroup () {
244286 // Make sure blocks B is available
245287 if (!blockAvail[BLOCK_TYPE_B]) { return ; }
246288
247289 // Decode block B
248290 decodeBlockB ();
249291
292+ // flog::debug("RDS Group {}{}", groupType, (groupVer == GROUP_VER_A) ? 'A':'B');
293+
250294 // Decode depending on group type
251295 switch (groupType) {
252296 case 0 :
@@ -255,6 +299,9 @@ namespace rds {
255299 case 2 :
256300 decodeGroup2 ();
257301 break ;
302+ case 10 :
303+ decodeGroup10 ();
304+ break ;
258305 default :
259306 break ;
260307 }
@@ -298,4 +345,9 @@ namespace rds {
298345 auto now = std::chrono::high_resolution_clock::now ();
299346 return (std::chrono::duration_cast<std::chrono::milliseconds>(now - group2LastUpdate)).count () < RDS_GROUP_2_TIMEOUT_MS;
300347 }
348+
349+ bool Decoder::group10Valid () {
350+ auto now = std::chrono::high_resolution_clock::now ();
351+ return (std::chrono::duration_cast<std::chrono::milliseconds>(now - group10LastUpdate)).count () < RDS_GROUP_10_TIMEOUT_MS;
352+ }
301353}
0 commit comments