public static DecodeCAT02I030 ( byte Data ) : void | ||
Data | byte | |
return | void |
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;
}
// This method will accept a buffer of data with the assumption that // category has been determined. It will then decode the data and save // it in the shared buffer. Every time a message is passed in the data // will be appended to the buffer. This means that each line will contain // data for one message. For data items which are not in the message, // indicated by the FSPEC field, N/A will be inserted instead. The shared // buffer is loacted in the SharedData and will not be saved. It is responsibility // of the user to save the data in a file it desired. public static void Do(byte[] Data) { // BitExtractor BE = new BitExtractor(); // I002/000, Message Type 1 if (CAT02.I002DataItems[CAT02.ItemIDToIndex("000")].CurrentlyPresent == true) { CAT02I000UserData.DecodeCAT02I000(Data); } // I002/020 Sector Number 1 if (CAT02.I002DataItems[CAT02.ItemIDToIndex("020")].CurrentlyPresent == true) { CAT02I020UserData.DecodeCAT02I020(Data); } // I002/030 Time of Day 3 if (CAT02.I002DataItems[CAT02.ItemIDToIndex("030")].CurrentlyPresent == true) { CAT02I030UserData.DecodeCAT02I030(Data); } // I002/041 Antenna Rotation Period 2 if (CAT02.I002DataItems[CAT02.ItemIDToIndex("041")].CurrentlyPresent == true) { CAT02I041UserData.DecodeCAT02I041(Data); } // I002/050 Station Configuration Status 1+ if (CAT02.I002DataItems[CAT02.ItemIDToIndex("050")].CurrentlyPresent == true) { CAT02I050UserData.DecodeCAT02I050(Data); } // I002/060 Station Processing Mode 1+ if (CAT02.I002DataItems[CAT02.ItemIDToIndex("060")].CurrentlyPresent == true) { CAT02I060UserData.DecodeCAT02I060(Data); } // FX Field Extension Indicator // I002/070 Plot Count Values (1 + 2 X N) if (CAT02.I002DataItems[CAT02.ItemIDToIndex("070")].CurrentlyPresent == true) { CAT02I070UserData.DecodeCAT02I070(Data); } // I002/100 Dynamic Window - Type 1 8 if (CAT02.I002DataItems[CAT02.ItemIDToIndex("100")].CurrentlyPresent == true) { CAT02I100UserData.DecodeCAT02I100(Data); } // I002/090 Collimation Error 2 if (CAT02.I002DataItems[CAT02.ItemIDToIndex("090")].CurrentlyPresent == true) { CAT02I090UserData.DecodeCAT02I090(Data); } // I002/080 Warning/Error Conditions 1+ if (CAT02.I002DataItems[CAT02.ItemIDToIndex("080")].CurrentlyPresent == true) { CAT02I080UserData.DecodeCAT02I080(Data); } //////////////////////////////////////////////////////////////////////////////////// // All CAT02 data has been decoded, so lets save off the message data to the global // storage for latter usage MainASTERIXDataStorage.CAT02Data CAT02MessageData = new MainASTERIXDataStorage.CAT02Data(); foreach (CAT02.CAT02DataItem Item in CAT02.I002DataItems) { CAT02.CAT02DataItem MyItem = new CAT02.CAT02DataItem(); MyItem.CurrentlyPresent = Item.CurrentlyPresent; MyItem.Description = Item.Description; MyItem.HasBeenPresent = Item.HasBeenPresent; MyItem.ID = Item.ID; MyItem.value = Item.value; CAT02MessageData.CAT02DataItems.Add(MyItem); } MainASTERIXDataStorage.CAT02Message.Add(CAT02MessageData); CAT02.Intitialize(false); }