mirror of
https://github.com/smittix/intercept.git
synced 2026-07-11 02:58:12 -07:00
Add direwolf config file for APRS decoding
Direwolf requires a config file to run. Create a minimal receive-only config at startup that configures stdin input with AFSK1200 modem. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+26
-1
@@ -3,10 +3,12 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import queue
|
import queue
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@@ -61,6 +63,25 @@ def find_rtl_fm() -> Optional[str]:
|
|||||||
return shutil.which('rtl_fm')
|
return shutil.which('rtl_fm')
|
||||||
|
|
||||||
|
|
||||||
|
# Path to direwolf config file
|
||||||
|
DIREWOLF_CONFIG_PATH = os.path.join(tempfile.gettempdir(), 'intercept_direwolf.conf')
|
||||||
|
|
||||||
|
|
||||||
|
def create_direwolf_config() -> str:
|
||||||
|
"""Create a minimal direwolf config for receive-only operation."""
|
||||||
|
config = """# Minimal direwolf config for INTERCEPT (receive-only)
|
||||||
|
# Audio input is handled via stdin
|
||||||
|
|
||||||
|
ADEVICE stdin null
|
||||||
|
CHANNEL 0
|
||||||
|
MYCALL N0CALL
|
||||||
|
MODEM 1200
|
||||||
|
"""
|
||||||
|
with open(DIREWOLF_CONFIG_PATH, 'w') as f:
|
||||||
|
f.write(config)
|
||||||
|
return DIREWOLF_CONFIG_PATH
|
||||||
|
|
||||||
|
|
||||||
def parse_aprs_packet(raw_packet: str) -> Optional[dict]:
|
def parse_aprs_packet(raw_packet: str) -> Optional[dict]:
|
||||||
"""Parse APRS packet into structured data."""
|
"""Parse APRS packet into structured data."""
|
||||||
try:
|
try:
|
||||||
@@ -436,14 +457,18 @@ def start_aprs() -> Response:
|
|||||||
|
|
||||||
# Build decoder command
|
# Build decoder command
|
||||||
if direwolf_path:
|
if direwolf_path:
|
||||||
|
# Create minimal config file for direwolf
|
||||||
|
config_path = create_direwolf_config()
|
||||||
|
|
||||||
# direwolf flags for receiving AFSK1200 from stdin:
|
# direwolf flags for receiving AFSK1200 from stdin:
|
||||||
|
# -c config = config file path
|
||||||
# -n 1 = mono audio channel
|
# -n 1 = mono audio channel
|
||||||
# -r 22050 = sample rate
|
# -r 22050 = sample rate
|
||||||
# -b 16 = 16-bit samples
|
# -b 16 = 16-bit samples
|
||||||
# -t 0 = disable text colors (for cleaner parsing)
|
# -t 0 = disable text colors (for cleaner parsing)
|
||||||
# -q h = quiet mode - suppress audio level heard line (keeps packet output)
|
# -q h = quiet mode - suppress audio level heard line (keeps packet output)
|
||||||
# - = read from stdin
|
# - = read from stdin
|
||||||
decoder_cmd = [direwolf_path, '-n', '1', '-r', '22050', '-b', '16', '-t', '0', '-q', 'h', '-']
|
decoder_cmd = [direwolf_path, '-c', config_path, '-n', '1', '-r', '22050', '-b', '16', '-t', '0', '-q', 'h', '-']
|
||||||
decoder_name = 'direwolf'
|
decoder_name = 'direwolf'
|
||||||
else:
|
else:
|
||||||
decoder_cmd = [multimon_path, '-t', 'raw', '-a', 'AFSK1200', '-']
|
decoder_cmd = [multimon_path, '-t', 'raw', '-a', 'AFSK1200', '-']
|
||||||
|
|||||||
Reference in New Issue
Block a user