author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 00:16:48 +0300 | |
changeset 77 | 2be0b271d017 |
parent 72 | c76a0b1755b9 |
child 76 | cfea66083b62 |
permissions | -rw-r--r-- |
37 | 1 |
/* |
2 |
* Copyright (c) 2005-2007 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: Implementation of CPhoneStateStartup class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// INCLUDES |
|
19 |
#include "cphonestatestartup.h" |
|
20 |
#include "phonestatedefinitions.h" |
|
21 |
#include "mphonestatemachine.h" |
|
22 |
#include "tphonecmdparamkeycapture.h" |
|
23 |
#include "tphonecmdparamboolean.h" |
|
24 |
#include "phonelogger.h" |
|
25 |
#include "phonerssbase.h" |
|
26 |
||
27 |
// ================= MEMBER FUNCTIONS ======================= |
|
28 |
||
29 |
// C++ default constructor can NOT contain any code, that |
|
30 |
// might leave. |
|
31 |
// |
|
32 |
EXPORT_C CPhoneStateStartup::CPhoneStateStartup( |
|
33 |
MPhoneStateMachine* aStateMachine, |
|
34 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
35 |
MPhoneCustomization* aPhoneCustomization |
|
36 |
) : |
|
37 |
CPhoneState( aStateMachine, aViewCommandHandle, aPhoneCustomization ), |
|
38 |
iPEReady( EFalse ), |
|
39 |
iPhoneReady( EFalse ) |
|
40 |
{ |
|
41 |
} |
|
42 |
||
43 |
// ----------------------------------------------------------- |
|
44 |
// CPhoneStateStartup::~CPhoneStateStartup() |
|
45 |
// Destructor |
|
46 |
// (other items were commented in a header). |
|
47 |
// ----------------------------------------------------------- |
|
48 |
// |
|
49 |
EXPORT_C CPhoneStateStartup::~CPhoneStateStartup() |
|
50 |
{ |
|
51 |
delete iCreateNote; |
|
52 |
} |
|
53 |
||
54 |
// ----------------------------------------------------------- |
|
55 |
// CPhoneStateStartup::ConstructL() |
|
56 |
// Constructor |
|
57 |
// (other items were commented in a header). |
|
58 |
// ----------------------------------------------------------- |
|
59 |
// |
|
60 |
EXPORT_C void CPhoneStateStartup::ConstructL() |
|
61 |
{ |
|
62 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::ConstructL() "); |
|
63 |
CPhoneState::BaseConstructL(); |
|
64 |
} |
|
65 |
||
66 |
// ----------------------------------------------------------- |
|
67 |
// CPhoneStateStartup::NewL() |
|
68 |
// Constructor |
|
69 |
// (other items were commented in a header). |
|
70 |
// ----------------------------------------------------------- |
|
71 |
// |
|
72 |
EXPORT_C CPhoneStateStartup* CPhoneStateStartup::NewL( |
|
73 |
MPhoneStateMachine* aStateMachine, |
|
74 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
75 |
MPhoneCustomization* aPhoneCustomization ) |
|
76 |
{ |
|
77 |
CPhoneStateStartup* self = new (ELeave) CPhoneStateStartup( |
|
78 |
aStateMachine, aViewCommandHandle, aPhoneCustomization ); |
|
79 |
||
80 |
CleanupStack::PushL( self ); |
|
81 |
self->ConstructL(); |
|
82 |
CleanupStack::Pop( self ); |
|
83 |
||
84 |
return self; |
|
85 |
} |
|
86 |
||
87 |
// ----------------------------------------------------------- |
|
88 |
// CPhoneStateStartup::HandlePhoneEngineMessageL |
|
89 |
// ----------------------------------------------------------- |
|
90 |
// |
|
91 |
EXPORT_C void CPhoneStateStartup::HandlePhoneEngineMessageL( |
|
92 |
const TInt aMessage, |
|
93 |
TInt aCallId ) |
|
94 |
{ |
|
95 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandlePhoneEngineMessageL() "); |
|
96 |
switch ( aMessage ) |
|
97 |
{ |
|
98 |
case MEngineMonitor::EPEMessagePEConstructionReady: |
|
99 |
HandlePEConstructionReadyL( aCallId ); |
|
100 |
break; |
|
101 |
||
102 |
default: |
|
103 |
CPhoneState::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
104 |
break; |
|
105 |
} |
|
106 |
} |
|
107 |
||
108 |
// ----------------------------------------------------------- |
|
109 |
// CPhoneStateStartup::HandlePEConstructionReadyL |
|
110 |
// ----------------------------------------------------------- |
|
111 |
// |
|
112 |
void CPhoneStateStartup::HandlePEConstructionReadyL( TInt /*aCallId*/ ) |
|
113 |
{ |
|
114 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandlePEConstructionReadyL() "); |
|
115 |
// Indicate that phone engine construction is ready |
|
116 |
iPEReady = ETrue; |
|
117 |
// Only go to the idle state if phone is also ready |
|
118 |
if ( iPhoneReady ) |
|
119 |
{ |
|
72
c76a0b1755b9
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
56
diff
changeset
|
120 |
TPhoneCmdParamBoolean isSecurityMode; |
c76a0b1755b9
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
56
diff
changeset
|
121 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode ); |
37 | 122 |
if ( !isSecurityMode.Boolean() && !IsSimOk() ) |
123 |
{ |
|
124 |
TPhoneCmdParamBoolean securityMode; |
|
125 |
securityMode.SetBoolean( ETrue ); |
|
126 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode ); |
|
127 |
iCreateNote = CIdle::NewL( CActive::EPriorityHigh ); |
|
128 |
CreateAndShowNoteAfterIdle(); |
|
129 |
} |
|
130 |
SetDefaultFlagsL(); |
|
131 |
iStateMachine->ChangeState( EPhoneStateIdle ); |
|
132 |
} |
|
133 |
} |
|
134 |
||
135 |
// ----------------------------------------------------------- |
|
136 |
// CPhoneStateStartup::HandleKeyMessageL |
|
137 |
// ----------------------------------------------------------- |
|
138 |
// |
|
139 |
EXPORT_C void CPhoneStateStartup::HandleKeyMessageL( |
|
140 |
TPhoneKeyEventMessages /*aMessage*/, |
|
141 |
TKeyCode /*aCode*/ ) |
|
142 |
{ |
|
143 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandleKeyMessageL( ) "); |
|
144 |
// TBD: Panic if PE Construction fails |
|
145 |
// For Debug use only |
|
146 |
// If a key event is received in this state, either the phone engine |
|
147 |
// is not ready or the phone has not started up yet. Display an error note |
|
148 |
// if the phone engine is not ready. |
|
149 |
if ( iPhoneReady && !iPEReady ) |
|
150 |
{ |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
151 |
SendGlobalErrorNoteL( EPhoneNoteTextPEFailedAtStartup, ETrue ); |
37 | 152 |
} |
153 |
} |
|
154 |
||
155 |
// ----------------------------------------------------------- |
|
156 |
// CPhoneStateStartup::HandleKeyEventL |
|
157 |
// ----------------------------------------------------------- |
|
158 |
// |
|
159 |
EXPORT_C void CPhoneStateStartup::HandleKeyEventL( |
|
160 |
const TKeyEvent& /*aKeyEvent*/, TEventCode /*aEventCode*/ ) |
|
161 |
{ |
|
162 |
// Empty implementation |
|
163 |
} |
|
164 |
||
165 |
// ----------------------------------------------------------- |
|
166 |
// CPhoneStateStartup::HandleDtmfKeyToneL |
|
167 |
// ----------------------------------------------------------- |
|
168 |
// |
|
169 |
EXPORT_C void CPhoneStateStartup::HandleDtmfKeyToneL( |
|
72
c76a0b1755b9
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
56
diff
changeset
|
170 |
const TKeyEvent& /* aKeyEvent */, TEventCode /* aEventCode */ ) |
37 | 171 |
{ |
172 |
// Empty implementation |
|
173 |
} |
|
174 |
||
175 |
// ----------------------------------------------------------- |
|
176 |
// CPhoneStateStartup::HandlePhoneStartupL |
|
177 |
// ----------------------------------------------------------- |
|
178 |
// |
|
179 |
EXPORT_C void CPhoneStateStartup::HandlePhoneStartupL() |
|
180 |
{ |
|
181 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandlePhoneStartupL() "); |
|
182 |
// Indicate that the phone is ready |
|
183 |
iPhoneReady = ETrue; |
|
184 |
// Only go to idle state when Phone engine is also ready |
|
185 |
if ( iPEReady ) |
|
186 |
{ |
|
72
c76a0b1755b9
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
56
diff
changeset
|
187 |
TPhoneCmdParamBoolean isSecurityMode; |
37 | 188 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode ); |
189 |
if ( !isSecurityMode.Boolean() && !IsSimOk() ) |
|
190 |
{ |
|
191 |
TPhoneCmdParamBoolean securityMode; |
|
192 |
securityMode.SetBoolean( ETrue ); |
|
193 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode ); |
|
194 |
iCreateNote = CIdle::NewL( CActive::EPriorityHigh ); |
|
195 |
CreateAndShowNoteAfterIdle(); |
|
196 |
} |
|
197 |
SetDefaultFlagsL(); |
|
198 |
iStateMachine->ChangeState( EPhoneStateIdle ); |
|
199 |
} |
|
200 |
} |
|
201 |
||
202 |
// --------------------------------------------------------- |
|
203 |
// CPhoneStateStartup::HandleIdleForegroundEventL |
|
204 |
// Phone should show security note asap. |
|
205 |
// Active idle might be in front quite early if f.e. rejected SIM |
|
206 |
// --------------------------------------------------------- |
|
207 |
// |
|
208 |
EXPORT_C void CPhoneStateStartup::HandleIdleForegroundEventL() |
|
209 |
{ |
|
210 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandleIdleForegroundEventL( ) "); |
|
211 |
TPhoneCmdParamBoolean isSecurityMode; |
|
72
c76a0b1755b9
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
56
diff
changeset
|
212 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode ); |
37 | 213 |
if ( !isSecurityMode.Boolean() && !IsSimOk() ) |
214 |
{ |
|
215 |
TPhoneCmdParamBoolean securityMode; |
|
216 |
securityMode.SetBoolean( ETrue ); |
|
217 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode ); |
|
218 |
iCreateNote = CIdle::NewL( CActive::EPriorityHigh ); |
|
219 |
||
220 |
CreateAndShowNoteAfterIdle(); |
|
221 |
} |
|
222 |
} |
|
223 |
||
224 |
// ----------------------------------------------------------------------------- |
|
225 |
// CPhoneStateStartup::CreateAndShowNoteAfterIdle |
|
226 |
// |
|
227 |
// Callback function. |
|
228 |
// ----------------------------------------------------------------------------- |
|
229 |
// |
|
230 |
void CPhoneStateStartup::CreateAndShowNoteAfterIdle() |
|
231 |
{ |
|
72
c76a0b1755b9
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
56
diff
changeset
|
232 |
__LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateStartup::CreateAndShowNoteAfterIdle "); |
37 | 233 |
if ( !iCreateNote->IsActive() ) |
234 |
{ |
|
235 |
iCreateNote->Start( |
|
236 |
TCallBack( DoShowNoteL, this ) ); |
|
237 |
} |
|
238 |
} |
|
239 |
||
240 |
// ----------------------------------------------------------------------------- |
|
241 |
// CPhoneStateStartup::DoShowNoteL |
|
242 |
// |
|
243 |
// Callback function. |
|
244 |
// ----------------------------------------------------------------------------- |
|
245 |
// |
|
246 |
TInt CPhoneStateStartup::DoShowNoteL( TAny* aAny ) |
|
247 |
{ |
|
248 |
__LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateStartup::DoShowNoteL "); |
|
249 |
static_cast< CPhoneStateStartup* >( aAny )-> |
|
250 |
StartShowSecurityNoteL(); |
|
251 |
return KErrNone; |
|
252 |
} |
|
253 |
||
254 |
// End of File |