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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
//
// Query.swift
// ADSBDecoder
//
// Created by Jacky Jack on 31/05/2024.
//
import Foundation
class QueryDF: CustomStringConvertible {
//max I see is 24
var DFlist:[Int] = Array(repeating: 0, count: 30)
init() {
}
func addDF(_ dataformat: UInt32) {
DFlist[Int(dataformat)] += 1
}
func showStat() {
print("DataFormat Count")
for i in 0...(DFlist.count)-1 {
if DFlist[i] != 0 {
print(String(format:" %02d: %05d", i, DFlist[i]))
}
}
}
var description: String {
var description = "DataFormat Count\n"
for i in 0...(DFlist.count)-1 {
if DFlist[i] != 0 {
description += String(format:" %02d: %04d\n", i, DFlist[i])
}
}
return description
}
}
class QueryDF17TC: CustomStringConvertible {
var TClist:[Int] = Array(repeating: 0, count: 32)
init() {
}
func addTC(_ typecode: Int) {
TClist[typecode] += 1
}
var description: String {
var description = "DF17 TypeCode Count\n"
for i in 0...(TClist.count-1) {
if TClist[i] != 0 {
description += String(format: " %02d: %04d\n", i, TClist[i])
}
}
return description
}
}
class QueryDecodedMessages: CustomStringConvertible {
var decoded:Int = 0
var total:Int = 0
init() {
}
func addDecoded() {
decoded += 1
total += 1
}
func addUndecoded() {
total = total + 1
}
var description: String {
var description = "Total messages:\n"
description += "Decoded:\(decoded)\n"
description += "Total :\(total) \(String(format:"%02.01f",Float(Float(decoded)/Float(total)*100.0)))%\n"
return description
}
}
class QueryDF17TC_decoded: CustomStringConvertible {
var TClist_decoded:[Int] = Array(repeating: 0, count: 32)
var TClist_total:[Int] = Array(repeating: 0, count: 32)
init() {
}
func addDecoded(_ typecode: Int) {
TClist_decoded[typecode] += 1
TClist_total[typecode] += 1
}
func addUndecode(_ typecode: Int) {
TClist_total[typecode] += 1
}
var description: String {
var description = ""
var decoded:Int = 0
var total:Int = 0
for i in 0...(TClist_decoded.count-1) {
total += TClist_total[i]
decoded += TClist_decoded[i]
if TClist_total[i] != 0 {
description += String(format: " %02d: %04d\n", i, TClist_decoded[i])
}
}
description += String(format:"Total %d/%d %.1f",decoded,total,Double(Double(decoded)/Double(total))*100)
description += "%\n"
return description
}
}
|