author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 00:16:48 +0300 | |
changeset 77 | 2be0b271d017 |
parent 37 | ba76fc04e6c2 |
permissions | -rw-r--r-- |
37 | 1 |
/* |
2 |
* Copyright (c) 2005 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 CPhoneStateMachine class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include <pevirtualengine.h> |
|
21 |
#include <mpeengineinfo.h> |
|
22 |
||
23 |
#include "phoneui.pan" |
|
24 |
#include "cphonestatemachine.h" |
|
25 |
#include "cphonestatestartup.h" |
|
26 |
#include "cphonestateidle.h" |
|
27 |
#include "cphonestateincoming.h" |
|
28 |
#include "cphonestatecallsetup.h" |
|
29 |
#include "cphonestateincall.h" |
|
30 |
#include "phonestatedefinitions.h" |
|
31 |
#include "phonelogger.h" |
|
32 |
#include "cphonestorage.h" |
|
33 |
#include "mphonestorage.h" |
|
34 |
||
35 |
// ================= MEMBER FUNCTIONS ======================= |
|
36 |
||
37 |
// C++ default constructor can NOT contain any code, that |
|
38 |
// might leave. |
|
39 |
// |
|
40 |
EXPORT_C CPhoneStateMachine::CPhoneStateMachine( |
|
41 |
MPhoneViewCommandHandle* aViewCommandHandle ) : |
|
42 |
iOldStateId( EPhoneStateNull ), |
|
43 |
iNewStateId( EPhoneStateNull ), |
|
77
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
44 |
iViewCommandHandle( aViewCommandHandle ), |
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
45 |
iEnv( CEikonEnv::Static() ) // codescanner::eikonenvstatic |
37 | 46 |
{ |
47 |
__ASSERT_ALWAYS( aViewCommandHandle, |
|
48 |
Panic( EPhoneCtrlParameterNotInitialized ) ); |
|
49 |
} |
|
50 |
||
51 |
// ----------------------------------------------------------- |
|
52 |
// CPhoneStateMachine::~CPhoneStateMachine() |
|
53 |
// Destructor |
|
54 |
// (other items were commented in a header). |
|
55 |
// ----------------------------------------------------------- |
|
56 |
// |
|
57 |
EXPORT_C CPhoneStateMachine::~CPhoneStateMachine() |
|
58 |
{ |
|
59 |
if( iState == iIdleState ) |
|
60 |
{ |
|
61 |
delete iState; |
|
62 |
iState = NULL; |
|
63 |
iIdleState = NULL; |
|
64 |
} |
|
65 |
else |
|
66 |
{ |
|
67 |
if( iState ) |
|
68 |
{ |
|
69 |
delete iState; |
|
70 |
iState = NULL; |
|
71 |
} |
|
72 |
if( iIdleState ) |
|
73 |
{ |
|
74 |
delete iIdleState; |
|
75 |
iIdleState = NULL; |
|
76 |
} |
|
77 |
} |
|
78 |
if( iPhoneEngine ) |
|
79 |
{ |
|
80 |
delete iPhoneEngine; |
|
81 |
iPhoneEngine = NULL; |
|
82 |
} |
|
83 |
if( iPhoneStorage ) |
|
84 |
{ |
|
85 |
delete iPhoneStorage; |
|
86 |
iPhoneStorage = NULL; |
|
87 |
} |
|
88 |
} |
|
89 |
||
90 |
// --------------------------------------------------------- |
|
91 |
// CPhoneStateMachine::SetPhoneEngine |
|
92 |
// --------------------------------------------------------- |
|
93 |
// |
|
94 |
EXPORT_C void CPhoneStateMachine::SetPhoneEngine( |
|
95 |
MPEPhoneModel* aPhoneEngine ) |
|
96 |
{ |
|
97 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateMachine::SetPhoneEngine "); |
|
98 |
__ASSERT_ALWAYS( aPhoneEngine, |
|
99 |
Panic( EPhoneCtrlParameterNotInitialized ) ); |
|
100 |
||
101 |
iPhoneEngine = aPhoneEngine; |
|
102 |
} |
|
103 |
||
104 |
// ----------------------------------------------------------- |
|
105 |
// CPhoneStateMachine::PhoneEngine |
|
106 |
// ----------------------------------------------------------- |
|
107 |
// |
|
108 |
EXPORT_C MPEPhoneModel* CPhoneStateMachine::PhoneEngine() |
|
109 |
{ |
|
110 |
__ASSERT_DEBUG( iPhoneEngine, Panic( EPhoneCtrlInvariant ) ); |
|
111 |
return iPhoneEngine; |
|
112 |
} |
|
113 |
// ----------------------------------------------------------- |
|
114 |
// CPhoneStateMachine::PhoneEngineInfo |
|
115 |
// ----------------------------------------------------------- |
|
116 |
// |
|
117 |
EXPORT_C MPEEngineInfo* CPhoneStateMachine::PhoneEngineInfo() |
|
118 |
{ |
|
119 |
if ( iPhoneEngine ) |
|
120 |
{ |
|
121 |
return iPhoneEngine->EngineInfo(); |
|
122 |
} |
|
123 |
else |
|
124 |
{ |
|
125 |
return NULL; |
|
126 |
} |
|
127 |
} |
|
128 |
||
129 |
// ----------------------------------------------------------- |
|
130 |
// CPhoneStateMachine::ChangeState() |
|
131 |
// (other items were commented in a header). |
|
132 |
// ----------------------------------------------------------- |
|
133 |
// |
|
134 |
EXPORT_C void CPhoneStateMachine::ChangeState( TInt aState ) |
|
135 |
{ |
|
136 |
__PHONELOGSTATECHANGE( iNewStateId, aState ); |
|
137 |
iNewStateId = aState; |
|
138 |
} |
|
139 |
||
140 |
// ----------------------------------------------------------- |
|
141 |
// CPhoneStateMachine::State() |
|
142 |
// (other items were commented in a header). |
|
143 |
// ----------------------------------------------------------- |
|
144 |
// |
|
145 |
EXPORT_C MPhoneState* CPhoneStateMachine::State() |
|
146 |
{ |
|
147 |
return iState; |
|
148 |
} |
|
149 |
||
150 |
// ----------------------------------------------------------- |
|
151 |
// CPhoneStateMachine::CreatePhoneEngineL |
|
152 |
// (other items were commented in a header). |
|
153 |
// ----------------------------------------------------------- |
|
154 |
// |
|
155 |
EXPORT_C MPEPhoneModel* CPhoneStateMachine::CreatePhoneEngineL( |
|
156 |
MEngineMonitor& /*aEngineMonitor*/ ) |
|
157 |
{ |
|
158 |
return NULL; |
|
159 |
} |
|
160 |
||
161 |
// ----------------------------------------------------------- |
|
162 |
// CPhoneStateMachine::SendPhoneEngineMessage |
|
163 |
// ----------------------------------------------------------- |
|
164 |
// |
|
165 |
EXPORT_C void CPhoneStateMachine::SendPhoneEngineMessage( |
|
166 |
TInt aMessage ) |
|
167 |
{ |
|
168 |
__PHONELOGENGINECMD( aMessage ); |
|
169 |
PhoneEngine()->HandleMessage( aMessage ); |
|
170 |
} |
|
171 |
||
172 |
// ----------------------------------------------------------- |
|
173 |
// CPhoneStateMachine::SetCallId |
|
174 |
// ----------------------------------------------------------- |
|
175 |
// |
|
176 |
EXPORT_C void CPhoneStateMachine::SetCallId( |
|
177 |
TInt aCallId ) |
|
178 |
{ |
|
179 |
__PHONELOG1( |
|
180 |
EBasic, |
|
181 |
EPhoneControl, |
|
182 |
"CALL ID: CPhoneStateMachine::SetCallId (%d)", |
|
183 |
aCallId); |
|
184 |
PhoneEngineInfo()->SetCallId( aCallId ); |
|
185 |
} |
|
186 |
||
187 |
// ----------------------------------------------------------- |
|
188 |
// CPhoneStateMachine::PhoneStorage |
|
189 |
// ----------------------------------------------------------- |
|
190 |
// |
|
191 |
EXPORT_C MPhoneStorage* CPhoneStateMachine::PhoneStorage() |
|
192 |
{ |
|
193 |
if ( iPhoneStorage == NULL ) |
|
194 |
{ |
|
195 |
TInt err( KErrNone ); |
|
196 |
TRAP( err, iPhoneStorage = CPhoneStorage::NewL()); |
|
197 |
__ASSERT_ALWAYS( KErrNone == err, User::Invariant() ); |
|
198 |
} |
|
199 |
return iPhoneStorage; |
|
200 |
} |
|
201 |
||
77
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
202 |
// ----------------------------------------------------------- |
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
203 |
// CPhoneStateMachine::EikonEnv |
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
204 |
// ----------------------------------------------------------- |
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
205 |
// |
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
206 |
EXPORT_C CEikonEnv* CPhoneStateMachine::EikonEnv() const |
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
207 |
{ |
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
208 |
return iEnv; |
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
209 |
} |
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
210 |
|
37 | 211 |
// End of File |