예제 #1
0
        public static void DecodeCAT48I130(byte[] Data)
        {
            // At this time we do not care about the content of CAT048I130.
            // However it is necessary to determine how many subfields of 8 octets
            // is present so that data buffer can be updated accordingly on order to
            // decode the other fileds of interest
            // NOTE: We assume that only first 7 defined subfuled

            // I048/130     Radar Plot Characteristics                          1 + 1+
            int Number_Of_Octets_Present = 1; // at least two, but that will be determined below

            // Decode 020
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("130")].HasBeenPresent == true)
            {
                // Get an instance of bit ops
                Bit_Ops BO = new Bit_Ops();

                //Extract the first octet
                BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 1];

                // Now check how many data octets is present.
                if (BO.DWord[CAT48I130Types.Subfiled_1] == true)
                {
                    Number_Of_Octets_Present++;
                }
                if (BO.DWord[CAT48I130Types.Subfiled_2] == true)
                {
                    Number_Of_Octets_Present++;
                }
                if (BO.DWord[CAT48I130Types.Subfiled_3] == true)
                {
                    Number_Of_Octets_Present++;
                }
                if (BO.DWord[CAT48I130Types.Subfiled_4] == true)
                {
                    Number_Of_Octets_Present++;
                }
                if (BO.DWord[CAT48I130Types.Subfiled_5] == true)
                {
                    Number_Of_Octets_Present++;
                }
                if (BO.DWord[CAT48I130Types.Subfiled_6] == true)
                {
                    Number_Of_Octets_Present++;
                }
                if (BO.DWord[CAT48I130Types.Subfiled_7] == true)
                {
                    Number_Of_Octets_Present++;
                }

                // Increase data buffer index so it ready for the next data item.
                CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + Number_Of_Octets_Present;
            }
        }
예제 #2
0
        public static void DecodeCAT48I090(byte[] Data)
        {
            // A new instance of the CAT48I070 data
            CAT48I090Types.CAT48I090FlightLevelUserData MyCAT48I090 = new CAT48I090Types.CAT48I090FlightLevelUserData();

            // Get an instance of bit ops
            Bit_Ops BO = new Bit_Ops();

            BO.DWord[Bit_Ops.Bits0_7_Of_DWord]  = Data[CAT48.CurrentDataBufferOctalIndex + 2];
            BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 1];

            //////////////////////////////////////////////////////////////////////////////////
            // Decode Code validation
            if (BO.DWord[Bit_Ops.Bit15] == true)
            {
                MyCAT48I090.Code_Validated = CAT48I090Types.Code_Validation_Type.Code_Not_Validated;
            }
            else
            {
                MyCAT48I090.Code_Validated = CAT48I090Types.Code_Validation_Type.Code_Validated;
            }

            //////////////////////////////////////////////////////////////////////////////////
            // Decode Code Garbling
            if (BO.DWord[Bit_Ops.Bit14] == true)
            {
                MyCAT48I090.Code_Garbled = CAT48I090Types.Code_Garbled_Type.Code_Garbled;
            }
            else
            {
                MyCAT48I090.Code_Garbled = CAT48I090Types.Code_Garbled_Type.Code_Not_Garbled;
            }

            //////////////////////////////////////////////////////////////////////////////////
            // Decode the flight level
            MyCAT48I090.FlightLevel = DecodeFlightLevel(BO);

            //////////////////////////////////////////////////////////////////////////////////
            // Now assign it to the generic list
            CAT48.I048DataItems[CAT48.ItemIDToIndex("090")].value = MyCAT48I090;
            //////////////////////////////////////////////////////////////////////////////////

            // Increase data buffer index so it ready for the next data item.
            CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 2;
        }
예제 #3
0
        public static void DecodeCAT48I220(byte[] Data)
        {
            CAT48I220Types.CAT48AC_Address_Type MyCAT48AC_Address = new CAT48I220Types.CAT48AC_Address_Type();

            // Get all octets
            Bit_Ops Bits_1_To_Bits_32_ = new Bit_Ops();

            Bits_1_To_Bits_32_.DWord[Bit_Ops.Bits0_7_Of_DWord]   = Data[CAT48.CurrentDataBufferOctalIndex + 3];
            Bits_1_To_Bits_32_.DWord[Bit_Ops.Bits8_15_Of_DWord]  = Data[CAT48.CurrentDataBufferOctalIndex + 2];
            Bits_1_To_Bits_32_.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 1];
            MyCAT48AC_Address.Is_Valid          = true;
            MyCAT48AC_Address.AC_ADDRESS_String = Bits_1_To_Bits_32_.DWord.Data.ToString("X");

            //////////////////////////////////////////////////////////////////////////////////
            // Now assign it to the generic list
            CAT48.I048DataItems[CAT48.ItemIDToIndex("220")].value = MyCAT48AC_Address;

            // Increase data buffer index so it ready for the next data item.
            CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 3;
        }
예제 #4
0
        public static void DecodeCAT48I040(byte[] Data)
        {
            CAT48I040Types.CAT48I040MeasuredPosInPolarCoordinates MyCAT48I040 = new CAT48I040Types.CAT48I040MeasuredPosInPolarCoordinates();

            // Get an instance of bit ops
            Bit_Ops BO = new Bit_Ops();

            BO.DWord[Bit_Ops.Bits0_7_Of_DWord]   = Data[CAT48.CurrentDataBufferOctalIndex + 4];
            BO.DWord[Bit_Ops.Bits8_15_Of_DWord]  = Data[CAT48.CurrentDataBufferOctalIndex + 3];
            BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 2];
            BO.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 1];

            DecodeAzimuthAndDistance(ref MyCAT48I040.LatLong, out MyCAT48I040.Measured_Distance, out MyCAT48I040.Measured_Azimuth, BO);

            //////////////////////////////////////////////////////////////////////////////////
            // Now assign it to the generic list
            CAT48.I048DataItems[CAT48.ItemIDToIndex("040")].value = MyCAT48I040;
            //////////////////////////////////////////////////////////////////////////////////

            // Leave it at the current index for the next decode
            CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 4;
        }
예제 #5
0
        public static void DecodeCAT48I200(byte[] Data)
        {
            CAT48I200Types.CalculatedGSPandHDG_Type CalculatedGSPandHDG = new CAT48I200Types.CalculatedGSPandHDG_Type();

            // Get an instance of bit ops
            Bit_Ops BO = new Bit_Ops();

            BO.DWord[Bit_Ops.Bits0_7_Of_DWord]   = Data[CAT48.CurrentDataBufferOctalIndex + 4];
            BO.DWord[Bit_Ops.Bits8_15_Of_DWord]  = Data[CAT48.CurrentDataBufferOctalIndex + 3];
            BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 2];
            BO.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 1];

            CalculatedGSPandHDG.Is_Valid = true;

            ///////////////////////////////////////////////////////////////////////////////////////
            // Decode GSPD
            ///////////////////////////////////////////////////////////////////////////////////////
            if (BO.DWord[Bit_Ops.Bit16] == true)
            {
                CalculatedGSPandHDG.GSPD = GSPD_1;
            }
            if (BO.DWord[Bit_Ops.Bit17] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_2;
            }
            if (BO.DWord[Bit_Ops.Bit18] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_3;
            }
            if (BO.DWord[Bit_Ops.Bit19] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_4;
            }
            if (BO.DWord[Bit_Ops.Bit20] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_5;
            }
            if (BO.DWord[Bit_Ops.Bit21] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_6;
            }
            if (BO.DWord[Bit_Ops.Bit22] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_7;
            }
            if (BO.DWord[Bit_Ops.Bit23] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_8;
            }
            if (BO.DWord[Bit_Ops.Bit24] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_9;
            }
            if (BO.DWord[Bit_Ops.Bit25] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_10;
            }
            if (BO.DWord[Bit_Ops.Bit26] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_11;
            }
            if (BO.DWord[Bit_Ops.Bit27] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_12;
            }
            if (BO.DWord[Bit_Ops.Bit28] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_13;
            }
            if (BO.DWord[Bit_Ops.Bit29] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_14;
            }
            if (BO.DWord[Bit_Ops.Bit30] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_15;
            }
            if (BO.DWord[Bit_Ops.Bit31] == true)
            {
                CalculatedGSPandHDG.GSPD = CalculatedGSPandHDG.GSPD + GSPD_16;
            }

            ///////////////////////////////////////////////////////////////////////////////////////
            // Decode HDG
            ///////////////////////////////////////////////////////////////////////////////////////
            if (BO.DWord[Bit_Ops.Bit0] == true)
            {
                CalculatedGSPandHDG.HDG = HDG_1;
            }
            if (BO.DWord[Bit_Ops.Bit1] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_2;
            }
            if (BO.DWord[Bit_Ops.Bit2] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_3;
            }
            if (BO.DWord[Bit_Ops.Bit3] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_4;
            }
            if (BO.DWord[Bit_Ops.Bit4] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_5;
            }
            if (BO.DWord[Bit_Ops.Bit5] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_6;
            }
            if (BO.DWord[Bit_Ops.Bit6] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_7;
            }
            if (BO.DWord[Bit_Ops.Bit7] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_8;
            }
            if (BO.DWord[Bit_Ops.Bit8] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_9;
            }
            if (BO.DWord[Bit_Ops.Bit9] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_10;
            }
            if (BO.DWord[Bit_Ops.Bit10] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_11;
            }
            if (BO.DWord[Bit_Ops.Bit11] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_12;
            }
            if (BO.DWord[Bit_Ops.Bit12] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_13;
            }
            if (BO.DWord[Bit_Ops.Bit13] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_14;
            }
            if (BO.DWord[Bit_Ops.Bit14] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_15;
            }
            if (BO.DWord[Bit_Ops.Bit15] == true)
            {
                CalculatedGSPandHDG.HDG = CalculatedGSPandHDG.HDG + HDG_16;
            }

            //////////////////////////////////////////////////////////////////////////////////
            // Now assign it to the generic list
            CAT48.I048DataItems[CAT48.ItemIDToIndex("200")].value = CalculatedGSPandHDG;
            //////////////////////////////////////////////////////////////////////////////////

            CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 4;
        }
예제 #6
0
        public static void DecodeCAT48I140(byte[] Data)
        {
            // Get an instance of bit ops
            Bit_Ops BO = new Bit_Ops();

            BO.DWord[Bit_Ops.Bits0_7_Of_DWord]   = Data[CAT48.CurrentDataBufferOctalIndex + 2];
            BO.DWord[Bit_Ops.Bits8_15_Of_DWord]  = Data[CAT48.CurrentDataBufferOctalIndex + 1];
            BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex];

            CAT48I140Types.CAT48140ElapsedTimeSinceMidnight Result = new CAT48I140Types.CAT48140ElapsedTimeSinceMidnight();

            if (BO.DWord[Bit_Ops.Bit0] == true)
            {
                Result.ElapsedTimeSinceMidnight = FIX_POINT_1;
            }
            if (BO.DWord[Bit_Ops.Bit1] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_2;
            }
            if (BO.DWord[Bit_Ops.Bit2] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_3;
            }
            if (BO.DWord[Bit_Ops.Bit3] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_4;
            }
            if (BO.DWord[Bit_Ops.Bit4] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_5;
            }
            if (BO.DWord[Bit_Ops.Bit5] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_6;
            }
            if (BO.DWord[Bit_Ops.Bit6] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_7;
            }
            if (BO.DWord[Bit_Ops.Bit7] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_8;
            }
            if (BO.DWord[Bit_Ops.Bit8] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_9;
            }
            if (BO.DWord[Bit_Ops.Bit9] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_10;
            }
            if (BO.DWord[Bit_Ops.Bit10] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_11;
            }
            if (BO.DWord[Bit_Ops.Bit11] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_12;
            }
            if (BO.DWord[Bit_Ops.Bit12] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_13;
            }
            if (BO.DWord[Bit_Ops.Bit13] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_14;
            }
            if (BO.DWord[Bit_Ops.Bit14] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_15;
            }
            if (BO.DWord[Bit_Ops.Bit15] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_16;
            }
            if (BO.DWord[Bit_Ops.Bit16] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_17;
            }
            if (BO.DWord[Bit_Ops.Bit17] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_18;
            }
            if (BO.DWord[Bit_Ops.Bit18] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_19;
            }
            if (BO.DWord[Bit_Ops.Bit19] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_20;
            }
            if (BO.DWord[Bit_Ops.Bit20] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_21;
            }
            if (BO.DWord[Bit_Ops.Bit21] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_22;
            }
            if (BO.DWord[Bit_Ops.Bit22] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_23;
            }
            if (BO.DWord[Bit_Ops.Bit23] == true)
            {
                Result.ElapsedTimeSinceMidnight = Result.ElapsedTimeSinceMidnight + FIX_POINT_24;
            }

            //////////////////////////////////////////////////////////////////////////////////
            // Now assign it to the generic list
            CAT48.I048DataItems[CAT48.ItemIDToIndex("140")].value = Result;
            //////////////////////////////////////////////////////////////////////////////////

            // Increase data buffer index so it ready for the next data item.
            CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 3;
        }
예제 #7
0
        public static void DecodeCAT48I070(byte[] Data)
        {
            // A new instance of the CAT48I070 data
            CAT48I070Types.CAT48I070Mode3UserData MyCAT48I070 = new CAT48I070Types.CAT48I070Mode3UserData();

            // Get an instance of bit ops
            Bit_Ops BO = new Bit_Ops();

            BO.DWord[Bit_Ops.Bits0_7_Of_DWord]  = Data[CAT48.CurrentDataBufferOctalIndex + 2];
            BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 1];

            //////////////////////////////////////////////////////////////////////////////////
            // Decode Code validation
            if (BO.DWord[Bit_Ops.Bit15] == true)
            {
                MyCAT48I070.Code_Validated = CAT48I070Types.Code_Validation_Type.Code_Not_Validated;
            }
            else
            {
                MyCAT48I070.Code_Validated = CAT48I070Types.Code_Validation_Type.Code_Validated;
            }

            //////////////////////////////////////////////////////////////////////////////////
            // Decode Code Garbling
            if (BO.DWord[Bit_Ops.Bit14] == true)
            {
                MyCAT48I070.Code_Garbled = CAT48I070Types.Code_Garbled_Type.Code_Garbled;
            }
            else
            {
                MyCAT48I070.Code_Garbled = CAT48I070Types.Code_Garbled_Type.Code_Not_Garbled;
            }

            //////////////////////////////////////////////////////////////////////////////////
            // Decode Code Smothed or from Transponder
            if (BO.DWord[Bit_Ops.Bit13] == true)
            {
                MyCAT48I070.Code_Smothed_Or_From_Transponder = CAT48I070Types.Code_Smothed_Or_From_Transporder_Type.Code_Not_Extracted;
            }
            else
            {
                MyCAT48I070.Code_Smothed_Or_From_Transponder = CAT48I070Types.Code_Smothed_Or_From_Transporder_Type.Code_From_Transpodner;
            }

            //////////////////////////////////////////////////////////////////////////////////
            // Decode Code value
            int A = DetermineOctalFromTheeBoolean(BO.DWord[Bit_Ops.Bit9], BO.DWord[Bit_Ops.Bit10], BO.DWord[Bit_Ops.Bit11]);
            int B = DetermineOctalFromTheeBoolean(BO.DWord[Bit_Ops.Bit6], BO.DWord[Bit_Ops.Bit7], BO.DWord[Bit_Ops.Bit8]);
            int C = DetermineOctalFromTheeBoolean(BO.DWord[Bit_Ops.Bit3], BO.DWord[Bit_Ops.Bit4], BO.DWord[Bit_Ops.Bit5]);
            int D = DetermineOctalFromTheeBoolean(BO.DWord[Bit_Ops.Bit0], BO.DWord[Bit_Ops.Bit1], BO.DWord[Bit_Ops.Bit2]);

            MyCAT48I070.Mode3A_Code = A.ToString() + B.ToString() + C.ToString() + D.ToString();

            //////////////////////////////////////////////////////////////////////////////////
            // Now assign it to the generic list
            CAT48.I048DataItems[CAT48.ItemIDToIndex("070")].value = MyCAT48I070;
            //////////////////////////////////////////////////////////////////////////////////

            // Leave it at the current index for the next decode
            CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 2;
        }
예제 #8
0
        public static void DecodeCAT48I240(byte[] Data)
        {
            // A new instance of the CAT48I240 data
            CAT48I240Types.CAT48I240ACID_Data MyCAT48I240 = new CAT48I240Types.CAT48I240ACID_Data();

            // Get all 6 octets
            Bit_Ops Bits_1_To_Bits_32_  = new Bit_Ops();
            Bit_Ops Bits_33_To_Bits_48_ = new Bit_Ops();

            Bits_1_To_Bits_32_.DWord[Bit_Ops.Bits0_7_Of_DWord]   = Data[CAT48.CurrentDataBufferOctalIndex + 6];
            Bits_1_To_Bits_32_.DWord[Bit_Ops.Bits8_15_Of_DWord]  = Data[CAT48.CurrentDataBufferOctalIndex + 5];
            Bits_1_To_Bits_32_.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 4];
            Bits_1_To_Bits_32_.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 3];

            Bits_33_To_Bits_48_.DWord[Bit_Ops.Bits0_7_Of_DWord]  = Data[CAT48.CurrentDataBufferOctalIndex + 2];
            Bits_33_To_Bits_48_.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 1];


            Bit_Ops Char1 = new Bit_Ops();

            Char1.DWord[Bit_Ops.Bits0_7_Of_DWord] = 0;
            Bit_Ops Char2 = new Bit_Ops();

            Char2.DWord[Bit_Ops.Bits0_7_Of_DWord] = 0;
            Bit_Ops Char3 = new Bit_Ops();

            Char3.DWord[Bit_Ops.Bits0_7_Of_DWord] = 0;
            Bit_Ops Char4 = new Bit_Ops();

            Char4.DWord[Bit_Ops.Bits0_7_Of_DWord] = 0;
            Bit_Ops Char5 = new Bit_Ops();

            Char5.DWord[Bit_Ops.Bits0_7_Of_DWord] = 0;
            Bit_Ops Char6 = new Bit_Ops();

            Char6.DWord[Bit_Ops.Bits0_7_Of_DWord] = 0;
            Bit_Ops Char7 = new Bit_Ops();

            Char7.DWord[Bit_Ops.Bits0_7_Of_DWord] = 0;
            Bit_Ops Char8 = new Bit_Ops();

            Char8.DWord[Bit_Ops.Bits0_7_Of_DWord] = 0;

            /////////////////////////////////////////
            // Decode character 1
            Char1.DWord[Bit_Ops.Bit5] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit15];
            Char1.DWord[Bit_Ops.Bit4] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit14];
            Char1.DWord[Bit_Ops.Bit3] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit13];
            Char1.DWord[Bit_Ops.Bit2] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit12];
            Char1.DWord[Bit_Ops.Bit1] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit11];
            Char1.DWord[Bit_Ops.Bit0] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit10];

            Char2.DWord[Bit_Ops.Bit5] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit9];
            Char2.DWord[Bit_Ops.Bit4] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit8];
            Char2.DWord[Bit_Ops.Bit3] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit7];
            Char2.DWord[Bit_Ops.Bit2] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit6];
            Char2.DWord[Bit_Ops.Bit1] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit5];
            Char2.DWord[Bit_Ops.Bit0] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit4];

            Char3.DWord[Bit_Ops.Bit5] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit3];
            Char3.DWord[Bit_Ops.Bit4] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit2];
            Char3.DWord[Bit_Ops.Bit3] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit1];
            Char3.DWord[Bit_Ops.Bit2] = Bits_33_To_Bits_48_.DWord[Bit_Ops.Bit0];
            Char3.DWord[Bit_Ops.Bit1] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit31];
            Char3.DWord[Bit_Ops.Bit0] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit30];

            Char4.DWord[Bit_Ops.Bit5] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit29];
            Char4.DWord[Bit_Ops.Bit4] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit28];
            Char4.DWord[Bit_Ops.Bit3] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit27];
            Char4.DWord[Bit_Ops.Bit2] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit26];
            Char4.DWord[Bit_Ops.Bit1] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit25];
            Char4.DWord[Bit_Ops.Bit0] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit24];

            Char5.DWord[Bit_Ops.Bit5] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit23];
            Char5.DWord[Bit_Ops.Bit4] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit22];
            Char5.DWord[Bit_Ops.Bit3] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit21];
            Char5.DWord[Bit_Ops.Bit2] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit20];
            Char5.DWord[Bit_Ops.Bit1] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit19];
            Char5.DWord[Bit_Ops.Bit0] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit18];

            Char6.DWord[Bit_Ops.Bit5] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit17];
            Char6.DWord[Bit_Ops.Bit4] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit16];
            Char6.DWord[Bit_Ops.Bit3] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit15];
            Char6.DWord[Bit_Ops.Bit2] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit14];
            Char6.DWord[Bit_Ops.Bit1] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit13];
            Char6.DWord[Bit_Ops.Bit0] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit12];

            Char7.DWord[Bit_Ops.Bit5] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit11];
            Char7.DWord[Bit_Ops.Bit4] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit10];
            Char7.DWord[Bit_Ops.Bit3] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit9];
            Char7.DWord[Bit_Ops.Bit2] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit8];
            Char7.DWord[Bit_Ops.Bit1] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit7];
            Char7.DWord[Bit_Ops.Bit0] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit6];

            Char8.DWord[Bit_Ops.Bit5] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit5];
            Char8.DWord[Bit_Ops.Bit4] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit4];
            Char8.DWord[Bit_Ops.Bit3] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit3];
            Char8.DWord[Bit_Ops.Bit2] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit2];
            Char8.DWord[Bit_Ops.Bit1] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit1];
            Char8.DWord[Bit_Ops.Bit0] = Bits_1_To_Bits_32_.DWord[Bit_Ops.Bit0];

            MyCAT48I240.ACID = Decode6BitASCII(Char1.DWord[Bit_Ops.Bits0_7_Of_DWord]) +
                               Decode6BitASCII(Char2.DWord[Bit_Ops.Bits0_7_Of_DWord]) +
                               Decode6BitASCII(Char3.DWord[Bit_Ops.Bits0_7_Of_DWord]) +
                               Decode6BitASCII(Char4.DWord[Bit_Ops.Bits0_7_Of_DWord]) +
                               Decode6BitASCII(Char5.DWord[Bit_Ops.Bits0_7_Of_DWord]) +
                               Decode6BitASCII(Char6.DWord[Bit_Ops.Bits0_7_Of_DWord]) +
                               Decode6BitASCII(Char7.DWord[Bit_Ops.Bits0_7_Of_DWord]) +
                               Decode6BitASCII(Char8.DWord[Bit_Ops.Bits0_7_Of_DWord]);

            //////////////////////////////////////////////////////////////////////////////////
            // Now assign it to the generic list
            CAT48.I048DataItems[CAT48.ItemIDToIndex("240")].value = MyCAT48I240;
            //////////////////////////////////////////////////////////////////////////////////

            // Increase data buffer index so it ready for the next data item.
            CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 6;
        }
예제 #9
0
        // This method will accept a buffer of data with the assumption that
        // category has been determined. It will then decode the data and save
        // it in the shared buffer. Everry time a message is passed in the data
        // will be appended to the buffer. This means that each line will contain
        // data for one message. For data items which are not in the message,
        // indicated by the FSPEC field, N/A will be inserted instead. The shared
        // buffer is loacted in the SharedData and will not be saved. It is
        //  responsibility of the user to save the data in a file it desired.
        public static void Do(byte[] Data)
        {
            // I048/010     Data Source Identifier                          2
            // NO NEED to do anything this is handled in CAT01

            // I048/140 Time-of-Day                                         3
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("140")].CurrentlyPresent == true)
            {
                CAT48I140UserData.DecodeCAT48I140(Data);
            }

            // I048/020 Target Report Descriptor                            1+
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("020")].CurrentlyPresent == true)
            {
                CAT48I020UserData.DecodeCAT48I002(Data);
            }

            // I048/040 Measured Position in Slant Polar Coordinates        4
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("040")].CurrentlyPresent == true)
            {
                CAT48I040UserData.DecodeCAT48I040(Data);
            }

            // I048/070 Mode-3/A Code in Octal Representation               2
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("070")].CurrentlyPresent == true)
            {
                CAT48I070UserData.DecodeCAT48I070(Data);
            }

            // I048/090 Flight Level in Binary Representation               2
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("090")].CurrentlyPresent == true)
            {
                CAT48I090UserData.DecodeCAT48I090(Data);
            }

            // I048/130 Radar Plot Characteristics                          1 + 1+
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("130")].CurrentlyPresent == true)
            {
                CAT48I130UserData.DecodeCAT48I130(Data);
            }

            // n.a.         Field Extension Indicator

            // I048/220 Aircraft Address                                    3
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("220")].CurrentlyPresent == true)
            {
                CAT48I220UserData.DecodeCAT48I220(Data);
            }

            // I048/240 Aircraft Identification                             6
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("240")].CurrentlyPresent == true)
            {
                CAT48I240UserData.DecodeCAT48I240(Data);
            }

            // I048/250 Mode S MB Data                                      1+8*N
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("250")].CurrentlyPresent == true)
            {
                CAT48I250UserData.DecodeCAT48I250(Data);
            }

            // I048/161 Track Number                                        2
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("161")].CurrentlyPresent == true)
            {
                CAT48I161UserData.DecodeCAT48I161(Data);
            }

            // I048/042 Calculated Position in Cartesian Coordinates        4
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("042")].CurrentlyPresent == true)
            {
                CAT48I042UserData.DecodeCAT48I042(Data);
            }

            // I048/200 Calculated Track Velocity in Polar Representation   4
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("200")].CurrentlyPresent == true)
            {
                CAT48I200UserData.DecodeCAT48I200(Data);
            }

            // I048/170 Track Status                                        1+
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("170")].CurrentlyPresent == true)
            {
                CAT48I170UserData.DecodeCAT48I170(Data);
            }

            // n.a.         Field Extension Indicator

            // I048/210 Track Quality                                       4
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("210")].CurrentlyPresent == true)
            {
                CAT48I210UserData.DecodeCAT48I210(Data);
            }

            // I048/030 Warning/Error Conditions                            1+
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("030")].CurrentlyPresent == true)
            {
                CAT48I030UserData.DecodeCAT48I030(Data);
            }
            // I048/080 Mode-3/A Code Confidence Indicator                  2
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("080")].CurrentlyPresent == true)
            {
                CAT48I080UserData.DecodeCAT48I080(Data);
            }

            // I048/100 Mode-C Code and Confidence Indicator                4
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("100")].CurrentlyPresent == true)
            {
                CAT48I100UserData.DecodeCAT48I100(Data);
            }

            // I048/110 Height Measured by 3D Radar                         2
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("110")].CurrentlyPresent == true)
            {
                CAT48I110UserData.DecodeCAT48I110(Data);
            }

            // I048/120 Radial Doppler Speed                                1+
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("120")].CurrentlyPresent == true)
            {
                CAT48I120UserData.DecodeCAT48I120(Data);
            }

            // I048/230 Communications / ACAS Capability and Flight Status  2
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("230")].CurrentlyPresent == true)
            {
                CAT48I230UserData.DecodeCAT48I230(Data);
            }

            // n.a.         Field Extension Indicator

            // I048/260 ACAS Resolution Advisory Report                     7
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("260")].CurrentlyPresent == true)
            {
                CAT48I260UserData.DecodeCAT48I260(Data);
            }

            // I048/055 Mode-1 Code in Octal Representation                 1
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("055")].CurrentlyPresent == true)
            {
                CAT48I055UserData.DecodeCAT48I055(Data);
            }

            // I048/050, Mode-2 Code in Octal Representation
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("050")].CurrentlyPresent == true)
            {
                CAT48I050UserData.DecodeCAT48I050(Data);
            }

            // I048/065 Mode-1 Code Confidence Indicator                    1
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("065")].CurrentlyPresent == true)
            {
                CAT48I065UserData.DecodeCAT48I065(Data);
            }

            // I048/060 Mode-2 Code Confidence Indicator                    2
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("060")].CurrentlyPresent == true)
            {
                CAT48I060UserData.DecodeCAT48I060(Data);
            }

            //  Reserved for Special Purpose Indicator (SP)                       1+
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("SPI")].CurrentlyPresent == true)
            {
                CAT48ISPIUserData.DecodeCAT48ISPI(Data);
            }

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

            MainASTERIXDataStorage.CAT48Data CAT48MessageData = new MainASTERIXDataStorage.CAT48Data();

            foreach (CAT48.CAT48DataItem Item in CAT48.I048DataItems)
            {
                CAT48.CAT48DataItem MyItem = new CAT48.CAT48DataItem();

                MyItem.CurrentlyPresent = Item.CurrentlyPresent;
                MyItem.Description      = Item.Description;
                MyItem.HasBeenPresent   = Item.HasBeenPresent;
                MyItem.ID    = Item.ID;
                MyItem.value = Item.value;

                CAT48MessageData.CAT48DataItems.Add(MyItem);
            }

            MainASTERIXDataStorage.CAT48Message.Add(CAT48MessageData);
            CAT48.Intitialize(false);
        }
        private static void ExtractAndDecodeASTERIX_CAT_DataBlock(byte[] DataBlock, bool Is_Live_Data)
        {
            // First thing is to store the time of the reception regardless of the category received
            string Time = DateTime.Now.Hour.ToString().PadLeft(2, '0') + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0') + ":" +
                DateTime.Now.Second.ToString().PadLeft(2, '0') + ":" + DateTime.Now.Millisecond.ToString().PadLeft(3, '0');

            // Save off the time of reception so decoders can use it
            TimeOfReception = DateTime.Now;

            // Extract ASTERIX category
            string Category = ASTERIX.ExtractCategory(DataBlock);

            // Extract lenght in Bytes, as indicated by the ASTERIX
            string LengthOfDataBlockInBytes = ASTERIX.ExtractLengthOfDataBlockInBytes(DataBlock);

            // Here format the lenght of bytes
            // to always use 3 characters for better alignement
            if (LengthOfDataBlockInBytes.Length < 3)
            {
                LengthOfDataBlockInBytes = "0" + LengthOfDataBlockInBytes;
            }
            else if (LengthOfDataBlockInBytes.Length < 2)
            {
                LengthOfDataBlockInBytes = "00" + LengthOfDataBlockInBytes;
            }

            // Define a string to store data not specific for all messages and add commond data
            // 1. TIME of reception
            // 2. Source IP address
            // 3. Multicast IP address
            // 4. Length of data block in bytes
            // 5. Asterix Category
            //
            // 6. Append Category specifc data, done just below

            string Common_Message_Data_String;
            if (Is_Live_Data == true)
                Common_Message_Data_String = Time + "     " + iep.ToString() + "        " + SharedData.CurrentMulticastAddress + ':' + SharedData.Current_Port.ToString() + "             " + LengthOfDataBlockInBytes.ToString() + "        " + Category + "           ";
            else
                Common_Message_Data_String = Time + "     " + "Recorded" + "        " + "Recorded" + ':' + "Recorded" + "             " + LengthOfDataBlockInBytes.ToString() + "        " + Category + "           ";
            // Hold individual records of the messages
            // from an individual data block
            string[] MessageData = new string[3000];

            byte[] DataBlockNoCATandLEN = new byte[DataBlock.Length - 3];

            // Now after we extracted Category and Lenght of the Data Block lets remove the first three octets from the data
            // buffer and pass it on to individual message handlers to do message decoding
            Array.Copy(DataBlock, 3, DataBlockNoCATandLEN, 0, (DataBlock.Length - 3));

            DataBlock = DataBlockNoCATandLEN;

            // Now do a switch based on the category received
            int NumOfMsgsDecoded = 0;
            switch (Category)
            {
                // Monoradar Data Target Reports, from a Radar Surveillance System to an SDPS
                // (plots and tracks from PSRs, SSRs, MSSRs, excluding Mode S and ground surveillance)
                case "001":
                    if (Properties.Settings.Default.CAT_001_Enabled == true)
                    {
                        CAT01 MyCAT01 = new CAT01();
                        MessageData = MyCAT01.Decode(DataBlock, Time, out NumOfMsgsDecoded);
                    }
                    break;
                // Monoradar Service Messages (status, North marker, sector crossing messages)
                case "002":
                    if (Properties.Settings.Default.CAT_002_Enabled == true)
                    {
                        CAT02 MyCAT02 = new CAT02();
                        MessageData = MyCAT02.Decode(DataBlock, Time, out NumOfMsgsDecoded);
                    }
                    break;
                // Monoradar Derived Weather Information
                case "008":
                    if (Properties.Settings.Default.CAT_008_Enabled == true)
                    {
                        CAT08 MyCAT08 = new CAT08();
                    }
                    break;
                // Next version of Category 002: PSR Radar, M-SSR Radar, Mode-S Station
                case "034":
                    if (Properties.Settings.Default.CAT_034_Enabled == true)
                    {
                        CAT34 MyCAT34 = new CAT34();
                        MessageData = MyCAT34.Decode(DataBlock, Time, out NumOfMsgsDecoded);
                    }
                    break;
                // Next version of Category 001: PSR Radar, M-SSR Radar, Mode-S Station
                case "048":
                    if (Properties.Settings.Default.CAT_048_Enabled == true)
                    {
                        CAT48 MyCAT48 = new CAT48();
                        MessageData = MyCAT48.Decode(DataBlock, Time, out NumOfMsgsDecoded);
                    }
                    break;
                // System Track Data(next version of Category 030 & 011, also applicable to non-ARTAS systems)
                case "062":
                    if (Properties.Settings.Default.CAT_062_Enabled == true)
                    {
                        CAT62 MyCAT62 = new CAT62();
                        MessageData = MyCAT62.Decode(DataBlock, Time, out NumOfMsgsDecoded);
                    }
                    break;
                // Sensor Status Messages (SPDS)
                case "063":
                    if (Properties.Settings.Default.CAT_063_Enabled == true)
                    {
                        CAT63 MyCAT63 = new CAT63();
                    }
                    break;
                // SDPS Service Status Messages (SDPS)
                case "065":
                    if (Properties.Settings.Default.CAT_065_Enabled == true)
                    {
                        CAT65 MyCAT65 = new CAT65();
                    }
                    break;
                // Transmission of Reference Trajectory State Vectors
                case "244":
                    if (Properties.Settings.Default.CAT_244_Enabled == true)
                    {
                        CAT244 MyCAT244 = new CAT244();
                    }
                    break;
                // Handle unsupported data/categories
                default:
                    Common_Message_Data_String = Common_Message_Data_String + " Unsupported category " + Category + " has been received";
                    break;
            }

            if (Properties.Settings.Default.PopulateMainListBox == true)
            {
                for (int I = 0; I < NumOfMsgsDecoded; I++)
                    SharedData.DataBox.Items.Add(Common_Message_Data_String + MessageData[I]);
            }
        }
예제 #11
0
        public static void DecodeCAT48I002(byte[] Data)
        {
            // Decode 020
            if (CAT48.I048DataItems[CAT48.ItemIDToIndex("020")].HasBeenPresent == true)
            {
                // First define CAT48I002 class
                CAT48I020UserData MyI002UserData = new CAT48I020UserData();

                // Get an instance of bit ops
                Bit_Ops BO = new Bit_Ops();

                //Extract the first octet
                BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex];

                ///////////////////////////////////////////////////////////////////////////////////////////////////
                //
                int Type_Result = BitExtractor.GetIntFromThreeBits(BO.DWord[CAT48I020Types.Word1_TYP_Index_1], BO.DWord[CAT48I020Types.Word1_TYP_Index_2], BO.DWord[CAT48I020Types.Word1_TYP_Index_3]);

                switch (Type_Result)
                {
                // Monoradar Data Target Reports, from a Radar Surveillance System to an SDPS
                // (plots and tracks from PSRs, SSRs, MSSRs, excluding Mode S and ground surveillance)
                case 0:
                    MyI002UserData.Type_Of_Report = CAT48I020Types.Type_Of_Report_Type.No_Detection;
                    break;

                case 1:
                    MyI002UserData.Type_Of_Report = CAT48I020Types.Type_Of_Report_Type.Single_PSR;
                    break;

                case 2:
                    MyI002UserData.Type_Of_Report = CAT48I020Types.Type_Of_Report_Type.Single_SSR;
                    break;

                case 3:
                    MyI002UserData.Type_Of_Report = CAT48I020Types.Type_Of_Report_Type.SSR_PSR_Detection;
                    break;

                case 4:
                    MyI002UserData.Type_Of_Report = CAT48I020Types.Type_Of_Report_Type.Single_Mode_S_All_Call;
                    break;

                case 5:
                    MyI002UserData.Type_Of_Report = CAT48I020Types.Type_Of_Report_Type.Single_Mode_S_Roll_Call;
                    break;

                case 6:
                    MyI002UserData.Type_Of_Report = CAT48I020Types.Type_Of_Report_Type.Mode_S_All_Call_PSR;
                    break;

                case 7:
                    MyI002UserData.Type_Of_Report = CAT48I020Types.Type_Of_Report_Type.Mode_S_Roll_Call_PSR;
                    break;

                // Handle unsupported data/categories
                default:
                    break;
                }


                if (BO.DWord[CAT48I020Types.Word1_SIM_Index] == true)
                {
                    MyI002UserData.Simulated_Or_Actual = CAT48I020Types.Simulated_Or_Actual_Type.Simulated;
                }
                else
                {
                    MyI002UserData.Simulated_Or_Actual = CAT48I020Types.Simulated_Or_Actual_Type.Actual;
                }


                if (BO.DWord[CAT48I020Types.Word1_RDP_Index] == true)
                {
                    MyI002UserData.RDP_Chain = CAT48I020Types.RDP_Chain_Type.RDP_2;
                }
                else
                {
                    MyI002UserData.RDP_Chain = CAT48I020Types.RDP_Chain_Type.RDP_1;
                }


                if (BO.DWord[CAT48I020Types.Word1_SPI_Index] == true)
                {
                    MyI002UserData.Special_Position_Ind = CAT48I020Types.Special_Position_Ind_Type.SPI;
                }
                else
                {
                    MyI002UserData.Special_Position_Ind = CAT48I020Types.Special_Position_Ind_Type.NO_SPI;
                }


                if (BO.DWord[CAT48I020Types.Word1_FFT_Index] == true)
                {
                    MyI002UserData.Data_From_FFT = CAT48I020Types.Data_From_FFT_Type.From_FFT;
                }
                else
                {
                    MyI002UserData.Data_From_FFT = CAT48I020Types.Data_From_FFT_Type.Not_from_FFT;
                }


                ///////////////////////////////////////////////////////////////////////////////////////////////////
                //
                if (BO.DWord[CAT48I020Types.Word1_FX_Index] == false)
                {
                    MyI002UserData.Next_Extension_1 = CAT48I020Types.Next_Extension_Type.No;
                }

                else
                {
                    // OK we have a filed extension, so lets first move the data buffer to the next
                    // octet
                    CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 1;

                    //Extract the next octet
                    BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex];

                    if (BO.DWord[CAT48I020Types.Word2_TST_Index] == true)
                    {
                        MyI002UserData.Test_Target_Indicator = CAT48I020Types.Test_Target_Indicator_Type.Test_Target_Indicator;
                    }
                    else
                    {
                        MyI002UserData.Test_Target_Indicator = CAT48I020Types.Test_Target_Indicator_Type.Real_Target_Indicator;
                    }

                    if (BO.DWord[CAT48I020Types.Word2_MI_Index] == true)
                    {
                        MyI002UserData.Military_Emergency = CAT48I020Types.Military_Emergency_Type.Unknown_Data;
                    }
                    else
                    {
                        MyI002UserData.Military_Emergency = CAT48I020Types.Military_Emergency_Type.Unknown_Data;
                    }

                    if (BO.DWord[CAT48I020Types.Word2_ME_Index] == true)
                    {
                        MyI002UserData.Military_Identification = CAT48I020Types.Military_Identification_Type.Unknown_Data;
                    }
                    else
                    {
                        MyI002UserData.Military_Identification = CAT48I020Types.Military_Identification_Type.Unknown_Data;
                    }


                    if ((BO.DWord[CAT48I020Types.Word2_FOE_FRI_Start_Index] == true) && (BO.DWord[CAT48I020Types.Word2_FOE_FRI_End_Index] == true))
                    {
                        MyI002UserData.FOE_or_FRI = CAT48I020Types.FOE_or_FRI_Type.No_Replay;
                    }
                    else if (BO.DWord[CAT48I020Types.Word2_FOE_FRI_Start_Index] == true)
                    {
                        MyI002UserData.FOE_or_FRI = CAT48I020Types.FOE_or_FRI_Type.Frendly_Target;
                    }
                    else if (BO.DWord[CAT48I020Types.Word2_FOE_FRI_End_Index] == true)
                    {
                        MyI002UserData.FOE_or_FRI = CAT48I020Types.FOE_or_FRI_Type.Unknown_Target;
                    }
                    else
                    {
                        MyI002UserData.FOE_or_FRI = CAT48I020Types.FOE_or_FRI_Type.No_Mode_4;
                    }
                }
                //////////////////////////////////////////////////////////////////////////////////
                // Now assign it to the generic list
                CAT48.I048DataItems[CAT48.ItemIDToIndex("020")].value = MyI002UserData;
                //////////////////////////////////////////////////////////////////////////////////
            }
        }
        private static void ExtractAndDecodeASTERIX_CAT_DataBlock(byte[] DataBlock, bool Is_Live_Data)
        {
            // First thing is to store the time of the reception regardless of the category received
            string Time = DateTime.Now.Hour.ToString().PadLeft(2, '0') + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0') + ":" +
                          DateTime.Now.Second.ToString().PadLeft(2, '0') + ":" + DateTime.Now.Millisecond.ToString().PadLeft(3, '0');

            // Save off the time of reception so decoders can use it
            TimeOfReception = DateTime.Now;

            // Extract ASTERIX category
            string Category = ASTERIX.ExtractCategory(DataBlock);

            // Extract lenght in Bytes, as indicated by the ASTERIX
            string LengthOfDataBlockInBytes = ASTERIX.ExtractLengthOfDataBlockInBytes(DataBlock);

            // Here format the lenght of bytes
            // to always use 3 characters for better alignement
            if (LengthOfDataBlockInBytes.Length < 3)
            {
                LengthOfDataBlockInBytes = "0" + LengthOfDataBlockInBytes;
            }
            else if (LengthOfDataBlockInBytes.Length < 2)
            {
                LengthOfDataBlockInBytes = "00" + LengthOfDataBlockInBytes;
            }

            // Define a string to store data not specific for all messages and add commond data
            // 1. TIME of reception
            // 2. Source IP address
            // 3. Multicast IP address
            // 4. Length of data block in bytes
            // 5. Asterix Category
            //
            // 6. Append Category specifc data, done just below

            string Common_Message_Data_String;

            if (Is_Live_Data == true)
            {
                Common_Message_Data_String = Time + "     " + iep.ToString() + "        " + SharedData.CurrentMulticastAddress + ':' + SharedData.Current_Port.ToString() + "             " + LengthOfDataBlockInBytes.ToString() + "        " + Category + "           ";
            }
            else
            {
                Common_Message_Data_String = Time + "     " + "Recorded" + "        " + "Recorded" + ':' + "Recorded" + "             " + LengthOfDataBlockInBytes.ToString() + "        " + Category + "           ";
            }
            // Hold individual records of the messages
            // from an individual data block
            string[] MessageData = new string[3000];

            byte[] DataBlockNoCATandLEN = new byte[DataBlock.Length - 3];

            // Now after we extracted Category and Lenght of the Data Block lets remove the first three octets from the data
            // buffer and pass it on to individual message handlers to do message decoding
            Array.Copy(DataBlock, 3, DataBlockNoCATandLEN, 0, (DataBlock.Length - 3));

            DataBlock = DataBlockNoCATandLEN;

            // Now do a switch based on the category received
            int NumOfMsgsDecoded = 0;

            switch (Category)
            {
            // Monoradar Data Target Reports, from a Radar Surveillance System to an SDPS
            // (plots and tracks from PSRs, SSRs, MSSRs, excluding Mode S and ground surveillance)
            case "001":
                if (Properties.Settings.Default.CAT_001_Enabled == true)
                {
                    CAT01 MyCAT01 = new CAT01();
                    MessageData = MyCAT01.Decode(DataBlock, Time, out NumOfMsgsDecoded);
                }
                break;

            // Monoradar Service Messages (status, North marker, sector crossing messages)
            case "002":
                if (Properties.Settings.Default.CAT_002_Enabled == true)
                {
                    CAT02 MyCAT02 = new CAT02();
                    MessageData = MyCAT02.Decode(DataBlock, Time, out NumOfMsgsDecoded);
                }
                break;

            // Monoradar Derived Weather Information
            case "008":
                if (Properties.Settings.Default.CAT_008_Enabled == true)
                {
                    CAT08 MyCAT08 = new CAT08();
                }
                break;

            // Next version of Category 002: PSR Radar, M-SSR Radar, Mode-S Station
            case "034":
                if (Properties.Settings.Default.CAT_034_Enabled == true)
                {
                    CAT34 MyCAT34 = new CAT34();
                    MessageData = MyCAT34.Decode(DataBlock, Time, out NumOfMsgsDecoded);
                }
                break;

            // Next version of Category 001: PSR Radar, M-SSR Radar, Mode-S Station
            case "048":
                if (Properties.Settings.Default.CAT_048_Enabled == true)
                {
                    CAT48 MyCAT48 = new CAT48();
                    MessageData = MyCAT48.Decode(DataBlock, Time, out NumOfMsgsDecoded);
                }
                break;

            // System Track Data(next version of Category 030 & 011, also applicable to non-ARTAS systems)
            case "062":
                if (Properties.Settings.Default.CAT_062_Enabled == true)
                {
                    CAT62 MyCAT62 = new CAT62();
                    MessageData = MyCAT62.Decode(DataBlock, Time, out NumOfMsgsDecoded);
                }
                break;

            // Sensor Status Messages (SPDS)
            case "063":
                if (Properties.Settings.Default.CAT_063_Enabled == true)
                {
                    CAT63 MyCAT63 = new CAT63();
                }
                break;

            // SDPS Service Status Messages (SDPS)
            case "065":
                if (Properties.Settings.Default.CAT_065_Enabled == true)
                {
                    CAT65 MyCAT65 = new CAT65();
                }
                break;

            // Transmission of Reference Trajectory State Vectors
            case "244":
                if (Properties.Settings.Default.CAT_244_Enabled == true)
                {
                    CAT244 MyCAT244 = new CAT244();
                }
                break;

            // Handle unsupported data/categories
            default:
                Common_Message_Data_String = Common_Message_Data_String + " Unsupported category " + Category + " has been received";
                break;
            }

            if (Properties.Settings.Default.PopulateMainListBox == true)
            {
                for (int I = 0; I < NumOfMsgsDecoded; I++)
                {
                    SharedData.DataBox.Items.Add(Common_Message_Data_String + MessageData[I]);
                }
            }
        }
예제 #13
0
        private static void DecodeAzimuthAndDistance(ref GeoCordSystemDegMinSecUtilities.LatLongClass NewPosition, out double Distance, out double Azimuth, Bit_Ops BO)
        {
            double Distance_Loc = 0.0;
            double Azimuth_Loc  = 0.0;

            GeoCordSystemDegMinSecUtilities.LatLongClass ResultPosition = new GeoCordSystemDegMinSecUtilities.LatLongClass();
            ///////////////////////////////////////////////////////////////////////////////////////
            // Decode Distance
            ///////////////////////////////////////////////////////////////////////////////////////
            if (BO.DWord[Bit_Ops.Bit16] == true)
            {
                Distance_Loc = RHO_1;
            }
            if (BO.DWord[Bit_Ops.Bit17] == true)
            {
                Distance_Loc = Distance_Loc + RHO_2;
            }
            if (BO.DWord[Bit_Ops.Bit18] == true)
            {
                Distance_Loc = Distance_Loc + RHO_3;
            }
            if (BO.DWord[Bit_Ops.Bit19] == true)
            {
                Distance_Loc = Distance_Loc + RHO_4;
            }
            if (BO.DWord[Bit_Ops.Bit20] == true)
            {
                Distance_Loc = Distance_Loc + RHO_5;
            }
            if (BO.DWord[Bit_Ops.Bit21] == true)
            {
                Distance_Loc = Distance_Loc + RHO_6;
            }
            if (BO.DWord[Bit_Ops.Bit22] == true)
            {
                Distance_Loc = Distance_Loc + RHO_7;
            }
            if (BO.DWord[Bit_Ops.Bit23] == true)
            {
                Distance_Loc = Distance_Loc + RHO_8;
            }
            if (BO.DWord[Bit_Ops.Bit24] == true)
            {
                Distance_Loc = Distance_Loc + RHO_9;
            }
            if (BO.DWord[Bit_Ops.Bit25] == true)
            {
                Distance_Loc = Distance_Loc + RHO_10;
            }
            if (BO.DWord[Bit_Ops.Bit26] == true)
            {
                Distance_Loc = Distance_Loc + RHO_11;
            }
            if (BO.DWord[Bit_Ops.Bit27] == true)
            {
                Distance_Loc = Distance_Loc + RHO_12;
            }
            if (BO.DWord[Bit_Ops.Bit28] == true)
            {
                Distance_Loc = Distance_Loc + RHO_13;
            }
            if (BO.DWord[Bit_Ops.Bit29] == true)
            {
                Distance_Loc = Distance_Loc + RHO_14;
            }
            if (BO.DWord[Bit_Ops.Bit30] == true)
            {
                Distance_Loc = Distance_Loc + RHO_15;
            }
            if (BO.DWord[Bit_Ops.Bit31] == true)
            {
                Distance_Loc = Distance_Loc + RHO_16;
            }

            ///////////////////////////////////////////////////////////////////////////////////////
            // Decode Azimuth
            ///////////////////////////////////////////////////////////////////////////////////////
            if (BO.DWord[Bit_Ops.Bit0] == true)
            {
                Azimuth_Loc = THETA_1;
            }
            if (BO.DWord[Bit_Ops.Bit1] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_2;
            }
            if (BO.DWord[Bit_Ops.Bit2] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_3;
            }
            if (BO.DWord[Bit_Ops.Bit3] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_4;
            }
            if (BO.DWord[Bit_Ops.Bit4] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_5;
            }
            if (BO.DWord[Bit_Ops.Bit5] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_6;
            }
            if (BO.DWord[Bit_Ops.Bit6] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_7;
            }
            if (BO.DWord[Bit_Ops.Bit7] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_8;
            }
            if (BO.DWord[Bit_Ops.Bit8] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_9;
            }
            if (BO.DWord[Bit_Ops.Bit9] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_10;
            }
            if (BO.DWord[Bit_Ops.Bit10] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_11;
            }
            if (BO.DWord[Bit_Ops.Bit11] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_12;
            }
            if (BO.DWord[Bit_Ops.Bit12] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_13;
            }
            if (BO.DWord[Bit_Ops.Bit13] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_14;
            }
            if (BO.DWord[Bit_Ops.Bit14] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_15;
            }
            if (BO.DWord[Bit_Ops.Bit15] == true)
            {
                Azimuth_Loc = Azimuth_Loc + THETA_16;
            }

            Azimuth  = Azimuth_Loc;
            Distance = Distance_Loc;

            //////////////////////////////////////////////////////////////////////////////////
            //
            // Here loop through the defined radars and determine the source of the data.
            // Once the source is determined calculate the extact position of the target
            // by taking the position of the radar and applying the range and bearing.
            // Display time of reception
            //
            // Extract the current SIC/SAC so the correct radar can be applied
            //
            ASTERIX.SIC_SAC_Time SIC_SAC_TIME = (ASTERIX.SIC_SAC_Time)CAT48.I048DataItems[CAT48.ItemIDToIndex("010")].value;
            foreach (SystemAdaptationDataSet.Radar RDS in SystemAdaptationDataSet.RadarDataSet)
            {
                // If the current SIC/SAC code matched the code of one of the defined radars
                // then go ahead and calculate the Lat/Long position.
                if (RDS.SIC == SIC_SAC_TIME.SIC.ToString() && RDS.SAC == SIC_SAC_TIME.SAC.ToString())
                {
                    ResultPosition = GeoCordSystemDegMinSecUtilities.CalculateNewPosition(RDS.RadarPosition, Distance_Loc, Azimuth_Loc);
                }
            }

            NewPosition.SetPosition(ResultPosition.GetLatLongDecimal());
        }
예제 #14
0
        private void EarthPlotExporter_Load(object sender, EventArgs e)
        {
            // Each time the form is opened reset code lookup
            // and then populate based on the latest received
            // data
            for (int I = 0; I < SSR_Code_Lookup.Length; I++)
            {
                SSR_Code_Lookup[I] = false;
            }

            // On load determine what SSR codes are present end populate the combo box
            if (MainASTERIXDataStorage.CAT01Message.Count > 0)
            {
                foreach (MainASTERIXDataStorage.CAT01Data Msg in MainASTERIXDataStorage.CAT01Message)
                {
                    CAT01I070Types.CAT01070Mode3UserData MyData = (CAT01I070Types.CAT01070Mode3UserData)Msg.CAT01DataItems[CAT01.ItemIDToIndex("070")].value;
                    int Result;
                    if (MyData != null)
                    {
                        if (int.TryParse(MyData.Mode3A_Code, out Result) == true)
                        {
                            SSR_Code_Lookup[Result] = true;
                        }
                    }
                }
            }
            else if (MainASTERIXDataStorage.CAT48Message.Count > 0)
            {
                foreach (MainASTERIXDataStorage.CAT48Data Msg in MainASTERIXDataStorage.CAT48Message)
                {
                    CAT48I070Types.CAT48I070Mode3UserData MyData = (CAT48I070Types.CAT48I070Mode3UserData)Msg.CAT48DataItems[CAT48.ItemIDToIndex("070")].value;

                    int Result;
                    if (MyData != null)
                    {
                        if (int.TryParse(MyData.Mode3A_Code, out Result) == true)
                        {
                            SSR_Code_Lookup[Result] = true;
                        }
                    }
                }
            }
            else if (MainASTERIXDataStorage.CAT62Message.Count > 0)
            {
                foreach (MainASTERIXDataStorage.CAT62Data Msg in MainASTERIXDataStorage.CAT62Message)
                {
                    CAT62I060Types.CAT62060Mode3UserData MyData = (CAT62I060Types.CAT62060Mode3UserData)Msg.CAT62DataItems[CAT62.ItemIDToIndex("060")].value;

                    int Result;
                    if (MyData != null)
                    {
                        if (int.TryParse(MyData.Mode3A_Code, out Result) == true)
                        {
                            SSR_Code_Lookup[Result] = true;
                        }
                    }
                }
            }

            this.comboBox1.Items.Clear();
            for (int I = 0; I < SSR_Code_Lookup.Length; I++)
            {
                if (SSR_Code_Lookup[I] == true)
                {
                    this.comboBox1.Items.Add(I.ToString().PadLeft(4, '0'));
                }
            }

            if (this.comboBox1.Items.Count > 0)
            {
                this.comboBox1.SelectedIndex = 0;
            }

            this.labelNumberofCodes.Text = this.comboBox1.Items.Count.ToString();
        }
예제 #15
0
        private string BuildExportedData()
        {
            string Data         = "";
            int    TargetNumber = 1;

            if (TypeOfExporter == ExporterType.GePath)
            {
                // On load determine what SSR codes are present end populate the combo box
                if (MainASTERIXDataStorage.CAT01Message.Count > 0)
                {
                    foreach (MainASTERIXDataStorage.CAT01Data Msg in MainASTERIXDataStorage.CAT01Message)
                    {
                        CAT01I070Types.CAT01070Mode3UserData Mode3AData = (CAT01I070Types.CAT01070Mode3UserData)Msg.CAT01DataItems[CAT01.ItemIDToIndex("070")].value;
                        if (Mode3AData != null)
                        {
                            if (Mode3AData.Code_Validated == CAT01I070Types.Code_Validation_Type.Code_Validated)
                            {
                                if (Mode3AData.Mode3A_Code == (string)this.comboBox1.Items[this.comboBox1.SelectedIndex])
                                {
                                    // Get Lat/Long
                                    CAT01I040Types.CAT01I040MeasuredPosInPolarCoordinates LatLongData = (CAT01I040Types.CAT01I040MeasuredPosInPolarCoordinates)Msg.CAT01DataItems[CAT01.ItemIDToIndex("040")].value;
                                    // Get Flight Level
                                    CAT01I090Types.CAT01I090FlightLevelUserData FlightLevelData = (CAT01I090Types.CAT01I090FlightLevelUserData)Msg.CAT01DataItems[CAT01.ItemIDToIndex("090")].value;

                                    double LevelInMeeters = 0.0;
                                    if (FlightLevelData != null)
                                    {
                                        try
                                        {
                                            LevelInMeeters = (FlightLevelData.FlightLevel * 100.00) * SharedData.FeetToMeeters;
                                        }
                                        catch
                                        {
                                        }
                                    }

                                    Data = Data + "P" + TargetNumber.ToString() + "," + "SSR" + Mode3AData.Mode3A_Code + "_" + TargetNumber.ToString() + "," + LatLongData.LatLong.GetLatLongDecimal().LongitudeDecimal.ToString() +
                                           "," + LatLongData.LatLong.GetLatLongDecimal().LatitudeDecimal.ToString() + "," + LevelInMeeters.ToString() + Environment.NewLine;

                                    TargetNumber++;
                                }
                            }
                        }
                    }
                }
                else if (MainASTERIXDataStorage.CAT48Message.Count > 0)
                {
                    foreach (MainASTERIXDataStorage.CAT48Data Msg in MainASTERIXDataStorage.CAT48Message)
                    {
                        CAT48I070Types.CAT48I070Mode3UserData Mode3AData = (CAT48I070Types.CAT48I070Mode3UserData)Msg.CAT48DataItems[CAT48.ItemIDToIndex("070")].value;
                        if (Mode3AData != null)
                        {
                            if (Mode3AData.Code_Validated == CAT48I070Types.Code_Validation_Type.Code_Validated)
                            {
                                if (Mode3AData.Mode3A_Code == (string)this.comboBox1.Items[this.comboBox1.SelectedIndex])
                                {
                                    // Get Lat/Long in decimal
                                    CAT48I040Types.CAT48I040MeasuredPosInPolarCoordinates LatLongData = (CAT48I040Types.CAT48I040MeasuredPosInPolarCoordinates)Msg.CAT48DataItems[CAT48.ItemIDToIndex("040")].value;
                                    // Get Flight Level
                                    CAT48I090Types.CAT48I090FlightLevelUserData FlightLevelData = (CAT48I090Types.CAT48I090FlightLevelUserData)Msg.CAT48DataItems[CAT48.ItemIDToIndex("090")].value;

                                    double LevelInMeeters = 0.0;
                                    if (FlightLevelData != null)
                                    {
                                        try
                                        {
                                            LevelInMeeters = (FlightLevelData.FlightLevel * 100.00) * SharedData.FeetToMeeters;
                                        }
                                        catch
                                        {
                                        }
                                    }

                                    Data = Data + "P" + TargetNumber.ToString() + "," + "SSR" + Mode3AData.Mode3A_Code + "_" + TargetNumber.ToString() + "," + LatLongData.LatLong.GetLatLongDecimal().LongitudeDecimal.ToString() +
                                           "," + LatLongData.LatLong.GetLatLongDecimal().LatitudeDecimal.ToString() + "," + LevelInMeeters.ToString() + Environment.NewLine;

                                    TargetNumber++;
                                }
                            }
                        }
                    }
                }
                else if (MainASTERIXDataStorage.CAT62Message.Count > 0)
                {
                    foreach (MainASTERIXDataStorage.CAT62Data Msg in MainASTERIXDataStorage.CAT62Message)
                    {
                        CAT62I060Types.CAT62060Mode3UserData Mode3AData = (CAT62I060Types.CAT62060Mode3UserData)Msg.CAT62DataItems[CAT62.ItemIDToIndex("060")].value;

                        if (Mode3AData != null)
                        {
                            if (Mode3AData.Mode3A_Code == (string)this.comboBox1.Items[this.comboBox1.SelectedIndex])
                            {
                                // Get Lat/Long in decimal
                                GeoCordSystemDegMinSecUtilities.LatLongClass LatLongData = (GeoCordSystemDegMinSecUtilities.LatLongClass)Msg.CAT62DataItems[CAT62.ItemIDToIndex("105")].value;

                                double FlightLevelData = 0.0;
                                if (Msg.CAT62DataItems[CAT62.ItemIDToIndex("136")].value != null)
                                {
                                    try
                                    {
                                        // Get Flight Level
                                        FlightLevelData = (double)Msg.CAT62DataItems[CAT62.ItemIDToIndex("136")].value;
                                    }
                                    catch
                                    {
                                    }
                                }

                                double LevelInMeeters = (FlightLevelData * 100.00) * SharedData.FeetToMeeters;
                                Data = Data + "P" + TargetNumber.ToString() + "," + "SSR" + Mode3AData.Mode3A_Code + "_" + TargetNumber.ToString() + "," + LatLongData.GetLatLongDecimal().LongitudeDecimal.ToString() +
                                       "," + LatLongData.GetLatLongDecimal().LatitudeDecimal.ToString() + "," + LevelInMeeters.ToString() + Environment.NewLine;

                                TargetNumber++;
                            }
                        }
                    }
                }
            }
            else
            {
                // On load determine what SSR codes are present end populate the combo box
                if (MainASTERIXDataStorage.CAT01Message.Count > 0)
                {
                    foreach (MainASTERIXDataStorage.CAT01Data Msg in MainASTERIXDataStorage.CAT01Message)
                    {
                        CAT01I070Types.CAT01070Mode3UserData Mode3AData = (CAT01I070Types.CAT01070Mode3UserData)Msg.CAT01DataItems[CAT01.ItemIDToIndex("070")].value;

                        if (Mode3AData != null)
                        {
                            if (Mode3AData.Code_Validated == CAT01I070Types.Code_Validation_Type.Code_Validated)
                            {
                                if (Mode3AData.Mode3A_Code == (string)this.comboBox1.Items[this.comboBox1.SelectedIndex])
                                {
                                    // Get Lat/Long
                                    CAT01I040Types.CAT01I040MeasuredPosInPolarCoordinates LatLongData = (CAT01I040Types.CAT01I040MeasuredPosInPolarCoordinates)Msg.CAT01DataItems[CAT01.ItemIDToIndex("040")].value;
                                    // Get Flight Level
                                    CAT01I090Types.CAT01I090FlightLevelUserData FlightLevelData = (CAT01I090Types.CAT01I090FlightLevelUserData)Msg.CAT01DataItems[CAT01.ItemIDToIndex("090")].value;

                                    double LevelInMeeters = 0.0;
                                    if (FlightLevelData != null)
                                    {
                                        try
                                        {
                                            LevelInMeeters = (FlightLevelData.FlightLevel * 100.00) * SharedData.FeetToMeeters;
                                        }
                                        catch
                                        {
                                        }
                                    }

                                    Data = Data + LatLongData.LatLong.GetLatLongDecimal().LongitudeDecimal.ToString() +
                                           "," + LatLongData.LatLong.GetLatLongDecimal().LatitudeDecimal.ToString() + "," + LevelInMeeters.ToString() + Environment.NewLine;
                                }
                            }
                        }
                    }
                }
                else if (MainASTERIXDataStorage.CAT48Message.Count > 0)
                {
                    foreach (MainASTERIXDataStorage.CAT48Data Msg in MainASTERIXDataStorage.CAT48Message)
                    {
                        CAT48I070Types.CAT48I070Mode3UserData Mode3AData = (CAT48I070Types.CAT48I070Mode3UserData)Msg.CAT48DataItems[CAT48.ItemIDToIndex("070")].value;
                        if (Mode3AData != null)
                        {
                            if (Mode3AData.Code_Validated == CAT48I070Types.Code_Validation_Type.Code_Validated)
                            {
                                if (Mode3AData.Mode3A_Code == (string)this.comboBox1.Items[this.comboBox1.SelectedIndex])
                                {
                                    // Get Lat/Long in decimal
                                    CAT48I040Types.CAT48I040MeasuredPosInPolarCoordinates LatLongData = (CAT48I040Types.CAT48I040MeasuredPosInPolarCoordinates)Msg.CAT48DataItems[CAT48.ItemIDToIndex("040")].value;
                                    // Get Flight Level
                                    CAT48I090Types.CAT48I090FlightLevelUserData FlightLevelData = (CAT48I090Types.CAT48I090FlightLevelUserData)Msg.CAT48DataItems[CAT48.ItemIDToIndex("090")].value;

                                    double LevelInMeeters = 0.0;
                                    if (FlightLevelData != null)
                                    {
                                        try
                                        {
                                            LevelInMeeters = (FlightLevelData.FlightLevel * 100.00) * SharedData.FeetToMeeters;
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    Data = Data + LatLongData.LatLong.GetLatLongDecimal().LongitudeDecimal.ToString() +
                                           "," + LatLongData.LatLong.GetLatLongDecimal().LatitudeDecimal.ToString() + "," + LevelInMeeters.ToString() + Environment.NewLine;
                                }
                            }
                        }
                    }
                }
                else if (MainASTERIXDataStorage.CAT62Message.Count > 0)
                {
                    foreach (MainASTERIXDataStorage.CAT62Data Msg in MainASTERIXDataStorage.CAT62Message)
                    {
                        CAT62I060Types.CAT62060Mode3UserData Mode3AData = (CAT62I060Types.CAT62060Mode3UserData)Msg.CAT62DataItems[CAT62.ItemIDToIndex("060")].value;

                        if (Mode3AData != null)
                        {
                            if (Mode3AData.Mode3A_Code == (string)this.comboBox1.Items[this.comboBox1.SelectedIndex])
                            {
                                // Get Lat/Long in decimal
                                GeoCordSystemDegMinSecUtilities.LatLongClass LatLongData = (GeoCordSystemDegMinSecUtilities.LatLongClass)Msg.CAT62DataItems[CAT62.ItemIDToIndex("105")].value;

                                double FlightLevelData = 0.0;
                                if (Msg.CAT62DataItems[CAT62.ItemIDToIndex("136")].value != null)
                                {
                                    try
                                    {
                                        // Get Flight Level
                                        FlightLevelData = (double)Msg.CAT62DataItems[CAT62.ItemIDToIndex("136")].value;
                                    }
                                    catch
                                    {
                                    }
                                }

                                double LevelInMeeters = (FlightLevelData * 100.00) * SharedData.FeetToMeeters;

                                Data = Data + LatLongData.GetLatLongDecimal().LongitudeDecimal.ToString() +
                                       "," + LatLongData.GetLatLongDecimal().LatitudeDecimal.ToString() + "," + LevelInMeeters.ToString() + Environment.NewLine;

                                TargetNumber++;
                            }
                        }
                    }
                }
            }

            return(Data);
        }
예제 #16
0
        private void comboBoxSSRCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.listBoxDataBySSRCode.Items.Clear();

            if (SSR_Code_Lookup.Length > 0)
            {
                // On load determine what SSR codes are present end populate the combo box
                if (MainASTERIXDataStorage.CAT01Message.Count > 0)
                {
                    foreach (MainASTERIXDataStorage.CAT01Data Msg in MainASTERIXDataStorage.CAT01Message)
                    {
                        CAT01I070Types.CAT01070Mode3UserData MyData = (CAT01I070Types.CAT01070Mode3UserData)Msg.CAT01DataItems[CAT01.ItemIDToIndex("070")].value;

                        if (MyData.Mode3A_Code == this.comboBoxSSRCode.Items[this.comboBoxSSRCode.SelectedIndex].ToString())
                        {
                            ASTERIX.SIC_SAC_Time SIC_SAC_TIME = (ASTERIX.SIC_SAC_Time)Msg.CAT01DataItems[CAT01.ItemIDToIndex("010")].value;

                            // Display time
                            string Time = SIC_SAC_TIME.TimeofReception.Hour.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Minute.ToString().PadLeft(2, '0') + ":" +
                                          SIC_SAC_TIME.TimeofReception.Second.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Millisecond.ToString().PadLeft(3, '0');
                            this.listBoxDataBySSRCode.Items.Add("Rcvd Time: " + Time);

                            CAT01I040Types.CAT01I040MeasuredPosInPolarCoordinates PositionData = (CAT01I040Types.CAT01I040MeasuredPosInPolarCoordinates)Msg.CAT01DataItems[CAT01.ItemIDToIndex("040")].value;
                            this.listBoxDataBySSRCode.Items.Add("\tDistance:\t" + PositionData.Measured_Distance);
                            this.listBoxDataBySSRCode.Items.Add("\tAzimuth:\t" + PositionData.Measured_Azimuth.ToString());
                            string Lat, Lon;
                            PositionData.LatLong.GetDegMinSecStringFormat(out Lat, out Lon);
                            this.listBoxDataBySSRCode.Items.Add("\tLat/Long:\t" + Lat + "/" + Lon);

                            // Display Data
                            CAT01I090Types.CAT01I090FlightLevelUserData FL_Data = (CAT01I090Types.CAT01I090FlightLevelUserData)Msg.CAT01DataItems[CAT01.ItemIDToIndex("090")].value;
                            this.listBoxDataBySSRCode.Items.Add("\tMode Validated:\t" + FL_Data.Code_Validated.ToString());
                            this.listBoxDataBySSRCode.Items.Add("\tMode Garbled:\t" + FL_Data.Code_Garbled.ToString());
                            this.listBoxDataBySSRCode.Items.Add("\tFL:\t" + FL_Data.FlightLevel.ToString());

                            this.listBoxDataBySSRCode.Items.Add("    ");
                        }
                    }
                }
                else if (MainASTERIXDataStorage.CAT48Message.Count > 0)
                {
                    foreach (MainASTERIXDataStorage.CAT48Data Msg in MainASTERIXDataStorage.CAT48Message)
                    {
                        CAT48I070Types.CAT48I070Mode3UserData MyData = (CAT48I070Types.CAT48I070Mode3UserData)Msg.CAT48DataItems[CAT48.ItemIDToIndex("070")].value;

                        if (MyData.Mode3A_Code == this.comboBoxSSRCode.Items[this.comboBoxSSRCode.SelectedIndex].ToString())
                        {
                            ASTERIX.SIC_SAC_Time SIC_SAC_TIME = (ASTERIX.SIC_SAC_Time)Msg.CAT48DataItems[CAT48.ItemIDToIndex("010")].value;

                            // Display time
                            string Time = SIC_SAC_TIME.TimeofReception.Hour.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Minute.ToString().PadLeft(2, '0') + ":" +
                                          SIC_SAC_TIME.TimeofReception.Second.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Millisecond.ToString().PadLeft(3, '0');
                            this.listBoxDataBySSRCode.Items.Add("Rcvd Time: " + Time);

                            // Display Data
                            CAT48I240Types.CAT48I240ACID_Data ACID_String = (CAT48I240Types.CAT48I240ACID_Data)Msg.CAT48DataItems[CAT48.ItemIDToIndex("240")].value;
                            if (ACID_String != null)
                            {
                                this.listBoxDataBySSRCode.Items.Add("\t" + "Callsign:" + ACID_String.ACID);
                            }
                            else
                            {
                                this.listBoxDataBySSRCode.Items.Add("\t" + "Callsign: N/A");
                            }

                            CAT48I040Types.CAT48I040MeasuredPosInPolarCoordinates PositionData = (CAT48I040Types.CAT48I040MeasuredPosInPolarCoordinates)Msg.CAT48DataItems[CAT48.ItemIDToIndex("040")].value;
                            this.listBoxDataBySSRCode.Items.Add("\tDistance:\t" + PositionData.Measured_Distance);
                            this.listBoxDataBySSRCode.Items.Add("\tAzimuth:\t" + PositionData.Measured_Azimuth.ToString());
                            string Lat, Lon;
                            PositionData.LatLong.GetDegMinSecStringFormat(out Lat, out Lon);
                            this.listBoxDataBySSRCode.Items.Add("\tLat/Long:\t" + Lat + "/" + Lon);

                            CAT48I090Types.CAT48I090FlightLevelUserData FL_Data = (CAT48I090Types.CAT48I090FlightLevelUserData)Msg.CAT48DataItems[CAT48.ItemIDToIndex("090")].value;
                            this.listBoxDataBySSRCode.Items.Add("\tMode Validated:\t" + FL_Data.Code_Validated.ToString());
                            this.listBoxDataBySSRCode.Items.Add("\tMode Garbled:\t" + FL_Data.Code_Garbled.ToString());
                            this.listBoxDataBySSRCode.Items.Add("\tFL:\t" + FL_Data.FlightLevel.ToString());
                            this.listBoxDataBySSRCode.Items.Add("    ");
                        }
                    }
                }
                else if (MainASTERIXDataStorage.CAT62Message.Count > 0)
                {
                    foreach (MainASTERIXDataStorage.CAT62Data Msg in MainASTERIXDataStorage.CAT62Message)
                    {
                        CAT62I060Types.CAT62060Mode3UserData MyData = (CAT62I060Types.CAT62060Mode3UserData)Msg.CAT62DataItems[CAT62.ItemIDToIndex("060")].value;

                        if (MyData.Mode3A_Code == this.comboBoxSSRCode.Items[this.comboBoxSSRCode.SelectedIndex].ToString())
                        {
                            ASTERIX.SIC_SAC_Time SIC_SAC_TIME = (ASTERIX.SIC_SAC_Time)Msg.CAT62DataItems[CAT62.ItemIDToIndex("010")].value;

                            // TIME
                            string Time = SIC_SAC_TIME.TimeofReception.Hour.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Minute.ToString().PadLeft(2, '0') + ":" +
                                          SIC_SAC_TIME.TimeofReception.Second.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Millisecond.ToString().PadLeft(3, '0');
                            this.listBoxDataBySSRCode.Items.Add("Rcvd Time: " + Time);
                            // TRACK NUMBER
                            int TrackNumber = (int)Msg.CAT62DataItems[CAT62.ItemIDToIndex("040")].value;
                            this.listBoxDataBySSRCode.Items.Add("\t" + "TRACK#:" + TrackNumber.ToString());
                            // CALLSIGN
                            CAT62I380Types.CAT62I380Data CAT62I380Data = (CAT62I380Types.CAT62I380Data)Msg.CAT62DataItems[CAT62.ItemIDToIndex("380")].value;
                            if (CAT62I380Data != null)
                            {
                                this.listBoxDataBySSRCode.Items.Add("\t" + "Callsign:" + CAT62I380Data.ACID.ACID_String);
                            }
                            // POSITION
                            GeoCordSystemDegMinSecUtilities.LatLongClass LatLongData = (GeoCordSystemDegMinSecUtilities.LatLongClass)Msg.CAT62DataItems[CAT62.ItemIDToIndex("105")].value;
                            string Lat, Lon;
                            LatLongData.GetDegMinSecStringFormat(out Lat, out Lon);
                            this.listBoxDataBySSRCode.Items.Add("\tLat/Long:\t" + Lat + "/" + Lon);
                            // FLIGHT LEVEL
                            double FlightLevel = (double)Msg.CAT62DataItems[CAT62.ItemIDToIndex("136")].value;
                            if (Msg.CAT62DataItems[CAT62.ItemIDToIndex("136")].value != null)
                            {
                                this.listBoxDataBySSRCode.Items.Add("\tFL:\t" + FlightLevel.ToString());
                            }
                            else
                            {
                                this.listBoxDataBySSRCode.Items.Add("\tFL:\t" + "N/A");
                            }
                            this.listBoxDataBySSRCode.Items.Add("    ");
                        }
                    }
                }
            }
            else
            {
                this.listBoxDataBySSRCode.Items.Add("No data was acquired !!!");
            }
        }