From fa8b756462fec42b23acbf253313c9292e43afed Mon Sep 17 00:00:00 2001 From: Arturs Artamonovs Date: Sun, 27 Sep 2026 10:24:48 +0100 Subject: remove from files multiple clases and put them in separate files --- ADSBDecoderFramework/DataFormat17.swift | 100 ++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 ADSBDecoderFramework/DataFormat17.swift (limited to 'ADSBDecoderFramework/DataFormat17.swift') diff --git a/ADSBDecoderFramework/DataFormat17.swift b/ADSBDecoderFramework/DataFormat17.swift new file mode 100644 index 0000000..e1ea428 --- /dev/null +++ b/ADSBDecoderFramework/DataFormat17.swift @@ -0,0 +1,100 @@ +// +// DataFormat17.swift +// ADSBDecoder +// +// Created by Jacky Jack on 27/09/2026. +// + +import Foundation + +public class DataFormat17 { + + let DataFormat=17 //0:5 + var Capability=0 //5:7 + public var AddressAnnounced=0 //8:31 + public var TypeCode=0 //32:36 + var MovementField=0//37:43 + var HeadingBit=0//44 + var HeadingField=0//45:51 + //var CPROddEven=0//53 + //var CPRlat=0//54:70 + //var CPRlon=0//71:87 + var ParityIntegrity=0//88-111 + + //all avaliable message types + public var messageIdentification:ADSBTypeCodeIndentification? = nil + public var messageAirbornPositon:ADSBTypeCodeAirbonePositon? = nil + + public init(_ adsb_data: String) { + //print("Dataformat: 17!") + //print(adsb_data) + + var bindata:[UInt8] = [] + + var startN = adsb_data.startIndex + var endN = adsb_data.index(startN, offsetBy: 1) + var count=0//start index value + while (count>1)&0x7 + //print(String(format: "cap %02x", cap)) + Capability = Int(cap) + + //Decode Address Announcement + let address_ann = UInt32(bindata[1])<<16 + UInt32(bindata[2])<<8 + UInt32(bindata[3]) + //print(String(format: "address %06x", address_ann)) + + AddressAnnounced = Int(address_ann) + + //Decode Type Code + let tc_byte = bindata[4] >> 3 + //print(String(format: "tc %02d", tc_byte)) + + TypeCode = Int(tc_byte) + + //aircraft indentification and category + if (tc_byte == 4) { + let msg = ADSBTypeCodeIndentification(bindata[4...10]) + if decoder_debug_mode { + print("=====ADSB MESSSGE 04 =======") + print(msg) + print("============================") + } + + messageIdentification = msg + //airborn position + } else if ((tc_byte >= 8) && (tc_byte <= 18)) { + let msg = ADSBTypeCodeAirbonePositon(bindata[4...10]) + if decoder_debug_mode { + print(String(format:"=====ADSB MESSSGE %02d ======= AA:%04d", tc_byte, AddressAnnounced)) + print(msg) + print("============================") + } + + messageAirbornPositon = msg + //airborn velocity + } else if (tc_byte == 19) { + if decoder_debug_mode { + print("=====ADSB MESSSGE 19 =======") + print("=====VELOCITY =======") + } + } else { + if decoder_debug_mode { + print("=====ADSB MESSSGE UNKNOWN =======") + } + } + } +} + + -- cgit v1.2.3