serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttraceconcurrentcalls.cpp
changeset 22 fc9cf246af83
parent 19 989d2f495d90
child 33 50974a8b132e
--- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttraceconcurrentcalls.cpp	Fri Jul 03 15:51:24 2009 +0100
+++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttraceconcurrentcalls.cpp	Thu Aug 27 07:43:07 2009 +0300
@@ -37,7 +37,7 @@
 
 	MLiwInterface *iLocationInterface ;
 	CLiwGenericParamList *iInputList ;
-	
+    TInt cnt;
 	public :
 	TInt iRetStatus ;
 
@@ -47,7 +47,7 @@
 	    CLiwGenericParamList& aEventParamList,
 	    const CLiwGenericParamList& aInParamList) ;
 
-	ConcurrentTraceLoc() : iRetStatus(KErrGeneral) //Default constructor 
+    ConcurrentTraceLoc() : iRetStatus(KErrGeneral),cnt(0) //Default constructor 
 		{
 			;
 		}
@@ -57,7 +57,7 @@
 
 ConcurrentTraceLoc :: ConcurrentTraceLoc(TInt aCmd ,MLiwInterface *aInterface , CLiwGenericParamList *aInputList)
 { 
-  
+    cnt = 0;
   iLocationInterface = aInterface ;
   iInputList = aInputList ;
   	
@@ -71,13 +71,30 @@
 {
 
 //DeRefrence Allocated Map first 
-	 return 0 ;
-}
+    cnt++;
+    TInt trid = aCmdId;
+
+    if(cnt == 2)
+        {
+
+        CActiveScheduler::Stop();
+        }
+    return 0 ;
+    }
   
   
 TInt TraceConcurrentCallsL()
 {
-	
+    __UHEAP_MARK ;
+    CActiveScheduler *Scheduler  = CActiveScheduler :: Current() ;
+
+    if(!Scheduler)
+        {
+        Scheduler = new CActiveScheduler ;
+        }
+
+
+    CActiveScheduler :: Install(Scheduler) ;
 	_LIT(KTraceFile , "C:\\Trace.txt") ;
 	
 	RFile TraceFile ;
@@ -93,10 +110,6 @@
 		}
 
 	}
-    CActiveScheduler *Scheduler = new CActiveScheduler ;
-
-	CActiveScheduler :: Install(Scheduler) ;
-
 	 
     
 	
@@ -166,7 +179,7 @@
 	
 	locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,KLiwOptASyncronous ,  &GetLoc);
 	pos = 0 ;
-	
+    CActiveScheduler :: Start() ;
 	const TLiwGenericParam *errparam = OutParmList->FindFirst(pos , KErrorCode) ;
 	
 	if(!errparam)
@@ -177,13 +190,14 @@
 	
     TLiwVariant ErrVariant = errparam->Value() ;
     TInt ret = ErrVariant.AsTInt32() ;
-    
+    a.ResetAndDestroy() ;
 	locinterface->Close() ;
 	delete ServiceHandler ;
 	delete InputList ;
 	delete OutParmList ;
 	delete Scheduler ;
 	TraceFile.Write(_L8("Gracefully returned \n")) ;
+    __UHEAP_MARKEND ;
 	return  ret ; 
 }