# Abflug clients v2.6.0

End-user applications for Abflug multiplayer.

## Main applications

| File | Description |
|------|-------------|
|**launcher.pyw**|Starting Application.|
| **abflug_gui.py** | GUI client: forwards simulator GPS to the server, registers flight plan |
| **rewinger.py** | Traffic viewer: map, own aircraft, nearby traffic, callsign from server |

## Quick start
### Windows
Install Python from main website or from Microsoft Store:
- [Microsoft Store App](https://apps.microsoft.com/detail/9NQ7512CXL7T)
- Alternative - [Python.org](https://www.python.org/downloads/release/pymanager-252/)

### Mac
- Official [Python.org](https://www.python.org/downloads/macos/)
- Or use the XCode version
- Or use Homebrew

## Installation
### **Config**
   - Copy `abflug.json.example` → `abflug.json`
   - Set `api_key` and optionally `server` (default: `https://abflug.cloud`)

### **Launcher (easiest)**
   - On Windows:
     - double click on launcher.pyw
   - On Mac:
      - Open a terminal in this folder (`abflug_vX.Y.Z_variant`).
      - Run:
      ```bash
      python3 launcher.py
      ```
   - At first launch, please click "Check prerequisites" that will verify if all the modules are installed ocrrectly.
   - Pick **Abflug Client** or **Rewinger** from the GUI.


**Or run apps directly**
   - Abflug Client: `python abflug_gui.py`
   - Rewinger: `python rewinger.py`

## Launcher
this allows to get set up and verify that all the components are available to connect to Abflug.Cloud:

![Launcher Screenshot](./images/launcher_screenshot.jpeg)

Going top to bottom:
- Abflug Client Allows you to share your position with other players
- Rewinger allows you to view the other players
- Check prerequisites verifies that the necesary modules are installed correctly.
   - required python modules:
      - `requests`
      - `tkintermapview`
- Check for updates checks online if there's a new version and downloads it in the downloads folder using your default browser.

## Abflug Client
![Abflug Client Connected](./images/Abflug_client_connected.jpeg)

### Server Configuration
Here you need to put your API key from the website. Alternatively, you can edit `abflug.json.example` to be called `abflug.json` and add the API Key in the configuration file. The system will take the API key from the file and autopopulate it.
![Abflug Client - Server Config Not Connected](./images/Server_config_red.jpeg)
![Abflug Client - Server Config Connected](./images/Server_config_green.jpeg)

### Simulator Data Source 
These are the settings necessary to connect to your Flight sim.

Currently supported methods - choose one:
- FSWidgets Protocol 
- UDP Protocol (PC / Mac Only)
>**Note**: you do not need to have FSWidgets App installed. It's just the name of the protocol.

In Aerofly you need to select **one** of them - enabling both will cause issues on priorities on the data source.

![Aerofly Settings](./images/Aerofly_settings.jpeg)

Once you have decided which connection method, you need to set up the Simulator Data source:

![Abflug Client - Simulator Data Source - not connected](./images/Sim_data_source_NC.jpeg)

- Autodedect simulator IP will attempt to find the sim by itself.
- You can select either the UDP or the FSwidgets Protocol.
- Simulator IP: free text
   - if Autodetect is used, it will show the IP address of the sim. 
   - If Autodetect is **NOT** used, you need to put the Local IP address of the Simulator machine (e.g. your smartphone Local IP address).

How it looks successfully connected:
![Abflug Client - Simulator Data Source - connected](./images/Sim_data_source_connected.jpeg)

>**Known Limitation:** please ensure that Aerofly is up and running before you connect to it.

### ATC mode - Fixed Position (optional)
This is a special mode that allows you to be an observer (e.g. a Tower). You can't send your flight Position if this mode is selected.
![Abflug Client - ATC mode - not toggled](./images/ATC_mode_NC.jpeg)

Once you toggle it, the Simulator Data Source will be locked:

![Abflug Client - ATC mode - toggled](./images/ATC_mode_toggled.jpeg)

you can then add the Latitude and Longitude to broadcast your position on the network.

### Squawk Code (optional)
Here you can set a squawk code as instructed by your ATC.
![Abflug Client - Squawk code - Not Set](./images/squawk_code_not_set.jpeg)

You need to write your squawk code and press "Apply" so it will be taken over:
![Abflug Client - Squawk code - Applied](./images/squawk_code_set.jpeg)

### Discord Webhooks (optional)
Here you can add a webhook to Discord. The Client will detect takeoff and landing, and send this information to a webhook.
![Discord Webhook](./images/Discord_webhooks.jpeg)

>**Note**: for this functionality to work correctly, you need to have a valid ICAO Airport code in the flightplan for Departure and Arrival.

### Flightplan
Here you can fill out your flightplan.

- departure Airport (4-letter code) *
- Arrival Airport  (4-letter code) *
- free text for your Airplane Model (e.g. A320)
- free text for your Airplane Livery (e.g. Alitalia)
- Callsign *
- Cruise Altitude
- Flight plan copied from SimBrief

>***Note:*** minimum required fields indicated with *

Press "Save" to confirm your flightplan.

![Flightplan Filled](./images/flightplan_filled.jpeg)

If you decide to use ATC Mode:
- Dparture and Arrival Airports must be the same
- Aircraft Model must contain the Airport you're managing (e.g. `EDDF`)
- Airline must contain you role (e.g. `Ground`)
- Callsign must be `ATC_`
- Flight plan route is free to be used for frequencies and information.

![Flightplan ATC](./images/flightplan_ATC.jpeg)

Press "Save" to confirm your flightplan.

### Connection button
Once you scrolled all the way down, you see the connection button.
![Connection Button - not connected](./images/connection_button_NC.jpeg)

Please press it. It will send all the information to the Abflug Network and manage the connection to the sim. If successful, you should see the button change to 
![Connection Button - not connected](./images/connection_button_connected.jpeg)

If you scroll up, you will see the two green dots for Server and Sim status:
![Green Status](./images/green_status.jpeg)

## Rewinger
Rewinger is the application that allows you to see the other planes as if you were on FlightRadar24.

The Application at first opening looks like this:
![Rewinger First Opening](./images/Rewinger_first_opening.jpeg)

As per the client, you need to add your API key and the connection to your sim (same rules apply as per the Abflug Client):

![Rewinger First Online](./images/Rewinger_online.jpeg)

>***Note***: blue airplane is your own sim. Orange are the other players!

To see the information from the other players (or your own) you click on the airplane. On the right side a list of information will appear.
![Rewinger side column](./images/Rewinger_click_on_airplane.jpeg)

Example with ATC online:
![Rewinger side column 2](./images/Rewinger_Airplane_traffic.jpeg)

To deselect an airplane, you just press the key "ESC".

### Target Settings
Version 2.4 introduced tools to help ATC players. You can now click on an airplane and "set" a target of Speed, heading, V/S or altitude.

Once a target is set, you will see next to the Airplane info a simbol and asterisks:
- Ⓣ = all values on target
- Ⓣ* = deviation from at least one target, but none major
- Ⓣ** =  deviation from at least one target, at least one major
- Ⓣ*** =  deviation from at least one target, of which one major

![Rewinger Target example](./images/Target_example.jpeg)

>***Note***: the targets are visible only to the user who sets them. Are not broadcasted. You can set targets to yourself or other airplanes (e.g. instructions from ATC)

### left side - Map, Follow, Filter
- "Follow" toggle: recenters the map on your airplane
- "Filter" toggle: if too many airplanes spawn on your same position, filters them out
- Map: drop down list to select different maps.
- Disconnected / connected: indicates the server status.

![Rewinger Toggles](./images/Toggles_options.jpeg)

## ATC - Observer mode:
To play as ATC or just observe, you need to be sure no Sim data is coming towards Rewinger. To make sure, you can select the "non active" communication method.
Once this is set, you need to set your observer place with an approximate Lat and Lon.
If successful, you will see an orange confirmation message: "Connected (Observer mode)":
![Rewinger Observer settings](./images/observer_mode.jpeg)
![Rewinger Observer Traffic](./images/Rewinger_full_observer.jpeg)


# FAQ
## Windows: “Downloaded from internet”

Scripts run from a downloaded zip are often blocked. To avoid that:

**Unblock before extracting:** 
Right‑click the downloaded zip → **Properties** → check **Unblock** → OK, then extract.

## FSWidget / Aerofly Mobile

- Use **FSWidget TCP** when the simulator runs on another device (e.g. phone).
- Use **Autodetect** in both Abflug Client and Rewinger to find the simulator IP.

## Rewinger shows only "Aircraft"
Sometimes some stale data messes up with the detection, especially if you changed location from one airport to the other via the location setting in Aerofly.
Workaround:
- disconnect Abflug and Rewinger
- in game, spawn correctly where you need to be
- close then reopen Aerofly
- reconnect Abflug and Rewinger

## Abflug cannot find the Simulator (dot remains grey for Sim Data Source) error 10061
This issue happens when the phone refuses to allow Abflug Client to request data (Connection refused, error 10061).

Workaround:
- Close Aerofly and estart your phone
- Start Aerofly
- try to reconnect with Abflug Client
