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