Ejemplo n.º 1
0
        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;
        }
        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;
        }