Exemple #1
0
        /// <summary>
        /// Increase the cpu clock within timeout.
        /// </summary>
        /// <param name="type">Performance Control Type</param>
        /// <param name="timeout">Cpu clock increasing duration in milliseconds.</param>
        /// <exception cref="ArgumentException">When an invalid parameter value is set.</exception>
        /// <exception cref="InvalidOperationException">In case of any system error.</exception>
        /// <exception cref="NotSupportedException">In case the device does not support this behavior.</exception>
        /// <example>
        /// <code>
        ///     try
        ///     {
        ///         PerformanceController.Request(PerformanceControlType.AppLaunchHome, 100);
        ///     }
        ///     Catch(Exception e)
        ///     {
        ///     }
        /// </code>
        /// </example>
        public static void Request(PerformanceControlType type, int timeout)
        {
            PerformanceControlFunc func = null;

            if (!PerformanceControlFunctions.TryGetValue(type, out func))
            {
                throw new ArgumentException("Invalid Arguments");
            }

            DeviceError res = (DeviceError)func(timeout);

            if (res != DeviceError.None)
            {
                throw DeviceExceptionFactory.CreateException(res, "unable to transmit PmQos command.");
            }
        }
        /// <summary>
        /// Determines whether this instance and a specified object.
        /// </summary>
        public override bool Equals(object obj)
        {
            PerformanceControlType other = obj as PerformanceControlType;

            return(other != null && other._typeName == this._typeName);
        }