public static void DecodeCAT01I090(byte[] Data) { // A new instance of the CAT01I070 data CAT01I090Types.CAT01I090FlightLevelUserData MyCAT01I090 = new CAT01I090Types.CAT01I090FlightLevelUserData(); // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 2]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 1]; ////////////////////////////////////////////////////////////////////////////////// // Decode Code validation if (BO.DWord[Bit_Ops.Bit15] == true) { MyCAT01I090.Code_Validated = CAT01I090Types.Code_Validation_Type.Code_Not_Validated; } else { MyCAT01I090.Code_Validated = CAT01I090Types.Code_Validation_Type.Code_Validated; } ////////////////////////////////////////////////////////////////////////////////// // Decode Code Garbling if (BO.DWord[Bit_Ops.Bit14] == true) { MyCAT01I090.Code_Garbled = CAT01I090Types.Code_Garbled_Type.Code_Garbled; } else { MyCAT01I090.Code_Garbled = CAT01I090Types.Code_Garbled_Type.Code_Not_Garbled; } ////////////////////////////////////////////////////////////////////////////////// // Decode the flight level MyCAT01I090.FlightLevel = DecodeFlightLevel(BO); ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT01.I001DataItems[CAT01.ItemIDToIndex("090")].value = MyCAT01I090; ////////////////////////////////////////////////////////////////////////////////// // Increase data buffer index so it ready for the next data item. CAT01.CurrentDataBufferOctalIndex = CAT01.CurrentDataBufferOctalIndex + 2; }
public static void DecodeCAT01I040(byte[] Data) { CAT01I040Types.CAT01I040MeasuredPosInPolarCoordinates MyCAT01I040 = new CAT01I040Types.CAT01I040MeasuredPosInPolarCoordinates(); // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 4]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 3]; BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 2]; BO.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 1]; DecodeAzimuthAndDistance(ref MyCAT01I040.LatLong, out MyCAT01I040.Measured_Distance, out MyCAT01I040.Measured_Azimuth, BO); ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT01.I001DataItems[CAT01.ItemIDToIndex("040")].value = MyCAT01I040; ////////////////////////////////////////////////////////////////////////////////// // Leave it at the current index for the next decode CAT01.CurrentDataBufferOctalIndex = CAT01.CurrentDataBufferOctalIndex + 4; }
private static void StoreDecodedData() { //////////////////////////////////////////////////////////////////////////////////// // All CAT01 data has been decoded, so lets save off the message data to the global // storage for latter usage MainASTERIXDataStorage.CAT01Data CAT01MessageData = new MainASTERIXDataStorage.CAT01Data(); foreach (CAT01.CAT01DataItem Item in CAT01.I001DataItems) { CAT01.CAT01DataItem MyItem = new CAT01.CAT01DataItem(); MyItem.CurrentlyPresent = Item.CurrentlyPresent; MyItem.Description = Item.Description; MyItem.HasBeenPresent = Item.HasBeenPresent; MyItem.ID = Item.ID; MyItem.value = Item.value; CAT01MessageData.CAT01DataItems.Add(MyItem); } MainASTERIXDataStorage.CAT01Message.Add(CAT01MessageData); CAT01.Intitialize(false); }
public static void DecodeCAT01I141(byte[] Data) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 1]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex]; CAT01I141Types.CAT01141ElapsedTimeSinceMidnight Result = new CAT01I141Types.CAT01141ElapsedTimeSinceMidnight(); 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; } ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT01.I001DataItems[CAT01.ItemIDToIndex("141")].value = Result; ////////////////////////////////////////////////////////////////////////////////// // Leave it at the current index for the next decode CAT01.CurrentDataBufferOctalIndex = CAT01.CurrentDataBufferOctalIndex + 2; }
public static void DecodeCAT01I200(byte[] Data) { CAT01I200Types.CalculatedGSPandHDG_Type CalculatedGSPandHDG = new CAT01I200Types.CalculatedGSPandHDG_Type(); // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 4]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 3]; BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 2]; BO.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[CAT01.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 CAT01.I001DataItems[CAT01.ItemIDToIndex("200")].value = CalculatedGSPandHDG; ////////////////////////////////////////////////////////////////////////////////// CAT01.CurrentDataBufferOctalIndex = CAT01.CurrentDataBufferOctalIndex + 4; }
// 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. Every 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 if desired. public static void Do(byte[] Data) { // First check what type of data is received? if (CAT01.Type_Of_Report == CAT01I020Types.Type_Of_Report_Type.Plot) { /////////////////////////////////////////////////////////////////////// // PLOT DATA // /////////////////////////////////////////////////////////////////////// // I001/010 Data Source Identifier 2 // NO NEED to do anything this is handled in CAT01 // I001/020 Target Report Descriptor +1 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("020")].CurrentlyPresent == true) { CAT01I020UserData.DecodeCAT01I002(Data); } // I001/040 Measured Position in Polar Coordinates 4 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("040")].CurrentlyPresent == true) { CAT01I040UserData.DecodeCAT01I040(Data); } // I001/070 Mode-3/A Code in Octal Representation 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("070")].CurrentlyPresent == true) { CAT01I070UserData.DecodeCAT01I070(Data); } // I001/090 Mode-C Code in Binary Representation 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("090")].CurrentlyPresent == true) { CAT01I090UserData.DecodeCAT01I090(Data); } // I001/130 Radar Plot Characteristics 1+ if (CAT01.I001DataItems[CAT01.ItemIDToIndex("130")].CurrentlyPresent == true) { CAT01I130UserData.DecodeCAT01I130(Data); } // I001/141 Truncated Time of Day 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("141")].CurrentlyPresent == true) { CAT01I141UserData.DecodeCAT01I141(Data); } // FX -------- Field Extension Indicator - // I001/050 Mode-2 Code in Octal Representation 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("050")].CurrentlyPresent == true) { CAT01I050UserData.DecodeCAT01I050(Data); } // I001/120 Measured Radial Doppler Speed 1 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("120")].CurrentlyPresent == true) { CAT01I120UserData.DecodeCAT01I120(Data); } // I001/131 Received Power 1 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("131")].CurrentlyPresent == true) { CAT01I131UserData.DecodeCAT01I131(Data); } // I001/080 Mode-3/A Code Confidence Indicator 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("080")].CurrentlyPresent == true) { CAT01I080UserData.DecodeCAT01I080(Data); } // I001/100 Mode-C Code and Code Confidence Indicator 4 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("100")].CurrentlyPresent == true) { CAT01I100UserData.DecodeCAT01I100(Data); } // I001/060 Mode-2 Code Confidence Indicator 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("060")].CurrentlyPresent == true) { CAT01I060UserData.DecodeCAT01I060(Data); } // I001/030 Warning/Error Conditions 1+ if (CAT01.I001DataItems[CAT01.ItemIDToIndex("030")].CurrentlyPresent == true) { CAT01I030UserData.DecodeCAT01I030(Data); } // FX -------- Field Extension Indicator - // I001/150 Presence of X-Pulse 1 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("150")].CurrentlyPresent == true) { CAT01I150UserData.DecodeCAT01I150(Data); } StoreDecodedData(); } else { /////////////////////////////////////////////////////////////////////// // TRACK DATA // /////////////////////////////////////////////////////////////////////// // I001/010 Data Source Identifier // NO NEED to do anything this is handled in CAT01 // I001/020 Target Report Descriptor +1 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("020")].CurrentlyPresent == true) { CAT01I020UserData.DecodeCAT01I002(Data); } // I001/161 Track/Plot Number 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("161")].CurrentlyPresent == true) { CAT01I161UserData.DecodeCAT01I161(Data); } // I001/040 Measured Position in Polar Coordinates 4 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("040")].CurrentlyPresent == true) { CAT01I040UserData.DecodeCAT01I040(Data); } // I001/042 Calculated Position in Cartesian Coordinates 4 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("042")].CurrentlyPresent == true) { CAT01I042UserData.DecodeCAT01I042(Data); } // I001/200 Calculated Track Velocity in polar Coordinates 4 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("200")].CurrentlyPresent == true) { CAT01I200UserData.DecodeCAT01I200(Data); } // I001/070 Mode-3/A Code in Octal Representation 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("070")].CurrentlyPresent == true) { CAT01I070UserData.DecodeCAT01I070(Data); } // I001/090 Mode-C Code in Binary Representation 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("090")].CurrentlyPresent == true) { CAT01I090UserData.DecodeCAT01I090(Data); } // I001/141 Truncated Time of Day 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("141")].CurrentlyPresent == true) { CAT01I141UserData.DecodeCAT01I141(Data); } // I001/130 Radar Plot Characteristics 1+ if (CAT01.I001DataItems[CAT01.ItemIDToIndex("130")].CurrentlyPresent == true) { CAT01I130UserData.DecodeCAT01I130(Data); } // I001/131 Received Power 1 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("131")].CurrentlyPresent == true) { CAT01I131UserData.DecodeCAT01I131(Data); } // I001/120 Measured Radial Doppler Speed 1 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("120")].CurrentlyPresent == true) { CAT01I120UserData.DecodeCAT01I120(Data); } // I001/170 Track Status 1+ if (CAT01.I001DataItems[CAT01.ItemIDToIndex("170")].CurrentlyPresent == true) { CAT01I170UserData.DecodeCAT01I170(Data); } // I001/210 Track Quality 1+ if (CAT01.I001DataItems[CAT01.ItemIDToIndex("210")].CurrentlyPresent == true) { CAT01I210UserData.DecodeCAT01I210(Data); } // FX Field Extension Indicator // I001/050 Mode-2 Code in Octal Representation 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("050")].CurrentlyPresent == true) { CAT01I050UserData.DecodeCAT01I050(Data); } // I001/080 Mode-3/A Code Confidence Indicator 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("080")].CurrentlyPresent == true) { CAT01I080UserData.DecodeCAT01I080(Data); } // I001/100 Mode-C Code and Code Confidence Indicator 4 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("100")].CurrentlyPresent == true) { CAT01I100UserData.DecodeCAT01I100(Data); } // I001/060 Mode-2 Code Confidence Indicator 2 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("060")].CurrentlyPresent == true) { CAT01I060UserData.DecodeCAT01I060(Data); } // I001/030 Warning/Error Conditions 1+ if (CAT01.I001DataItems[CAT01.ItemIDToIndex("030")].CurrentlyPresent == true) { CAT01I030UserData.DecodeCAT01I030(Data); } // Reserved for Special Purpose Indicator (SP) // Reserved for RFS Indicator (RS-bit) // FX Field Extension Indicator // I001/150 Presence of X-Pulse 1 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("150")].CurrentlyPresent == true) { CAT01I150UserData.DecodeCAT01I150(Data); } StoreDecodedData(); } }
public static void DecodeCAT01I002(byte[] Data) { // Decode 020 if (CAT01.I001DataItems[CAT01.ItemIDToIndex("020")].CurrentlyPresent == true) { // First define CAT01I002 class CAT01I020UserData MyI002UserData = new CAT01I020UserData(); // 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[CAT01.CurrentDataBufferOctalIndex]; /////////////////////////////////////////////////////////////////////////////////////////////////// // if (BO.DWord[CAT01I020Types.Word1_TYP_Index] == true) { MyI002UserData.Type_Of_Report = CAT01I020Types.Type_Of_Report_Type.Track; } else { MyI002UserData.Type_Of_Report = CAT01I020Types.Type_Of_Report_Type.Plot; } /////////////////////////////////////////////////////////////////////////////////////////////////// // if (BO.DWord[CAT01I020Types.Word1_SIM_Index] == true) { MyI002UserData.Simulated_Or_Actual_Report = CAT01I020Types.Simulated_Or_Actual_Type.Simulated; } else { MyI002UserData.Simulated_Or_Actual_Report = CAT01I020Types.Simulated_Or_Actual_Type.Actual; } /////////////////////////////////////////////////////////////////////////////////////////////////// // if ((BO.DWord[CAT01I020Types.Word1_SSR_PSR_Start_Index] == true) && (BO.DWord[CAT01I020Types.Word1_SSR_PSR_End_Index] == true)) { MyI002UserData.Type_Of_Radar_Detection = CAT01I020Types.Radar_Detection_Type.Combined; } else if ((BO.DWord[CAT01I020Types.Word1_SSR_PSR_Start_Index] == false) && (BO.DWord[CAT01I020Types.Word1_SSR_PSR_End_Index] == false)) { MyI002UserData.Type_Of_Radar_Detection = CAT01I020Types.Radar_Detection_Type.No_Detection; } else if (BO.DWord[CAT01I020Types.Word1_SSR_PSR_Start_Index] == true) { MyI002UserData.Type_Of_Radar_Detection = CAT01I020Types.Radar_Detection_Type.Secondary; } else { MyI002UserData.Type_Of_Radar_Detection = CAT01I020Types.Radar_Detection_Type.Primary; } /////////////////////////////////////////////////////////////////////////////////////////////////// // if (BO.DWord[CAT01I020Types.Word1_ANT_Index] == true) { MyI002UserData.Antena_Source = CAT01I020Types.Antena_Source_Type.Antena_2; } else { MyI002UserData.Antena_Source = CAT01I020Types.Antena_Source_Type.Antena_1; } /////////////////////////////////////////////////////////////////////////////////////////////////// // if (BO.DWord[CAT01I020Types.Word1_SPI_Index] == true) { MyI002UserData.Special_Position_Ind = CAT01I020Types.Special_Position_Ind_Type.SPI_Special_Position_Indicator; } else { MyI002UserData.Special_Position_Ind = CAT01I020Types.Special_Position_Ind_Type.Default_Position; } /////////////////////////////////////////////////////////////////////////////////////////////////// // if (BO.DWord[CAT01I020Types.Word1_FFT_Index] == true) { MyI002UserData.Data_Is_From_FFT = CAT01I020Types.Data_From_FFT_Type.From_FFT; } else { MyI002UserData.Data_Is_From_FFT = CAT01I020Types.Data_From_FFT_Type.Not_from_FFT; } /////////////////////////////////////////////////////////////////////////////////////////////////// // if (BO.DWord[CAT01I020Types.Word1_FX_Index] == false) { MyI002UserData.Next_Extension_1 = CAT01I020Types.Next_Extension_Type.No; } else { MyI002UserData.Next_Extension_1 = CAT01I020Types.Next_Extension_Type.Yes; // OK we have a field extension, so lets first move the data buffer to the next // octet CAT01.CurrentDataBufferOctalIndex = CAT01.CurrentDataBufferOctalIndex + 1; //Extract the next octet BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex]; if (BO.DWord[CAT01I020Types.Word2_TST_Index] == true) { MyI002UserData.Is_Test_Target_Indicator = CAT01I020Types.Test_Target_Indicator_Type.Test_Target_Indicator; } else { MyI002UserData.Is_Test_Target_Indicator = CAT01I020Types.Test_Target_Indicator_Type.Default_Target_Indicator_Type; } MyI002UserData.Special_SSR_Codes = CAT01I020Types.Special_SSR_Codes_Type.Unknown_Data; /////////////////////////////////////////////////////////////////////////////////////////////////// // if ((BO.DWord[CAT01I020Types.Word2_DS1_DS2_Start_Index] == true) && (BO.DWord[CAT01I020Types.Word2_DS1_DS2_End_Index] == true)) { MyI002UserData.Special_SSR_Codes = CAT01I020Types.Special_SSR_Codes_Type.C7700_Emergency; } else if ((BO.DWord[CAT01I020Types.Word2_DS1_DS2_Start_Index] == false) && (BO.DWord[CAT01I020Types.Word2_DS1_DS2_End_Index] == false)) { MyI002UserData.Special_SSR_Codes = CAT01I020Types.Special_SSR_Codes_Type.Default_SSR_Code; } else if (BO.DWord[CAT01I020Types.Word2_DS1_DS2_Start_Index] == true) { MyI002UserData.Special_SSR_Codes = CAT01I020Types.Special_SSR_Codes_Type.C7600_Radio_Com_Failure; } else { MyI002UserData.Special_SSR_Codes = CAT01I020Types.Special_SSR_Codes_Type.C7500_Unlawful_Interference; } if (BO.DWord[CAT01I020Types.Word2_ME_Index] == true) { MyI002UserData.Is_Military_Emergency = CAT01I020Types.Military_Emergency_Type.Yes; } else { MyI002UserData.Is_Military_Emergency = CAT01I020Types.Military_Emergency_Type.No; } if (BO.DWord[CAT01I020Types.Word2_MI_Index] == true) { MyI002UserData.Is_Military_Identification = CAT01I020Types.Military_Identification_Type.Yes; } else { MyI002UserData.Is_Military_Identification = CAT01I020Types.Military_Identification_Type.No; } if (BO.DWord[CAT01I020Types.Word2_FX_Index] == true) { MyI002UserData.Next_Extension_2 = CAT01I020Types.Next_Extension_Type.Yes; } else { MyI002UserData.Next_Extension_2 = CAT01I020Types.Next_Extension_Type.No; } } ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT01.I001DataItems[CAT01.ItemIDToIndex("020")].value = MyI002UserData; ////////////////////////////////////////////////////////////////////////////////// } }
public static void DecodeCAT01I070(byte[] Data) { // A new instance of the CAT01I070 data CAT01I070Types.CAT01070Mode3UserData MyCAT01I070 = new CAT01I070Types.CAT01070Mode3UserData(); // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 2]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 1]; ////////////////////////////////////////////////////////////////////////////////// // Decode Code validation if (BO.DWord[Bit_Ops.Bit15] == true) { MyCAT01I070.Code_Validated = CAT01I070Types.Code_Validation_Type.Code_Not_Validated; } else { MyCAT01I070.Code_Validated = CAT01I070Types.Code_Validation_Type.Code_Validated; } ////////////////////////////////////////////////////////////////////////////////// // Decode Code Garbling if (BO.DWord[Bit_Ops.Bit14] == true) { MyCAT01I070.Code_Garbled = CAT01I070Types.Code_Garbled_Type.Code_Garbled; } else { MyCAT01I070.Code_Garbled = CAT01I070Types.Code_Garbled_Type.Code_Not_Garbled; } ////////////////////////////////////////////////////////////////////////////////// // Decode Code Smothed or from Transponder if (BO.DWord[Bit_Ops.Bit13] == true) { MyCAT01I070.Code_Smothed_Or_From_Transponder = CAT01I070Types.Code_Smothed_Or_From_Transporder_Type.Code_Smoothed; } else { MyCAT01I070.Code_Smothed_Or_From_Transponder = CAT01I070Types.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]); MyCAT01I070.Mode3A_Code = A.ToString() + B.ToString() + C.ToString() + D.ToString(); ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT01.I001DataItems[CAT01.ItemIDToIndex("070")].value = MyCAT01I070; ////////////////////////////////////////////////////////////////////////////////// // Leave it at the current index for the next decode CAT01.CurrentDataBufferOctalIndex = CAT01.CurrentDataBufferOctalIndex + 2; }
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)CAT01.I001DataItems[CAT01.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()); }
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]); } } }
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(); }
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); }
private static void DecodeAzimuthAndDistance(ref GeoCordSystemDegMinSecUtilities.LatLongClass NewPosition, double Distance, double Azimuth) { GeoCordSystemDegMinSecUtilities.LatLongClass ResultPosition = new GeoCordSystemDegMinSecUtilities.LatLongClass(); ////////////////////////////////////////////////////////////////////////////////// // // 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 cu // rrent SIC/SAC so the correct radar can be applied // ASTERIX.SIC_SAC_Time SIC_SAC_TIME = (ASTERIX.SIC_SAC_Time)CAT01.I001DataItems[CAT01.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, Azimuth); } } NewPosition.SetPosition(ResultPosition.GetLatLongDecimal()); }
public static void DecodeCAT01I042(byte[] Data) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); double Result = 0.0; CAT01I042Types.CAT01I042CalculatedPositionInCartesianCoordinates MyCAT01I042 = new CAT01I042Types.CAT01I042CalculatedPositionInCartesianCoordinates(); BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 4]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 3]; BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 2]; BO.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex + 1]; // Decode first X component // Check if this is a negative altitude. // and then handle it properly if (BO.DWord[Bit_Ops.Bit31] == true) { BO.DWord[Bit_Ops.Bit16] = !BO.DWord[Bit_Ops.Bit16]; BO.DWord[Bit_Ops.Bit17] = !BO.DWord[Bit_Ops.Bit17]; BO.DWord[Bit_Ops.Bit18] = !BO.DWord[Bit_Ops.Bit18]; BO.DWord[Bit_Ops.Bit19] = !BO.DWord[Bit_Ops.Bit19]; BO.DWord[Bit_Ops.Bit20] = !BO.DWord[Bit_Ops.Bit20]; BO.DWord[Bit_Ops.Bit21] = !BO.DWord[Bit_Ops.Bit21]; BO.DWord[Bit_Ops.Bit22] = !BO.DWord[Bit_Ops.Bit22]; BO.DWord[Bit_Ops.Bit23] = !BO.DWord[Bit_Ops.Bit23]; BO.DWord[Bit_Ops.Bit24] = !BO.DWord[Bit_Ops.Bit24]; BO.DWord[Bit_Ops.Bit25] = !BO.DWord[Bit_Ops.Bit25]; BO.DWord[Bit_Ops.Bit26] = !BO.DWord[Bit_Ops.Bit26]; BO.DWord[Bit_Ops.Bit27] = !BO.DWord[Bit_Ops.Bit27]; BO.DWord[Bit_Ops.Bit28] = !BO.DWord[Bit_Ops.Bit28]; BO.DWord[Bit_Ops.Bit29] = !BO.DWord[Bit_Ops.Bit29]; BO.DWord[Bit_Ops.Bit30] = !BO.DWord[Bit_Ops.Bit30]; BO.DWord[Bit_Ops.Bit31] = !BO.DWord[Bit_Ops.Bit31]; BO.DWord[Bit_Ops.Bits0_15_Of_DWord] = BO.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; if (BO.DWord[Bit_Ops.Bit16] == true) { Result = Result + XY_1; } if (BO.DWord[Bit_Ops.Bit17] == true) { Result = Result + XY_2; } if (BO.DWord[Bit_Ops.Bit18] == true) { Result = Result + XY_3; } if (BO.DWord[Bit_Ops.Bit19] == true) { Result = Result + XY_4; } if (BO.DWord[Bit_Ops.Bit20] == true) { Result = Result + XY_5; } if (BO.DWord[Bit_Ops.Bit21] == true) { Result = Result + XY_6; } if (BO.DWord[Bit_Ops.Bit22] == true) { Result = Result + XY_7; } if (BO.DWord[Bit_Ops.Bit23] == true) { Result = Result + XY_8; } if (BO.DWord[Bit_Ops.Bit24] == true) { Result = Result + XY_9; } if (BO.DWord[Bit_Ops.Bit25] == true) { Result = Result + XY_10; } if (BO.DWord[Bit_Ops.Bit26] == true) { Result = Result + XY_11; } if (BO.DWord[Bit_Ops.Bit27] == true) { Result = Result + XY_12; } if (BO.DWord[Bit_Ops.Bit28] == true) { Result = Result + XY_13; } if (BO.DWord[Bit_Ops.Bit29] == true) { Result = Result + XY_14; } if (BO.DWord[Bit_Ops.Bit30] == true) { Result = Result + XY_15; } Result = -Result; } else { if (BO.DWord[Bit_Ops.Bit16] == true) { Result = Result + XY_1; } if (BO.DWord[Bit_Ops.Bit17] == true) { Result = Result + XY_2; } if (BO.DWord[Bit_Ops.Bit18] == true) { Result = Result + XY_3; } if (BO.DWord[Bit_Ops.Bit19] == true) { Result = Result + XY_4; } if (BO.DWord[Bit_Ops.Bit20] == true) { Result = Result + XY_5; } if (BO.DWord[Bit_Ops.Bit21] == true) { Result = Result + XY_6; } if (BO.DWord[Bit_Ops.Bit22] == true) { Result = Result + XY_7; } if (BO.DWord[Bit_Ops.Bit23] == true) { Result = Result + XY_8; } if (BO.DWord[Bit_Ops.Bit24] == true) { Result = Result + XY_9; } if (BO.DWord[Bit_Ops.Bit25] == true) { Result = Result + XY_10; } if (BO.DWord[Bit_Ops.Bit26] == true) { Result = Result + XY_11; } if (BO.DWord[Bit_Ops.Bit27] == true) { Result = Result + XY_12; } if (BO.DWord[Bit_Ops.Bit28] == true) { Result = Result + XY_13; } if (BO.DWord[Bit_Ops.Bit29] == true) { Result = Result + XY_14; } if (BO.DWord[Bit_Ops.Bit30] == true) { Result = Result + XY_15; } if (BO.DWord[Bit_Ops.Bit31] == true) { Result = Result + XY_16; } } MyCAT01I042.X = Result; Result = 0.0; // Decode first Y component // Check if this is a negative altitude. // and then handle it properly if (BO.DWord[Bit_Ops.Bit15] == true) { BO.DWord[Bit_Ops.Bit0] = !BO.DWord[Bit_Ops.Bit0]; BO.DWord[Bit_Ops.Bit1] = !BO.DWord[Bit_Ops.Bit1]; BO.DWord[Bit_Ops.Bit2] = !BO.DWord[Bit_Ops.Bit2]; BO.DWord[Bit_Ops.Bit3] = !BO.DWord[Bit_Ops.Bit3]; BO.DWord[Bit_Ops.Bit4] = !BO.DWord[Bit_Ops.Bit4]; BO.DWord[Bit_Ops.Bit5] = !BO.DWord[Bit_Ops.Bit5]; BO.DWord[Bit_Ops.Bit6] = !BO.DWord[Bit_Ops.Bit6]; BO.DWord[Bit_Ops.Bit7] = !BO.DWord[Bit_Ops.Bit7]; BO.DWord[Bit_Ops.Bit8] = !BO.DWord[Bit_Ops.Bit8]; BO.DWord[Bit_Ops.Bit9] = !BO.DWord[Bit_Ops.Bit9]; BO.DWord[Bit_Ops.Bit10] = !BO.DWord[Bit_Ops.Bit10]; BO.DWord[Bit_Ops.Bit11] = !BO.DWord[Bit_Ops.Bit11]; BO.DWord[Bit_Ops.Bit12] = !BO.DWord[Bit_Ops.Bit12]; BO.DWord[Bit_Ops.Bit13] = !BO.DWord[Bit_Ops.Bit13]; BO.DWord[Bit_Ops.Bit14] = !BO.DWord[Bit_Ops.Bit14]; BO.DWord[Bit_Ops.Bit15] = !BO.DWord[Bit_Ops.Bit15]; BO.DWord[Bit_Ops.Bits16_31_Of_DWord] = BO.DWord[Bit_Ops.Bits16_31_Of_DWord] + 1; if (BO.DWord[Bit_Ops.Bit0] == true) { Result = Result + XY_1; } if (BO.DWord[Bit_Ops.Bit1] == true) { Result = Result + XY_2; } if (BO.DWord[Bit_Ops.Bit2] == true) { Result = Result + XY_3; } if (BO.DWord[Bit_Ops.Bit3] == true) { Result = Result + XY_4; } if (BO.DWord[Bit_Ops.Bit4] == true) { Result = Result + XY_5; } if (BO.DWord[Bit_Ops.Bit5] == true) { Result = Result + XY_6; } if (BO.DWord[Bit_Ops.Bit6] == true) { Result = Result + XY_7; } if (BO.DWord[Bit_Ops.Bit7] == true) { Result = Result + XY_8; } if (BO.DWord[Bit_Ops.Bit8] == true) { Result = Result + XY_9; } if (BO.DWord[Bit_Ops.Bit9] == true) { Result = Result + XY_10; } if (BO.DWord[Bit_Ops.Bit10] == true) { Result = Result + XY_11; } if (BO.DWord[Bit_Ops.Bit11] == true) { Result = Result + XY_12; } if (BO.DWord[Bit_Ops.Bit12] == true) { Result = Result + XY_13; } if (BO.DWord[Bit_Ops.Bit13] == true) { Result = Result + XY_14; } if (BO.DWord[Bit_Ops.Bit14] == true) { Result = Result + XY_15; } Result = -Result; } else { if (BO.DWord[Bit_Ops.Bit0] == true) { Result = Result + XY_1; } if (BO.DWord[Bit_Ops.Bit1] == true) { Result = Result + XY_2; } if (BO.DWord[Bit_Ops.Bit2] == true) { Result = Result + XY_3; } if (BO.DWord[Bit_Ops.Bit3] == true) { Result = Result + XY_4; } if (BO.DWord[Bit_Ops.Bit4] == true) { Result = Result + XY_5; } if (BO.DWord[Bit_Ops.Bit5] == true) { Result = Result + XY_6; } if (BO.DWord[Bit_Ops.Bit6] == true) { Result = Result + XY_7; } if (BO.DWord[Bit_Ops.Bit7] == true) { Result = Result + XY_8; } if (BO.DWord[Bit_Ops.Bit8] == true) { Result = Result + XY_9; } if (BO.DWord[Bit_Ops.Bit9] == true) { Result = Result + XY_10; } if (BO.DWord[Bit_Ops.Bit10] == true) { Result = Result + XY_11; } if (BO.DWord[Bit_Ops.Bit11] == true) { Result = Result + XY_12; } if (BO.DWord[Bit_Ops.Bit12] == true) { Result = Result + XY_13; } if (BO.DWord[Bit_Ops.Bit13] == true) { Result = Result + XY_14; } if (BO.DWord[Bit_Ops.Bit14] == true) { Result = Result + XY_15; } if (BO.DWord[Bit_Ops.Bit15] == true) { Result = Result + XY_16; } } MyCAT01I042.Y = Result; Azimuth_And_Distance_Type CalculatedGSPDandHDG = ToPolarFromCarteisan(MyCAT01I042.X, MyCAT01I042.Y); DecodeAzimuthAndDistance(ref MyCAT01I042.LatLong, CalculatedGSPDandHDG.Distance, CalculatedGSPDandHDG.Azimuth); ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT01.I001DataItems[CAT01.ItemIDToIndex("042")].value = MyCAT01I042; ////////////////////////////////////////////////////////////////////////////////// CAT01.CurrentDataBufferOctalIndex = CAT01.CurrentDataBufferOctalIndex + 4; }
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 !!!"); } }