27 #include "cphonestateincoming.h" |
27 #include "cphonestateincoming.h" |
28 #include "cphonestatecallsetup.h" |
28 #include "cphonestatecallsetup.h" |
29 #include "cphonestateincall.h" |
29 #include "cphonestateincall.h" |
30 #include "phonestatedefinitions.h" |
30 #include "phonestatedefinitions.h" |
31 #include "phonelogger.h" |
31 #include "phonelogger.h" |
32 #include "mphonesecuritymodeobserver.h" |
32 #include "cphonestorage.h" |
33 #include "mphonesecuritymessagehandler.h" |
33 #include "mphonestorage.h" |
34 |
34 |
35 // ================= MEMBER FUNCTIONS ======================= |
35 // ================= MEMBER FUNCTIONS ======================= |
36 |
36 |
37 // C++ default constructor can NOT contain any code, that |
37 // C++ default constructor can NOT contain any code, that |
38 // might leave. |
38 // might leave. |
39 // |
39 // |
40 EXPORT_C CPhoneStateMachine::CPhoneStateMachine( |
40 EXPORT_C CPhoneStateMachine::CPhoneStateMachine( |
41 MPhoneViewCommandHandle* aViewCommandHandle ) : |
41 MPhoneViewCommandHandle* aViewCommandHandle ) : |
42 iOldStateId( EPhoneStateNull ), |
42 iOldStateId( EPhoneStateNull ), |
43 iNewStateId( EPhoneStateNull ), |
43 iNewStateId( EPhoneStateNull ), |
44 iViewCommandHandle( aViewCommandHandle ), |
44 iViewCommandHandle( aViewCommandHandle ) |
45 iEnv( CEikonEnv::Static() ) // codescanner::eikonenvstatic |
|
46 { |
45 { |
47 __ASSERT_ALWAYS( aViewCommandHandle, |
46 __ASSERT_ALWAYS( aViewCommandHandle, |
48 Panic( EPhoneCtrlParameterNotInitialized ) ); |
47 Panic( EPhoneCtrlParameterNotInitialized ) ); |
49 } |
48 } |
50 |
49 |
51 // ----------------------------------------------------------- |
50 // ----------------------------------------------------------- |
52 // CPhoneStateMachine::~CPhoneStateMachine() |
51 // CPhoneStateMachine::~CPhoneStateMachine() |
53 // Destructor |
52 // Destructor |
54 // (other items were commented in a header). |
53 // (other items were commented in a header). |
55 // ----------------------------------------------------------- |
54 // ----------------------------------------------------------- |
56 // |
55 // |
57 EXPORT_C CPhoneStateMachine::~CPhoneStateMachine() |
56 EXPORT_C CPhoneStateMachine::~CPhoneStateMachine() |
58 { |
57 { |
59 if( iState == iIdleState ) |
58 if( iState == iIdleState ) |
60 { |
59 { |
61 // Avoid deleting idle state instance twice. |
60 delete iState; |
62 // If state is idle, iState points to idle state instance. |
61 iState = NULL; |
63 iIdleState = NULL; |
62 iIdleState = NULL; |
64 } |
63 } |
65 delete iState; |
64 else |
66 delete iIdleState; |
65 { |
67 delete iPhoneEngine; |
66 if( iState ) |
68 } |
67 { |
|
68 delete iState; |
|
69 iState = NULL; |
|
70 } |
|
71 if( iIdleState ) |
|
72 { |
|
73 delete iIdleState; |
|
74 iIdleState = NULL; |
|
75 } |
|
76 } |
|
77 if( iPhoneEngine ) |
|
78 { |
|
79 delete iPhoneEngine; |
|
80 iPhoneEngine = NULL; |
|
81 } |
|
82 if( iPhoneStorage ) |
|
83 { |
|
84 delete iPhoneStorage; |
|
85 iPhoneStorage = NULL; |
|
86 } |
|
87 } |
69 |
88 |
70 // --------------------------------------------------------- |
89 // --------------------------------------------------------- |
71 // CPhoneStateMachine::SetPhoneEngine |
90 // CPhoneStateMachine::SetPhoneEngine |
72 // --------------------------------------------------------- |
91 // --------------------------------------------------------- |
73 // |
92 // |
74 EXPORT_C void CPhoneStateMachine::SetPhoneEngine( |
93 EXPORT_C void CPhoneStateMachine::SetPhoneEngine( |
75 MPEPhoneModel* aPhoneEngine ) |
94 MPEPhoneModel* aPhoneEngine ) |
76 { |
95 { |
77 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateMachine::SetPhoneEngine "); |
96 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateMachine::SetPhoneEngine "); |
78 __ASSERT_ALWAYS( aPhoneEngine, |
97 __ASSERT_ALWAYS( aPhoneEngine, |
79 Panic( EPhoneCtrlParameterNotInitialized ) ); |
98 Panic( EPhoneCtrlParameterNotInitialized ) ); |
80 |
99 |
81 iPhoneEngine = aPhoneEngine; |
100 iPhoneEngine = aPhoneEngine; |
82 } |
101 } |
83 |
102 |
84 // ----------------------------------------------------------- |
103 // ----------------------------------------------------------- |
162 "CALL ID: CPhoneStateMachine::SetCallId (%d)", |
181 "CALL ID: CPhoneStateMachine::SetCallId (%d)", |
163 aCallId); |
182 aCallId); |
164 PhoneEngineInfo()->SetCallId( aCallId ); |
183 PhoneEngineInfo()->SetCallId( aCallId ); |
165 } |
184 } |
166 |
185 |
167 |
186 // ----------------------------------------------------------- |
168 // ----------------------------------------------------------- |
187 // CPhoneStateMachine::PhoneStorage |
169 // CPhoneStateMachine::SecurityMode |
188 // ----------------------------------------------------------- |
170 // ----------------------------------------------------------- |
189 // |
171 // |
190 EXPORT_C MPhoneStorage* CPhoneStateMachine::PhoneStorage() |
172 EXPORT_C MPhoneSecurityModeObserver* CPhoneStateMachine::SecurityMode() |
191 { |
173 { |
192 if ( iPhoneStorage == NULL ) |
174 return iSecurityModeObserver; |
193 { |
175 } |
194 TInt err( KErrNone ); |
176 |
195 TRAP( err, iPhoneStorage = CPhoneStorage::NewL()); |
177 // ----------------------------------------------------------- |
196 __ASSERT_ALWAYS( KErrNone == err, User::Invariant() ); |
178 // CPhoneStateMachine::SetSecurityModeObserver |
197 } |
179 // ----------------------------------------------------------- |
198 return iPhoneStorage; |
180 // |
199 } |
181 EXPORT_C void CPhoneStateMachine::SetSecurityModeObserver( MPhoneSecurityModeObserver* aObserver ) |
200 |
182 { |
|
183 iSecurityModeObserver = aObserver; |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------- |
|
187 // CPhoneStateMachine::SetSecurityMessageHandler |
|
188 // ----------------------------------------------------------- |
|
189 // |
|
190 EXPORT_C void CPhoneStateMachine::SetSecurityMessageHandler( MPhoneSecurityMessageHandler* aHandler ) |
|
191 { |
|
192 iSecurityMessageHandler = aHandler; |
|
193 } |
|
194 |
|
195 // ----------------------------------------------------------- |
|
196 // CPhoneStateMachine::HandlePhoneEngineMessageL |
|
197 // ----------------------------------------------------------- |
|
198 // |
|
199 EXPORT_C void CPhoneStateMachine::HandlePhoneEngineMessageL(const TInt aMessage, |
|
200 TInt aCallId ) |
|
201 { |
|
202 // Forward engine messages to security mode state and current phone state |
|
203 // instance. |
|
204 if ( iSecurityMessageHandler ) |
|
205 { |
|
206 iSecurityMessageHandler->HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
207 } |
|
208 |
|
209 State()->HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
210 } |
|
211 |
|
212 // ----------------------------------------------------------- |
|
213 // CPhoneStateMachine::HandlePropertyChangedL |
|
214 // ----------------------------------------------------------- |
|
215 // |
|
216 EXPORT_C void CPhoneStateMachine::HandlePropertyChangedL(const TUid& aCategory, |
|
217 const TUint aKey, |
|
218 const TInt aValue ) |
|
219 { |
|
220 // Forward P&S key changes to security mode state and current phone state |
|
221 // instance. |
|
222 if ( iSecurityMessageHandler ) |
|
223 { |
|
224 iSecurityMessageHandler->HandlePropertyChangedL( aCategory, aKey, aValue ); |
|
225 } |
|
226 State()->HandlePropertyChangedL( aCategory, aKey, aValue ); |
|
227 } |
|
228 |
|
229 // ----------------------------------------------------------- |
|
230 // CPhoneStateMachine::EikonEnv |
|
231 // ----------------------------------------------------------- |
|
232 // |
|
233 EXPORT_C CEikonEnv* CPhoneStateMachine::EikonEnv() const |
|
234 { |
|
235 return iEnv; |
|
236 } |
|
237 |
|
238 // End of File |
201 // End of File |