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
|
//
// ADSBTypeCodeIndentification.swift
// ADSBDecoder
//
// Created by Jacky Jack on 27/09/2026.
//
public class ADSBTypeCodeIndentification: CustomStringConvertible {
var TypeCode:Int = 4
var Category:Int = 0
public var ICAOName:String
public init(_ bindata:ArraySlice<UInt8>) {
let cat = bindata[4]&0x7
Category = Int(cat)
let char_0 = bindata[5]>>2
let char_1 = (bindata[5]&0x3)<<4 + bindata[6]>>4
let char_2 = (bindata[6]&0xf)<<2 + (bindata[7]>>6)&0x3
let char_3 = (bindata[7])&0x3f
let char_4 = bindata[8]>>2
let char_5 = (bindata[8]&0x3)<<4 + bindata[9]>>4
let char_6 = (bindata[9]&0xf)<<2 + (bindata[10]>>6)
let char_7 = bindata[10]&0x3f
//print(char_0, char_1, char_2,char_3,char_4,char_5,char_6,char_7)
ICAOName = ICAO2String(char_0, char_1, char_2, char_3, char_4, char_5, char_6, char_7)
//print("ICAO name \(ICAOName)")
}
public var description: String {
let description = "TypeCode \(TypeCode) Cat \(Category) Flight name \(ICAOName)"
return description
}
}
|