|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Implementation of CSsmInitStartupReason class. |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "ssminitstartupreason.h" |
|
20 #include "ssmmapperutility.h" |
|
21 #include "trace.h" |
|
22 |
|
23 #include <starterdomaincrkeys.h> |
|
24 #include <startupdomainpskeys.h> |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // CSsmInitStartupReason::NewL |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 CSsmInitStartupReason* CSsmInitStartupReason::NewL() |
|
33 { |
|
34 FUNC_LOG; |
|
35 return new ( ELeave ) CSsmInitStartupReason(); |
|
36 } |
|
37 |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // CSsmInitStartupReason::~CSsmInitStartupReason |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 CSsmInitStartupReason::~CSsmInitStartupReason() |
|
44 { |
|
45 FUNC_LOG; |
|
46 } |
|
47 |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CSsmInitStartupReason::Initialize |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 TInt CSsmInitStartupReason::Initialize( CSsmCustomCommandEnv* /*aCmdEnv*/ ) |
|
54 { |
|
55 FUNC_LOG; |
|
56 |
|
57 return KErrNone; |
|
58 } |
|
59 |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CSsmInitStartupReason::Execute |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 void CSsmInitStartupReason::Execute( |
|
66 const TDesC8& /*aParams*/, |
|
67 TRequestStatus& aRequest ) |
|
68 { |
|
69 FUNC_LOG; |
|
70 aRequest = KRequestPending; |
|
71 |
|
72 TRAPD( errorCode, InitStartupReasonL() ); |
|
73 ERROR( errorCode, "Failed to initialize startup reason P&S keys" ); |
|
74 |
|
75 TRequestStatus* request = &aRequest; |
|
76 User::RequestComplete( request, errorCode ); |
|
77 } |
|
78 |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CSsmInitStartupReason::ExecuteCancel |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 void CSsmInitStartupReason::ExecuteCancel() |
|
85 { |
|
86 FUNC_LOG; |
|
87 } |
|
88 |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // CSsmInitStartupReason::Close |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void CSsmInitStartupReason::Close() |
|
95 { |
|
96 FUNC_LOG; |
|
97 } |
|
98 |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // CSsmInitStartupReason::Release |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 void CSsmInitStartupReason::Release() |
|
105 { |
|
106 FUNC_LOG; |
|
107 |
|
108 delete this; |
|
109 } |
|
110 // --------------------------------------------------------------------------- |
|
111 // CSsmInitStartupReason::InitStartupReasonL |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 void CSsmInitStartupReason::InitStartupReasonL() |
|
115 { |
|
116 FUNC_LOG; |
|
117 |
|
118 TInt val( 0 ); |
|
119 TInt errorCode = MapperUtilityL().CrValue( KCRUidStartup, KStartupReason, val ); |
|
120 ERROR( errorCode, "Failed to get KStartupReason CenRep key" ); |
|
121 |
|
122 if ( errorCode == KErrNone ) |
|
123 { |
|
124 SetL( KPSUidStartup, KPSStartupReason, val ); |
|
125 INFO_1( "Value of startup reason is %d", val ); |
|
126 } |
|
127 User::LeaveIfError( errorCode ); |
|
128 } |
|
129 |