diff options
| author | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2026-09-27 10:24:48 +0100 |
|---|---|---|
| committer | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2026-09-27 10:24:48 +0100 |
| commit | fa8b756462fec42b23acbf253313c9292e43afed (patch) | |
| tree | 81b153638b18226feb254f44d0e8a7efababe69a /ADSBDecoderFramework/ADSBTypeCodeAirbonePositon.swift | |
| parent | 40038b02ce651958ae703c8ecfe5f5578e1f7f09 (diff) | |
| download | ADSBDecoder-main.tar.gz ADSBDecoder-main.zip | |
remove from files multiple clases and put them in separate filesmain
Diffstat (limited to 'ADSBDecoderFramework/ADSBTypeCodeAirbonePositon.swift')
| -rw-r--r-- | ADSBDecoderFramework/ADSBTypeCodeAirbonePositon.swift | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/ADSBDecoderFramework/ADSBTypeCodeAirbonePositon.swift b/ADSBDecoderFramework/ADSBTypeCodeAirbonePositon.swift new file mode 100644 index 0000000..b6a302a --- /dev/null +++ b/ADSBDecoderFramework/ADSBTypeCodeAirbonePositon.swift @@ -0,0 +1,49 @@ +// +// ADSBTypeCodeAirbonePositon.swift +// ADSBDecoder +// +// Created by Jacky Jack on 27/09/2026. +// + +//DF17 message types codes 8 to 18 +public class ADSBTypeCodeAirbonePositon:CustomStringConvertible { + var TypeCode:Int = 11 + var SurveillanceStatus: Int = 0 + var SingleAntennaFlag: Int = 0 + public var Altitude: Int = 0 + var Time: Int = 0 + public var CPRFormat: Int = 0 + public var Latitude: Int = 0 + public var Longitude: Int = 0 + + public init(_ bindata:ArraySlice<UInt8>) { + let ss = (bindata[4]>>1)&(0x3) + SurveillanceStatus = Int(ss) + let saf = bindata[5]&0x1 + SingleAntennaFlag = Int(saf) + let altitude = UInt16(bindata[5])<<4 + (UInt16(bindata[6])>>4)&0xf + //print(altitude) + Altitude = BarometricAltitudeFeat(altitude) + let time = (bindata[6]>>3)&0x1 + Time = Int(time) + let cpr = (bindata[6]>>2)&0x1 + CPRFormat = Int(cpr) + let lat:UInt32 = UInt32(bindata[6]&0x3)<<15 + UInt32(bindata[7])<<7 + UInt32(bindata[8]>>1) + Latitude = Int(lat) + let lon:UInt32 = UInt32(bindata[8]&0x1)<<16 + UInt32(bindata[9])<<8 + UInt32(bindata[10]) + Longitude = Int(lon) + } + + public var description: String { + var description = "SS \(SurveillanceStatus) SAF \(SingleAntennaFlag) Altitude \(Altitude)ft \n" + description += "Time \(Time) CPR \(CPRFormat)" + if (CPRFormat == 0) { + description += "even" + } else { + description += "odd" + } + description += "\n" + description += "Lat \(Latitude) Long \(Longitude)" + return description + } +} |
