diff options
Diffstat (limited to 'ADSBDecoderFramework/Decoder.swift')
| -rw-r--r-- | ADSBDecoderFramework/Decoder.swift | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/ADSBDecoderFramework/Decoder.swift b/ADSBDecoderFramework/Decoder.swift index a9724b6..17fce52 100644 --- a/ADSBDecoderFramework/Decoder.swift +++ b/ADSBDecoderFramework/Decoder.swift @@ -20,11 +20,11 @@ func BarometricAltitudeFeat(_ altitude: UInt16) -> Int { return Int(altitude)*100-1000 } -class Decoder { +public class Decoder { var adsb_data: String = "" - var DataFormat: UInt32 = 0; - - init (_ adsb_data: String) { + public var DataFormat: UInt32 = 0; + + public init (_ adsb_data: String) { //print(adsb_data) self.adsb_data = adsb_data //get the first 8 bits as integer @@ -41,7 +41,7 @@ class Decoder { //print("Data Format \(DataFormat)") } - func getDataFormat17() -> DataFormat17? { + public func getDataFormat17() -> DataFormat17? { if (DataFormat != 17) { return nil @@ -77,12 +77,12 @@ func ICAO2String(_ b1: UInt8, _ b2: UInt8, _ b3: UInt8, _ b4: UInt8, _ b5: UInt8 return ICAOAlphabet(b1)+ICAOAlphabet(b2)+ICAOAlphabet(b3)+ICAOAlphabet(b4)+ICAOAlphabet(b5)+ICAOAlphabet(b6)+ICAOAlphabet(b7)+ICAOAlphabet(b8) } -class DataFormat17 { - +public class DataFormat17 { + let DataFormat=17 //0:5 var Capability=0 //5:7 - var AddressAnnounced=0 //8:31 - var TypeCode=0 //32:36 + 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 @@ -92,10 +92,10 @@ class DataFormat17 { var ParityIntegrity=0//88-111 //all avaliable message types - var messageIdentification:ADSBTypeCodeIndentification? = nil - var messageAirbornPositon:ADSBTypeCodeAirbonePositon? = nil - - init(_ adsb_data: String) { + public var messageIdentification:ADSBTypeCodeIndentification? = nil + public var messageAirbornPositon:ADSBTypeCodeAirbonePositon? = nil + + public init(_ adsb_data: String) { //print("Dataformat: 17!") //print(adsb_data) @@ -167,12 +167,12 @@ class DataFormat17 { } } -class ADSBTypeCodeIndentification: CustomStringConvertible { +public class ADSBTypeCodeIndentification: CustomStringConvertible { var TypeCode:Int = 4 var Category:Int = 0 - var ICAOName:String - - init(_ bindata:ArraySlice<UInt8>) { + public var ICAOName:String + + public init(_ bindata:ArraySlice<UInt8>) { let cat = bindata[4]&0x7 Category = Int(cat) let char_0 = bindata[5]>>2 @@ -189,24 +189,24 @@ class ADSBTypeCodeIndentification: CustomStringConvertible { //print("ICAO name \(ICAOName)") } - var description: String { + public var description: String { let description = "TypeCode \(TypeCode) Cat \(Category) Flight name \(ICAOName)" return description } } //DF17 message types codes 8 to 18 -class ADSBTypeCodeAirbonePositon:CustomStringConvertible { +public class ADSBTypeCodeAirbonePositon:CustomStringConvertible { var TypeCode:Int = 11 var SurveillanceStatus: Int = 0 var SingleAntennaFlag: Int = 0 - var Altitude: Int = 0 + public var Altitude: Int = 0 var Time: Int = 0 - var CPRFormat: Int = 0 - var Latitude: Int = 0 - var Longitude: Int = 0 - - init(_ bindata:ArraySlice<UInt8>) { + 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 @@ -224,7 +224,7 @@ class ADSBTypeCodeAirbonePositon:CustomStringConvertible { Longitude = Int(lon) } - var description: String { + public var description: String { var description = "SS \(SurveillanceStatus) SAF \(SingleAntennaFlag) Altitude \(Altitude)ft \n" description += "Time \(Time) CPR \(CPRFormat)" if (CPRFormat == 0) { |
