|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32\euser\us_power.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include <e32power.h> |
|
19 #include "us_std.h" |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 Enables wakeup events. |
|
26 |
|
27 Starts a system-wide transition to a low power state enabling wakeup events. |
|
28 |
|
29 The exact specification of wakeup events depends on the target power state |
|
30 and the platform. |
|
31 For example, an absolute timer expiration event wakes up the system from |
|
32 the EPwStandby power state on all currently supported platforms. |
|
33 |
|
34 If, at the time this function is called, wakeup events are enabled, then |
|
35 the implementation disables them before enabling them again. |
|
36 |
|
37 The caller must have PowerMgnt capability to perform this call; otherwise |
|
38 it panics with EPlatformSecurityTrap code. |
|
39 |
|
40 @param aState The target low power state; this can be EPwStandby or KPwOff. |
|
41 |
|
42 @return KErrNone, if successful, |
|
43 KErrArgument, if aState is neither EPwStandby nor KPwOff; |
|
44 otherwise one of the other system-wide error codes. |
|
45 |
|
46 @panic KERN-EXEC 46 if the caller does not have PowerMgnt capability. |
|
47 |
|
48 @see Power::DisableWakeupEvents() |
|
49 |
|
50 @capability PowerMgmt |
|
51 */ |
|
52 EXPORT_C TInt Power::EnableWakeupEvents(TPowerState aState) |
|
53 { |
|
54 return Exec::PowerEnableWakeupEvents(aState); |
|
55 } |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 /** |
|
61 Disables wakeup events. |
|
62 |
|
63 If, at the time this function is called, wakeup events are disabled, then |
|
64 the function does nothing and returns immediately. |
|
65 |
|
66 The caller must have PowerMgnt capability to perform this call; otherwise it |
|
67 panics with EPlatformSecurityTrap code. |
|
68 |
|
69 @panic KERN-EXEC 46 if the caller does not have PowerMgnt capability. |
|
70 |
|
71 @capability PowerMgmt |
|
72 */ |
|
73 EXPORT_C void Power::DisableWakeupEvents() |
|
74 { |
|
75 Exec::PowerDisableWakeupEvents(); |
|
76 } |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 /** |
|
82 Requests notification of a subsequent wakeup event. |
|
83 |
|
84 Typically the user-side domain manager issues this request |
|
85 before starting a system-wide transition to a low power state by |
|
86 enabling wakeup events. |
|
87 |
|
88 Only one pending request is allowed. The request completes immediately |
|
89 with KErrInUse status if another request is currently pending. |
|
90 |
|
91 The caller must have PowerMgnt capability to perform this call; otherwise |
|
92 it panics with EPlatformSecurityTrap code. |
|
93 |
|
94 @param aStatus The request status to signal on wakeup event |
|
95 |
|
96 @panic KERN-EXEC 46 if the caller does not have PowerMgnt capability. |
|
97 |
|
98 @see Power::EnableWakeupEvents() |
|
99 |
|
100 @capability PowerMgmt |
|
101 */ |
|
102 EXPORT_C void Power::RequestWakeupEventNotification(TRequestStatus& aStatus) |
|
103 { |
|
104 aStatus = KRequestPending; |
|
105 Exec::PowerRequestWakeupEventNotification(&aStatus); |
|
106 } |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 /** |
|
112 Cancels a pending wakeup event notification request. |
|
113 |
|
114 If, at the time this function is called, the notification request is still |
|
115 pending, then the request completes with KErrCancel status. |
|
116 |
|
117 The caller must have PowerMgnt capability to perform this call; otherwise it panics with |
|
118 EPlatformSecurityTrap code |
|
119 |
|
120 @panic KERN-EXEC 46 if the caller does not have PowerMgnt capability. |
|
121 |
|
122 @capability PowerMgmt |
|
123 */ |
|
124 EXPORT_C void Power::CancelWakeupEventNotification() |
|
125 { |
|
126 Exec::PowerCancelWakeupEventNotification(); |
|
127 } |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 /** |
|
133 Lowers the kernel power state. |
|
134 |
|
135 Changes the kernel power state from EPwActive to the state specified by the last |
|
136 call to EnableWakeupEvents(). |
|
137 |
|
138 If the target state is EPwStandby, the function returns either immediately, |
|
139 if at least one wakeup event has occurred since the last call |
|
140 to EnableWakeupEvent(), or when a wakeup event eventually occurs. |
|
141 |
|
142 When this function returns, wakeup events are disabled. |
|
143 |
|
144 If the target state is EPwOff, this function never returns, |
|
145 the system is powered off, and can subsequently only come back by rebooting. |
|
146 |
|
147 The caller must have PowerMgnt capability to perform this call; otherwise |
|
148 it panics with EPlatformSecurityTrap code |
|
149 |
|
150 @return KErrNone, if successful; |
|
151 KErrNotReady, if wakeup events are disabled at the time this function is called; |
|
152 otherwise one of the other system-wide error codes. |
|
153 |
|
154 @panic KERN-EXEC 46 if the caller does not have PowerMgnt capability. |
|
155 |
|
156 @capability PowerMgmt |
|
157 */ |
|
158 EXPORT_C TInt Power::PowerDown() |
|
159 { |
|
160 return Exec::PowerDown(); |
|
161 } |