mirror of
https://github.com/smittix/intercept.git
synced 2026-07-05 16:18:12 -07:00
Simplify ADS-B to always use SBS service
Skip the port check and always connect to localhost:30003. The SBS parser will handle connection errors and retry. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+6
-18
@@ -12011,27 +12011,15 @@ def start_adsb():
|
|||||||
return jsonify({'status': 'error', 'message': 'ADS-B already running (using service)'})
|
return jsonify({'status': 'error', 'message': 'ADS-B already running (using service)'})
|
||||||
|
|
||||||
data = request.json or {}
|
data = request.json or {}
|
||||||
print(f"[ADS-B] Request data: {data}")
|
|
||||||
gain = data.get('gain', '40')
|
gain = data.get('gain', '40')
|
||||||
device = data.get('device', '0')
|
device = data.get('device', '0')
|
||||||
force_service = data.get('forceService', False)
|
|
||||||
print(f"[ADS-B] forceService = {force_service}")
|
|
||||||
|
|
||||||
# First check if dump1090 is already running as a service with SBS port
|
# Always try SBS service first (dump1090-mutability on port 30003)
|
||||||
service_addr = check_dump1090_service()
|
print("[ADS-B] Connecting to dump1090 SBS service on localhost:30003...")
|
||||||
|
adsb_using_service = True
|
||||||
# Allow forcing service mode even if check fails
|
thread = threading.Thread(target=parse_sbs_stream, args=('localhost:30003',), daemon=True)
|
||||||
if force_service and not service_addr:
|
thread.start()
|
||||||
print("[ADS-B] Force service mode enabled, using localhost:30003")
|
return jsonify({'status': 'started', 'mode': 'service'})
|
||||||
service_addr = 'localhost:30003'
|
|
||||||
|
|
||||||
if service_addr:
|
|
||||||
print(f"[ADS-B] Using existing dump1090 service SBS port at {service_addr}")
|
|
||||||
adsb_using_service = True
|
|
||||||
# Start thread to parse SBS data
|
|
||||||
thread = threading.Thread(target=parse_sbs_stream, args=(service_addr,), daemon=True)
|
|
||||||
thread.start()
|
|
||||||
return jsonify({'status': 'started', 'mode': 'service'})
|
|
||||||
|
|
||||||
# No service running, start dump1090 ourselves
|
# 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')
|
||||||
|
|||||||
Reference in New Issue
Block a user