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 "CSimCallBarringTraces.h" |
|
28 #endif |
|
29 |
|
30 #include <testconfigfileparser.h> |
23 #include <testconfigfileparser.h> |
31 #include "CSimCallBarring.h" |
24 #include "CSimCallBarring.h" |
32 #include "CSimPhone.h" |
25 #include "CSimPhone.h" |
|
26 #include "Simlog.h" |
33 |
27 |
34 // The Mobile Basic Service Groups used - originally were magic numbers from 1 to 6 incl; |
28 // The Mobile Basic Service Groups used - originally were magic numbers from 1 to 6 incl; |
35 const TInt KMobServiceIndxStart = 1; |
29 const TInt KMobServiceIndxStart = 1; |
36 const TInt KMobServiceIndxEnd = 6; |
30 const TInt KMobServiceIndxEnd = 6; |
37 |
31 |
63 /** |
57 /** |
64 Second phase of 2-Phase Constructor |
58 Second phase of 2-Phase Constructor |
65 Retrieves all the Call Barring related tags from the config file |
59 Retrieves all the Call Barring related tags from the config file |
66 */ |
60 */ |
67 { |
61 { |
68 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_CONSTRUCTL_1, "Starting to parse Call Barring config parameters..."); |
62 LOGCALL1("Starting to parse Call Barring config parameters..."); |
69 |
63 |
70 iPassword.Copy(CfgFile()->ItemValue(KCBPassword,KCBDefaultPassword)); |
64 iPassword.Copy(CfgFile()->ItemValue(KCBPassword,KCBDefaultPassword)); |
71 |
65 |
72 iGetCBStatus = new(ELeave) CArrayPtrFlat<CListReadAllAttempt>(1); |
66 iGetCBStatus = new(ELeave) CArrayPtrFlat<CListReadAllAttempt>(1); |
73 FindAndCreateCBListL(); |
67 FindAndCreateCBListL(); |
74 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_CONSTRUCTL_2, "...Finished parsing Call Barring config parameters..."); |
68 LOGCALL1("...Finished parsing Call Barring config parameters..."); |
75 } |
69 } |
76 |
70 |
77 void CSimCallBarring::FindAndCreateCBListL() |
71 void CSimCallBarring::FindAndCreateCBListL() |
78 { |
72 { |
79 /** |
73 /** |
80 Retrieves all the Call barring tags that define the |
74 Retrieves all the Call barring tags that define the |
81 original status of Call barring from the config file |
75 original status of Call barring from the config file |
82 */ |
76 */ |
83 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_FINDANDCREATECBLISTL_1, "CSimPhone::FindAndCreateCBListL"); |
77 LOGCALL1("CSimPhone::FindAndCreateCBListL"); |
84 RMobilePhone::TMobilePhoneCBInfoEntryV1 entry; |
78 RMobilePhone::TMobilePhoneCBInfoEntryV1 entry; |
85 |
79 |
86 iCBList = CMobilePhoneCBList::NewL(); |
80 iCBList = CMobilePhoneCBList::NewL(); |
87 TInt count=CfgFile()->ItemCount(KCBList); |
81 TInt count=CfgFile()->ItemCount(KCBList); |
88 const CTestConfigItem* item=NULL; |
82 const CTestConfigItem* item=NULL; |
89 TInt ret=KErrNone; |
83 TInt ret=KErrNone; |
90 |
84 |
91 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_FINDANDCREATECBLISTL_2, "Starting to Load and Parse CBList Config parameters"); |
85 LOGCALL1("Starting to Load and Parse CBList Config parameters"); |
92 TInt i; |
86 TInt i; |
93 for(i=0;i<count;i++) |
87 for(i=0;i<count;i++) |
94 { |
88 { |
95 item=CfgFile()->Item(KCBList,i); |
89 item=CfgFile()->Item(KCBList,i); |
96 if(!item) |
90 if(!item) |
98 |
92 |
99 TInt condition, serviceGroup, status; |
93 TInt condition, serviceGroup, status; |
100 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,condition); |
94 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,condition); |
101 if(ret!=KErrNone) |
95 if(ret!=KErrNone) |
102 { |
96 { |
103 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_FINDANDCREATECBLISTL_3, "WARNING - CONFIGURATION FILE PARSING - Reading element CONDITION returned %d (element no. %d) from tag %s.",ret,0,KCBList); |
97 LOGPARSERR("condition",ret,0,&KCBList); |
104 continue; |
98 continue; |
105 } |
99 } |
106 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,serviceGroup); |
100 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,serviceGroup); |
107 if(ret!=KErrNone) |
101 if(ret!=KErrNone) |
108 { |
102 { |
109 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_FINDANDCREATECBLISTL_4, "WARNING - CONFIGURATION FILE PARSING - Reading element SERVICEGROUP returned %d (element no. %d) from tag %s.",ret,1,KCBList); |
103 LOGPARSERR("serviceGroup",ret,1,&KCBList); |
110 continue; |
104 continue; |
111 } |
105 } |
112 |
106 |
113 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,status); |
107 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,status); |
114 if(ret!=KErrNone) |
108 if(ret!=KErrNone) |
115 { |
109 { |
116 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_FINDANDCREATECBLISTL_5, "WARNING - CONFIGURATION FILE PARSING - Reading element STATUS returned %d (element no. %d) from tag %s.",ret,2,KCBList); |
110 LOGPARSERR("status",ret,2,&KCBList); |
117 continue; |
111 continue; |
118 } |
112 } |
119 |
113 |
120 entry.iCondition=(RMobilePhone::TMobilePhoneCBCondition)condition; |
114 entry.iCondition=(RMobilePhone::TMobilePhoneCBCondition)condition; |
121 entry.iServiceGroup=(RMobilePhone::TMobileService)serviceGroup; |
115 entry.iServiceGroup=(RMobilePhone::TMobileService)serviceGroup; |
198 */ |
192 */ |
199 __ASSERT_ALWAYS(!iCBNotification.iCBChangeInfoNotificationPending,SimPanic(ENotificationReqAlreadyOutstanding)); |
193 __ASSERT_ALWAYS(!iCBNotification.iCBChangeInfoNotificationPending,SimPanic(ENotificationReqAlreadyOutstanding)); |
200 iCBNotification.iCBChangeInfoNotificationPending=ETrue; |
194 iCBNotification.iCBChangeInfoNotificationPending=ETrue; |
201 iCBNotification.iCBChangeInfoReqHandle=aReqHandle; |
195 iCBNotification.iCBChangeInfoReqHandle=aReqHandle; |
202 iCBNotification.iCurrentCBCondition=aCB; |
196 iCBNotification.iCurrentCBCondition=aCB; |
203 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_NOTIFYCALLBARRINGSTATUSCHANGE_1, "Finished CSimCallBarring::NotifyCallBarringStatusChange"); |
197 LOGCALL1("Finished CSimCallBarring::NotifyCallBarringStatusChange"); |
204 return KErrNone; |
198 return KErrNone; |
205 } |
199 } |
206 |
200 |
207 TInt CSimCallBarring::NotifyCallBarringStatusChangeCancel(const TTsyReqHandle aReqHandle) |
201 TInt CSimCallBarring::NotifyCallBarringStatusChangeCancel(const TTsyReqHandle aReqHandle) |
208 { |
202 { |
314 1st phase retrieval of the the call barring status list |
308 1st phase retrieval of the the call barring status list |
315 @param aReqHandle Handle to the request |
309 @param aReqHandle Handle to the request |
316 @param aReqData information about the request |
310 @param aReqData information about the request |
317 @param aBufSize Size of the buffer the client has to allocate for the 2nd pahase |
311 @param aBufSize Size of the buffer the client has to allocate for the 2nd pahase |
318 */ |
312 */ |
319 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_GETCALLBARRINGSTATUSPHASE1_1, "CSimPhone::GetCallBarringStatusPhase1"); |
313 LOGCALL1("CSimPhone::GetCallBarringStatusPhase1"); |
320 |
314 |
321 TInt ret=KErrNone; |
315 TInt ret=KErrNone; |
322 TInt leaveCode=KErrNone; |
316 TInt leaveCode=KErrNone; |
323 TRAP(leaveCode, ret=ProcessGetCallBarringStatusPhase1L(aTsyReqHandle, aReqData, aBufSize);); |
317 TRAP(leaveCode, ret=ProcessGetCallBarringStatusPhase1L(aTsyReqHandle, aReqData, aBufSize);); |
324 if (leaveCode != KErrNone) |
318 if (leaveCode != KErrNone) |
325 iPhone->ReqCompleted(aTsyReqHandle,leaveCode); |
319 iPhone->ReqCompleted(aTsyReqHandle,leaveCode); |
326 |
320 |
327 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_GETCALLBARRINGSTATUSPHASE1_2, "CSimPhone::GetCallBarringStatusPhase1"); |
321 LOGCALL1("CSimPhone::GetCallBarringStatusPhase1"); |
328 return ret; |
322 return ret; |
329 } |
323 } |
330 |
324 |
331 TInt CSimCallBarring::ProcessGetCallBarringStatusPhase1L(const TTsyReqHandle aTsyReqHandle, |
325 TInt CSimCallBarring::ProcessGetCallBarringStatusPhase1L(const TTsyReqHandle aTsyReqHandle, |
332 CRetrieveMobilePhoneCBList::TGetCallBarringRequest* aReqData, |
326 CRetrieveMobilePhoneCBList::TGetCallBarringRequest* aReqData, |
337 stream the list and then return size of this buffer to client |
331 stream the list and then return size of this buffer to client |
338 @param aReqHandle Handle to the request |
332 @param aReqHandle Handle to the request |
339 @param aReqData information about the request |
333 @param aReqData information about the request |
340 @param aBufSize Size of the buffer the client has to allocate for the 2nd pahase |
334 @param aBufSize Size of the buffer the client has to allocate for the 2nd pahase |
341 */ |
335 */ |
342 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_PROCESSGETCALLBARRINGSTATUSPHASE1L_1, "CSimCallBarring::ProcessGetCallBarringStatusPhase1L"); |
336 LOGCALL1("CSimCallBarring::ProcessGetCallBarringStatusPhase1L"); |
343 |
337 |
344 CMobilePhoneCBList* list=CMobilePhoneCBList::NewL(); |
338 CMobilePhoneCBList* list=CMobilePhoneCBList::NewL(); |
345 CleanupStack::PushL(list); |
339 CleanupStack::PushL(list); |
346 |
340 |
347 |
341 |
399 CleanupStack::PopAndDestroy(list); // pop&destroy list |
393 CleanupStack::PopAndDestroy(list); // pop&destroy list |
400 |
394 |
401 // Complete first phase of list retrieval |
395 // Complete first phase of list retrieval |
402 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
396 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
403 |
397 |
404 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_PROCESSGETCALLBARRINGSTATUSPHASE1L_2, "CSimCallBarring::ProcessGetCallBarringStatusPhase1L"); |
398 LOGCALL1("CSimCallBarring::ProcessGetCallBarringStatusPhase1L"); |
405 return KErrNone; |
399 return KErrNone; |
406 } |
400 } |
407 |
401 |
408 TInt CSimCallBarring::GetCallBarringStatusPhase2(const TTsyReqHandle aTsyReqHandle, |
402 TInt CSimCallBarring::GetCallBarringStatusPhase2(const TTsyReqHandle aTsyReqHandle, |
409 RMobilePhone::TClientId* aClient, TDes8* aBuf) |
403 RMobilePhone::TClientId* aClient, TDes8* aBuf) |
412 2nd phase retrieval of the the call barring status list |
406 2nd phase retrieval of the the call barring status list |
413 @param aReqHandle Handle to the request |
407 @param aReqHandle Handle to the request |
414 @param aClient Ponter to the client |
408 @param aClient Ponter to the client |
415 @param aBuf Buffer containiong the call barring status list |
409 @param aBuf Buffer containiong the call barring status list |
416 */ |
410 */ |
417 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_GETCALLBARRINGSTATUSPHASE2_1, "CSimCallBarring::GetCallBarringStatusPhase2"); |
411 LOGCALL1("CSimCallBarring::GetCallBarringStatusPhase2"); |
418 CListReadAllAttempt* read=NULL; |
412 CListReadAllAttempt* read=NULL; |
419 // Find the get detected network attempt from this client |
413 // Find the get detected network attempt from this client |
420 for (TInt i=0; i<iGetCBStatus->Count(); ++i) |
414 for (TInt i=0; i<iGetCBStatus->Count(); ++i) |
421 { |
415 { |
422 read = iGetCBStatus->At(i); |
416 read = iGetCBStatus->At(i); |
431 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
425 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
432 return KErrNone; |
426 return KErrNone; |
433 } |
427 } |
434 } |
428 } |
435 // Should handle error case of not finding the matching client from read all phase 1 |
429 // Should handle error case of not finding the matching client from read all phase 1 |
436 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_GETCALLBARRINGSTATUSPHASE2_2, "CSimCallBarring::GetCallBarringStatusPhase2"); |
430 LOGCALL1("CSimCallBarring::GetCallBarringStatusPhase2"); |
437 return KErrNotFound; |
431 return KErrNotFound; |
438 } |
432 } |
439 |
433 |
440 TInt CSimCallBarring::GetCallBarringStatusCancel(const TTsyReqHandle aTsyReqHandle) |
434 TInt CSimCallBarring::GetCallBarringStatusCancel(const TTsyReqHandle aTsyReqHandle) |
441 { |
435 { |
442 /* |
436 /* |
443 Cancels a Request to retrieve the call barring status list |
437 Cancels a Request to retrieve the call barring status list |
444 @param aReqHandle Handle to the request |
438 @param aReqHandle Handle to the request |
445 */ |
439 */ |
446 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_GETCALLBARRINGSTATUSCANCEL_1, "CSimCallBarring::GetCallBarringStatusCancel"); |
440 LOGCALL1("CSimCallBarring::GetCallBarringStatusCancel"); |
447 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
441 iPhone->ReqCompleted(aTsyReqHandle,KErrNone); |
448 // Remove the read all attempt from iGetCBStatus |
442 // Remove the read all attempt from iGetCBStatus |
449 CListReadAllAttempt* read=NULL; |
443 CListReadAllAttempt* read=NULL; |
450 for (TInt i=0; i<iGetCBStatus->Count(); ++i) |
444 for (TInt i=0; i<iGetCBStatus->Count(); ++i) |
451 { |
445 { |
456 iGetCBStatus->Delete(i); |
450 iGetCBStatus->Delete(i); |
457 break; |
451 break; |
458 } |
452 } |
459 } |
453 } |
460 iPhone->ReqCompleted(aTsyReqHandle,KErrCancel); |
454 iPhone->ReqCompleted(aTsyReqHandle,KErrCancel); |
461 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLBARRING_GETCALLBARRINGSTATUSCANCEL_2, "CSimCallBarring::GetCallBarringStatusCancel"); |
455 LOGCALL1("CSimCallBarring::GetCallBarringStatusCancel"); |
462 return KErrNone; |
456 return KErrNone; |
463 } |
457 } |
464 |
458 |
465 // some useful functions for checking the type of conditions |
459 // some useful functions for checking the type of conditions |
466 inline TBool IsOutgoingCondition( RMobilePhone::TMobilePhoneCBCondition aCondition ) |
460 inline TBool IsOutgoingCondition( RMobilePhone::TMobilePhoneCBCondition aCondition ) |