AsterixDisplayAnalyser.CAT34DecodeAndStore.Do C# (CSharp) Метод

Do() публичный статический Метод

public static Do ( byte Data ) : void
Data byte
Результат void
        public static void Do(byte[] Data)
        {
            /////////////////////////////////////////////////////////////////////////
            //
            // Next version of Category 002: PSR Radar, M-SSR Radar, Mode-S Station
            //                                               Length in bytes
            //

            // I002/000, Message Type                        1
            if (CAT34.I034DataItems[CAT34.ItemIDToIndex("000")].CurrentlyPresent == true)
            {
                CAT34I000UserData.DecodeCAT34I000(Data);
            }

            // 3 I034/030 Time-of-Day                           3
            if (CAT34.I034DataItems[CAT34.ItemIDToIndex("030")].CurrentlyPresent == true)
            {
                CAT34I030UserData.DecodeCAT34I030(Data);
            }
            // 4 I034/020 Sector Number                         1
            if (CAT34.I034DataItems[CAT34.ItemIDToIndex("020")].CurrentlyPresent == true)
            {
                CAT34I020UserData.DecodeCAT34I020(Data);
            }
            // 5 I034/041 Antenna Rotation Period               2
            if (CAT34.I034DataItems[CAT34.ItemIDToIndex("041")].CurrentlyPresent == true)
            {
                CAT34I041UserData.DecodeCAT34I041(Data);
            }
            // 6 I034/050 System Configuration and Status       1+
            if (CAT34.I034DataItems[CAT34.ItemIDToIndex("050")].CurrentlyPresent == true)
            {
                CAT34I050UserData.DecodeCAT34I050(Data);
            }
            // 7 I034/060 System Processing Mode                1+
            if (CAT34.I034DataItems[CAT34.ItemIDToIndex("060")].CurrentlyPresent == true)
            {
                CAT34I060UserData.DecodeCAT34I060(Data);
            }
            // FX

            // 8 I034/070 Message Count Values                  1+2N
            if (CAT34.I034DataItems[CAT34.ItemIDToIndex("070")].CurrentlyPresent == true)
            {
                CAT34I070UserData.DecodeCAT34I070(Data);
            }
            // 9 I034/100 Generic Polar Window                  8
            if (CAT34.I034DataItems[CAT34.ItemIDToIndex("100")].CurrentlyPresent == true)
            {
                CAT34I100UserData.DecodeCAT34I100(Data);
            }
            // 10 I034/110 Data Filter                          1
            if (CAT34.I034DataItems[CAT34.ItemIDToIndex("110")].CurrentlyPresent == true)
            {
                CAT34I110UserData.DecodeCAT34I110(Data);
            }
            // 11 I034/120 3D-Position of Data Source           8
            if (CAT34.I034DataItems[CAT34.ItemIDToIndex("120")].CurrentlyPresent == true)
            {
                CAT34I120UserData.DecodeCAT34I120(Data);
            }
            // 12 I034/090 Collimation Error                    2
            if (CAT34.I034DataItems[CAT34.ItemIDToIndex("090")].CurrentlyPresent == true)
            {
                CAT34I090UserData.DecodeCAT34I090(Data);
            }

            ////////////////////////////////////////////////////////////////////////////////////
            // All CAT34 data has been decoded, so lets save off the message data to the global
            // storage for latter usage

            MainASTERIXDataStorage.CAT34Data CAT34MessageData = new MainASTERIXDataStorage.CAT34Data();
            foreach (CAT34.CAT34DataItem Item in CAT34.I034DataItems)
            {
                CAT34.CAT34DataItem MyItem = new CAT34.CAT34DataItem();
                MyItem.CurrentlyPresent = Item.CurrentlyPresent;
                MyItem.Description = Item.Description;
                MyItem.HasBeenPresent = Item.HasBeenPresent;
                MyItem.ID = Item.ID;
                MyItem.value = Item.value;
                CAT34MessageData.CAT34DataItems.Add(MyItem);
            }
            MainASTERIXDataStorage.CAT34Message.Add(CAT34MessageData);
            CAT34.Intitialize(false);
        }

Usage Example

Пример #1
0
        public string[] Decode(byte[] DataBlockBuffer, string Time, out int NumOfMessagesDecoded)
        {
            // Define output data buffer
            string[] DataOut = new string[3000];

            // Determine the size of the datablock
            int LengthOfDataBlockInBytes = DataBlockBuffer.Length;

            // Index into the array of record strings
            int DataOutIndex = 0;

            // Reset buffer indexes
            CurrentDataBufferOctalIndex = 0;
            int DataBufferIndexForThisExtraction = 0;

            // Determine SIC/SAC Index
            int SIC_Index = 0;
            int SAC_Index = 0;

            // Lenght of the current record's FSPECs
            int FSPEC_Length = 0;

            // Creates and initializes a BitVector32 with all bit flags set to FALSE.
            BitVector32 FourFSPECOctets = new BitVector32();

            while (DataBufferIndexForThisExtraction < LengthOfDataBlockInBytes)
            {
                // Assume that there will be no more than 1000 bytes in one record
                byte[] LocalSingleRecordBuffer = new byte[3000];

                Array.Copy(DataBlockBuffer, DataBufferIndexForThisExtraction, LocalSingleRecordBuffer, 0, (LengthOfDataBlockInBytes - DataBufferIndexForThisExtraction));

                // Get all four data words, but use only the number specifed
                // by the length of FSPEC words
                FourFSPECOctets = ASTERIX.GetFourFSPECOctets(LocalSingleRecordBuffer);

                // Determine Length of FSPEC fields in bytes
                FSPEC_Length = ASTERIX.DetermineLenghtOfFSPEC(LocalSingleRecordBuffer);

                // Check wether 010 is present
                if (FourFSPECOctets[Bit_Ops.Bit7] == true)
                {
                    // Determine SIC/SAC Index
                    SIC_Index = FSPEC_Length;
                    SAC_Index = SIC_Index + 1;

                    // Extract SIC/SAC Indexes.
                    DataOut[DataOutIndex] = LocalSingleRecordBuffer[SIC_Index].ToString() + '/' + LocalSingleRecordBuffer[SAC_Index].ToString();

                    // Save of the current data buffer index so it can be used by
                    // Decoder
                    CurrentDataBufferOctalIndex = SAC_Index + 1;
                }
                else
                {
                    // Extract SIC/SAC Indexes.
                    DataOut[DataOutIndex] = "---" + '/' + "---";
                }

                ///////////////////////////////////////////////////////////////////////////
                // Populate the current SIC/SAC and Time stamp for this meesage
                //
                I034DataItems[ItemIDToIndex("010")].value =
                    new ASTERIX.SIC_SAC_Time(LocalSingleRecordBuffer[SIC_Index], LocalSingleRecordBuffer[SAC_Index], ASTERIX.TimeOfReception);

                // Loop for each FSPEC and determine what data item is present
                for (int FSPEC_Index = 1; FSPEC_Index <= FSPEC_Length; FSPEC_Index++)
                {
                    switch (FSPEC_Index)
                    {
                    case 1:

                        // 010 Data Source Identifier
                        if (FourFSPECOctets[Bit_Ops.Bit7] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  010:T";
                            I034DataItems[ItemIDToIndex("010")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("010")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  010:F";
                            I034DataItems[ItemIDToIndex("010")].CurrentlyPresent = false;
                        }

                        // 000 Message Type
                        if (FourFSPECOctets[Bit_Ops.Bit6] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  000:T";
                            I034DataItems[ItemIDToIndex("000")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("000")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  000:F";
                            I034DataItems[ItemIDToIndex("000")].CurrentlyPresent = false;
                        }

                        // 030 Time-of-Day
                        if (FourFSPECOctets[Bit_Ops.Bit5] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  030:T";
                            I034DataItems[ItemIDToIndex("030")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("030")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  030:F";
                            I034DataItems[ItemIDToIndex("030")].CurrentlyPresent = false;
                        }

                        // 020 Sector Number
                        if (FourFSPECOctets[Bit_Ops.Bit4] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  020:T";
                            I034DataItems[ItemIDToIndex("020")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("020")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  020:F";
                            I034DataItems[ItemIDToIndex("020")].CurrentlyPresent = false;
                        }

                        // 041 Antenna Rotation Period
                        if (FourFSPECOctets[Bit_Ops.Bit3] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  041:T";
                            I034DataItems[ItemIDToIndex("041")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("041")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  041:F";
                            I034DataItems[ItemIDToIndex("041")].CurrentlyPresent = false;
                        }

                        // 050 System Configuration and Status
                        if (FourFSPECOctets[Bit_Ops.Bit2] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  050:T";
                            I034DataItems[ItemIDToIndex("050")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("050")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  050:F";
                            I034DataItems[ItemIDToIndex("050")].CurrentlyPresent = false;
                        }

                        // 060 System Processing Mode
                        if (FourFSPECOctets[Bit_Ops.Bit1] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  060:T";
                            I034DataItems[ItemIDToIndex("060")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("060")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  060:F";
                            I034DataItems[ItemIDToIndex("060")].CurrentlyPresent = false;
                        }

                        break;

                    case 2:

                        // 070 Message Count Values
                        if (FourFSPECOctets[Bit_Ops.Bit15] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  070:T";
                            I034DataItems[ItemIDToIndex("070")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("070")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  070:F";
                            I034DataItems[ItemIDToIndex("070")].CurrentlyPresent = false;
                        }

                        // 100 Generic Polar Window
                        if (FourFSPECOctets[Bit_Ops.Bit14] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  100:T";
                            I034DataItems[ItemIDToIndex("100")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("100")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  100:F";
                            I034DataItems[ItemIDToIndex("100")].CurrentlyPresent = false;
                        }

                        // 110 Data Filter
                        if (FourFSPECOctets[Bit_Ops.Bit13] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  110:T";
                            I034DataItems[ItemIDToIndex("110")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("110")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  110:F";
                            I034DataItems[ItemIDToIndex("110")].CurrentlyPresent = false;
                        }

                        // 120 3D-Position of Data Source
                        if (FourFSPECOctets[Bit_Ops.Bit12] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  120:T";
                            I034DataItems[ItemIDToIndex("120")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("120")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  120:F";
                            I034DataItems[ItemIDToIndex("120")].CurrentlyPresent = false;
                        }

                        // 090 Collimation Error
                        if (FourFSPECOctets[Bit_Ops.Bit11] == true)
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  090:T";
                            I034DataItems[ItemIDToIndex("090")].HasBeenPresent   = true;
                            I034DataItems[ItemIDToIndex("090")].CurrentlyPresent = true;
                        }
                        else
                        {
                            DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  090:F";
                            I034DataItems[ItemIDToIndex("090")].CurrentlyPresent = false;
                        }
                        break;

                    // Handle errors
                    default:
                        DataOut[DataOutIndex] = DataOut[DataOutIndex] + "  UKN:T";
                        break;
                    }
                }

                DataOutIndex++;
                CAT34DecodeAndStore.Do(LocalSingleRecordBuffer);
                DataBufferIndexForThisExtraction = DataBufferIndexForThisExtraction + CurrentDataBufferOctalIndex + 1;
            }

            // Return decoded data
            NumOfMessagesDecoded = DataOutIndex;
            // Return decoded data
            return(DataOut);
        }
CAT34DecodeAndStore