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; }
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 !!!"); } }