telephonyserverplugins/simtsy/src/CSimCallWaiting.cpp
branchRCL_3
changeset 66 07a122eea281
parent 65 630d2f34d719
equal deleted inserted replaced
65:630d2f34d719 66:07a122eea281
     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 "CSimCallWaitingTraces.h"
       
    28 #endif
       
    29 
       
    30 #include <testconfigfileparser.h>
    23 #include <testconfigfileparser.h>
    31 #include "CSimCallWaiting.h"
    24 #include "CSimCallWaiting.h"
    32 #include "CSimPhone.h"
    25 #include "CSimPhone.h"
       
    26 #include "Simlog.h"
       
    27 
    33 const TInt KMobServiceIndxStart = 1;
    28 const TInt KMobServiceIndxStart = 1;
    34 const TInt KMobServiceIndxEnd   = 5;
    29 const TInt KMobServiceIndxEnd   = 5;
    35 
    30 
    36 
    31 
    37 CSimCallWaiting* CSimCallWaiting::NewL(CSimPhone* aPhone)
    32 CSimCallWaiting* CSimCallWaiting::NewL(CSimPhone* aPhone)
    61 /**
    56 /**
    62 	Second phase of 2-Phase Constructor
    57 	Second phase of 2-Phase Constructor
    63   	Retrieves all the Call waiting related tags from the config file
    58   	Retrieves all the Call waiting related tags from the config file
    64 */
    59 */
    65 	{
    60 	{
    66 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_CONSTRUCTL_1, "Starting to parse Call waiting config parameters...");
    61 	LOGCALL1("Starting to parse Call waiting config parameters...");
    67 
    62 
    68 	iGetCWStatus = new(ELeave) CArrayPtrFlat<CListReadAllAttempt>(1);
    63 	iGetCWStatus = new(ELeave) CArrayPtrFlat<CListReadAllAttempt>(1);
    69 	FindAndCreateCWListL();
    64 	FindAndCreateCWListL();
    70 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_CONSTRUCTL_2, "...Finished parsing Call waiting config parameters...");
    65 	LOGCALL1("...Finished parsing Call waiting config parameters...");
    71 	}
    66 	}
    72 	
    67 	
    73 void CSimCallWaiting::FindAndCreateCWListL()
    68 void CSimCallWaiting::FindAndCreateCWListL()
    74 {
    69 {
    75 /**
    70 /**
    76   	Retrieves all the Call waiting tags that define the 
    71   	Retrieves all the Call waiting tags that define the 
    77   	original status of Call waiting from the config file
    72   	original status of Call waiting from the config file
    78 */
    73 */
    79 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_FINDANDCREATECWLISTL_1, "CSimPhone::FindAndCreateCWListL");
    74 	LOGCALL1("CSimPhone::FindAndCreateCWListL");
    80 	RMobilePhone::TMobilePhoneCWInfoEntryV1 entry;
    75 	RMobilePhone::TMobilePhoneCWInfoEntryV1 entry;
    81 
    76 
    82 	iCWList = CMobilePhoneCWList::NewL();
    77 	iCWList = CMobilePhoneCWList::NewL();
    83 	TInt count=CfgFile()->ItemCount(KCWList);
    78 	TInt count=CfgFile()->ItemCount(KCWList);
    84 	const CTestConfigItem* item=NULL;
    79 	const CTestConfigItem* item=NULL;
    85 	TInt ret=KErrNone;
    80 	TInt ret=KErrNone;
    86 
    81 
    87 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_FINDANDCREATECWLISTL_2, "Starting to Load and Parse CWList Config parameters");
    82 	LOGCALL1("Starting to Load and Parse CWList Config parameters");
    88 	TInt i;
    83 	TInt i;
    89 	for(i=0;i<count;i++)
    84 	for(i=0;i<count;i++)
    90 		{
    85 		{
    91 		item=CfgFile()->Item(KCWList,i);
    86 		item=CfgFile()->Item(KCWList,i);
    92 		if(!item)
    87 		if(!item)
    95 		TInt serviceGroup, status;
    90 		TInt serviceGroup, status;
    96 		
    91 		
    97 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,serviceGroup);
    92 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,serviceGroup);
    98 		if(ret!=KErrNone)
    93 		if(ret!=KErrNone)
    99 			{
    94 			{
   100 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_FINDANDCREATECWLISTL_3, "WARNING - CONFIGURATION FILE PARSING - Reading element SERVICEGROUP returned %d (element no. %d) from tag %s.",ret,0,KCWList);
    95 			LOGPARSERR("serviceGroup",ret,0,&KCWList);
   101 			continue;
    96 			continue;
   102 			}
    97 			}
   103 
    98 
   104 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,status);
    99 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,status);
   105 		if(ret!=KErrNone)
   100 		if(ret!=KErrNone)
   106 			{
   101 			{
   107 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_FINDANDCREATECWLISTL_4, "WARNING - CONFIGURATION FILE PARSING - Reading element STATUS returned %d (element no. %d) from tag %s.",ret,1,KCWList);
   102 			LOGPARSERR("status",ret,1,&KCWList);
   108 			continue;
   103 			continue;
   109 			}
   104 			}
   110 		
   105 		
   111 		entry.iServiceGroup=(RMobilePhone::TMobileService)serviceGroup;
   106 		entry.iServiceGroup=(RMobilePhone::TMobileService)serviceGroup;
   112 		entry.iStatus=(RMobilePhone::TMobilePhoneCWStatus)status;
   107 		entry.iStatus=(RMobilePhone::TMobilePhoneCWStatus)status;
   184   	*/
   179   	*/
   185 	__ASSERT_ALWAYS(!iCWNotification.iCWChangeInfoNotificationPending,SimPanic(ENotificationReqAlreadyOutstanding));
   180 	__ASSERT_ALWAYS(!iCWNotification.iCWChangeInfoNotificationPending,SimPanic(ENotificationReqAlreadyOutstanding));
   186 	iCWNotification.iCWChangeInfoNotificationPending=ETrue;
   181 	iCWNotification.iCWChangeInfoNotificationPending=ETrue;
   187 	iCWNotification.iCWChangeInfoReqHandle=aReqHandle;
   182 	iCWNotification.iCWChangeInfoReqHandle=aReqHandle;
   188 	iCWNotification.iCWInfo=aCW;
   183 	iCWNotification.iCWInfo=aCW;
   189 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_NOTIFYCALLWAITINGSTATUSCHANGE_1, "Finished CSimCallWaiting::NotifyCallWaitingStatusChange");
   184 	LOGCALL1("Finished CSimCallWaiting::NotifyCallWaitingStatusChange");
   190 	return KErrNone;
   185 	return KErrNone;
   191 	}
   186 	}
   192 
   187 
   193 TInt CSimCallWaiting::NotifyCallWaitingStatusChangeCancel(const TTsyReqHandle aReqHandle)
   188 TInt CSimCallWaiting::NotifyCallWaitingStatusChangeCancel(const TTsyReqHandle aReqHandle)
   194 	{
   189 	{
   285 	1st phase retrieval of the the call waiting status list
   280 	1st phase retrieval of the the call waiting status list
   286 	@param aReqHandle Handle to the request
   281 	@param aReqHandle Handle to the request
   287 	@param aReqData information about the request
   282 	@param aReqData information about the request
   288 	@param aBufSize Size of the buffer the client has to allocate for the 2nd pahase
   283 	@param aBufSize Size of the buffer the client has to allocate for the 2nd pahase
   289   	*/
   284   	*/
   290 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_GETCALLWAITINGSTATUSPHASE1_1, "CSimCallWaiting::GetCalWaitingStatusPhase1");
   285 	LOGCALL1("CSimCallWaiting::GetCalWaitingStatusPhase1");
   291 	
   286 	
   292 	TInt ret=KErrNone;
   287 	TInt ret=KErrNone;
   293 	TInt leaveCode=KErrNone;
   288 	TInt leaveCode=KErrNone;
   294 	TRAP(leaveCode, ret=ProcessGetCallWaitingStatusPhase1L(aTsyReqHandle, aReqData, aBufSize););
   289 	TRAP(leaveCode, ret=ProcessGetCallWaitingStatusPhase1L(aTsyReqHandle, aReqData, aBufSize););
   295 	if (leaveCode != KErrNone)
   290 	if (leaveCode != KErrNone)
   296 			iPhone->ReqCompleted(aTsyReqHandle,leaveCode);
   291 			iPhone->ReqCompleted(aTsyReqHandle,leaveCode);
   297 
   292 
   298 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_GETCALLWAITINGSTATUSPHASE1_2, "CSimCallWaiting::GetCalWaitingStatusPhase1");
   293 	LOGCALL1("CSimCallWaiting::GetCalWaitingStatusPhase1");
   299 	return ret;
   294 	return ret;
   300 	}
   295 	}
   301 	
   296 	
   302 TInt CSimCallWaiting::ProcessGetCallWaitingStatusPhase1L(const TTsyReqHandle aTsyReqHandle, 
   297 TInt CSimCallWaiting::ProcessGetCallWaitingStatusPhase1L(const TTsyReqHandle aTsyReqHandle, 
   303 														 CRetrieveMobilePhoneCWList::TGetCallWaitingRequest* aReqData, 
   298 														 CRetrieveMobilePhoneCWList::TGetCallWaitingRequest* aReqData, 
   308 	stream the list and then return size of this buffer to client
   303 	stream the list and then return size of this buffer to client
   309 	@param aReqHandle Handle to the request
   304 	@param aReqHandle Handle to the request
   310 	@param aReqData information about the request
   305 	@param aReqData information about the request
   311 	@param aBufSize Size of the buffer the client has to allocate for the 2nd pahase
   306 	@param aBufSize Size of the buffer the client has to allocate for the 2nd pahase
   312 	*/
   307 	*/
   313 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_PROCESSGETCALLWAITINGSTATUSPHASE1L_1, "CSimCallWaiting::ProcessGetCallWaitingStatusPhase1L");
   308 	LOGCALL1("CSimCallWaiting::ProcessGetCallWaitingStatusPhase1L");
   314 
   309 
   315 	CMobilePhoneCWList* list=CMobilePhoneCWList::NewL();
   310 	CMobilePhoneCWList* list=CMobilePhoneCWList::NewL();
   316 	CleanupStack::PushL(list);
   311 	CleanupStack::PushL(list);
   317 		
   312 		
   318 	TInt maxNum=iCWList->Enumerate();
   313 	TInt maxNum=iCWList->Enumerate();
   359 	CleanupStack::PopAndDestroy(list); // pop&destroy list
   354 	CleanupStack::PopAndDestroy(list); // pop&destroy list
   360 	
   355 	
   361 	// Complete first phase of list retrieval
   356 	// Complete first phase of list retrieval
   362 	iPhone->ReqCompleted(aTsyReqHandle,KErrNone);
   357 	iPhone->ReqCompleted(aTsyReqHandle,KErrNone);
   363 	
   358 	
   364 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_PROCESSGETCALLWAITINGSTATUSPHASE1L_2, "CSimCallWaiting::ProcessGetCallWaitingStatusPhase1L");
   359 	LOGCALL1("CSimCallWaiting::ProcessGetCallWaitingStatusPhase1L");
   365 	return KErrNone;
   360 	return KErrNone;
   366 	}
   361 	}
   367 
   362 
   368 TInt CSimCallWaiting::GetCallWaitingStatusPhase2(const TTsyReqHandle aTsyReqHandle, 
   363 TInt CSimCallWaiting::GetCallWaitingStatusPhase2(const TTsyReqHandle aTsyReqHandle, 
   369 												 RMobilePhone::TClientId* aClient, TDes8* aBuf)
   364 												 RMobilePhone::TClientId* aClient, TDes8* aBuf)
   372 	2nd phase retrieval of the the call waiting status list
   367 	2nd phase retrieval of the the call waiting status list
   373 	@param aReqHandle Handle to the request
   368 	@param aReqHandle Handle to the request
   374 	@param aClient Ponter to the client
   369 	@param aClient Ponter to the client
   375 	@param aBuf Buffer containiong the call waiting status list
   370 	@param aBuf Buffer containiong the call waiting status list
   376 	*/
   371 	*/
   377 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_GETCALLWAITINGSTATUSPHASE2_1, "CSimCallWaiting::GetCallWaitingStatusPhase2");
   372 	LOGCALL1("CSimCallWaiting::GetCallWaitingStatusPhase2");
   378 	CListReadAllAttempt* read=NULL;
   373 	CListReadAllAttempt* read=NULL;
   379 	// Find the get detected network attempt from this client
   374 	// Find the get detected network attempt from this client
   380 	for (TInt i=0; i<iGetCWStatus->Count(); ++i)
   375 	for (TInt i=0; i<iGetCWStatus->Count(); ++i)
   381 		{
   376 		{
   382 		read = iGetCWStatus->At(i);
   377 		read = iGetCWStatus->At(i);
   391 			iPhone->ReqCompleted(aTsyReqHandle,KErrNone);
   386 			iPhone->ReqCompleted(aTsyReqHandle,KErrNone);
   392 			return KErrNone;
   387 			return KErrNone;
   393 			}
   388 			}
   394 		}
   389 		}
   395 	// Should handle error case of not finding the matching client from read all phase 1
   390 	// Should handle error case of not finding the matching client from read all phase 1
   396 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_GETCALLWAITINGSTATUSPHASE2_2, "CSimCallWaiting::GetCallWaitingStatusPhase2");
   391 	LOGCALL1("CSimCallWaiting::GetCallWaitingStatusPhase2");
   397 	return KErrNotFound;
   392 	return KErrNotFound;
   398 	}
   393 	}
   399 
   394 
   400 TInt CSimCallWaiting::GetCallWaitingStatusCancel(const TTsyReqHandle aTsyReqHandle)
   395 TInt CSimCallWaiting::GetCallWaitingStatusCancel(const TTsyReqHandle aTsyReqHandle)
   401 	{
   396 	{
   402 	/*
   397 	/*
   403 	Cancels a Request to retrieve the call waiting status list
   398 	Cancels a Request to retrieve the call waiting status list
   404 	@param aReqHandle Handle to the request
   399 	@param aReqHandle Handle to the request
   405 	*/
   400 	*/
   406 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_GETCALLWAITINGSTATUSCANCEL_1, "CSimCallWaiting::GetCallWaitingStatusCancel");
   401 	LOGCALL1("CSimCallWaiting::GetCallWaitingStatusCancel");
   407 	iPhone->ReqCompleted(aTsyReqHandle,KErrNone);
   402 	iPhone->ReqCompleted(aTsyReqHandle,KErrNone);
   408 	// Remove the read all attempt from iGetCBStatus
   403 	// Remove the read all attempt from iGetCBStatus
   409 	CListReadAllAttempt* read=NULL;
   404 	CListReadAllAttempt* read=NULL;
   410 	for (TInt i=0; i<iGetCWStatus->Count(); ++i)
   405 	for (TInt i=0; i<iGetCWStatus->Count(); ++i)
   411 		{
   406 		{
   416 			iGetCWStatus->Delete(i);
   411 			iGetCWStatus->Delete(i);
   417 			break;
   412 			break;
   418 			}
   413 			}
   419 		}
   414 		}
   420 	iPhone->ReqCompleted(aTsyReqHandle,KErrCancel);
   415 	iPhone->ReqCompleted(aTsyReqHandle,KErrCancel);
   421 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMCALLWAITING_GETCALLWAITINGSTATUSCANCEL_2, "CSimCallWaiting::GetCallWaitingStatusCancel");
   416 	LOGCALL1("CSimCallWaiting::GetCallWaitingStatusCancel");
   422 	return KErrNone;
   417 	return KErrNone;
   423 	}
   418 	}
   424 	
   419 	
   425 inline void SplitOneEntryIntoSeparateGroupsL( 
   420 inline void SplitOneEntryIntoSeparateGroupsL( 
   426 								CMobilePhoneCWList* aCWList,
   421 								CMobilePhoneCWList* aCWList,