mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -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:
24
intercept.py
24
intercept.py
@@ -12011,27 +12011,15 @@ def start_adsb():
|
||||
return jsonify({'status': 'error', 'message': 'ADS-B already running (using service)'})
|
||||
|
||||
data = request.json or {}
|
||||
print(f"[ADS-B] Request data: {data}")
|
||||
gain = data.get('gain', '40')
|
||||
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
|
||||
service_addr = check_dump1090_service()
|
||||
|
||||
# Allow forcing service mode even if check fails
|
||||
if force_service and not service_addr:
|
||||
print("[ADS-B] Force service mode enabled, using localhost:30003")
|
||||
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'})
|
||||
# Always try SBS service first (dump1090-mutability on port 30003)
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user