public static void DecodeCAT62I060(byte[] Data) { // A new instance of the CAT48I070 data CAT62I060Types.CAT62060Mode3UserData MyCAT62I060 = new CAT62I060Types.CAT62060Mode3UserData(); // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 1]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; ////////////////////////////////////////////////////////////////////////////////// // Has code has changed MyCAT62I060.Mode_3A_Has_Changed = (BO.DWord[Bit_Ops.Bit13] == true); ////////////////////////////////////////////////////////////////////////////////// // 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]); MyCAT62I060.Mode3A_Code = A.ToString() + B.ToString() + C.ToString() + D.ToString(); ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT62.I062DataItems[CAT62.ItemIDToIndex("060")].value = MyCAT62I060; ////////////////////////////////////////////////////////////////////////////////// // Increase data buffer index so it ready for the next data item. CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 2; }
public static void DecodeCAT48I030(byte[] Data) { // Get an instance of bit ops Bit_Ops B0 = new Bit_Ops(); //Extract the first octet B0.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 1]; if (B0.DWord[CAT48I030Types.Word1_FX_Index] == true) { // Increase data buffer index so it ready for the next data item. CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 1; //Extract the first octet B0.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 1]; if (B0.DWord[CAT48I030Types.Word1_FX_Index] == true) { // Increase data buffer index so it ready for the next data item. CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 1; } } // Increase data buffer index so it ready for the next data item. CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 1; }
public static void DecodeCAT02I020(byte[] Data) { // 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[CAT02.CurrentDataBufferOctalIndex + 1]; double Result = 0.0; if (BO.DWord[Bit_Ops.Bit0] == true) Result = LSB_1; if (BO.DWord[Bit_Ops.Bit1] == true) Result = Result + LSB_2; if (BO.DWord[Bit_Ops.Bit2] == true) Result = Result + LSB_3; if (BO.DWord[Bit_Ops.Bit3] == true) Result = Result + LSB_4; if (BO.DWord[Bit_Ops.Bit4] == true) Result = Result + LSB_5; if (BO.DWord[Bit_Ops.Bit5] == true) Result = Result + LSB_6; if (BO.DWord[Bit_Ops.Bit6] == true) Result = Result + LSB_7; if (BO.DWord[Bit_Ops.Bit7] == true) Result = Result + LSB_8; ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT02.I002DataItems[CAT02.ItemIDToIndex("020")].value = Result; ////////////////////////////////////////////////////////////////////////////////// // Leave it at the current index for the next decode CAT02.CurrentDataBufferOctalIndex = CAT02.CurrentDataBufferOctalIndex + 1; }
///////////////////////////////////////////////////////////////////////// // This method returns the fifth FSPEC octet // as a BitVector32. User then can evaluate the individual bits // and interpret their meaining depending on the ASTERIX CAT public static BitVector32 GetFifthFSPECOctet(byte[] Data) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); // Move each octet into the DWORD BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[FifthFSPECS_Byte_Index]; return(BO.DWord); }
public static void DecodeCAT34I060(byte[] Data) { // At this time we do not care about the content of CAT034I060. // 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 // I034/050 Radar Plot Characteristics 1 + 1+ int Number_Of_Octets_Present = 1; // at least two, but that will be determined below // Decode 020 if (CAT34.I034DataItems[CAT34.ItemIDToIndex("060")].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[CAT34.CurrentDataBufferOctalIndex + 1]; // Now check how many data octets is present. if (BO.DWord[CAT34I060Types.Subfiled_1] == true) { Number_Of_Octets_Present++; } if (BO.DWord[CAT34I060Types.Subfiled_2] == true) { Number_Of_Octets_Present++; } if (BO.DWord[CAT34I060Types.Subfiled_3] == true) { Number_Of_Octets_Present++; } if (BO.DWord[CAT34I060Types.Subfiled_4] == true) { Number_Of_Octets_Present++; } if (BO.DWord[CAT34I060Types.Subfiled_5] == true) { Number_Of_Octets_Present++; } if (BO.DWord[CAT34I060Types.Subfiled_6] == true) { Number_Of_Octets_Present++; } if (BO.DWord[CAT34I060Types.Subfiled_7] == true) { Number_Of_Octets_Present++; } // Increase data buffer index so it ready for the next data item. CAT34.CurrentDataBufferOctalIndex = CAT34.CurrentDataBufferOctalIndex + Number_Of_Octets_Present; } }
public static void DecodeCAT34I041(byte[] Data) { // 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[CAT34.CurrentDataBufferOctalIndex + 2]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT34.CurrentDataBufferOctalIndex + 1]; double Result = 0.0; if (BO.DWord[Bit_Ops.Bit0] == true) Result = LSB_1; if (BO.DWord[Bit_Ops.Bit1] == true) Result = Result + LSB_2; if (BO.DWord[Bit_Ops.Bit2] == true) Result = Result + LSB_3; if (BO.DWord[Bit_Ops.Bit3] == true) Result = Result + LSB_4; if (BO.DWord[Bit_Ops.Bit4] == true) Result = Result + LSB_5; if (BO.DWord[Bit_Ops.Bit5] == true) Result = Result + LSB_6; if (BO.DWord[Bit_Ops.Bit6] == true) Result = Result + LSB_7; if (BO.DWord[Bit_Ops.Bit7] == true) Result = Result + LSB_8; if (BO.DWord[Bit_Ops.Bit8] == true) Result = Result + LSB_9; if (BO.DWord[Bit_Ops.Bit9] == true) Result = Result + LSB_10; if (BO.DWord[Bit_Ops.Bit10] == true) Result = Result + LSB_11; if (BO.DWord[Bit_Ops.Bit11] == true) Result = Result + LSB_12; if (BO.DWord[Bit_Ops.Bit12] == true) Result = Result + LSB_13; if (BO.DWord[Bit_Ops.Bit13] == true) Result = Result + LSB_14; if (BO.DWord[Bit_Ops.Bit14] == true) Result = Result + LSB_15; if (BO.DWord[Bit_Ops.Bit15] == true) Result = Result + LSB_16; ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT34.I034DataItems[CAT34.ItemIDToIndex("041")].value = Result; ////////////////////////////////////////////////////////////////////////////////// // Leave it at the current index for the next decode CAT34.CurrentDataBufferOctalIndex = CAT34.CurrentDataBufferOctalIndex + 2; }
public static void DecodeCAT62IREF(byte[] Data) { // Get an instance of bit ops Bit_Ops WORD0 = new Bit_Ops(); //Extract the first octet WORD0.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; int NumOfOctets = (int)WORD0.DWord[Bit_Ops.Bits0_7_Of_DWord]; // Increase data buffer index so it ready for the next data item. CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + NumOfOctets; }
///////////////////////////////////////////////////////////////////////// // This method returns the first four FSPEC octets // as a BitVector32. User then can evaluate the individual bits // and interpret their meaining depending on the ASTERIX CAT // // NOTE: It returns the four possible FSPEC, but user is first to // determine the length of the FSPEC and according to that to use it. public static BitVector32 GetFourFSPECOctets(byte[] Data) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); // Move each octet into the DWORD BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[FirstFSPECS_Byte_Index]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[SecondFSPECS_Byte_Index]; BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[ThirdFSPECS_Byte_Index]; BO.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[FourthFSPECS_Byte_Index]; return(BO.DWord); }
public static void DecodeCAT48ISPI(byte[] Data) { // 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]; int OctetsToSkip = (int)BO.DWord[Bit_Ops.Bits0_7_Of_DWord]; // Bump the index to this octet CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + OctetsToSkip; }
public static void DecodeCAT02I020(byte[] Data) { // 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[CAT02.CurrentDataBufferOctalIndex + 1]; double Result = 0.0; if (BO.DWord[Bit_Ops.Bit0] == true) { Result = LSB_1; } if (BO.DWord[Bit_Ops.Bit1] == true) { Result = Result + LSB_2; } if (BO.DWord[Bit_Ops.Bit2] == true) { Result = Result + LSB_3; } if (BO.DWord[Bit_Ops.Bit3] == true) { Result = Result + LSB_4; } if (BO.DWord[Bit_Ops.Bit4] == true) { Result = Result + LSB_5; } if (BO.DWord[Bit_Ops.Bit5] == true) { Result = Result + LSB_6; } if (BO.DWord[Bit_Ops.Bit6] == true) { Result = Result + LSB_7; } if (BO.DWord[Bit_Ops.Bit7] == true) { Result = Result + LSB_8; } ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT02.I002DataItems[CAT02.ItemIDToIndex("020")].value = Result; ////////////////////////////////////////////////////////////////////////////////// // Leave it at the current index for the next decode CAT02.CurrentDataBufferOctalIndex = CAT02.CurrentDataBufferOctalIndex + 1; }
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 DecodeCAT01I210(byte[] Data) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); // Bump the index to this octet CAT01.CurrentDataBufferOctalIndex = CAT01.CurrentDataBufferOctalIndex + 1; //Extract the first octet BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex]; // If the field extension is on then bump the index again if (BO.DWord[CAT01I020Types.Word1_FX_Index] == true) CAT01.CurrentDataBufferOctalIndex = CAT01.CurrentDataBufferOctalIndex + 1; }
public static void DecodeCAT48I170(byte[] Data) { // 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]; if (BO.DWord[CAT48I170Types.Word1_FX_Index] == true) // Increase data buffer index so it ready for the next data item. CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 1; // Increase data buffer index so it ready for the next data item. CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 1; }
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; }
public static void DecodeCAT01I210(byte[] Data) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); // Bump the index to this octet CAT01.CurrentDataBufferOctalIndex = CAT01.CurrentDataBufferOctalIndex + 1; //Extract the first octet BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT01.CurrentDataBufferOctalIndex]; // If the field extension is on then bump the index again if (BO.DWord[CAT01I020Types.Word1_FX_Index] == true) { CAT01.CurrentDataBufferOctalIndex = CAT01.CurrentDataBufferOctalIndex + 1; } }
/////////////////////////////////////////////////////////////////////////// // This one extracts the next 16 bits, which is // lenght of the data block public static int ExtractLengthOfDataBlockInBytes_Int(byte[] Data) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); // Extract first 16 bits // 15..........................0 // 00000000 00000000 // First_LEN_Octet Second_LEN_Octet BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[Second_LEN_Octet]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[First_LEN_Octet]; int Result = BO.DWord[Bit_Ops.Bits0_15_Of_DWord]; return(Result); }
public static void DecodeCAT02I000(byte[] Data) { // First define CAT01I002 class CAT02I000UserData MyI002UserData = new CAT02I000UserData(); // 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[CAT02.CurrentDataBufferOctalIndex]; int result = BO.DWord[Bit_Ops.Bits0_7_Of_DWord]; switch (result) { case 1: MyI002UserData.Message_Type = CAT02I000Types.Message_Type.North_Marker_Msg; FormMain MainFrame = Application.OpenForms[0] as FormMain; MainFrame.HandleNorthMarkMessage(); break; case 2: MyI002UserData.Message_Type = CAT02I000Types.Message_Type.Sector_Crossing_Msg; break; case 3: MyI002UserData.Message_Type = CAT02I000Types.Message_Type.South_Marker_Msg; break; case 8: MyI002UserData.Message_Type = CAT02I000Types.Message_Type.Activation_Of_Blind_Zone_Filtering; break; case 9: MyI002UserData.Message_Type = CAT02I000Types.Message_Type.Stop_Of_Blind_Zone_Filtering; break; default: break; } ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT02.I002DataItems[CAT02.ItemIDToIndex("000")].value = MyI002UserData.Message_Type; ////////////////////////////////////////////////////////////////////////////////// }
public static void DecodeCAT62I136(byte[] Data) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 1]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; double MeasuredFlightLevel = DecodeFlightLevel(BO); ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT62.I062DataItems[CAT62.ItemIDToIndex("136")].value = MeasuredFlightLevel; ////////////////////////////////////////////////////////////////////////////////// // Increase data buffer index so it ready for the next data item. CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 2; }
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 DecodeCAT62I040(byte[] Data) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 1]; int Track_Number = BO.DWord[Bit_Ops.Bits0_15_Of_DWord]; ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT62.I062DataItems[CAT62.ItemIDToIndex("040")].value = Track_Number; ////////////////////////////////////////////////////////////////////////////////// // Increase data buffer index so it ready for the next data item. CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 2; }
static double DecodeFlightLevel(Bit_Ops BO_In) { double Result = 0.0; // First check if this is a negative altitude. // and then handle it properly if (BO_In.DWord[Bit_Ops.Bit13] == true) { // Do not worry about negative values for now. Result = -1.0; } else { // A positive value if (BO_In.DWord[Bit_Ops.Bit0] == true) Result = Result + 0.25; if (BO_In.DWord[Bit_Ops.Bit1] == true) Result = Result + 0.50; if (BO_In.DWord[Bit_Ops.Bit2] == true) Result = Result + 1.00; if (BO_In.DWord[Bit_Ops.Bit3] == true) Result = Result + 2.00; if (BO_In.DWord[Bit_Ops.Bit4] == true) Result = Result + 4.00; if (BO_In.DWord[Bit_Ops.Bit5] == true) Result = Result + 8.00; if (BO_In.DWord[Bit_Ops.Bit6] == true) Result = Result + 16.00; if (BO_In.DWord[Bit_Ops.Bit7] == true) Result = Result + 32.00; if (BO_In.DWord[Bit_Ops.Bit8] == true) Result = Result + 64.00; if (BO_In.DWord[Bit_Ops.Bit9] == true) Result = Result + 128.00; if (BO_In.DWord[Bit_Ops.Bit10] == true) Result = Result + 256.00; if (BO_In.DWord[Bit_Ops.Bit11] == true) Result = Result + 512.00; if (BO_In.DWord[Bit_Ops.Bit12] == true) Result = Result + 1024.00; } return Result; }
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; }
public static void DecodeCAT62I340(byte[] Data) { // Get an instance of bit ops Bit_Ops WORD0 = new Bit_Ops(); //Extract the first octet WORD0.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 2; // 2 SIC/SAC if (WORD0.DWord[CAT62I340Types.Sensor_Identification] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD0.DWord[CAT62I340Types.Measured_Position] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 4; } if (WORD0.DWord[CAT62I340Types.Measured_3_D_Height] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 2; } if (WORD0.DWord[CAT62I340Types.Last_Measured_Mode_C_Code] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 2; } if (WORD0.DWord[CAT62I340Types.Last_Measured_Mode_3_A_Code] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 2; } if (WORD0.DWord[CAT62I340Types.Report_Type] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } }
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; }
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; }
// This method returns the lenght of FSPEC in bytes (8bits). // The minumum value is 1, and if it is bigger than one byte then // bit 8 is set to true to indicate that next byte is also used // as FSPEC field. After the last FSPEC field ASTERIX data items begin. public static int DetermineLenghtOfFSPEC(byte[] Data) { // Assume it is 1 int LenghtOfFSPEC = 1; // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); // Move each octet into the DWORD BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[FirstFSPECS_Byte_Index]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[SecondFSPECS_Byte_Index]; BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[ThirdFSPECS_Byte_Index]; BO.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[FourthFSPECS_Byte_Index]; //////////////////////////////////////////////////////////////////////// // Now check for the 8th bit of each FSPEC field. If it is set // to true then the next octet is also FSPEC. if (BO.DWord[Bit_Ops.Bit0] == true) { LenghtOfFSPEC++; if (BO.DWord[Bit_Ops.Bit8] == true) { LenghtOfFSPEC++; if (BO.DWord[Bit_Ops.Bit16] == true) { LenghtOfFSPEC++; if (BO.DWord[Bit_Ops.Bit24] == true) { LenghtOfFSPEC++; } } } } return(LenghtOfFSPEC); }
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; }
public static void DecodeCAT02I030(byte[] Data) { CAT02I030Types.CAT02I030_Time_Of_The_Day_User_Type MyCAT02I030 = new CAT02I030Types.CAT02I030_Time_Of_The_Day_User_Type(); // 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[CAT02.CurrentDataBufferOctalIndex + 3]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT02.CurrentDataBufferOctalIndex + 2]; BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT02.CurrentDataBufferOctalIndex + 1]; double Result = 0.0; if (BO.DWord[Bit_Ops.Bit0] == true) Result = LSB_1; if (BO.DWord[Bit_Ops.Bit1] == true) Result = Result + LSB_2; if (BO.DWord[Bit_Ops.Bit2] == true) Result = Result + LSB_3; if (BO.DWord[Bit_Ops.Bit3] == true) Result = Result + LSB_4; if (BO.DWord[Bit_Ops.Bit4] == true) Result = Result + LSB_5; if (BO.DWord[Bit_Ops.Bit5] == true) Result = Result + LSB_6; if (BO.DWord[Bit_Ops.Bit6] == true) Result = Result + LSB_7; if (BO.DWord[Bit_Ops.Bit7] == true) Result = Result + LSB_8; if (BO.DWord[Bit_Ops.Bit8] == true) Result = Result + LSB_9; if (BO.DWord[Bit_Ops.Bit9] == true) Result = Result + LSB_10; if (BO.DWord[Bit_Ops.Bit10] == true) Result = Result + LSB_11; if (BO.DWord[Bit_Ops.Bit11] == true) Result = Result + LSB_12; if (BO.DWord[Bit_Ops.Bit12] == true) Result = Result + LSB_13; if (BO.DWord[Bit_Ops.Bit13] == true) Result = Result + LSB_14; if (BO.DWord[Bit_Ops.Bit14] == true) Result = Result + LSB_15; if (BO.DWord[Bit_Ops.Bit15] == true) Result = Result + LSB_16; if (BO.DWord[Bit_Ops.Bit16] == true) Result = Result + LSB_17; if (BO.DWord[Bit_Ops.Bit17] == true) Result = Result + LSB_18; if (BO.DWord[Bit_Ops.Bit18] == true) Result = Result + LSB_19; if (BO.DWord[Bit_Ops.Bit19] == true) Result = Result + LSB_20; if (BO.DWord[Bit_Ops.Bit20] == true) Result = Result + LSB_21; if (BO.DWord[Bit_Ops.Bit21] == true) Result = Result + LSB_22; if (BO.DWord[Bit_Ops.Bit22] == true) Result = Result + LSB_23; if (BO.DWord[Bit_Ops.Bit23] == true) Result = Result + LSB_24; MyCAT02I030.Time_Of_The_Day_In_Sec_Since_Midnight_UTC = Result; // Compute the time in a human friendy form // from sec.miliec since midnight UTC. double hrs, sec, min, milis; hrs = Math.Floor(Result / 3600.00); double tmp = (Result - (hrs * 3600.0)) / 60; min = Math.Floor(tmp); tmp = (tmp * 60.0) - (min * 60.0); sec = Math.Floor(tmp); milis = (tmp - sec) * 1000.0; MyCAT02I030.TimeOfDay = new TimeSpan(0, (int)hrs, (int)min, (int)sec, (int)milis); ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT02.I002DataItems[CAT02.ItemIDToIndex("030")].value = MyCAT02I030; ////////////////////////////////////////////////////////////////////////////////// // Leave it at the current index for the next decode CAT02.CurrentDataBufferOctalIndex = CAT02.CurrentDataBufferOctalIndex + 3; }
public static void DecodeCAT62I290(byte[] Data) { // Get an instance of bit ops Bit_Ops WORD0 = new Bit_Ops(); Bit_Ops WORD1 = new Bit_Ops(); //Extract the first octet WORD0.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; if (WORD0.DWord[CAT62I290Types.WORD0_FX_Extension_Indicator] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; WORD1.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; } CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; // 2 SIC/SAC if (WORD0.DWord[CAT62I290Types.Track_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 7 (7 Char Callsign) if (WORD0.DWord[CAT62I290Types.PSR_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 4 if (WORD0.DWord[CAT62I290Types.SSR_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 1 if (WORD0.DWord[CAT62I290Types.Mode_S_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 4 if (WORD0.DWord[CAT62I290Types.ADS_C_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 1 if (WORD0.DWord[CAT62I290Types.ADS_B_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 4 if (WORD0.DWord[CAT62I290Types.ADS_B_VDL_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 4 if (WORD1.DWord[CAT62I290Types.ADS_B_UAT_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 3 if (WORD1.DWord[CAT62I290Types.Loop_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 2 if (WORD1.DWord[CAT62I290Types.Multilateration_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } }
static double DecodeFlightLevel(Bit_Ops BO_In) { double Result = 0.0; // First check if this is a negative altitude. // and then handle it properly if (BO_In.DWord[Bit_Ops.Bit13] == true) { BO_In.DWord[Bit_Ops.Bit0] = !BO_In.DWord[Bit_Ops.Bit0]; BO_In.DWord[Bit_Ops.Bit1] = !BO_In.DWord[Bit_Ops.Bit1]; BO_In.DWord[Bit_Ops.Bit2] = !BO_In.DWord[Bit_Ops.Bit2]; BO_In.DWord[Bit_Ops.Bit3] = !BO_In.DWord[Bit_Ops.Bit3]; BO_In.DWord[Bit_Ops.Bit4] = !BO_In.DWord[Bit_Ops.Bit4]; BO_In.DWord[Bit_Ops.Bit5] = !BO_In.DWord[Bit_Ops.Bit5]; BO_In.DWord[Bit_Ops.Bit6] = !BO_In.DWord[Bit_Ops.Bit6]; BO_In.DWord[Bit_Ops.Bit7] = !BO_In.DWord[Bit_Ops.Bit7]; BO_In.DWord[Bit_Ops.Bit8] = !BO_In.DWord[Bit_Ops.Bit8]; BO_In.DWord[Bit_Ops.Bit9] = !BO_In.DWord[Bit_Ops.Bit9]; BO_In.DWord[Bit_Ops.Bit10] = !BO_In.DWord[Bit_Ops.Bit10]; BO_In.DWord[Bit_Ops.Bit11] = !BO_In.DWord[Bit_Ops.Bit11]; BO_In.DWord[Bit_Ops.Bit12] = !BO_In.DWord[Bit_Ops.Bit12]; BO_In.DWord[Bit_Ops.Bit13] = false; BO_In.DWord[Bit_Ops.Bit14] = false; BO_In.DWord[Bit_Ops.Bit15] = false; BO_In.DWord[Bit_Ops.Bits0_15_Of_DWord] = BO_In.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; if (BO_In.DWord[Bit_Ops.Bit0] == true) { Result = Result + 0.25; } if (BO_In.DWord[Bit_Ops.Bit1] == true) { Result = Result + 0.50; } if (BO_In.DWord[Bit_Ops.Bit2] == true) { Result = Result + 1.00; } if (BO_In.DWord[Bit_Ops.Bit3] == true) { Result = Result + 2.00; } if (BO_In.DWord[Bit_Ops.Bit4] == true) { Result = Result + 4.00; } if (BO_In.DWord[Bit_Ops.Bit5] == true) { Result = Result + 8.00; } if (BO_In.DWord[Bit_Ops.Bit6] == true) { Result = Result + 16.00; } if (BO_In.DWord[Bit_Ops.Bit7] == true) { Result = Result + 32.00; } if (BO_In.DWord[Bit_Ops.Bit8] == true) { Result = Result + 64.00; } if (BO_In.DWord[Bit_Ops.Bit9] == true) { Result = Result + 128.00; } if (BO_In.DWord[Bit_Ops.Bit10] == true) { Result = Result + 256.00; } if (BO_In.DWord[Bit_Ops.Bit11] == true) { Result = Result + 512.00; } if (BO_In.DWord[Bit_Ops.Bit12] == true) { Result = Result + 1024.00; } Result = -Result; } else { // A positive value if (BO_In.DWord[Bit_Ops.Bit0] == true) { Result = Result + 0.25; } if (BO_In.DWord[Bit_Ops.Bit1] == true) { Result = Result + 0.50; } if (BO_In.DWord[Bit_Ops.Bit2] == true) { Result = Result + 1.00; } if (BO_In.DWord[Bit_Ops.Bit3] == true) { Result = Result + 2.00; } if (BO_In.DWord[Bit_Ops.Bit4] == true) { Result = Result + 4.00; } if (BO_In.DWord[Bit_Ops.Bit5] == true) { Result = Result + 8.00; } if (BO_In.DWord[Bit_Ops.Bit6] == true) { Result = Result + 16.00; } if (BO_In.DWord[Bit_Ops.Bit7] == true) { Result = Result + 32.00; } if (BO_In.DWord[Bit_Ops.Bit8] == true) { Result = Result + 64.00; } if (BO_In.DWord[Bit_Ops.Bit9] == true) { Result = Result + 128.00; } if (BO_In.DWord[Bit_Ops.Bit10] == true) { Result = Result + 256.00; } if (BO_In.DWord[Bit_Ops.Bit11] == true) { Result = Result + 512.00; } if (BO_In.DWord[Bit_Ops.Bit12] == true) { Result = Result + 1024.00; } } return(Result); }
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; }
public static void DecodeCAT62I185(byte[] Data) { CAT62I185Types.CalculatedGSPandHDG_Type CalculatedGSPDandHDG = new CAT62I185Types.CalculatedGSPandHDG_Type(); // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 3]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 2]; BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 1]; BO.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; double Vx = 0.0; double Vy = 0.0; /////////////////////////////////////////////////////////////////////////////////////// // Decode Vx /////////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[Bit_Ops.Bit31] == true) { Bit_Ops BO1_Temp = new Bit_Ops(); BO1_Temp.DWord[Bit_Ops.Bit0] = !BO.DWord[Bit_Ops.Bit16]; BO1_Temp.DWord[Bit_Ops.Bit1] = !BO.DWord[Bit_Ops.Bit17]; BO1_Temp.DWord[Bit_Ops.Bit2] = !BO.DWord[Bit_Ops.Bit18]; BO1_Temp.DWord[Bit_Ops.Bit3] = !BO.DWord[Bit_Ops.Bit19]; BO1_Temp.DWord[Bit_Ops.Bit4] = !BO.DWord[Bit_Ops.Bit20]; BO1_Temp.DWord[Bit_Ops.Bit5] = !BO.DWord[Bit_Ops.Bit21]; BO1_Temp.DWord[Bit_Ops.Bit6] = !BO.DWord[Bit_Ops.Bit22]; BO1_Temp.DWord[Bit_Ops.Bit7] = !BO.DWord[Bit_Ops.Bit23]; BO1_Temp.DWord[Bit_Ops.Bit8] = !BO.DWord[Bit_Ops.Bit24]; BO1_Temp.DWord[Bit_Ops.Bit9] = !BO.DWord[Bit_Ops.Bit25]; BO1_Temp.DWord[Bit_Ops.Bit10] = !BO.DWord[Bit_Ops.Bit26]; BO1_Temp.DWord[Bit_Ops.Bit11] = !BO.DWord[Bit_Ops.Bit27]; BO1_Temp.DWord[Bit_Ops.Bit12] = !BO.DWord[Bit_Ops.Bit28]; BO1_Temp.DWord[Bit_Ops.Bit13] = !BO.DWord[Bit_Ops.Bit29]; BO1_Temp.DWord[Bit_Ops.Bit14] = !BO.DWord[Bit_Ops.Bit30]; BO1_Temp.DWord[Bit_Ops.Bit15] = !BO.DWord[Bit_Ops.Bit31]; BO1_Temp.DWord[Bit_Ops.Bit16] = false; BO1_Temp.DWord[Bit_Ops.Bit17] = false; BO1_Temp.DWord[Bit_Ops.Bit18] = false; BO1_Temp.DWord[Bit_Ops.Bit19] = false; BO1_Temp.DWord[Bit_Ops.Bit20] = false; BO1_Temp.DWord[Bit_Ops.Bit21] = false; BO1_Temp.DWord[Bit_Ops.Bit22] = false; BO1_Temp.DWord[Bit_Ops.Bit23] = false; BO1_Temp.DWord[Bit_Ops.Bit24] = false; BO1_Temp.DWord[Bit_Ops.Bit25] = false; BO1_Temp.DWord[Bit_Ops.Bit26] = false; BO1_Temp.DWord[Bit_Ops.Bit27] = false; BO1_Temp.DWord[Bit_Ops.Bit28] = false; BO1_Temp.DWord[Bit_Ops.Bit29] = false; BO1_Temp.DWord[Bit_Ops.Bit30] = false; BO1_Temp.DWord[Bit_Ops.Bit31] = false; BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] = BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; if (BO1_Temp.DWord[Bit_Ops.Bit0] == true) { Vx = V_1; } if (BO1_Temp.DWord[Bit_Ops.Bit1] == true) { Vx = Vx + V_2; } if (BO1_Temp.DWord[Bit_Ops.Bit2] == true) { Vx = Vx + V_3; } if (BO1_Temp.DWord[Bit_Ops.Bit3] == true) { Vx = Vx + V_4; } if (BO1_Temp.DWord[Bit_Ops.Bit4] == true) { Vx = Vx + V_5; } if (BO1_Temp.DWord[Bit_Ops.Bit5] == true) { Vx = Vx + V_6; } if (BO1_Temp.DWord[Bit_Ops.Bit6] == true) { Vx = Vx + V_7; } if (BO1_Temp.DWord[Bit_Ops.Bit7] == true) { Vx = Vx + V_8; } if (BO1_Temp.DWord[Bit_Ops.Bit8] == true) { Vx = Vx + V_9; } if (BO1_Temp.DWord[Bit_Ops.Bit9] == true) { Vx = Vx + V_10; } if (BO1_Temp.DWord[Bit_Ops.Bit10] == true) { Vx = Vx + V_11; } if (BO1_Temp.DWord[Bit_Ops.Bit11] == true) { Vx = Vx + V_12; } if (BO1_Temp.DWord[Bit_Ops.Bit12] == true) { Vx = Vx + V_13; } if (BO1_Temp.DWord[Bit_Ops.Bit13] == true) { Vx = Vx + V_14; } if (BO1_Temp.DWord[Bit_Ops.Bit14] == true) { Vx = Vx + V_15; } if (BO1_Temp.DWord[Bit_Ops.Bit15] == true) { Vx = Vx + V_16; } Vx = -Vx; } else { if (BO.DWord[Bit_Ops.Bit16] == true) { Vx = V_1; } if (BO.DWord[Bit_Ops.Bit17] == true) { Vx = Vx + V_2; } if (BO.DWord[Bit_Ops.Bit18] == true) { Vx = Vx + V_3; } if (BO.DWord[Bit_Ops.Bit19] == true) { Vx = Vx + V_4; } if (BO.DWord[Bit_Ops.Bit20] == true) { Vx = Vx + V_5; } if (BO.DWord[Bit_Ops.Bit21] == true) { Vx = Vx + V_6; } if (BO.DWord[Bit_Ops.Bit22] == true) { Vx = Vx + V_7; } if (BO.DWord[Bit_Ops.Bit23] == true) { Vx = Vx + V_8; } if (BO.DWord[Bit_Ops.Bit24] == true) { Vx = Vx + V_9; } if (BO.DWord[Bit_Ops.Bit25] == true) { Vx = Vx + V_10; } if (BO.DWord[Bit_Ops.Bit26] == true) { Vx = Vx + V_11; } if (BO.DWord[Bit_Ops.Bit27] == true) { Vx = Vx + V_12; } if (BO.DWord[Bit_Ops.Bit28] == true) { Vx = Vx + V_13; } if (BO.DWord[Bit_Ops.Bit29] == true) { Vx = Vx + V_14; } if (BO.DWord[Bit_Ops.Bit30] == true) { Vx = Vx + V_15; } if (BO.DWord[Bit_Ops.Bit31] == true) { Vx = Vx + V_16; } } /////////////////////////////////////////////////////////////////////////////////////// // Decode Vy /////////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[Bit_Ops.Bit15] == true) { Bit_Ops BO1_Temp = new Bit_Ops(); BO1_Temp.DWord[Bit_Ops.Bit0] = !BO.DWord[Bit_Ops.Bit0]; BO1_Temp.DWord[Bit_Ops.Bit1] = !BO.DWord[Bit_Ops.Bit1]; BO1_Temp.DWord[Bit_Ops.Bit2] = !BO.DWord[Bit_Ops.Bit2]; BO1_Temp.DWord[Bit_Ops.Bit3] = !BO.DWord[Bit_Ops.Bit3]; BO1_Temp.DWord[Bit_Ops.Bit4] = !BO.DWord[Bit_Ops.Bit4]; BO1_Temp.DWord[Bit_Ops.Bit5] = !BO.DWord[Bit_Ops.Bit5]; BO1_Temp.DWord[Bit_Ops.Bit6] = !BO.DWord[Bit_Ops.Bit6]; BO1_Temp.DWord[Bit_Ops.Bit7] = !BO.DWord[Bit_Ops.Bit7]; BO1_Temp.DWord[Bit_Ops.Bit8] = !BO.DWord[Bit_Ops.Bit8]; BO1_Temp.DWord[Bit_Ops.Bit9] = !BO.DWord[Bit_Ops.Bit9]; BO1_Temp.DWord[Bit_Ops.Bit10] = !BO.DWord[Bit_Ops.Bit10]; BO1_Temp.DWord[Bit_Ops.Bit11] = !BO.DWord[Bit_Ops.Bit11]; BO1_Temp.DWord[Bit_Ops.Bit12] = !BO.DWord[Bit_Ops.Bit12]; BO1_Temp.DWord[Bit_Ops.Bit13] = !BO.DWord[Bit_Ops.Bit13]; BO1_Temp.DWord[Bit_Ops.Bit14] = !BO.DWord[Bit_Ops.Bit14]; BO1_Temp.DWord[Bit_Ops.Bit15] = !BO.DWord[Bit_Ops.Bit15]; BO1_Temp.DWord[Bit_Ops.Bit16] = false; BO1_Temp.DWord[Bit_Ops.Bit17] = false; BO1_Temp.DWord[Bit_Ops.Bit18] = false; BO1_Temp.DWord[Bit_Ops.Bit19] = false; BO1_Temp.DWord[Bit_Ops.Bit20] = false; BO1_Temp.DWord[Bit_Ops.Bit21] = false; BO1_Temp.DWord[Bit_Ops.Bit22] = false; BO1_Temp.DWord[Bit_Ops.Bit23] = false; BO1_Temp.DWord[Bit_Ops.Bit24] = false; BO1_Temp.DWord[Bit_Ops.Bit25] = false; BO1_Temp.DWord[Bit_Ops.Bit26] = false; BO1_Temp.DWord[Bit_Ops.Bit27] = false; BO1_Temp.DWord[Bit_Ops.Bit28] = false; BO1_Temp.DWord[Bit_Ops.Bit29] = false; BO1_Temp.DWord[Bit_Ops.Bit30] = false; BO1_Temp.DWord[Bit_Ops.Bit31] = false; BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] = BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; if (BO1_Temp.DWord[Bit_Ops.Bit0] == true) { Vy = V_1; } if (BO1_Temp.DWord[Bit_Ops.Bit1] == true) { Vy = Vy + V_2; } if (BO1_Temp.DWord[Bit_Ops.Bit2] == true) { Vy = Vy + V_3; } if (BO1_Temp.DWord[Bit_Ops.Bit3] == true) { Vy = Vy + V_4; } if (BO1_Temp.DWord[Bit_Ops.Bit4] == true) { Vy = Vy + V_5; } if (BO1_Temp.DWord[Bit_Ops.Bit5] == true) { Vy = Vy + V_6; } if (BO1_Temp.DWord[Bit_Ops.Bit6] == true) { Vy = Vy + V_7; } if (BO1_Temp.DWord[Bit_Ops.Bit7] == true) { Vy = Vy + V_8; } if (BO1_Temp.DWord[Bit_Ops.Bit8] == true) { Vy = Vy + V_9; } if (BO1_Temp.DWord[Bit_Ops.Bit9] == true) { Vy = Vy + V_10; } if (BO1_Temp.DWord[Bit_Ops.Bit10] == true) { Vy = Vy + V_11; } if (BO1_Temp.DWord[Bit_Ops.Bit11] == true) { Vy = Vy + V_12; } if (BO1_Temp.DWord[Bit_Ops.Bit12] == true) { Vy = Vy + V_13; } if (BO1_Temp.DWord[Bit_Ops.Bit13] == true) { Vy = Vy + V_14; } if (BO1_Temp.DWord[Bit_Ops.Bit14] == true) { Vy = Vy + V_15; } if (BO1_Temp.DWord[Bit_Ops.Bit15] == true) { Vy = Vy + V_16; } Vy = -Vy; } else { if (BO.DWord[Bit_Ops.Bit0] == true) { Vy = V_1; } if (BO.DWord[Bit_Ops.Bit1] == true) { Vy = Vy + V_2; } if (BO.DWord[Bit_Ops.Bit2] == true) { Vy = Vy + V_3; } if (BO.DWord[Bit_Ops.Bit3] == true) { Vy = Vy + V_4; } if (BO.DWord[Bit_Ops.Bit4] == true) { Vy = Vy + V_5; } if (BO.DWord[Bit_Ops.Bit5] == true) { Vy = Vy + V_6; } if (BO.DWord[Bit_Ops.Bit6] == true) { Vy = Vy + V_7; } if (BO.DWord[Bit_Ops.Bit7] == true) { Vy = Vy + V_8; } if (BO.DWord[Bit_Ops.Bit8] == true) { Vy = Vy + V_9; } if (BO.DWord[Bit_Ops.Bit9] == true) { Vy = Vy + V_10; } if (BO.DWord[Bit_Ops.Bit10] == true) { Vy = Vy + V_11; } if (BO.DWord[Bit_Ops.Bit11] == true) { Vy = Vy + V_12; } if (BO.DWord[Bit_Ops.Bit12] == true) { Vy = Vy + V_13; } if (BO.DWord[Bit_Ops.Bit13] == true) { Vy = Vy + V_14; } if (BO.DWord[Bit_Ops.Bit14] == true) { Vy = Vy + V_15; } if (BO.DWord[Bit_Ops.Bit15] == true) { Vy = Vy + V_16; } } CalculatedGSPDandHDG = ToPolarFromCarteisan(Vx, Vy); ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT62.I062DataItems[CAT62.ItemIDToIndex("185")].value = CalculatedGSPDandHDG; ////////////////////////////////////////////////////////////////////////////////// // Increase data buffer index so it ready for the next data item. CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 4; }
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; }
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; }
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; }
public static void DecodeCAT34I050(byte[] Data) { // At this time we do not care about the content of CAT034I050. // However it is necessary to determine how many subfields of 8 octets // is present so that data buffer can be updated accordingly in order to // decode the other fileds of interest // NOTE: We assume that only first 7 defined subfields are present // I034/050 System Configuration and Status 1 + 1+ int Number_Of_Octets_Present = 1; // at least two, but that will be determined below // Decode 020 if (CAT34.I034DataItems[CAT34.ItemIDToIndex("050")].HasBeenPresent == true) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); Bit_Ops CAT34_I050_Data = new Bit_Ops(); //Extract the first octet BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT34.CurrentDataBufferOctalIndex + 1]; CAT34I050Types.CAT34I050UserData ThisCycleData = new CAT34I050Types.CAT34I050UserData(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Now check how many data octets is present and decode the present subfileds at the same time //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// // COM - Common elements of a System ////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[CAT34I050Types.Subfiled_1] == true) { Number_Of_Octets_Present++; CAT34_I050_Data.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT34.CurrentDataBufferOctalIndex + Number_Of_Octets_Present]; ThisCycleData.COM_Data.Data_Present = true; ThisCycleData.COM_Data.System_is_NOGO = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_1]; ThisCycleData.COM_Data.RDPC2_Selected = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_2]; ThisCycleData.COM_Data.RDPC_Reset = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_3]; ThisCycleData.COM_Data.RDP_Overloaded = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_4]; ThisCycleData.COM_Data.Transmision_Sys_Overloaded = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_5]; ThisCycleData.COM_Data.Monitor_Sys_Disconected = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_6]; ThisCycleData.COM_Data.Time_Source_Invalid = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_7]; } ////////////////////////////////////////////////////////////////////////////////// // Spare ////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[CAT34I050Types.Subfiled_2] == true) { Number_Of_Octets_Present++; CAT34_I050_Data.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT34.CurrentDataBufferOctalIndex + Number_Of_Octets_Present]; } ////////////////////////////////////////////////////////////////////////////////// // Spare ////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[CAT34I050Types.Subfiled_3] == true) { Number_Of_Octets_Present++; CAT34_I050_Data.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT34.CurrentDataBufferOctalIndex + Number_Of_Octets_Present]; } ////////////////////////////////////////////////////////////////////////////////// // PSR - Primary sensor component ////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[CAT34I050Types.Subfiled_4] == true) { Number_Of_Octets_Present++; CAT34_I050_Data.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT34.CurrentDataBufferOctalIndex + Number_Of_Octets_Present]; ThisCycleData.PSR_Data.Data_Present = true; ThisCycleData.PSR_Data.Ant_2_Selected = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_1]; if (CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_3] == true && CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_2] == true) { ThisCycleData.PSR_Data.CH_Status = CAT34I050Types.PSR.Channel_Status.Channel_A_and_B; } else if (CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_3] == false && CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_2] == false) { ThisCycleData.PSR_Data.CH_Status = CAT34I050Types.PSR.Channel_Status.No_Channel; } else if (CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_3] == true) { ThisCycleData.PSR_Data.CH_Status = CAT34I050Types.PSR.Channel_Status.Channel_A; } else { ThisCycleData.PSR_Data.CH_Status = CAT34I050Types.PSR.Channel_Status.Channel_B; } ThisCycleData.PSR_Data.PSR_Overloaded = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_4]; ThisCycleData.PSR_Data.Monitor_Sys_Disconected = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_5]; } ////////////////////////////////////////////////////////////////////////////////// // SSR - Secondary sensor component ////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[CAT34I050Types.Subfiled_5] == true) { Number_Of_Octets_Present++; CAT34_I050_Data.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT34.CurrentDataBufferOctalIndex + Number_Of_Octets_Present]; ThisCycleData.SSR_Data.Data_Present = true; ThisCycleData.SSR_Data.Ant_2_Selected = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_1]; if (CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_3] == true && CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_2] == true) { ThisCycleData.SSR_Data.CH_Status = CAT34I050Types.SSR.Channel_Status.Invalid_Combination; } else if (CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_3] == false && CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_2] == false) { ThisCycleData.SSR_Data.CH_Status = CAT34I050Types.SSR.Channel_Status.No_Channel; } else if (CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_3] == true) { ThisCycleData.SSR_Data.CH_Status = CAT34I050Types.SSR.Channel_Status.Channel_A; } else { ThisCycleData.SSR_Data.CH_Status = CAT34I050Types.SSR.Channel_Status.Channel_B; } ThisCycleData.SSR_Data.SSR_Overloaded = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_4]; ThisCycleData.SSR_Data.Monitor_Sys_Disconected = CAT34_I050_Data.DWord[CAT34I050Types.Subfiled_5]; } ////////////////////////////////////////////////////////////////////////////////// // MDS - Mode-S sensor component ////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[CAT34I050Types.Subfiled_6] == true) { Number_Of_Octets_Present++; // Mode S subfield is 2 octets CAT34_I050_Data.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT34.CurrentDataBufferOctalIndex + Number_Of_Octets_Present]; ThisCycleData.MDS_Data.Data_Present = true; ThisCycleData.MDS_Data.Ant_2_Selected = BO.DWord[CAT34I050Types.Subfiled_1]; if (BO.DWord[CAT34I050Types.Subfiled_3] == true && BO.DWord[CAT34I050Types.Subfiled_2] == true) { ThisCycleData.MDS_Data.CH_Status = CAT34I050Types.MDS.Channel_Status.Illegal_Combination; } else if (BO.DWord[CAT34I050Types.Subfiled_3] == false && BO.DWord[CAT34I050Types.Subfiled_2] == false) { ThisCycleData.MDS_Data.CH_Status = CAT34I050Types.MDS.Channel_Status.No_Channel; } else if (BO.DWord[CAT34I050Types.Subfiled_3] == true) { ThisCycleData.MDS_Data.CH_Status = CAT34I050Types.MDS.Channel_Status.Channel_A; } else { ThisCycleData.MDS_Data.CH_Status = CAT34I050Types.MDS.Channel_Status.Channel_B; } ThisCycleData.MDS_Data.ModeS_Overloaded = BO.DWord[CAT34I050Types.Subfiled_4]; ThisCycleData.MDS_Data.Monitor_Sys_Disconected = BO.DWord[CAT34I050Types.Subfiled_5]; ThisCycleData.MDS_Data.CH2_For_Coordination_In_Use = BO.DWord[CAT34I050Types.Subfiled_6]; ThisCycleData.MDS_Data.CH2_For_DataLink_In_Use = BO.DWord[CAT34I050Types.Subfiled_7]; ThisCycleData.MDS_Data.Coordination_Func_Overload = BO.DWord[CAT34I050Types.FX_Primary_Subfiled]; // Not really FX but the index is correct Number_Of_Octets_Present++; // Mode S subfield is 2 octets CAT34_I050_Data.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT34.CurrentDataBufferOctalIndex + Number_Of_Octets_Present]; ThisCycleData.MDS_Data.DataLink_Func_Overload = BO.DWord[CAT34I050Types.Subfiled_1]; } ////////////////////////////////////////////////////////////////////////////////// // Spare ////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[CAT34I050Types.Subfiled_7] == true) { Number_Of_Octets_Present++; CAT34_I050_Data.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT34.CurrentDataBufferOctalIndex + Number_Of_Octets_Present]; } ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT34.I034DataItems[CAT34.ItemIDToIndex("050")].value = ThisCycleData; ////////////////////////////////////////////////////////////////////////////////// // Increase data buffer index so it ready for the next data item. CAT34.CurrentDataBufferOctalIndex = CAT34.CurrentDataBufferOctalIndex + Number_Of_Octets_Present; } }
public static void DecodeCAT62I295(byte[] Data) { // Get an instance of bit ops Bit_Ops WORD0 = new Bit_Ops(); Bit_Ops WORD1 = new Bit_Ops(); Bit_Ops WORD2 = new Bit_Ops(); Bit_Ops WORD3 = new Bit_Ops(); Bit_Ops WORD4 = new Bit_Ops(); //Extract the first octet WORD0.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; if (WORD0.DWord[CAT62I295Types.WORD0_FX_Extension_Indicator] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; WORD1.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; if (WORD1.DWord[CAT62I295Types.WORD1_FX_Extension_Indicator] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; WORD2.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; if (WORD2.DWord[CAT62I295Types.WORD2_FX_Extension_Indicator] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; WORD3.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; if (WORD3.DWord[CAT62I295Types.WORD3_FX_Extension_Indicator] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; WORD4.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; if (WORD4.DWord[CAT62I295Types.WORD4_FX_Extension_Indicator] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } } } } } CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; // WORD0 if (WORD0.DWord[CAT62I295Types.Measured_Flight_Level_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD0.DWord[CAT62I295Types.Mode_1_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD0.DWord[CAT62I295Types.Mode_2_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD0.DWord[CAT62I295Types.Mode_3_A_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD0.DWord[CAT62I295Types.Mode_4_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD0.DWord[CAT62I295Types.Mode_5_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD0.DWord[CAT62I295Types.Magnetic_Heading_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } //WORD1 if (WORD1.DWord[CAT62I295Types.Indicated_Airspeed_Mach_Nb_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD1.DWord[CAT62I295Types.True_Airspeed_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD1.DWord[CAT62I295Types.Selected_Altitude_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD1.DWord[CAT62I295Types.Final_State_Selected_Altitude_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD1.DWord[CAT62I295Types.Trajectory_Intent_Data_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD1.DWord[CAT62I295Types.COM_ACAS_Capability_and_Flight_Status_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD1.DWord[CAT62I295Types.Status_Reported_by_ADS_B_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } //WORD2 if (WORD2.DWord[CAT62I295Types.ACAS_Resolution_Advisory_Report_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD2.DWord[CAT62I295Types.Barometric_Vertical_Rate_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD2.DWord[CAT62I295Types.Geometric_Vertical_Rate_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD2.DWord[CAT62I295Types.Roll_Angle_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD2.DWord[CAT62I295Types.Track_Angle_Rate_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD2.DWord[CAT62I295Types.Track_Angle_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD2.DWord[CAT62I295Types.Ground_Speed_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } //WORD3 if (WORD3.DWord[CAT62I295Types.Velocity_Uncertainty_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD3.DWord[CAT62I295Types.Meteorological_Data_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD3.DWord[CAT62I295Types.Emitter_Category_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD3.DWord[CAT62I295Types.Position_Data_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD3.DWord[CAT62I295Types.Geometric_Altitude_Data_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD3.DWord[CAT62I295Types.Position_Uncertainty_Data_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD3.DWord[CAT62I295Types.Mode_S_MB_Data_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } //WORD4 if (WORD4.DWord[CAT62I295Types.Indicated_Airspeed_Data_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD4.DWord[CAT62I295Types.Mach_NumberAData_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } if (WORD4.DWord[CAT62I295Types.Barometric_Pressure_Setting_Data_Age] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } }
public static void DecodeCAT62I220(byte[] Data) { // Define a global record for all data, then down there depending on the avalability of each field // populate specific items. Each item has validity flag that needs to be set for each available data // item for this message CAT62I220Types.CalculatedRateOfClimbDescent CAT62I220DataRecord = new CAT62I220Types.CalculatedRateOfClimbDescent(); /////////////////////////////////////////////////////////////// // Track_Angle and Magnetic Heading DECODE CONSTANTS double RCD_1 = 6.25; // LSB Feet/MIN double RCD_2 = RCD_1 * 2.0; double RCD_3 = RCD_2 * 2.0; double RCD_4 = RCD_3 * 2.0; double RCD_5 = RCD_4 * 2.0; double RCD_6 = RCD_5 * 2.0; double RCD_7 = RCD_6 * 2.0; double RCD_8 = RCD_7 * 2.0; double RCD_9 = RCD_8 * 2.0; double RCD_10 = RCD_9 * 2.0; double RCD_11 = RCD_10 * 2.0; double RCD_12 = RCD_11 * 2.0; double RCD_13 = RCD_12 * 2.0; double RCD_14 = RCD_13 * 2.0; double RCD_15 = RCD_14 * 2.0; double RCD_16 = RCD_15 * 2.0; // MSB /////////////////////////////////////////////////////////////////// Bit_Ops BO = new Bit_Ops(); BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 1]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; double Value = 0.0; if (BO.DWord[Bit_Ops.Bit15]) { 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.Bits0_15_Of_DWord] = BO.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; if (BO.DWord[Bit_Ops.Bit0]) { Value = RCD_1; } if (BO.DWord[Bit_Ops.Bit1]) { Value = Value + RCD_2; } if (BO.DWord[Bit_Ops.Bit2]) { Value = Value + RCD_3; } if (BO.DWord[Bit_Ops.Bit3]) { Value = Value + RCD_4; } if (BO.DWord[Bit_Ops.Bit4]) { Value = Value + RCD_5; } if (BO.DWord[Bit_Ops.Bit5]) { Value = Value + RCD_6; } if (BO.DWord[Bit_Ops.Bit6]) { Value = Value + RCD_7; } if (BO.DWord[Bit_Ops.Bit7]) { Value = Value + RCD_8; } if (BO.DWord[Bit_Ops.Bit8]) { Value = Value + RCD_9; } if (BO.DWord[Bit_Ops.Bit9]) { Value = Value + RCD_10; } if (BO.DWord[Bit_Ops.Bit10]) { Value = Value + RCD_11; } if (BO.DWord[Bit_Ops.Bit11]) { Value = Value + RCD_12; } if (BO.DWord[Bit_Ops.Bit12]) { Value = Value + RCD_13; } if (BO.DWord[Bit_Ops.Bit13]) { Value = Value + RCD_14; } if (BO.DWord[Bit_Ops.Bit14]) { Value = Value + RCD_15; } if (BO.DWord[Bit_Ops.Bit15]) { Value = Value + RCD_16; } Value = -Value; } else { if (BO.DWord[Bit_Ops.Bit0]) { Value = RCD_1; } if (BO.DWord[Bit_Ops.Bit1]) { Value = Value + RCD_2; } if (BO.DWord[Bit_Ops.Bit2]) { Value = Value + RCD_3; } if (BO.DWord[Bit_Ops.Bit3]) { Value = Value + RCD_4; } if (BO.DWord[Bit_Ops.Bit4]) { Value = Value + RCD_5; } if (BO.DWord[Bit_Ops.Bit5]) { Value = Value + RCD_6; } if (BO.DWord[Bit_Ops.Bit6]) { Value = Value + RCD_7; } if (BO.DWord[Bit_Ops.Bit7]) { Value = Value + RCD_8; } if (BO.DWord[Bit_Ops.Bit8]) { Value = Value + RCD_9; } if (BO.DWord[Bit_Ops.Bit9]) { Value = Value + RCD_10; } if (BO.DWord[Bit_Ops.Bit10]) { Value = Value + RCD_11; } if (BO.DWord[Bit_Ops.Bit11]) { Value = Value + RCD_12; } if (BO.DWord[Bit_Ops.Bit12]) { Value = Value + RCD_13; } if (BO.DWord[Bit_Ops.Bit13]) { Value = Value + RCD_14; } if (BO.DWord[Bit_Ops.Bit14]) { Value = Value + RCD_15; } } CAT62I220DataRecord.Is_Valid = true; CAT62I220DataRecord.Value = Value; ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT62.I062DataItems[CAT62.ItemIDToIndex("220")].value = CAT62I220DataRecord; ////////////////////////////////////////////////////////////////////////////////// // Increase data buffer index so it ready for the next data item. CAT62.CurrentDataBufferOctalIndex = CAT62.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)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()); }
static double DecodeFlightLevel(Bit_Ops BO_In) { double Result = 0.0; // First check if this is a negative altitude. // and then handle it properly if (BO_In.DWord[Bit_Ops.Bit13] == true) { // Do not worry about negative values for now. Result = -1.0; } else { // A positive value if (BO_In.DWord[Bit_Ops.Bit0] == true) { Result = Result + 0.25; } if (BO_In.DWord[Bit_Ops.Bit1] == true) { Result = Result + 0.50; } if (BO_In.DWord[Bit_Ops.Bit2] == true) { Result = Result + 1.00; } if (BO_In.DWord[Bit_Ops.Bit3] == true) { Result = Result + 2.00; } if (BO_In.DWord[Bit_Ops.Bit4] == true) { Result = Result + 4.00; } if (BO_In.DWord[Bit_Ops.Bit5] == true) { Result = Result + 8.00; } if (BO_In.DWord[Bit_Ops.Bit6] == true) { Result = Result + 16.00; } if (BO_In.DWord[Bit_Ops.Bit7] == true) { Result = Result + 32.00; } if (BO_In.DWord[Bit_Ops.Bit8] == true) { Result = Result + 64.00; } if (BO_In.DWord[Bit_Ops.Bit9] == true) { Result = Result + 128.00; } if (BO_In.DWord[Bit_Ops.Bit10] == true) { Result = Result + 256.00; } if (BO_In.DWord[Bit_Ops.Bit11] == true) { Result = Result + 512.00; } if (BO_In.DWord[Bit_Ops.Bit12] == true) { Result = Result + 1024.00; } } return(Result); }
public static void DecodeCAT62I390(byte[] Data) { // Get an instance of bit ops Bit_Ops WORD0 = new Bit_Ops(); Bit_Ops WORD1 = new Bit_Ops(); Bit_Ops WORD2 = new Bit_Ops(); //Extract the first octet WORD0.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; if (WORD0.DWord[CAT62I390Types.WORD0_FX_Extension_Indicator] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; WORD1.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; if (WORD1.DWord[CAT62I390Types.WORD1_FX_Extension_Indicator] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; WORD2.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; if (WORD2.DWord[CAT62I390Types.WORD2_FX_Extension_Indicator] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } } } CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; // 2 SIC/SAC if (WORD0.DWord[CAT62I390Types.FPPS_Identification_Tag] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 2; } // 7 (7 Char Callsign) if (WORD0.DWord[CAT62I390Types.Callsign] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 7; } // 4 if (WORD0.DWord[CAT62I390Types.IFPS_FLIGHT_ID] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 4; } // 1 if (WORD0.DWord[CAT62I390Types.Flight_Category] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 4 if (WORD0.DWord[CAT62I390Types.Type_of_Aircraft] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 4; } // 1 if (WORD0.DWord[CAT62I390Types.Wake_Turbulence_Category] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 4 if (WORD0.DWord[CAT62I390Types.Departure_Airport] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 4; } // 4 if (WORD1.DWord[CAT62I390Types.Destination_Airport] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 4; } // 3 if (WORD1.DWord[CAT62I390Types.Runway_Designation] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 3; } // 2 if (WORD1.DWord[CAT62I390Types.Current_Cleared_Flight_Level] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 2; } // 2 if (WORD1.DWord[CAT62I390Types.Current_Control_Position] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 2; } // 5 if (WORD1.DWord[CAT62I390Types.Time_of_Departure_Arrival] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 5; } // 6 if (WORD1.DWord[CAT62I390Types.Aircraft_Stand] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 6; } // 1 if (WORD1.DWord[CAT62I390Types.Stand_Status] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 1; } // 7 if (WORD2.DWord[CAT62I390Types.Standard_Instrument_Departure] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 7; } // 7 if (WORD2.DWord[CAT62I390Types.Standard_Instrument_Arrival] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 7; } // 2 if (WORD2.DWord[CAT62I390Types.Pre_emergency_Mode_3_A_Code] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 2; } // 7 if (WORD2.DWord[CAT62I390Types.Pre_emergency_Callsign] == true) { CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 7; } ////bits-4/2 Spare bits set to zero }
public static void DecodeCAT48I250(byte[] Data) { #region DecodeConstantsRegion //////////////////////////////////////////////////////////////// // MAG HDG DECODE CONSTANTS double MAG_HDG_1 = 90.0 / 512.0; double MAG_HDG_2 = MAG_HDG_1 * 2.0; double MAG_HDG_3 = MAG_HDG_2 * 2.0; double MAG_HDG_4 = MAG_HDG_3 * 2.0; double MAG_HDG_5 = MAG_HDG_4 * 2.0; double MAG_HDG_6 = MAG_HDG_5 * 2.0; double MAG_HDG_7 = MAG_HDG_6 * 2.0; double MAG_HDG_8 = MAG_HDG_7 * 2.0; double MAG_HDG_9 = MAG_HDG_8 * 2.0; double MAG_HDG_10 = MAG_HDG_9 * 2.0; //////////////////////////////////////////////////////////////// // IAS DECODE CONSTANTS int IAS_1 = 1; int IAS_2 = IAS_1 * 2; int IAS_3 = IAS_2 * 2; int IAS_4 = IAS_3 * 2; int IAS_5 = IAS_4 * 2; int IAS_6 = IAS_5 * 2; int IAS_7 = IAS_6 * 2; int IAS_8 = IAS_7 * 2; int IAS_9 = IAS_8 * 2; int IAS_10 = IAS_9 * 2; //////////////////////////////////////////////////////////////// // MACH DECODE CONSTANTS double MACH_1 = 2.048 / 512.0; double MACH_2 = MACH_1 * 2.0; double MACH_3 = MACH_2 * 2.0; double MACH_4 = MACH_3 * 2.0; double MACH_5 = MACH_4 * 2.0; double MACH_6 = MACH_5 * 2.0; double MACH_7 = MACH_6 * 2.0; double MACH_8 = MACH_7 * 2.0; double MACH_9 = MACH_8 * 2.0; double MACH_10 = MAG_HDG_9 * 2.0; //////////////////////////////////////////////////////////////// // RoC DECODE CONSTANTS int RoC_1 = 8192 / 256; // 32 feet/min int RoC_2 = RoC_1 * 2; int RoC_3 = RoC_2 * 2; int RoC_4 = RoC_3 * 2; int RoC_5 = RoC_4 * 2; int RoC_6 = RoC_5 * 2; int RoC_7 = RoC_6 * 2; int RoC_8 = RoC_7 * 2; int RoC_9 = RoC_8 * 2; //////////////////////////////////////////////////////////////// // ROLL ANGLE CONSTANTS double ROLL_ANG_1 = 45.0 / 256.0; double ROLL_ANG_2 = ROLL_ANG_1 * 2; double ROLL_ANG_3 = ROLL_ANG_2 * 2; double ROLL_ANG_4 = ROLL_ANG_3 * 2; double ROLL_ANG_5 = ROLL_ANG_4 * 2; double ROLL_ANG_6 = ROLL_ANG_5 * 2; double ROLL_ANG_7 = ROLL_ANG_6 * 2; double ROLL_ANG_8 = ROLL_ANG_7 * 2; double ROLL_ANG_9 = ROLL_ANG_8 * 2; //////////////////////////////////////////////////////////////// // TRUE TRACK ANGLE CONSTANTS double TRUE_TRK_ANG_1 = 90.0 / 512.0; double TRUE_TRK_ANG_2 = TRUE_TRK_ANG_1 * 2; double TRUE_TRK_ANG_3 = TRUE_TRK_ANG_2 * 2; double TRUE_TRK_ANG_4 = TRUE_TRK_ANG_3 * 2; double TRUE_TRK_ANG_5 = TRUE_TRK_ANG_4 * 2; double TRUE_TRK_ANG_6 = TRUE_TRK_ANG_5 * 2; double TRUE_TRK_ANG_7 = TRUE_TRK_ANG_6 * 2; double TRUE_TRK_ANG_8 = TRUE_TRK_ANG_7 * 2; double TRUE_TRK_ANG_9 = TRUE_TRK_ANG_8 * 2; double TRUE_TRK_ANG_10 = TRUE_TRK_ANG_9 * 2; //////////////////////////////////////////////////////////////// // GND SPD CONSTANTS double GND_SPD_1 = 1024.0 / 512.0; double GND_SPD_2 = GND_SPD_1 * 2; double GND_SPD_3 = GND_SPD_2 * 2; double GND_SPD_4 = GND_SPD_3 * 2; double GND_SPD_5 = GND_SPD_4 * 2; double GND_SPD_6 = GND_SPD_5 * 2; double GND_SPD_7 = GND_SPD_6 * 2; double GND_SPD_8 = GND_SPD_7 * 2; double GND_SPD_9 = GND_SPD_8 * 2; double GND_SPD_10 = GND_SPD_9 * 2; //////////////////////////////////////////////////////////////// // TRK AND RFATE CONSTANTS double TRK_ANG_RATE_1 = 8.0 / 256.0; double TRK_ANG_RATE_2 = TRK_ANG_RATE_1 * 2; double TRK_ANG_RATE_3 = TRK_ANG_RATE_2 * 2; double TRK_ANG_RATE_4 = TRK_ANG_RATE_3 * 2; double TRK_ANG_RATE_5 = TRK_ANG_RATE_4 * 2; double TRK_ANG_RATE_6 = TRK_ANG_RATE_5 * 2; double TRK_ANG_RATE_7 = TRK_ANG_RATE_6 * 2; double TRK_ANG_RATE_8 = TRK_ANG_RATE_7 * 2; double TRK_ANG_RATE_9 = TRK_ANG_RATE_8 * 2; //////////////////////////////////////////////////////////////// // TRUE AIRSPEED int TAS_1 = 2; int TAS_2 = TAS_1 * 2; int TAS_3 = TAS_2 * 2; int TAS_4 = TAS_3 * 2; int TAS_5 = TAS_4 * 2; int TAS_6 = TAS_5 * 2; int TAS_7 = TAS_6 * 2; int TAS_8 = TAS_7 * 2; int TAS_9 = TAS_8 * 2; int TAS_10 = TAS_9 * 2; //////////////////////////////////////////////////////////////// // SELECTED_ALTITUDE int SEL_ALT_1 = 16; //feet int SEL_ALT_2 = SEL_ALT_1 * 2; int SEL_ALT_3 = SEL_ALT_2 * 2; int SEL_ALT_4 = SEL_ALT_3 * 2; int SEL_ALT_5 = SEL_ALT_4 * 2; int SEL_ALT_6 = SEL_ALT_5 * 2; int SEL_ALT_7 = SEL_ALT_6 * 2; int SEL_ALT_8 = SEL_ALT_7 * 2; int SEL_ALT_9 = SEL_ALT_8 * 2; int SEL_ALT_10 = SEL_ALT_9 * 2; int SEL_ALT_11 = SEL_ALT_10 * 2; int SEL_ALT_12 = SEL_ALT_11 * 2; //////////////////////////////////////////////////////////////// // BARO SETTING double BARO_STNG_1 = 0.1; //mb (add 800.0 mb to the value computed) double BARO_STNG_2 = BARO_STNG_1 * 2; double BARO_STNG_3 = BARO_STNG_2 * 2; double BARO_STNG_4 = BARO_STNG_3 * 2; double BARO_STNG_5 = BARO_STNG_4 * 2; double BARO_STNG_6 = BARO_STNG_5 * 2; double BARO_STNG_7 = BARO_STNG_6 * 2; double BARO_STNG_8 = BARO_STNG_7 * 2; double BARO_STNG_9 = BARO_STNG_8 * 2; double BARO_STNG_10 = BARO_STNG_9 * 2; double BARO_STNG_11 = BARO_STNG_10 * 2; double BARO_STNG_12 = BARO_STNG_11 * 2; #endregion CAT48I250Types.CAT48I250DataType CAT48I250Data = new CAT48I250Types.CAT48I250DataType(); // The lenght is always 1 + 8 X (repetative factor form the first octet) // Get an instance of bit ops Bit_Ops BO1 = new Bit_Ops(); Bit_Ops BO2 = new Bit_Ops(); //Extract the first octet BO1.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 1]; int Repetative_Factor = (int)BO1.DWord[Bit_Ops.Bits0_7_Of_DWord]; CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + 1; ////////////////////////////////////////////////////////////////////////////////////////// for (int I = 0; I < Repetative_Factor; I++) { BO1.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 1 + (8 * I)]; BO1.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 2 + (8 * I)]; BO1.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 3 + (8 * I)]; BO1.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 4 + (8 * I)]; BO2.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 5 + (8 * I)]; BO2.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 6 + (8 * I)]; BO2.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 7 + (8 * I)]; BO2.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT48.CurrentDataBufferOctalIndex + 8 + (8 * I)]; // Fist check whether this is a Broadcst report or CIGB initiated int Register_Number = System.Convert.ToInt16(BO2.DWord[Bit_Ops.Bits0_7_Of_DWord]); string Test = "NONE"; double Value = 0.0; if (Register_Number == 0) { #region BroadcastMessages Register_Number = System.Convert.ToInt16(BO1.DWord[Bit_Ops.Bits0_7_Of_DWord]); // Parse the data depending on the register number switch (Register_Number.ToString("X")) { default: Test = Register_Number.ToString("X"); Test = Test + Test; break; } #endregion } else { #region GCIB_Messages // Parse the data depending on the register number switch (Register_Number.ToString("X")) { // Data link capability report case "10": break; // Common usage GICB capability report case "17": break; // Selected vertical intention case "40": // BDS40 is present CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Present_This_Cycle = true; #region MCP_FCU_SEL_ALT_REGION // Bit 1 MCP_FCU_SEL_ALTD Status CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.MCP_FCU_Sel_ALT.Is_Valid = BO1.DWord[Bit_Ops.Bit31]; // Bits 2 .. 13 MCP_FCU_SEL_ALT Value Value = 0.0; if (BO1.DWord[Bit_Ops.Bit19]) Value = SEL_ALT_1; if (BO1.DWord[Bit_Ops.Bit20]) Value = Value + SEL_ALT_2; if (BO1.DWord[Bit_Ops.Bit21]) Value = Value + SEL_ALT_3; if (BO1.DWord[Bit_Ops.Bit22]) Value = Value + SEL_ALT_4; if (BO1.DWord[Bit_Ops.Bit23]) Value = Value + SEL_ALT_5; if (BO1.DWord[Bit_Ops.Bit24]) Value = Value + SEL_ALT_6; if (BO1.DWord[Bit_Ops.Bit25]) Value = Value + SEL_ALT_7; if (BO1.DWord[Bit_Ops.Bit26]) Value = Value + SEL_ALT_8; if (BO1.DWord[Bit_Ops.Bit27]) Value = Value + SEL_ALT_9; if (BO1.DWord[Bit_Ops.Bit28]) Value = Value + SEL_ALT_10; if (BO1.DWord[Bit_Ops.Bit29]) Value = Value + SEL_ALT_11; if (BO1.DWord[Bit_Ops.Bit30]) Value = Value + SEL_ALT_12; CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.MCP_FCU_Sel_ALT.Value = (int)Value / 100; // Use FL #endregion #region FMS_SELECTED_ALT_REGION // Bit 14 FMS_SELECTED_ALT Status CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.FMS_Sel_ALT.Is_Valid = BO1.DWord[Bit_Ops.Bit18]; // Bits 15 .. 26 MCP_FCU_SEL_ALT Value Value = 0.0; if (BO1.DWord[Bit_Ops.Bit6]) Value = SEL_ALT_1; if (BO1.DWord[Bit_Ops.Bit7]) Value = Value + SEL_ALT_2; if (BO1.DWord[Bit_Ops.Bit8]) Value = Value + SEL_ALT_3; if (BO1.DWord[Bit_Ops.Bit9]) Value = Value + SEL_ALT_4; if (BO1.DWord[Bit_Ops.Bit10]) Value = Value + SEL_ALT_5; if (BO1.DWord[Bit_Ops.Bit11]) Value = Value + SEL_ALT_6; if (BO1.DWord[Bit_Ops.Bit12]) Value = Value + SEL_ALT_7; if (BO1.DWord[Bit_Ops.Bit13]) Value = Value + SEL_ALT_8; if (BO1.DWord[Bit_Ops.Bit14]) Value = Value + SEL_ALT_9; if (BO1.DWord[Bit_Ops.Bit15]) Value = Value + SEL_ALT_10; if (BO1.DWord[Bit_Ops.Bit16]) Value = Value + SEL_ALT_11; if (BO1.DWord[Bit_Ops.Bit17]) Value = Value + SEL_ALT_12; CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.FMS_Sel_ALT.Value = (int)Value / 100; // Use FL #endregion #region BARO_SETTING_REGION // Bit 27 BARO_SETTING Status CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Baro_Sel_ALT.Is_Valid = BO1.DWord[Bit_Ops.Bit5]; // Bits 28 .. 39 MCP_FCU_SEL_ALT Value Value = 0.0; if (BO2.DWord[Bit_Ops.Bit25]) Value = BARO_STNG_1; if (BO2.DWord[Bit_Ops.Bit26]) Value = Value + BARO_STNG_2; if (BO2.DWord[Bit_Ops.Bit27]) Value = Value + BARO_STNG_3; if (BO2.DWord[Bit_Ops.Bit28]) Value = Value + BARO_STNG_4; if (BO2.DWord[Bit_Ops.Bit29]) Value = Value + BARO_STNG_5; if (BO2.DWord[Bit_Ops.Bit30]) Value = Value + BARO_STNG_6; if (BO2.DWord[Bit_Ops.Bit31]) Value = Value + BARO_STNG_7; if (BO1.DWord[Bit_Ops.Bit0]) Value = Value + BARO_STNG_8; if (BO1.DWord[Bit_Ops.Bit1]) Value = Value + BARO_STNG_9; if (BO1.DWord[Bit_Ops.Bit2]) Value = Value + BARO_STNG_10; if (BO1.DWord[Bit_Ops.Bit3]) Value = Value + BARO_STNG_11; if (BO1.DWord[Bit_Ops.Bit4]) Value = Value + BARO_STNG_12; CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Baro_Sel_ALT.Value = (int)Value + 800; // Always add 800mb #endregion // BIT 40 .. 47 ARE RESERVED (24 ..17) #region STATUS_REGION // Bit 48 .. 56 STATUS // Bit 48 STATUS OF MCP/FCU MODE BITS CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Status_Data.MCP_FCU_Mode_Bits_Populated = BO2.DWord[Bit_Ops.Bit16]; // Bit 49 VNAV MODE CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Status_Data.VNAV_Mode_Active = BO2.DWord[Bit_Ops.Bit15]; // Bit 50 ALT HOLD MODE MODE CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Status_Data.ALT_Hold_Active = BO2.DWord[Bit_Ops.Bit14]; // Bit 51 ALT HOLD MODE MODE CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Status_Data.APP_Mode_Active = BO2.DWord[Bit_Ops.Bit13]; // Bits 52 .. 53 are reserved // Bit 54 ALT STATUS OF TARGET ALT SOURCE BITS and 55..56 TARGET ALT SOURCE if (!BO2.DWord[Bit_Ops.Bit10]) { CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Status_Data.Target_Altitude_Source = CAT48I250Types.BDS40_Selected_Vertical_Intention_Report.Status.Target_Altitude_Mode_Type.Unknown; } else { if (BO2.DWord[Bit_Ops.Bit9] && BO2.DWord[Bit_Ops.Bit8]) CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Status_Data.Target_Altitude_Source = CAT48I250Types.BDS40_Selected_Vertical_Intention_Report.Status.Target_Altitude_Mode_Type.FMS_Selected_Alt; else if (BO2.DWord[Bit_Ops.Bit9]) CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Status_Data.Target_Altitude_Source = CAT48I250Types.BDS40_Selected_Vertical_Intention_Report.Status.Target_Altitude_Mode_Type.Aircraft_Alt; else if (BO2.DWord[Bit_Ops.Bit8]) CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Status_Data.Target_Altitude_Source = CAT48I250Types.BDS40_Selected_Vertical_Intention_Report.Status.Target_Altitude_Mode_Type.FCU_MCP_Selected_Alt; else CAT48I250Data.BDS40_Selected_Vertical_Intention_Report.Status_Data.Target_Altitude_Source = CAT48I250Types.BDS40_Selected_Vertical_Intention_Report.Status.Target_Altitude_Mode_Type.Unknown; } #endregion break; // Track and turn report case "50": // BDS50 is present CAT48I250Data.BDS50_Track_Turn_Report.Present_This_Cycle = true; #region ROLL_ANGLE_REGION // Bit 1 ROLL ANGLE Status CAT48I250Data.BDS50_Track_Turn_Report.Roll_Ang.Is_Valid = BO1.DWord[Bit_Ops.Bit31]; // Bits 3 .. 11 ROLL ANGLE Value Value = 0.0; // Bit 2 ROLL ANGLE SIGN if (BO1.DWord[Bit_Ops.Bit30]) { Bit_Ops BO1_Temp = new Bit_Ops(); BO1_Temp.DWord[Bit_Ops.Bit0] = !BO1.DWord[Bit_Ops.Bit21]; BO1_Temp.DWord[Bit_Ops.Bit1] = !BO1.DWord[Bit_Ops.Bit22]; BO1_Temp.DWord[Bit_Ops.Bit2] = !BO1.DWord[Bit_Ops.Bit23]; BO1_Temp.DWord[Bit_Ops.Bit3] = !BO1.DWord[Bit_Ops.Bit24]; BO1_Temp.DWord[Bit_Ops.Bit4] = !BO1.DWord[Bit_Ops.Bit25]; BO1_Temp.DWord[Bit_Ops.Bit5] = !BO1.DWord[Bit_Ops.Bit26]; BO1_Temp.DWord[Bit_Ops.Bit6] = !BO1.DWord[Bit_Ops.Bit27]; BO1_Temp.DWord[Bit_Ops.Bit7] = !BO1.DWord[Bit_Ops.Bit28]; BO1_Temp.DWord[Bit_Ops.Bit8] = !BO1.DWord[Bit_Ops.Bit29]; BO1_Temp.DWord[Bit_Ops.Bit9] = !BO1.DWord[Bit_Ops.Bit30]; BO1_Temp.DWord[Bit_Ops.Bit10] = false; BO1_Temp.DWord[Bit_Ops.Bit11] = false; BO1_Temp.DWord[Bit_Ops.Bit12] = false; BO1_Temp.DWord[Bit_Ops.Bit13] = false; BO1_Temp.DWord[Bit_Ops.Bit14] = false; BO1_Temp.DWord[Bit_Ops.Bit15] = false; BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] = BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; if (BO1_Temp.DWord[Bit_Ops.Bit0]) Value = ROLL_ANG_1; if (BO1_Temp.DWord[Bit_Ops.Bit1]) Value = Value + ROLL_ANG_2; if (BO1_Temp.DWord[Bit_Ops.Bit2]) Value = Value + ROLL_ANG_3; if (BO1_Temp.DWord[Bit_Ops.Bit3]) Value = Value + ROLL_ANG_4; if (BO1_Temp.DWord[Bit_Ops.Bit4]) Value = Value + ROLL_ANG_5; if (BO1_Temp.DWord[Bit_Ops.Bit5]) Value = Value + ROLL_ANG_6; if (BO1_Temp.DWord[Bit_Ops.Bit6]) Value = Value + ROLL_ANG_7; if (BO1_Temp.DWord[Bit_Ops.Bit7]) Value = Value + ROLL_ANG_8; if (BO1_Temp.DWord[Bit_Ops.Bit8]) Value = Value + ROLL_ANG_9; CAT48I250Data.BDS50_Track_Turn_Report.Roll_Ang.Value = -Value; } else { if (BO1.DWord[Bit_Ops.Bit21]) Value = ROLL_ANG_1; if (BO1.DWord[Bit_Ops.Bit22]) Value = Value + ROLL_ANG_2; if (BO1.DWord[Bit_Ops.Bit23]) Value = Value + ROLL_ANG_3; if (BO1.DWord[Bit_Ops.Bit24]) Value = Value + ROLL_ANG_4; if (BO1.DWord[Bit_Ops.Bit25]) Value = Value + ROLL_ANG_5; if (BO1.DWord[Bit_Ops.Bit26]) Value = Value + ROLL_ANG_6; if (BO1.DWord[Bit_Ops.Bit27]) Value = Value + ROLL_ANG_7; if (BO1.DWord[Bit_Ops.Bit28]) Value = Value + ROLL_ANG_8; if (BO1.DWord[Bit_Ops.Bit29]) Value = Value + ROLL_ANG_9; CAT48I250Data.BDS50_Track_Turn_Report.Roll_Ang.Value = Value; } #endregion #region TRUE_TRACK_ANGLE_REGION // Bit 12 TRUE TRACK ANGLE Status CAT48I250Data.BDS50_Track_Turn_Report.TRUE_TRK.Is_Valid = BO1.DWord[Bit_Ops.Bit20]; // Bits 14 .. 23 TRUE TRACK ANGLE Value Value = 0.0; // Bit 13 TRUE TRACK ANGLE SIGN if (BO1.DWord[Bit_Ops.Bit19]) { Bit_Ops BO1_Temp = new Bit_Ops(); BO1_Temp.DWord[Bit_Ops.Bit0] = !BO1.DWord[Bit_Ops.Bit9]; BO1_Temp.DWord[Bit_Ops.Bit1] = !BO1.DWord[Bit_Ops.Bit10]; BO1_Temp.DWord[Bit_Ops.Bit2] = !BO1.DWord[Bit_Ops.Bit11]; BO1_Temp.DWord[Bit_Ops.Bit3] = !BO1.DWord[Bit_Ops.Bit12]; BO1_Temp.DWord[Bit_Ops.Bit4] = !BO1.DWord[Bit_Ops.Bit13]; BO1_Temp.DWord[Bit_Ops.Bit5] = !BO1.DWord[Bit_Ops.Bit14]; BO1_Temp.DWord[Bit_Ops.Bit6] = !BO1.DWord[Bit_Ops.Bit15]; BO1_Temp.DWord[Bit_Ops.Bit7] = !BO1.DWord[Bit_Ops.Bit16]; BO1_Temp.DWord[Bit_Ops.Bit8] = !BO1.DWord[Bit_Ops.Bit17]; BO1_Temp.DWord[Bit_Ops.Bit9] = !BO1.DWord[Bit_Ops.Bit18]; BO1_Temp.DWord[Bit_Ops.Bit10] = !BO1.DWord[Bit_Ops.Bit19]; BO1_Temp.DWord[Bit_Ops.Bit11] = false; BO1_Temp.DWord[Bit_Ops.Bit12] = false; BO1_Temp.DWord[Bit_Ops.Bit13] = false; BO1_Temp.DWord[Bit_Ops.Bit14] = false; BO1_Temp.DWord[Bit_Ops.Bit15] = false; BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] = BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; if (BO1_Temp.DWord[Bit_Ops.Bit0]) Value = TRUE_TRK_ANG_1; if (BO1_Temp.DWord[Bit_Ops.Bit1]) Value = Value + TRUE_TRK_ANG_2; if (BO1_Temp.DWord[Bit_Ops.Bit2]) Value = Value + TRUE_TRK_ANG_3; if (BO1_Temp.DWord[Bit_Ops.Bit3]) Value = Value + TRUE_TRK_ANG_4; if (BO1_Temp.DWord[Bit_Ops.Bit4]) Value = Value + TRUE_TRK_ANG_5; if (BO1_Temp.DWord[Bit_Ops.Bit5]) Value = Value + TRUE_TRK_ANG_6; if (BO1_Temp.DWord[Bit_Ops.Bit6]) Value = Value + TRUE_TRK_ANG_7; if (BO1_Temp.DWord[Bit_Ops.Bit7]) Value = Value + TRUE_TRK_ANG_8; if (BO1_Temp.DWord[Bit_Ops.Bit8]) Value = Value + TRUE_TRK_ANG_9; if (BO1_Temp.DWord[Bit_Ops.Bit9]) Value = Value + TRUE_TRK_ANG_10; CAT48I250Data.BDS50_Track_Turn_Report.TRUE_TRK.Value = 360.0 - Value; } else { if (BO1.DWord[Bit_Ops.Bit9]) Value = TRUE_TRK_ANG_1; if (BO1.DWord[Bit_Ops.Bit10]) Value = Value + TRUE_TRK_ANG_2; if (BO1.DWord[Bit_Ops.Bit11]) Value = Value + TRUE_TRK_ANG_3; if (BO1.DWord[Bit_Ops.Bit12]) Value = Value + TRUE_TRK_ANG_4; if (BO1.DWord[Bit_Ops.Bit13]) Value = Value + TRUE_TRK_ANG_5; if (BO1.DWord[Bit_Ops.Bit14]) Value = Value + TRUE_TRK_ANG_6; if (BO1.DWord[Bit_Ops.Bit15]) Value = Value + TRUE_TRK_ANG_7; if (BO1.DWord[Bit_Ops.Bit16]) Value = Value + TRUE_TRK_ANG_8; if (BO1.DWord[Bit_Ops.Bit17]) Value = Value + TRUE_TRK_ANG_9; if (BO1.DWord[Bit_Ops.Bit18]) Value = Value + TRUE_TRK_ANG_10; CAT48I250Data.BDS50_Track_Turn_Report.TRUE_TRK.Value = Value; } #endregion #region GROUND_SPEED_REGION // Bit 24 GROUND SPEED Status CAT48I250Data.BDS50_Track_Turn_Report.GND_SPD.Is_Valid = BO1.DWord[Bit_Ops.Bit8]; // Bits 25 .. 34 GROUND SPEED Value Value = 0.0; if (BO2.DWord[Bit_Ops.Bit30]) Value = GND_SPD_1; if (BO2.DWord[Bit_Ops.Bit31]) Value = Value + GND_SPD_2; if (BO1.DWord[Bit_Ops.Bit0]) Value = Value + GND_SPD_3; if (BO1.DWord[Bit_Ops.Bit1]) Value = Value + GND_SPD_4; if (BO1.DWord[Bit_Ops.Bit2]) Value = Value + GND_SPD_5; if (BO1.DWord[Bit_Ops.Bit3]) Value = Value + GND_SPD_6; if (BO1.DWord[Bit_Ops.Bit4]) Value = Value + GND_SPD_7; if (BO1.DWord[Bit_Ops.Bit5]) Value = Value + GND_SPD_8; if (BO1.DWord[Bit_Ops.Bit6]) Value = Value + GND_SPD_9; if (BO1.DWord[Bit_Ops.Bit7]) Value = Value + GND_SPD_10; CAT48I250Data.BDS50_Track_Turn_Report.GND_SPD.Value = Value; #endregion #region TRACK_ANGLE_RATE_REGION // Bit 35 TRACK ANGLE RATE Status CAT48I250Data.BDS50_Track_Turn_Report.TRK_ANG_RATE.Is_Valid = BO2.DWord[Bit_Ops.Bit29]; // Bits 37 .. 45 TRACK ANGLE RATE Value Value = 0.0; // Bit 36 TRACK ANGLE RATE SIGN if (BO2.DWord[Bit_Ops.Bit28]) { Bit_Ops BO1_Temp = new Bit_Ops(); BO1_Temp.DWord[Bit_Ops.Bit0] = !BO2.DWord[Bit_Ops.Bit19]; BO1_Temp.DWord[Bit_Ops.Bit1] = !BO2.DWord[Bit_Ops.Bit20]; BO1_Temp.DWord[Bit_Ops.Bit2] = !BO2.DWord[Bit_Ops.Bit21]; BO1_Temp.DWord[Bit_Ops.Bit3] = !BO2.DWord[Bit_Ops.Bit22]; BO1_Temp.DWord[Bit_Ops.Bit4] = !BO2.DWord[Bit_Ops.Bit23]; BO1_Temp.DWord[Bit_Ops.Bit5] = !BO2.DWord[Bit_Ops.Bit24]; BO1_Temp.DWord[Bit_Ops.Bit6] = !BO2.DWord[Bit_Ops.Bit25]; BO1_Temp.DWord[Bit_Ops.Bit7] = !BO2.DWord[Bit_Ops.Bit26]; BO1_Temp.DWord[Bit_Ops.Bit8] = !BO2.DWord[Bit_Ops.Bit27]; BO1_Temp.DWord[Bit_Ops.Bit9] = !BO2.DWord[Bit_Ops.Bit28]; BO1_Temp.DWord[Bit_Ops.Bit10] = false; BO1_Temp.DWord[Bit_Ops.Bit11] = false; BO1_Temp.DWord[Bit_Ops.Bit12] = false; BO1_Temp.DWord[Bit_Ops.Bit13] = false; BO1_Temp.DWord[Bit_Ops.Bit14] = false; BO1_Temp.DWord[Bit_Ops.Bit15] = false; BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] = BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; if (BO1_Temp.DWord[Bit_Ops.Bit0]) Value = Value + TRK_ANG_RATE_1; if (BO1_Temp.DWord[Bit_Ops.Bit1]) Value = Value + TRK_ANG_RATE_2; if (BO1_Temp.DWord[Bit_Ops.Bit2]) Value = Value + TRK_ANG_RATE_3; if (BO1_Temp.DWord[Bit_Ops.Bit3]) Value = Value + TRK_ANG_RATE_4; if (BO1_Temp.DWord[Bit_Ops.Bit4]) Value = Value + TRK_ANG_RATE_5; if (BO1_Temp.DWord[Bit_Ops.Bit5]) Value = Value + TRK_ANG_RATE_6; if (BO1_Temp.DWord[Bit_Ops.Bit6]) Value = Value + TRK_ANG_RATE_7; if (BO1_Temp.DWord[Bit_Ops.Bit7]) Value = Value + TRK_ANG_RATE_8; if (BO1_Temp.DWord[Bit_Ops.Bit8]) Value = Value + TRK_ANG_RATE_9; CAT48I250Data.BDS50_Track_Turn_Report.TRK_ANG_RATE.Value = -Value; } else { if (BO2.DWord[Bit_Ops.Bit19]) Value = TRK_ANG_RATE_1; if (BO2.DWord[Bit_Ops.Bit20]) Value = Value + TRK_ANG_RATE_2; if (BO2.DWord[Bit_Ops.Bit21]) Value = Value + TRK_ANG_RATE_3; if (BO2.DWord[Bit_Ops.Bit22]) Value = Value + TRK_ANG_RATE_4; if (BO2.DWord[Bit_Ops.Bit23]) Value = Value + TRK_ANG_RATE_5; if (BO2.DWord[Bit_Ops.Bit24]) Value = Value + TRK_ANG_RATE_6; if (BO2.DWord[Bit_Ops.Bit25]) Value = Value + TRK_ANG_RATE_7; if (BO2.DWord[Bit_Ops.Bit26]) Value = Value + TRK_ANG_RATE_8; if (BO2.DWord[Bit_Ops.Bit27]) Value = Value + TRK_ANG_RATE_9; CAT48I250Data.BDS50_Track_Turn_Report.TRK_ANG_RATE.Value = Value; } #endregion #region TRUE_AIRSPEED_REGION // Bit 46 TAS Status CAT48I250Data.BDS50_Track_Turn_Report.TAS.Is_Valid = BO1.DWord[Bit_Ops.Bit18]; // Bits 47 .. 56 TAS Value Value = 0.0; if (BO2.DWord[Bit_Ops.Bit8]) Value = TAS_1; if (BO2.DWord[Bit_Ops.Bit9]) Value = Value + TAS_2; if (BO2.DWord[Bit_Ops.Bit10]) Value = Value + TAS_3; if (BO2.DWord[Bit_Ops.Bit11]) Value = Value + TAS_4; if (BO2.DWord[Bit_Ops.Bit12]) Value = Value + TAS_5; if (BO2.DWord[Bit_Ops.Bit13]) Value = Value + TAS_6; if (BO2.DWord[Bit_Ops.Bit14]) Value = Value + TAS_7; if (BO2.DWord[Bit_Ops.Bit15]) Value = Value + TAS_8; if (BO2.DWord[Bit_Ops.Bit16]) Value = Value + TAS_9; if (BO2.DWord[Bit_Ops.Bit17]) Value = Value + TAS_10; CAT48I250Data.BDS50_Track_Turn_Report.TAS.Value = (int)Value; #endregion break; // Heading and speed report case "60": // BDS60 is present CAT48I250Data.BDS60_HDG_SPD_Report.Present_This_Cycle = true; #region MAG_HSG_REGION // Bit 1 MAG HDG Status CAT48I250Data.BDS60_HDG_SPD_Report.MAG_HDG.Is_Valid = BO1.DWord[Bit_Ops.Bit31]; // Bits 3 .. 12 MAG HDG Value Value = 0.0; // Bit 2 MAG HDG SIGN if (BO1.DWord[Bit_Ops.Bit30]) { Bit_Ops BO1_Temp = new Bit_Ops(); BO1_Temp.DWord[Bit_Ops.Bit0] = !BO1.DWord[Bit_Ops.Bit20]; BO1_Temp.DWord[Bit_Ops.Bit1] = !BO1.DWord[Bit_Ops.Bit21]; BO1_Temp.DWord[Bit_Ops.Bit2] = !BO1.DWord[Bit_Ops.Bit22]; BO1_Temp.DWord[Bit_Ops.Bit3] = !BO1.DWord[Bit_Ops.Bit23]; BO1_Temp.DWord[Bit_Ops.Bit4] = !BO1.DWord[Bit_Ops.Bit24]; BO1_Temp.DWord[Bit_Ops.Bit5] = !BO1.DWord[Bit_Ops.Bit25]; BO1_Temp.DWord[Bit_Ops.Bit6] = !BO1.DWord[Bit_Ops.Bit26]; BO1_Temp.DWord[Bit_Ops.Bit7] = !BO1.DWord[Bit_Ops.Bit27]; BO1_Temp.DWord[Bit_Ops.Bit8] = !BO1.DWord[Bit_Ops.Bit28]; BO1_Temp.DWord[Bit_Ops.Bit9] = !BO1.DWord[Bit_Ops.Bit29]; BO1_Temp.DWord[Bit_Ops.Bit10] = !BO1.DWord[Bit_Ops.Bit30]; BO1_Temp.DWord[Bit_Ops.Bit11] = false; BO1_Temp.DWord[Bit_Ops.Bit12] = false; BO1_Temp.DWord[Bit_Ops.Bit13] = false; BO1_Temp.DWord[Bit_Ops.Bit14] = false; BO1_Temp.DWord[Bit_Ops.Bit15] = false; BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] = BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; if (BO1_Temp.DWord[Bit_Ops.Bit0]) Value = MAG_HDG_1; if (BO1_Temp.DWord[Bit_Ops.Bit1]) Value = Value + MAG_HDG_2; if (BO1_Temp.DWord[Bit_Ops.Bit2]) Value = Value + MAG_HDG_3; if (BO1_Temp.DWord[Bit_Ops.Bit3]) Value = Value + MAG_HDG_4; if (BO1_Temp.DWord[Bit_Ops.Bit4]) Value = Value + MAG_HDG_5; if (BO1_Temp.DWord[Bit_Ops.Bit5]) Value = Value + MAG_HDG_6; if (BO1_Temp.DWord[Bit_Ops.Bit6]) Value = Value + MAG_HDG_7; if (BO1_Temp.DWord[Bit_Ops.Bit7]) Value = Value + MAG_HDG_8; if (BO1_Temp.DWord[Bit_Ops.Bit8]) Value = Value + MAG_HDG_9; if (BO1_Temp.DWord[Bit_Ops.Bit9]) Value = Value + MAG_HDG_10; CAT48I250Data.BDS60_HDG_SPD_Report.MAG_HDG.Value = 360.0 - Value; } else { if (BO1.DWord[Bit_Ops.Bit20]) Value = MAG_HDG_1; if (BO1.DWord[Bit_Ops.Bit21]) Value = Value + MAG_HDG_2; if (BO1.DWord[Bit_Ops.Bit22]) Value = Value + MAG_HDG_3; if (BO1.DWord[Bit_Ops.Bit23]) Value = Value + MAG_HDG_4; if (BO1.DWord[Bit_Ops.Bit24]) Value = Value + MAG_HDG_5; if (BO1.DWord[Bit_Ops.Bit25]) Value = Value + MAG_HDG_6; if (BO1.DWord[Bit_Ops.Bit26]) Value = Value + MAG_HDG_7; if (BO1.DWord[Bit_Ops.Bit27]) Value = Value + MAG_HDG_8; if (BO1.DWord[Bit_Ops.Bit28]) Value = Value + MAG_HDG_9; if (BO1.DWord[Bit_Ops.Bit29]) Value = Value + MAG_HDG_10; CAT48I250Data.BDS60_HDG_SPD_Report.MAG_HDG.Value = Value; } #endregion #region IAS_REGION // BIT 13 IAS STATUS CAT48I250Data.BDS60_HDG_SPD_Report.IAS.Is_Valid = BO1.DWord[Bit_Ops.Bit19]; // BITS 14 .. 23 IAS VALUE Value = 0.0; if (BO1.DWord[Bit_Ops.Bit9]) Value = IAS_1; if (BO1.DWord[Bit_Ops.Bit10]) Value = Value + IAS_2; if (BO1.DWord[Bit_Ops.Bit11]) Value = Value + IAS_3; if (BO1.DWord[Bit_Ops.Bit12]) Value = Value + IAS_4; if (BO1.DWord[Bit_Ops.Bit13]) Value = Value + IAS_5; if (BO1.DWord[Bit_Ops.Bit14]) Value = Value + IAS_6; if (BO1.DWord[Bit_Ops.Bit15]) Value = Value + IAS_7; if (BO1.DWord[Bit_Ops.Bit16]) Value = Value + IAS_8; if (BO1.DWord[Bit_Ops.Bit17]) Value = Value + IAS_9; if (BO1.DWord[Bit_Ops.Bit18]) Value = Value + IAS_10; // Assign new IAS value CAT48I250Data.BDS60_HDG_SPD_Report.IAS.Value = (int)Value; #endregion #region MACH_REGION // BIT 24 MACH STATUS CAT48I250Data.BDS60_HDG_SPD_Report.MACH.Is_Valid = BO1.DWord[Bit_Ops.Bit8]; // BITS 25 .. 34 MACH VALUE Value = 0.0; if (BO2.DWord[Bit_Ops.Bit30]) Value = MACH_1; if (BO2.DWord[Bit_Ops.Bit31]) Value = Value + MACH_2; if (BO1.DWord[Bit_Ops.Bit0]) Value = Value + MACH_3; if (BO1.DWord[Bit_Ops.Bit1]) Value = Value + MACH_4; if (BO1.DWord[Bit_Ops.Bit2]) Value = Value + MACH_5; if (BO1.DWord[Bit_Ops.Bit3]) Value = Value + MACH_6; if (BO1.DWord[Bit_Ops.Bit4]) Value = Value + MACH_7; if (BO1.DWord[Bit_Ops.Bit5]) Value = Value + MACH_8; if (BO1.DWord[Bit_Ops.Bit6]) Value = Value + MACH_9; if (BO1.DWord[Bit_Ops.Bit7]) Value = Value + MACH_10; // Assign new MACH value CAT48I250Data.BDS60_HDG_SPD_Report.MACH.Value = Value; #endregion #region BARO_ALT_RATE // BIT 35 BARO ALT RATE STATUS CAT48I250Data.BDS60_HDG_SPD_Report.Baro_RoC.Is_Valid = BO2.DWord[Bit_Ops.Bit29]; // BITS 37 .. 45 BARO ALT RATE VALUE Value = 0.0; // Bit 36 BARO ALT RATE SIGN if (BO2.DWord[Bit_Ops.Bit28]) { Bit_Ops BO1_Temp = new Bit_Ops(); BO1_Temp.DWord[Bit_Ops.Bit0] = !BO2.DWord[Bit_Ops.Bit19]; BO1_Temp.DWord[Bit_Ops.Bit1] = !BO2.DWord[Bit_Ops.Bit20]; BO1_Temp.DWord[Bit_Ops.Bit2] = !BO2.DWord[Bit_Ops.Bit21]; BO1_Temp.DWord[Bit_Ops.Bit3] = !BO2.DWord[Bit_Ops.Bit22]; BO1_Temp.DWord[Bit_Ops.Bit4] = !BO2.DWord[Bit_Ops.Bit23]; BO1_Temp.DWord[Bit_Ops.Bit5] = !BO2.DWord[Bit_Ops.Bit24]; BO1_Temp.DWord[Bit_Ops.Bit6] = !BO2.DWord[Bit_Ops.Bit25]; BO1_Temp.DWord[Bit_Ops.Bit7] = !BO2.DWord[Bit_Ops.Bit26]; BO1_Temp.DWord[Bit_Ops.Bit8] = !BO2.DWord[Bit_Ops.Bit27]; BO1_Temp.DWord[Bit_Ops.Bit9] = false; BO1_Temp.DWord[Bit_Ops.Bit10] = false; BO1_Temp.DWord[Bit_Ops.Bit11] = false; BO1_Temp.DWord[Bit_Ops.Bit12] = false; BO1_Temp.DWord[Bit_Ops.Bit13] = false; BO1_Temp.DWord[Bit_Ops.Bit14] = false; BO1_Temp.DWord[Bit_Ops.Bit15] = false; if (BO1_Temp.DWord[Bit_Ops.Bit0]) Value = RoC_1; if (BO1_Temp.DWord[Bit_Ops.Bit1]) Value = Value + RoC_2; if (BO1_Temp.DWord[Bit_Ops.Bit2]) Value = Value + RoC_3; if (BO1_Temp.DWord[Bit_Ops.Bit3]) Value = Value + RoC_4; if (BO1_Temp.DWord[Bit_Ops.Bit4]) Value = Value + RoC_5; if (BO1_Temp.DWord[Bit_Ops.Bit5]) Value = Value + RoC_6; if (BO1_Temp.DWord[Bit_Ops.Bit6]) Value = Value + RoC_7; if (BO1_Temp.DWord[Bit_Ops.Bit7]) Value = Value + RoC_8; if (BO1_Temp.DWord[Bit_Ops.Bit8]) Value = Value + RoC_9; BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] = BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; CAT48I250Data.BDS60_HDG_SPD_Report.Baro_RoC.Value = -(int)Value; } else { if (BO2.DWord[Bit_Ops.Bit19]) Value = RoC_1; if (BO2.DWord[Bit_Ops.Bit20]) Value = Value + RoC_2; if (BO2.DWord[Bit_Ops.Bit21]) Value = Value + RoC_3; if (BO2.DWord[Bit_Ops.Bit22]) Value = Value + RoC_4; if (BO2.DWord[Bit_Ops.Bit23]) Value = Value + RoC_5; if (BO2.DWord[Bit_Ops.Bit24]) Value = Value + RoC_6; if (BO2.DWord[Bit_Ops.Bit25]) Value = Value + RoC_7; if (BO2.DWord[Bit_Ops.Bit26]) Value = Value + RoC_8; if (BO2.DWord[Bit_Ops.Bit27]) Value = Value + RoC_9; CAT48I250Data.BDS60_HDG_SPD_Report.Baro_RoC.Value = (int)Value; } #endregion #region INERTIAL_ALT_RATE // BIT 48 BARO ALT RATE STATUS CAT48I250Data.BDS60_HDG_SPD_Report.Inertial_RoC.Is_Valid = BO2.DWord[Bit_Ops.Bit18]; // BITS 47 .. 56 BARO ALT RATE VALUE Value = 0.0; // Bit 36 BARO ALT RATE SIGN if (BO2.DWord[Bit_Ops.Bit17]) { Bit_Ops BO1_Temp = new Bit_Ops(); BO1_Temp.DWord[Bit_Ops.Bit0] = !BO2.DWord[Bit_Ops.Bit8]; BO1_Temp.DWord[Bit_Ops.Bit1] = !BO2.DWord[Bit_Ops.Bit9]; BO1_Temp.DWord[Bit_Ops.Bit2] = !BO2.DWord[Bit_Ops.Bit10]; BO1_Temp.DWord[Bit_Ops.Bit3] = !BO2.DWord[Bit_Ops.Bit11]; BO1_Temp.DWord[Bit_Ops.Bit4] = !BO2.DWord[Bit_Ops.Bit12]; BO1_Temp.DWord[Bit_Ops.Bit5] = !BO2.DWord[Bit_Ops.Bit13]; BO1_Temp.DWord[Bit_Ops.Bit6] = !BO2.DWord[Bit_Ops.Bit14]; BO1_Temp.DWord[Bit_Ops.Bit7] = !BO2.DWord[Bit_Ops.Bit15]; BO1_Temp.DWord[Bit_Ops.Bit8] = !BO2.DWord[Bit_Ops.Bit16]; BO1_Temp.DWord[Bit_Ops.Bit9] = false; BO1_Temp.DWord[Bit_Ops.Bit10] = false; BO1_Temp.DWord[Bit_Ops.Bit11] = false; BO1_Temp.DWord[Bit_Ops.Bit12] = false; BO1_Temp.DWord[Bit_Ops.Bit13] = false; BO1_Temp.DWord[Bit_Ops.Bit14] = false; BO1_Temp.DWord[Bit_Ops.Bit15] = false; if (BO1_Temp.DWord[Bit_Ops.Bit0]) Value = RoC_1; if (BO1_Temp.DWord[Bit_Ops.Bit1]) Value = Value + RoC_2; if (BO1_Temp.DWord[Bit_Ops.Bit2]) Value = Value + RoC_3; if (BO1_Temp.DWord[Bit_Ops.Bit3]) Value = Value + RoC_4; if (BO1_Temp.DWord[Bit_Ops.Bit4]) Value = Value + RoC_5; if (BO1_Temp.DWord[Bit_Ops.Bit5]) Value = Value + RoC_6; if (BO1_Temp.DWord[Bit_Ops.Bit6]) Value = Value + RoC_7; if (BO1_Temp.DWord[Bit_Ops.Bit7]) Value = Value + RoC_8; if (BO1_Temp.DWord[Bit_Ops.Bit8]) Value = Value + RoC_9; BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] = BO1_Temp.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; CAT48I250Data.BDS60_HDG_SPD_Report.Inertial_RoC.Value = -(int)Value; } else { if (BO2.DWord[Bit_Ops.Bit8]) Value = RoC_1; if (BO2.DWord[Bit_Ops.Bit9]) Value = Value + RoC_2; if (BO2.DWord[Bit_Ops.Bit10]) Value = Value + RoC_3; if (BO2.DWord[Bit_Ops.Bit11]) Value = Value + RoC_4; if (BO2.DWord[Bit_Ops.Bit12]) Value = Value + RoC_5; if (BO2.DWord[Bit_Ops.Bit13]) Value = Value + RoC_6; if (BO2.DWord[Bit_Ops.Bit14]) Value = Value + RoC_7; if (BO2.DWord[Bit_Ops.Bit15]) Value = Value + RoC_8; if (BO2.DWord[Bit_Ops.Bit16]) Value = Value + RoC_9; CAT48I250Data.BDS60_HDG_SPD_Report.Inertial_RoC.Value = (int)Value; } #endregion break; #endregion } } } // Increase data buffer index so it ready for the next data item. CAT48.CurrentDataBufferOctalIndex = CAT48.CurrentDataBufferOctalIndex + (8 * Repetative_Factor); ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT48.I048DataItems[CAT48.ItemIDToIndex("250")].value = CAT48I250Data; ////////////////////////////////////////////////////////////////////////////////// }
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 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; ////////////////////////////////////////////////////////////////////////////////// } }
static double DecodeFlightLevel(Bit_Ops BO_In) { double Result = 0.0; // First check if this is a negative altitude. // and then handle it properly if (BO_In.DWord[Bit_Ops.Bit13] == true) { BO_In.DWord[Bit_Ops.Bit0] = !BO_In.DWord[Bit_Ops.Bit0]; BO_In.DWord[Bit_Ops.Bit1] = !BO_In.DWord[Bit_Ops.Bit1]; BO_In.DWord[Bit_Ops.Bit2] = !BO_In.DWord[Bit_Ops.Bit2]; BO_In.DWord[Bit_Ops.Bit3] = !BO_In.DWord[Bit_Ops.Bit3]; BO_In.DWord[Bit_Ops.Bit4] = !BO_In.DWord[Bit_Ops.Bit4]; BO_In.DWord[Bit_Ops.Bit5] = !BO_In.DWord[Bit_Ops.Bit5]; BO_In.DWord[Bit_Ops.Bit6] = !BO_In.DWord[Bit_Ops.Bit6]; BO_In.DWord[Bit_Ops.Bit7] = !BO_In.DWord[Bit_Ops.Bit7]; BO_In.DWord[Bit_Ops.Bit8] = !BO_In.DWord[Bit_Ops.Bit8]; BO_In.DWord[Bit_Ops.Bit9] = !BO_In.DWord[Bit_Ops.Bit9]; BO_In.DWord[Bit_Ops.Bit10] = !BO_In.DWord[Bit_Ops.Bit10]; BO_In.DWord[Bit_Ops.Bit11] = !BO_In.DWord[Bit_Ops.Bit11]; BO_In.DWord[Bit_Ops.Bit12] = !BO_In.DWord[Bit_Ops.Bit12]; BO_In.DWord[Bit_Ops.Bit13] = false; BO_In.DWord[Bit_Ops.Bit14] = false; BO_In.DWord[Bit_Ops.Bit15] = false; BO_In.DWord[Bit_Ops.Bits0_15_Of_DWord] = BO_In.DWord[Bit_Ops.Bits0_15_Of_DWord] + 1; if (BO_In.DWord[Bit_Ops.Bit0] == true) Result = Result + 0.25; if (BO_In.DWord[Bit_Ops.Bit1] == true) Result = Result + 0.50; if (BO_In.DWord[Bit_Ops.Bit2] == true) Result = Result + 1.00; if (BO_In.DWord[Bit_Ops.Bit3] == true) Result = Result + 2.00; if (BO_In.DWord[Bit_Ops.Bit4] == true) Result = Result + 4.00; if (BO_In.DWord[Bit_Ops.Bit5] == true) Result = Result + 8.00; if (BO_In.DWord[Bit_Ops.Bit6] == true) Result = Result + 16.00; if (BO_In.DWord[Bit_Ops.Bit7] == true) Result = Result + 32.00; if (BO_In.DWord[Bit_Ops.Bit8] == true) Result = Result + 64.00; if (BO_In.DWord[Bit_Ops.Bit9] == true) Result = Result + 128.00; if (BO_In.DWord[Bit_Ops.Bit10] == true) Result = Result + 256.00; if (BO_In.DWord[Bit_Ops.Bit11] == true) Result = Result + 512.00; if (BO_In.DWord[Bit_Ops.Bit12] == true) Result = Result + 1024.00; Result = -Result; } else { // A positive value if (BO_In.DWord[Bit_Ops.Bit0] == true) Result = Result + 0.25; if (BO_In.DWord[Bit_Ops.Bit1] == true) Result = Result + 0.50; if (BO_In.DWord[Bit_Ops.Bit2] == true) Result = Result + 1.00; if (BO_In.DWord[Bit_Ops.Bit3] == true) Result = Result + 2.00; if (BO_In.DWord[Bit_Ops.Bit4] == true) Result = Result + 4.00; if (BO_In.DWord[Bit_Ops.Bit5] == true) Result = Result + 8.00; if (BO_In.DWord[Bit_Ops.Bit6] == true) Result = Result + 16.00; if (BO_In.DWord[Bit_Ops.Bit7] == true) Result = Result + 32.00; if (BO_In.DWord[Bit_Ops.Bit8] == true) Result = Result + 64.00; if (BO_In.DWord[Bit_Ops.Bit9] == true) Result = Result + 128.00; if (BO_In.DWord[Bit_Ops.Bit10] == true) Result = Result + 256.00; if (BO_In.DWord[Bit_Ops.Bit11] == true) Result = Result + 512.00; if (BO_In.DWord[Bit_Ops.Bit12] == true) Result = Result + 1024.00; } return Result; }
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; }
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; ////////////////////////////////////////////////////////////////////////////////// } }
public static void DecodeCAT62I105(byte[] Data) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 3]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 2]; BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 1]; BO.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex]; double Result = 0.0; double Latitude = 0.0; double Longitude = 0.0; // Check for negative values if (BO.DWord[Bit_Ops.Bit31] == 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.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.Bits16_31_Of_DWord] = BO.DWord[Bit_Ops.Bits16_31_Of_DWord] + 1; if (BO.DWord[Bit_Ops.Bit0] == true) Result = POS_FIX_1; if (BO.DWord[Bit_Ops.Bit1] == true) Result = Result + POS_FIX_2; if (BO.DWord[Bit_Ops.Bit2] == true) Result = Result + POS_FIX_3; if (BO.DWord[Bit_Ops.Bit3] == true) Result = Result + POS_FIX_4; if (BO.DWord[Bit_Ops.Bit4] == true) Result = Result + POS_FIX_5; if (BO.DWord[Bit_Ops.Bit5] == true) Result = Result + POS_FIX_6; if (BO.DWord[Bit_Ops.Bit6] == true) Result = Result + POS_FIX_7; if (BO.DWord[Bit_Ops.Bit7] == true) Result = Result + POS_FIX_8; if (BO.DWord[Bit_Ops.Bit8] == true) Result = Result + POS_FIX_9; if (BO.DWord[Bit_Ops.Bit9] == true) Result = Result + POS_FIX_10; if (BO.DWord[Bit_Ops.Bit10] == true) Result = Result + POS_FIX_11; if (BO.DWord[Bit_Ops.Bit11] == true) Result = Result + POS_FIX_12; if (BO.DWord[Bit_Ops.Bit12] == true) Result = Result + POS_FIX_13; if (BO.DWord[Bit_Ops.Bit13] == true) Result = Result + POS_FIX_14; if (BO.DWord[Bit_Ops.Bit14] == true) Result = Result + POS_FIX_15; if (BO.DWord[Bit_Ops.Bit15] == true) Result = Result + POS_FIX_16; if (BO.DWord[Bit_Ops.Bit16] == true) Result = Result + POS_FIX_17; if (BO.DWord[Bit_Ops.Bit17] == true) Result = Result + POS_FIX_18; if (BO.DWord[Bit_Ops.Bit18] == true) Result = Result + POS_FIX_19; if (BO.DWord[Bit_Ops.Bit19] == true) Result = Result + POS_FIX_20; if (BO.DWord[Bit_Ops.Bit20] == true) Result = Result + POS_FIX_21; if (BO.DWord[Bit_Ops.Bit21] == true) Result = Result + POS_FIX_22; if (BO.DWord[Bit_Ops.Bit22] == true) Result = Result + POS_FIX_23; if (BO.DWord[Bit_Ops.Bit23] == true) Result = Result + POS_FIX_24; if (BO.DWord[Bit_Ops.Bit24] == true) Result = Result + POS_FIX_25; if (BO.DWord[Bit_Ops.Bit25] == true) Result = Result + POS_FIX_26; if (BO.DWord[Bit_Ops.Bit26] == true) Result = Result + POS_FIX_27; if (BO.DWord[Bit_Ops.Bit27] == true) Result = Result + POS_FIX_28; Latitude = -Result; } else { /////////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[Bit_Ops.Bit0] == true) Result = POS_FIX_1; if (BO.DWord[Bit_Ops.Bit1] == true) Result = Result + POS_FIX_2; if (BO.DWord[Bit_Ops.Bit2] == true) Result = Result + POS_FIX_3; if (BO.DWord[Bit_Ops.Bit3] == true) Result = Result + POS_FIX_4; if (BO.DWord[Bit_Ops.Bit4] == true) Result = Result + POS_FIX_5; if (BO.DWord[Bit_Ops.Bit5] == true) Result = Result + POS_FIX_6; if (BO.DWord[Bit_Ops.Bit6] == true) Result = Result + POS_FIX_7; if (BO.DWord[Bit_Ops.Bit7] == true) Result = Result + POS_FIX_8; if (BO.DWord[Bit_Ops.Bit8] == true) Result = Result + POS_FIX_9; if (BO.DWord[Bit_Ops.Bit9] == true) Result = Result + POS_FIX_10; if (BO.DWord[Bit_Ops.Bit10] == true) Result = Result + POS_FIX_11; if (BO.DWord[Bit_Ops.Bit11] == true) Result = Result + POS_FIX_12; if (BO.DWord[Bit_Ops.Bit12] == true) Result = Result + POS_FIX_13; if (BO.DWord[Bit_Ops.Bit13] == true) Result = Result + POS_FIX_14; if (BO.DWord[Bit_Ops.Bit14] == true) Result = Result + POS_FIX_15; if (BO.DWord[Bit_Ops.Bit15] == true) Result = Result + POS_FIX_16; if (BO.DWord[Bit_Ops.Bit16] == true) Result = Result + POS_FIX_17; if (BO.DWord[Bit_Ops.Bit17] == true) Result = Result + POS_FIX_18; if (BO.DWord[Bit_Ops.Bit18] == true) Result = Result + POS_FIX_19; if (BO.DWord[Bit_Ops.Bit19] == true) Result = Result + POS_FIX_20; if (BO.DWord[Bit_Ops.Bit20] == true) Result = Result + POS_FIX_21; if (BO.DWord[Bit_Ops.Bit21] == true) Result = Result + POS_FIX_22; if (BO.DWord[Bit_Ops.Bit22] == true) Result = Result + POS_FIX_23; if (BO.DWord[Bit_Ops.Bit23] == true) Result = Result + POS_FIX_24; if (BO.DWord[Bit_Ops.Bit24] == true) Result = Result + POS_FIX_25; if (BO.DWord[Bit_Ops.Bit25] == true) Result = Result + POS_FIX_26; if (BO.DWord[Bit_Ops.Bit26] == true) Result = Result + POS_FIX_27; if (BO.DWord[Bit_Ops.Bit27] == true) Result = Result + POS_FIX_28; Latitude = Result; } Result = 0.0; BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 7]; BO.DWord[Bit_Ops.Bits8_15_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 6]; BO.DWord[Bit_Ops.Bits16_23_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 5]; BO.DWord[Bit_Ops.Bits24_31_Of_DWord] = Data[CAT62.CurrentDataBufferOctalIndex + 4]; // Check for negative values if (BO.DWord[Bit_Ops.Bit31] == 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.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.Bits16_31_Of_DWord] = BO.DWord[Bit_Ops.Bits16_31_Of_DWord] + 1; if (BO.DWord[Bit_Ops.Bit0] == true) Result = POS_FIX_1; if (BO.DWord[Bit_Ops.Bit1] == true) Result = Result + POS_FIX_2; if (BO.DWord[Bit_Ops.Bit2] == true) Result = Result + POS_FIX_3; if (BO.DWord[Bit_Ops.Bit3] == true) Result = Result + POS_FIX_4; if (BO.DWord[Bit_Ops.Bit4] == true) Result = Result + POS_FIX_5; if (BO.DWord[Bit_Ops.Bit5] == true) Result = Result + POS_FIX_6; if (BO.DWord[Bit_Ops.Bit6] == true) Result = Result + POS_FIX_7; if (BO.DWord[Bit_Ops.Bit7] == true) Result = Result + POS_FIX_8; if (BO.DWord[Bit_Ops.Bit8] == true) Result = Result + POS_FIX_9; if (BO.DWord[Bit_Ops.Bit9] == true) Result = Result + POS_FIX_10; if (BO.DWord[Bit_Ops.Bit10] == true) Result = Result + POS_FIX_11; if (BO.DWord[Bit_Ops.Bit11] == true) Result = Result + POS_FIX_12; if (BO.DWord[Bit_Ops.Bit12] == true) Result = Result + POS_FIX_13; if (BO.DWord[Bit_Ops.Bit13] == true) Result = Result + POS_FIX_14; if (BO.DWord[Bit_Ops.Bit14] == true) Result = Result + POS_FIX_15; if (BO.DWord[Bit_Ops.Bit15] == true) Result = Result + POS_FIX_16; if (BO.DWord[Bit_Ops.Bit16] == true) Result = Result + POS_FIX_17; if (BO.DWord[Bit_Ops.Bit17] == true) Result = Result + POS_FIX_18; if (BO.DWord[Bit_Ops.Bit18] == true) Result = Result + POS_FIX_19; if (BO.DWord[Bit_Ops.Bit19] == true) Result = Result + POS_FIX_20; if (BO.DWord[Bit_Ops.Bit20] == true) Result = Result + POS_FIX_21; if (BO.DWord[Bit_Ops.Bit21] == true) Result = Result + POS_FIX_22; if (BO.DWord[Bit_Ops.Bit22] == true) Result = Result + POS_FIX_23; if (BO.DWord[Bit_Ops.Bit23] == true) Result = Result + POS_FIX_24; if (BO.DWord[Bit_Ops.Bit24] == true) Result = Result + POS_FIX_25; if (BO.DWord[Bit_Ops.Bit25] == true) Result = Result + POS_FIX_26; if (BO.DWord[Bit_Ops.Bit26] == true) Result = Result + POS_FIX_27; if (BO.DWord[Bit_Ops.Bit27] == true) Result = Result + POS_FIX_28; Longitude = -Result; } else { if (BO.DWord[Bit_Ops.Bit0] == true) Result = POS_FIX_1; if (BO.DWord[Bit_Ops.Bit1] == true) Result = Result + POS_FIX_2; if (BO.DWord[Bit_Ops.Bit2] == true) Result = Result + POS_FIX_3; if (BO.DWord[Bit_Ops.Bit3] == true) Result = Result + POS_FIX_4; if (BO.DWord[Bit_Ops.Bit4] == true) Result = Result + POS_FIX_5; if (BO.DWord[Bit_Ops.Bit5] == true) Result = Result + POS_FIX_6; if (BO.DWord[Bit_Ops.Bit6] == true) Result = Result + POS_FIX_7; if (BO.DWord[Bit_Ops.Bit7] == true) Result = Result + POS_FIX_8; if (BO.DWord[Bit_Ops.Bit8] == true) Result = Result + POS_FIX_9; if (BO.DWord[Bit_Ops.Bit9] == true) Result = Result + POS_FIX_10; if (BO.DWord[Bit_Ops.Bit10] == true) Result = Result + POS_FIX_11; if (BO.DWord[Bit_Ops.Bit11] == true) Result = Result + POS_FIX_12; if (BO.DWord[Bit_Ops.Bit12] == true) Result = Result + POS_FIX_13; if (BO.DWord[Bit_Ops.Bit13] == true) Result = Result + POS_FIX_14; if (BO.DWord[Bit_Ops.Bit14] == true) Result = Result + POS_FIX_15; if (BO.DWord[Bit_Ops.Bit15] == true) Result = Result + POS_FIX_16; if (BO.DWord[Bit_Ops.Bit16] == true) Result = Result + POS_FIX_17; if (BO.DWord[Bit_Ops.Bit17] == true) Result = Result + POS_FIX_18; if (BO.DWord[Bit_Ops.Bit18] == true) Result = Result + POS_FIX_19; if (BO.DWord[Bit_Ops.Bit19] == true) Result = Result + POS_FIX_20; if (BO.DWord[Bit_Ops.Bit20] == true) Result = Result + POS_FIX_21; if (BO.DWord[Bit_Ops.Bit21] == true) Result = Result + POS_FIX_22; if (BO.DWord[Bit_Ops.Bit22] == true) Result = Result + POS_FIX_23; if (BO.DWord[Bit_Ops.Bit23] == true) Result = Result + POS_FIX_24; if (BO.DWord[Bit_Ops.Bit24] == true) Result = Result + POS_FIX_25; if (BO.DWord[Bit_Ops.Bit25] == true) Result = Result + POS_FIX_26; if (BO.DWord[Bit_Ops.Bit26] == true) Result = Result + POS_FIX_27; Longitude = Result; } GeoCordSystemDegMinSecUtilities.LatLongClass LatLong = new GeoCordSystemDegMinSecUtilities.LatLongClass(Latitude, Longitude); ////////////////////////////////////////////////////////////////////////////////// // Now assign it to the generic list CAT62.I062DataItems[CAT62.ItemIDToIndex("105")].value = LatLong; ////////////////////////////////////////////////////////////////////////////////// // Increase data buffer index so it ready for the next data item. CAT62.CurrentDataBufferOctalIndex = CAT62.CurrentDataBufferOctalIndex + 8; }
// This method extracts the 8th bit of the Data Item I001/020, Target Report Descriptor // to determine the type of the report that was received (1 = tracks, 0 = plot) private void Determine_Type_Of_Report(byte[] Data, int Target_Report_Desc_Index) { // Get an instance of bit ops Bit_Ops BO = new Bit_Ops(); //Extract the first BO.DWord[Bit_Ops.Bits0_7_Of_DWord] = Data[Target_Report_Desc_Index]; if (BO.DWord[CAT01I020Types.Word1_TYP_Index] == true) { Type_Of_Report = CAT01I020Types.Type_Of_Report_Type.Track; } else { Type_Of_Report = CAT01I020Types.Type_Of_Report_Type.Plot; } if (Previous_Type_Of_Report != Type_Of_Report) { Previous_Type_Of_Report = Type_Of_Report; Handle_Type_Of_Report(true); } }
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; }