|
1 /* |
|
2 * Copyright (c) 2006-2008 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: CFPhaseDeviceStarted class implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <startupdomainpskeys.h> |
|
20 #ifndef RD_STARTUP_CHANGE |
|
21 #include <SysStartup.h> |
|
22 #endif |
|
23 |
|
24 #include "cfphasedevicestarted.h" |
|
25 #include "cfpropertylistener.h" |
|
26 #include "cftrace.h" |
|
27 |
|
28 CCFPhaseDeviceStarted* CCFPhaseDeviceStarted::NewL( |
|
29 MCFContextInterface& aCF ) |
|
30 { |
|
31 FUNC_LOG; |
|
32 |
|
33 CCFPhaseDeviceStarted* self = CCFPhaseDeviceStarted::NewLC( aCF ); |
|
34 CleanupStack::Pop( self ); |
|
35 |
|
36 return self; |
|
37 } |
|
38 |
|
39 CCFPhaseDeviceStarted* CCFPhaseDeviceStarted::NewLC( |
|
40 MCFContextInterface& aCF ) |
|
41 { |
|
42 FUNC_LOG; |
|
43 |
|
44 CCFPhaseDeviceStarted* self = new( ELeave ) CCFPhaseDeviceStarted( aCF ); |
|
45 CleanupStack::PushL( self ); |
|
46 self->ConstructL(); |
|
47 |
|
48 return self; |
|
49 } |
|
50 |
|
51 CCFPhaseDeviceStarted::~CCFPhaseDeviceStarted() |
|
52 { |
|
53 FUNC_LOG; |
|
54 |
|
55 delete iPropertyListener; |
|
56 } |
|
57 |
|
58 void CCFPhaseDeviceStarted::ConstructL() |
|
59 { |
|
60 FUNC_LOG; |
|
61 |
|
62 iPropertyListener = CCFPropertyListener::NewL( |
|
63 KPSUidStartup, |
|
64 KPSGlobalSystemState, |
|
65 *this ); |
|
66 } |
|
67 |
|
68 CCFPhaseDeviceStarted::CCFPhaseDeviceStarted( |
|
69 MCFContextInterface& aCF ): |
|
70 CCFPhaseBase( CCFPhaseBase::ECFDeviceStarted, aCF ) |
|
71 { |
|
72 FUNC_LOG; |
|
73 } |
|
74 |
|
75 // METHODS |
|
76 |
|
77 //----------------------------------------------------------------------------- |
|
78 // CCFPhaseDeviceStarted::ExecuteL |
|
79 //----------------------------------------------------------------------------- |
|
80 // |
|
81 void CCFPhaseDeviceStarted::ExecuteL( TRequestStatus* aStatus ) |
|
82 { |
|
83 FUNC_LOG; |
|
84 |
|
85 // Store starter request |
|
86 iStarterRequest = aStatus; |
|
87 |
|
88 // Double check if we already have been started |
|
89 TInt value = 0; |
|
90 TInt err = iPropertyListener->Property().Get( value ); |
|
91 if( err == KErrNone ) |
|
92 { |
|
93 iStarterState = value; |
|
94 } |
|
95 |
|
96 DoComplete(); |
|
97 } |
|
98 |
|
99 //----------------------------------------------------------------------------- |
|
100 // CCFPhaseDeviceStarted::NextPhase |
|
101 //----------------------------------------------------------------------------- |
|
102 // |
|
103 CCFPhaseBase::TCFPhaseId CCFPhaseDeviceStarted::NextPhase() const |
|
104 { |
|
105 FUNC_LOG; |
|
106 |
|
107 // This ends CF starting sequence |
|
108 return CCFPhaseBase::ECFLoadingPlugins; |
|
109 } |
|
110 |
|
111 //----------------------------------------------------------------------------- |
|
112 // CCFPhaseDeviceStarted::HandlePropertyChangedL |
|
113 //----------------------------------------------------------------------------- |
|
114 // |
|
115 void CCFPhaseDeviceStarted::HandlePropertyChangedL() |
|
116 { |
|
117 FUNC_LOG; |
|
118 |
|
119 TInt value = 0; |
|
120 TInt err = iPropertyListener->Property().Get( value ); |
|
121 if( err == KErrNone ) |
|
122 { |
|
123 iStarterState = value; |
|
124 |
|
125 INFO_1( "P&S key KPSUidStartup: KPSGlobalSystemState changed. New value: %d", |
|
126 iStarterState ); |
|
127 |
|
128 DoComplete(); |
|
129 } |
|
130 } |
|
131 |
|
132 //----------------------------------------------------------------------------- |
|
133 // CCFPhaseDeviceStarted::DoComplete |
|
134 //----------------------------------------------------------------------------- |
|
135 // |
|
136 void CCFPhaseDeviceStarted::DoComplete() |
|
137 { |
|
138 FUNC_LOG; |
|
139 |
|
140 #ifdef RD_STARTUP_CHANGE |
|
141 if( iStarterState == ESwStateNormalRfOn || |
|
142 iStarterState == ESwStateNormalRfOff ) |
|
143 #else |
|
144 if( iStarterState == ESWStateNormal) |
|
145 #endif |
|
146 { |
|
147 INFO( "Starter in normal state... Continue initialization" ); |
|
148 |
|
149 // Cancel system state API events |
|
150 iPropertyListener->Cancel(); |
|
151 |
|
152 // Device started, complete phase |
|
153 if( iStarterRequest ) |
|
154 { |
|
155 Complete( KErrNone ); |
|
156 } |
|
157 } |
|
158 } |