1 // Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
18 |
18 |
19 /** |
19 /** |
20 @file |
20 @file |
21 */ |
21 */ |
22 |
22 |
23 |
|
24 |
|
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "CSimCallForwardingTraces.h" |
|
28 #endif |
|
29 |
|
30 #include <testconfigfileparser.h> |
23 #include <testconfigfileparser.h> |
31 #include "CSimCallForwarding.h" |
24 #include "CSimCallForwarding.h" |
32 #include "CSimPhone.h" |
25 #include "CSimPhone.h" |
|
26 #include "Simlog.h" |
33 |
27 |
34 const TInt KSettingListGranularity=5; // < The granularity used for parameter list arrays. |
28 const TInt KSettingListGranularity=5; // < The granularity used for parameter list arrays. |
35 const TInt KInvalidTimeout = -1; // Value used when timeout period does not matter |
29 const TInt KInvalidTimeout = -1; // Value used when timeout period does not matter |
36 const TInt KMobServiceIndxStart = 1; |
30 const TInt KMobServiceIndxStart = 1; |
37 const TInt KMobServiceIndxEnd = 6; |
31 const TInt KMobServiceIndxEnd = 6; |
63 /** |
57 /** |
64 Second phase of 2-Phase Constructor |
58 Second phase of 2-Phase Constructor |
65 Retrieves all the Call forwarding and Identity services tags from the config file |
59 Retrieves all the Call forwarding and Identity services tags from the config file |
66 */ |
60 */ |
67 { |
61 { |
68 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_CONSTRUCTL_1, "Starting to parse Call Forwarding config parameters..."); |
62 LOGCALL1("Starting to parse Call Forwarding config parameters..."); |
69 |
63 |
70 iIdentityServiceStatus=new(ELeave) CArrayFixFlat<TIdentityServiceStatus>(KSettingListGranularity); |
64 iIdentityServiceStatus=new(ELeave) CArrayFixFlat<TIdentityServiceStatus>(KSettingListGranularity); |
71 |
65 |
72 iGetCFStatus = new(ELeave) CArrayPtrFlat<CListReadAllAttempt>(1); |
66 iGetCFStatus = new(ELeave) CArrayPtrFlat<CListReadAllAttempt>(1); |
73 FindAndCreateCFListL(); |
67 FindAndCreateCFListL(); |
84 |
78 |
85 TInt status, service; |
79 TInt status, service; |
86 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,service); |
80 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,service); |
87 if(ret!=KErrNone) |
81 if(ret!=KErrNone) |
88 { |
82 { |
89 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_CONSTRUCTL_2, "WARNING - CONFIGURATION FILE PARSING - Reading element SERVICE returned %d (element no. %d) from tag %s.",ret,0,KIdentityServiceStatus); |
83 LOGPARSERR("service",ret,0,&KIdentityServiceStatus); |
90 continue; |
84 continue; |
91 } |
85 } |
92 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,status); |
86 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,status); |
93 if(ret!=KErrNone) |
87 if(ret!=KErrNone) |
94 { |
88 { |
95 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_CONSTRUCTL_3, "WARNING - CONFIGURATION FILE PARSING - Reading element STATUS returned %d (element no. %d) from tag %s.",ret,1,KIdentityServiceStatus); |
89 LOGPARSERR("status",ret,1,&KIdentityServiceStatus); |
96 continue; |
90 continue; |
97 } |
91 } |
98 |
92 |
99 TIdentityServiceStatus identityServiceStatus; |
93 TIdentityServiceStatus identityServiceStatus; |
100 identityServiceStatus.iService = static_cast<RMobilePhone::TMobilePhoneIdService>(service); |
94 identityServiceStatus.iService = static_cast<RMobilePhone::TMobilePhoneIdService>(service); |
101 identityServiceStatus.iStatus = static_cast<RMobilePhone::TMobilePhoneIdServiceStatus>(status); |
95 identityServiceStatus.iStatus = static_cast<RMobilePhone::TMobilePhoneIdServiceStatus>(status); |
102 iIdentityServiceStatus->AppendL(identityServiceStatus); |
96 iIdentityServiceStatus->AppendL(identityServiceStatus); |
103 } |
97 } |
104 |
98 |
105 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_CONSTRUCTL_4, "...Finished parsing Call Forwarding config parameters..."); |
99 LOGCALL1("...Finished parsing Call Forwarding config parameters..."); |
106 } |
100 } |
107 |
101 |
108 CSimCallForwarding::~CSimCallForwarding() |
102 CSimCallForwarding::~CSimCallForwarding() |
109 /** |
103 /** |
110 Destroy all the objects constructed. |
104 Destroy all the objects constructed. |
209 TPtrC8 number; |
203 TPtrC8 number; |
210 TInt condition, serviceGroup, status, timeout; // valid for CFRNy only |
204 TInt condition, serviceGroup, status, timeout; // valid for CFRNy only |
211 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,condition); |
205 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,condition); |
212 if(ret!=KErrNone) |
206 if(ret!=KErrNone) |
213 { |
207 { |
214 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_FINDANDCREATECFLISTL_3, "WARNING - CONFIGURATION FILE PARSING - Reading element CONDITION returned %d (element no. %d) from tag %s.",ret,0,KCFList); |
208 LOGPARSERR("condition",ret,0,&KCFList); |
215 continue; |
209 continue; |
216 } |
210 } |
217 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,serviceGroup); |
211 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,serviceGroup); |
218 if(ret!=KErrNone) |
212 if(ret!=KErrNone) |
219 { |
213 { |
220 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_FINDANDCREATECFLISTL_4, "WARNING - CONFIGURATION FILE PARSING - Reading element SERVICEGROUP returned %d (element no. %d) from tag %s.",ret,1,KCFList); |
214 LOGPARSERR("serviceGroup",ret,1,&KCFList); |
221 continue; |
215 continue; |
222 } |
216 } |
223 |
217 |
224 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,status); |
218 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,status); |
225 if(ret!=KErrNone) |
219 if(ret!=KErrNone) |
226 { |
220 { |
227 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_FINDANDCREATECFLISTL_5, "WARNING - CONFIGURATION FILE PARSING - Reading element STATUS returned %d (element no. %d) from tag %s.",ret,2,KCFList); |
221 LOGPARSERR("status",ret,2,&KCFList); |
228 continue; |
222 continue; |
229 } |
223 } |
230 |
224 |
231 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,timeout); |
225 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,timeout); |
232 if(ret!=KErrNone) |
226 if(ret!=KErrNone) |
233 { |
227 { |
234 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_FINDANDCREATECFLISTL_6, "WARNING - CONFIGURATION FILE PARSING - Reading element TIMEOUT returned %d (element no. %d) from tag %s.",ret,3,KCFList); |
228 LOGPARSERR("timeout",ret,3,&KCFList); |
235 continue; |
229 continue; |
236 } |
230 } |
237 |
231 |
238 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,number); |
232 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,number); |
239 if(ret!=KErrNone) |
233 if(ret!=KErrNone) |
240 { |
234 { |
241 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_FINDANDCREATECFLISTL_7, "WARNING - CONFIGURATION FILE PARSING - Reading element NUMBER returned %d (element no. %d) from tag %s.",ret,4,KCFList); |
235 LOGPARSERR("number",ret,4,&KCFList); |
242 continue; |
236 continue; |
243 } |
237 } |
244 |
238 |
245 entry.iServiceGroup=(RMobilePhone::TMobileService)serviceGroup; |
239 entry.iServiceGroup=(RMobilePhone::TMobileService)serviceGroup; |
246 entry.iNumber.iTelNumber.Copy(number); |
240 entry.iNumber.iTelNumber.Copy(number); |
358 __ASSERT_ALWAYS(!iCFNotification.iCFChangeInfoNotificationPending,SimPanic(ENotificationReqAlreadyOutstanding)); |
352 __ASSERT_ALWAYS(!iCFNotification.iCFChangeInfoNotificationPending,SimPanic(ENotificationReqAlreadyOutstanding)); |
359 |
353 |
360 iCFNotification.iCFChangeInfoNotificationPending=ETrue; |
354 iCFNotification.iCFChangeInfoNotificationPending=ETrue; |
361 iCFNotification.iCFChangeInfoReqHandle=aReqHandle; |
355 iCFNotification.iCFChangeInfoReqHandle=aReqHandle; |
362 iCFNotification.iCurrentCFCondition=aCF; |
356 iCFNotification.iCurrentCFCondition=aCF; |
363 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_NOTIFYCALLFORWARDINGSTATUSCHANGE_1, "Finished CSimCallForwarding::NotifyCallForwardingStatusChange"); |
357 LOGCALL1("Finished CSimCallForwarding::NotifyCallForwardingStatusChange"); |
364 return KErrNone; |
358 return KErrNone; |
365 } |
359 } |
366 |
360 |
367 TInt CSimCallForwarding::NotifyCallForwardingStatusChangeCancel(const TTsyReqHandle aReqHandle) |
361 TInt CSimCallForwarding::NotifyCallForwardingStatusChangeCancel(const TTsyReqHandle aReqHandle) |
368 /** |
362 /** |
399 iCFNotification.iCFChangeInfoNotificationPending=EFalse; |
393 iCFNotification.iCFChangeInfoNotificationPending=EFalse; |
400 iPhone->ReqCompleted(iCFNotification.iCFChangeInfoReqHandle,KErrNone); |
394 iPhone->ReqCompleted(iCFNotification.iCFChangeInfoReqHandle,KErrNone); |
401 } |
395 } |
402 |
396 |
403 iPhone->ReqCompleted(aReqHandle,err); |
397 iPhone->ReqCompleted(aReqHandle,err); |
404 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_SETCALLFORWARDINGSTATUS_1, "Finished CSimCallForwarding::SetCallForwardingStatus"); |
398 LOGCALL1("Finished CSimCallForwarding::SetCallForwardingStatus"); |
405 return KErrNone; |
399 return KErrNone; |
406 } |
400 } |
407 |
401 |
408 TInt CSimCallForwarding::SetCallForwardingStatusCancel(const TTsyReqHandle aReqHandle) |
402 TInt CSimCallForwarding::SetCallForwardingStatusCancel(const TTsyReqHandle aReqHandle) |
409 /** |
403 /** |
424 1st phase retrieval of the status of call forwarding |
418 1st phase retrieval of the status of call forwarding |
425 @param aTsyReqHandle handle to the request |
419 @param aTsyReqHandle handle to the request |
426 @param aReqData contains details of the request |
420 @param aReqData contains details of the request |
427 @param aBufSize size of the buffer the client needs to allocate for phase 2 |
421 @param aBufSize size of the buffer the client needs to allocate for phase 2 |
428 */ |
422 */ |
429 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_GETCALLFORWARDINGSTATUSPHASE1_1, "CSimPhone::GetCallForwardingStatusPhase1"); |
423 LOGCALL1("CSimPhone::GetCallForwardingStatusPhase1"); |
430 TInt ret=KErrNone; |
424 TInt ret=KErrNone; |
431 |
425 |
432 // for forwarding we cannot querry for all conditions; |
426 // for forwarding we cannot querry for all conditions; |
433 // conditions - specific |
427 // conditions - specific |
434 // services - individual and all |
428 // services - individual and all |
443 TInt leaveCode=KErrNone; |
437 TInt leaveCode=KErrNone; |
444 TRAP(leaveCode, ret=ProcessGetCallForwardingStatusPhase1L(aTsyReqHandle, aReqData, aBufSize);); |
438 TRAP(leaveCode, ret=ProcessGetCallForwardingStatusPhase1L(aTsyReqHandle, aReqData, aBufSize);); |
445 if (leaveCode != KErrNone) |
439 if (leaveCode != KErrNone) |
446 iPhone->ReqCompleted(aTsyReqHandle,leaveCode); |
440 iPhone->ReqCompleted(aTsyReqHandle,leaveCode); |
447 } |
441 } |
448 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_GETCALLFORWARDINGSTATUSPHASE1_2, "CSimPhone::GetCallForwardingStatusPhase1"); |
442 LOGCALL1("CSimPhone::GetCallForwardingStatusPhase1"); |
449 return ret; |
443 return ret; |
450 } |
444 } |
451 |
445 |
452 TInt CSimCallForwarding::ProcessGetCallForwardingStatusPhase1L(const TTsyReqHandle aTsyReqHandle, |
446 TInt CSimCallForwarding::ProcessGetCallForwardingStatusPhase1L(const TTsyReqHandle aTsyReqHandle, |
453 CRetrieveMobilePhoneCFList::TGetCallForwardingRequest* aReqData, |
447 CRetrieveMobilePhoneCFList::TGetCallForwardingRequest* aReqData, |
459 @param aReqHandle Handle to the request |
453 @param aReqHandle Handle to the request |
460 @param aReqData information about the request |
454 @param aReqData information about the request |
461 @param aBufSize Size of the buffer the client has to allocate for the 2nd pahase |
455 @param aBufSize Size of the buffer the client has to allocate for the 2nd pahase |
462 */ |
456 */ |
463 |
457 |
464 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_PROCESSGETCALLFORWARDINGSTATUSPHASE1L_1, "CSimPhone::ProcessGetCallForwardingStatusPhase1L"); |
458 LOGCALL1("CSimPhone::ProcessGetCallForwardingStatusPhase1L"); |
465 |
459 |
466 CMobilePhoneCFList* list=CMobilePhoneCFList::NewL(); |
460 CMobilePhoneCFList* list=CMobilePhoneCFList::NewL(); |
467 CleanupStack::PushL(list); |
461 CleanupStack::PushL(list); |
468 |
462 |
469 TInt cnt=0;//Only interested by entries with a particular condition |
463 TInt cnt=0;//Only interested by entries with a particular condition |
507 |
501 |
508 CleanupStack::PopAndDestroy(list); // pop&destroy list |
502 CleanupStack::PopAndDestroy(list); // pop&destroy list |
509 |
503 |
510 // Complete first phase of list retrieval |
504 // Complete first phase of list retrieval |
511 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
505 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
512 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_PROCESSGETCALLFORWARDINGSTATUSPHASE1L_2, "CSimPhone::ProcessGetCallForwardingStatusPhase1L"); |
506 LOGCALL1("CSimPhone::ProcessGetCallForwardingStatusPhase1L"); |
513 return KErrNone; |
507 return KErrNone; |
514 } |
508 } |
515 |
509 |
516 TInt CSimCallForwarding::GetCallForwardingStatusPhase2(const TTsyReqHandle aTsyReqHandle, |
510 TInt CSimCallForwarding::GetCallForwardingStatusPhase2(const TTsyReqHandle aTsyReqHandle, |
517 RMobilePhone::TClientId* aClient, TDes8* aBuf) |
511 RMobilePhone::TClientId* aClient, TDes8* aBuf) |
520 @param aTsyRqHandle handle to the request |
514 @param aTsyRqHandle handle to the request |
521 @param aClient pointer to the client |
515 @param aClient pointer to the client |
522 @param aBuf buffer that contains the call forwarding list |
516 @param aBuf buffer that contains the call forwarding list |
523 */ |
517 */ |
524 { |
518 { |
525 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_GETCALLFORWARDINGSTATUSPHASE2_1, "CSimPhone::GetCallForwardingStatusPhase2"); |
519 LOGCALL1("CSimPhone::GetCallForwardingStatusPhase2"); |
526 CListReadAllAttempt* read=NULL; |
520 CListReadAllAttempt* read=NULL; |
527 // Find the get detected network attempt from this client |
521 // Find the get detected network attempt from this client |
528 for (TInt i=0; i<iGetCFStatus->Count(); ++i) |
522 for (TInt i=0; i<iGetCFStatus->Count(); ++i) |
529 { |
523 { |
530 read = iGetCFStatus->At(i); |
524 read = iGetCFStatus->At(i); |
539 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
533 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
540 return KErrNone; |
534 return KErrNone; |
541 } |
535 } |
542 } |
536 } |
543 // Should handle error case of not finding the matching client from read all phase 1 |
537 // Should handle error case of not finding the matching client from read all phase 1 |
544 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_GETCALLFORWARDINGSTATUSPHASE2_2, "CSimPhone::GetCallForwardingStatusPhase2"); |
538 LOGCALL1("CSimPhone::GetCallForwardingStatusPhase2"); |
545 return KErrNotFound; |
539 return KErrNotFound; |
546 } |
540 } |
547 |
541 |
548 |
542 |
549 TInt CSimCallForwarding::GetCallForwardingStatusCancel(const TTsyReqHandle aTsyReqHandle) |
543 TInt CSimCallForwarding::GetCallForwardingStatusCancel(const TTsyReqHandle aTsyReqHandle) |
550 { |
544 { |
551 /** |
545 /** |
552 Cancel the request to retrieve the status of call forwarding |
546 Cancel the request to retrieve the status of call forwarding |
553 @param aTsyReqHandle handle to the request |
547 @param aTsyReqHandle handle to the request |
554 */ |
548 */ |
555 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_GETCALLFORWARDINGSTATUSCANCEL_1, "CSimPhone::GetCallForwardingStatusCancel"); |
549 LOGCALL1("CSimPhone::GetCallForwardingStatusCancel"); |
556 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
550 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
557 // Remove the read all attempt from iGetCFStatus |
551 // Remove the read all attempt from iGetCFStatus |
558 CListReadAllAttempt* read=NULL; |
552 CListReadAllAttempt* read=NULL; |
559 for (TInt i=0; i<iGetCFStatus->Count(); ++i) |
553 for (TInt i=0; i<iGetCFStatus->Count(); ++i) |
560 { |
554 { |
565 iGetCFStatus->Delete(i); |
559 iGetCFStatus->Delete(i); |
566 break; |
560 break; |
567 } |
561 } |
568 } |
562 } |
569 iPhone->ReqCompleted(aTsyReqHandle,KErrCancel); |
563 iPhone->ReqCompleted(aTsyReqHandle,KErrCancel); |
570 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLFORWARDING_GETCALLFORWARDINGSTATUSCANCEL_2, "CSimPhone::GetCallForwardingStatusCancel"); |
564 LOGCALL1("CSimPhone::GetCallForwardingStatusCancel"); |
571 return KErrNone; |
565 return KErrNone; |
572 } |
566 } |
573 |
567 |
574 void CSimCallForwarding::UpdateCFListL(RMobilePhone::TMobilePhoneCFCondition* aCF, |
568 void CSimCallForwarding::UpdateCFListL(RMobilePhone::TMobilePhoneCFCondition* aCF, |
575 RMobilePhone::TMobilePhoneCFChangeV1* aCFInfo ) |
569 RMobilePhone::TMobilePhoneCFChangeV1* aCFInfo ) |