6 /// The Power class provides methods to control the power service.
8 public static class Power
11 /// Locks the CPU for a specified time.
12 /// After the given timeout (in milliseconds), unlock the given lock state automatically.
14 /// <param name="timeout">
15 /// The positive number in milliseconds or 0 for permanent lock
16 /// So you must release the permanent lock of power state with ReleaseCpuLock() if timeout_ms is zero.
18 public static void RequestCpuLock(int timeout)
20 DeviceError res = (DeviceError) Interop.Device.DevicePowerRequestLock(0, timeout);
21 if (res != DeviceError.None)
23 throw DeviceExceptionFactory.CreateException(res, "unable to acquire power lock.");
28 /// Releases the CPU lock state.
30 public static void ReleaseCpuLock()
32 DeviceError res = (DeviceError) Interop.Device.DevicePowerReleaseLock(0);
33 if (res != DeviceError.None)
35 throw DeviceExceptionFactory.CreateException(res, "unable to release power lock.");