Esempio n. 1
0
        public string Decode(byte[] Data, string Time)
        {
            // Define output data buffer
            string DataOut;

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

            // Determine SIC/SAC Index
            int SIC_Index = 2 + FSPEC_Length;
            int SAC_Index = SIC_Index + 1;

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

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

            // 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 = DataOut + "  010:T";
                        I063DataItems[ItemIDToIndex("010")].IsPresent = true;
                    }
                    else
                    {
                        DataOut = DataOut + "  010:F";
                    }

                    //  015, Service Identification
                    if (FourFSPECOctets[Bit_Ops.Bit6] == true)
                    {
                        DataOut = DataOut + "  015:T";
                        I063DataItems[ItemIDToIndex("015")].IsPresent = true;
                    }
                    else
                    {
                        DataOut = DataOut + "  015:F";
                    }

                    //  030, Time of Message
                    if (FourFSPECOctets[Bit_Ops.Bit5] == true)
                    {
                        DataOut = DataOut + "  030:T";
                        I063DataItems[ItemIDToIndex("030")].IsPresent = true;
                    }
                    else
                    {
                        DataOut = DataOut + "  030:F";
                    }

                    //  050, Sensor Identifier
                    if (FourFSPECOctets[Bit_Ops.Bit4] == true)
                    {
                        DataOut = DataOut + "  050:T";
                        I063DataItems[ItemIDToIndex("050")].IsPresent = true;
                    }
                    else
                    {
                        DataOut = DataOut + "  050:F";
                    }

                    //  060, Sensor Configuration and Status
                    if (FourFSPECOctets[Bit_Ops.Bit3] == true)
                    {
                        DataOut = DataOut + "  060:T";
                        I063DataItems[ItemIDToIndex("060")].IsPresent = true;
                    }
                    else
                    {
                        DataOut = DataOut + "  060:F";
                    }

                    //  070, Time Stamping Bias
                    if (FourFSPECOctets[Bit_Ops.Bit2] == true)
                    {
                        DataOut = DataOut + "  070:T";
                        I063DataItems[ItemIDToIndex("070")].IsPresent = true;
                    }
                    else
                    {
                        DataOut = DataOut + "  070:F";
                    }

                    //  080, SSR / Mode S Range Gain and Bias
                    if (FourFSPECOctets[Bit_Ops.Bit1] == true)
                    {
                        DataOut = DataOut + "  080:T";
                        I063DataItems[ItemIDToIndex("080")].IsPresent = true;
                    }
                    else
                    {
                        DataOut = DataOut + "  080:F";
                    }

                    break;

                case 2:

                    //  081, SSR / Mode S Azimuth Bias
                    if (FourFSPECOctets[Bit_Ops.Bit15] == true)
                    {
                        DataOut = DataOut + "  081:T";
                        I063DataItems[ItemIDToIndex("081")].IsPresent = true;
                    }
                    else
                    {
                        DataOut = DataOut + "  081:F";
                    }

                    //  090, PSR Range Gain and Bias
                    if (FourFSPECOctets[Bit_Ops.Bit14] == true)
                    {
                        DataOut = DataOut + "  090:T";
                        I063DataItems[ItemIDToIndex("090")].IsPresent = true;
                    }
                    else
                    {
                        DataOut = DataOut + "  090:F";
                    }

                    //  091, PSR Azimuth Bias
                    if (FourFSPECOctets[Bit_Ops.Bit13] == true)
                    {
                        DataOut = DataOut + "  091:T";
                        I063DataItems[ItemIDToIndex("091")].IsPresent = true;
                    }
                    else
                    {
                        DataOut = DataOut + "  091:F";
                    }

                    //  092, PSR Elevation Bias
                    if (FourFSPECOctets[Bit_Ops.Bit12] == true)
                    {
                        DataOut = DataOut + "  092:T";
                        I063DataItems[ItemIDToIndex("092")].IsPresent = true;
                    }
                    else
                    {
                        DataOut = DataOut + "  092:F";
                    }

                    // Spare
                    if (FourFSPECOctets[Bit_Ops.Bit11] == true)
                    {
                        DataOut = DataOut + "  SPR:T";
                    }
                    else
                    {
                        DataOut = DataOut + "  SPR:F";
                    }

                    // RE Reserved Expansion Field
                    if (FourFSPECOctets[Bit_Ops.Bit10] == true)
                    {
                        DataOut = DataOut + "  RES:T";
                    }
                    else
                    {
                        DataOut = DataOut + "  RES:F";
                    }

                    // SP Special Purpose Field
                    if (FourFSPECOctets[Bit_Ops.Bit9] == true)
                    {
                        DataOut = DataOut + "  SPF:T";
                    }
                    else
                    {
                        DataOut = DataOut + "  SPF:F";
                    }

                    break;

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

                CAT63DecodeAndStore.Do(Data);
            }

            // Return decoded data
            return(DataOut);
        }