diff options
| author | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2025-11-17 00:32:31 +0000 |
|---|---|---|
| committer | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2025-11-17 00:32:31 +0000 |
| commit | 2b599499dc26f0f93537d1bea4733eae68333a1c (patch) | |
| tree | dc3b177aa2c5cfcf88cf4d5012bb0555c9f7fb5e /LearnMapKit/ADSBDataQueue.swift | |
| parent | 9070c9e6b7c7ce5671f4fad85e4aefa8c27aad28 (diff) | |
| download | ADSBDecoder-2b599499dc26f0f93537d1bea4733eae68333a1c.tar.gz ADSBDecoder-2b599499dc26f0f93537d1bea4733eae68333a1c.zip | |
Save old work that I have no clue what I where doing
Diffstat (limited to 'LearnMapKit/ADSBDataQueue.swift')
| -rw-r--r-- | LearnMapKit/ADSBDataQueue.swift | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/LearnMapKit/ADSBDataQueue.swift b/LearnMapKit/ADSBDataQueue.swift index ada0ab5..d3777ec 100644 --- a/LearnMapKit/ADSBDataQueue.swift +++ b/LearnMapKit/ADSBDataQueue.swift @@ -8,23 +8,26 @@ import Foundation import Collections +///Tag for location struct ADSBLocation { let address: Int let lat: Double let long: Double //let alt: Int } - +/// Tag for Altitude struct ADSBAltitude { let address: Int let altitude: Int } +/// Tag for ICAO name struct ADSBICAOname { let address: Int let ICAOname: String } - +/// Tag enum for data stream +/// enum DataStreamType { case EMPTY case ADSB_ICAO @@ -32,7 +35,7 @@ enum DataStreamType { case ADSB_ALTITUDE } -//get stream of decoded data, to tagged stream so all can be processed in sequence +/// get stream of decoded data, to tagged stream so all can be processed in sequence class ADSBDataQueue { //var icaoQueue: Deque<ADSBICAOname> = [] var icaoArray: Array<ADSBICAOname> = [] @@ -41,6 +44,8 @@ class ADSBDataQueue { //var tagQueue: Deque<> = [] var tagArray: Array<DataStreamType> = [] + ///get the last tag from a queue + ///user handles what todo with this data func getNextTag() -> DataStreamType { if tagArray.count < 0 { return DataStreamType.EMPTY @@ -48,6 +53,7 @@ class ADSBDataQueue { return tagArray[tagArray.count-1] } + func addIcaoName(_ address: Int, _ icaoname: String) { tagArray.append(DataStreamType.ADSB_ICAO) icaoArray.append(ADSBICAOname(address: address, ICAOname: icaoname)) @@ -63,6 +69,8 @@ class ADSBDataQueue { locQueue.append(ADSBLocation(address: address, lat: lat, long: long)) } + ///let read next tag in a queue, that is ICAO name + ///user handles order in a queue for now func getIcaoName() -> ADSBICAOname { if tagArray.count < 1 { print("ADSB tag Queue is empty") @@ -81,6 +89,8 @@ class ADSBDataQueue { return ret_icao_name } + ///let read next tag in a queue, that is Altitude + ///user handles order in a queue for now func getAltitude() -> ADSBAltitude { if tagArray.count < 1 { print("ADSB tag Queue is empty") @@ -95,6 +105,8 @@ class ADSBDataQueue { return altQueue.popLast()! } + ///let read next tag in a queue, that is the location + ///user handles order in a queue for now func getLocation() -> ADSBLocation { if tagArray.count < 1 { print("ADSB tag Queue is empry") @@ -109,6 +121,7 @@ class ADSBDataQueue { return locQueue.popLast()! } + //check if there is more then specified number in queue func haveNum(_ num: Int) -> Bool { if (tagArray.count > num) { return true @@ -116,6 +129,7 @@ class ADSBDataQueue { return false } + ///get number in the queue func getCount() -> Int { return tagArray.count } |
