|
1 /* |
|
2 * Copyright (c) 2007-2010 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: Encapsule the access to etelmm API in sat |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <mmtsy_names.h> |
|
20 #include "csatmultimodeapi.h" |
|
21 #include "csatsactivewrapper.h" |
|
22 #include "SatLog.h" |
|
23 |
|
24 #ifdef SAT_USE_DUMMY_TSY |
|
25 _LIT( KSatSDummyTsyModuleName, "DSAT" ); |
|
26 _LIT( KSatSDummyTsyPhoneName, "DMobile" ); |
|
27 #endif |
|
28 |
|
29 const TInt KLoopMaxTryouts = 5; |
|
30 const TInt KLoopTimeout = 3000000; |
|
31 |
|
32 // ================= MEMBER FUNCTIONS ========================================== |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // Class constructor. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CSatMultiModeApi::CSatMultiModeApi() |
|
39 { |
|
40 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CSatMultiModeApi calling-exiting" ) |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // Destructor |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CSatMultiModeApi::~CSatMultiModeApi() |
|
48 { |
|
49 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::~CSatMultiModeApi calling" ) |
|
50 |
|
51 if ( iCallOpened ) |
|
52 { |
|
53 iCall.Close(); |
|
54 } |
|
55 |
|
56 if ( iLineOpened ) |
|
57 { |
|
58 iLine.Close(); |
|
59 } |
|
60 |
|
61 if ( iUssdOpened ) |
|
62 { |
|
63 iUssd.Close(); |
|
64 } |
|
65 |
|
66 iCustomPhone.Close(); |
|
67 |
|
68 iPhone.Close(); |
|
69 |
|
70 #ifdef SAT_USE_DUMMY_TSY |
|
71 iDummyPhone.Close(); |
|
72 #endif |
|
73 iTelServer.Close(); |
|
74 |
|
75 delete iWrapper; |
|
76 iWrapper = NULL; |
|
77 |
|
78 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::~CSatMultiModeApi calling" ) |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CSatMultiModeApi::NewL |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 CSatMultiModeApi* CSatMultiModeApi::NewL() |
|
86 { |
|
87 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::NewL calling" ) |
|
88 |
|
89 CSatMultiModeApi* self = new( ELeave )CSatMultiModeApi(); |
|
90 CleanupStack::PushL( self ); |
|
91 self->ConstructL(); |
|
92 CleanupStack::Pop( self ); |
|
93 |
|
94 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::NewL calling" ) |
|
95 return self; |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CSatMultiModeApi::Phone |
|
100 // (other items were commented in a header). |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 RMobilePhone* CSatMultiModeApi::Phone() |
|
104 { |
|
105 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::Phone calling-exiting" ) |
|
106 return &iPhone; |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CSatMultiModeApi::Phone |
|
111 // (other items were commented in a header). |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 RMobilePhone* CSatMultiModeApi::DummyPhone() |
|
115 { |
|
116 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::Phone calling-exiting" ) |
|
117 #ifdef SAT_USE_DUMMY_TSY |
|
118 return &iDummyPhone; |
|
119 #else |
|
120 return NULL; |
|
121 #endif |
|
122 } |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // CSatMultiModeApi::CustomApi |
|
126 // (other items were commented in a header). |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 RMmCustomAPI* CSatMultiModeApi::CustomApi() |
|
130 { |
|
131 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CustomApi calling-exiting" ) |
|
132 return &iCustomPhone; |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // CSatMultiModeApi::LowerErrorGranularity |
|
137 // (other items were commented in a header). |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 void CSatMultiModeApi::LowerErrorGranularity() |
|
141 { |
|
142 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LowerErrorGranularity \ |
|
143 calling-exiting" ) |
|
144 iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorBasic ); |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CSatMultiModeApi::RaiseErrorGranularity |
|
149 // (other items were commented in a header). |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 void CSatMultiModeApi::RaiseErrorGranularity() |
|
153 { |
|
154 LOG( NORMAL, "SATENGINE: CSatMultiModeApi::RaiseErrorGranularity \ |
|
155 calling-exiting" ) |
|
156 iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ); |
|
157 } |
|
158 |
|
159 // ----------------------------------------------------------------------------- |
|
160 // CSatMultiModeApi::GetNetworkRegistrationStatus |
|
161 // (other items were commented in a header). |
|
162 // ----------------------------------------------------------------------------- |
|
163 // |
|
164 void CSatMultiModeApi::GetNetworkRegistrationStatus( |
|
165 TRequestStatus& aReqStatus, |
|
166 RMobilePhone::TMobilePhoneRegistrationStatus& aStatus) |
|
167 { |
|
168 LOG( SIMPLE, |
|
169 "SATENGINE: CSatMultiModeApi::GetNetworkRegistrationStatus calling" ) |
|
170 |
|
171 iPhone.GetNetworkRegistrationStatus( aReqStatus, aStatus ); |
|
172 |
|
173 LOG( SIMPLE, |
|
174 "SATENGINE: CSatMultiModeApi::GetNetworkRegistrationStatus exiting" ) |
|
175 } |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CSatMultiModeApi::NotifyNetworkRegistrationStatusChange |
|
178 // (other items were commented in a header). |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 void CSatMultiModeApi::NotifyNetworkRegistrationStatusChange( |
|
182 TRequestStatus& aReqStatus, |
|
183 RMobilePhone::TMobilePhoneRegistrationStatus& aStatus) |
|
184 { |
|
185 LOG( SIMPLE, "SATENGINE: \ |
|
186 CSatMultiModeApi::NotifyNetworkRegistrationStatusChange calling" ) |
|
187 |
|
188 iPhone.NotifyNetworkRegistrationStatusChange( aReqStatus, aStatus ); |
|
189 |
|
190 LOG( SIMPLE, "SATENGINE: \ |
|
191 CSatMultiModeApi::NotifyNetworkRegistrationStatusChange exiting" ) |
|
192 } |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // CSatMultiModeApi::GetSubscriberId |
|
196 // (other items were commented in a header). |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 void CSatMultiModeApi::GetSubscriberId(TRequestStatus& aReqStatus, |
|
200 RMobilePhone::TMobilePhoneSubscriberId& aId) |
|
201 { |
|
202 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::GetSubscriberId calling" ) |
|
203 iPhone.GetSubscriberId( aReqStatus, aId ); |
|
204 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::GetSubscriberId exiting" ) |
|
205 } |
|
206 |
|
207 // ----------------------------------------------------------------------------- |
|
208 // CSatMultiModeApi::SendDTMFTones |
|
209 // (other items were commented in a header). |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 void CSatMultiModeApi::SendDTMFTones( TRequestStatus& aReqStatus, |
|
213 const TDesC& aTones) |
|
214 { |
|
215 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::SendDTMFTones calling" ) |
|
216 iPhone.SendDTMFTones( aReqStatus, aTones ); |
|
217 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::SendDTMFTones exiting" ) |
|
218 } |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // CSatMultiModeApi::ContinueDTMFStringSending |
|
222 // (other items were commented in a header). |
|
223 // ----------------------------------------------------------------------------- |
|
224 // |
|
225 TInt CSatMultiModeApi::ContinueDTMFStringSending( TBool aContinue ) |
|
226 { |
|
227 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ContinueDTMFStringSending" ) |
|
228 return iPhone.ContinueDTMFStringSending( aContinue ); |
|
229 } |
|
230 |
|
231 // ----------------------------------------------------------------------------- |
|
232 // CSatMultiModeApi::DialNoFdnCheck |
|
233 // (other items were commented in a header). |
|
234 // ----------------------------------------------------------------------------- |
|
235 // |
|
236 void CSatMultiModeApi::DialNoFdnCheck( TRequestStatus& aStatus, |
|
237 const TDesC8& aCallParams, const TDesC& aTelNumber) |
|
238 { |
|
239 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialNoFdnCheck calling" ) |
|
240 TInt err = LoadMobileCall(); |
|
241 LOG2( SIMPLE, "SATENGINE: CSatMultiModeApi::DialNoFdnCheck err %d", err ) |
|
242 |
|
243 iCall.DialNoFdnCheck( aStatus, aCallParams, aTelNumber ); |
|
244 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialNoFdnCheck exiting" ) |
|
245 } |
|
246 |
|
247 // ----------------------------------------------------------------------------- |
|
248 // CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck |
|
249 // (other items were commented in a header). |
|
250 // ----------------------------------------------------------------------------- |
|
251 // |
|
252 void CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck( |
|
253 TRequestStatus& aReqStatus, const TDesC& aServiceString) |
|
254 |
|
255 { |
|
256 LOG( SIMPLE, "SATENGINE: \ |
|
257 CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck calling" ) |
|
258 |
|
259 iPhone.SendNetworkServiceRequestNoFdnCheck( aReqStatus, aServiceString ); |
|
260 |
|
261 LOG( SIMPLE, "SATENGINE: \ |
|
262 CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck exiting" ) |
|
263 } |
|
264 |
|
265 // ----------------------------------------------------------------------------- |
|
266 // CSatMultiModeApi::SendMessageNoFdnCheck |
|
267 // (other items were commented in a header). |
|
268 // ----------------------------------------------------------------------------- |
|
269 // |
|
270 void CSatMultiModeApi::SendMessageNoFdnCheck( TRequestStatus& aReqStatus, |
|
271 const TDesC8& aMsgData, const TDesC8& aMsgAttributes ) |
|
272 { |
|
273 LOG( SIMPLE, |
|
274 "SATENGINE: CSatMultiModeApi::SendMessageNoFdnCheck calling" ) |
|
275 |
|
276 iUssd.SendMessageNoFdnCheck( aReqStatus, aMsgData, aMsgAttributes ); |
|
277 |
|
278 LOG( SIMPLE, |
|
279 "SATENGINE: CSatMultiModeApi::SendMessageNoFdnCheck exiting" ) |
|
280 } |
|
281 |
|
282 // ----------------------------------------------------------------------------- |
|
283 // CSatMultiModeApi::CancelAsyncRequest |
|
284 // (other items were commented in a header). |
|
285 // ----------------------------------------------------------------------------- |
|
286 // |
|
287 void CSatMultiModeApi::CancelAsyncRequest(TInt aReqToCancel) |
|
288 { |
|
289 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CancelAsyncRequest calling" ) |
|
290 iPhone.CancelAsyncRequest( aReqToCancel ); |
|
291 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CancelAsyncRequest exiting" ) |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CSatMultiModeApi::DialCancel |
|
296 // (other items were commented in a header). |
|
297 // ----------------------------------------------------------------------------- |
|
298 // |
|
299 void CSatMultiModeApi::DialCancel() |
|
300 { |
|
301 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialCancel calling" ) |
|
302 iCall.DialCancel(); |
|
303 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialCancel exiting" ) |
|
304 } |
|
305 |
|
306 // ----------------------------------------------------------------------------- |
|
307 // CSatMultiModeApi::IsCallIncoming |
|
308 // (other items were commented in a header). |
|
309 // ----------------------------------------------------------------------------- |
|
310 // |
|
311 TBool CSatMultiModeApi::IsCallIncoming() |
|
312 { |
|
313 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::IsCallIncoming entering" ) |
|
314 TInt lines( 0 ); |
|
315 TBool callIncoming( EFalse ); |
|
316 |
|
317 // Enumerate all lines in the phone |
|
318 TInt err( iPhone.EnumerateLines( lines ) ); |
|
319 |
|
320 if ( KErrNone == err ) |
|
321 { |
|
322 RPhone::TLineInfo lineInfo; |
|
323 // Check the lines' status one by one |
|
324 for( TInt i = 0; ( i < lines ) && !callIncoming; ++i ) |
|
325 { |
|
326 err = iPhone.GetLineInfo( i, lineInfo ); |
|
327 if ( KErrNone == err ) |
|
328 { |
|
329 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::IsCallIncoming \ |
|
330 line status is %d", lineInfo.iStatus ) |
|
331 if ( ( RCall::EStatusDialling == lineInfo.iStatus ) || |
|
332 ( RCall::EStatusRinging == lineInfo.iStatus ) ) |
|
333 { |
|
334 // There is an incoming call |
|
335 callIncoming = ETrue; |
|
336 } |
|
337 } |
|
338 else |
|
339 { |
|
340 // Error happened when getting line info |
|
341 // We currently do nothing but skip the error line and log it |
|
342 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::IsCallIncoming \ |
|
343 getting line status error %d", err ) |
|
344 } |
|
345 } |
|
346 } |
|
347 else |
|
348 { |
|
349 // Enumerate lines error |
|
350 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::IsCallIncoming \ |
|
351 enumerate lines error %d", err ) |
|
352 } |
|
353 |
|
354 LOG2( SIMPLE, "SATENGINE: CSatMultiModeApi::IsCallIncoming exiting %d", |
|
355 callIncoming ) |
|
356 return callIncoming; |
|
357 } |
|
358 |
|
359 // ----------------------------------------------------------------------------- |
|
360 // CSatMultiModeApi::NotifyMobileCallStatusChange |
|
361 // ----------------------------------------------------------------------------- |
|
362 // |
|
363 void CSatMultiModeApi::NotifyMobileCallStatusChange ( |
|
364 TRequestStatus& aReqStatus, RMobileCall::TMobileCallStatus& aStatus ) |
|
365 { |
|
366 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::NotifyMobileCallStatusChange \ |
|
367 calling" ) |
|
368 iCall.NotifyMobileCallStatusChange( aReqStatus, aStatus ); |
|
369 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::NotifyMobileCallStatusChange \ |
|
370 exiting" ) |
|
371 } |
|
372 |
|
373 // ----------------------------------------------------------------------------- |
|
374 // CSatMultiModeApi::NotifyCallStatusChangeCancel |
|
375 // (other items were commented in a header). |
|
376 // ----------------------------------------------------------------------------- |
|
377 // |
|
378 void CSatMultiModeApi::NotifyCallStatusChangeCancel() |
|
379 { |
|
380 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialCancel calling" ) |
|
381 iCall.NotifyStatusChangeCancel(); |
|
382 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialCancel exiting" ) |
|
383 } |
|
384 |
|
385 // ----------------------------------------------------------------------------- |
|
386 // CSatMultiModeApi::NotifyMobileCallStatusChange |
|
387 // ----------------------------------------------------------------------------- |
|
388 // |
|
389 void CSatMultiModeApi::TerminateActiveCalls(TRequestStatus& aReqStatus) |
|
390 { |
|
391 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::TerminateAllCalls calling" ) |
|
392 |
|
393 iPhone.TerminateActiveCalls( aReqStatus ); |
|
394 |
|
395 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::TerminateAllCalls exiting" ) |
|
396 } |
|
397 |
|
398 // ----------------------------------------------------------------------------- |
|
399 // CSatMultiModeApi::GetMobileCallInfo |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 TInt CSatMultiModeApi::GetMobileCallInfo(TDes8& aCallInfo) |
|
403 { |
|
404 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::GetMobileCallInfo calling" ) |
|
405 TInt ret = iCall.GetMobileCallInfo( aCallInfo ); |
|
406 LOG2( SIMPLE, "SATENGINE: CSatMultiModeApi::GetMobileCallInfo exiting %d", |
|
407 ret ) |
|
408 return ret; |
|
409 } |
|
410 |
|
411 // ----------------------------------------------------------------------------- |
|
412 // CSatMultiModeApi::GetMobileCallInfo |
|
413 // ----------------------------------------------------------------------------- |
|
414 // |
|
415 void CSatMultiModeApi::DialEmergencyCall(TRequestStatus& aReqStatus, |
|
416 const TDesC& aNumber) |
|
417 { |
|
418 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialEmergencyCall calling" ) |
|
419 TInt err = LoadMobileCall(); |
|
420 LOG2( SIMPLE, "SATENGINE: CSatMultiModeApi::DialEmergencyCall err %d", err ) |
|
421 iCall.DialEmergencyCall( aReqStatus, aNumber ); |
|
422 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialEmergencyCall exiting" ) |
|
423 } |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // CSatMultiModeApi::ConstructL |
|
427 // ----------------------------------------------------------------------------- |
|
428 // |
|
429 void CSatMultiModeApi::ConstructL() |
|
430 { |
|
431 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConstructL calling" ) |
|
432 |
|
433 // Connect to ETel Server |
|
434 ConnectETelServerL(); |
|
435 #if !defined ( __WINSCW__ ) |
|
436 //On the emulator the load will leave. We can not use the functionaly |
|
437 //on enmulator |
|
438 LoadUssdMessagingL(); |
|
439 #endif |
|
440 |
|
441 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConstructL exiting" ) |
|
442 } |
|
443 |
|
444 // ----------------------------------------------------------------------------- |
|
445 // CSatMultiModeApi::ConnectETelServerL |
|
446 // (other items were commented in a header). |
|
447 // ----------------------------------------------------------------------------- |
|
448 // |
|
449 void CSatMultiModeApi::ConnectETelServerL() |
|
450 { |
|
451 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConnectETelServerL calling" ) |
|
452 |
|
453 TInt numberOfTries( 1 ); // Indicates loop tryouts |
|
454 TBool loopSuccess( EFalse ); // Loop stopper, if this is ETrue |
|
455 TInt error = KErrNone; // Error that is Leave'd |
|
456 |
|
457 if ( !iWrapper ) |
|
458 { |
|
459 LOG( NORMAL, "SATENGINE: CSatMultiModeApi::ConnectETelServerL \ |
|
460 iWrapper false" ) |
|
461 iWrapper = new ( ELeave ) CSatSActiveWrapper(); |
|
462 } |
|
463 |
|
464 // First loop is for connecting to RTelServer. Loop is done until |
|
465 // connection returns KErrNone or when max loop try outs has been |
|
466 // reached |
|
467 while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts ) |
|
468 { |
|
469 error = iTelServer.Connect(); |
|
470 if ( KErrNone == error ) |
|
471 { |
|
472 LOG( NORMAL, "SATENGINE: \ |
|
473 CSatMultiModeApi::ConnectETelServerL KErrNone == error" ) |
|
474 loopSuccess = ETrue; |
|
475 } |
|
476 else |
|
477 { |
|
478 numberOfTries++; |
|
479 iWrapper->After( KLoopTimeout ); |
|
480 } |
|
481 } |
|
482 |
|
483 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::ConnectETelServerL \ |
|
484 numberOfTries: %i", numberOfTries ) |
|
485 |
|
486 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::ConnectETelServerL \ |
|
487 error: %i", error ) |
|
488 |
|
489 // Check the error status |
|
490 User::LeaveIfError( error ); |
|
491 |
|
492 // Now load phone module |
|
493 LoadPhoneModuleL( iPhone, KMmTsyModuleName, KMmTsyPhoneName ); |
|
494 |
|
495 #ifdef SAT_USE_DUMMY_TSY |
|
496 // Also load dummy tsy |
|
497 LoadPhoneModuleL( iDummyPhone, KSatSDummyTsyModuleName, KSatSDummyTsyPhoneName ); |
|
498 #endif // SAT_USE_DUMMY_TSY |
|
499 |
|
500 User::LeaveIfError( iCustomPhone.Open( iPhone ) ); |
|
501 |
|
502 // No need for wrapper anymore |
|
503 delete iWrapper; |
|
504 iWrapper = NULL; |
|
505 |
|
506 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConnectETelServerL exiting" ) |
|
507 } |
|
508 |
|
509 // ----------------------------------------------------------------------------- |
|
510 // CSatMultiModeApi::LoadPhoneModuleL |
|
511 // (other items were commented in a header). |
|
512 // ----------------------------------------------------------------------------- |
|
513 // |
|
514 void CSatMultiModeApi::LoadPhoneModuleL( RMobilePhone& aPhone, |
|
515 const TDesC& aModuleName, const TDesC& aPhoneName ) |
|
516 { |
|
517 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL calling" ) |
|
518 |
|
519 TInt numberOfTries( 1 ); // Indicates loop tryouts |
|
520 TBool loopSuccess( EFalse ); // Loop stopper, if this is ETrue |
|
521 TInt error = KErrNone; // Error that is Leave'd |
|
522 |
|
523 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \ |
|
524 ModuleName: %S", &aModuleName ) |
|
525 |
|
526 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \ |
|
527 PhoneName: %S", &aPhoneName ) |
|
528 |
|
529 // We wait here until the phone module gets loaded. |
|
530 // Load the correct phone module depending on the TSY being used. |
|
531 while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts ) |
|
532 { |
|
533 error = iTelServer.LoadPhoneModule( aModuleName ); |
|
534 if ( KErrNone == error ) |
|
535 { |
|
536 loopSuccess = ETrue; |
|
537 } |
|
538 else |
|
539 { |
|
540 numberOfTries++; |
|
541 iWrapper->After( KLoopTimeout ); |
|
542 } |
|
543 } |
|
544 |
|
545 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \ |
|
546 numberOfTries: %i", numberOfTries ) |
|
547 |
|
548 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \ |
|
549 error: %i", error ) |
|
550 |
|
551 // Check the error status |
|
552 User::LeaveIfError( error ); |
|
553 |
|
554 // This function retrieves the total number of phones supported by all |
|
555 // the currently loaded ETel (TSY) modules. |
|
556 TInt phoneCount( 0 ); |
|
557 User::LeaveIfError( iTelServer.EnumeratePhones( phoneCount ) ); |
|
558 |
|
559 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \ |
|
560 phoneCount: %i", phoneCount ) |
|
561 |
|
562 // This function retrieves information associated with the specified phone |
|
563 RTelServer::TPhoneInfo phoneInfo; |
|
564 while ( phoneCount-- ) |
|
565 { |
|
566 User::LeaveIfError( iTelServer.GetPhoneInfo( phoneCount, |
|
567 phoneInfo ) ); |
|
568 |
|
569 // Check that do we have the right phone |
|
570 if ( phoneInfo.iName == aPhoneName ) |
|
571 { |
|
572 LOG( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \ |
|
573 phoneInfo.iName == aPhoneName" ) |
|
574 phoneCount = 0; |
|
575 } |
|
576 } |
|
577 |
|
578 if ( phoneInfo.iName != aPhoneName ) |
|
579 { |
|
580 // Did not found correct phone info -> Leave |
|
581 LOG( SIMPLE, |
|
582 "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL Not found" ) |
|
583 User::Leave( KErrNotFound ); |
|
584 } |
|
585 |
|
586 // Reset the counter and loop status for the next loop. |
|
587 numberOfTries = 1; |
|
588 loopSuccess = EFalse; |
|
589 |
|
590 // We wait here until the phone gets opened. |
|
591 // Open the correct phone depending on the TSY being used. |
|
592 while ( !loopSuccess && ( numberOfTries <= KLoopMaxTryouts ) ) |
|
593 { |
|
594 error = aPhone.Open( iTelServer, aPhoneName ); |
|
595 |
|
596 if ( KErrNone == error ) |
|
597 { |
|
598 LOG( NORMAL, "SATENGINE: \ |
|
599 CSatMultiModeApi::LoadPhoneModuleL KErrNone == error" ) |
|
600 loopSuccess = ETrue; |
|
601 } |
|
602 else |
|
603 { |
|
604 numberOfTries++; |
|
605 iWrapper->After( KLoopTimeout ); |
|
606 } |
|
607 } |
|
608 if ( !loopSuccess ) |
|
609 { |
|
610 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL\ |
|
611 phone open failed" ); |
|
612 } |
|
613 |
|
614 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL exiting" ) |
|
615 } |
|
616 |
|
617 // ----------------------------------------------------------------------------- |
|
618 // CSatMultiModeApi::LoadMobileCall |
|
619 // (other items were commented in a header). |
|
620 // ----------------------------------------------------------------------------- |
|
621 // |
|
622 TInt CSatMultiModeApi::LoadMobileCall() |
|
623 { |
|
624 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadMobileCallL calling" ) |
|
625 |
|
626 if ( iCallOpened ) |
|
627 { |
|
628 iCall.Close(); |
|
629 } |
|
630 |
|
631 if ( iLineOpened ) |
|
632 { |
|
633 iLine.Close(); |
|
634 } |
|
635 |
|
636 TInt numberOfTries( 1 ); // Indicates loop tryouts |
|
637 TBool loopSuccess( EFalse ); // Loop stopper, if this is ETrue |
|
638 TInt error = KErrNone; // Error that is Leave'd |
|
639 |
|
640 while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts ) |
|
641 { |
|
642 error = iLine.Open( iPhone, KMmTsyVoice1LineName ); |
|
643 if ( KErrNone == error ) |
|
644 { |
|
645 loopSuccess = ETrue; |
|
646 iLineOpened = ETrue; |
|
647 } |
|
648 else |
|
649 { |
|
650 numberOfTries++; |
|
651 iWrapper->After( KLoopTimeout ); |
|
652 } |
|
653 } |
|
654 |
|
655 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \ |
|
656 iLine numberOfTries: %i", numberOfTries ) |
|
657 |
|
658 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \ |
|
659 iLine error: %i", error ) |
|
660 |
|
661 numberOfTries = 1; |
|
662 loopSuccess = EFalse; |
|
663 |
|
664 while ( iLineOpened &&!loopSuccess && numberOfTries <= KLoopMaxTryouts ) |
|
665 { |
|
666 error = iCall.OpenNewCall( iLine ); |
|
667 if ( KErrNone == error ) |
|
668 { |
|
669 loopSuccess = ETrue; |
|
670 iCallOpened = ETrue; |
|
671 } |
|
672 else |
|
673 { |
|
674 numberOfTries++; |
|
675 iWrapper->After( KLoopTimeout ); |
|
676 } |
|
677 } |
|
678 |
|
679 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \ |
|
680 iCall numberOfTries: %i", numberOfTries ) |
|
681 |
|
682 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \ |
|
683 iCall error: %i", error ) |
|
684 |
|
685 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadMobileCallL exiting" ) |
|
686 return error; |
|
687 } |
|
688 |
|
689 // ----------------------------------------------------------------------------- |
|
690 // CSatMultiModeApi::LoadMobileCallL |
|
691 // (other items were commented in a header). |
|
692 // ----------------------------------------------------------------------------- |
|
693 // |
|
694 void CSatMultiModeApi::LoadUssdMessagingL() |
|
695 |
|
696 { |
|
697 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL calling" ) |
|
698 |
|
699 TInt numberOfTries( 1 ); // Indicates loop tryouts |
|
700 TBool loopSuccess( EFalse ); // Loop stopper, if this is ETrue |
|
701 TInt error = KErrNone; // Error that is Leave'd |
|
702 |
|
703 while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts ) |
|
704 { |
|
705 error = iUssd.Open( iPhone ); |
|
706 if ( KErrNone == error ) |
|
707 { |
|
708 loopSuccess = ETrue; |
|
709 iUssdOpened = ETrue; |
|
710 } |
|
711 else |
|
712 { |
|
713 numberOfTries++; |
|
714 iWrapper->After( KLoopTimeout ); |
|
715 } |
|
716 } |
|
717 |
|
718 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL \ |
|
719 iUssd numberOfTries: %i", numberOfTries ) |
|
720 |
|
721 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL \ |
|
722 iUssd error: %i", error ) |
|
723 |
|
724 User::LeaveIfError( error ); |
|
725 |
|
726 LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL exiting" ) |
|
727 } |
|
728 |
|
729 |
|
730 //End of file |