mirror of
https://github.com/smittix/intercept.git
synced 2026-07-30 19:38:12 -07:00
Start dump1090 with --net flag and connect to SBS port
- App starts dump1090-mutability with network mode enabled - Waits 3 seconds for initialization - Connects to SBS port 30003 for position data - No longer relies on system service being configured 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+21
-22
@@ -12014,36 +12014,35 @@ def start_adsb():
|
|||||||
gain = data.get('gain', '40')
|
gain = data.get('gain', '40')
|
||||||
device = data.get('device', '0')
|
device = data.get('device', '0')
|
||||||
|
|
||||||
# Always try SBS service first (dump1090-mutability on port 30003)
|
# Find dump1090
|
||||||
print("[ADS-B] Connecting to dump1090 SBS service on localhost:30003...")
|
|
||||||
adsb_using_service = True
|
|
||||||
thread = threading.Thread(target=parse_sbs_stream, args=('localhost:30003',), daemon=True)
|
|
||||||
thread.start()
|
|
||||||
return jsonify({'status': 'started', 'mode': 'service'})
|
|
||||||
|
|
||||||
# No service running, start dump1090 ourselves
|
|
||||||
dump1090_path = shutil.which('dump1090') or shutil.which('dump1090-mutability')
|
dump1090_path = shutil.which('dump1090') or shutil.which('dump1090-mutability')
|
||||||
|
|
||||||
if dump1090_path:
|
if not dump1090_path:
|
||||||
cmd = [dump1090_path, '--raw', '--net', '--gain', gain, '--device-index', str(device)]
|
return jsonify({'status': 'error', 'message': 'dump1090 not found. Install dump1090-mutability.'})
|
||||||
print(f"[ADS-B] Starting dump1090: {dump1090_path}")
|
|
||||||
elif shutil.which('rtl_adsb'):
|
# Start dump1090 with --net to enable SBS output on port 30003
|
||||||
cmd = ['rtl_adsb', '-g', gain, '-d', str(device)]
|
cmd = [dump1090_path, '--net', '--gain', gain, '--device-index', str(device), '--quiet']
|
||||||
print("[ADS-B] Using rtl_adsb (raw output only)")
|
print(f"[ADS-B] Starting dump1090 with network mode: {' '.join(cmd)}")
|
||||||
else:
|
|
||||||
return jsonify({'status': 'error', 'message': 'No ADS-B decoder found (install dump1090 or rtl_adsb)'})
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
adsb_process = subprocess.Popen(
|
adsb_process = subprocess.Popen(
|
||||||
cmd,
|
cmd,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.DEVNULL
|
||||||
bufsize=1,
|
|
||||||
universal_newlines=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Start parsing thread
|
# Wait for dump1090 to start and open ports
|
||||||
thread = threading.Thread(target=parse_adsb_output, args=(adsb_process,), daemon=True)
|
print("[ADS-B] Waiting for dump1090 to initialize...")
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
# Check if process is still running
|
||||||
|
if adsb_process.poll() is not None:
|
||||||
|
return jsonify({'status': 'error', 'message': 'dump1090 failed to start. Check if RTL-SDR is connected.'})
|
||||||
|
|
||||||
|
# Connect to SBS port for data
|
||||||
|
print("[ADS-B] Connecting to SBS stream on localhost:30003...")
|
||||||
|
adsb_using_service = True
|
||||||
|
thread = threading.Thread(target=parse_sbs_stream, args=('localhost:30003',), daemon=True)
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
return jsonify({'status': 'started', 'mode': 'standalone'})
|
return jsonify({'status': 'started', 'mode': 'standalone'})
|
||||||
|
|||||||
Reference in New Issue
Block a user