summaryrefslogtreecommitdiff
path: root/Net1090/main.swift
blob: deeae31d43da440b219f3091cd5a7237ce8f94e1 (plain) (blame)
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
//
//  main.swift
//  Net1090
//
//  Created by Jacky Jack on 11/07/2024.
//

import Foundation
import Network
import NIO


var timer: Timer?
let ADSBClient = NetADSBDecoder(host: "192.168.7.61", port: 12345)

print("Net1090")

//var timer:Timer?
timer = Timer.scheduledTimer(
    withTimeInterval: 1,
    repeats: true
) { _ in
    print("Timer drain queue")
    while let msg = ADSBClient.msgarray.pop() {
        print(msg)
    }
}

print("start")

DispatchQueue.global(qos: .background).async {
    do {
        try ADSBClient.start()
    } catch let error {
        print("Error: \(error.localizedDescription)")
        ADSBClient.stop()
    }
}
RunLoop.current.run()
print("end")