|
1 // Copyright (c) 2007-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 "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 // |
|
15 |
|
16 #ifndef __CMDPOWEROFF_H__ |
|
17 #define __CMDPOWEROFF_H__ |
|
18 |
|
19 #include <e32power.h> |
|
20 #include "ssmcommandbase.h" |
|
21 |
|
22 #ifdef TEST_SSM_GRACEFUL_SHUTDOWN // for testing purpose |
|
23 #include <e32property.h> |
|
24 #endif |
|
25 |
|
26 class TSsmCommandParameters; |
|
27 class RReadStream; |
|
28 |
|
29 /** |
|
30 Built-in command for powering down the device |
|
31 @internalComponent |
|
32 @released |
|
33 @see TPowerState |
|
34 */ |
|
35 NONSHARABLE_CLASS (CCmdPowerOff) : public CSsmCommandBase |
|
36 { |
|
37 public: |
|
38 static CCmdPowerOff* NewL(RReadStream& aReadStream); |
|
39 static CCmdPowerOff* NewL(TCmdErrorSeverity aSeverity, TPowerState aPowerEvent); |
|
40 static CCmdPowerOff* NewL(TSsmCommandParameters& aCommandParameters); |
|
41 //Must be used only by CLE to reconstruct the command |
|
42 static CCmdPowerOff* NewLC(const CCmdPowerOff& aCmdPowerOff); |
|
43 ~CCmdPowerOff(); |
|
44 |
|
45 // from MSsmCommand |
|
46 TSsmCommandType Type() const; |
|
47 void ExternalizeL(RWriteStream& aWriteStream) const; |
|
48 void Execute(TRequestStatus& aStatus); |
|
49 void ExecuteCancel(); |
|
50 void Release(); |
|
51 //returns the current power state |
|
52 inline TPowerState PowerStateInfo()const {return iState;} |
|
53 |
|
54 protected: |
|
55 // from CActive |
|
56 void RunL(); |
|
57 void DoCancel(); |
|
58 TInt RunError(TInt aError); |
|
59 |
|
60 private: |
|
61 CCmdPowerOff(); |
|
62 CCmdPowerOff(TCmdErrorSeverity aSeverity, TPowerState aState); |
|
63 void InternalizeL(RReadStream& aReadStream); |
|
64 void ConstructL(RReadStream& aReadStream); |
|
65 void ConstructL(TSsmCommandParameters& aCommandParameters); |
|
66 void ConstructL(const CCmdPowerOff& aCmdPowerOff); |
|
67 void ConstructL(); |
|
68 void ValidateL(); |
|
69 static TInt MaxSupportedVersion(); |
|
70 |
|
71 private: |
|
72 TPowerState iState; // system-wide power state |
|
73 public: |
|
74 #ifdef TEST_SSM_GRACEFUL_SHUTDOWN // for testing purpose |
|
75 TUint iTestKey; |
|
76 TUid iTestCategory; |
|
77 #endif |
|
78 }; |
|
79 |
|
80 #endif // __CMDPOWEROFF_H__ |