# ============================================================================
# HamBridge-DMR Configuration File
# HomeBrew Protocol (MMDVM-compatible) - RECOMMENDED
# ============================================================================
#
# This configuration bridges SVXLink reflectors to DMR networks using the
# HomeBrew protocol. This is the recommended protocol for BrandMeister and
# most MMDVM-based networks.
#
# Copy this file to config.toml and edit with your credentials.
# ============================================================================

# ============================================================================
# GENERAL SETTINGS
# Application-wide configuration options
# ============================================================================
[general]

# Log level: trace, debug, info, warn, error
# Use "debug" for troubleshooting, "info" for normal operation
log_level = "info"

# Time between reconnection attempts (seconds)
# Lower values = faster recovery, higher values = less network spam
reconnect_interval_sec = 10

# Maximum reconnection attempts before giving up (0 = infinite/never give up)
max_reconnect_attempts = 0

# Path to write JSON status file (for external monitoring)
# Set to empty string to disable
api_json_path = "/var/lib/hambridge/status.json"

# How often to update the status JSON file (milliseconds)
api_update_interval_ms = 1000

# REST API HTTP port for status/control (0 = disabled)
# Access at http://localhost:10099/status
api_port = 10099

# ============================================================================
# SVXLINK REFLECTOR CONNECTION
# Connect to an SVXLink/EchoLink-style reflector network
# ============================================================================
[svxlink]

# Enable SVXLink connection (set to false to disable this side of the bridge)
enabled = true

# SVXLink reflector server hostname or IP address
# Examples: "reflector.example.com", "192.168.1.100"
hostname = "reflector.example.com"

# SVXLink reflector TCP port (default: 5300)
port = 5300

# Your amateur radio callsign for authentication
# Must be a valid callsign registered on the reflector
callsign = "N0CALL"

# Authentication password/key for the reflector
# Obtain this from your reflector administrator
auth_key = "your_svxlink_password_here"

# Talkgroup/room to join on the reflector
# Common values: "9" (parrot/test), specific room numbers
talkgroup = "9"

# UDP receive timeout in milliseconds
# Increase if experiencing drops on high-latency connections
udp_timeout_ms = 1000

# ============================================================================
# DMR NETWORK CONNECTION - HOMEBREW PROTOCOL
# Connect to BrandMeister, TGIF, or other HomeBrew-compatible networks
# ============================================================================
[dmr]

# Enable DMR connection (set to false to disable this side of the bridge)
enabled = true

# Protocol: "homebrew" (MMDVM) or "rewind" (BrandMeister-only)
# HomeBrew is recommended for most networks
protocol = "homebrew"

# DMR master server hostname or IP
# BrandMeister examples by region:
#   Germany:  "87.106.126.49" or "bm262.master.brandmeister.network"
#   USA:      "3101.master.brandmeister.network"
#   UK:       "2341.master.brandmeister.network"
# TGIF:       "tgif.network"
hostname = "87.106.126.49"

# HomeBrew protocol port (default: 62030)
port = 62030

# Your 7-digit DMR ID (obtain from radioid.net)
# Example: 1234567
dmr_id = 1234567

# Optional: Your callsign (defaults to DMR ID if not set)
# Displayed in network last-heard lists
callsign = "N0CALL"

# Optional: Repeater/Hotspot ID (defaults to DMR_ID * 100 + 1)
# For hotspots, typically your DMR ID with 01-99 suffix
# Example: 123456701
# repeater_id = 123456701

# Hotspot security password from BrandMeister selfcare
# Set this in your BrandMeister dashboard under Security
auth_key = "your_hotspot_password_here"

# Default talkgroup to monitor/transmit
# Common examples:
#   91    = Worldwide
#   9     = Local/Parrot test
#   3100  = USA Nationwide
#   235   = UK
talkgroup = 91

# DMR timeslot (1 or 2)
# Timeslot 2 is typically used for hotspots
timeslot = 2

# Color code (0-15, usually 1)
color_code = 1

# ----------------------------------------------------------------------------
# HomeBrew Protocol Metadata
# These fields are sent to the network for identification
# ----------------------------------------------------------------------------

# RX/TX frequencies in Hz (9 digits max)
# For hotspots, these are typically the same
rx_freq = "438800000"
tx_freq = "438800000"

# Transmit power in watts (2 digits)
tx_power = "01"

# Station coordinates for network mapping
# Format: latitude "+XX.XXXX" (8 chars), longitude "+XXX.XXXX" (9 chars)
latitude = "+47.5000"
longitude = "+008.5000"

# Antenna height above ground in meters (3 digits)
height = "010"

# Location description (20 chars max)
location = "My QTH"

# Station description (19 chars max)
description = "HamBridge"

# URL for more info (124 chars max)
url = "https://github.com/your-repo"

# Software identification strings (40 chars max each)
software_id = "HamBridge-DMR"
package_id = "HamBridge-DMR"

# ============================================================================
# AMBE VOCODER CONFIGURATION
# DMR uses AMBE+2 codec - requires external vocoder hardware/server
# ============================================================================
[ambe]

# Vocoder mode: "server" (external AMBE server like AMBEd/md380-emu)
# A DV3K/ThumbDV dongle or software vocoder server is REQUIRED
ambe_mode = "server"

# AMBE server IP address (REQUIRED when ambe_mode = "server")
# Examples:
#   Local AMBEd:     "127.0.0.1"
#   Network server:  "192.168.1.50"
#   md380-emu:       "192.168.1.100"
server_address = "127.0.0.1"

# AMBE server port (default: 2460 for AMBEd)
server_port = 2460

# Gain adjustment for decoded DMR->SVXLink audio (dB)
# Positive = louder, negative = quieter
# Recommended: 0.0 to 6.0 dB
decode_gain_db = 3.0

# Gain adjustment for encoded SVXLink->DMR audio (dB)
# Positive = louder, negative = quieter
encode_gain_db = 0.0

# ============================================================================
# AUDIO PROCESSING CONFIGURATION
# Settings for audio quality and buffering
# ============================================================================
[audio]

# Opus codec bitrate for SVXLink side (bits per second)
# Higher = better quality but more bandwidth
# Recommended: 16000-24000 for voice
opus_bitrate = 20000

# Total jitter buffer capacity in milliseconds
# Larger = more resilient to network jitter, but higher latency
jitter_buffer_ms = 480

# Prebuffer threshold in milliseconds
# Audio playback starts after this much data is buffered
# Lower = less latency but more susceptible to dropouts
prebuffer_ms = 120

# Audio sample rate in Hz (always 16000 for Opus voice mode)
# Do not change unless you know what you're doing
sample_rate = 16000

# Enable audio EQ processing (de-emphasis, presence boost, limiting)
# false = passthrough (cleaner, recommended for most setups)
# true  = apply processing (may help with some audio sources)
eq_enabled = false
