|
1 /* |
|
2 * Copyright (c) 2009 Sony Ericsson Mobile Communications AB |
|
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 * Sony Ericsson Mobile Communications AB - initial contribution. |
|
11 * Nokia Corporation - additional changes. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * Code for CTelephonyFunctions class, used by CTelephony class. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 */ |
|
24 |
|
25 #include "TelephonyFunctions.h" |
|
26 #include "TelephonyActPhone.h" |
|
27 #include "TelephonyActSupplServices.h" |
|
28 #include "TelephonyActLine.h" |
|
29 #include "TelephonyActCall.h" |
|
30 #include "TelephonyActNetwork.h" |
|
31 |
|
32 #include <commsdattypesv1_1.h> |
|
33 #include <cdblen.h> |
|
34 #include <commsdat_partner.h> |
|
35 using namespace CommsDat; |
|
36 |
|
37 // construct/destruct |
|
38 |
|
39 CTelephonyFunctions* CTelephonyFunctions::NewLC() |
|
40 /** |
|
41 Constructs a CTelephonyFunctions object. |
|
42 |
|
43 A pointer to this object is left on the CleanupStack. |
|
44 |
|
45 @leave Leaves if no memory, or underlying Etel DLL returns error. |
|
46 @return Pointer to a newly created CTelephonyFunctions object connected to an RTelServer. |
|
47 */ |
|
48 { |
|
49 CTelephonyFunctions* self=new (ELeave) CTelephonyFunctions(); |
|
50 CleanupStack::PushL(self); |
|
51 self->ConstructL(); |
|
52 return self; |
|
53 } |
|
54 |
|
55 CTelephonyFunctions* CTelephonyFunctions::NewL() |
|
56 /** |
|
57 Constructs a CTelephonyFunctions object. |
|
58 |
|
59 @leave Leaves if no memory, or underlying Etel DLL returns error. |
|
60 @return pointer to a newly created CTelephonyFunctions object connected to an RTelServer. |
|
61 */ |
|
62 { |
|
63 CTelephonyFunctions* self=NewLC(); |
|
64 CleanupStack::Pop(); |
|
65 return self; |
|
66 } |
|
67 |
|
68 CTelephonyFunctions::~CTelephonyFunctions() |
|
69 /** |
|
70 Destructor |
|
71 */ |
|
72 { |
|
73 |
|
74 CleanUp(); |
|
75 |
|
76 if (iTelServerIsOpen) |
|
77 { |
|
78 iTelServer.Close(); |
|
79 } |
|
80 |
|
81 iReqPendingTable.Close(); |
|
82 iReqStatusTable.Close(); |
|
83 iCallPool.Close(); |
|
84 iCallPoolStatus.Close(); |
|
85 iPhonePowerProperty.Close(); |
|
86 } |
|
87 |
|
88 /** |
|
89 Cleans up any outstanding "Open" objects. |
|
90 */ |
|
91 void CTelephonyFunctions::CleanUp() |
|
92 { |
|
93 for ( TInt i=0;i<iReqPendingTable.Count(); i++) |
|
94 { |
|
95 if(iReqPendingTable[i]!=EFalse) |
|
96 { |
|
97 User::RequestComplete(iReqStatusTable[i], KErrCancel); |
|
98 } |
|
99 } |
|
100 |
|
101 iState = ECleaningUp; |
|
102 |
|
103 if(iGetPhoneId!=NULL) |
|
104 { |
|
105 delete iGetPhoneId; |
|
106 iGetPhoneId = NULL; |
|
107 } |
|
108 if(iGetSubscriberId!=NULL) |
|
109 { |
|
110 delete iGetSubscriberId; |
|
111 iGetSubscriberId = NULL; |
|
112 } |
|
113 if(iGetIndicator!=NULL) |
|
114 { |
|
115 delete iGetIndicator; |
|
116 iGetIndicator = NULL; |
|
117 } |
|
118 if(iGetBatteryInfo!=NULL) |
|
119 { |
|
120 delete iGetBatteryInfo; |
|
121 iGetBatteryInfo = NULL; |
|
122 } |
|
123 if(iGetSignalStrength!=NULL) |
|
124 { |
|
125 delete iGetSignalStrength; |
|
126 iGetSignalStrength = NULL; |
|
127 } |
|
128 if(iGetIccLockInfo!=NULL) |
|
129 { |
|
130 delete iGetIccLockInfo; |
|
131 iGetIccLockInfo = NULL; |
|
132 } |
|
133 if(iSendDTMFTones!=NULL) |
|
134 { |
|
135 delete iSendDTMFTones; |
|
136 iSendDTMFTones = NULL; |
|
137 } |
|
138 if(iDialNewCall!=NULL) |
|
139 { |
|
140 delete iDialNewCall; |
|
141 iDialNewCall = NULL; |
|
142 } |
|
143 if(iHold!=NULL) |
|
144 { |
|
145 delete iHold; |
|
146 iHold = NULL; |
|
147 } |
|
148 if(iResume!=NULL) |
|
149 { |
|
150 delete iResume; |
|
151 iResume = NULL; |
|
152 } |
|
153 if(iSwap!=NULL) |
|
154 { |
|
155 delete iSwap; |
|
156 iSwap = NULL; |
|
157 } |
|
158 if(iHangup!=NULL) |
|
159 { |
|
160 delete iHangup; |
|
161 iHangup = NULL; |
|
162 } |
|
163 if(iAnswerIncomingCall!=NULL) |
|
164 { |
|
165 delete iAnswerIncomingCall; |
|
166 iAnswerIncomingCall = NULL; |
|
167 } |
|
168 if(iGetNetworkRegistrationStatus!=NULL) |
|
169 { |
|
170 delete iGetNetworkRegistrationStatus; |
|
171 iGetNetworkRegistrationStatus = NULL; |
|
172 } |
|
173 if(iGetCurrentNetworkInfo!=NULL) |
|
174 { |
|
175 delete iGetCurrentNetworkInfo; |
|
176 iGetCurrentNetworkInfo = NULL; |
|
177 } |
|
178 if(iGetCurrentNetworkName!=NULL) |
|
179 { |
|
180 delete iGetCurrentNetworkName; |
|
181 iGetCurrentNetworkName = NULL; |
|
182 } |
|
183 if(iGetOperatorName!=NULL) |
|
184 { |
|
185 delete iGetOperatorName; |
|
186 iGetOperatorName = NULL; |
|
187 } |
|
188 if(iGetCFSupplementaryServiceStatus!=NULL) |
|
189 { |
|
190 delete iGetCFSupplementaryServiceStatus; |
|
191 iGetCFSupplementaryServiceStatus = NULL; |
|
192 } |
|
193 if(iGetCBSupplementaryServiceStatus!=NULL) |
|
194 { |
|
195 delete iGetCBSupplementaryServiceStatus; |
|
196 iGetCBSupplementaryServiceStatus = NULL; |
|
197 } |
|
198 if(iGetCWSupplementaryServiceStatus!=NULL) |
|
199 { |
|
200 delete iGetCWSupplementaryServiceStatus; |
|
201 iGetCWSupplementaryServiceStatus = NULL; |
|
202 } |
|
203 if(iGetIdentityServiceStatus!=NULL) |
|
204 { |
|
205 delete iGetIdentityServiceStatus; |
|
206 iGetIdentityServiceStatus = NULL; |
|
207 } |
|
208 if(iFlightModeChange!=NULL) |
|
209 { |
|
210 delete iFlightModeChange; |
|
211 iFlightModeChange = NULL; |
|
212 } |
|
213 if(iNotifyIndicator!=NULL) |
|
214 { |
|
215 delete iNotifyIndicator; |
|
216 iNotifyIndicator = NULL; |
|
217 } |
|
218 if(iNotifyBatteryInfo!=NULL) |
|
219 { |
|
220 delete iNotifyBatteryInfo; |
|
221 iNotifyBatteryInfo = NULL; |
|
222 } |
|
223 if(iNotifySignalStrength!=NULL) |
|
224 { |
|
225 delete iNotifySignalStrength; |
|
226 iNotifySignalStrength = NULL; |
|
227 } |
|
228 if(iNotifyIccLockInfo!=NULL) |
|
229 { |
|
230 delete iNotifyIccLockInfo; |
|
231 iNotifyIccLockInfo = NULL; |
|
232 } |
|
233 if(iNotifyNetworkRegStatus!=NULL) |
|
234 { |
|
235 delete iNotifyNetworkRegStatus; |
|
236 iNotifyNetworkRegStatus = NULL; |
|
237 } |
|
238 if(iNotifyCurrentNetworkInfo!=NULL) |
|
239 { |
|
240 delete iNotifyCurrentNetworkInfo; |
|
241 iNotifyCurrentNetworkInfo = NULL; |
|
242 } |
|
243 if(iNotifyOwnedCall1Status!=NULL) |
|
244 { |
|
245 delete iNotifyOwnedCall1Status; |
|
246 iNotifyOwnedCall1Status = NULL; |
|
247 } |
|
248 if(iNotifyOwnedCall2Status!=NULL) |
|
249 { |
|
250 delete iNotifyOwnedCall2Status; |
|
251 iNotifyOwnedCall2Status = NULL; |
|
252 } |
|
253 if(iNotifyOwnedCall1RemoteInfo!=NULL) |
|
254 { |
|
255 delete iNotifyOwnedCall1RemoteInfo; |
|
256 iNotifyOwnedCall1RemoteInfo = NULL; |
|
257 } |
|
258 if(iNotifyOwnedCall2RemoteInfo!=NULL) |
|
259 { |
|
260 delete iNotifyOwnedCall2RemoteInfo; |
|
261 iNotifyOwnedCall2RemoteInfo = NULL; |
|
262 } |
|
263 |
|
264 // Delete the internal active objects last |
|
265 if(iInternalNotifyVoiceLineStatus!=NULL) |
|
266 { |
|
267 delete iInternalNotifyVoiceLineStatus; |
|
268 iInternalNotifyVoiceLineStatus = NULL; |
|
269 } |
|
270 if (iInternalNotifyIncomingCall!=NULL) |
|
271 { |
|
272 delete iInternalNotifyIncomingCall; |
|
273 iInternalNotifyIncomingCall = NULL; |
|
274 } |
|
275 |
|
276 if(iCallIsOpen) |
|
277 { |
|
278 iCallIsOpen = EFalse; |
|
279 iCall.Close(); |
|
280 } |
|
281 |
|
282 for(TInt k = 0; k < iCallPool.Count(); k++) |
|
283 { |
|
284 iCallPool[k].Close(); |
|
285 } |
|
286 |
|
287 for(TInt k = 0; k < iCallPoolStatus.Count(); k++) |
|
288 { |
|
289 iCallPoolStatus[k] = EUnset; |
|
290 } |
|
291 |
|
292 if(iLineIsDataOpen) |
|
293 { |
|
294 iLineIsDataOpen = EFalse; |
|
295 iLineData.Close(); |
|
296 } |
|
297 |
|
298 if(iLineIsVoiceOpen) |
|
299 { |
|
300 iLineIsVoiceOpen = EFalse; |
|
301 iLineVoice.Close(); |
|
302 } |
|
303 |
|
304 if(iLineIsFaxOpen) |
|
305 { |
|
306 iLineIsFaxOpen = EFalse; |
|
307 iLineFax.Close(); |
|
308 } |
|
309 |
|
310 if(iPhoneIsOpen) |
|
311 { |
|
312 iPhoneIsOpen = EFalse; |
|
313 iPhone.Close(); |
|
314 } |
|
315 iState = EIdle; // all cleaned up. |
|
316 } |
|
317 |
|
318 |
|
319 CTelephonyFunctions::CTelephonyFunctions() |
|
320 /** |
|
321 First-phase constructor |
|
322 |
|
323 private function which cannot Leave(). |
|
324 */ |
|
325 : iState(EIdle), |
|
326 iReqStatusTable(EMaxNumberOperations), |
|
327 iReqPendingTable(EMaxNumberOperations), |
|
328 iCallPool(CTelephony::EISVMaxNumOfCalls), |
|
329 iCallPoolStatus(CTelephony::EISVMaxNumOfCalls) |
|
330 { |
|
331 } |
|
332 |
|
333 |
|
334 void CTelephonyFunctions::ConstructL() |
|
335 /** |
|
336 Second-phase constructor |
|
337 */ |
|
338 { |
|
339 #ifdef __WINS__ |
|
340 // When bootstrapping C32 we have to avoid the PhBkSyncServer being started, since |
|
341 // it needs a different CommDB |
|
342 _LIT(KPhbkSyncCMI, "phbsync.cmi"); |
|
343 TInt err = StartC32WithCMISuppressions(KPhbkSyncCMI); // Start Comms server if not already active. |
|
344 if( err!=KErrNone && err!=KErrAlreadyExists ) |
|
345 { |
|
346 User::Leave(err); |
|
347 } |
|
348 |
|
349 #endif |
|
350 User::LeaveIfError(iTelServer.Connect()); |
|
351 iTelServerIsOpen = ETrue; |
|
352 User::LeaveIfError(iPhonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid)); |
|
353 |
|
354 for( TInt i=0; i<EMaxNumberOperations; i++) |
|
355 { |
|
356 TRequestStatus dummy(KErrNone); |
|
357 iReqPendingTable.Append(EFalse); |
|
358 iReqStatusTable.Append(&dummy); |
|
359 } |
|
360 for( TInt j=0; j<CTelephony::EISVMaxNumOfCalls; j++) |
|
361 { |
|
362 RMobileCall aDummyCall; |
|
363 iCallPool.Append(aDummyCall); |
|
364 iCallPoolStatus.Append(EUnset); |
|
365 } |
|
366 |
|
367 __ASSERT_DEBUG(iState==EIdle, User::Invariant()); |
|
368 |
|
369 InitialisePhoneL(); |
|
370 } |
|
371 |
|
372 |
|
373 void CTelephonyFunctions::GetCommDbTSYnameL(TDes& aTsyName) |
|
374 { |
|
375 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
376 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
|
377 #else |
|
378 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
|
379 #endif |
|
380 CleanupStack::PushL(db); |
|
381 |
|
382 CMDBField<TDesC>* globalSettingField = new(ELeave) CMDBField<TDesC>(KCDTIdBearerAvailabilityCheckTSY); |
|
383 CleanupStack::PushL(globalSettingField); |
|
384 globalSettingField->SetRecordId(1); |
|
385 globalSettingField->SetMaxLengthL(KMaxTextLength); |
|
386 globalSettingField->LoadL(*db); |
|
387 aTsyName = *globalSettingField; |
|
388 CleanupStack::PopAndDestroy(globalSettingField); |
|
389 |
|
390 CleanupStack::PopAndDestroy(db); |
|
391 } |
|
392 |
|
393 |
|
394 void CTelephonyFunctions::InitialisePhoneL() |
|
395 /** |
|
396 Finds the first data-Line and Open()'s the Phone and Line. |
|
397 |
|
398 @leave Leaves if underlying ETEL.DLL returns error, |
|
399 or if we can't find a suitable Phone/Line or can't open it. |
|
400 */ |
|
401 { |
|
402 TBuf<KCommsDbSvrMaxFieldLength> tsyName; |
|
403 GetCommDbTSYnameL(tsyName); |
|
404 |
|
405 User::LeaveIfError(iTelServer.LoadPhoneModule(tsyName)); |
|
406 |
|
407 TInt numPhones; |
|
408 User::LeaveIfError(iTelServer.EnumeratePhones(numPhones)); |
|
409 |
|
410 TInt phoneIndx; |
|
411 TInt ret = KErrHardwareNotAvailable; |
|
412 |
|
413 RPhone::TLineInfo lineInfo; |
|
414 for(phoneIndx=0; phoneIndx<numPhones; phoneIndx++) |
|
415 { |
|
416 RTelServer::TPhoneInfo tInfo; |
|
417 ret = iTelServer.GetPhoneInfo(phoneIndx, tInfo); |
|
418 if(ret != KErrNone) |
|
419 { |
|
420 continue; |
|
421 } |
|
422 |
|
423 ret = iPhone.Open(iTelServer, tInfo.iName); |
|
424 if(ret != KErrNone) |
|
425 { |
|
426 continue; |
|
427 } |
|
428 |
|
429 iPhoneIsOpen = ETrue; |
|
430 |
|
431 RPhone::TStatus status; |
|
432 User::LeaveIfError(iPhone.GetStatus(status)); |
|
433 if(status.iModemDetected!=RPhone::EDetectedPresent) |
|
434 { |
|
435 ret = iPhone.Initialise(); |
|
436 if(ret != KErrNone) |
|
437 { |
|
438 iPhone.Close(); |
|
439 iPhoneIsOpen = EFalse; |
|
440 continue; |
|
441 } |
|
442 } |
|
443 |
|
444 TInt lines; |
|
445 ret = iPhone.EnumerateLines(lines); |
|
446 if(ret != KErrNone) |
|
447 { |
|
448 iPhone.Close(); |
|
449 iPhoneIsOpen = EFalse; |
|
450 continue; |
|
451 } |
|
452 |
|
453 if(lines<1) |
|
454 { |
|
455 ret = KErrEtelWrongModemType; |
|
456 iPhone.Close(); |
|
457 iPhoneIsOpen = EFalse; |
|
458 continue; |
|
459 } |
|
460 |
|
461 TInt lineIndx; |
|
462 TBool lineVoiceFound=EFalse, lineFaxFound=EFalse, lineDataFound=EFalse; |
|
463 for(lineIndx=0; lineIndx<lines; lineIndx++) |
|
464 { |
|
465 if(iPhone.GetLineInfo(lineIndx, lineInfo) != KErrNone) |
|
466 { |
|
467 continue; |
|
468 } |
|
469 |
|
470 if((lineInfo.iLineCapsFlags & RLine::KCapsVoice)&&(!lineVoiceFound)) |
|
471 { |
|
472 User::LeaveIfError(iLineVoice.Open(iPhone, lineInfo.iName)); |
|
473 iLineIsVoiceOpen = ETrue; |
|
474 lineVoiceFound = ETrue; |
|
475 iLineVoiceName.Copy(lineInfo.iName); |
|
476 continue; |
|
477 } |
|
478 else if((lineInfo.iLineCapsFlags & RLine::KCapsData)&&(!lineDataFound)) |
|
479 { |
|
480 User::LeaveIfError(iLineData.Open(iPhone, lineInfo.iName)); |
|
481 iLineIsDataOpen = ETrue; |
|
482 lineDataFound = ETrue; |
|
483 continue; |
|
484 } |
|
485 else if((lineInfo.iLineCapsFlags & RLine::KCapsFax)&&(!lineFaxFound)) |
|
486 { |
|
487 User::LeaveIfError(iLineFax.Open(iPhone, lineInfo.iName)); |
|
488 iLineIsFaxOpen = ETrue; |
|
489 lineFaxFound = ETrue; |
|
490 continue; |
|
491 } |
|
492 |
|
493 } |
|
494 |
|
495 if(!iLineIsVoiceOpen) |
|
496 { |
|
497 ret = KErrEtelWrongModemType; |
|
498 iPhone.Close(); |
|
499 iPhoneIsOpen = EFalse; |
|
500 continue; |
|
501 } |
|
502 |
|
503 //get TSY version |
|
504 TBool result; |
|
505 iTsyVersion = KETelExtMultimodeV3; |
|
506 User::LeaveIfError(iTelServer.IsSupportedByModule(tsyName, iTsyVersion, result)); |
|
507 if(!result) |
|
508 { |
|
509 iTsyVersion = KETelExtMultimodeV2; |
|
510 User::LeaveIfError(iTelServer.IsSupportedByModule(tsyName, iTsyVersion, result)); |
|
511 if(!result) |
|
512 { |
|
513 iTsyVersion = KETelExtMultimodeV1; |
|
514 User::LeaveIfError(iTelServer.IsSupportedByModule(tsyName, iTsyVersion, result)); |
|
515 if(!result) |
|
516 { |
|
517 iTsyVersion = KNoMultimodeTsy; |
|
518 } |
|
519 } |
|
520 } |
|
521 |
|
522 // |
|
523 // A CTelephonyFunctions object is always listening for a change |
|
524 // in the line status and for an incoming call. |
|
525 // The iInternalNotifyVoiceLineStatus and iInternalNotifyIncoming |
|
526 // call objects persist throughout this object's lifetime. |
|
527 // Create the internal active objects and post the first request. |
|
528 // |
|
529 iInternalNotifyIncomingCall=CNotifyIncomingCallAct::NewL(this); |
|
530 iInternalNotifyIncomingCall->NotifyIncomingCall(); |
|
531 iInternalNotifyVoiceLineStatus=CNotifyLineStatusAct::NewL(this, CTelephonyFunctions::ENotifyVoiceLineStatus, *iInternalNotifyIncomingCall); |
|
532 iInternalNotifyVoiceLineStatus->NotifyLineStatus(NULL); |
|
533 |
|
534 // |
|
535 // We have found a valid phone to use... |
|
536 // |
|
537 break; |
|
538 } |
|
539 |
|
540 // |
|
541 // ret will be KErrNone if a valid phone was found... |
|
542 // |
|
543 User::LeaveIfError(ret); |
|
544 } |
|
545 |
|
546 /** |
|
547 Cancel the outstanding async request. |
|
548 */ |
|
549 TInt CTelephonyFunctions::CancelAsync(CTelephony::TCancellationRequest aCancel) |
|
550 { |
|
551 switch(aCancel) |
|
552 { |
|
553 case CTelephony::EGetPhoneIdCancel: |
|
554 if((iGetPhoneId==NULL)|| |
|
555 (IsRequestPending(EGetPhoneId)==EFalse)) |
|
556 return KErrTelephonyOutOfSequence; |
|
557 else |
|
558 { |
|
559 delete iGetPhoneId; |
|
560 iGetPhoneId=NULL; |
|
561 } |
|
562 break; |
|
563 case CTelephony::EGetSubscriberIdCancel: |
|
564 if((iGetSubscriberId==NULL)|| |
|
565 (IsRequestPending(EGetSubscriberId)==EFalse)) |
|
566 return KErrTelephonyOutOfSequence; |
|
567 else |
|
568 { |
|
569 delete iGetSubscriberId; |
|
570 iGetSubscriberId=NULL; |
|
571 } |
|
572 break; |
|
573 case CTelephony::EGetIndicatorCancel: |
|
574 if((iGetIndicator==NULL)|| |
|
575 (IsRequestPending(EGetIndicator)==EFalse)) |
|
576 return KErrTelephonyOutOfSequence; |
|
577 else |
|
578 { |
|
579 delete iGetIndicator; |
|
580 iGetIndicator=NULL; |
|
581 } |
|
582 break; |
|
583 case CTelephony::EGetBatteryInfoCancel: |
|
584 if((iGetBatteryInfo==NULL)|| |
|
585 (IsRequestPending(EGetBatteryInfo)==EFalse)) |
|
586 return KErrTelephonyOutOfSequence; |
|
587 else |
|
588 { |
|
589 delete iGetBatteryInfo; |
|
590 iGetBatteryInfo=NULL; |
|
591 } |
|
592 break; |
|
593 case CTelephony::EGetSignalStrengthCancel: |
|
594 if((iGetSignalStrength==NULL)|| |
|
595 (IsRequestPending(EGetSignalStrength)==EFalse)) |
|
596 return KErrTelephonyOutOfSequence; |
|
597 else |
|
598 { |
|
599 delete iGetSignalStrength; |
|
600 iGetSignalStrength=NULL; |
|
601 } |
|
602 break; |
|
603 case CTelephony::EGetLockInfoCancel: |
|
604 if((iGetIccLockInfo==NULL)|| |
|
605 (IsRequestPending(EGetIccLockInfo)==EFalse)) |
|
606 return KErrTelephonyOutOfSequence; |
|
607 else |
|
608 { |
|
609 delete iGetIccLockInfo; |
|
610 iGetIccLockInfo=NULL; |
|
611 } |
|
612 break; |
|
613 case CTelephony::ESendDTMFTonesCancel: |
|
614 if((iSendDTMFTones==NULL)|| |
|
615 (IsRequestPending(ESendDTMFTones)==EFalse)) |
|
616 return KErrTelephonyOutOfSequence; |
|
617 else |
|
618 { |
|
619 delete iSendDTMFTones; |
|
620 iSendDTMFTones=NULL; |
|
621 } |
|
622 break; |
|
623 case CTelephony::EDialNewCallCancel: |
|
624 if((iDialNewCall==NULL)|| |
|
625 (IsRequestPending(EDialNewCall)==EFalse)) |
|
626 return KErrTelephonyOutOfSequence; |
|
627 else |
|
628 { |
|
629 delete iDialNewCall; |
|
630 iDialNewCall=NULL; |
|
631 } |
|
632 break; |
|
633 case CTelephony::EHoldCancel: |
|
634 if((iHold==NULL)|| |
|
635 (IsRequestPending(EHold)==EFalse)) |
|
636 return KErrTelephonyOutOfSequence; |
|
637 else |
|
638 { |
|
639 delete iHold; |
|
640 iHold=NULL; |
|
641 } |
|
642 break; |
|
643 case CTelephony::EResumeCancel: |
|
644 if((iResume==NULL)|| |
|
645 (IsRequestPending(EResume)==EFalse)) |
|
646 return KErrTelephonyOutOfSequence; |
|
647 else |
|
648 { |
|
649 delete iResume; |
|
650 iResume=NULL; |
|
651 } |
|
652 break; |
|
653 case CTelephony::ESwapCancel: |
|
654 if((iSwap==NULL)|| |
|
655 (IsRequestPending(ESwap)==EFalse)) |
|
656 return KErrTelephonyOutOfSequence; |
|
657 else |
|
658 { |
|
659 delete iSwap; |
|
660 iSwap=NULL; |
|
661 } |
|
662 break; |
|
663 case CTelephony::EHangupCancel: |
|
664 if((iHangup==NULL)|| |
|
665 (IsRequestPending(EHangup)==EFalse)) |
|
666 return KErrTelephonyOutOfSequence; |
|
667 else |
|
668 { |
|
669 delete iHangup; |
|
670 iHangup=NULL; |
|
671 } |
|
672 break; |
|
673 case CTelephony::EAnswerIncomingCallCancel: |
|
674 if((iAnswerIncomingCall==NULL)|| |
|
675 (IsRequestPending(EAnswerIncomingCall)==EFalse)) |
|
676 return KErrTelephonyOutOfSequence; |
|
677 else |
|
678 { |
|
679 delete iAnswerIncomingCall; |
|
680 iAnswerIncomingCall=NULL; |
|
681 } |
|
682 break; |
|
683 case CTelephony::EGetNetworkRegistrationStatusCancel: |
|
684 if((iGetNetworkRegistrationStatus==NULL)|| |
|
685 (IsRequestPending(EGetNetworkRegistrationStatus)==EFalse)) |
|
686 return KErrTelephonyOutOfSequence; |
|
687 else |
|
688 { |
|
689 delete iGetNetworkRegistrationStatus; |
|
690 iGetNetworkRegistrationStatus=NULL; |
|
691 } |
|
692 break; |
|
693 case CTelephony::EGetCurrentNetworkInfoCancel: |
|
694 if((iGetCurrentNetworkInfo==NULL)|| |
|
695 (IsRequestPending(EGetCurrentNetworkInfo)==EFalse)) |
|
696 return KErrTelephonyOutOfSequence; |
|
697 else |
|
698 { |
|
699 delete iGetCurrentNetworkInfo; |
|
700 iGetCurrentNetworkInfo=NULL; |
|
701 } |
|
702 break; |
|
703 case CTelephony::EGetCurrentNetworkNameCancel: |
|
704 if((iGetCurrentNetworkName==NULL)|| |
|
705 (IsRequestPending(EGetCurrentNetworkName)==EFalse)) |
|
706 return KErrTelephonyOutOfSequence; |
|
707 else |
|
708 { |
|
709 delete iGetCurrentNetworkName; |
|
710 iGetCurrentNetworkName=NULL; |
|
711 } |
|
712 break; |
|
713 case CTelephony::EGetOperatorNameCancel: |
|
714 if((iGetOperatorName==NULL)|| |
|
715 (IsRequestPending(EGetOperatorName)==EFalse)) |
|
716 return KErrTelephonyOutOfSequence; |
|
717 else |
|
718 { |
|
719 delete iGetOperatorName; |
|
720 iGetOperatorName=NULL; |
|
721 } |
|
722 break; |
|
723 case CTelephony::EGetCallForwardingStatusCancel: |
|
724 if((iGetCFSupplementaryServiceStatus==NULL)|| |
|
725 (IsRequestPending(EGetCFSupplServicesStatus)==EFalse)) |
|
726 return KErrTelephonyOutOfSequence; |
|
727 else |
|
728 { |
|
729 delete iGetCFSupplementaryServiceStatus; |
|
730 iGetCFSupplementaryServiceStatus=NULL; |
|
731 } |
|
732 break; |
|
733 case CTelephony::EGetCallBarringStatusCancel: |
|
734 if((iGetCBSupplementaryServiceStatus==NULL)|| |
|
735 (IsRequestPending(EGetCBSupplServicesStatus)==EFalse)) |
|
736 return KErrTelephonyOutOfSequence; |
|
737 else |
|
738 { |
|
739 delete iGetCBSupplementaryServiceStatus; |
|
740 iGetCBSupplementaryServiceStatus=NULL; |
|
741 } |
|
742 break; |
|
743 case CTelephony::EGetCallWaitingStatusCancel: |
|
744 if((iGetCWSupplementaryServiceStatus==NULL)|| |
|
745 (IsRequestPending(EGetCWSupplServicesStatus)==EFalse)) |
|
746 return KErrTelephonyOutOfSequence; |
|
747 else |
|
748 { |
|
749 delete iGetCWSupplementaryServiceStatus; |
|
750 iGetCWSupplementaryServiceStatus=NULL; |
|
751 } |
|
752 break; |
|
753 case CTelephony::EGetIdentityServiceStatusCancel: |
|
754 if((iGetIdentityServiceStatus==NULL)|| |
|
755 (IsRequestPending(EGetIdentityServiceStatus)==EFalse)) |
|
756 return KErrTelephonyOutOfSequence; |
|
757 else |
|
758 { |
|
759 delete iGetIdentityServiceStatus; |
|
760 iGetIdentityServiceStatus=NULL; |
|
761 } |
|
762 break; |
|
763 case CTelephony::EFlightModeChangeCancel: |
|
764 if((iFlightModeChange==NULL)|| |
|
765 (IsRequestPending(EFlightModeChange)==EFalse)) |
|
766 return KErrTelephonyOutOfSequence; |
|
767 else |
|
768 { |
|
769 delete iFlightModeChange; |
|
770 iFlightModeChange=NULL; |
|
771 } |
|
772 break; |
|
773 case CTelephony::EIndicatorChangeCancel: |
|
774 if((iNotifyIndicator==NULL)|| |
|
775 (IsRequestPending(ENotifyIndicator)==EFalse)) |
|
776 return KErrTelephonyOutOfSequence; |
|
777 else |
|
778 { |
|
779 delete iNotifyIndicator; |
|
780 iNotifyIndicator=NULL; |
|
781 } |
|
782 break; |
|
783 case CTelephony::EBatteryInfoChangeCancel: |
|
784 if((iNotifyBatteryInfo==NULL)|| |
|
785 (IsRequestPending(ENotifyBatteryInfo)==EFalse)) |
|
786 return KErrTelephonyOutOfSequence; |
|
787 else |
|
788 { |
|
789 delete iNotifyBatteryInfo; |
|
790 iNotifyBatteryInfo=NULL; |
|
791 } |
|
792 break; |
|
793 case CTelephony::ESignalStrengthChangeCancel: |
|
794 if((iNotifySignalStrength==NULL)|| |
|
795 (IsRequestPending(ENotifySignalStrength)==EFalse)) |
|
796 return KErrTelephonyOutOfSequence; |
|
797 else |
|
798 { |
|
799 delete iNotifySignalStrength; |
|
800 iNotifySignalStrength=NULL; |
|
801 } |
|
802 break; |
|
803 case CTelephony::EPin1LockInfoChangeCancel: |
|
804 if((iNotifyIccLockInfo==NULL)|| |
|
805 (IsRequestPending(ENotifyPin1LockInfo)==EFalse)) |
|
806 { |
|
807 return KErrTelephonyOutOfSequence; |
|
808 } |
|
809 else if (IsRequestPending(ENotifyPin2LockInfo)) |
|
810 { |
|
811 CompleteRequest(ENotifyPin1LockInfo,KErrCancel); |
|
812 } |
|
813 else |
|
814 { |
|
815 delete iNotifyIccLockInfo; |
|
816 iNotifyIccLockInfo=NULL; |
|
817 } |
|
818 |
|
819 break; |
|
820 case CTelephony::EPin2LockInfoChangeCancel: |
|
821 if((iNotifyIccLockInfo==NULL)|| |
|
822 (IsRequestPending(ENotifyPin2LockInfo)==EFalse)) |
|
823 { |
|
824 return KErrTelephonyOutOfSequence; |
|
825 } |
|
826 else if (IsRequestPending(ENotifyPin1LockInfo)) |
|
827 { |
|
828 CompleteRequest(ENotifyPin2LockInfo,KErrCancel); |
|
829 } |
|
830 else |
|
831 { |
|
832 delete iNotifyIccLockInfo; |
|
833 iNotifyIccLockInfo=NULL; |
|
834 } |
|
835 break; |
|
836 case CTelephony::ENetworkRegistrationStatusChangeCancel: |
|
837 if((iNotifyNetworkRegStatus==NULL)|| |
|
838 (IsRequestPending(ENotifyNetworkRegistrationStatus)==EFalse)) |
|
839 return KErrTelephonyOutOfSequence; |
|
840 else |
|
841 { |
|
842 delete iNotifyNetworkRegStatus; |
|
843 iNotifyNetworkRegStatus=NULL; |
|
844 } |
|
845 break; |
|
846 case CTelephony::ECurrentNetworkInfoChangeCancel: |
|
847 if((iNotifyCurrentNetworkInfo==NULL)|| |
|
848 (IsRequestPending(ENotifyCurrentNetworkInfo)==EFalse)) |
|
849 return KErrTelephonyOutOfSequence; |
|
850 else |
|
851 { |
|
852 delete iNotifyCurrentNetworkInfo; |
|
853 iNotifyCurrentNetworkInfo=NULL; |
|
854 } |
|
855 break; |
|
856 case CTelephony::EOwnedCall1StatusChangeCancel: |
|
857 if((iNotifyOwnedCall1Status==NULL)|| |
|
858 (IsRequestPending(ENotifyOwnedCall1Status)==EFalse)) |
|
859 return KErrTelephonyOutOfSequence; |
|
860 else |
|
861 { |
|
862 delete iNotifyOwnedCall1Status; |
|
863 iNotifyOwnedCall1Status=NULL; |
|
864 } |
|
865 break; |
|
866 case CTelephony::EOwnedCall2StatusChangeCancel: |
|
867 if((iNotifyOwnedCall2Status==NULL)|| |
|
868 (IsRequestPending(ENotifyOwnedCall2Status)==EFalse)) |
|
869 return KErrTelephonyOutOfSequence; |
|
870 else |
|
871 { |
|
872 delete iNotifyOwnedCall2Status; |
|
873 iNotifyOwnedCall2Status=NULL; |
|
874 } |
|
875 break; |
|
876 case CTelephony::EVoiceLineStatusChangeCancel: |
|
877 if (IsRequestPending(ENotifyVoiceLineStatus)==EFalse) |
|
878 { |
|
879 return KErrTelephonyOutOfSequence; |
|
880 } |
|
881 else |
|
882 { |
|
883 // Notifies the iInternalNotifyVoiceLineStatus active |
|
884 // object that the client is no longer interested |
|
885 // in being notified of line status changes. |
|
886 // The AO will then complete the request back to the |
|
887 // client with a status of KErrCancel. |
|
888 // The AO will still continue to monitor for line |
|
889 // status changes but now the result will not be |
|
890 // returned to the client. |
|
891 if (iInternalNotifyVoiceLineStatus) |
|
892 iInternalNotifyVoiceLineStatus->CancelFromClient(); |
|
893 } |
|
894 break; |
|
895 case CTelephony::EFaxLineStatusChangeCancel: |
|
896 return KErrNotSupported; |
|
897 case CTelephony::EDataLineStatusChangeCancel: |
|
898 return KErrNotSupported; |
|
899 case CTelephony::EOwnedCall1RemotePartyInfoChangeCancel: |
|
900 if((iNotifyOwnedCall1RemoteInfo==NULL)|| |
|
901 (IsRequestPending(ENotifyOwnedCall1RemoteInfo)==EFalse)) |
|
902 return KErrTelephonyOutOfSequence; |
|
903 else |
|
904 { |
|
905 delete iNotifyOwnedCall1RemoteInfo; |
|
906 iNotifyOwnedCall1RemoteInfo=NULL; |
|
907 } |
|
908 break; |
|
909 case CTelephony::EOwnedCall2RemotePartyInfoChangeCancel: |
|
910 if((iNotifyOwnedCall2RemoteInfo==NULL)|| |
|
911 (IsRequestPending(ENotifyOwnedCall2RemoteInfo)==EFalse)) |
|
912 return KErrTelephonyOutOfSequence; |
|
913 else |
|
914 { |
|
915 delete iNotifyOwnedCall2RemoteInfo; |
|
916 iNotifyOwnedCall2RemoteInfo=NULL; |
|
917 } |
|
918 break; |
|
919 default: |
|
920 return KErrNotSupported; |
|
921 } |
|
922 |
|
923 return KErrNone; |
|
924 } |
|
925 |
|
926 /** |
|
927 Send a notification request. |
|
928 |
|
929 @param aRequestStatus The request status to be returned when an event |
|
930 occurs for client notification. |
|
931 @param aEvent The notification event the caller is requesting. |
|
932 @param aDes Packaged data returned by the TSY when an event for notification occurs. |
|
933 */ |
|
934 TInt CTelephonyFunctions::NotifyChangeL(TRequestStatus& aRequestStatus, |
|
935 const CTelephony::TNotificationEvent& aEvent, TDes8& aDes) |
|
936 { |
|
937 TInt err; |
|
938 switch(aEvent) |
|
939 { |
|
940 case CTelephony::EFlightModeChange: |
|
941 err = NotifyFlightModeL(aRequestStatus, aDes); |
|
942 break; |
|
943 |
|
944 case CTelephony::EOwnedCall1RemotePartyInfoChange: |
|
945 err = NotifyOwnedCall1RemotePartyInfoL(aRequestStatus, aDes); |
|
946 break; |
|
947 |
|
948 case CTelephony::EOwnedCall2RemotePartyInfoChange: |
|
949 err = NotifyOwnedCall2RemotePartyInfoL(aRequestStatus, aDes); |
|
950 break; |
|
951 |
|
952 case CTelephony::EVoiceLineStatusChange: |
|
953 err = NotifyVoiceLineStatusL(aRequestStatus, aDes); |
|
954 break; |
|
955 |
|
956 case CTelephony::EFaxLineStatusChange: |
|
957 err = KErrNotSupported; |
|
958 break; |
|
959 |
|
960 case CTelephony::EDataLineStatusChange: |
|
961 err = KErrNotSupported; |
|
962 break; |
|
963 |
|
964 case CTelephony::EOwnedCall1StatusChange: |
|
965 err = NotifyOwnedCall1StatusL(aRequestStatus, aDes); |
|
966 break; |
|
967 |
|
968 case CTelephony::EOwnedCall2StatusChange: |
|
969 err = NotifyOwnedCall2StatusL(aRequestStatus, aDes); |
|
970 break; |
|
971 |
|
972 case CTelephony::EIndicatorChange: |
|
973 err = NotifyIndicatorL(aRequestStatus, aDes); |
|
974 break; |
|
975 |
|
976 case CTelephony::EPin1LockInfoChange: |
|
977 case CTelephony::EPin2LockInfoChange: |
|
978 err = NotifyPinLockInfoL(aRequestStatus, aEvent, aDes); |
|
979 break; |
|
980 |
|
981 case CTelephony::EBatteryInfoChange: |
|
982 err = NotifyBatteryInfoL(aRequestStatus, aDes); |
|
983 break; |
|
984 |
|
985 case CTelephony::ESignalStrengthChange: |
|
986 err = NotifySignalStrengthL(aRequestStatus, aDes); |
|
987 break; |
|
988 |
|
989 case CTelephony::ENetworkRegistrationStatusChange: |
|
990 err = NotifyNetworkRegistrationStatusL(aRequestStatus, aDes); |
|
991 break; |
|
992 |
|
993 case CTelephony::ECurrentNetworkInfoChange: |
|
994 err = NotifyCurrentNetworkInfoL(aRequestStatus, aDes); |
|
995 break; |
|
996 default: |
|
997 err = KErrArgument; |
|
998 } |
|
999 return err; |
|
1000 } |
|
1001 |
|
1002 TInt CTelephonyFunctions::NotifyFlightModeL(TRequestStatus& aRequestStatus, TDes8& aDes) |
|
1003 /** |
|
1004 Post a Flight mode notification request |
|
1005 */ |
|
1006 { |
|
1007 if (IsRequestPending(EFlightModeChange)!=EFalse) |
|
1008 { |
|
1009 return KErrInUse; |
|
1010 } |
|
1011 else |
|
1012 { |
|
1013 SetRequestPending(CTelephonyFunctions::EFlightModeChange, ETrue); |
|
1014 } |
|
1015 |
|
1016 if(iFlightModeChange==NULL) |
|
1017 { |
|
1018 iFlightModeChange=CFlightModeChangeAct::NewL(this); |
|
1019 } |
|
1020 iReqStatusTable[EFlightModeChange] = &aRequestStatus; |
|
1021 |
|
1022 iFlightModeChange->FlightModeChangeL(aDes); |
|
1023 return KErrNone; |
|
1024 } |
|
1025 |
|
1026 TInt CTelephonyFunctions::NotifyOwnedCall1RemotePartyInfoL(TRequestStatus& aRequestStatus, TDes8& aDes) |
|
1027 /** |
|
1028 Post a remote party info call 1 notification request |
|
1029 */ |
|
1030 { |
|
1031 if (IsRequestPending(ENotifyOwnedCall1RemoteInfo)!=EFalse) |
|
1032 { |
|
1033 return KErrInUse; |
|
1034 } |
|
1035 else |
|
1036 { |
|
1037 SetRequestPending(CTelephonyFunctions::ENotifyOwnedCall1RemoteInfo, ETrue); |
|
1038 } |
|
1039 |
|
1040 if(iCallPoolStatus[CTelephony::EISVCall1]==EUnset) |
|
1041 { |
|
1042 return KErrAccessDenied; |
|
1043 } |
|
1044 |
|
1045 if(iNotifyOwnedCall1RemoteInfo==NULL) |
|
1046 { |
|
1047 iNotifyOwnedCall1RemoteInfo=CNotifyRemotePartyInfoAct::NewL(this, CTelephonyFunctions::ENotifyOwnedCall1RemoteInfo); |
|
1048 } |
|
1049 |
|
1050 iReqStatusTable[ENotifyOwnedCall1RemoteInfo] = &aRequestStatus; |
|
1051 |
|
1052 iNotifyOwnedCall1RemoteInfo->NotifyRemotePartyInfo(aDes, CTelephony::EISVCall1); |
|
1053 return KErrNone; |
|
1054 } |
|
1055 |
|
1056 TInt CTelephonyFunctions::NotifyOwnedCall2RemotePartyInfoL(TRequestStatus& aRequestStatus, TDes8& aDes) |
|
1057 /** |
|
1058 Post aremote party info call 2 notification request |
|
1059 */ |
|
1060 { |
|
1061 if (IsRequestPending(ENotifyOwnedCall2RemoteInfo)!=EFalse) |
|
1062 { |
|
1063 return KErrInUse; |
|
1064 } |
|
1065 else |
|
1066 { |
|
1067 SetRequestPending(CTelephonyFunctions::ENotifyOwnedCall2RemoteInfo, ETrue); |
|
1068 } |
|
1069 |
|
1070 if(iCallPoolStatus[CTelephony::EISVCall2]==EUnset) |
|
1071 { |
|
1072 return KErrAccessDenied; |
|
1073 } |
|
1074 |
|
1075 if(iNotifyOwnedCall2RemoteInfo==NULL) |
|
1076 { |
|
1077 iNotifyOwnedCall2RemoteInfo=CNotifyRemotePartyInfoAct::NewL(this, CTelephonyFunctions::ENotifyOwnedCall2RemoteInfo); |
|
1078 } |
|
1079 |
|
1080 iReqStatusTable[ENotifyOwnedCall2RemoteInfo] = &aRequestStatus; |
|
1081 |
|
1082 iNotifyOwnedCall2RemoteInfo->NotifyRemotePartyInfo(aDes, CTelephony::EISVCall2); |
|
1083 return KErrNone; |
|
1084 } |
|
1085 |
|
1086 /** |
|
1087 Post a voice line status notification request. |
|
1088 |
|
1089 @param aRequestStatus The request status. |
|
1090 @param aDes Package containing TCallStatus which will store the resulting line status. |
|
1091 */ |
|
1092 TInt CTelephonyFunctions::NotifyVoiceLineStatusL(TRequestStatus& aRequestStatus, TDes8& aDes) |
|
1093 { |
|
1094 if (IsRequestPending(ENotifyVoiceLineStatus)!=EFalse) |
|
1095 { |
|
1096 return KErrInUse; |
|
1097 } |
|
1098 else |
|
1099 { |
|
1100 SetRequestPending(CTelephonyFunctions::ENotifyVoiceLineStatus, ETrue); |
|
1101 } |
|
1102 iReqStatusTable[ENotifyVoiceLineStatus] = &aRequestStatus; |
|
1103 |
|
1104 iInternalNotifyVoiceLineStatus->NotifyLineStatus(&aDes); |
|
1105 |
|
1106 return KErrNone; |
|
1107 } |
|
1108 |
|
1109 TInt CTelephonyFunctions::NotifyOwnedCall1StatusL(TRequestStatus& aRequestStatus, TDes8& aDes) |
|
1110 /** |
|
1111 Post a call 1 status change notification request |
|
1112 */ |
|
1113 { |
|
1114 if (IsRequestPending(ENotifyOwnedCall1Status)!=EFalse) |
|
1115 { |
|
1116 return KErrInUse; |
|
1117 } |
|
1118 else |
|
1119 { |
|
1120 SetRequestPending(CTelephonyFunctions::ENotifyOwnedCall1Status, ETrue); |
|
1121 } |
|
1122 if(iCallPoolStatus[CTelephony::EISVCall1]==EUnset) |
|
1123 { |
|
1124 return KErrAccessDenied; |
|
1125 } |
|
1126 |
|
1127 if(iNotifyOwnedCall1Status==NULL) |
|
1128 { |
|
1129 iNotifyOwnedCall1Status=CNotifyCallStatusAct::NewL(this, CTelephonyFunctions::ENotifyOwnedCall1Status); |
|
1130 } |
|
1131 |
|
1132 iReqStatusTable[ENotifyOwnedCall1Status] = &aRequestStatus; |
|
1133 |
|
1134 iNotifyOwnedCall1Status->NotifyCallStatus(aDes, CTelephony::EISVCall1); |
|
1135 return KErrNone; |
|
1136 } |
|
1137 |
|
1138 TInt CTelephonyFunctions::NotifyOwnedCall2StatusL(TRequestStatus& aRequestStatus, TDes8& aDes) |
|
1139 /** |
|
1140 Post a call 2 status change notification request |
|
1141 */ |
|
1142 { |
|
1143 if (IsRequestPending(ENotifyOwnedCall2Status)!=EFalse) |
|
1144 { |
|
1145 return KErrInUse; |
|
1146 } |
|
1147 else |
|
1148 { |
|
1149 SetRequestPending(CTelephonyFunctions::ENotifyOwnedCall2Status, ETrue); |
|
1150 } |
|
1151 if(iCallPoolStatus[CTelephony::EISVCall2]==EUnset) |
|
1152 { |
|
1153 return KErrAccessDenied; |
|
1154 } |
|
1155 |
|
1156 if(iNotifyOwnedCall2Status==NULL) |
|
1157 { |
|
1158 iNotifyOwnedCall2Status=CNotifyCallStatusAct::NewL(this, CTelephonyFunctions::ENotifyOwnedCall2Status); |
|
1159 } |
|
1160 |
|
1161 iReqStatusTable[ENotifyOwnedCall2Status] = &aRequestStatus; |
|
1162 |
|
1163 iNotifyOwnedCall2Status->NotifyCallStatus(aDes, CTelephony::EISVCall2); |
|
1164 return KErrNone; |
|
1165 } |
|
1166 |
|
1167 TInt CTelephonyFunctions::NotifyIndicatorL(TRequestStatus& aRequestStatus, TDes8& aDes) |
|
1168 /** |
|
1169 Post a indicator notification request |
|
1170 */ |
|
1171 { |
|
1172 if (IsRequestPending(ENotifyIndicator)!=EFalse) |
|
1173 { |
|
1174 return KErrInUse; |
|
1175 } |
|
1176 else |
|
1177 { |
|
1178 SetRequestPending(CTelephonyFunctions::ENotifyIndicator, ETrue); |
|
1179 } |
|
1180 |
|
1181 if(iNotifyIndicator==NULL) |
|
1182 { |
|
1183 iNotifyIndicator=CNotifyIndicatorAct::NewL(this); |
|
1184 } |
|
1185 |
|
1186 iReqStatusTable[ENotifyIndicator] = &aRequestStatus; |
|
1187 |
|
1188 iNotifyIndicator->NotifyIndicator(aDes); |
|
1189 return KErrNone; |
|
1190 } |
|
1191 |
|
1192 TInt CTelephonyFunctions::NotifyPinLockInfoL(TRequestStatus& aRequestStatus, const CTelephony::TNotificationEvent& aEvent, TDes8& aDes) |
|
1193 /** |
|
1194 Post a pin lock change notification request |
|
1195 */ |
|
1196 { |
|
1197 CTelephony::TIccLock lock; |
|
1198 if(aEvent == CTelephony::EPin1LockInfoChange) |
|
1199 { |
|
1200 lock = CTelephony::ELockPin1; |
|
1201 if (IsRequestPending(ENotifyPin1LockInfo)) |
|
1202 { |
|
1203 return KErrInUse; |
|
1204 } |
|
1205 } |
|
1206 else if(aEvent == CTelephony::EPin2LockInfoChange) |
|
1207 { |
|
1208 lock = CTelephony::ELockPin2; |
|
1209 if (IsRequestPending(ENotifyPin2LockInfo)) |
|
1210 { |
|
1211 return KErrInUse; |
|
1212 } |
|
1213 } |
|
1214 else |
|
1215 { |
|
1216 return KErrNotSupported; |
|
1217 } |
|
1218 |
|
1219 if(iNotifyIccLockInfo==NULL) |
|
1220 { |
|
1221 iNotifyIccLockInfo=CNotifyIccLockInfoAct::NewL(this); |
|
1222 } |
|
1223 |
|
1224 if (lock == CTelephony::ELockPin1) |
|
1225 { |
|
1226 SetRequestPending(CTelephonyFunctions::ENotifyPin1LockInfo, ETrue); |
|
1227 iReqStatusTable[ENotifyPin1LockInfo] = &aRequestStatus; |
|
1228 } |
|
1229 else if (lock == CTelephony::ELockPin2) |
|
1230 { |
|
1231 SetRequestPending(CTelephonyFunctions::ENotifyPin2LockInfo, ETrue); |
|
1232 iReqStatusTable[ENotifyPin2LockInfo] = &aRequestStatus; |
|
1233 } |
|
1234 |
|
1235 iNotifyIccLockInfo->NotifyIccLockInfo(lock, aDes); |
|
1236 return KErrNone; |
|
1237 } |
|
1238 |
|
1239 TInt CTelephonyFunctions::NotifyBatteryInfoL(TRequestStatus& aRequestStatus, TDes8& aDes) |
|
1240 /** |
|
1241 Post a battery info change notification request |
|
1242 */ |
|
1243 { |
|
1244 if (IsRequestPending(ENotifyBatteryInfo)!=EFalse) |
|
1245 { |
|
1246 return KErrInUse; |
|
1247 } |
|
1248 else |
|
1249 { |
|
1250 SetRequestPending(CTelephonyFunctions::ENotifyBatteryInfo, ETrue); |
|
1251 } |
|
1252 |
|
1253 if(iNotifyBatteryInfo==NULL) |
|
1254 { |
|
1255 iNotifyBatteryInfo=CNotifyBatteryInfoAct::NewL(this); |
|
1256 } |
|
1257 iReqStatusTable[ENotifyBatteryInfo] = &aRequestStatus; |
|
1258 |
|
1259 iNotifyBatteryInfo->NotifyBatteryInfo(aDes); |
|
1260 return KErrNone; |
|
1261 } |
|
1262 |
|
1263 TInt CTelephonyFunctions::NotifySignalStrengthL(TRequestStatus& aRequestStatus, TDes8& aDes) |
|
1264 /** |
|
1265 Post a signal strength change notification request |
|
1266 */ |
|
1267 { |
|
1268 if (IsRequestPending(ENotifySignalStrength)!=EFalse) |
|
1269 { |
|
1270 return KErrInUse; |
|
1271 } |
|
1272 else |
|
1273 { |
|
1274 SetRequestPending(CTelephonyFunctions::ENotifySignalStrength, ETrue); |
|
1275 } |
|
1276 |
|
1277 if(iNotifySignalStrength==NULL) |
|
1278 { |
|
1279 iNotifySignalStrength=CNotifySignalStrengthAct::NewL(this); |
|
1280 } |
|
1281 |
|
1282 iReqStatusTable[ENotifySignalStrength] = &aRequestStatus; |
|
1283 |
|
1284 iNotifySignalStrength->NotifySignalStrength(aDes); |
|
1285 return KErrNone; |
|
1286 } |
|
1287 |
|
1288 TInt CTelephonyFunctions::NotifyNetworkRegistrationStatusL(TRequestStatus& aRequestStatus, TDes8& aDes) |
|
1289 /** |
|
1290 Post a network registration change notification request |
|
1291 */ |
|
1292 { |
|
1293 if (IsRequestPending(ENotifyNetworkRegistrationStatus)!=EFalse) |
|
1294 { |
|
1295 return KErrInUse; |
|
1296 } |
|
1297 else |
|
1298 { |
|
1299 SetRequestPending(CTelephonyFunctions::ENotifyNetworkRegistrationStatus, ETrue); |
|
1300 } |
|
1301 |
|
1302 if(iNotifyNetworkRegStatus==NULL) |
|
1303 { |
|
1304 iNotifyNetworkRegStatus=CNotifyNetworkRegistrationStatusAct::NewL(this); |
|
1305 } |
|
1306 iReqStatusTable[ENotifyNetworkRegistrationStatus] = &aRequestStatus; |
|
1307 |
|
1308 iNotifyNetworkRegStatus->NotifyNetworkRegistrationStatus(aDes); |
|
1309 return KErrNone; |
|
1310 } |
|
1311 |
|
1312 TInt CTelephonyFunctions::NotifyCurrentNetworkInfoL(TRequestStatus& aRequestStatus, TDes8& aDes) |
|
1313 /** |
|
1314 Post a current network info change notification request |
|
1315 */ |
|
1316 { |
|
1317 if (IsRequestPending(ENotifyCurrentNetworkInfo)!=EFalse) |
|
1318 { |
|
1319 return KErrInUse; |
|
1320 } |
|
1321 else |
|
1322 { |
|
1323 SetRequestPending(CTelephonyFunctions::ENotifyCurrentNetworkInfo, ETrue); |
|
1324 } |
|
1325 |
|
1326 if(iNotifyCurrentNetworkInfo==NULL) |
|
1327 { |
|
1328 iNotifyCurrentNetworkInfo=CNotifyCurrentNetworkInfoAct::NewL(this); |
|
1329 } |
|
1330 iReqStatusTable[CTelephonyFunctions::ENotifyCurrentNetworkInfo] = &aRequestStatus; |
|
1331 |
|
1332 iNotifyCurrentNetworkInfo->NotifyCurrentNetworkInfo(aDes); |
|
1333 return KErrNone; |
|
1334 } |
|
1335 |
|
1336 TInt CTelephonyFunctions::GetISVCall(CTelephony::TCallId& aCallId) |
|
1337 /** |
|
1338 Return an available call ID. |
|
1339 Also, continue looping though other call objects for opportunity to close them if they have become idle. |
|
1340 */ |
|
1341 { |
|
1342 RMobileCall::TMobileCallStatus callStatus; |
|
1343 //get first free call object |
|
1344 TInt err; |
|
1345 TInt ret = KErrNotFound; |
|
1346 TInt foundACallId = EFalse; |
|
1347 for(int k=0;k<CTelephony::EISVMaxNumOfCalls;k++) |
|
1348 { |
|
1349 if(iCallPoolStatus[k]!=EUnset) |
|
1350 { |
|
1351 err = Call((CTelephony::TCallId)k)->GetMobileCallStatus(callStatus); |
|
1352 if(err==KErrNone && callStatus==RMobileCall::EStatusIdle) |
|
1353 { |
|
1354 if(!foundACallId) |
|
1355 { |
|
1356 aCallId=(CTelephony::TCallId)k; |
|
1357 foundACallId = ETrue; |
|
1358 ret = KErrNone; |
|
1359 } |
|
1360 else |
|
1361 { |
|
1362 CloseAndReset((CTelephony::TCallId)k); |
|
1363 } |
|
1364 } |
|
1365 } |
|
1366 else |
|
1367 { |
|
1368 if(!foundACallId) |
|
1369 { |
|
1370 aCallId=(CTelephony::TCallId)k; |
|
1371 foundACallId = ETrue; |
|
1372 ret = KErrNone; |
|
1373 } |
|
1374 } |
|
1375 } |
|
1376 return ret; |
|
1377 } |
|
1378 |
|
1379 TBool CTelephonyFunctions::IsFlightModeOn() |
|
1380 /** |
|
1381 Get Flight mode from SA |
|
1382 */ |
|
1383 { |
|
1384 TInt newPhonePowerState; |
|
1385 if (iPhonePowerProperty.Get(newPhonePowerState) != KErrNone) |
|
1386 newPhonePowerState = ESAPhoneOff; |
|
1387 if(newPhonePowerState==ESAPhoneOn) |
|
1388 { |
|
1389 return EFalse; |
|
1390 } |
|
1391 else |
|
1392 { |
|
1393 return ETrue; |
|
1394 } |
|
1395 } |
|
1396 |
|
1397 void CTelephonyFunctions::CloseAndReset(const CTelephony::TCallId aCallId) |
|
1398 /** |
|
1399 Closes the open call object and resets its pool status back to Unset |
|
1400 */ |
|
1401 { |
|
1402 //must close all outstanding notifiers invoked from this call session prior to closing the session. |
|
1403 if( aCallId == CTelephony::EISVCall1) |
|
1404 { |
|
1405 if(IsRequestPending(ENotifyOwnedCall1RemoteInfo)) |
|
1406 { |
|
1407 CancelAsync(CTelephony::EOwnedCall1RemotePartyInfoChangeCancel); |
|
1408 } |
|
1409 |
|
1410 if(IsRequestPending(ENotifyOwnedCall1Status)) |
|
1411 { |
|
1412 CancelAsync(CTelephony::EOwnedCall1StatusChangeCancel); |
|
1413 } |
|
1414 } |
|
1415 else if(aCallId == CTelephony::EISVCall2) |
|
1416 { |
|
1417 if(IsRequestPending(ENotifyOwnedCall2RemoteInfo)) |
|
1418 { |
|
1419 CancelAsync(CTelephony::EOwnedCall2RemotePartyInfoChangeCancel); |
|
1420 } |
|
1421 |
|
1422 if(IsRequestPending(ENotifyOwnedCall2Status)) |
|
1423 { |
|
1424 CancelAsync(CTelephony::EOwnedCall2StatusChangeCancel); |
|
1425 } |
|
1426 } |
|
1427 |
|
1428 //close the call session |
|
1429 Call(aCallId)->Close(); |
|
1430 iCallPoolStatus[aCallId] = EUnset; |
|
1431 } |
|
1432 |
|
1433 void CTelephonyFunctions::ResetPendingNotifyRequest(CTelephony::TNotificationEvent aEvent) |
|
1434 /** |
|
1435 Reset the pending notify request flag |
|
1436 */ |
|
1437 { |
|
1438 switch(aEvent) |
|
1439 { |
|
1440 case CTelephony::EFlightModeChange: |
|
1441 SetRequestPending(CTelephonyFunctions::EFlightModeChange, EFalse); |
|
1442 break; |
|
1443 case CTelephony::EOwnedCall1RemotePartyInfoChange: |
|
1444 SetRequestPending(CTelephonyFunctions::ENotifyOwnedCall1RemoteInfo, EFalse); |
|
1445 break; |
|
1446 case CTelephony::EOwnedCall2RemotePartyInfoChange: |
|
1447 SetRequestPending(CTelephonyFunctions::ENotifyOwnedCall2RemoteInfo, EFalse); |
|
1448 break; |
|
1449 case CTelephony::EVoiceLineStatusChange: |
|
1450 SetRequestPending(CTelephonyFunctions::ENotifyVoiceLineStatus, EFalse); |
|
1451 break; |
|
1452 case CTelephony::EOwnedCall1StatusChange: |
|
1453 SetRequestPending(CTelephonyFunctions::ENotifyOwnedCall1Status, EFalse); |
|
1454 break; |
|
1455 case CTelephony::EOwnedCall2StatusChange: |
|
1456 SetRequestPending(CTelephonyFunctions::ENotifyOwnedCall2Status, EFalse); |
|
1457 break; |
|
1458 case CTelephony::EIndicatorChange: |
|
1459 SetRequestPending(CTelephonyFunctions::ENotifyIndicator, EFalse); |
|
1460 break; |
|
1461 case CTelephony::EPin1LockInfoChange: |
|
1462 SetRequestPending(CTelephonyFunctions::ENotifyPin1LockInfo, EFalse); |
|
1463 break; |
|
1464 case CTelephony::EPin2LockInfoChange: |
|
1465 SetRequestPending(CTelephonyFunctions::ENotifyPin2LockInfo, EFalse); |
|
1466 break; |
|
1467 case CTelephony::EBatteryInfoChange: |
|
1468 SetRequestPending(CTelephonyFunctions::ENotifyBatteryInfo, EFalse); |
|
1469 break; |
|
1470 case CTelephony::ESignalStrengthChange: |
|
1471 SetRequestPending(CTelephonyFunctions::ENotifySignalStrength, EFalse); |
|
1472 break; |
|
1473 case CTelephony::ENetworkRegistrationStatusChange: |
|
1474 SetRequestPending(CTelephonyFunctions::ENotifyNetworkRegistrationStatus, EFalse); |
|
1475 break; |
|
1476 case CTelephony::ECurrentNetworkInfoChange: |
|
1477 SetRequestPending(CTelephonyFunctions::ENotifyCurrentNetworkInfo, EFalse); |
|
1478 break; |
|
1479 default: |
|
1480 break; |
|
1481 } |
|
1482 } |
|
1483 |
|
1484 /** |
|
1485 Completes the request back to the client that requested it. |
|
1486 |
|
1487 @param aOperation The operation that has been completed. |
|
1488 @param aCompleteCode The error code to be returned to the client. |
|
1489 */ |
|
1490 void CTelephonyFunctions::CompleteRequest(TOperations aOperation, TInt aCompleteCode) |
|
1491 { |
|
1492 if(IsRequestPending(aOperation)) |
|
1493 { |
|
1494 User::RequestComplete(*GetRequestStatus(aOperation), aCompleteCode); |
|
1495 SetRequestPending(aOperation, EFalse); |
|
1496 } |
|
1497 |
|
1498 } |
|
1499 |
|
1500 CAsyncRequestBaseAct::CAsyncRequestBaseAct() |
|
1501 : CActive(CActive::EPriorityStandard) |
|
1502 {} //NOP |
|
1503 |
|
1504 CAsyncRequestBaseAct::~CAsyncRequestBaseAct() |
|
1505 {} //NOP |
|
1506 |
|
1507 void CAsyncRequestBaseAct::RunL() |
|
1508 /** |
|
1509 Service Completed request. |
|
1510 |
|
1511 @leave Leaves if System error. |
|
1512 */ |
|
1513 { |
|
1514 Complete(); |
|
1515 } |