package rds // RDSConfig holds configuration data used to build the RDS data stream. // Covers IEC 62106 groups 0A, 2A, 3A, 4A, 10A, 11A, 14A (everything except TMC/EWS). type RDSConfig struct { // --- Group 0A: Basic tuning & switching --- // Program Identification – 16-bit station identifier. PI uint16 // Program Service name (8 ASCII characters, padded with spaces). PS string // Program Type (0-31 standard RDS PTY values). PTY uint8 // Traffic Program (TP) — this station carries traffic announcements. TP bool // Traffic Announcement (TA) — a traffic announcement is currently on air. // When TA transitions to true, receivers with TP-seek interrupt CD/other media. TA bool // Music/Speech switch: true = music, false = speech. // LEGACY: Deleted from IEC 62106-2:2018. Retained for pre-2018 receivers. MS bool // Decoder Identification (DI): 4-bit field sent across 4 group 0A segments. // bit 0 (d3): dynamic PTY (1) vs static (0) — ONLY THIS BIT REMAINS in IEC 62106-2:2018 // bit 1-3: stereo/artificial head/compressed — DELETED from standard // LEGACY: Only dynamic PTY indicator (bit 3) is current standard. DI uint8 // Long Programme Service name (LPS) — Group Type 15A, IEC 62106-2:2018. // Up to 32 bytes UTF-8, max ~16 display characters. Static station name. // Complements PS (8 chars); receivers may display LPS instead of PS. // Runs on Stream 0 — no RDS2 required. LPS string // Alternative Frequencies list. Up to 25 frequencies in MHz (e.g. 93.3, 95.7). // Transmitted in group 0A block C (two AF codes per group). // Enables automatic retuning when signal weakens. AF []float64 // --- Group 2A: RadioText --- // RadioText (up to 64 characters). Current song, info, etc. RT string // --- Group 4A: Clock-Time & Date --- // CTEnabled: transmit UTC clock-time once per minute. CTEnabled bool // CTOffsetHalfHours: local time offset from UTC in half-hours (-24..+24). // E.g. CET = +2, CEST = +4. Auto-detected from OS if zero. CTOffsetHalfHours int8 // --- Group 10A: Program Type Name --- // PTYN: 8-character custom label for the program type. // Overrides the standard PTY label on receivers that support it. // Empty = don't transmit group 10A. PTYN string // --- Group 11A + 3A: RT+ (RadioText Plus) --- // RTPlusEnabled: automatically parse RT into semantic tags (artist, title, etc.) // and transmit RT+ groups (11A) with ODA announcements (3A). RTPlusEnabled bool // RTPlusSeparator: string used to split RT into artist/title. // Default "-". E.g. "Depeche Mode - Enjoy The Silence" → artist/title. RTPlusSeparator string // --- eRT: Enhanced RadioText (ODA, AID 0x6552) --- // ERTEnabled: transmit eRT as ODA on Stream 0 (parallel to RT). ERTEnabled bool // ERT: UTF-8 text, max 128 bytes. For non-Latin scripts (Cyrillic, Arabic, CJK). ERT string // ERTGroupType: allocated group type for eRT data (default 12). ERTGroupType uint8 // --- RDS2 (Streams 1-3, IEC 62106-1:2018) --- // RDS2Enabled: activate additional subcarriers (66.5, 71.25, 76 kHz). RDS2Enabled bool // StationLogoPath: PNG/JPEG file. Transmitted via RFT on RDS2 streams. StationLogoPath string // --- Group 14A/14B: Enhanced Other Networks (EON) --- // EON: information about other stations in the network. // Enables cross-station TA switching and AF lists for other programs. EON []EONEntry // --- Encoder internal --- // SampleRate that the encoder will work against. Defaults to 228000 when zero. SampleRate float64 } // EONEntry describes another station in the network for EON (group 14A/14B). type EONEntry struct { PI uint16 // Program Identification of the other station PS string // Program Service name (8 chars) PTY uint8 // Program Type TP bool // Traffic Program flag TA bool // Traffic Announcement flag (live-updated for cross-TA switching) AF []float64 // Alternative Frequencies for the other station } // DefaultConfig returns a minimal config with sane defaults. func DefaultConfig() RDSConfig { return RDSConfig{ PI: 0x1234, PS: "FM-RDS", RT: "Go-based MPX", PTY: 0, TP: false, TA: false, MS: true, // music by default DI: 0x01, // stereo CTEnabled: true, RTPlusEnabled: true, RTPlusSeparator: " - ", ERTGroupType: 12, // Group 12A for eRT data SampleRate: 228000, } }