summaryrefslogtreecommitdiff
path: root/LearnMapKit/LearnMapKitApp.swift
diff options
context:
space:
mode:
Diffstat (limited to 'LearnMapKit/LearnMapKitApp.swift')
-rw-r--r--LearnMapKit/LearnMapKitApp.swift56
1 files changed, 24 insertions, 32 deletions
diff --git a/LearnMapKit/LearnMapKitApp.swift b/LearnMapKit/LearnMapKitApp.swift
index 8132c92..b10764d 100644
--- a/LearnMapKit/LearnMapKitApp.swift
+++ b/LearnMapKit/LearnMapKitApp.swift
@@ -19,29 +19,31 @@ struct CommandLineArgs: ParsableCommand {
@Flag(name: .shortAndLong) var version:Bool = false
}
+//@EnvironmentObject var flightState: FlightState
+
@main
struct LearnMapKitApp: App {
var network_mode = false
var file_mode = false
@State var queue: Deque<ADSBLocation> = []
@State var netconfig: NetworkConfigure = NetworkConfigure()
+ @State var new_config: Bool = false
+
+ //@StateObject private var flightState:FlightState = FlightState()
+ //@State var flightState:FlightState = FlightState()
+ var flightState:FlightState = FlightState()
+ //@Published var list_of_plains:[FlightTracker]?
+ //@StateObject var flightState:FlightState = FlightState()
- @StateObject private var flightState:FlightState = FlightState()
- var default_hostname = "192.168.4.201"
+ var default_hostname = "192.168.4.233"
var default_port = 30002
var default_input_file = ""
+
+
init() {
- print("Init app")
- //parse arguments
- //let args = CommandLineArgs.parseOrExit()
- //flightState.defaultMode()
- let args = CommandLineArgs.parseOrExit()
- print(args)
- print(args.inputfile)
- //exit(0)
- //if (true)//
+ print("Init ")
if let args = CommandLineArgs.parseNotExit()
{
if args.hostname != nil {
@@ -57,44 +59,34 @@ struct LearnMapKitApp: App {
default_input_file = args.inputfile!
file_mode = true
}
- print("Set this")
-
}
- //flightState.run()
-
-
- /*let ADSBClient = NetADSBDecoder(host: default_hostname, port: default_port)
- DispatchQueue.global(qos: .background).async {
- do {
- try ADSBClient.start()
- } catch let error {
- print("Error: \(error.localizedDescription)")
- ADSBClient.stop()
- }
- }*/
+ if network_mode {
+ netconfig.servername = default_hostname
+ netconfig.serverport = default_port
+ }
}
var body: some Scene {
WindowGroup {
- ContentView(pos_queue: $queue, net_config: $netconfig).onAppear(perform: {
+ ContentView(net_config: $netconfig).onAppear(perform: {
if network_mode {
- print("network mode")
+ print("Network mode")
flightState.networkMode(hostname: self.default_hostname, port: self.default_port)
} else if (file_mode){
- print("RUn file mode")
+ print("Run file mode")
flightState.fileMode(filepath: self.default_input_file)
} else {
print("Run default mode")
- flightState.defaultMode()
+ flightState.defaultMode(hostname: default_hostname, port: default_port)
}
- flightState.run()
+ flightState.run()
})
}.environmentObject(flightState)
- WindowGroup("Network", id: "net-config") {
+ /*WindowGroup("Network", id: "net-config") {
NetConfigView(net_config: $netconfig)
- }
+ }*/
}
}