Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\euser\us_power.cpp
25 Enables wakeup events.
27 Starts a system-wide transition to a low power state enabling wakeup events.
29 The exact specification of wakeup events depends on the target power state
31 For example, an absolute timer expiration event wakes up the system from
32 the EPwStandby power state on all currently supported platforms.
34 If, at the time this function is called, wakeup events are enabled, then
35 the implementation disables them before enabling them again.
37 The caller must have PowerMgnt capability to perform this call; otherwise
38 it panics with EPlatformSecurityTrap code.
40 @param aState The target low power state; this can be EPwStandby or KPwOff.
42 @return KErrNone, if successful,
43 KErrArgument, if aState is neither EPwStandby nor KPwOff;
44 otherwise one of the other system-wide error codes.
46 @panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
48 @see Power::DisableWakeupEvents()
52 EXPORT_C TInt Power::EnableWakeupEvents(TPowerState aState)
54 return Exec::PowerEnableWakeupEvents(aState);
61 Disables wakeup events.
63 If, at the time this function is called, wakeup events are disabled, then
64 the function does nothing and returns immediately.
66 The caller must have PowerMgnt capability to perform this call; otherwise it
67 panics with EPlatformSecurityTrap code.
69 @panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
73 EXPORT_C void Power::DisableWakeupEvents()
75 Exec::PowerDisableWakeupEvents();
82 Requests notification of a subsequent wakeup event.
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.
88 Only one pending request is allowed. The request completes immediately
89 with KErrInUse status if another request is currently pending.
91 The caller must have PowerMgnt capability to perform this call; otherwise
92 it panics with EPlatformSecurityTrap code.
94 @param aStatus The request status to signal on wakeup event
96 @panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
98 @see Power::EnableWakeupEvents()
100 @capability PowerMgmt
102 EXPORT_C void Power::RequestWakeupEventNotification(TRequestStatus& aStatus)
104 aStatus = KRequestPending;
105 Exec::PowerRequestWakeupEventNotification(&aStatus);
112 Cancels a pending wakeup event notification request.
114 If, at the time this function is called, the notification request is still
115 pending, then the request completes with KErrCancel status.
117 The caller must have PowerMgnt capability to perform this call; otherwise it panics with
118 EPlatformSecurityTrap code
120 @panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
122 @capability PowerMgmt
124 EXPORT_C void Power::CancelWakeupEventNotification()
126 Exec::PowerCancelWakeupEventNotification();
133 Lowers the kernel power state.
135 Changes the kernel power state from EPwActive to the state specified by the last
136 call to EnableWakeupEvents().
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.
142 When this function returns, wakeup events are disabled.
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.
147 The caller must have PowerMgnt capability to perform this call; otherwise
148 it panics with EPlatformSecurityTrap code
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.
154 @panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
156 @capability PowerMgmt
158 EXPORT_C TInt Power::PowerDown()
160 return Exec::PowerDown();