summaryrefslogtreecommitdiff
path: root/ADSBDecoder/Query.swift
diff options
context:
space:
mode:
Diffstat (limited to 'ADSBDecoder/Query.swift')
-rw-r--r--ADSBDecoder/Query.swift65
1 files changed, 64 insertions, 1 deletions
diff --git a/ADSBDecoder/Query.swift b/ADSBDecoder/Query.swift
index 99d9075..a92d919 100644
--- a/ADSBDecoder/Query.swift
+++ b/ADSBDecoder/Query.swift
@@ -52,7 +52,7 @@ class QueryDF17TC: CustomStringConvertible {
}
var description: String {
- var description = "TypeCode Count\n"
+ 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])
@@ -61,3 +61,66 @@ class QueryDF17TC: CustomStringConvertible {
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
+ }
+}
+