From 86c489c3c8ab1fa46fdcae022289f414f2de04cd Mon Sep 17 00:00:00 2001 From: Arturs Artamonovs Date: Wed, 5 Jun 2024 09:09:36 +0100 Subject: Decoder part --- ADSBDecoder/Query.swift | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'ADSBDecoder/Query.swift') diff --git a/ADSBDecoder/Query.swift b/ADSBDecoder/Query.swift index 4906221..99d9075 100644 --- a/ADSBDecoder/Query.swift +++ b/ADSBDecoder/Query.swift @@ -6,3 +6,58 @@ // 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 = "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 + } +} -- cgit v1.2.3