Exemplo n.º 1
0
        /// <summary>
        /// Get DCMI Power Reading Values
        /// </summary>
        /// <param name="AverageByte">Rolling Average Byte (DCMI Capabilities)</param>
        private PowerReadingSupport PowerReadingSupport(byte readingMode, byte averageByte)
        {
            // Function Return Value
            byte[] readings = new byte[12];

            // Get Power reading passing in the Rolling Average Byte
            GetDcmiPowerReadingResponse response = (GetDcmiPowerReadingResponse)this.IpmiSendReceive(
                new GetDcmiPowerReadingRequest(readingMode, averageByte), typeof(GetDcmiPowerReadingResponse));

            PowerReadingSupport returnObj = new PowerReadingSupport(response.CompletionCode);

            if (response.CompletionCode == 0)
            {
                // Add Current Power Reading to the return array
                readings[0] = response.CurrentPower[0];
                readings[1] = response.CurrentPower[1];

                // Add Minimum Power Reading to the return array
                readings[2] = response.MinimumPower[0];
                readings[3] = response.MinimumPower[1];

                // Add Maximum Power Reading to the return array
                readings[4] = response.MaximumPower[0];
                readings[5] = response.MaximumPower[1];

                // Add Average Power Reading to the return array
                readings[6] = response.AveragePower[0];
                readings[7] = response.AveragePower[1];

                // Add Statistics reporting time period
                Buffer.BlockCopy(response.Statistics, 0, readings, 8, 4);

                returnObj.SetParamaters(readings);
            }

            return(returnObj);
        }