File: 0027-encoder-allow-setting-raw-pi-code.patch

package info (click to toggle)
gr-rds 3.10-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,648 kB
  • sloc: cpp: 18,916; python: 9,650; ansic: 26; makefile: 10
file content (52 lines) | stat: -rw-r--r-- 1,916 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 12f21188981145c4f31a19c22b4d995ed6bdc87c Mon Sep 17 00:00:00 2001
From: Bastian Bloessl <mail@bastibl.net>
Date: Fri, 28 Feb 2025 09:18:11 +0100
Subject: [PATCH 27/32] encoder: allow setting raw pi code

fixes #94
---
 grc/rds_encoder.block.yml |  4 ++--
 lib/encoder_impl.cc       | 11 ++++++++---
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/grc/rds_encoder.block.yml b/grc/rds_encoder.block.yml
index c96d73f..bb9ee7a 100644
--- a/grc/rds_encoder.block.yml
+++ b/grc/rds_encoder.block.yml
@@ -57,9 +57,9 @@ parameters:
     label: PI Country Code
     dtype: int
     default: '13'
-    options: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13',
+    options: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13',
         '15']
-    option_labels: [DE, DZ, AD, IL, IT, BE, RU, PS, AL, AT, HU, MT, DE, EG]
+    option_labels: [Other, DE, DZ, AD, IL, IT, BE, RU, PS, AL, AT, HU, MT, DE, EG]
 -   id: pi_coverage_area
     label: PI Coverage Area
     dtype: int
diff --git a/lib/encoder_impl.cc b/lib/encoder_impl.cc
index bf45bda..42eafe8 100644
--- a/lib/encoder_impl.cc
+++ b/lib/encoder_impl.cc
@@ -52,9 +52,14 @@ encoder_impl::encoder_impl (unsigned char pty_locale, int pty, bool ms,
 	d_current_buffer     = 0;
 	d_buffer_bit_counter = 0;
 
-	PI                   = (pi_country_code & 0xF) << 12 |
-	                       (pi_coverage_area & 0xF) << 8 |
-	                       (pi_reference_number);
+	if (pi_country_code == 0) {
+		PI                 = pi_reference_number;
+	} else {
+		PI                 = (pi_country_code & 0xF) << 12 |
+		                     (pi_coverage_area & 0xF) << 8 |
+		                     (pi_reference_number);
+	}
+
 	PTY                  = pty;     // programm type (education)
 	TP                   = tp;      // traffic programm
 	TA                   = ta;      // traffic announcement
-- 
2.47.3