# ninjalunarray/distoforeflight architecture

> Architecture diagram of the GitHub repository ninjalunarray/distoforeflight, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ninjalunarray/distoforeflight
- Repository: https://github.com/ninjalunarray/distoforeflight

## Overview

This repository contains two standalone DIS-to-ForeFlight UDP bridge scripts. The principal workflow in `dis2foreflight.py` receives and filters DIS Entity State PDUs, derives position and motion, then sends ownship data and optionally other-aircraft traffic to ForeFlight; optional discovery learns the destination device. `dis_to_foreflight.py` is a simpler alternate implementation. The excerpts do not establish how that script’s receive loop invokes its parser, so that internal link is omitted.

Main entry points: [`dis2foreflight.py`](https://github.com/ninjalunarray/distoforeflight/blob/main/dis2foreflight.py) (Bridge loop), [`dis_to_foreflight.py`](https://github.com/ninjalunarray/distoforeflight/blob/main/dis_to_foreflight.py) (Alternate bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_dis_sender(("DIS sender"))
node_bridge["Bridge loop<br/>[dis2foreflight.py]"]
node_pdu_parser["PDU parser<br/>[dis2foreflight.py]"]
node_kinematics["Geodetic derivation<br/>[dis2foreflight.py]"]
node_foreflight(("ForeFlight"))
node_legacy_bridge["Alternate bridge"]

node_dis_sender -->|"sends PDUs"| node_bridge
node_bridge -->|"parses datagrams"| node_pdu_parser
node_bridge -->|"derives motion"| node_kinematics
node_bridge -->|"sends UDP data"| node_foreflight
node_legacy_bridge -->|"sends UDP data"| node_foreflight

click node_bridge "https://github.com/ninjalunarray/distoforeflight/blob/main/dis2foreflight.py"
click node_pdu_parser "https://github.com/ninjalunarray/distoforeflight/blob/main/dis2foreflight.py"
click node_kinematics "https://github.com/ninjalunarray/distoforeflight/blob/main/dis2foreflight.py"
click node_legacy_bridge "https://github.com/ninjalunarray/distoforeflight/blob/main/dis_to_foreflight.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dis_sender,node_foreflight toneIndigo
class node_bridge,node_pdu_parser,node_kinematics,node_legacy_bridge toneTeal
```

## Components

### Other components

- **DIS sender**
- [Bridge loop](https://github.com/ninjalunarray/distoforeflight/blob/main/dis2foreflight.py): `dis2foreflight.py`
- [PDU parser](https://github.com/ninjalunarray/distoforeflight/blob/main/dis2foreflight.py): `dis2foreflight.py`
- [Geodetic derivation](https://github.com/ninjalunarray/distoforeflight/blob/main/dis2foreflight.py): `dis2foreflight.py`
- **ForeFlight**
- [Alternate bridge](https://github.com/ninjalunarray/distoforeflight/blob/main/dis_to_foreflight.py): `dis_to_foreflight.py`

## Connections

- DIS sender → Bridge loop: sends PDUs (evidence: `dis2foreflight.py`)
- Bridge loop → PDU parser: parses datagrams (evidence: `dis2foreflight.py`)
- Bridge loop → Geodetic derivation: derives motion (evidence: `dis2foreflight.py`)
- Bridge loop → ForeFlight: sends UDP data (evidence: `dis2foreflight.py`)
- Alternate bridge → ForeFlight: sends UDP data (evidence: `dis_to_foreflight.py`)
