-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
67 lines (61 loc) · 2.96 KB
/
Copy pathProgram.cs
File metadata and controls
67 lines (61 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// ============================================================
// ATCuno - Console Companion App
//
// ARCHITECTURE:
// This app holds ALL state. The Arduino is a dumb display.
//
// SCREEN ZONES:
// ┌─ Aircraft list ──────────────────────────────────┐ ← Zone: Aircraft
// ├─ API monitor ────────────────────────────────────┤
// ├─ Panel [Routes|Live|DB] ─────────────────────────┤ ← Zone: Panel
// └─ LCD preview ────────────────────────────────────┘
//
// KEYBOARD (Aircraft zone active):
// W/S = plane up/down A/D = page left/right Tab = open panel Q = quit
// KEYBOARD (Panel zone active):
// W/S = row up/down A/D = switch tabs Enter = action
// Tab / Esc = exit panel
//
// FILES:
// Models.cs — Plane, PanelTab/State/Data, DisplayMode
// Config.cs — Config + appsettings loading
// AnimState.cs — LCD scroll/heading animation state
// Formatter.cs — LCD string formatting + Geo helpers
// SerialHelper.cs— Serial port helpers + Display (Arduino push)
// ConsoleUi.cs — Spectre.Console rendering
// TestData.cs — Hard-coded test planes
// AppState.cs — Main application loop + input handling
// Program.cs — Entry point (this file)
// ============================================================
using System;
using System.IO.Ports;
using System.Threading.Tasks;
using Spectre.Console;
class Program
{
static async Task Main()
{
Console.OutputEncoding = System.Text.Encoding.UTF8;
Console.Title = "ATCuno Companion";
ConsoleUi.PrintBanner();
var config = Config.Load();
if (config.IsDefaultLocation)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(" [WARN] Using default location (Johannesburg).");
Console.WriteLine(" Set Location.Lat / Location.Lon in appsettings.Development.json\n");
Console.ResetColor();
}
var db = new Db(config.Cache);
var adsbQueue = new ApiQueue("adsbdb", config.GetQueueConfig("AdsbDb", 400, 60).MaxRequests, config.GetQueueConfig("AdsbDb", 400, 60).WindowSecs);
var skyQueue = new ApiQueue("opensky", config.GetQueueConfig("OpenSky", 2, 60).MaxRequests, config.GetQueueConfig("OpenSky", 2, 60).WindowSecs);
var adsbDb = new AdsbDbService(db, adsbQueue, config.PrivatePrefixes);
var openSky = new OpenSkyService(config, db, adsbDb, skyQueue);
SerialPort? serial = await SerialHelper.ChoosePortAsync(config);
var app = new AppState(serial, config, db, openSky, adsbDb);
await app.RunAsync();
db.Dispose();
adsbDb.Dispose();
openSky.Dispose();
}
}