mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
fix: integrate GNSS and emergency features with current main contracts
This commit is contained in:
1 parent
69e8b18e02
commit
ec80c89c1e
27 files changed
+1581
-453
No files matched your search
@@ -94,8 +94,25 @@ export function normalizeAdsbLolPointResponse(payload) {
|
||||
: Math.floor(
|
||||
responseNow > 10_000_000_000 ? responseNow / 1000 : responseNow,
|
||||
);
|
||||
const states = (Array.isArray(payload?.ac) ? payload.ac : [])
|
||||
const aircraft = Array.isArray(payload?.ac) ? payload.ac : [];
|
||||
const states = aircraft
|
||||
.map((aircraft) => normalizeAdsbLolAircraftState(aircraft, nowSeconds))
|
||||
.filter(Boolean);
|
||||
return { time: nowSeconds, states };
|
||||
// Keep the OpenSky vectors unchanged. The regional fallback's extra readsb
|
||||
// status travels alongside them, keyed only to admitted aircraft.
|
||||
const admitted = new Set(states.map((row) => row[0]));
|
||||
const emergencyByIcao = Object.fromEntries(
|
||||
aircraft.flatMap((row) => {
|
||||
const id = String(row?.hex || '')
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
if (!admitted.has(id) || typeof row?.emergency !== 'string') return [];
|
||||
return [[id, row.emergency.trim().toLowerCase()]];
|
||||
}),
|
||||
);
|
||||
return {
|
||||
time: nowSeconds,
|
||||
states,
|
||||
...(Object.keys(emergencyByIcao).length ? { emergencyByIcao } : {}),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user