feat(export): AIS UDP NMEA forward and JSON export endpoints for AIS/ADS-B

AIS:
- New optional NMEA UDP forwarding via AIS-catcher's -u flag, configurable
  from the AIS sidebar (host + port). Lets OpenCPN and other NMEA tools
  receive live vessel data directly. All SDR builders updated.
- New GET /ais/vessels endpoint — clean JSON snapshot of tracked vessels
  for REST integration

ADS-B:
- New GET /adsb/aircraft endpoint — JSON snapshot of all tracked aircraft,
  with optional ?icao= and ?military=true filters. Response includes a
  reminder that port 30003 (SBS) is already available for tools like
  Virtual Radar Server and OpenCPN's AIS/target plugin.

Closes #90
This commit is contained in:
James Smith
2026-04-05 16:20:10 +01:00
parent 50de9a9932
commit a1af859cd1
9 changed files with 138 additions and 8 deletions
+35
View File
@@ -803,6 +803,41 @@ def adsb_status():
})
@adsb_bp.route('/aircraft')
def adsb_aircraft_export():
"""Export current ADS-B aircraft data as JSON.
Returns a snapshot of all tracked aircraft suitable for integration
with external tools. For SBS (BaseStation) format, connect directly
to port 30003 which dump1090 exposes natively.
Query parameters:
icao: Filter to a specific ICAO hex code (optional)
military: 'true' to return only military aircraft (optional)
Returns:
JSON with aircraft list and metadata.
"""
aircraft = dict(app_module.adsb_aircraft)
icao_filter = request.args.get('icao', '').upper()
if icao_filter:
aircraft = {k: v for k, v in aircraft.items() if k.upper() == icao_filter}
if request.args.get('military') == 'true':
try:
from utils.military_icao import is_military_icao
aircraft = {k: v for k, v in aircraft.items() if is_military_icao(k)}
except ImportError:
pass
return jsonify({
'count': len(aircraft),
'aircraft': list(aircraft.values()),
'sbs_port': 30003, # dump1090 SBS stream for tools like Virtual Radar Server
})
@adsb_bp.route('/session')
def adsb_session():
"""Get ADS-B session status and uptime."""