public static DecodeCAT62I220 ( byte Data ) : void | ||
Data | byte | |
return | void |
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;
}
// This method will accept a buffer of data with the assumption that // category has been determined. It will then decode the data and save // it in the shared buffer. Everry time a message is passed in the data // will be appended to the buffer. This means that each line will contain // data for one message. For data items which are not in the message, // indicated by the FSPEC field, N/A will be inserted instead. The shared // buffer is loacted in the SharedData and will not be saved. It is responsibility // of the user to save the data in a file it desired. public static void Do(byte[] Data) { // I048/010 Data Source Identifier 2 // NO NEED to do anything this is handled in CAT01 // 2. - Spare - // I062/015 Service Identification 1 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("015")].CurrentlyPresent == true) { CAT62I015UserData.DecodeCAT62I015(Data); } // I062/070 Time Of Track Information 3 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("070")].CurrentlyPresent == true) { CAT62I070UserData.DecodeCAT62I070(Data); } // I062/105 Calculated Track Position (WGS-84) 8 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("105")].CurrentlyPresent == true) { CAT62I105UserData.DecodeCAT62I105(Data); } // I062/100 Calculated Track Position (Cartesian) 6 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("100")].CurrentlyPresent == true) { CAT62I100UserData.DecodeCAT62I100(Data); } // I062/185 Calculated Track Velocity (Cartesian) 4 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("185")].CurrentlyPresent == true) { CAT62I185UserData.DecodeCAT62I185(Data); } // FX. - Field extension indicator - // // I062/210 Calculated Acceleration (Cartesian) 2 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("210")].CurrentlyPresent == true) { CAT62I210UserData.DecodeCAT62I210(Data); } // I062/060 Track Mode 3/A Code 2 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("060")].CurrentlyPresent == true) { CAT62I060UserData.DecodeCAT62I060(Data); } // I062/245 Target Identification 7 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("245")].CurrentlyPresent == true) { CAT62I245UserData.DecodeCAT62I245(Data); } // I062/380 Aircraft Derived Data 1+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("380")].CurrentlyPresent == true) { CAT62I380UserData.DecodeCAT62I380(Data); } // I062/040 Track Number 2 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("040")].CurrentlyPresent == true) { CAT62I040UserData.DecodeCAT62I040(Data); } // I062/080 Track Status 1+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("080")].CurrentlyPresent == true) { CAT62I080UserData.DecodeCAT62I080(Data); } // I062/290 System Track Update Ages 1+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("290")].CurrentlyPresent == true) { CAT62I290UserData.DecodeCAT62I290(Data); } // FX. - Field extension indicator - // // I062/200 Mode of Movement 1 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("200")].CurrentlyPresent == true) { CAT62I200UserData.DecodeCAT62I200(Data); } // I062/295 Track Data Ages 1+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("295")].CurrentlyPresent == true) { CAT62I295UserData.DecodeCAT62I295(Data); } // I062/136 Measured Flight Level 2 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("136")].CurrentlyPresent == true) { CAT62I136UserData.DecodeCAT62I136(Data); } // I062/130 Calculated Track Geometric Altitude 2 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("130")].CurrentlyPresent == true) { CAT62I130UserData.DecodeCAT62I130(Data); } // I062/135 Calculated Track Barometric Altitude 2 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("135")].CurrentlyPresent == true) { CAT62I135UserData.DecodeCAT62I135(Data); } // I062/220 Calculated Rate Of Climb/Descent 2 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("220")].CurrentlyPresent == true) { CAT62I220UserData.DecodeCAT62I220(Data); } // I062/390 Flight Plan Related Data 1+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("390")].CurrentlyPresent == true) { CAT62I390UserData.DecodeCAT62I390(Data); } // FX. - Field extension indicator - // // I062/270 Target Size & Orientation 1+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("270")].CurrentlyPresent == true) { CAT62I270UserData.DecodeCAT62I270(Data); } // I062/300 Vehicle Fleet Identification 1 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("300")].CurrentlyPresent == true) { CAT62I300UserData.DecodeCAT62I300(Data); } // I062/110 Mode 5 Data reports & Extended Mode 1 Code 1+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("110")].CurrentlyPresent == true) { CAT62I110UserData.DecodeCAT62I110(Data); } // I062/120 Track Mode 2 Code 2 if (CAT62.I062DataItems[CAT62.ItemIDToIndex("120")].CurrentlyPresent == true) { CAT62I120UserData.DecodeCAT62I120(Data); } // I062/510 Composed Track Number 3+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("510")].CurrentlyPresent == true) { CAT62I510UserData.DecodeCAT62I510(Data); } // I062/500 Estimated Accuracies 1+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("500")].CurrentlyPresent == true) { CAT62I500UserData.DecodeCAT62I500(Data); } // I062/340 Measured Information 1+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("340")].CurrentlyPresent == true) { CAT62I340UserData.DecodeCAT62I340(Data); } // FX. - Field extension indicator - // I062/500 Estimated Accuracies 1+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("REF")].CurrentlyPresent == true) { CAT62IREFUserData.DecodeCAT62IREF(Data); } // I062/340 Measured Information 1+ if (CAT62.I062DataItems[CAT62.ItemIDToIndex("SPI")].CurrentlyPresent == true) { CAT62ISPIUserData.DecodeCAT62ISPI(Data); } //////////////////////////////////////////////////////////////////////////////////// // All CAT62 data has been decoded, so lets save off the message data to the global // storage for latter usage MainASTERIXDataStorage.CAT62Data CAT62MessageData = new MainASTERIXDataStorage.CAT62Data(); foreach (CAT62.CAT062DataItem Item in CAT62.I062DataItems) { CAT62.CAT062DataItem MyItem = new CAT62.CAT062DataItem(); MyItem.CurrentlyPresent = Item.CurrentlyPresent; MyItem.Description = Item.Description; MyItem.HasBeenPresent = Item.HasBeenPresent; MyItem.ID = Item.ID; MyItem.value = Item.value; CAT62MessageData.CAT62DataItems.Add(MyItem); } MainASTERIXDataStorage.CAT62Message.Add(CAT62MessageData); CAT62.Intitialize(false); }