| Wheelchair Control for Windows Mobile Diploma Thesis, Author: Ondrej Vozda, FEEC BUT, 2013

- Main Page
- Packages
- Classes
- Files

- File List

All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
DevicePowerManagement.cs
1 ﻿using System.Runtime.InteropServices;
2
3 namespace WheelchairControlWM
4 {
8 public static class DevicePowerManagement
9 {
13 [DllImport("coredll.dll")]
14 private static extern void SystemIdleTimerReset();
15
24 [DllImport("coredll.dll")]
25 private static extern int SetSystemPowerState(string pwrState,
26 int pwrStateFlags, int options);
27
31 enum powerState : int
32 {
36 POWER_STATE_ON = 0x10000,
37
41 POWER_STATE_OFF = 0x20000,
42
46 POWER_STATE_SUSPEND = 0x200000,
47
51 POWER_FORCE = 4096
52 }
53
58 public static void ResetIdleTimer()
59 {
60 SetSystemPowerState(null, (int)powerState.POWER_STATE_ON, (int)powerState.POWER_FORCE);
61 SystemIdleTimerReset();
62 }
63 }
64 }