serviceproviders/sapi_location/tsrc/testing/tsapiloctest/src/sapiloctestblocks.cpp
changeset 22 fc9cf246af83
parent 19 989d2f495d90
child 33 50974a8b132e
equal deleted inserted replaced
19:989d2f495d90 22:fc9cf246af83
    32 _LIT(LogFileName , "C:\\tsapiloctest.txt") ;
    32 _LIT(LogFileName , "C:\\tsapiloctest.txt") ;
    33 TInt returnCode;
    33 TInt returnCode;
    34 RFile LogFile ;
    34 RFile LogFile ;
    35 RFs LogSession ;
    35 RFs LogSession ;
    36 
    36 
       
    37 #define GETLOCATION 0
       
    38 #define TRACE 1
    37 void OpenFile()
    39 void OpenFile()
    38 	{
    40 	{
    39 	LogSession.Connect() ;
    41 	LogSession.Connect() ;
    40 
    42 
    41 	if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny )  == KErrNotFound)
    43 	if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny )  == KErrNotFound)
   399 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
   401 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
   400     aRequestorStack.Insert(identityInfo,0);
   402     aRequestorStack.Insert(identityInfo,0);
   401     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
   403     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
   402 
   404 
   403     
   405     
   404     TRAPD( error,aRet = CoreObj->GetLocationL(&currPos) );
   406     TRAP(aRet , CoreObj->GetLocationL(&currPos) );
   405     
   407     
   406     if( KErrNone == aRet )
   408     if( KErrNone == aRet )
   407     	{
   409     	{
   408     	OpenFile();
   410     	OpenFile();
   409     	LogFile.Write(_L8("\n<GetPosition Test>\n"));
   411     	LogFile.Write(_L8("\n<GetPosition Test>\n"));
   467 	/*RRequestorStack aRequestorStack;
   469 	/*RRequestorStack aRequestorStack;
   468 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
   470 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
   469     aRequestorStack.Insert(identityInfo,0);
   471     aRequestorStack.Insert(identityInfo,0);
   470     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
   472     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
   471 	
   473 	
   472 	User::After(120000000) ;	
   474     //User::After(120000000) ;	
   473     aRet1 = CoreObj->GetLocationL(&currPos1) ;
   475     TRAP(aRet1,CoreObj->GetLocationL(&currPos1) );
   474     
   476 
   475     
   477 
   476     if (KErrNone == aRet1)
   478     if (KErrNone == aRet1)
   477     	{
   479         {
   478         aRet2 = CoreObj->GetLocationL(&currPos2) ;
   480         TRAPD(aRet2,CoreObj->GetLocationL(&currPos2)) ;
   479         
   481 
   480         OpenFile();
   482         OpenFile();
   481     	LogFile.Write(_L8("\n<GetPosition2 Test>\n"));
   483         LogFile.Write(_L8("\n<GetPosition2 Test>\n"));
   482     	CloseFile();
   484         CloseFile();
   483     	
   485 
   484     	currPos1.GetPosition(currPosition1);
   486         currPos1.GetPosition(currPosition1);
   485     	currPos2.GetPosition(currPosition2);
   487         currPos2.GetPosition(currPosition2);
   486     	aFlag1 = ValidatePosition(currPosition1);
   488         aFlag1 = ValidatePosition(currPosition1);
   487     	aFlag2 = ValidatePosition(currPosition2);
   489         aFlag2 = ValidatePosition(currPosition2);
   488     	
   490 
   489        	if((KErrNone == aFlag1) && (KErrNone == aFlag2))
   491         if((KErrNone == aFlag1) && (KErrNone == aFlag2))
   490     		{
   492             {
   491     		OpenFile();
   493             OpenFile();
   492 	    	LogFile.Write(_L8("Passed..\n"));
   494             LogFile.Write(_L8("Passed..\n"));
   493 	    	CloseFile();
   495             CloseFile();
   494 	    	returnCode = KErrNone;
   496             returnCode = KErrNone;
   495     		}
   497             }
   496     	else
   498         else
   497     		{
   499             {
   498     		OpenFile();
   500             OpenFile();
   499     		LogFile.Write(_L8("Failed..\n"));
   501             LogFile.Write(_L8("Failed..\n"));
   500     		CloseFile();
   502             CloseFile();
   501     		returnCode = KErrGeneral;	
   503             returnCode = KErrGeneral;	
   502     		}
   504             }
   503     	}
   505         }
   504     else
   506     else
   505     	{
   507         {
   506        	OpenFile();
   508         OpenFile();
   507     	LogFile.Write(_L8("\n<GetPosition2 Test>\n"));
   509         LogFile.Write(_L8("\n<GetPosition2 Test>\n"));
   508     	LogFile.Write(_L8("Failed(getloc error)..\n"));
   510         LogFile.Write(_L8("Failed(getloc error)..\n"));
   509     	CloseFile();
   511         CloseFile();
   510     	returnCode = KErrGeneral;
   512         returnCode = KErrGeneral;
   511     	}
   513         }
   512     
   514 
   513      /*aRequestorStack.Close();
   515     /*aRequestorStack.Close();
   514 	 delete identityInfo;*/
   516 	 delete identityInfo;*/
   515 	 delete CoreObj;
   517     delete CoreObj;
   516     
   518 
   517     __UHEAP_MARKEND;
   519     __UHEAP_MARKEND;
   518     
   520 
   519     return returnCode;	
   521     return returnCode;	
   520     
   522 
   521     }
   523     }
   522 	    
   524 
   523     
   525 
   524 
   526 
   525     
   527 
   526 // -----------------------------------------------------------------------------
   528 // -----------------------------------------------------------------------------
   527 // CSAPILocTest::GetPositionAsync
   529 // CSAPILocTest::GetPositionAsync
   528 // -----------------------------------------------------------------------------
   530 // -----------------------------------------------------------------------------
   529 //
   531 //
   530 
   532 
   531 class LocUpdateCallBack : public MLocationCallBack
   533 class LocUpdateCallBack : public MLocationCallBack
   532 	{
   534     {
   533     TInt iCount ;
   535     TInt iCount ;
   534     TInt iRetStatus ;
   536     TInt iRetStatus ;
       
   537     TInt iRequestType;
       
   538     TInt iTransactionId;
   535     public :
   539     public :
   536     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
   540         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
   537     LocUpdateCallBack() :iCount(0) , iRetStatus(KErrGeneral){;}
   541         LocUpdateCallBack(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){
   538 	};
   542         iTransactionId = transId;
   539   
   543         iRequestType = req;
   540    
   544         }
       
   545 
       
   546         inline TUint GetRequestType(void) 
       
   547             {
       
   548             return iRequestType ;
       
   549             }
       
   550 
       
   551 
       
   552         /**
       
   553          * GetTransactionId function returns transcation id associated with current async object
       
   554          *
       
   555          */
       
   556         inline TInt32 GetTransactionId(void)
       
   557             {
       
   558             return iTransactionId ;
       
   559             }
       
   560     };
       
   561 
       
   562 
   541 TInt LocUpdateCallBack :: HandleNotifyL(HPositionGenericInfo *currPos , TInt /*aError*/)
   563 TInt LocUpdateCallBack :: HandleNotifyL(HPositionGenericInfo *currPos , TInt /*aError*/)
   542 	{
   564     {
   543 //	User::After(60000000);
   565     //	User::After(60000000);
   544 	TInt aRetVal = KErrNone;
   566     TInt aRetVal = KErrNone;
   545 	
   567 
   546 	OpenFile();
   568     OpenFile();
   547 	LogFile.Write(_L8("\n<GetPositionAsync Test>\n "));
   569     LogFile.Write(_L8("\n<GetPositionAsync Test>\n "));
   548 	CloseFile();
   570     CloseFile();
   549 	TPosition outPos ;
   571     TPosition outPos ;
   550   	currPos->GetPosition(outPos) ;
   572     currPos->GetPosition(outPos) ;
   551 	aRetVal = ValidatePosition(outPos);
   573     aRetVal = ValidatePosition(outPos);
   552     
   574 
   553     if( KErrNone == aRetVal )
   575     if( KErrNone == aRetVal )
   554 	    {
   576         {
   555     	OpenFile();
   577         OpenFile();
   556     	LogFile.Write(_L8("Passed..\n"));
   578         LogFile.Write(_L8("Passed..\n"));
   557     	CloseFile();
   579         CloseFile();
   558     	returnCode = KErrNone;
   580         returnCode = KErrNone;
   559 	    }
   581         }
   560    else
   582     else
   561 	   	{
   583         {
   562    		OpenFile();
   584         OpenFile();
   563    		LogFile.Write(_L8("Failed..\n"));
   585         LogFile.Write(_L8("Failed..\n"));
   564    		CloseFile();
   586         CloseFile();
   565    		returnCode = KErrGeneral;
   587         returnCode = KErrGeneral;
   566 	   	}
   588         }
   567     
   589 
   568     CActiveScheduler *Current = CActiveScheduler :: Current() ;
   590     CActiveScheduler *Current = CActiveScheduler :: Current() ;
   569 	Current->Stop() ;
   591     Current->Stop() ;
   570 	return KErrNone ;
   592     return KErrNone ;
   571 	}
   593     }
   572 
   594 
   573 TInt GetLocFunctionL()
   595 TInt GetLocFunctionL()
   574 	{
   596     {
   575     TBuf8<20> retBuf;
   597     TBuf8<20> retBuf;
   576     TRealFormat retFormat;
   598     TRealFormat retFormat;
   577   
   599     __UHEAP_MARK ;
   578     CLocationService *CoreObj = CLocationService ::NewL() ;
   600     CLocationService *CoreObj = CLocationService ::NewL() ;
   579     
   601 
   580     if( NULL == CoreObj )
   602     if( NULL == CoreObj )
   581     	{
   603         {
   582     	OpenFile();
   604         OpenFile();
   583 	    LogFile.Write(_L8("\n<GetPositionAsync Test>\n"));
   605         LogFile.Write(_L8("\n<GetPositionAsync Test>\n"));
   584 	    LogFile.Write(_L8("Failed(CoreObj Creation)..\n"));
   606         LogFile.Write(_L8("Failed(CoreObj Creation)..\n"));
   585 	    CloseFile();
   607         CloseFile();
   586    		return KErrGeneral;
   608         return KErrGeneral;
   587    		}
   609         }
   588     
   610 
   589     _LIT(Kidentity ,"Coreclass Testing" ) ;
   611     _LIT(Kidentity ,"Coreclass Testing" ) ;
   590 	//not needed any more
   612     //not needed any more
   591 	/*RRequestorStack aRequestorStack;
   613     /*RRequestorStack aRequestorStack;
   592 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
   614 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
   593     aRequestorStack.Insert(identityInfo,0);
   615     aRequestorStack.Insert(identityInfo,0);
   594     
   616 
   595     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
   617     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
   596 		
   618 
   597     LocUpdateCallBack MyUpdates  ;
   619     LocUpdateCallBack MyUpdates(10,GETLOCATION)  ;
   598     
   620 
   599     CoreObj->GetLocationL(&MyUpdates) ;
   621     CoreObj->GetLocationL(&MyUpdates) ;
   600     
   622 
   601     User::After(60000000);
   623     // User::After(60000000);
   602     CActiveScheduler :: Start() ;
   624     CActiveScheduler :: Start() ;
   603         
   625 
   604     retBuf.Num(returnCode,retFormat) ;
   626     retBuf.Num(returnCode,retFormat) ;
   605     OpenFile();
   627     OpenFile();
   606     LogFile.Write(_L8("\nreturnCode : "));
   628     LogFile.Write(_L8("\nreturnCode : "));
   607     LogFile.Write(retBuf);
   629     LogFile.Write(retBuf);
   608     CloseFile();
   630     CloseFile();
   609     /*aRequestorStack.Close();
   631     /*aRequestorStack.Close();
   610     delete identityInfo;*/
   632     delete identityInfo;*/
   611     delete CoreObj;
   633     delete CoreObj;
       
   634     __UHEAP_MARKEND ;
   612     return 0;
   635     return 0;
   613 	}
   636     }
   614 
   637 
   615 TInt CSAPILocTest::GetPositionAsync( CStifItemParser& /*aItem*/ )
   638 TInt CSAPILocTest::GetPositionAsync( CStifItemParser& /*aItem*/ )
   616 	{
   639     {
   617     TRequestStatus status = KRequestPending;
   640     TRequestStatus status = KRequestPending;
   618     TInt aRet = KErrNone;
   641     TInt aRet = KErrNone;
   619     returnCode = KErrNone;
   642     returnCode = KErrNone;
   620     // Print to UI
   643     // Print to UI
   621     _LIT( KSAPILocTest, "SAPILocTest" );
   644     _LIT( KSAPILocTest, "SAPILocTest" );
   622     _LIT( KExample, "GetPositionAsync" );
   645     _LIT( KExample, "GetPositionAsync" );
   623     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
   646     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
   624     
   647 
   625      __UHEAP_MARK;
   648     __UHEAP_MARK;
   626     
   649 
   627     TRAPD(err , aRet = GetLocFunctionL()) ;
   650     TRAPD(err , aRet = GetLocFunctionL()) ;
   628     if( err || aRet )
   651     if( err || aRet )
   629     returnCode = KErrGeneral; 
   652         returnCode = KErrGeneral; 
   630     
   653 
   631     __UHEAP_MARKEND;
   654     __UHEAP_MARKEND;
   632  
   655 
   633     return returnCode;  
   656     return returnCode;  
   634     }
   657     }
   635     
   658 
   636    
   659 
   637 
   660 
   638 // -----------------------------------------------------------------------------
   661 // -----------------------------------------------------------------------------
   639 // CSAPILocTest::GetPositionAsyncOpts1
   662 // CSAPILocTest::GetPositionAsyncOpts1
   640 // -----------------------------------------------------------------------------
   663 // -----------------------------------------------------------------------------
   641 //
   664 //
   642 class LocUpdateCallBackOpts1 : public MLocationCallBack
   665 class LocUpdateCallBackOpts1 : public MLocationCallBack
   643 	{
   666     {
   644 	TInt iCount ;
   667     TInt iCount ;
   645 	TInt iRetStatus ;
   668     TInt iRetStatus ;
   646 	public :
   669     TInt iTransactionId;
   647 	TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
   670     TInt iRequestType;
   648 	LocUpdateCallBackOpts1() :iCount(0) , iRetStatus(KErrGeneral)  //Default constructor 
   671     public :
   649 		{;}
   672         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
   650 	};
   673         LocUpdateCallBackOpts1(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral)  //Default constructor 
   651    
   674 		        {
       
   675 		        iTransactionId  = transId;
       
   676 		        iRequestType = req;
       
   677 		        }
       
   678         inline TUint GetRequestType(void) 
       
   679             {
       
   680             return iRequestType ;
       
   681             }
       
   682 
       
   683 
       
   684         /**
       
   685          * GetTransactionId function returns transcation id associated with current async object
       
   686          *
       
   687          */
       
   688         inline TInt32 GetTransactionId(void)
       
   689             {
       
   690             return iTransactionId ;
       
   691             }
       
   692     };
       
   693 
   652 TInt LocUpdateCallBackOpts1 :: HandleNotifyL(HPositionGenericInfo* /*currPos*/ , TInt aError)
   694 TInt LocUpdateCallBackOpts1 :: HandleNotifyL(HPositionGenericInfo* /*currPos*/ , TInt aError)
   653 	{
   695     {
   654 	if(KErrTimedOut == aError)
   696     if(KErrTimedOut == aError)
   655  		{
   697         {
   656 	    OpenFile();
   698         OpenFile();
   657 	    LogFile.Write(_L8("\n<GetPositionAsyncOpts1 Async test>\n "));
   699         LogFile.Write(_L8("\n<GetPositionAsyncOpts1 Async test>\n "));
   658 	    LogFile.Write(_L8("Passed..\n "));
   700         LogFile.Write(_L8("Passed..\n "));
   659 	    CloseFile(); 
   701         CloseFile(); 
   660 	 	returnCode = KErrNone;
   702         returnCode = KErrNone;
   661 	    }
   703         }
   662  
   704 
   663  	else
   705     else
   664 	 	{
   706         {
   665 	 	OpenFile();
   707         OpenFile();
   666 	 	LogFile.Write(_L8("GetPositionAsyncOpts1 Async failed "));
   708         LogFile.Write(_L8("GetPositionAsyncOpts1 Async failed "));
   667 	    CloseFile();
   709         CloseFile();
   668 	  	returnCode = KErrGeneral;
   710         returnCode = KErrGeneral;
   669 		}
   711         }
   670  
   712 
   671  
   713 
   672   CActiveScheduler *Current = CActiveScheduler :: Current() ;
   714     CActiveScheduler *Current = CActiveScheduler :: Current() ;
   673   Current->Stop() ;
   715     Current->Stop() ;
   674   
   716 
   675   return KErrNone ;
   717     return KErrNone ;
   676 	}
   718     }
   677 
   719 
   678 TInt GetLocFunctionOpts1L()
   720 TInt GetLocFunctionOpts1L()
   679 	{
   721     {
       
   722     __UHEAP_MARK ;
   680     TInt ret;
   723     TInt ret;
   681     TPositionUpdateOptions aOptions;
   724     TPositionUpdateOptions aOptions;
   682     TTimeIntervalMicroSeconds aTimeOut = 100;
   725     TTimeIntervalMicroSeconds aTimeOut = 100;
   683   
   726 
   684     CLocationService *CoreObj = CLocationService ::NewL() ;
   727     CLocationService *CoreObj = CLocationService ::NewL() ;
   685     if( NULL == CoreObj )
   728     if( NULL == CoreObj )
   686     	{
   729         {
   687     	OpenFile();
   730         OpenFile();
   688 	    LogFile.Write(_L8("\n<GetPositionAsyncOpts1 Test>\n"));
   731         LogFile.Write(_L8("\n<GetPositionAsyncOpts1 Test>\n"));
   689 	    LogFile.Write(_L8("Failed..\n"));
   732         LogFile.Write(_L8("Failed..\n"));
   690 	    CloseFile();
   733         CloseFile();
   691    		return KErrGeneral;
   734         return KErrGeneral;
   692    		}
   735         }
   693     
   736 
   694     _LIT(Kidentity ,"Coreclass Testing" ) ;
   737     _LIT(Kidentity ,"Coreclass Testing" ) ;
   695 	//not needed any more
   738     //not needed any more
   696 	/*RRequestorStack aRequestorStack;
   739     /*RRequestorStack aRequestorStack;
   697 	
   740 
   698 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
   741 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
   699     aRequestorStack.Insert(identityInfo,0);
   742     aRequestorStack.Insert(identityInfo,0);
       
   743 
       
   744     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
       
   745 
       
   746     LocUpdateCallBackOpts1 MyUpdates(11,GETLOCATION) ;
       
   747 
       
   748     aOptions.SetUpdateTimeOut(aTimeOut);
       
   749 
       
   750     TRAP(ret,CoreObj->GetLocationL(&MyUpdates,0,NULL ,&aOptions)) ;
       
   751 
       
   752     if(KErrNone == ret)
       
   753         {
       
   754         CActiveScheduler :: Start() ;	
       
   755         }
       
   756 
       
   757     else
       
   758         {
       
   759         returnCode = KErrGeneral;	
       
   760         }
       
   761 
       
   762     //aRequestorStack.Close();
       
   763 
       
   764     delete CoreObj;
   700     
   765     
   701     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
   766     __UHEAP_MARKEND ;
   702 		
       
   703     LocUpdateCallBackOpts1 MyUpdates ;
       
   704     
       
   705     aOptions.SetUpdateTimeOut(aTimeOut);
       
   706     
       
   707     ret = CoreObj->GetLocationL(&MyUpdates,0,NULL ,&aOptions) ;
       
   708     
       
   709     if(KErrNone == ret)
       
   710 	    {
       
   711 	    CActiveScheduler :: Start() ;	
       
   712 	    }
       
   713     
       
   714     else
       
   715     	{
       
   716     	returnCode = KErrGeneral;	
       
   717     	}
       
   718         
       
   719     //aRequestorStack.Close();
       
   720     
       
   721     delete CoreObj;
       
   722     return KErrNone;;
   767     return KErrNone;;
   723 	}
   768     }
   724 
   769 
   725 
   770 
   726 TInt CSAPILocTest::GetPositionAsyncOpts1( CStifItemParser& /*aItem*/ )
   771 TInt CSAPILocTest::GetPositionAsyncOpts1( CStifItemParser& /*aItem*/ )
   727 	{
   772     {
   728     TRequestStatus status = KRequestPending;
   773     TRequestStatus status = KRequestPending;
   729     TInt aRet = KErrNone;
   774     TInt aRet = KErrNone;
   730     returnCode = KErrNone;
   775     returnCode = KErrNone;
   731     
   776 
   732     // Print to UI
   777     // Print to UI
   733     _LIT( KSAPILocTest, "SAPILocTest" );
   778     _LIT( KSAPILocTest, "SAPILocTest" );
   734     _LIT( KExample, "GetPositionAsyncOpts1" );
   779     _LIT( KExample, "GetPositionAsyncOpts1" );
   735     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
   780     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
   736     
   781 
   737 	__UHEAP_MARK;
   782     __UHEAP_MARK;
   738 	
   783 
   739     TInt start = User::CountAllocCells();
   784     TInt start = User::CountAllocCells();
   740     TRAPD(err ,aRet = GetLocFunctionOpts1L()) ;
   785     TRAPD(err ,aRet = GetLocFunctionOpts1L()) ;
   741     if( err || aRet)
   786     if( err || aRet)
   742     returnCode = KErrGeneral;
   787         returnCode = KErrGeneral;
   743     
   788 
   744     TInt end = User::CountAllocCells();
   789     TInt end = User::CountAllocCells();
   745     
   790 
   746     __UHEAP_MARKEND;
   791     __UHEAP_MARKEND;
   747     
   792 
   748      return returnCode;  
   793     return returnCode;  
   749 	}
   794     }
   750 
   795 
   751 
   796 
   752 // -----------------------------------------------------------------------------
   797 // -----------------------------------------------------------------------------
   753 // CSAPILocTest::GetPositionAsyncOpts2
   798 // CSAPILocTest::GetPositionAsyncOpts2
   754 // -----------------------------------------------------------------------------
   799 // -----------------------------------------------------------------------------
   755 //
   800 //
   756 
   801 
   757 class LocUpdateCallBackOpts2 : public MLocationCallBack
   802 class LocUpdateCallBackOpts2 : public MLocationCallBack
   758 	{
   803     {
   759     TInt iCount ;
   804     TInt iCount ;
   760     TInt iRetStatus ;
   805     TInt iRetStatus ;
       
   806     TInt iRequestType;
       
   807     TInt iTransactionId;
   761     public :
   808     public :
   762     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
   809         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
   763     LocUpdateCallBackOpts2() :iCount(0) , iRetStatus(KErrGeneral){;}
   810         LocUpdateCallBackOpts2(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){
   764 	};
   811         iTransactionId = transId;
   765   
   812         iRequestType = req;
   766    
   813         }
       
   814 
       
   815         inline TUint GetRequestType(void) 
       
   816             {
       
   817             return iRequestType ;
       
   818             }
       
   819 
       
   820 
       
   821         /**
       
   822          * GetTransactionId function returns transcation id associated with current async object
       
   823          *
       
   824          */
       
   825         inline TInt32 GetTransactionId(void)
       
   826             {
       
   827             return iTransactionId ;
       
   828             }
       
   829     };
       
   830 
       
   831 
   767 TInt LocUpdateCallBackOpts2 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
   832 TInt LocUpdateCallBackOpts2 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
   768 	{
   833     {
   769     User::After(60000000);
   834     // User::After(60000000);
   770     if(KErrNone == aError)
   835     if(KErrNone == aError)
   771    		{
   836         {
   772 	 	 TPosition currPos1;
   837         TPosition currPos1;
   773 	 	 currPos->GetPosition(currPos1);
   838         currPos->GetPosition(currPos1);
   774 	 //	 ValidatePosition(currPos1);
   839         //	 ValidatePosition(currPos1);
   775 		 TBuf8<50> buf;
   840         TBuf8<50> buf;
   776 		 TRealFormat format ;
   841         TRealFormat format ;
   777 		 TInt64 aTime1;;
   842         TInt64 aTime1;;
   778 		 TTime aTimeStamp1;
   843         TTime aTimeStamp1;
   779 		 aTimeStamp1 = currPos1.Time();
   844         aTimeStamp1 = currPos1.Time();
   780          aTime1 = aTimeStamp1.Int64();
   845         aTime1 = aTimeStamp1.Int64();
   781          buf.Num(aTime1 , format) ;
   846         buf.Num(aTime1 , format) ;
   782          if(aTime1) 
   847         if(aTime1) 
   783          	{
   848             {
   784           	OpenFile();
   849             OpenFile();
   785             LogFile.Write(_L8("Time = "));
   850             LogFile.Write(_L8("Time = "));
   786 		    LogFile.Write(buf) ;
   851             LogFile.Write(buf) ;
   787 		    CloseFile();
   852             CloseFile();
   788 		    returnCode = KErrNone;
   853             returnCode = KErrNone;
   789 	     	}
   854             }
   790 	     else
   855         else
   791 	    	{
   856             {
   792 	    	OpenFile();
   857             OpenFile();
   793             LogFile.Write(_L8("\nFailed(Time value).."));
   858             LogFile.Write(_L8("\nFailed(Time value).."));
   794 		    CloseFile();
   859             CloseFile();
   795 		    returnCode = KErrGeneral;
   860             returnCode = KErrGeneral;
   796 	    	}
   861             }
   797 		 
   862 
   798 	  	 }
   863         }
   799 	 
   864 
   800 	 else
   865     else
   801 	 	{
   866         {
   802 	 	OpenFile();
   867         OpenFile();
   803         LogFile.Write(_L8("\nFailed(Handlenotifyl error).."));
   868         LogFile.Write(_L8("\nFailed(Handlenotifyl error).."));
   804 		CloseFile();
   869         CloseFile();
   805 		returnCode = KErrGeneral;
   870         returnCode = KErrGeneral;
   806 		}
   871         }
   807 	 
   872 
   808 	  CActiveScheduler *Current = CActiveScheduler :: Current() ;
   873     CActiveScheduler *Current = CActiveScheduler :: Current() ;
   809 	  Current->Stop() ;
   874     Current->Stop() ;
   810 	  return KErrNone ;
   875     return KErrNone ;
   811 }
   876     }
   812 
   877 
   813 
   878 
   814 TInt GetLocFunctionOpts2L()
   879 TInt GetLocFunctionOpts2L()
   815 	{
   880     {
       
   881     __UHEAP_MARK ;
   816     TInt ret;
   882     TInt ret;
   817     TPositionInfo aPosition1,aPosition2,aPosition3;  
   883     TPositionInfo aPosition1,aPosition2,aPosition3;  
   818     TPosition aPos1,aPos2,aPos3;
   884     TPosition aPos1,aPos2,aPos3;
   819     TPositionUpdateOptions aOptions;
   885     TPositionUpdateOptions aOptions;
   820     TTime start,end;
   886     TTime start,end;
   821     TTimeIntervalMicroSeconds aTimeOut =  6000000;
   887     TTimeIntervalMicroSeconds aTimeOut =  6000000;
   822 	TTimeIntervalMicroSeconds aInterval = 60000000;
   888     TTimeIntervalMicroSeconds aInterval = 60000000;
   823     TTimeIntervalMicroSeconds aActualInterval;
   889     TTimeIntervalMicroSeconds aActualInterval;
   824     
   890 
   825     CLocationService *CoreObj = CLocationService ::NewL() ;
   891     CLocationService *CoreObj = CLocationService ::NewL() ;
   826    
   892 
   827     if( NULL == CoreObj )
   893     if( NULL == CoreObj )
   828     	{
   894         {
   829     	OpenFile();
   895         OpenFile();
   830 	    LogFile.Write(_L8("\n<GetPositionAsyncOpts2 Test>\n"));
   896         LogFile.Write(_L8("\n<GetPositionAsyncOpts2 Test>\n"));
   831 	    LogFile.Write(_L8("Failed..\n"));
   897         LogFile.Write(_L8("Failed..\n"));
   832 	    CloseFile();
   898         CloseFile();
   833    		return KErrGeneral;
   899         return KErrGeneral;
   834    		}
   900         }
   835    	
   901 
   836     _LIT(Kidentity ,"Coreclass Testing" ) ;
   902     _LIT(Kidentity ,"Coreclass Testing" ) ;
   837 	//not needed any more
   903     //not needed any more
   838 	/*RRequestorStack aRequestorStack;
   904     /*RRequestorStack aRequestorStack;
   839 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
   905 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
   840     aRequestorStack.Insert(identityInfo,0);
   906     aRequestorStack.Insert(identityInfo,0);
   841     
   907 
   842     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
   908     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
   843 			
   909 
   844    	LocUpdateCallBackOpts2 MyUpdates ;
   910     LocUpdateCallBackOpts2 MyUpdates(12,GETLOCATION) ;
   845     aOptions.SetUpdateTimeOut(aTimeOut);
   911     aOptions.SetUpdateTimeOut(aTimeOut);
   846     aOptions.SetUpdateInterval(aInterval);
   912     aOptions.SetUpdateInterval(aInterval);
   847     
   913 
   848     ret = CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions) ;
   914     TRAP(ret ,CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions) );
   849     
   915 
   850     if( KErrArgument == ret )
   916     if( KErrArgument == ret )
   851     	{
   917         {
   852         OpenFile();
   918         OpenFile();
   853 		LogFile.Write(_L8("\n<GetPositionAsyncOpts1 test>\n"));
   919         LogFile.Write(_L8("\n<GetPositionAsyncOpts1 test>\n"));
   854     	LogFile.Write(_L8("Passed\n"));
   920         LogFile.Write(_L8("Passed\n"));
   855     	CloseFile();
   921         CloseFile();
   856         returnCode = KErrNone;
   922         returnCode = KErrNone;
   857 	    /*aRequestorStack.Close();
       
   858 	    delete identityInfo;*/
       
   859 	    delete CoreObj;
       
   860 	    return returnCode;	
       
   861 	   	}
       
   862    	
       
   863    	else
       
   864     	{
       
   865         /*aRequestorStack.Close();
   923         /*aRequestorStack.Close();
   866 	    delete identityInfo;*/
   924 	    delete identityInfo;*/
   867 	    delete CoreObj;
   925         delete CoreObj;
   868     	returnCode = KErrGeneral;
   926         __UHEAP_MARKEND ;
   869     	return returnCode;
   927         return returnCode;	
   870     	}
   928         }
   871  }
   929 
       
   930     else
       
   931         {
       
   932         /*aRequestorStack.Close();
       
   933 	    delete identityInfo;*/
       
   934         delete CoreObj;
       
   935         returnCode = KErrGeneral;
       
   936         __UHEAP_MARKEND ;
       
   937         return returnCode;
       
   938         }
       
   939     }
   872 
   940 
   873 
   941 
   874 TInt CSAPILocTest::GetPositionAsyncOpts2( CStifItemParser& /*aItem*/ )
   942 TInt CSAPILocTest::GetPositionAsyncOpts2( CStifItemParser& /*aItem*/ )
   875 	{
   943     {
   876     TRequestStatus status = KRequestPending;
   944     TRequestStatus status = KRequestPending;
   877 	TInt aRet = KErrNone;
   945     TInt aRet = KErrNone;
   878 	returnCode = KErrNone;	    
   946     returnCode = KErrNone;	    
   879     // Print to UI
   947     // Print to UI
   880     _LIT( KSAPILocTest, "SAPILocTest" );
   948     _LIT( KSAPILocTest, "SAPILocTest" );
   881     _LIT( KExample, "GetPositionAsyncOpts2" );
   949     _LIT( KExample, "GetPositionAsyncOpts2" );
   882     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
   950     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
   883    
   951 
   884     __UHEAP_MARK;
   952     __UHEAP_MARK;
   885     
   953 
   886     TRAPD(err ,aRet = GetLocFunctionOpts2L()) ;
   954     TRAPD(err ,aRet = GetLocFunctionOpts2L()) ;
   887     if( err || aRet )
   955     if( err || aRet )
   888     returnCode = KErrGeneral;
   956         returnCode = KErrGeneral;
   889   
   957 
   890     __UHEAP_MARKEND;
   958     __UHEAP_MARKEND;
   891     
   959 
   892     return returnCode;  
   960     return returnCode;  
   893 	}
   961     }
   894 
   962 
   895 
   963 
   896 
   964 
   897 // -----------------------------------------------------------------------------
   965 // -----------------------------------------------------------------------------
   898 // CSAPILocTest::GetPositionAsyncOpts3
   966 // CSAPILocTest::GetPositionAsyncOpts3
   899 // -----------------------------------------------------------------------------
   967 // -----------------------------------------------------------------------------
   900 //
   968 //
   901 
   969 
   902 class LocUpdateCallBackOpts3 : public MLocationCallBack
   970 class LocUpdateCallBackOpts3 : public MLocationCallBack
   903 	{
   971     {
   904     TInt iCount ;
   972     TInt iCount ;
   905     TInt iRetStatus ;
   973     TInt iRetStatus ;
       
   974     TInt iTransactionId;
       
   975     TInt iRequestType;
       
   976 
   906     public :
   977     public :
   907     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
   978         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
   908     LocUpdateCallBackOpts3() :iCount(0) , iRetStatus(KErrGeneral){;}
   979         LocUpdateCallBackOpts3(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){
       
   980         iTransactionId = transId;
       
   981         iRequestType = req;
       
   982         }
       
   983 
       
   984         inline TUint GetRequestType(void) 
       
   985             {
       
   986             return iRequestType ;
       
   987             }
       
   988 
       
   989 
       
   990         /**
       
   991          * GetTransactionId function returns transcation id associated with current async object
       
   992          *
       
   993          */
       
   994         inline TInt32 GetTransactionId(void)
       
   995             {
       
   996             return iTransactionId ;
       
   997             }
   909     };
   998     };
   910  
   999 
   911    
  1000 
   912 TInt LocUpdateCallBackOpts3 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  1001 TInt LocUpdateCallBackOpts3 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
   913 	{
  1002     {
   914     User::After(60000000);
  1003     //  User::After(60000000);
   915     if(KErrNone == aError)
  1004     if(KErrNone == aError)
   916 		 {
  1005         {
   917 		 OpenFile();
  1006         OpenFile();
   918 		 LogFile.Write(_L8("\n<GetPositionAsyncOpts3 test>\n"));
  1007         LogFile.Write(_L8("\n<GetPositionAsyncOpts3 test>\n"));
   919 	     CloseFile();
  1008         CloseFile();
   920 	     TBuf8<50> buf;
  1009         TBuf8<50> buf;
   921 		 TRealFormat format ;
  1010         TRealFormat format ;
   922 		 TInt64 aTime1;;
  1011         TInt64 aTime1;;
   923 		 TTime aTimeStamp1;
  1012         TTime aTimeStamp1;
   924 		 TPosition currPos1;
  1013         TPosition currPos1;
   925 		 currPos->GetPosition(currPos1);
  1014         currPos->GetPosition(currPos1);
   926 		 aTimeStamp1 = currPos1.Time();
  1015         aTimeStamp1 = currPos1.Time();
   927 	     aTime1 = aTimeStamp1.Int64();
  1016         aTime1 = aTimeStamp1.Int64();
   928 	     buf.Num(aTime1 , format) ;
  1017         buf.Num(aTime1 , format) ;
   929 	     if(aTime1) 
  1018         if(aTime1) 
   930 	     	{
  1019             {
   931 	        OpenFile();
  1020             OpenFile();
   932 	        LogFile.Write(_L8("Time = "));
  1021             LogFile.Write(_L8("Time = "));
   933 			LogFile.Write(buf) ;
  1022             LogFile.Write(buf) ;
   934 			LogFile.Write(_L8("\n"));
  1023             LogFile.Write(_L8("\n"));
   935 			CloseFile();
  1024             CloseFile();
   936 			returnCode = KErrNone;
  1025             returnCode = KErrNone;
   937 		    }
  1026             }
   938 		 else
  1027         else
   939 		    {
  1028             {
   940 		    OpenFile();
  1029             OpenFile();
   941 	        LogFile.Write(_L8("\nFailed to write Time value"));
  1030             LogFile.Write(_L8("\nFailed to write Time value"));
   942 		    CloseFile();
  1031             CloseFile();
   943 		    returnCode = KErrGeneral;
  1032             returnCode = KErrGeneral;
   944 		    }
  1033             }
   945 		 }
  1034         }
   946 		
  1035 
   947      else
  1036     else
   948 	 	{
  1037         {
   949 	 	OpenFile();
  1038         OpenFile();
   950         LogFile.Write(_L8("\nFailed.."));
  1039         LogFile.Write(_L8("\nFailed.."));
   951 		CloseFile();
  1040         CloseFile();
   952 		returnCode = KErrGeneral;
  1041         returnCode = KErrGeneral;
   953 	 	}
  1042         }
   954 		 
  1043 
   955 	  CActiveScheduler *Current = CActiveScheduler :: Current() ;
  1044     CActiveScheduler *Current = CActiveScheduler :: Current() ;
   956 	  Current->Stop() ;
  1045     Current->Stop() ;
   957 	  return KErrNone ;
  1046     return KErrNone ;
   958 }
  1047     }
   959 
  1048 
   960 
  1049 
   961 TInt GetLocFunctionOpts3L()
  1050 TInt GetLocFunctionOpts3L()
   962 	{
  1051     {
       
  1052     __UHEAP_MARK ;
   963     TInt ret;
  1053     TInt ret;
   964     TPositionInfo aPosition1,aPosition2,aPosition3;  
  1054     TPositionInfo aPosition1,aPosition2,aPosition3;  
   965     TPosition aPos1,aPos2,aPos3;
  1055     TPosition aPos1,aPos2,aPos3;
   966     TPositionUpdateOptions aOptions;
  1056     TPositionUpdateOptions aOptions;
   967     TTimeIntervalMicroSeconds aTimeOut =  60000000;
  1057     TTimeIntervalMicroSeconds aTimeOut =  60000000;
   968 	TTimeIntervalMicroSeconds aInterval = 6000000;
  1058     TTimeIntervalMicroSeconds aInterval = 6000000;
   969 	TBool aAcceptPartialUpdates = ETrue;
  1059     TBool aAcceptPartialUpdates = ETrue;
   970     
  1060 
   971     CLocationService *CoreObj = CLocationService ::NewL() ;
  1061     CLocationService *CoreObj = CLocationService ::NewL() ;
   972     if( NULL == CoreObj )
  1062     if( NULL == CoreObj )
   973     	{
  1063         {
   974     	OpenFile();
  1064         OpenFile();
   975 	    LogFile.Write(_L8("\n<GetPositionAsyncOpts3 Test>\n"));
  1065         LogFile.Write(_L8("\n<GetPositionAsyncOpts3 Test>\n"));
   976 	    LogFile.Write(_L8("Failed..\n"));
  1066         LogFile.Write(_L8("Failed..\n"));
   977 	    CloseFile();
  1067         CloseFile();
   978    		return KErrGeneral;
  1068         return KErrGeneral;
   979    		}
  1069         }
   980    	
  1070 
   981     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1071     _LIT(Kidentity ,"Coreclass Testing" ) ;
   982 	//not needed any more
  1072     //not needed any more
   983 	/*RRequestorStack aRequestorStack;
  1073     /*RRequestorStack aRequestorStack;
   984 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1074 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
   985     aRequestorStack.Insert(identityInfo,0);
  1075     aRequestorStack.Insert(identityInfo,0);
   986     
  1076 
   987     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1077     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
   988 			
  1078 
   989     LocUpdateCallBackOpts3 MyUpdates ;
  1079     LocUpdateCallBackOpts3 MyUpdates(29,GETLOCATION) ;
   990     
  1080 
   991     aOptions.SetUpdateTimeOut(aTimeOut);
  1081     aOptions.SetUpdateTimeOut(aTimeOut);
   992     aOptions.SetUpdateInterval(aInterval);
  1082     aOptions.SetUpdateInterval(aInterval);
   993     aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates);
  1083     aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates);
   994     
  1084 
   995     ret = CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions) ;
  1085     TRAP(ret,CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions)) ;
   996     
  1086 
   997     if( KErrNone == ret)
  1087     if( KErrNone == ret)
   998     	{
  1088         {
   999     	CActiveScheduler :: Start() ;
  1089         CActiveScheduler :: Start() ;
  1000 	    if( KErrNone == returnCode )
  1090         if( KErrNone == returnCode )
  1001 	    	{
  1091             {
  1002 		    CoreObj->GetLocationL(&aPosition1,&aOptions);
  1092             CoreObj->GetLocationL(&aPosition1,&aOptions);
  1003 		    //CoreObj->GetLocationL(&aPosition2,&aOptions);
  1093             //CoreObj->GetLocationL(&aPosition2,&aOptions);
  1004 		    //CoreObj->GetLocationL(&aPosition3,&aOptions);
  1094             //CoreObj->GetLocationL(&aPosition3,&aOptions);
  1005 		    
  1095 
  1006 		    aPosition1.GetPosition(aPos1);
  1096             aPosition1.GetPosition(aPos1);
  1007 		    
  1097 
  1008 		    returnCode = ValidatePosition(aPos1);
  1098             returnCode = ValidatePosition(aPos1);
  1009 			    
  1099 
  1010 			/*    if( KErrNone == returnCode)
  1100             /*    if( KErrNone == returnCode)
  1011 			    	{
  1101 			    	{
  1012 			       	aPosition2.GetPosition(aPos2);
  1102 			       	aPosition2.GetPosition(aPos2);
  1013 			       	returnCode = ValidatePosition(aPos2);
  1103 			       	returnCode = ValidatePosition(aPos2);
  1014 			    	}
  1104 			    	}
  1015 			    
  1105 
  1016 			    if( KErrNone == returnCode)
  1106 			    if( KErrNone == returnCode)
  1017 			    	{
  1107 			    	{
  1018 			       	aPosition3.GetPosition(aPos3);
  1108 			       	aPosition3.GetPosition(aPos3);
  1019 			    	returnCode = ValidatePosition(aPos3);
  1109 			    	returnCode = ValidatePosition(aPos3);
  1020 			    	}
  1110 			    	}
  1021 		    */
  1111              */
  1022 		    //aRequestorStack.Close();
  1112             //aRequestorStack.Close();
  1023 		    
  1113 
  1024 		    delete CoreObj;
  1114             delete CoreObj;
  1025 			return returnCode;	
  1115             __UHEAP_MARKEND ;
  1026 	    	}
  1116             return returnCode;	
  1027 	    else
  1117             }
  1028 	    	{
  1118         else
  1029 	    	//aRequestorStack.Close();
  1119             {
  1030 			
  1120             //aRequestorStack.Close();
  1031 			delete CoreObj;
  1121 
  1032 	    	return returnCode;
  1122             delete CoreObj;
  1033 	    	}
  1123             __UHEAP_MARKEND ;
  1034 	   	}
  1124             return returnCode;
  1035     
  1125             }
  1036     else
  1126         }
  1037     	{
  1127 
  1038     	/*aRequestorStack.Close();
  1128     else
       
  1129         {
       
  1130         /*aRequestorStack.Close();
  1039 	    delete identityInfo;*/
  1131 	    delete identityInfo;*/
  1040 	    delete CoreObj;
  1132         delete CoreObj;
  1041     	return KErrGeneral;
  1133         __UHEAP_MARKEND ;
  1042     	}
  1134         return KErrGeneral;
  1043 	}
  1135         }
       
  1136     }
  1044 
  1137 
  1045 
  1138 
  1046 TInt CSAPILocTest::GetPositionAsyncOpts3( CStifItemParser& /*aItem*/ )
  1139 TInt CSAPILocTest::GetPositionAsyncOpts3( CStifItemParser& /*aItem*/ )
  1047 {
  1140     {
  1048     
  1141 
  1049    TRequestStatus status = KRequestPending;
  1142     TRequestStatus status = KRequestPending;
  1050    TInt aRet = KErrNone;
  1143     TInt aRet = KErrNone;
  1051    returnCode = KErrNone;
  1144     returnCode = KErrNone;
  1052 	    
  1145 
  1053     // Print to UI
  1146     // Print to UI
  1054     _LIT( KSAPILocTest, "SAPILocTest" );
  1147     _LIT( KSAPILocTest, "SAPILocTest" );
  1055     _LIT( KExample, "GetPositionAsyncOpts3" );
  1148     _LIT( KExample, "GetPositionAsyncOpts3" );
  1056     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1149     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1057     
  1150 
  1058     __UHEAP_MARK;
  1151     __UHEAP_MARK;
  1059    
  1152 
  1060     TRAPD(err , aRet = GetLocFunctionOpts3L()) ;
  1153     TRAPD(err , aRet = GetLocFunctionOpts3L()) ;
  1061     if( err || aRet )
  1154     if( err || aRet )
  1062     returnCode = KErrGeneral;
  1155         returnCode = KErrGeneral;
  1063    
  1156 
  1064     __UHEAP_MARKEND;
  1157     __UHEAP_MARKEND;
  1065     
  1158 
  1066      return returnCode;  
  1159     return returnCode;  
  1067 }
  1160     }
  1068 
  1161 
  1069 
  1162 
  1070 // -----------------------------------------------------------------------------
  1163 // -----------------------------------------------------------------------------
  1071 // CSAPILocTest::GetPositionAsyncOpts4
  1164 // CSAPILocTest::GetPositionAsyncOpts4
  1072 // -----------------------------------------------------------------------------
  1165 // -----------------------------------------------------------------------------
  1073 //
  1166 //
  1074 
  1167 
  1075 class LocUpdateCallBackOpts4 : public MLocationCallBack
  1168 class LocUpdateCallBackOpts4 : public MLocationCallBack
  1076 	{
  1169     {
  1077     TInt iCount ;
  1170     TInt iCount ;
  1078     TInt iRetStatus ;
  1171     TInt iRetStatus ;
       
  1172     TInt iTransactionId;
       
  1173     TInt iRequestType;
  1079     public :
  1174     public :
  1080     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  1175         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  1081     LocUpdateCallBackOpts4() :iCount(0) , iRetStatus(KErrGeneral){;}
  1176         LocUpdateCallBackOpts4(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){
       
  1177         iTransactionId = transId;
       
  1178         iRequestType = req;
       
  1179         }
       
  1180 
       
  1181         inline TUint GetRequestType(void) 
       
  1182             {
       
  1183             return iRequestType ;
       
  1184             }
       
  1185 
       
  1186 
       
  1187         /**
       
  1188          * GetTransactionId function returns transcation id associated with current async object
       
  1189          *
       
  1190          */
       
  1191         inline TInt32 GetTransactionId(void)
       
  1192             {
       
  1193             return iTransactionId ;
       
  1194             }
  1082     };
  1195     };
  1083   
  1196 
  1084    
  1197 
  1085 TInt LocUpdateCallBackOpts4 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  1198 TInt LocUpdateCallBackOpts4 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  1086 	{
  1199     {
  1087     User::After(120000000);
  1200     //User::After(120000000);
  1088 
  1201 
  1089     if(KErrNone == aError)
  1202     if(KErrNone == aError)
  1090     {
  1203         {
  1091  	TPosition currPos1;
  1204         TPosition currPos1;
  1092  	currPos->GetPosition(currPos1);
  1205         currPos->GetPosition(currPos1);
  1093  	
  1206 
  1094 	TBuf8<50> buf;
  1207         TBuf8<50> buf;
  1095 	TRealFormat format ;
  1208         TRealFormat format ;
  1096 	TInt64 aTime1;
  1209         TInt64 aTime1;
  1097 	TTime aTimeStamp1;
  1210         TTime aTimeStamp1;
  1098 	
  1211 
  1099 	aTimeStamp1 = currPos1.Time();
  1212         aTimeStamp1 = currPos1.Time();
  1100     aTime1 = aTimeStamp1.Int64();
  1213         aTime1 = aTimeStamp1.Int64();
  1101     buf.Num(aTime1 , format) ;
  1214         buf.Num(aTime1 , format) ;
  1102     
  1215 
  1103     if(aTime1) 
  1216         if(aTime1) 
  1104     	{
  1217             {
  1105       	OpenFile();
  1218             OpenFile();
  1106         LogFile.Write(_L8("Time = "));
  1219             LogFile.Write(_L8("Time = "));
  1107 	    LogFile.Write(buf) ;
  1220             LogFile.Write(buf) ;
  1108 	    LogFile.Write(_L8("\n"));
  1221             LogFile.Write(_L8("\n"));
  1109 	    CloseFile();
  1222             CloseFile();
  1110 	    returnCode = KErrNone;
  1223             returnCode = KErrNone;
  1111      	}
  1224             }
  1112     else
  1225         else
  1113     	{
  1226             {
  1114     	OpenFile();
  1227             OpenFile();
  1115         LogFile.Write(_L8("\nFailed(No TimeStamp).. "));
  1228             LogFile.Write(_L8("\nFailed(No TimeStamp).. "));
  1116 	    CloseFile();
  1229             CloseFile();
  1117 	    returnCode = KErrGeneral;
  1230             returnCode = KErrGeneral;
  1118     	}
  1231             }
  1119 	}
  1232         }
  1120 	
  1233 
  1121  else
  1234     else
  1122  	{
  1235         {
  1123  	OpenFile();
  1236         OpenFile();
  1124     LogFile.Write(_L8("\nFailed(HandleNotifyL error).."));
  1237         LogFile.Write(_L8("\nFailed(HandleNotifyL error).."));
  1125 	CloseFile();
  1238         CloseFile();
  1126 	returnCode = KErrGeneral;
  1239         returnCode = KErrGeneral;
  1127  	}
  1240         }
  1128 	 
  1241 
  1129   CActiveScheduler *Current = CActiveScheduler :: Current() ;
  1242     CActiveScheduler *Current = CActiveScheduler :: Current() ;
  1130   Current->Stop() ;
  1243     Current->Stop() ;
  1131   return returnCode ;
  1244     return returnCode ;
  1132 }
  1245     }
  1133 
  1246 
  1134 
  1247 
  1135 TInt GetLocFunctionOpts4L()
  1248 TInt GetLocFunctionOpts4L()
  1136 {
  1249     {
       
  1250     __UHEAP_MARK ;
  1137     TInt ret;
  1251     TInt ret;
  1138     TPositionInfo aPosition1;  
  1252     TPositionInfo aPosition1;  
  1139     TPosition aPos1;
  1253     TPosition aPos1;
  1140     TPositionUpdateOptions aOptions;
  1254     TPositionUpdateOptions aOptions;
  1141     TTimeIntervalMicroSeconds aTimeOut =  10000000;
  1255     TTimeIntervalMicroSeconds aTimeOut =  10000000;
  1142 	TTimeIntervalMicroSeconds aInterval = 6000000;
  1256     TTimeIntervalMicroSeconds aInterval = 6000000;
  1143 	TBool aAcceptPartialUpdates = EFalse;
  1257     TBool aAcceptPartialUpdates = EFalse;
  1144     
  1258 
  1145     CLocationService *CoreObj = CLocationService ::NewL() ;
  1259     CLocationService *CoreObj = CLocationService ::NewL() ;
  1146     
  1260 
  1147     if( NULL == CoreObj )
  1261     if( NULL == CoreObj )
  1148     	{
  1262         {
  1149     	OpenFile();
  1263         OpenFile();
  1150 	    LogFile.Write(_L8("\n<GetPositionAsyncOpts4 Test>\n"));
  1264         LogFile.Write(_L8("\n<GetPositionAsyncOpts4 Test>\n"));
  1151 	    LogFile.Write(_L8("Failed(Null CoreObj)..\n"));
  1265         LogFile.Write(_L8("Failed(Null CoreObj)..\n"));
  1152 	    CloseFile();
  1266         CloseFile();
  1153    		return KErrGeneral;
  1267         return KErrGeneral;
  1154    		}
  1268         }
  1155     
  1269 
  1156     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1270     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1157 	//not needed any more
  1271     //not needed any more
  1158 	/*RRequestorStack aRequestorStack;
  1272     /*RRequestorStack aRequestorStack;
  1159 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1273 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1160     aRequestorStack.Insert(identityInfo,0);
  1274     aRequestorStack.Insert(identityInfo,0);
  1161     
  1275 
  1162     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1276     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1163 		
  1277 
  1164     LocUpdateCallBackOpts4 MyUpdates ;
  1278     LocUpdateCallBackOpts4 MyUpdates(30,GETLOCATION) ;
  1165     
  1279 
  1166     aOptions.SetUpdateTimeOut(aTimeOut);
  1280     aOptions.SetUpdateTimeOut(aTimeOut);
  1167     aOptions.SetUpdateInterval(aInterval);
  1281     aOptions.SetUpdateInterval(aInterval);
  1168     aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates);
  1282     aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates);
  1169     
  1283 
  1170    	OpenFile();
  1284     OpenFile();
  1171 	LogFile.Write(_L8("\n<GetPositionAsyncOpts4 test>\n"));
  1285     LogFile.Write(_L8("\n<GetPositionAsyncOpts4 test>\n"));
  1172 	CloseFile();
  1286     CloseFile();
  1173     ret = CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions) ;
  1287     TRAP(ret , CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions) );
  1174     if( KErrNone == ret)
  1288     if( KErrNone == ret)
  1175     	{
  1289         {
  1176     	CActiveScheduler :: Start() ;
  1290         CActiveScheduler :: Start() ;
  1177 	    if( KErrNone == returnCode )
  1291         if( KErrNone == returnCode )
  1178 		    {
  1292             {
  1179 		    CoreObj->GetLocationL(&aPosition1,&aOptions);
  1293             CoreObj->GetLocationL(&aPosition1,&aOptions);
  1180 		    aPosition1.GetPosition(aPos1);
  1294             aPosition1.GetPosition(aPos1);
  1181 		    
  1295 
  1182 		   // ValidatePosition(aPos1);
  1296             // ValidatePosition(aPos1);
  1183 	
  1297 
  1184 			/*aRequestorStack.Close();
  1298             /*aRequestorStack.Close();
  1185 		    delete identityInfo;*/
  1299 		    delete identityInfo;*/
  1186 		    delete CoreObj;
  1300             delete CoreObj;
  1187 			return returnCode;	
  1301             __UHEAP_MARKEND ;
  1188 		    }
  1302             return returnCode;	
  1189 		  else
  1303             }
  1190 		  	{
  1304         else
  1191 		  	/*aRequestorStack.Close();
  1305             {
       
  1306             /*aRequestorStack.Close();
  1192 		    delete identityInfo;*/
  1307 		    delete identityInfo;*/
  1193 		    delete CoreObj;
  1308             delete CoreObj;
  1194 		  	return returnCode;
  1309             __UHEAP_MARKEND ;
  1195 		  	}
  1310             return returnCode;
  1196     	}
  1311             }
  1197     
  1312         }
  1198     else
  1313 
  1199     	{
  1314     else
  1200     	/*aRequestorStack.Close();
  1315         {
       
  1316         /*aRequestorStack.Close();
  1201 	    delete identityInfo;*/
  1317 	    delete identityInfo;*/
  1202 	    delete CoreObj;
  1318         delete CoreObj;
  1203     	return returnCode;
  1319         __UHEAP_MARKEND ;
  1204     	}
  1320         return returnCode;
  1205 }
  1321         }
       
  1322     }
  1206 
  1323 
  1207 
  1324 
  1208 TInt CSAPILocTest::GetPositionAsyncOpts4( CStifItemParser& /*aItem*/ )
  1325 TInt CSAPILocTest::GetPositionAsyncOpts4( CStifItemParser& /*aItem*/ )
  1209 	{
  1326     {
  1210     
  1327 
  1211     TInt aRet = KErrNone;
  1328     TInt aRet = KErrNone;
  1212     returnCode = KErrNone;
  1329     returnCode = KErrNone;
  1213     // Print to UI
  1330     // Print to UI
  1214     _LIT( KSAPILocTest, "SAPILocTest" );
  1331     _LIT( KSAPILocTest, "SAPILocTest" );
  1215     _LIT( KExample, "GetPositionAsyncOpts4" );
  1332     _LIT( KExample, "GetPositionAsyncOpts4" );
  1216     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1333     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1217     
  1334 
  1218     __UHEAP_MARK;
  1335     __UHEAP_MARK;
  1219     
  1336 
  1220     TRAPD(err , aRet = GetLocFunctionOpts4L()) ;
  1337     TRAPD(err , aRet = GetLocFunctionOpts4L()) ;
  1221     if( err )
  1338     if( err )
  1222     returnCode = KErrGeneral; 
  1339         returnCode = KErrGeneral; 
  1223     
  1340 
  1224     __UHEAP_MARKEND;
  1341     __UHEAP_MARKEND;
  1225     
  1342 
  1226      return returnCode;  
  1343     return returnCode;  
  1227 	}
  1344     }
  1228 
  1345 
  1229 
  1346 
  1230 // -----------------------------------------------------------------------------
  1347 // -----------------------------------------------------------------------------
  1231 // CSAPILocTest::GetPositionAsyncOpts5
  1348 // CSAPILocTest::GetPositionAsyncOpts5
  1232 // -----------------------------------------------------------------------------
  1349 // -----------------------------------------------------------------------------
  1233 //
  1350 //
  1234 
  1351 
  1235 TInt GetLocFunctionOpts5L()
  1352 TInt GetLocFunctionOpts5L()
  1236 	{
  1353     {
  1237     TInt ret1,ret2;
  1354     TInt ret1,ret2;
  1238     TPositionInfo aPosition1,aPosition2,aPosition3;  
  1355     TPositionInfo aPosition1,aPosition2,aPosition3;  
  1239     TPosition aPos1,aPos2,aPos3;
  1356     TPosition aPos1,aPos2,aPos3;
  1240     TPositionUpdateOptions aOptions;
  1357     TPositionUpdateOptions aOptions;
  1241     TTimeIntervalMicroSeconds aTimeOut =  10000000;
  1358     TTimeIntervalMicroSeconds aTimeOut =  10000000;
  1242 	TTimeIntervalMicroSeconds aInterval = 6000000;
  1359     TTimeIntervalMicroSeconds aInterval = 6000000;
  1243 	TBool aAcceptPartialUpdates = ETrue;
  1360     TBool aAcceptPartialUpdates = ETrue;
  1244     
  1361     __UHEAP_MARK ;
  1245     CLocationService *CoreObj = CLocationService ::NewL() ;
  1362     CLocationService *CoreObj = CLocationService ::NewL() ;
  1246     if( NULL == CoreObj )
  1363     if( NULL == CoreObj )
  1247     	{
  1364         {
  1248     	OpenFile();
  1365         OpenFile();
  1249 	    LogFile.Write(_L8("\n<GetPositionAsyncOpts5 Test>\n"));
  1366         LogFile.Write(_L8("\n<GetPositionAsyncOpts5 Test>\n"));
  1250 	    LogFile.Write(_L8("Failed(CoreObj Creation)..\n"));
  1367         LogFile.Write(_L8("Failed(CoreObj Creation)..\n"));
  1251 	    CloseFile();
  1368         CloseFile();
  1252    		return KErrGeneral;
  1369         return KErrGeneral;
  1253    		}
  1370         }
  1254     
  1371 
  1255     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1372     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1256 	//not needed any more
  1373     //not needed any more
  1257 	/*RRequestorStack aRequestorStack;
  1374     /*RRequestorStack aRequestorStack;
  1258 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1375 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1259     aRequestorStack.Insert(identityInfo,0);
  1376     aRequestorStack.Insert(identityInfo,0);
  1260     
  1377 
  1261     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1378     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1262 		
  1379 
  1263     LocUpdateCallBackOpts4 MyUpdates1 ;
  1380     LocUpdateCallBackOpts4 MyUpdates1(32,GETLOCATION) ;
  1264     LocUpdateCallBackOpts4 MyUpdates2 ;
  1381     LocUpdateCallBackOpts4 MyUpdates2(33,GETLOCATION) ;
  1265     
  1382 
  1266     aOptions.SetUpdateTimeOut(aTimeOut);
  1383     aOptions.SetUpdateTimeOut(aTimeOut);
  1267     aOptions.SetUpdateInterval(aInterval);
  1384     aOptions.SetUpdateInterval(aInterval);
  1268     aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates);
  1385     aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates);
  1269     
  1386 
  1270    	OpenFile();
  1387     OpenFile();
  1271 	LogFile.Write(_L8("\n<GetPositionAsyncOpts5 test>\n"));
  1388     LogFile.Write(_L8("\n<GetPositionAsyncOpts5 test>\n"));
  1272 	CloseFile();
  1389     CloseFile();
  1273 	
  1390 
  1274 	ret1 = CoreObj->GetLocationL(&MyUpdates1) ;
  1391     TRAP(ret1 ,CoreObj->GetLocationL(&MyUpdates1) );
  1275     
  1392 
  1276     ret2 = CoreObj->GetLocationL(&MyUpdates2) ;
  1393     TRAP(ret2, CoreObj->GetLocationL(&MyUpdates2)) ;
  1277     
  1394 
  1278     if( KErrNone == ret1 && KErrInUse == ret2 )
  1395     if( KErrNone == ret1 && KErrNone == ret2 )
  1279     	{
  1396         {
  1280     	TBuf8<20> retBuf;
  1397         TBuf8<20> retBuf;
  1281     	TRealFormat retFormat;
  1398         TRealFormat retFormat;
  1282     	
  1399 
  1283     	CActiveScheduler :: Start() ;
  1400         CActiveScheduler :: Start() ;
  1284 		
  1401 
  1285 		OpenFile();
  1402         OpenFile();
  1286 		LogFile.Write(_L8("\nreturnCode : "));
  1403         LogFile.Write(_L8("\nreturnCode : "));
  1287 		LogFile.Write(retBuf);
  1404         LogFile.Write(retBuf);
  1288 		CloseFile();
  1405         CloseFile();
  1289 		}
  1406         }
  1290     
  1407 
  1291     else
  1408     else
  1292     	{
  1409         {
  1293     	returnCode = KErrGeneral;	
  1410         returnCode = KErrGeneral;	
  1294     	}
  1411         }
  1295     //aRequestorStack.Close();
  1412     //aRequestorStack.Close();
  1296     
  1413 
  1297     delete CoreObj;
  1414     delete CoreObj;
       
  1415     __UHEAP_MARKEND ;
  1298     return 0;
  1416     return 0;
  1299 	}
  1417     }
  1300 
  1418 
  1301 
  1419 
  1302 TInt CSAPILocTest::GetPositionAsyncOpts5( CStifItemParser& /*aItem*/ )
  1420 TInt CSAPILocTest::GetPositionAsyncOpts5( CStifItemParser& /*aItem*/ )
  1303 	{
  1421     {
  1304      TInt aRet = KErrNone;
  1422     TInt aRet = KErrNone;
  1305      returnCode = KErrNone;
  1423     returnCode = KErrNone;
  1306      // Print to UI
  1424     // Print to UI
  1307      _LIT( KSAPILocTest, "SAPILocTest" );
  1425     _LIT( KSAPILocTest, "SAPILocTest" );
  1308      _LIT( KExample, "GetPositionAsyncOpts5" );
  1426     _LIT( KExample, "GetPositionAsyncOpts5" );
  1309      TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1427     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1310     
  1428 
  1311      __UHEAP_MARK;
  1429     __UHEAP_MARK;
  1312    
  1430 
  1313     TRAPD(err ,aRet =  GetLocFunctionOpts5L()) ;
  1431     TRAPD(err ,aRet =  GetLocFunctionOpts5L()) ;
  1314     if( err || aRet )
  1432     if( err || aRet )
  1315     returnCode = KErrGeneral;
  1433         returnCode = KErrGeneral;
  1316    
  1434 
  1317     __UHEAP_MARKEND;
  1435     __UHEAP_MARKEND;
  1318    
  1436 
  1319     return returnCode;  
  1437     return returnCode;  
  1320 	}
  1438     }
  1321 
  1439 
  1322 
  1440 
  1323 
  1441 
  1324 // -----------------------------------------------------------------------------
  1442 // -----------------------------------------------------------------------------
  1325 // CSAPILocTest::GetPositionAsyncOpts6
  1443 // CSAPILocTest::GetPositionAsyncOpts6
  1326 // -----------------------------------------------------------------------------
  1444 // -----------------------------------------------------------------------------
  1327 //
  1445 //
  1328 TInt GetLocFunctionOpts6L()
  1446 TInt GetLocFunctionOpts6L()
  1329 	{
  1447     {
       
  1448     __UHEAP_MARK ;
  1330     TInt aRet,aRet1;
  1449     TInt aRet,aRet1;
  1331     TPosition aPosition1;  
  1450     TPosition aPosition1;  
  1332     TPositionUpdateOptions aOptions;
  1451     TPositionUpdateOptions aOptions;
  1333     TTimeIntervalMicroSeconds aTimeOut =  60000000;
  1452     TTimeIntervalMicroSeconds aTimeOut =  60000000;
  1334 	TTimeIntervalMicroSeconds aInterval = 6000000;
  1453     TTimeIntervalMicroSeconds aInterval = 6000000;
  1335 	TBool aAcceptPartialUpdates = ETrue;
  1454     TBool aAcceptPartialUpdates = ETrue;
  1336     
  1455 
  1337     CLocationService *CoreObj = CLocationService ::NewL() ;
  1456     CLocationService *CoreObj = CLocationService ::NewL() ;
  1338     if( NULL == CoreObj )
  1457     if( NULL == CoreObj )
  1339     	{
  1458         {
  1340     	OpenFile();
  1459         OpenFile();
  1341 	    LogFile.Write(_L8("\n<GetPositionAsyncOpts6 Test>\n"));
  1460         LogFile.Write(_L8("\n<GetPositionAsyncOpts6 Test>\n"));
  1342 	    LogFile.Write(_L8("Failed(Null CoreObj)..\n"));
  1461         LogFile.Write(_L8("Failed(Null CoreObj)..\n"));
  1343 	    CloseFile();
  1462         CloseFile();
  1344    		return KErrGeneral;
  1463         return KErrGeneral;
  1345    		}
  1464         }
  1346    
  1465 
  1347     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1466     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1348 	//not needed any more
  1467     //not needed any more
  1349 	/*RRequestorStack aRequestorStack;
  1468     /*RRequestorStack aRequestorStack;
  1350 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1469 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1351     aRequestorStack.Insert(identityInfo,0);
  1470     aRequestorStack.Insert(identityInfo,0);
  1352     
  1471 
  1353     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1472     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1354 				
  1473 
  1355     LocUpdateCallBackOpts2 MyUpdates ;
  1474     LocUpdateCallBackOpts2 MyUpdates(13,GETLOCATION) ;
  1356     
  1475 
  1357     aOptions.SetUpdateTimeOut(aTimeOut);
  1476     aOptions.SetUpdateTimeOut(aTimeOut);
  1358     aOptions.SetUpdateInterval(aInterval);
  1477     aOptions.SetUpdateInterval(aInterval);
  1359     aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates);
  1478     aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates);
  1360     
  1479 
  1361     aRet = CoreObj->GetLocationL(&MyUpdates) ;
  1480     TRAP(aRet , CoreObj->GetLocationL(&MyUpdates) );
  1362     
  1481 
  1363     if( KErrNone == aRet )
  1482     if( KErrNone == aRet )
  1364     	{
  1483         {
  1365     	aRet1 = CoreObj->CancelOnGoingService(0);
  1484         aRet1 = CoreObj->CancelOnGoingService(0);
  1366     	if( KErrNone == aRet1 )
  1485         if( KErrNone == aRet1 )
  1367     		{
  1486             {
  1368     	    TBuf8<20> retBuf;
  1487             TBuf8<20> retBuf;
  1369     	    TRealFormat retFormat;
  1488             TRealFormat retFormat;
  1370     	    aRet = CoreObj->GetLocationL(&MyUpdates) ;
  1489             TRAP(aRet ,CoreObj->GetLocationL(&MyUpdates)) ;
  1371     	    if( KErrNone == aRet)
  1490             if( KErrNone == aRet)
  1372     	    OpenFile();
  1491                 OpenFile();
  1373 		 	LogFile.Write(_L8("\n<GetPositionAsyncOpts6 test>\n"));
  1492             LogFile.Write(_L8("\n<GetPositionAsyncOpts6 test>\n"));
  1374     	 	CloseFile();
  1493             CloseFile();
  1375     	    CActiveScheduler :: Start() ;
  1494             CActiveScheduler :: Start() ;
  1376     		retBuf.Num(returnCode,retFormat);
  1495             retBuf.Num(returnCode,retFormat);
  1377     		OpenFile();
  1496             OpenFile();
  1378     		LogFile.Write(_L8("\nreturnCode : "));
  1497             LogFile.Write(_L8("\nreturnCode : "));
  1379     		LogFile.Write(retBuf);
  1498             LogFile.Write(retBuf);
  1380     		CloseFile();
  1499             CloseFile();
  1381     		}
  1500             }
  1382     	else
  1501         else
  1383     		{
  1502             {
  1384     		returnCode = KErrGeneral;
  1503             returnCode = KErrGeneral;
  1385     		}
  1504             }
  1386     	}
  1505         }
  1387     else
  1506     else
  1388     	{
  1507         {
  1389     	returnCode = KErrGeneral;	
  1508         returnCode = KErrGeneral;	
  1390     	}
  1509         }
  1391     
  1510 
  1392     //aRequestorStack.Close();
  1511     //aRequestorStack.Close();
  1393 	
  1512 
  1394 	delete CoreObj;
  1513     delete CoreObj;
       
  1514     __UHEAP_MARKEND ;
  1395     return 0;
  1515     return 0;
  1396 	}
  1516     }
  1397 
  1517 
  1398 
  1518 
  1399 TInt CSAPILocTest::GetPositionAsyncOpts6( CStifItemParser& /*aItem*/ )
  1519 TInt CSAPILocTest::GetPositionAsyncOpts6( CStifItemParser& /*aItem*/ )
  1400 	{
  1520     {
  1401     TInt aRet = KErrNone;
  1521     TInt aRet = KErrNone;
  1402     returnCode = KErrNone;
  1522     returnCode = KErrNone;
  1403    
  1523 
  1404     // Print to UI
  1524     // Print to UI
  1405     _LIT( KSAPILocTest, "SAPILocTest" );
  1525     _LIT( KSAPILocTest, "SAPILocTest" );
  1406     _LIT( KExample, "GetPositionAsyncOpts6" );
  1526     _LIT( KExample, "GetPositionAsyncOpts6" );
  1407     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1527     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1408     
  1528 
  1409     __UHEAP_MARK;
  1529     __UHEAP_MARK;
  1410     
  1530 
  1411     TRAPD(err , aRet = GetLocFunctionOpts6L()) ;
  1531     TRAPD(err , aRet = GetLocFunctionOpts6L()) ;
  1412     
  1532 
  1413     __UHEAP_MARKEND;
  1533     __UHEAP_MARKEND;
  1414    
  1534 
  1415     return returnCode;  
  1535     return returnCode;  
  1416 	}
  1536     }
  1417 
  1537 
  1418 
  1538 
  1419 // -----------------------------------------------------------------------------
  1539 // -----------------------------------------------------------------------------
  1420 // CSAPILocTest::TraceLPosition
  1540 // CSAPILocTest::TraceLPosition
  1421 // -----------------------------------------------------------------------------
  1541 // -----------------------------------------------------------------------------
  1422 //
  1542 //
  1423 
  1543 
  1424 class TraceLCallBack : public MLocationCallBack
  1544 class TraceLCallBack : public MLocationCallBack
  1425 	{
  1545     {
  1426     TInt iCount ;
  1546     TInt iCount ;
  1427     TInt iRetStatus ;
  1547     TInt iRetStatus ;
       
  1548     TInt iRequestType;
       
  1549     TInt iTransactionId;
  1428     public :
  1550     public :
  1429     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  1551         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  1430     TraceLCallBack() :iCount(0) , iRetStatus(KErrGeneral){;}
  1552         TraceLCallBack(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){
       
  1553         iTransactionId = transId;
       
  1554         iRequestType = req;
       
  1555         }
       
  1556 
       
  1557         inline TUint GetRequestType(void) 
       
  1558             {
       
  1559             return iRequestType ;
       
  1560             }
       
  1561 
       
  1562 
       
  1563         /**
       
  1564          * GetTransactionId function returns transcation id associated with current async object
       
  1565          *
       
  1566          */
       
  1567         inline TInt32 GetTransactionId(void)
       
  1568             {
       
  1569             return iTransactionId ;
       
  1570             }
  1431     };
  1571     };
  1432   
  1572 
  1433   
  1573 
  1434   
  1574 
  1435 TInt TraceLCallBack :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  1575 TInt TraceLCallBack :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  1436 	{
  1576     {
  1437 //	User::After(60000000);
  1577     //	User::After(60000000);
  1438 	if(KErrNone == aError && iCount<2)
  1578     if(KErrNone == aError && iCount<2)
  1439 		{
  1579         {
  1440 		TPosition currPos1;
  1580         TPosition currPos1;
  1441 		currPos->GetPosition(currPos1);
  1581         currPos->GetPosition(currPos1);
  1442 	//	ValidatePosition(currPos1);
  1582         //	ValidatePosition(currPos1);
  1443 	    iCount++;	 
  1583         iCount++;	 
  1444 		}
  1584         }
  1445 	 else
  1585     else
  1446 	 	{
  1586         {
  1447 	 	 CActiveScheduler *Current = CActiveScheduler :: Current() ;
  1587         CActiveScheduler *Current = CActiveScheduler :: Current() ;
  1448 	  	 Current->Stop() ;
  1588         Current->Stop() ;
  1449 	  	// returnCode = KErrNone;
  1589         // returnCode = KErrNone;
  1450 	  	}
  1590         }
  1451 	 return returnCode;
  1591     return returnCode;
  1452 	 }
  1592     }
  1453 	 
  1593 
  1454 
  1594 
  1455 TInt TraceLFunctionL()
  1595 TInt TraceLFunctionL()
  1456 	{
  1596     {
       
  1597     __UHEAP_MARK ;
  1457     TInt ret;
  1598     TInt ret;
  1458     TPosition aPosition1;  
  1599     TPosition aPosition1;  
  1459     
  1600 
  1460     CLocationService *CoreObj = CLocationService ::NewL() ;
  1601     CLocationService *CoreObj = CLocationService ::NewL() ;
  1461     if( NULL == CoreObj )
  1602     if( NULL == CoreObj )
  1462     	{
  1603         {
  1463     	OpenFile();
  1604         OpenFile();
  1464 	    LogFile.Write(_L8("\n<TraceLPosition Test>\n"));
  1605         LogFile.Write(_L8("\n<TraceLPosition Test>\n"));
  1465 	    LogFile.Write(_L8("Failed..\n"));
  1606         LogFile.Write(_L8("Failed..\n"));
  1466 	    CloseFile();
  1607         CloseFile();
  1467    		return KErrGeneral;
  1608         return KErrGeneral;
  1468    		}
  1609         }
  1469     
  1610 
  1470     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1611     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1471 	//not needed any more
  1612     //not needed any more
  1472 	/*RRequestorStack aRequestorStack;
  1613     /*RRequestorStack aRequestorStack;
  1473 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1614 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1474     aRequestorStack.Insert(identityInfo,0);
  1615     aRequestorStack.Insert(identityInfo,0);
  1475     
  1616 
  1476     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1617     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1477 		
  1618 
  1478     TraceLCallBack MyUpdates ;
  1619     TraceLCallBack MyUpdates(14,TRACE) ;
  1479     
  1620 
  1480     ret = CoreObj->TraceL(&MyUpdates) ;
  1621     TRAP(ret, CoreObj->TraceL(&MyUpdates) );
  1481     if( KErrNone == ret)
  1622     if( KErrNone == ret)
  1482     	{
  1623         {
  1483         TBuf8<20> retBuf;
  1624         TBuf8<20> retBuf;
  1484         TRealFormat retFormat;
  1625         TRealFormat retFormat;
  1485         
  1626 
  1486         OpenFile();
  1627         OpenFile();
  1487 	 	LogFile.Write(_L8("\n<TraceLPosition test>\n"));
  1628         LogFile.Write(_L8("\n<TraceLPosition test>\n"));
  1488 	 	CloseFile();
  1629         CloseFile();
  1489         CActiveScheduler :: Start() ;
  1630         CActiveScheduler :: Start() ;
  1490 		
  1631 
  1491 		retBuf.Num(returnCode,retFormat);
  1632         retBuf.Num(returnCode,retFormat);
  1492 		OpenFile();
  1633         OpenFile();
  1493 		LogFile.Write(_L8("\nreturnCode : "));
  1634         LogFile.Write(_L8("\nreturnCode : "));
  1494 		LogFile.Write(retBuf);
  1635         LogFile.Write(retBuf);
  1495 		CloseFile();
  1636         CloseFile();
  1496 		}
  1637         }
  1497     else
  1638     else
  1498     	{
  1639         {
  1499     	returnCode = KErrGeneral;	
  1640         returnCode = KErrGeneral;	
  1500     	}
  1641         }
  1501     
  1642 
  1502  	//aRequestorStack.Close();
  1643     //aRequestorStack.Close();
  1503     
  1644 
  1504     delete CoreObj;
  1645     delete CoreObj;
  1505 	return 0;
  1646     __UHEAP_MARKEND ;
  1506 	}	
  1647     return 0;
       
  1648     }	
  1507 
  1649 
  1508 
  1650 
  1509 TInt CSAPILocTest::TraceLPosition( CStifItemParser& /*aItem*/ )
  1651 TInt CSAPILocTest::TraceLPosition( CStifItemParser& /*aItem*/ )
  1510 	{
  1652     {
  1511     TInt aRet = KErrNone;
  1653     TInt aRet = KErrNone;
  1512     returnCode = KErrNone;
  1654     returnCode = KErrNone;
  1513    
  1655 
  1514     // Print to UI
  1656     // Print to UI
  1515     _LIT( KSAPILocTest, "SAPILocTest" );
  1657     _LIT( KSAPILocTest, "SAPILocTest" );
  1516     _LIT( KExample, "TraceLPosition" );
  1658     _LIT( KExample, "TraceLPosition" );
  1517     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1659     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1518     
  1660 
  1519     __UHEAP_MARK;
  1661     __UHEAP_MARK;
  1520     
  1662 
  1521     TRAPD(err ,aRet = TraceLFunctionL() ) ;
  1663     TRAPD(err ,aRet = TraceLFunctionL() ) ;
  1522     
  1664 
  1523     if( err || aRet )
  1665     if( err || aRet )
  1524     returnCode = KErrGeneral;
  1666         returnCode = KErrGeneral;
  1525     
  1667 
  1526     __UHEAP_MARKEND;
  1668     __UHEAP_MARKEND;
  1527   
  1669 
  1528      return returnCode;  
  1670     return returnCode;  
  1529 	}
  1671     }
  1530 
  1672 
  1531 
  1673 
  1532 // -----------------------------------------------------------------------------
  1674 // -----------------------------------------------------------------------------
  1533 // CSAPILocTest::TraceLPosition1
  1675 // CSAPILocTest::TraceLPosition1
  1534 // -----------------------------------------------------------------------------
  1676 // -----------------------------------------------------------------------------
  1535 //
  1677 //
  1536 TInt TraceLFunction1L()
  1678 TInt TraceLFunction1L()
  1537 	{
  1679     {
  1538     TInt ret1,ret2;
  1680     TInt ret1,ret2;
  1539     TPosition aPosition1;  
  1681     TPosition aPosition1;  
  1540     
  1682     __UHEAP_MARK ;
  1541     CLocationService *CoreObj = CLocationService ::NewL() ;
  1683     CLocationService *CoreObj = CLocationService ::NewL() ;
  1542     if( NULL == CoreObj )
  1684     if( NULL == CoreObj )
  1543     	{
  1685         {
  1544     	OpenFile();
  1686         OpenFile();
  1545 	    LogFile.Write(_L8("\n<TraceLPosition1 Test>\n"));
  1687         LogFile.Write(_L8("\n<TraceLPosition1 Test>\n"));
  1546 	    LogFile.Write(_L8("Failed(Null CoreObj)..\n"));
  1688         LogFile.Write(_L8("Failed(Null CoreObj)..\n"));
  1547 	    CloseFile();
  1689         CloseFile();
  1548    		return KErrGeneral;
  1690         return KErrGeneral;
  1549    		}
  1691         }
  1550     
  1692 
  1551     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1693     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1552 	//not needed any more
  1694     //not needed any more
  1553 	/*RRequestorStack aRequestorStack;
  1695     /*RRequestorStack aRequestorStack;
  1554 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1696 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1555     aRequestorStack.Insert(identityInfo,0);
  1697     aRequestorStack.Insert(identityInfo,0);
  1556     
  1698 
  1557     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1699     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1558 		
  1700 
  1559     TraceLCallBack MyUpdates ;
  1701     TraceLCallBack MyUpdates(15,TRACE) ;
  1560     
  1702 
  1561     ret1 = CoreObj->TraceL(&MyUpdates) ;
  1703     TRAP(ret1, CoreObj->TraceL(&MyUpdates)) ;
  1562     ret2 = CoreObj->TraceL(&MyUpdates) ;
  1704     TRAP(ret2 , CoreObj->TraceL(&MyUpdates) );
  1563     
  1705 
  1564     if( KErrNone == ret1 && KErrInUse == ret2)
  1706     if( KErrNone == ret1 && KErrNone == ret2)
  1565     	{
  1707         {
  1566         TBuf8<20> retBuf;
  1708         TBuf8<20> retBuf;
  1567         TRealFormat retFormat;
  1709         TRealFormat retFormat;
  1568         
  1710 
  1569         OpenFile();
  1711         OpenFile();
  1570 	 	LogFile.Write(_L8("\n<TraceLPosition1 test>\n"));
  1712         LogFile.Write(_L8("\n<TraceLPosition1 test>\n"));
  1571 	 	CloseFile();
  1713         CloseFile();
  1572         
  1714 
  1573         CActiveScheduler :: Start() ;
  1715         CActiveScheduler :: Start() ;
  1574 		
  1716 
  1575 		retBuf.Num(returnCode,retFormat);
  1717         retBuf.Num(returnCode,retFormat);
  1576 		OpenFile();
  1718         OpenFile();
  1577 		LogFile.Write(_L8("\nreturnCode : "));
  1719         LogFile.Write(_L8("\nreturnCode : "));
  1578 		LogFile.Write(retBuf);
  1720         LogFile.Write(retBuf);
  1579 		CloseFile();
  1721         CloseFile();
  1580 		}
  1722         }
  1581     
  1723 
  1582     else
  1724     else
  1583       	{
  1725         {
  1584     	returnCode = KErrGeneral;	
  1726         returnCode = KErrGeneral;	
  1585     	}
  1727         }
  1586     //aRequestorStack.Close();
  1728     //aRequestorStack.Close();
  1587     
  1729 
  1588     delete CoreObj;
  1730     delete CoreObj;
       
  1731     __UHEAP_MARKEND ;
  1589     return 0;
  1732     return 0;
  1590 	}
  1733     }
  1591 
  1734 
  1592 
  1735 
  1593 TInt CSAPILocTest::TraceLPosition1( CStifItemParser& /*aItem*/ )
  1736 TInt CSAPILocTest::TraceLPosition1( CStifItemParser& /*aItem*/ )
  1594 	{
  1737     {
  1595      TInt aRet = KErrNone;
  1738     TInt aRet = KErrNone;
  1596      returnCode = KErrNone;
  1739     returnCode = KErrNone;
  1597      
  1740 
  1598     // Print to UI
  1741     // Print to UI
  1599     _LIT( KSAPILocTest, "SAPILocTest" );
  1742     _LIT( KSAPILocTest, "SAPILocTest" );
  1600     _LIT( KExample, "TraceLPosition1" );
  1743     _LIT( KExample, "TraceLPosition1" );
  1601     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1744     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1602     
  1745 
  1603     __UHEAP_MARK;
  1746     __UHEAP_MARK;
  1604     
  1747 
  1605     TRAPD(err ,aRet = TraceLFunction1L()) ;
  1748     TRAPD(err ,aRet = TraceLFunction1L()) ;
  1606     
  1749 
  1607     if( err || aRet )
  1750     if( err || aRet )
  1608     returnCode = KErrGeneral;
  1751         returnCode = KErrGeneral;
  1609     
  1752 
  1610     __UHEAP_MARKEND;
  1753     __UHEAP_MARKEND;
  1611     
  1754 
  1612      return returnCode;  
  1755     return returnCode;  
  1613 	}
  1756     }
  1614 
  1757 
  1615 
  1758 
  1616 // -----------------------------------------------------------------------------
  1759 // -----------------------------------------------------------------------------
  1617 // CSAPILocTest::TraceLPosition2
  1760 // CSAPILocTest::TraceLPosition2
  1618 // -----------------------------------------------------------------------------
  1761 // -----------------------------------------------------------------------------
  1619 //
  1762 //
  1620 
  1763 
  1621 class TraceLCallBack2 : public MLocationCallBack
  1764 class TraceLCallBack2 : public MLocationCallBack
  1622 	{
  1765     {
  1623     TInt iCount ;
  1766     TInt iCount ;
  1624     TInt iRetStatus ;
  1767     TInt iRetStatus ;
       
  1768     TInt iRequestType;
       
  1769     TInt iTransactionId;
  1625     CLocationService *CoreObj;
  1770     CLocationService *CoreObj;
  1626     public :
  1771     public :
  1627     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  1772         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  1628     TraceLCallBack2(CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral)
  1773         TraceLCallBack2(TInt transId,TInt req,CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral)
  1629    		{
  1774             {
  1630    	    iCount = count;
  1775             iRequestType = req;
  1631    	    iRetStatus = status;
  1776             iCount = count;
  1632    	    CoreObj = LocObj;	
  1777             iTransactionId = transId;
  1633    		}
  1778             iRetStatus = status;
  1634  	};
  1779             CoreObj = LocObj;	
  1635   
  1780             }
  1636   
  1781 
  1637   
  1782         inline TUint GetRequestType(void) 
       
  1783             {
       
  1784             return iRequestType ;
       
  1785             }
       
  1786 
       
  1787 
       
  1788         /**
       
  1789          * GetTransactionId function returns transcation id associated with current async object
       
  1790          *
       
  1791          */
       
  1792         inline TInt32 GetTransactionId(void)
       
  1793             {
       
  1794             return iTransactionId ;
       
  1795             }
       
  1796     };
       
  1797 
       
  1798 
       
  1799 
  1638 TInt TraceLCallBack2 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  1800 TInt TraceLCallBack2 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  1639 	{
  1801     {
  1640 //	 User::After(60000000);
  1802     //	 User::After(60000000);
  1641 	 TInt aRet1;
  1803     TInt aRet1;
  1642 	 if(KErrNone == aError && iCount<2)
  1804     if(iCount<2)
  1643 	 	{
  1805         {
  1644 	  	TBuf8<20> retBuf;
  1806         TBuf8<20> retBuf;
  1645         TRealFormat retFormat;
  1807         TRealFormat retFormat;
  1646         retBuf.Num(aError,retFormat);
  1808         retBuf.Num(aError,retFormat);
  1647         
  1809 
  1648         OpenFile();
  1810         OpenFile();
  1649 	 	LogFile.Write(_L8("\n<TraceLPosition2 HandleNotifyL>\n"));
  1811         LogFile.Write(_L8("\n<TraceLPosition2 HandleNotifyL>\n"));
  1650 	 	LogFile.Write(retBuf);
  1812         LogFile.Write(retBuf);
  1651 	 	CloseFile();
  1813         CloseFile();
  1652 	  	TPosition currPos1;
  1814         TPosition currPos1;
  1653 	  	currPos->GetPosition(currPos1);
  1815         currPos->GetPosition(currPos1);
  1654 	  //	ValidatePosition(currPos1);
  1816         //	ValidatePosition(currPos1);
  1655     	iCount++;	 
  1817         iCount++;	 
  1656 	 	
  1818 
  1657 	 	}
  1819         }
  1658 		
  1820 
  1659      else
  1821     else
  1660 	 	{
  1822         {
  1661 	 	aRet1 = CoreObj->CancelOnGoingService(1);
  1823         aRet1 = CoreObj->CancelOnGoingService(1);
  1662     		TBuf8<20> retBuf;
  1824         TBuf8<20> retBuf;
  1663         TRealFormat retFormat;
  1825         TRealFormat retFormat;
  1664         retBuf.Num(aRet1,retFormat);
  1826         retBuf.Num(aRet1,retFormat);
  1665         
  1827 
  1666         OpenFile();
  1828         OpenFile();
  1667 	 	LogFile.Write(_L8("\n<TraceLPosition2 CancelOnGoingService>\n"));
  1829         LogFile.Write(_L8("\n<TraceLPosition2 CancelOnGoingService>\n"));
  1668 	 	LogFile.Write(retBuf);
  1830         LogFile.Write(retBuf);
  1669 	 	CloseFile();
  1831         CloseFile();
  1670     	if( KErrNone == aRet1 )
  1832         if( KErrNone == aRet1 )
  1671     		{
  1833             {
  1672     		returnCode = KErrNone;
  1834             returnCode = KErrNone;
  1673     		CActiveScheduler *Current = CActiveScheduler :: Current() ;
  1835             CActiveScheduler *Current = CActiveScheduler :: Current() ;
  1674 	  	    Current->Stop() ;
  1836             Current->Stop() ;
  1675        		}
  1837             }
  1676     	else
  1838         else
  1677     		{
  1839             {
  1678     		returnCode = KErrGeneral;
  1840             returnCode = KErrGeneral;
  1679     		CActiveScheduler *Current = CActiveScheduler :: Current() ;
  1841             CActiveScheduler *Current = CActiveScheduler :: Current() ;
  1680 	  	    Current->Stop() ;
  1842             Current->Stop() ;
  1681     		}
  1843             }
  1682     			
  1844 
  1683 	 	}
  1845         }
  1684 	return KErrNone; 
  1846     return KErrNone; 
  1685 	}
  1847     }
  1686 
  1848 
  1687 
  1849 
  1688 TInt TraceLFunction2L()
  1850 TInt TraceLFunction2L()
  1689 	{
  1851     {
       
  1852     __UHEAP_MARK ;
  1690     TInt ret;
  1853     TInt ret;
  1691     TPosition aPosition1;  
  1854     TPosition aPosition1;  
  1692     
  1855 
  1693     CLocationService *CoreObj = CLocationService ::NewL() ;
  1856     CLocationService *CoreObj = CLocationService ::NewL() ;
  1694     if( NULL == CoreObj )
  1857     if( NULL == CoreObj )
  1695     	{
  1858         {
  1696     	OpenFile();
  1859         OpenFile();
  1697 	    LogFile.Write(_L8("\n<TraceLPosition2 Test>\n"));
  1860         LogFile.Write(_L8("\n<TraceLPosition2 Test>\n"));
  1698 	    LogFile.Write(_L8("Failed(CoreObj Creation)..\n"));
  1861         LogFile.Write(_L8("Failed(CoreObj Creation)..\n"));
  1699 	    CloseFile();
  1862         CloseFile();
  1700    		return KErrGeneral;
  1863         return KErrGeneral;
  1701    		}
  1864         }
  1702     
  1865 
  1703     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1866     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1704     //not needed any more
  1867     //not needed any more
  1705 	
  1868 
  1706 	/*RRequestorStack aRequestorStack;
  1869     /*RRequestorStack aRequestorStack;
  1707 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1870 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1708     aRequestorStack.Insert(identityInfo,0);
  1871     aRequestorStack.Insert(identityInfo,0);
  1709     
  1872 
  1710     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1873     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1711 		
  1874 
  1712     TraceLCallBack2 MyUpdates(CoreObj) ;
  1875     TraceLCallBack2 MyUpdates(16,TRACE,CoreObj) ;
  1713     
  1876 
  1714     ret = CoreObj->TraceL(&MyUpdates) ;
  1877     TRAP(ret,CoreObj->TraceL(&MyUpdates) );
  1715     
  1878 
  1716     if( KErrNone == ret)
  1879     if( KErrNone == ret)
  1717     	{
  1880         {
  1718         TBuf8<20> retBuf;
  1881         TBuf8<20> retBuf;
  1719         TRealFormat retFormat;
  1882         TRealFormat retFormat;
  1720         OpenFile();
  1883         OpenFile();
  1721 	 	LogFile.Write(_L8("\n<TraceLPosition2 test>\n"));
  1884         LogFile.Write(_L8("\n<TraceLPosition2 test>\n"));
  1722 	 	CloseFile();
  1885         CloseFile();
  1723         CActiveScheduler :: Start() ;
  1886         CActiveScheduler :: Start() ;
  1724         retBuf.Num(returnCode,retFormat);
  1887         retBuf.Num(returnCode,retFormat);
  1725         OpenFile();
  1888         OpenFile();
  1726         LogFile.Write(_L8("\nreturnCode : "));
  1889         LogFile.Write(_L8("\nreturnCode : "));
  1727         LogFile.Write(retBuf);
  1890         LogFile.Write(retBuf);
  1728         CloseFile();
  1891         CloseFile();
  1729 		}
  1892         }
  1730     else
  1893     else
  1731     	{
  1894         {
  1732     	returnCode = KErrGeneral;	
  1895         returnCode = KErrGeneral;	
  1733     	}
  1896         }
  1734     	
  1897 
  1735     //aRequestorStack.Close();
  1898     //aRequestorStack.Close();
  1736 	
  1899 
  1737 	delete CoreObj;
  1900     delete CoreObj;
       
  1901     __UHEAP_MARKEND ;
  1738     return 0;
  1902     return 0;
  1739 	}
  1903     }
  1740 
  1904 
  1741 
  1905 
  1742 TInt CSAPILocTest::TraceLPosition2( CStifItemParser& /*aItem*/ )
  1906 TInt CSAPILocTest::TraceLPosition2( CStifItemParser& /*aItem*/ )
  1743 	{
  1907     {
  1744     TInt aRet = KErrNone;
  1908     TInt aRet = KErrNone;
  1745     returnCode = KErrNone; 
  1909     returnCode = KErrNone; 
  1746    
  1910 
  1747     // Print to UI
  1911     // Print to UI
  1748     _LIT( KSAPILocTest, "SAPILocTest" );
  1912     _LIT( KSAPILocTest, "SAPILocTest" );
  1749     _LIT( KExample, "TraceLPosition2" );
  1913     _LIT( KExample, "TraceLPosition2" );
  1750     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1914     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1751     
  1915 
  1752     __UHEAP_MARK;
  1916     __UHEAP_MARK;
  1753     
  1917 
  1754     TRAPD(err , aRet = TraceLFunction2L()) ;
  1918     TRAPD(err , aRet = TraceLFunction2L()) ;
  1755     if( err || aRet )
  1919     if( err || aRet )
  1756     returnCode = KErrGeneral;
  1920         returnCode = KErrGeneral;
  1757     
  1921 
  1758      __UHEAP_MARKEND;
  1922     __UHEAP_MARKEND;
  1759     
  1923 
  1760      return returnCode;  
  1924     return returnCode;  
  1761 	}
  1925     }
  1762 
  1926 
  1763 
  1927 
  1764 // -----------------------------------------------------------------------------
  1928 // -----------------------------------------------------------------------------
  1765 // CSAPILocTest::TraceLPosition3
  1929 // CSAPILocTest::TraceLPosition3
  1766 // -----------------------------------------------------------------------------
  1930 // -----------------------------------------------------------------------------
  1767 //
  1931 //
  1768 TInt TraceLFunction3L()
  1932 TInt TraceLFunction3L()
  1769 	{
  1933     {
       
  1934     __UHEAP_MARK ;
  1770     TInt ret1,ret2,ret3;
  1935     TInt ret1,ret2,ret3;
  1771     TPosition aPosition1;  
  1936     TPosition aPosition1;  
  1772     
  1937 
  1773     CLocationService *CoreObj = CLocationService ::NewL() ;
  1938     CLocationService *CoreObj = CLocationService ::NewL() ;
  1774     if( NULL == CoreObj )
  1939     if( NULL == CoreObj )
  1775     	{
  1940         {
  1776     	OpenFile();
  1941         OpenFile();
  1777 	    LogFile.Write(_L8("\n<TraceLPosition3 Test>\n"));
  1942         LogFile.Write(_L8("\n<TraceLPosition3 Test>\n"));
  1778 	    LogFile.Write(_L8("Failed(Null CoreObj)..\n"));
  1943         LogFile.Write(_L8("Failed(Null CoreObj)..\n"));
  1779 	    CloseFile();
  1944         CloseFile();
  1780    		return KErrGeneral;
  1945         return KErrGeneral;
  1781    		}
  1946         }
  1782    	
  1947 
  1783     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1948     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1784     //not needed any more
  1949     //not needed any more
  1785 	
  1950 
  1786 	/*RRequestorStack aRequestorStack;
  1951     /*RRequestorStack aRequestorStack;
  1787 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1952 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1788     aRequestorStack.Insert(identityInfo,0);
  1953     aRequestorStack.Insert(identityInfo,0);
  1789     
  1954 
  1790     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1955     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1791 			
  1956 
  1792     TraceLCallBack MyUpdates ;
  1957     TraceLCallBack MyUpdates(31,TRACE) ;
  1793     
  1958 
  1794     ret1 = CoreObj->TraceL(&MyUpdates) ;
  1959     TRAP(ret1 , CoreObj->TraceL(&MyUpdates) );
  1795     
  1960 
  1796     ret2 = CoreObj->TraceL(&MyUpdates) ;
  1961     // ret2 = CoreObj->TraceL(&MyUpdates) ;
  1797     
  1962 
  1798     if( KErrNone == ret1 && KErrInUse == ret2)
  1963     if( KErrNone == ret1 )
  1799     	{
  1964         {
  1800         ret3 = CoreObj->CancelOnGoingService(1);
  1965         ret3 = CoreObj->CancelOnGoingService(1);
  1801         
  1966 
  1802         if( KErrNone == ret3 )
  1967         if( KErrNone == ret3 )
  1803             {
  1968             {
  1804         	TBuf8<20> retBuf;
  1969             TBuf8<20> retBuf;
  1805         	TRealFormat retFormat;
  1970             TRealFormat retFormat;
  1806         	OpenFile();
  1971             OpenFile();
  1807 		 	LogFile.Write(_L8("\n<TraceLPosition3 test>\n"));
  1972             LogFile.Write(_L8("\n<TraceLPosition3 test>\n"));
  1808 		 	CloseFile();
  1973             CloseFile();
  1809 		 	ret1 = CoreObj->TraceL(&MyUpdates) ;
  1974             TRAP(ret1 , CoreObj->TraceL(&MyUpdates) );
  1810 		 	if(KErrNone == ret1)
  1975             if(KErrNone == ret1)
  1811 	        CActiveScheduler :: Start() ;
  1976                 CActiveScheduler :: Start() ;
  1812         	retBuf.Num(returnCode,retFormat);
  1977             retBuf.Num(returnCode,retFormat);
  1813 			OpenFile();
  1978             OpenFile();
  1814 			LogFile.Write(_L8("\nreturnCode : "));
  1979             LogFile.Write(_L8("\nreturnCode : "));
  1815 			LogFile.Write(retBuf);
  1980             LogFile.Write(retBuf);
  1816 			CloseFile();
  1981             CloseFile();
  1817 			}
  1982             }
  1818         else
  1983         else
  1819         	{
  1984             {
  1820         	returnCode = KErrGeneral;
  1985             returnCode = KErrGeneral;
  1821         	}
  1986             }
  1822     	}
  1987         }
  1823     
  1988 
  1824     else
  1989     else
  1825    		{
  1990         {
  1826 		returnCode = KErrGeneral;
  1991         returnCode = KErrGeneral;
  1827    		}
  1992         }
  1828 	
  1993 
  1829     //aRequestorStack.Close();
  1994     //aRequestorStack.Close();
  1830     
  1995 
  1831     delete CoreObj;
  1996     delete CoreObj;
  1832 	return KErrNone;
  1997     __UHEAP_MARKEND ;
  1833 	}
  1998     return KErrNone;
       
  1999     }
  1834 
  2000 
  1835 
  2001 
  1836 TInt CSAPILocTest::TraceLPosition3( CStifItemParser& /*aItem*/ )
  2002 TInt CSAPILocTest::TraceLPosition3( CStifItemParser& /*aItem*/ )
  1837 	{
  2003     {
  1838     TInt aRet = KErrNone;
  2004     TInt aRet = KErrNone;
  1839     returnCode = KErrNone;
  2005     returnCode = KErrNone;
  1840     
  2006 
  1841     // Print to UI
  2007     // Print to UI
  1842     _LIT( KSAPILocTest, "SAPILocTest" );
  2008     _LIT( KSAPILocTest, "SAPILocTest" );
  1843     _LIT( KExample, "TraceLPosition3" );
  2009     _LIT( KExample, "TraceLPosition3" );
  1844     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2010     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1845     
  2011 
  1846     __UHEAP_MARK;
  2012     __UHEAP_MARK;
  1847     
  2013 
  1848     TRAPD(err , aRet = TraceLFunction3L()) ;
  2014     TRAPD(err , aRet = TraceLFunction3L()) ;
  1849     if( err || aRet )
  2015     if( err || aRet )
  1850       returnCode = KErrGeneral;
  2016         returnCode = KErrGeneral;
  1851    
  2017 
  1852     __UHEAP_MARKEND;
  2018     __UHEAP_MARKEND;
  1853     
  2019 
  1854     return returnCode;  
  2020     return returnCode;  
  1855 	}
  2021     }
  1856 
  2022 
  1857 // -----------------------------------------------------------------------------
  2023 // -----------------------------------------------------------------------------
  1858 // CSAPILocTest::TraceLPosition4
  2024 // CSAPILocTest::TraceLPosition4
  1859 // -----------------------------------------------------------------------------
  2025 // -----------------------------------------------------------------------------
  1860 //
  2026 //
  1861 class TraceLCallBack4 : public MLocationCallBack
  2027 class TraceLCallBack4 : public MLocationCallBack
  1862 	{
  2028     {
  1863     TInt iCount ;
  2029     TInt iCount ;
  1864     TInt iRetStatus ;
  2030     TInt iRetStatus ;
  1865     TInt iCallIdentity;
  2031     TInt iCallIdentity;
       
  2032     TInt iRequestType;
       
  2033     TInt iTransactionId;
  1866     public :
  2034     public :
  1867     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2035         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  1868     TraceLCallBack4(TInt identity, TInt count = 0 , TInt status = KErrGeneral)
  2036         TraceLCallBack4(TInt transId,TInt req,TInt identity, TInt count = 0 , TInt status = KErrGeneral)
  1869    		{
  2037             {
  1870    		iCallIdentity = identity;
  2038             iTransactionId = transId;
  1871    		iCount = count;
  2039             iRequestType = req;
  1872         iRetStatus = status;  
  2040             iCallIdentity = identity;
  1873    		}
  2041             iCount = count;
       
  2042             iRetStatus = status;  
       
  2043             }
       
  2044 
       
  2045         inline TUint GetRequestType(void) 
       
  2046             {
       
  2047             return iRequestType ;
       
  2048             }
       
  2049 
       
  2050 
       
  2051         /**
       
  2052          * GetTransactionId function returns transcation id associated with current async object
       
  2053          *
       
  2054          */
       
  2055         inline TInt32 GetTransactionId(void)
       
  2056             {
       
  2057             return iTransactionId ;
       
  2058             }
  1874     };
  2059     };
  1875  
  2060 
  1876   
  2061 
  1877 TInt TraceLCallBack4 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  2062 TInt TraceLCallBack4 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  1878 	{
  2063     {
  1879 	  if(iCallIdentity == 1 && KErrNone == aError )
  2064     if(iCallIdentity == 1 && KErrNone == aError )
  1880 	  	{
  2065         {
  1881 	  	TPosition currPos1;
  2066         TPosition currPos1;
  1882 	  	currPos->GetPosition(currPos1);
  2067         currPos->GetPosition(currPos1);
  1883 	//  	ValidatePosition(currPos1);
  2068         //  	ValidatePosition(currPos1);
  1884     //  	returnCode = KErrNone ;
  2069         //  	returnCode = KErrNone ;
  1885 	  	}
  2070         }
  1886 	  else if(KErrNone == aError && iCount<2)
  2071     else if(KErrNone == aError && iCount<2)
  1887 	  	{
  2072         {
  1888 		 TPosition currPos1;
  2073         TPosition currPos1;
  1889 		 currPos->GetPosition(currPos1);
  2074         currPos->GetPosition(currPos1);
  1890 	//	 ValidatePosition(currPos1);
  2075         //	 ValidatePosition(currPos1);
  1891 	     iCount++;	 
  2076         iCount++;	 
  1892 	  	}
  2077         }
  1893 			
  2078 
  1894   	  else if(iCount>=2)
  2079     else if(iCount>=2)
  1895 	  	{
  2080         {
  1896 		CActiveScheduler *Current = CActiveScheduler :: Current() ;
  2081         CActiveScheduler *Current = CActiveScheduler :: Current() ;
  1897   	    Current->Stop() ;
  2082         Current->Stop() ;
  1898   	    returnCode = KErrNone; 
  2083         returnCode = KErrNone; 
  1899 	  	}
  2084         }
  1900 	  else
  2085     else
  1901 	  	{
  2086         {
  1902 	  	returnCode = KErrGeneral;	
  2087         returnCode = KErrGeneral;	
  1903 	  	}
  2088         }
  1904 	  	
  2089 
  1905 	return returnCode;
  2090     return returnCode;
  1906 	}
  2091     }
  1907 	
  2092 
  1908 TInt TraceLFunction4L()
  2093 TInt TraceLFunction4L()
  1909 	{
  2094     {
       
  2095     __UHEAP_MARK ;
  1910     TInt ret1,ret2;
  2096     TInt ret1,ret2;
  1911     TPosition aPosition1;  
  2097     TPosition aPosition1;  
  1912     
  2098 
  1913     CLocationService *CoreObj = CLocationService ::NewL() ;
  2099     CLocationService *CoreObj = CLocationService ::NewL() ;
  1914     
  2100 
  1915     TraceLCallBack4 MyUpdates1(1) ;
  2101     TraceLCallBack4 MyUpdates1(17,GETLOCATION,1) ;
  1916     
  2102 
  1917     TraceLCallBack4 MyUpdates2(2) ;
  2103     TraceLCallBack4 MyUpdates2(18,TRACE,2) ;
  1918     
  2104 
  1919     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2105     _LIT(Kidentity ,"Coreclass Testing" ) ;
  1920     //not needed any more
  2106     //not needed any more
  1921 	
  2107 
  1922 	/*RRequestorStack aRequestorStack;
  2108     /*RRequestorStack aRequestorStack;
  1923 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2109 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  1924     aRequestorStack.Insert(identityInfo,0);
  2110     aRequestorStack.Insert(identityInfo,0);
  1925     
  2111 
  1926     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2112     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  1927 		
  2113 
  1928     ret1 = CoreObj->GetLocationL(&MyUpdates1) ;
  2114     TRAP(ret1 , CoreObj->GetLocationL(&MyUpdates1) );
  1929     
  2115 
  1930     ret2 = CoreObj->TraceL(&MyUpdates2) ;
  2116     TRAP(ret2 , CoreObj->TraceL(&MyUpdates2) );
  1931     
  2117 
  1932     
  2118 
  1933     if( KErrNone == ret1 && KErrNone == ret2)
  2119     if( KErrNone == ret1 && KErrNone == ret2)
  1934     	{
  2120         {
  1935        	TBuf8<50> buf ;
  2121         TBuf8<50> buf ;
  1936 		TRealFormat format ;
  2122         TRealFormat format ;
  1937 		
  2123 
  1938        	OpenFile();
  2124         OpenFile();
  1939 	 	LogFile.Write(_L8("\n<TraceLPosition4 test>\n"));
  2125         LogFile.Write(_L8("\n<TraceLPosition4 test>\n"));
  1940 	 	CActiveScheduler :: Start() ;
  2126         CActiveScheduler :: Start() ;
  1941     	
  2127 
  1942 	    //Logging returnCode 
  2128         //Logging returnCode 
  1943 		buf.Num(returnCode , format) ;
  2129         buf.Num(returnCode , format) ;
  1944 		LogFile.Write(_L8("returnCode = "));
  2130         LogFile.Write(_L8("returnCode = "));
  1945 		LogFile.Write(buf) ;
  2131         LogFile.Write(buf) ;
  1946 		LogFile.Write(_L8("\n")) ;
  2132         LogFile.Write(_L8("\n")) ;
  1947 	    CloseFile();
  2133         CloseFile();
  1948 	    }
  2134         }
  1949     else
  2135     else
  1950     	{
  2136         {
  1951       	returnCode = KErrGeneral;
  2137         returnCode = KErrGeneral;
  1952     	}
  2138         }
  1953     //aRequestorStack.Close();
  2139     //aRequestorStack.Close();
  1954 	
  2140 
  1955 	delete CoreObj;
  2141     delete CoreObj;
       
  2142     __UHEAP_MARKEND ;
  1956     return KErrNone;
  2143     return KErrNone;
  1957         
  2144 
  1958 	}
  2145     }
  1959 
  2146 
  1960 
  2147 
  1961 
  2148 
  1962 TInt CSAPILocTest::TraceLPosition4( CStifItemParser& /*aItem*/ )
  2149 TInt CSAPILocTest::TraceLPosition4( CStifItemParser& /*aItem*/ )
  1963 	{
  2150     {
  1964     TInt aRet = KErrNone;
  2151     TInt aRet = KErrNone;
  1965     returnCode = KErrNone;
  2152     returnCode = KErrNone;
  1966     
  2153 
  1967     // Print to UI
  2154     // Print to UI
  1968     _LIT( KSAPILocTest, "SAPILocTest" );
  2155     _LIT( KSAPILocTest, "SAPILocTest" );
  1969     _LIT( KExample, "TraceLPosition4" );
  2156     _LIT( KExample, "TraceLPosition4" );
  1970     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2157     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  1971     
  2158 
  1972     __UHEAP_MARK;
  2159     __UHEAP_MARK;
  1973     
  2160 
  1974     TRAPD(err ,aRet = TraceLFunction4L()) ;
  2161     TRAPD(err ,aRet = TraceLFunction4L()) ;
  1975     if( err || aRet )
  2162     if( err || aRet )
  1976     returnCode = KErrGeneral;
  2163         returnCode = KErrGeneral;
  1977     
  2164 
  1978     __UHEAP_MARKEND;
  2165     __UHEAP_MARKEND;
  1979     
  2166 
  1980      return returnCode;  
  2167     return returnCode;  
  1981 	}
  2168     }
  1982 
  2169 
  1983 
  2170 
  1984 // -----------------------------------------------------------------------------
  2171 // -----------------------------------------------------------------------------
  1985 // CSAPILocTest::TraceLPosition5
  2172 // CSAPILocTest::TraceLPosition5
  1986 // -----------------------------------------------------------------------------
  2173 // -----------------------------------------------------------------------------
  1987 //
  2174 //
  1988 
  2175 
  1989 class CTraceLCallBack5 : public CBase , public MLocationCallBack 
  2176 class CTraceLCallBack5 : public CBase , public MLocationCallBack 
  1990 	{
  2177     {
  1991    TInt iCount ;
       
  1992    TInt iRetStatus ;
       
  1993    CLocationService *CoreObj;
       
  1994    CTraceLCallBack5* iSelf;  
       
  1995    public :
       
  1996    TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
       
  1997    CTraceLCallBack5(CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral)
       
  1998    		{
       
  1999    	    iCount = count;
       
  2000    	    iRetStatus = status;
       
  2001    	    CoreObj = LocObj;	
       
  2002    		}
       
  2003    
       
  2004    virtual ~CTraceLCallBack5();
       
  2005    static CTraceLCallBack5* NewL(CLocationService*) ;
       
  2006  	};
       
  2007   
       
  2008  CTraceLCallBack5* CTraceLCallBack5 :: NewL(CLocationService* obj)
       
  2009  	{
       
  2010  	CTraceLCallBack5* temp = new(ELeave) CTraceLCallBack5(obj);
       
  2011  	temp->iSelf = temp;
       
  2012  	return temp;
       
  2013  	}
       
  2014  
       
  2015  CTraceLCallBack5 :: ~CTraceLCallBack5()
       
  2016  	{
       
  2017   	delete (this->CoreObj);
       
  2018   	}
       
  2019   
       
  2020 TInt CTraceLCallBack5 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
       
  2021 	{
       
  2022 	 User::After(30000000);
       
  2023 	 TInt aRet1;
       
  2024 	 if(KErrNone == aError && iCount<2)
       
  2025 	 	{
       
  2026 	    TPosition currPos1;
       
  2027 	    currPos->GetPosition(currPos1);
       
  2028 	    ValidatePosition(currPos1);
       
  2029         iCount++;	 
       
  2030 	 	}
       
  2031 		
       
  2032      else
       
  2033 	 	{
       
  2034 	   	aRet1 = CoreObj->CancelOnGoingService(1);
       
  2035     	if( KErrNone == aRet1 )
       
  2036     		{	
       
  2037     		returnCode = KErrNone;
       
  2038     		delete this;
       
  2039     		CActiveScheduler *Current = CActiveScheduler :: Current() ;
       
  2040     		Current->Stop() ;
       
  2041        		}
       
  2042     	else
       
  2043     		{
       
  2044     		returnCode = KErrGeneral;
       
  2045        		delete this;
       
  2046        		CActiveScheduler *Current = CActiveScheduler :: Current() ;
       
  2047     		Current->Stop() ;
       
  2048        		}	
       
  2049 	 	}
       
  2050 	
       
  2051 	return KErrNone; 
       
  2052 	}
       
  2053 	
       
  2054 class LocUpdateCallBack5 : public MLocationCallBack
       
  2055  	{
       
  2056     TInt iCount ;
  2178     TInt iCount ;
  2057     TInt iRetStatus ;
  2179     TInt iRetStatus ;
       
  2180     CLocationService *CoreObj;
       
  2181     CTraceLCallBack5* iSelf;  
       
  2182     TInt iRequestType;
       
  2183     TInt iTransactionId;
  2058     public :
  2184     public :
  2059     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2185         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2060     LocUpdateCallBack5() :iCount(0) , iRetStatus(KErrGeneral){;}
  2186         CTraceLCallBack5(TInt transId,TInt req,CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral)
  2061   	};
  2187             {
  2062   
  2188             iTransactionId = transId;
  2063     
  2189             iRequestType = req;
       
  2190             iCount = count;
       
  2191             iRetStatus = status;
       
  2192             CoreObj = LocObj;	
       
  2193             }
       
  2194 
       
  2195         virtual ~CTraceLCallBack5();
       
  2196         static CTraceLCallBack5* NewL(TInt aTransId,TInt req,CLocationService*) ;
       
  2197 
       
  2198         inline TUint GetRequestType(void) 
       
  2199             {
       
  2200             return iRequestType ;
       
  2201             }
       
  2202 
       
  2203 
       
  2204         /**
       
  2205          * GetTransactionId function returns transcation id associated with current async object
       
  2206          *
       
  2207          */
       
  2208         inline TInt32 GetTransactionId(void)
       
  2209             {
       
  2210             return iTransactionId ;
       
  2211             }
       
  2212     };
       
  2213 
       
  2214 CTraceLCallBack5* CTraceLCallBack5 :: NewL(TInt aTransId,TInt req,CLocationService* obj)
       
  2215     {
       
  2216     CTraceLCallBack5* temp = new(ELeave) CTraceLCallBack5(aTransId,req,obj);
       
  2217     temp->iSelf = temp;
       
  2218     return temp;
       
  2219     }
       
  2220 
       
  2221 CTraceLCallBack5 :: ~CTraceLCallBack5()
       
  2222     {
       
  2223     delete (this->CoreObj);
       
  2224     this->CoreObj = NULL;
       
  2225     }
       
  2226 
       
  2227 TInt CTraceLCallBack5 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
       
  2228     {
       
  2229     // User::After(30000000);
       
  2230     TInt aRet1;
       
  2231     if(KErrNone == aError && iCount<2)
       
  2232         {
       
  2233         TPosition currPos1;
       
  2234         currPos->GetPosition(currPos1);
       
  2235         ValidatePosition(currPos1);
       
  2236         iCount++;	 
       
  2237         }
       
  2238 
       
  2239     else
       
  2240         {
       
  2241         aRet1 = CoreObj->CancelOnGoingService(1);
       
  2242         if( KErrNone == aRet1 )
       
  2243             {	
       
  2244             returnCode = KErrNone;
       
  2245             delete this;
       
  2246             CActiveScheduler *Current = CActiveScheduler :: Current() ;
       
  2247             Current->Stop() ;
       
  2248             }
       
  2249         else
       
  2250             {
       
  2251             returnCode = KErrGeneral;
       
  2252             delete this;
       
  2253             CActiveScheduler *Current = CActiveScheduler :: Current() ;
       
  2254             Current->Stop() ;
       
  2255             }	
       
  2256         }
       
  2257 
       
  2258     return KErrNone; 
       
  2259     }
       
  2260 
       
  2261 class LocUpdateCallBack5 : public MLocationCallBack
       
  2262     {
       
  2263     TInt iCount ;
       
  2264     TInt iRetStatus ;
       
  2265     TInt iRequestType;
       
  2266     TInt iTransactionId;
       
  2267     public :
       
  2268         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
       
  2269         LocUpdateCallBack5(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){
       
  2270         iTransactionId = transId;
       
  2271         iRequestType = req;
       
  2272         }
       
  2273 
       
  2274         inline TUint GetRequestType(void) 
       
  2275             {
       
  2276             return iRequestType ;
       
  2277             }
       
  2278 
       
  2279 
       
  2280         /**
       
  2281          * GetTransactionId function returns transcation id associated with current async object
       
  2282          *
       
  2283          */
       
  2284         inline TInt32 GetTransactionId(void)
       
  2285             {
       
  2286             return iTransactionId ;
       
  2287             }
       
  2288     };
       
  2289 
       
  2290 
  2064 TInt LocUpdateCallBack5 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt /*aError*/)
  2291 TInt LocUpdateCallBack5 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt /*aError*/)
  2065 	{
  2292     {
  2066 	  
  2293 
  2067 	 TInt aRet;
  2294     TInt aRet;
  2068 	 TPosition currPos1;
  2295     TPosition currPos1;
  2069 	 currPos->GetPosition(currPos1);
  2296     currPos->GetPosition(currPos1);
  2070 	 aRet = ValidatePosition(currPos1);
  2297     aRet = ValidatePosition(currPos1);
  2071      
  2298 
  2072      if ( KErrNone == aRet )
  2299     if ( KErrNone == aRet )
  2073      	{
  2300         {
  2074       	TPosition aPosition2;  
  2301         TPosition aPosition2;  
  2075 	    CLocationService *CoreObj1 = CLocationService ::NewL() ;
  2302         CLocationService *CoreObj1 = CLocationService ::NewL() ;
  2076 	    
  2303 
  2077 	    _LIT(Kidentity ,"Coreclass Testing" ) ;
  2304         _LIT(Kidentity ,"Coreclass Testing" ) ;
  2078 		//not needed any more
  2305         //not needed any more
  2079 		/*RRequestorStack aRequestorStack;
  2306         /*RRequestorStack aRequestorStack;
  2080 		const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2307 		const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2081 	    aRequestorStack.Insert(identityInfo,0);
  2308 	    aRequestorStack.Insert(identityInfo,0);
  2082 	    
  2309 
  2083 	    CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/
  2310 	    CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/
  2084 		
  2311 
  2085 	    CTraceLCallBack5 *MyUpdates2 = CTraceLCallBack5::NewL(CoreObj1);
  2312         CTraceLCallBack5 *MyUpdates2 = CTraceLCallBack5::NewL(18,TRACE,CoreObj1);
  2086 	    
  2313 
  2087 	    CoreObj1->TraceL(MyUpdates2) ;
  2314         CoreObj1->TraceL(MyUpdates2) ;
  2088 	    
  2315 
  2089 	    //aRequestorStack.Close();
  2316         //aRequestorStack.Close();
  2090 		
  2317 
  2091 	    }
  2318         }
  2092      return KErrNone ;
  2319     return KErrNone ;
  2093 	}
  2320     }
  2094 
  2321 
  2095 
  2322 
  2096 TInt TraceLFunction5L()
  2323 TInt TraceLFunction5L()
  2097 	{
  2324     {
       
  2325     __UHEAP_MARK ;
  2098     TInt ret1;
  2326     TInt ret1;
  2099     TPosition aPosition1;  
  2327     TPosition aPosition1;  
  2100     CLocationService *CoreObj = CLocationService ::NewL() ;
  2328     CLocationService *CoreObj = CLocationService ::NewL() ;
  2101     LocUpdateCallBack5 MyUpdates1 ;
  2329     LocUpdateCallBack5 MyUpdates1(28,GETLOCATION) ;
  2102     
  2330 
  2103     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2331     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2104 	//not needed any more
  2332     //not needed any more
  2105 	/*RRequestorStack aRequestorStack;
  2333     /*RRequestorStack aRequestorStack;
  2106 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2334 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2107     aRequestorStack.Insert(identityInfo,0);
  2335     aRequestorStack.Insert(identityInfo,0);
  2108     
  2336 
  2109     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2337     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2110 		
  2338 
  2111     ret1 = CoreObj->GetLocationL(&MyUpdates1) ;
  2339     TRAP(ret1 ,CoreObj->GetLocationL(&MyUpdates1) );
  2112     
  2340 
  2113     if( KErrNone == ret1)
  2341     if( KErrNone == ret1)
  2114     	{
  2342         {
  2115        	TBuf8<20> retBuf;
  2343         TBuf8<20> retBuf;
  2116        	TRealFormat retFormat;
  2344         TRealFormat retFormat;
  2117        	OpenFile();
  2345         OpenFile();
  2118 	 	LogFile.Write(_L8("\n<TraceLPosition5 test>\n"));
  2346         LogFile.Write(_L8("\n<TraceLPosition5 test>\n"));
  2119 	 	CloseFile();
  2347         CloseFile();
  2120 	 	CActiveScheduler :: Start() ;
  2348         CActiveScheduler :: Start() ;
  2121     	retBuf.Num(returnCode,retFormat);
  2349         retBuf.Num(returnCode,retFormat);
  2122     	OpenFile();
  2350         OpenFile();
  2123     	LogFile.Write(_L8("\nreturn code : "));
  2351         LogFile.Write(_L8("\nreturn code : "));
  2124     	LogFile.Write(retBuf);
  2352         LogFile.Write(retBuf);
  2125     	CloseFile();
  2353         CloseFile();
  2126     	}
  2354         }
  2127     else
  2355     else
  2128     	{
  2356         {
  2129       	returnCode = KErrGeneral;
  2357         returnCode = KErrGeneral;
  2130     	}
  2358         }
  2131     
  2359 
  2132     //aRequestorStack.Close();
  2360     //aRequestorStack.Close();
  2133 	
  2361 
  2134 	delete CoreObj;
  2362     delete CoreObj;
       
  2363     __UHEAP_MARKEND ;
  2135     return KErrNone;
  2364     return KErrNone;
  2136 	}
  2365     }
  2137 
  2366 
  2138 TInt CSAPILocTest::TraceLPosition5( CStifItemParser& /*aItem*/ )
  2367 TInt CSAPILocTest::TraceLPosition5( CStifItemParser& /*aItem*/ )
  2139 	{
  2368     {
  2140     returnCode = KErrNone;
  2369     returnCode = KErrNone;
  2141     // Print to UI
  2370     // Print to UI
  2142     _LIT( KSAPILocTest, "SAPILocTest" );
  2371     _LIT( KSAPILocTest, "SAPILocTest" );
  2143     _LIT( KExample, "TraceLPosition5" );
  2372     _LIT( KExample, "TraceLPosition5" );
  2144     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2373     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2145     
  2374 
  2146     __UHEAP_MARK;
  2375     __UHEAP_MARK;
  2147     
  2376 
  2148     TRAPD(err , TraceLFunction5L()) ;
  2377     TRAPD(err , TraceLFunction5L()) ;
  2149     if(err)
  2378     if(err)
  2150     returnCode = KErrGeneral;
  2379         returnCode = KErrGeneral;
  2151     
  2380 
  2152      __UHEAP_MARKEND;
  2381     __UHEAP_MARKEND;
  2153   
  2382 
  2154      return returnCode;  
  2383     return returnCode;  
  2155 	}
  2384     }
  2156 
  2385 
  2157 // -----------------------------------------------------------------------------
  2386 // -----------------------------------------------------------------------------
  2158 // CSAPILocTest::TraceLPosition6
  2387 // CSAPILocTest::TraceLPosition6
  2159 // -----------------------------------------------------------------------------
  2388 // -----------------------------------------------------------------------------
  2160 //
  2389 //
  2161 
  2390 
  2162 class CLocUpdateCallBack6 : public CBase , public MLocationCallBack
  2391 class CLocUpdateCallBack6 : public CBase , public MLocationCallBack
  2163 	{
  2392     {
  2164     TInt iCount ;
  2393     TInt iCount ;
  2165     TInt iRetStatus ;
  2394     TInt iRetStatus ;
  2166     CLocUpdateCallBack6* iSelf;
  2395     CLocUpdateCallBack6* iSelf;
  2167     CLocationService *CoreObj;
  2396     CLocationService *CoreObj;
       
  2397     TInt iTransactionId;
       
  2398     TInt iRequestType;
  2168     public :
  2399     public :
  2169     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2400         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2170     CLocUpdateCallBack6(CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) 
  2401         CLocUpdateCallBack6(TInt transId,TInt req,CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) 
  2171    		{
  2402             {
  2172     	iCount = count;
  2403             iCount = count;
  2173    	    iRetStatus = status;
  2404             iRetStatus = status;
  2174    	 	CoreObj = LocObj;	
  2405             CoreObj = LocObj;
  2175    		}
  2406             iTransactionId =transId;
  2176     static CLocUpdateCallBack6* NewL(CLocationService* obj);
  2407             iRequestType = req;
  2177     virtual ~CLocUpdateCallBack6();
  2408             }
  2178   	};
  2409         static CLocUpdateCallBack6* NewL(TInt transid,TInt req,CLocationService* obj);
  2179   
  2410         virtual ~CLocUpdateCallBack6();
  2180  CLocUpdateCallBack6* CLocUpdateCallBack6 :: NewL(CLocationService* obj)
  2411 
  2181  	{
  2412         inline TUint GetRequestType(void) 
  2182  	CLocUpdateCallBack6* temp = new(ELeave) CLocUpdateCallBack6(obj);
  2413             {
  2183  	temp->iSelf = temp;
  2414             return iRequestType ;
  2184  	return temp;
  2415             }
  2185  	}
  2416 
  2186  
  2417 
  2187  CLocUpdateCallBack6 :: ~CLocUpdateCallBack6()
  2418         /**
  2188 	 {
  2419          * GetTransactionId function returns transcation id associated with current async object
  2189  	 delete (this->CoreObj);
  2420          *
  2190  	 }
  2421          */
       
  2422         inline TInt32 GetTransactionId(void)
       
  2423             {
       
  2424             return iTransactionId ;
       
  2425             }
       
  2426 
       
  2427     };
       
  2428 
       
  2429 CLocUpdateCallBack6* CLocUpdateCallBack6 :: NewL(TInt transid,TInt req,CLocationService* obj)
       
  2430     {
       
  2431     CLocUpdateCallBack6* temp = new(ELeave) CLocUpdateCallBack6(transid,req,obj);
       
  2432     temp->iSelf = temp;
       
  2433     return temp;
       
  2434     }
       
  2435 
       
  2436 CLocUpdateCallBack6 :: ~CLocUpdateCallBack6()
       
  2437     {
       
  2438     delete (this->CoreObj);
       
  2439     }
  2191 TInt CLocUpdateCallBack6 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt /*aError*/)
  2440 TInt CLocUpdateCallBack6 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt /*aError*/)
  2192 	{
  2441     {
  2193 	TInt aRet;
  2442     TInt aRet;
  2194 	TPosition currPos1;
  2443     TPosition currPos1;
  2195 	
  2444     currPos->GetPosition(currPos1);
  2196 	currPos->GetPosition(currPos1);
  2445 
  2197 	
  2446     aRet = ValidatePosition(currPos1);
  2198 	aRet = ValidatePosition(currPos1);
  2447 
  2199     
       
  2200     if( KErrNone == aRet )
  2448     if( KErrNone == aRet )
  2201     	{
  2449         {
  2202       	CActiveScheduler *Current = CActiveScheduler :: Current() ;
  2450         CActiveScheduler *Current = CActiveScheduler :: Current() ;
  2203 	  	Current->Stop() ;
  2451         Current->Stop() ;
  2204         returnCode = KErrNone;
  2452         returnCode = KErrNone;
  2205         delete this;
  2453         delete this;
  2206         }
  2454         }
  2207     else  
  2455     else  
  2208 	    {
  2456         {
  2209 	 	CActiveScheduler *Current = CActiveScheduler :: Current() ;
  2457         CActiveScheduler *Current = CActiveScheduler :: Current() ;
  2210 	 	Current->Stop() ;
  2458         Current->Stop() ;
  2211 	  	returnCode = KErrGeneral;
  2459         returnCode = KErrGeneral;
  2212 	  	delete this;
  2460         delete this;
  2213 	    }
  2461         }
       
  2462     OpenFile();  
       
  2463     LogFile.Write(_L8("CLocUpdateCallBack6 :: Before retrunin to runl"));
       
  2464     LogFile.Write(_L8("\n")) ;
       
  2465     CloseFile();
  2214     return KErrNone ;
  2466     return KErrNone ;
  2215  	}
  2467     }
  2216  	
  2468 
  2217 class TraceLCallBack6 : public MLocationCallBack
  2469 class TraceLCallBack6 : public MLocationCallBack
  2218  	{
  2470     {
  2219   	TInt iCount ;
  2471     TInt iCount ;
  2220     TInt iRetStatus ;
  2472     TInt iRetStatus ;
  2221     CLocationService *CoreObj;
  2473     CLocationService *CoreObj;
       
  2474     TInt iTransactionId;
       
  2475     TInt iRequestType;
  2222     public :
  2476     public :
  2223     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2477         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2224     TraceLCallBack6(CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral)
  2478         TraceLCallBack6(TInt transId,TInt req,CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral)
  2225    		{
  2479             {
  2226    	 	iCount = count;
  2480             iTransactionId = transId;
  2227    	 	iRetStatus = status;
  2481             iRequestType = req;
  2228    	 	CoreObj = LocObj;	
  2482             iCount = count;
  2229    		}
  2483             iRetStatus = status;
  2230  	};
  2484             CoreObj = LocObj;	
  2231   
  2485             }
  2232     
  2486 
       
  2487         inline TUint GetRequestType(void) 
       
  2488             {
       
  2489             return iRequestType ;
       
  2490             }
       
  2491 
       
  2492 
       
  2493         /**
       
  2494          * GetTransactionId function returns transcation id associated with current async object
       
  2495          *
       
  2496          */
       
  2497         inline TInt32 GetTransactionId(void)
       
  2498             {
       
  2499             return iTransactionId ;
       
  2500             }
       
  2501 
       
  2502 
       
  2503 
       
  2504     };
       
  2505 
       
  2506 
  2233 TInt TraceLCallBack6 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  2507 TInt TraceLCallBack6 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  2234 	{
  2508     {
  2235 	 TInt aRet1;
  2509     TInt aRet1;
  2236 	 if(KErrNone == aError && iCount<1)
  2510     if(KErrNone == aError && iCount<1)
  2237 	 	{
  2511         {
  2238 	    TPosition currPos1;
  2512         TPosition currPos1;
  2239 	   	currPos->GetPosition(currPos1);
  2513         currPos->GetPosition(currPos1);
  2240 	   	ValidatePosition(currPos1);
  2514         ValidatePosition(currPos1);
  2241     	iCount++;	 
  2515         iCount++;	 
  2242 	 	}
  2516         }
  2243 		
  2517 
  2244      else
  2518     else
  2245 	 	{
  2519         {
  2246 	   	aRet1 = CoreObj->CancelOnGoingService(1);
  2520         aRet1 = CoreObj->CancelOnGoingService(1);
  2247     	
  2521 
  2248     	if( KErrNone == aRet1 )
  2522         if( KErrNone == aRet1 )
  2249     		{
  2523             {
  2250     		TPosition aPosition2;  
  2524             TPosition aPosition2;  
  2251 		    CLocationService *CoreObj1 = CLocationService ::NewL() ;
  2525             CLocationService *CoreObj1 = CLocationService ::NewL() ;
  2252 		    
  2526 
  2253 	    	_LIT(Kidentity ,"Coreclass Testing" ) ;
  2527             _LIT(Kidentity ,"Coreclass Testing" ) ;
  2254 			//not needed any more
  2528             //not needed any more
  2255 			/*RRequestorStack aRequestorStack;
  2529             /*RRequestorStack aRequestorStack;
  2256 			const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2530 			const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2257 		    aRequestorStack.Insert(identityInfo,0);
  2531 		    aRequestorStack.Insert(identityInfo,0);
  2258 		    
  2532 
  2259 		    CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/
  2533 		    CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/
  2260     
  2534 
  2261 		    CLocUpdateCallBack6 *MyUpdates1 =  CLocUpdateCallBack6 :: NewL(CoreObj1);
  2535             CLocUpdateCallBack6 *MyUpdates1 =  CLocUpdateCallBack6 :: NewL(26,GETLOCATION,CoreObj1);
  2262 		    
  2536 
  2263 		    CoreObj1->GetLocationL(MyUpdates1) ;
  2537             CoreObj1->GetLocationL(MyUpdates1) ;
  2264 		    
  2538 
  2265 		    //aRequestorStack.Close();
  2539             //aRequestorStack.Close();
  2266     		
  2540 
  2267 		    
  2541 
  2268 		    returnCode = KErrNone;
  2542             returnCode = KErrNone;
  2269     		}
  2543             }
  2270     	else
  2544         else
  2271     		{
  2545             {
  2272     		returnCode = KErrGeneral;
  2546             returnCode = KErrGeneral;
  2273        		}	
  2547             }	
  2274 	 	}
  2548         }
  2275 	return KErrNone; 
  2549     return KErrNone; 
  2276 	}
  2550     }
  2277   
  2551 
  2278   
  2552 
  2279 TInt TraceLFunction6L()
  2553 TInt TraceLFunction6L()
  2280 	{
  2554     {
       
  2555     __UHEAP_MARK;
       
  2556 
       
  2557     CActiveScheduler *Scheduler = new CActiveScheduler ;
       
  2558 
       
  2559     CActiveScheduler :: Install(Scheduler) ;
  2281     TInt ret1;
  2560     TInt ret1;
  2282     TPosition aPosition1;  
  2561     TPosition aPosition1;  
  2283     CLocationService *CoreObj = CLocationService ::NewL() ;
  2562     CLocationService *CoreObj = CLocationService ::NewL() ;
  2284     TraceLCallBack6 MyUpdates2(CoreObj) ;
  2563     TraceLCallBack6 MyUpdates2(36,TRACE,CoreObj) ;
  2285     
  2564 
  2286     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2565     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2287 	//not needed any more
  2566     //not needed any more
  2288 	/*RRequestorStack aRequestorStack;
  2567     /*RRequestorStack aRequestorStack;
  2289 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2568 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2290     aRequestorStack.Insert(identityInfo,0);
  2569     aRequestorStack.Insert(identityInfo,0);
  2291     
  2570 
  2292     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2571     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2293     
  2572     TPositionUpdateOptions updateOpts;
  2294     ret1 = CoreObj->TraceL(&MyUpdates2) ;
  2573     updateOpts.SetUpdateInterval(5000000);
  2295     
  2574 
       
  2575     TRAP(ret1 , CoreObj->TraceL(&MyUpdates2,0,NULL,&updateOpts) );
       
  2576 
  2296     if( KErrNone == ret1)
  2577     if( KErrNone == ret1)
  2297     	{	
  2578         {	
  2298        	OpenFile();
  2579         OpenFile();
  2299 	 	LogFile.Write(_L8("\n<TraceLPosition6 test>\n"));
  2580         LogFile.Write(_L8("\n<TraceLPosition6 test>\n"));
  2300 	 	CloseFile();
  2581         CloseFile();
  2301 	 	CActiveScheduler :: Start() ;
  2582         CActiveScheduler :: Start() ;
  2302     	}
  2583         }
  2303     else
  2584     else
  2304     	{
  2585         {
  2305       	returnCode = KErrGeneral;
  2586         returnCode = KErrGeneral;
  2306     	}
  2587         }
  2307    
  2588 
  2308     //aRequestorStack.Close();
  2589     //aRequestorStack.Close();
  2309     
  2590 
  2310     delete CoreObj;
  2591     delete CoreObj;
  2311    return KErrNone;
  2592     delete Scheduler ;
  2312    }
  2593     __UHEAP_MARKEND;
       
  2594     OpenFile();
       
  2595     LogFile.Write(_L8("\n<TraceLPosition6 test after uheap>\n"));
       
  2596     CloseFile();
       
  2597     return KErrNone;
       
  2598     }
  2313 
  2599 
  2314 
  2600 
  2315 
  2601 
  2316 TInt CSAPILocTest::TraceLPosition6( CStifItemParser& /*aItem*/ )
  2602 TInt CSAPILocTest::TraceLPosition6( CStifItemParser& /*aItem*/ )
  2317 	{
  2603     {
       
  2604 
       
  2605     _LIT(KTLocTest ,"TLocTest");
       
  2606     iLog->Log(KTLocTest) ;
       
  2607 
       
  2608     TRequestStatus Status = KRequestPending  ;
       
  2609     RThread FunctionThread ;
       
  2610 
       
  2611     FunctionThread.Create(_L("GetLocationAsynch Thread") , TraceLPosition6T ,KDefaultStackSize , 
       
  2612             KMinHeapSize , KDefaultStackSize ,(TAny *) NULL);
       
  2613 
       
  2614     FunctionThread.Logon(Status)    ;
       
  2615     FunctionThread.Resume() ;
       
  2616 
       
  2617     User :: WaitForRequest (Status) ;               
       
  2618     FunctionThread.Close();
       
  2619 
       
  2620     return Status.Int() ;   
       
  2621     }
       
  2622 
       
  2623 TInt TraceLPosition6T( TAny */*Arg*/)
       
  2624     {
  2318     returnCode = KErrNone;
  2625     returnCode = KErrNone;
  2319      // Print to UI
  2626 
  2320     _LIT( KSAPILocTest, "SAPILocTest" );
  2627     TInt err = KErrNone;
  2321     _LIT( KExample, "TraceLPosition6" );
  2628 
  2322     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2629     CTrapCleanup* cleanup = CTrapCleanup::New();
  2323     
  2630     TRAP(err , TraceLFunction6L()) ;
  2324    __UHEAP_MARK;
  2631     if(err)
  2325    
  2632         {
  2326    TRAPD(err , TraceLFunction6L()) ;
  2633 
  2327    if(err)
  2634         returnCode = KErrGeneral;
  2328    returnCode = KErrGeneral;
  2635         }
  2329    
  2636     //TInt alloc1 = User::CountAllocCells();
  2330    __UHEAP_MARKEND;
  2637 
  2331     
  2638 
  2332    return returnCode;  
  2639     delete cleanup ;
  2333 	}
  2640     return returnCode;
  2334 	
  2641     }
  2335 	
  2642 
       
  2643 
  2336 // -----------------------------------------------------------------------------
  2644 // -----------------------------------------------------------------------------
  2337 // CSAPILocTest::TraceLPosition7
  2645 // CSAPILocTest::TraceLPosition7
  2338 // -----------------------------------------------------------------------------
  2646 // -----------------------------------------------------------------------------
  2339 //
  2647 //
  2340  	
  2648 
  2341 class TraceLCallBack7 : public MLocationCallBack
  2649 class TraceLCallBack7 : public MLocationCallBack
  2342  	{
  2650     {
  2343   	TInt iCount ;
  2651     TInt iCount ;
  2344     TInt iRetStatus ;
  2652     TInt iRetStatus ;
  2345     CLocationService *CoreObj;
  2653     CLocationService *CoreObj;
       
  2654     TInt iTransactionId;
       
  2655     TInt iRequestType;
  2346     public :
  2656     public :
  2347     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2657         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2348     TraceLCallBack7(CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral)
  2658         TraceLCallBack7(TInt transId,TInt req,CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral)
  2349    		{
  2659             {
  2350    	 	iCount = count;
  2660             iTransactionId= transId;
  2351    	 	iRetStatus = status;
  2661             iRequestType = req;
  2352    	 	CoreObj = LocObj;	
  2662             iCount = count;
  2353    		}
  2663             iRetStatus = status;
  2354  	};
  2664             CoreObj = LocObj;	
  2355   
  2665             }
  2356     
  2666         inline TUint GetRequestType(void) 
       
  2667             {
       
  2668             return iRequestType ;
       
  2669             }
       
  2670 
       
  2671 
       
  2672         /**
       
  2673          * GetTransactionId function returns transcation id associated with current async object
       
  2674          *
       
  2675          */
       
  2676         inline TInt32 GetTransactionId(void)
       
  2677             {
       
  2678             return iTransactionId ;
       
  2679             }
       
  2680     };
       
  2681 
       
  2682 
  2357 TInt TraceLCallBack7 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  2683 TInt TraceLCallBack7 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  2358 	{
  2684     {
  2359 	 User::After(30000000);
  2685     //User::After(30000000);
  2360 	 TInt aRet1;
  2686     TInt aRet1;
  2361 	 if(KErrNone == aError && iCount<2)
  2687     if(KErrNone == aError && iCount<2)
  2362 	 	{
  2688         {
  2363 	   	TPosition currPos1;
  2689         TPosition currPos1;
  2364 	   	currPos->GetPosition(currPos1);
  2690         currPos->GetPosition(currPos1);
  2365 	//   	ValidatePosition(currPos1);
  2691         //   	ValidatePosition(currPos1);
  2366     	iCount++;	 
  2692         iCount++;	 
  2367 	 	}
  2693         }
  2368 		
  2694 
  2369      else
  2695     else
  2370 	 	{
  2696         {
  2371 	   	aRet1 = CoreObj->CancelOnGoingService(1);
  2697         aRet1 = CoreObj->CancelOnGoingService(1);
  2372     	if( KErrNone == aRet1 )
  2698         if( KErrNone == aRet1 )
  2373     		{
  2699             {
  2374     		TPosition aPosition2;  
  2700             TPosition aPosition2;  
  2375 		    CLocationService *CoreObj1 = CLocationService ::NewL() ;
  2701             CLocationService *CoreObj1 = CLocationService ::NewL() ;
  2376 		    
  2702 
  2377 		    _LIT(Kidentity ,"Coreclass Testing" ) ;
  2703             _LIT(Kidentity ,"Coreclass Testing" ) ;
  2378 			//not needed any more
  2704             //not needed any more
  2379 			/*RRequestorStack aRequestorStack;
  2705             /*RRequestorStack aRequestorStack;
  2380 			const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2706 			const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2381 		    aRequestorStack.Insert(identityInfo,0);
  2707 		    aRequestorStack.Insert(identityInfo,0);
  2382 		    
  2708 
  2383 		    CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/
  2709 		    CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/
  2384     
  2710 
  2385 		    CTraceLCallBack5 *MyUpdates2 = CTraceLCallBack5::NewL(CoreObj1);
  2711             CTraceLCallBack5 *MyUpdates2 = CTraceLCallBack5::NewL(19,TRACE,CoreObj1);
  2386 	    	
  2712 
  2387 	    	CoreObj1->TraceL(MyUpdates2) ;
  2713             CoreObj1->TraceL(MyUpdates2) ;
  2388 		    
  2714 
  2389 		    User::After(30000000) ;
  2715             // User::After(30000000) ;
  2390 		    //aRequestorStack.Close();
  2716             //aRequestorStack.Close();
  2391     		
  2717 
  2392 		    
  2718 
  2393 		    returnCode = KErrNone;
  2719             returnCode = KErrNone;
  2394     		}
  2720             }
  2395     	else
  2721         else
  2396     		{
  2722             {
  2397     		returnCode = KErrGeneral;
  2723             returnCode = KErrGeneral;
  2398        		}	
  2724             }	
  2399 	 	}
  2725         }
  2400 	return KErrNone; 
  2726     return KErrNone; 
  2401 	}
  2727     }
  2402   
  2728 
  2403   
  2729 
  2404 TInt TraceLFunction7L()
  2730 TInt TraceLFunction7L()
  2405 	{
  2731     {
       
  2732     __UHEAP_MARK ;
  2406     TInt ret1;
  2733     TInt ret1;
  2407     TPosition aPosition1;  
  2734     TPosition aPosition1;  
  2408     CLocationService *CoreObj = CLocationService ::NewL() ;
  2735     CLocationService *CoreObj = CLocationService ::NewL() ;
  2409     
  2736 
  2410     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2737     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2411     //not needed any more
  2738     //not needed any more
  2412 	
  2739 
  2413 	/*RRequestorStack aRequestorStack;
  2740     /*RRequestorStack aRequestorStack;
  2414 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2741 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2415     aRequestorStack.Insert(identityInfo,0);
  2742     aRequestorStack.Insert(identityInfo,0);
  2416     
  2743 
  2417     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2744     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2418     
  2745 
  2419     TraceLCallBack7 MyUpdates1(CoreObj) ;
  2746     TraceLCallBack7 MyUpdates1(20,TRACE,CoreObj) ;
  2420     
  2747 
  2421     ret1 = CoreObj->TraceL(&MyUpdates1) ;
  2748     TRAP(ret1 , CoreObj->TraceL(&MyUpdates1) );
  2422     
  2749 
  2423     if( KErrNone == ret1)
  2750     if( KErrNone == ret1)
  2424     	{	
  2751         {	
  2425        	OpenFile();
  2752         OpenFile();
  2426 	 	LogFile.Write(_L8("\n<TraceLPosition7 test>\n"));
  2753         LogFile.Write(_L8("\n<TraceLPosition7 test>\n"));
  2427 	 	CloseFile();
  2754         CloseFile();
  2428 	 	CActiveScheduler :: Start() ;
  2755         CActiveScheduler :: Start() ;
  2429     	}
  2756         }
  2430     else
  2757     else
  2431     	{
  2758         {
  2432       	returnCode = KErrGeneral;
  2759         returnCode = KErrGeneral;
  2433     	}
  2760         }
  2434    
  2761 
  2435    //aRequestorStack.Close();
  2762     //aRequestorStack.Close();
  2436    
  2763 
  2437    delete CoreObj;
  2764     delete CoreObj;
  2438    return KErrNone;
  2765     __UHEAP_MARKEND ;
  2439    }
  2766     return KErrNone;
       
  2767     }
  2440 
  2768 
  2441 
  2769 
  2442 
  2770 
  2443 TInt CSAPILocTest::TraceLPosition7( CStifItemParser& /*aItem*/ )
  2771 TInt CSAPILocTest::TraceLPosition7( CStifItemParser& /*aItem*/ )
  2444 	{
  2772     {
  2445     returnCode = KErrNone;
  2773     returnCode = KErrNone;
  2446      // Print to UI
  2774     // Print to UI
  2447     _LIT( KSAPILocTest, "SAPILocTest" );
  2775     _LIT( KSAPILocTest, "SAPILocTest" );
  2448     _LIT( KExample, "TraceLPosition7" );
  2776     _LIT( KExample, "TraceLPosition7" );
  2449     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2777     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2450     
  2778 
  2451    __UHEAP_MARK;
  2779     __UHEAP_MARK;
  2452    
  2780 
  2453    TRAPD(err , TraceLFunction7L()) ;
  2781     TRAPD(err , TraceLFunction7L()) ;
  2454    if(err)
  2782     if(err)
  2455    returnCode = KErrGeneral;
  2783         returnCode = KErrGeneral;
  2456    
  2784 
  2457    __UHEAP_MARKEND;
  2785     __UHEAP_MARKEND;
  2458     
  2786 
  2459    return returnCode;  
  2787     return returnCode;  
  2460 	}
  2788     }
  2461 
  2789 
  2462 // -----------------------------------------------------------------------------
  2790 // -----------------------------------------------------------------------------
  2463 // CSAPILocTest::TraceLPosition8
  2791 // CSAPILocTest::TraceLPosition8
  2464 // -----------------------------------------------------------------------------
  2792 // -----------------------------------------------------------------------------
  2465 //
  2793 //
  2466 	
  2794 
  2467 class LocUpdateCallBack8 : public MLocationCallBack
  2795 class LocUpdateCallBack8 : public MLocationCallBack
  2468  	{
  2796     {
  2469     TInt iCount ;
  2797     TInt iCount ;
  2470     TInt iRetStatus ;
  2798     TInt iRetStatus ;
       
  2799     TInt iRequestType;
       
  2800     TInt iTransactionId;
  2471     public :
  2801     public :
  2472     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2802         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2473     LocUpdateCallBack8() :iCount(0) , iRetStatus(KErrGeneral){;}
  2803         LocUpdateCallBack8(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){
  2474   	};
  2804         iTransactionId = transId;
  2475   
  2805         iRequestType = req;
  2476     
  2806         }
       
  2807 
       
  2808         inline TUint GetRequestType(void) 
       
  2809             {
       
  2810             return iRequestType ;
       
  2811             }
       
  2812 
       
  2813 
       
  2814         /**
       
  2815          * GetTransactionId function returns transcation id associated with current async object
       
  2816          *
       
  2817          */
       
  2818         inline TInt32 GetTransactionId(void)
       
  2819             {
       
  2820             return iTransactionId ;
       
  2821             }
       
  2822     };
       
  2823 
       
  2824 
  2477 TInt LocUpdateCallBack8 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt /*aError*/)
  2825 TInt LocUpdateCallBack8 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt /*aError*/)
  2478 	{
  2826     {
  2479 	  
  2827 
  2480 	 TInt aRet;
  2828     TInt aRet;
  2481 	 TPosition currPos1;
  2829     TPosition currPos1;
  2482 	 currPos->GetPosition(currPos1);
  2830     currPos->GetPosition(currPos1);
  2483 	 aRet = ValidatePosition(currPos1);
  2831     aRet = ValidatePosition(currPos1);
  2484      if ( KErrNone == aRet)
  2832     if ( KErrNone == aRet)
  2485      	{
  2833         {
  2486       	TPosition aPosition2;  
  2834         TPosition aPosition2;  
  2487 	    CLocationService *CoreObj1 = CLocationService ::NewL() ;
  2835         CLocationService *CoreObj1 = CLocationService ::NewL() ;
  2488 	    
  2836 
  2489 	    _LIT(Kidentity ,"Coreclass Testing" ) ;
  2837         _LIT(Kidentity ,"Coreclass Testing" ) ;
  2490 		//not needed any more
  2838         //not needed any more
  2491 		/*RRequestorStack aRequestorStack;
  2839         /*RRequestorStack aRequestorStack;
  2492 		const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2840 		const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2493 	    
  2841 
  2494 	    aRequestorStack.Insert(identityInfo,0);
  2842 	    aRequestorStack.Insert(identityInfo,0);
  2495 	    	    
  2843 
  2496 	    CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/
  2844 	    CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/
  2497     
  2845 
  2498 	    CLocUpdateCallBack6 *MyUpdates2 =  CLocUpdateCallBack6 :: NewL(CoreObj1);
  2846         CLocUpdateCallBack6 *MyUpdates2 =  CLocUpdateCallBack6 :: NewL(27,GETLOCATION,CoreObj1);
  2499 		
  2847 
  2500 		CoreObj1->GetLocationL(MyUpdates2) ;
  2848         CoreObj1->GetLocationL(MyUpdates2) ;
  2501 	    
  2849 
  2502 	    /*aRequestorStack.Close();
  2850         /*aRequestorStack.Close();
  2503     	delete identityInfo;*/
  2851     	delete identityInfo;*/
  2504 	    }
  2852         }
  2505      return KErrNone ;
  2853     return KErrNone ;
  2506 	}
  2854     }
  2507 
  2855 
  2508 
  2856 
  2509 TInt TraceLFunction8L()
  2857 TInt TraceLFunction8L()
  2510 	{
  2858     {
       
  2859     __UHEAP_MARK ;
  2511     TInt ret1;
  2860     TInt ret1;
  2512     TPosition aPosition1;  
  2861     TPosition aPosition1;  
  2513     CLocationService *CoreObj = CLocationService ::NewL() ;
  2862     CLocationService *CoreObj = CLocationService ::NewL() ;
  2514     LocUpdateCallBack8 MyUpdates1 ;
  2863     LocUpdateCallBack8 MyUpdates1(21,GETLOCATION) ;
  2515     
  2864 
  2516     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2865     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2517 	//not needed any more
  2866     //not needed any more
  2518 	/*RRequestorStack aRequestorStack;
  2867     /*RRequestorStack aRequestorStack;
  2519 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2868 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2520     aRequestorStack.Insert(identityInfo,0);
  2869     aRequestorStack.Insert(identityInfo,0);
  2521     
  2870 
  2522     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2871     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2523     
  2872     TPositionUpdateOptions updateOpts;
  2524     ret1 = CoreObj->GetLocationL(&MyUpdates1) ;
  2873     updateOpts.SetUpdateInterval(5000000);      
  2525     
  2874 
       
  2875     TRAP(ret1 , CoreObj->GetLocationL(&MyUpdates1,0,NULL,&updateOpts) );
       
  2876 
  2526     if( KErrNone == ret1)
  2877     if( KErrNone == ret1)
  2527     	{
  2878         {
  2528        	OpenFile();
  2879         OpenFile();
  2529 	 	LogFile.Write(_L8("\n<TraceLPosition8 test>\n"));
  2880         LogFile.Write(_L8("\n<TraceLPosition8 test>\n"));
  2530 	 	CloseFile();
  2881         CloseFile();
  2531 	 	CActiveScheduler :: Start() ;
  2882         CActiveScheduler :: Start() ;
  2532     	}
  2883         }
  2533     else
  2884     else
  2534     	{
  2885         {
  2535       	returnCode = KErrGeneral;
  2886         returnCode = KErrGeneral;
  2536     	}
  2887         }
  2537     
  2888 
  2538     /*aRequestorStack.Close();
  2889     /*aRequestorStack.Close();
  2539     delete identityInfo;*/
  2890     delete identityInfo;*/
  2540     delete CoreObj;
  2891     delete CoreObj;
  2541     
  2892     __UHEAP_MARKEND ;
  2542     return KErrNone;
  2893     return KErrNone;
  2543 	}
  2894     }
  2544 
  2895 
  2545 TInt CSAPILocTest::TraceLPosition8( CStifItemParser& /*aItem*/ )
  2896 TInt CSAPILocTest::TraceLPosition8( CStifItemParser& /*aItem*/ )
  2546 	{
  2897     {
  2547     returnCode = KErrNone;
  2898     returnCode = KErrNone;
  2548     // Print to UI
  2899     // Print to UI
  2549     _LIT( KSAPILocTest, "SAPILocTest" );
  2900     _LIT( KSAPILocTest, "SAPILocTest" );
  2550     _LIT( KExample, "TraceLPosition8" );
  2901     _LIT( KExample, "TraceLPosition8" );
  2551     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2902     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2552     
  2903 
  2553     
  2904 
  2554     __UHEAP_MARK;
  2905     __UHEAP_MARK;
  2555     
  2906 
  2556     TRAPD(err , TraceLFunction8L()) ;
  2907     TRAPD(err , TraceLFunction8L()) ;
  2557     if(err)
  2908     if(err)
  2558     returnCode = KErrGeneral;
  2909         returnCode = KErrGeneral;
  2559     
  2910 
  2560      __UHEAP_MARKEND;
  2911     __UHEAP_MARKEND;
  2561   
  2912 
  2562      return returnCode;  
  2913     return returnCode;  
  2563 	}
  2914     }
  2564 	
  2915 
  2565 	
  2916 
  2566 // -----------------------------------------------------------------------------
  2917 // -----------------------------------------------------------------------------
  2567 // CSAPILocTest::TraceLPositionOpts
  2918 // CSAPILocTest::TraceLPositionOpts
  2568 // -----------------------------------------------------------------------------
  2919 // -----------------------------------------------------------------------------
  2569 //
  2920 //
  2570 class TraceLCallBackTO : public MLocationCallBack
  2921 class TraceLCallBackTO : public MLocationCallBack
  2571 	{
  2922     {
  2572     TInt iCount ;
  2923     TInt iCount ;
  2573     TInt iRetStatus ;
  2924     TInt iRetStatus ;
       
  2925     TInt iTransactionId;
       
  2926     TInt iRequestType;
  2574     public :
  2927     public :
  2575     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2928         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2576     TraceLCallBackTO() :iCount(0) , iRetStatus(KErrGeneral){;}
  2929         TraceLCallBackTO(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){
       
  2930         iTransactionId = transId;
       
  2931         iRequestType = req;
       
  2932         }
       
  2933 
       
  2934         inline TUint GetRequestType(void) 
       
  2935             {
       
  2936             return iRequestType ;
       
  2937             }
       
  2938 
       
  2939 
       
  2940         /**
       
  2941          * GetTransactionId function returns transcation id associated with current async object
       
  2942          *
       
  2943          */
       
  2944         inline TInt32 GetTransactionId(void)
       
  2945             {
       
  2946             return iTransactionId ;
       
  2947             }
  2577     };
  2948     };
  2578   
  2949 
  2579 TInt TraceLCallBackTO :: HandleNotifyL(HPositionGenericInfo* /*currPos*/ , TInt aError)
  2950 TInt TraceLCallBackTO :: HandleNotifyL(HPositionGenericInfo* /*currPos*/ , TInt aError)
  2580 	{
  2951     {
  2581 	if(KErrTimedOut == aError)
  2952     if(KErrTimedOut == aError)
  2582 		 {
  2953         {
  2583 	 	 CActiveScheduler *Current = CActiveScheduler :: Current() ;
  2954         CActiveScheduler *Current = CActiveScheduler :: Current() ;
  2584 	  	 Current->Stop() ;
  2955         Current->Stop() ;
  2585 	  	 OpenFile();
  2956         OpenFile();
  2586 	  	 LogFile.Write(_L8("Passed..\n"));
  2957         LogFile.Write(_L8("Passed..\n"));
  2587 	  	 CloseFile();
  2958         CloseFile();
  2588 	  	 returnCode = KErrNone;
  2959         returnCode = KErrNone;
  2589 	  	 return KErrNone ;	
  2960         return KErrNone ;	
  2590     	 }
  2961         }
  2591     else
  2962     else
  2592 		 {
  2963         {
  2593 	 	 CActiveScheduler *Current = CActiveScheduler :: Current() ;
  2964         CActiveScheduler *Current = CActiveScheduler :: Current() ;
  2594 	  	 Current->Stop() ;
  2965         Current->Stop() ;
  2595 	  	 OpenFile();
  2966         OpenFile();
  2596 	  	 LogFile.Write(_L8("Failed..\n"));
  2967         LogFile.Write(_L8("Failed..\n"));
  2597 	  	 CloseFile();
  2968         CloseFile();
  2598 	  	 returnCode = KErrGeneral;
  2969         returnCode = KErrGeneral;
  2599 	 	 return KErrNone; 
  2970         return KErrNone; 
  2600 		 }
  2971         }
  2601 	}
  2972     }
  2602 
  2973 
  2603 
  2974 
  2604 TInt TraceLFunctionOptsL()
  2975 TInt TraceLFunctionOptsL()
  2605 	{
  2976     {
       
  2977     __UHEAP_MARK ;
  2606     TInt ret1;
  2978     TInt ret1;
  2607     TPosition aPosition1;
  2979     TPosition aPosition1;
  2608     TPositionUpdateOptions aOptions;
  2980     TPositionUpdateOptions aOptions;
  2609     TTimeIntervalMicroSeconds aTimeOut = 10;  
  2981     TTimeIntervalMicroSeconds aTimeOut = 10;  
  2610     CLocationService *CoreObj = CLocationService ::NewL() ;
  2982     CLocationService *CoreObj = CLocationService ::NewL() ;
  2611     
  2983 
  2612     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2984     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2613 	//not needed any more
  2985     //not needed any more
  2614 	/*RRequestorStack aRequestorStack;
  2986     /*RRequestorStack aRequestorStack;
  2615 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2987 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2616     aRequestorStack.Insert(identityInfo,0);
  2988     aRequestorStack.Insert(identityInfo,0);
  2617     
  2989 
  2618     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2990     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2619     
  2991 
  2620     aOptions.SetUpdateTimeOut(aTimeOut);
  2992     aOptions.SetUpdateTimeOut(aTimeOut);
  2621     
  2993 
  2622     TraceLCallBackTO MyUpdates;
  2994     TraceLCallBackTO MyUpdates(22,TRACE);
  2623     
  2995 
  2624     ret1 = CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ;
  2996     TRAP(ret1 , CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) );
  2625     
  2997 
  2626     if( KErrNone == ret1)
  2998     if( KErrNone == ret1)
  2627     	{
  2999         {
  2628         OpenFile();
  3000         OpenFile();
  2629 	 	LogFile.Write(_L8("\n<TraceLPositionOpts test>\n"));
  3001         LogFile.Write(_L8("\n<TraceLPositionOpts test>\n"));
  2630 	 	CloseFile();
  3002         CloseFile();
  2631 	 	CActiveScheduler::Start();
  3003         CActiveScheduler::Start();
  2632    		}
  3004         }
  2633     
  3005 
  2634     else
  3006     else
  2635     	{
  3007         {
  2636     	returnCode = KErrGeneral;	
  3008         returnCode = KErrGeneral;	
  2637     	}
  3009         }
  2638     /*aRequestorStack.Close();
  3010     /*aRequestorStack.Close();
  2639     delete identityInfo;*/
  3011     delete identityInfo;*/
  2640     delete CoreObj;
  3012     delete CoreObj;
       
  3013     __UHEAP_MARKEND ;
  2641     return 0;
  3014     return 0;
  2642 	}
  3015     }
  2643 
  3016 
  2644 TInt CSAPILocTest::TraceLPositionOpts( CStifItemParser& /*aItem*/ )
  3017 TInt CSAPILocTest::TraceLPositionOpts( CStifItemParser& /*aItem*/ )
  2645 	{
  3018     {
  2646     returnCode = KErrNone;
  3019     returnCode = KErrNone;
  2647     // Print to UI
  3020     // Print to UI
  2648     _LIT( KSAPILocTest, "SAPILocTest" );
  3021     _LIT( KSAPILocTest, "SAPILocTest" );
  2649     _LIT( KExample, "TraceLPositionOpts" );
  3022     _LIT( KExample, "TraceLPositionOpts" );
  2650     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3023     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2651    
  3024 
  2652 	 __UHEAP_MARK;
  3025     __UHEAP_MARK;
  2653     
  3026 
  2654     TRAPD(err , TraceLFunctionOptsL()) ;
  3027     TRAPD(err , TraceLFunctionOptsL()) ;
  2655     if(err)
  3028     if(err)
  2656     returnCode = KErrGeneral;
  3029         returnCode = KErrGeneral;
  2657     
  3030 
  2658     __UHEAP_MARKEND;
  3031     __UHEAP_MARKEND;
  2659     
  3032 
  2660     return returnCode;  
  3033     return returnCode;  
  2661 	}
  3034     }
  2662 
  3035 
  2663 // -----------------------------------------------------------------------------
  3036 // -----------------------------------------------------------------------------
  2664 // CSAPILocTest::TraceLPositionOpts1
  3037 // CSAPILocTest::TraceLPositionOpts1
  2665 // -----------------------------------------------------------------------------
  3038 // -----------------------------------------------------------------------------
  2666 //
  3039 //
  2667 class TraceLCallBackOpts1 : public MLocationCallBack
  3040 class TraceLCallBackOpts1 : public MLocationCallBack
  2668 	{
  3041     {
  2669     TInt iCount ;
  3042     TInt iCount ;
  2670     TInt iRetStatus ;
  3043     TInt iRetStatus ;
  2671     CLocationService *CoreObj;
  3044     CLocationService *CoreObj;
       
  3045     TInt iTransactionId;
       
  3046     TInt iRequestType;
  2672     public :
  3047     public :
  2673     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  3048         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2674     TraceLCallBackOpts1(TInt count = 0,TInt status = KErrGeneral)
  3049         TraceLCallBackOpts1(TInt transId,TInt req,TInt count = 0,TInt status = KErrGeneral)
  2675    		{
  3050             {
  2676    	 	iCount = count;
  3051             iRequestType = req;
  2677    	 	iRetStatus = status;
  3052             iTransactionId = transId;
  2678    		}
  3053             iCount = count;
  2679   	};
  3054             iRetStatus = status;
  2680   
  3055             }
  2681  
  3056 
       
  3057         inline TUint GetRequestType(void) 
       
  3058             {
       
  3059             return iRequestType ;
       
  3060             }
       
  3061 
       
  3062 
       
  3063         /**
       
  3064          * GetTransactionId function returns transcation id associated with current async object
       
  3065          *
       
  3066          */
       
  3067         inline TInt32 GetTransactionId(void)
       
  3068             {
       
  3069             return iTransactionId ;
       
  3070             }
       
  3071     };
       
  3072 
       
  3073 
  2682 TInt TraceLCallBackOpts1 :: HandleNotifyL(HPositionGenericInfo* /*currPos*/ , TInt /*aError*/){return 0;}
  3074 TInt TraceLCallBackOpts1 :: HandleNotifyL(HPositionGenericInfo* /*currPos*/ , TInt /*aError*/){return 0;}
  2683 
  3075 
  2684 
  3076 
  2685 
  3077 
  2686 TInt TraceLFunctionOpts1L()
  3078 TInt TraceLFunctionOpts1L()
  2687 	{
  3079     {
  2688     TInt ret1;
  3080     TInt ret1;
  2689     TPosition aPosition1;
  3081     TPosition aPosition1;
  2690     TPositionUpdateOptions aOptions;
  3082     TPositionUpdateOptions aOptions;
  2691     TTimeIntervalMicroSeconds aTimeOut = 10000000; 
  3083     TTimeIntervalMicroSeconds aTimeOut = 10000000; 
  2692     TTimeIntervalMicroSeconds aTimeInterval = 30000000; 
  3084     TTimeIntervalMicroSeconds aTimeInterval = 30000000; 
  2693     
  3085 
  2694     CLocationService *CoreObj = CLocationService ::NewL() ;
  3086     CLocationService *CoreObj = CLocationService ::NewL() ;
  2695     
  3087 
  2696     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3088     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2697 	//not needed any more
  3089     //not needed any more
  2698 	/*RRequestorStack aRequestorStack;
  3090     /*RRequestorStack aRequestorStack;
  2699 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3091 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2700     aRequestorStack.Insert(identityInfo,0);
  3092     aRequestorStack.Insert(identityInfo,0);
  2701     
  3093 
  2702     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3094     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2703     
  3095 
  2704     aOptions.SetUpdateTimeOut(aTimeOut);
  3096     aOptions.SetUpdateTimeOut(aTimeOut);
  2705     aOptions.SetUpdateInterval(aTimeInterval);
  3097     aOptions.SetUpdateInterval(aTimeInterval);
  2706     
  3098 
  2707     TraceLCallBackOpts1 MyUpdates;
  3099     TraceLCallBackOpts1 MyUpdates(23,TRACE);
  2708     
  3100 
  2709     ret1 = CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ;
  3101     TRAP(ret1 , CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) );
  2710     
  3102 
  2711     if( KErrArgument == ret1)
  3103     if( KErrArgument == ret1)
  2712     	{
  3104         {
  2713         OpenFile();
  3105         OpenFile();
  2714 	 	LogFile.Write(_L8("\n<TraceLPositionOpts1 test>\n"));
  3106         LogFile.Write(_L8("\n<TraceLPositionOpts1 test>\n"));
  2715 	 	LogFile.Write(_L8("Passed\n"));
  3107         LogFile.Write(_L8("Passed\n"));
  2716 	 	CloseFile();
  3108         CloseFile();
  2717 	 	returnCode = KErrNone;
  3109         returnCode = KErrNone;
  2718 	 	}
  3110         }
  2719     
  3111 
  2720     else
  3112     else
  2721     	{
  3113         {
  2722     	returnCode = KErrGeneral;
  3114         returnCode = KErrGeneral;
  2723     	}
  3115         }
  2724    	
  3116 
  2725    	/*aRequestorStack.Close();
  3117     /*aRequestorStack.Close();
  2726     delete identityInfo;*/
  3118     delete identityInfo;*/
  2727     delete CoreObj;
  3119     delete CoreObj;
  2728     return 0;
  3120     return 0;
  2729 	}
  3121     }
  2730 
  3122 
  2731 
  3123 
  2732 TInt CSAPILocTest::TraceLPositionOpts1( CStifItemParser& /*aItem*/ )
  3124 TInt CSAPILocTest::TraceLPositionOpts1( CStifItemParser& /*aItem*/ )
  2733 	{
  3125     {
  2734     returnCode = KErrNone;
  3126     returnCode = KErrNone;
  2735    
  3127 
  2736     // Print to UI
  3128     // Print to UI
  2737     _LIT( KSAPILocTest, "SAPILocTest" );
  3129     _LIT( KSAPILocTest, "SAPILocTest" );
  2738     _LIT( KExample, "TraceLPositionOpts1" );
  3130     _LIT( KExample, "TraceLPositionOpts1" );
  2739      TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3131     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2740     
  3132 
  2741      __UHEAP_MARK;
  3133     __UHEAP_MARK;
  2742    
  3134 
  2743     TRAPD(err , TraceLFunctionOpts1L()) ;
  3135     TRAPD(err , TraceLFunctionOpts1L()) ;
  2744     if(err)
  3136     if(err)
  2745     returnCode = KErrGeneral;
  3137         returnCode = KErrGeneral;
  2746    
  3138 
  2747      __UHEAP_MARKEND;
  3139     __UHEAP_MARKEND;
  2748     
  3140 
  2749     return returnCode;  
  3141     return returnCode;  
  2750 	}
  3142     }
  2751 
  3143 
  2752 
  3144 
  2753 // -----------------------------------------------------------------------------
  3145 // -----------------------------------------------------------------------------
  2754 // CSAPILocTest::TraceLPositionOpts2
  3146 // CSAPILocTest::TraceLPositionOpts2
  2755 // -----------------------------------------------------------------------------
  3147 // -----------------------------------------------------------------------------
  2756 //
  3148 //
  2757 TInt TraceLFunctionOpts2L()
  3149 TInt TraceLFunctionOpts2L()
  2758 	{
  3150     {
       
  3151     __UHEAP_MARK ;
  2759     TInt ret1;
  3152     TInt ret1;
  2760     TPosition aPosition1;
  3153     TPosition aPosition1;
  2761     TPositionUpdateOptions aOptions;
  3154     TPositionUpdateOptions aOptions;
  2762     TTimeIntervalMicroSeconds aTimeOut = 60000000; 
  3155     TTimeIntervalMicroSeconds aTimeOut = 60000000; 
  2763     TTimeIntervalMicroSeconds aTimeInterval = 30000000;
  3156     TTimeIntervalMicroSeconds aTimeInterval = 30000000;
  2764     TTimeIntervalMicroSeconds aInterval;
  3157     TTimeIntervalMicroSeconds aInterval;
  2765     TTime start,end;
  3158     TTime start,end;
  2766     
  3159 
  2767     CLocationService *CoreObj = CLocationService ::NewL() ;
  3160     CLocationService *CoreObj = CLocationService ::NewL() ;
  2768     //not needed any more
  3161     //not needed any more
  2769     /*_LIT(Kidentity ,"Coreclass Testing" ) ;
  3162     /*_LIT(Kidentity ,"Coreclass Testing" ) ;
  2770 	RRequestorStack aRequestorStack;
  3163 	RRequestorStack aRequestorStack;
  2771 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3164 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2772     aRequestorStack.Insert(identityInfo,0);
  3165     aRequestorStack.Insert(identityInfo,0);
  2773     
  3166 
  2774     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3167     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2775     
  3168 
  2776     aOptions.SetUpdateTimeOut(aTimeOut);
  3169     aOptions.SetUpdateTimeOut(aTimeOut);
  2777     aOptions.SetUpdateInterval(aTimeInterval);
  3170     aOptions.SetUpdateInterval(aTimeInterval);
  2778     
  3171 
  2779     TraceLCallBack MyUpdates;
  3172     TraceLCallBack MyUpdates(34,TRACE);
  2780     
  3173 
  2781     ret1 = CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ;
  3174     TRAP(ret1 , CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) );
  2782     
  3175 
  2783     if( KErrNone == ret1)
  3176     if( KErrNone == ret1)
  2784     	{
  3177         {
  2785         OpenFile();
  3178         OpenFile();
  2786 	 	LogFile.Write(_L8("\n<TraceLPositionOpts2 test>\n"));
  3179         LogFile.Write(_L8("\n<TraceLPositionOpts2 test>\n"));
  2787 	 	CloseFile();
  3180         CloseFile();
  2788 	 	start.HomeTime();
  3181         start.HomeTime();
  2789 	 	CActiveScheduler::Start();
  3182         CActiveScheduler::Start();
  2790 	 	end.HomeTime();
  3183         end.HomeTime();
  2791 	 	aInterval = end.MicroSecondsFrom(start);
  3184         aInterval = end.MicroSecondsFrom(start);
  2792 //	 	if(aInterval<150000000)
  3185         //	 	if(aInterval<150000000)
  2793 //	 	returnCode = KErrGeneral;
  3186         //	 	returnCode = KErrGeneral;
  2794    		}
  3187         }
  2795     
  3188 
  2796     else
  3189     else
  2797     	{
  3190         {
  2798     	returnCode = KErrGeneral;	
  3191         returnCode = KErrGeneral;	
  2799     	}
  3192         }
  2800     
  3193 
  2801     /*aRequestorStack.Close();
  3194     /*aRequestorStack.Close();
  2802     delete identityInfo;*/
  3195     delete identityInfo;*/
  2803     delete CoreObj;
  3196     delete CoreObj;
       
  3197     __UHEAP_MARKEND ;
  2804     return 0;
  3198     return 0;
  2805 	}
  3199     }
  2806 
  3200 
  2807 TInt CSAPILocTest::TraceLPositionOpts2( CStifItemParser& /*aItem*/ )
  3201 TInt CSAPILocTest::TraceLPositionOpts2( CStifItemParser& /*aItem*/ )
  2808 	{
  3202     {
  2809     returnCode = KErrNone;
  3203     returnCode = KErrNone;
  2810     // Print to UI
  3204     // Print to UI
  2811     _LIT( KSAPILocTest, "SAPILocTest" );
  3205     _LIT( KSAPILocTest, "SAPILocTest" );
  2812     _LIT( KExample, "TraceLPositionOpts2" );
  3206     _LIT( KExample, "TraceLPositionOpts2" );
  2813     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3207     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2814    
  3208 
  2815     __UHEAP_MARK;
  3209     __UHEAP_MARK;
  2816     
  3210 
  2817     TRAPD(err , TraceLFunctionOpts2L()) ;
  3211     TRAPD(err , TraceLFunctionOpts2L()) ;
  2818     if(err)
  3212     if(err)
  2819     returnCode = KErrGeneral;
  3213         returnCode = KErrGeneral;
  2820     
  3214 
  2821     __UHEAP_MARKEND;
  3215     __UHEAP_MARKEND;
  2822     
  3216 
  2823     return returnCode;  
  3217     return returnCode;  
  2824 	}
  3218     }
  2825 
  3219 
  2826 // -----------------------------------------------------------------------------
  3220 // -----------------------------------------------------------------------------
  2827 // CSAPILocTest::TraceLPositionOpts3
  3221 // CSAPILocTest::TraceLPositionOpts3
  2828 // -----------------------------------------------------------------------------
  3222 // -----------------------------------------------------------------------------
  2829 //
  3223 //
  2830 class TraceLCallBackOpts3 : public MLocationCallBack
  3224 class TraceLCallBackOpts3 : public MLocationCallBack
  2831 	{
  3225     {
  2832     TInt iCount ;
  3226     TInt iCount ;
  2833     TInt iRetStatus ;
  3227     TInt iRetStatus ;
       
  3228     TInt iTransactionId;
       
  3229     TInt iRequestType;
  2834     public :
  3230     public :
  2835     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  3231         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  2836     TraceLCallBackOpts3() :iCount(0) , iRetStatus(KErrGeneral){;}
  3232         TraceLCallBackOpts3(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){+
  2837   	};
  3233         iTransactionId = transId;
  2838   
  3234         iRequestType = req;
  2839   
  3235         }
  2840   
  3236 
       
  3237         inline TUint GetRequestType(void) 
       
  3238             {
       
  3239             return iRequestType ;
       
  3240             }
       
  3241 
       
  3242 
       
  3243         /**
       
  3244          * GetTransactionId function returns transcation id associated with current async object
       
  3245          *
       
  3246          */
       
  3247         inline TInt32 GetTransactionId(void)
       
  3248             {
       
  3249             return iTransactionId ;
       
  3250             }
       
  3251     };
       
  3252 
       
  3253 
       
  3254 
  2841 TInt TraceLCallBackOpts3 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  3255 TInt TraceLCallBackOpts3 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError)
  2842 	{
  3256     {
  2843 	 TTime timeStamp;
  3257     TTime timeStamp;
  2844 	 TInt64 timeInt;
  3258     TInt64 timeInt;
  2845 	 TBuf8<50> buf ;
  3259     TBuf8<50> buf ;
  2846  	 TRealFormat format ;
  3260     TRealFormat format ;
  2847 	 if(KErrNone == aError && iCount<2)
  3261     if(KErrNone == aError && iCount<2)
  2848 	 	{
  3262         {
  2849 	 	User::After(60000000);
  3263         //User::After(60000000);
  2850 	 	TPosition currPos1;
  3264         TPosition currPos1;
  2851 	 	currPos->GetPosition(currPos1);
  3265         currPos->GetPosition(currPos1);
  2852 	 	timeStamp = currPos1.Time();
  3266         timeStamp = currPos1.Time();
  2853         timeInt = timeStamp.Int64();
  3267         timeInt = timeStamp.Int64();
  2854         if(timeInt)
  3268         if(timeInt)
  2855         	{
  3269             {
  2856             OpenFile();
  3270             OpenFile();
  2857 	        buf.Num(timeInt , format) ;
  3271             buf.Num(timeInt , format) ;
  2858  		    LogFile.Write(_L8("\nTimestamp = "));
  3272             LogFile.Write(_L8("\nTimestamp = "));
  2859  		    LogFile.Write(buf) ;
  3273             LogFile.Write(buf) ;
  2860 	        CloseFile();
  3274             CloseFile();
  2861 	        returnCode = KErrNone;
  3275             returnCode = KErrNone;
  2862 	        }
  3276             }
  2863         else
  3277         else
  2864         	{
  3278             {
  2865         	returnCode = KErrGeneral;
  3279             returnCode = KErrGeneral;
  2866         	return 0;
  3280             return 0;
  2867         	}
  3281             }
  2868     	 iCount++;	 
  3282         iCount++;	 
  2869 	 	}
  3283         }
  2870 		
  3284 
  2871      else
  3285     else
  2872 	 	{
  3286         {
  2873 	 	CActiveScheduler *Current = CActiveScheduler :: Current() ;
  3287         CActiveScheduler *Current = CActiveScheduler :: Current() ;
  2874 	  	Current->Stop() ;
  3288         Current->Stop() ;
  2875 	 	}
  3289         }
  2876 	 return 0;
  3290     return 0;
  2877 	}
  3291     }
  2878 
  3292 
  2879 TInt TraceLFunctionOpts3L()
  3293 TInt TraceLFunctionOpts3L()
  2880 	{
  3294     {
       
  3295     __UHEAP_MARK ;
  2881     TInt ret1;
  3296     TInt ret1;
  2882     TPosition aPosition1;
  3297     TPosition aPosition1;
  2883     TPositionUpdateOptions aOptions;
  3298     TPositionUpdateOptions aOptions;
  2884     TTimeIntervalMicroSeconds aTimeOut = 20000000; 
  3299     TTimeIntervalMicroSeconds aTimeOut = 20000000; 
  2885     TTimeIntervalMicroSeconds aTimeInterval = 5000000;
  3300     TTimeIntervalMicroSeconds aTimeInterval = 5000000;
  2886     TTimeIntervalMicroSeconds aInterval;
  3301     TTimeIntervalMicroSeconds aInterval;
  2887     TTime start,end;
  3302     TTime start,end;
  2888    	TBool aAcceptPartialUpdates = ETrue;
  3303     TBool aAcceptPartialUpdates = ETrue;
  2889     
  3304 
  2890     CLocationService *CoreObj = CLocationService ::NewL() ;
  3305     CLocationService *CoreObj = CLocationService ::NewL() ;
  2891     
  3306 
  2892     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3307     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2893 	//not needed any more
  3308     //not needed any more
  2894 	/*RRequestorStack aRequestorStack;
  3309     /*RRequestorStack aRequestorStack;
  2895 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3310 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2896     aRequestorStack.Insert(identityInfo,0);
  3311     aRequestorStack.Insert(identityInfo,0);
  2897    
  3312 
  2898     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3313     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2899     
  3314 
  2900     aOptions.SetUpdateTimeOut(aTimeOut);
  3315     aOptions.SetUpdateTimeOut(aTimeOut);
  2901     aOptions.SetUpdateInterval(aTimeInterval);
  3316     aOptions.SetUpdateInterval(aTimeInterval);
  2902     aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates);
  3317     aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates);
  2903     
  3318 
  2904     TraceLCallBackOpts3 MyUpdates;
  3319     TraceLCallBackOpts3 MyUpdates(24,TRACE);
  2905     
  3320 
  2906     ret1 = CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ;
  3321     TRAP(ret1 , CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) );
  2907     
  3322 
  2908     if( KErrNone == ret1)
  3323     if( KErrNone == ret1)
  2909     	{
  3324         {
  2910         TBuf8<20> retBuf;
  3325         TBuf8<20> retBuf;
  2911         TRealFormat retFormat;
  3326         TRealFormat retFormat;
  2912         OpenFile();
  3327         OpenFile();
  2913 	 	LogFile.Write(_L8("\n<TraceLPositionOpts3 test>\n"));
  3328         LogFile.Write(_L8("\n<TraceLPositionOpts3 test>\n"));
  2914 	 	CloseFile();
  3329         CloseFile();
  2915 
  3330 
  2916 	 	start.HomeTime();
  3331         start.HomeTime();
  2917 	 	CActiveScheduler::Start();
  3332         CActiveScheduler::Start();
  2918 	 	end.HomeTime();
  3333         end.HomeTime();
  2919 	 	aInterval = end.MicroSecondsFrom(start);
  3334         aInterval = end.MicroSecondsFrom(start);
  2920 	// 	if(aInterval<150000000)
  3335         // 	if(aInterval<150000000)
  2921 	// 	returnCode = KErrGeneral;
  3336         // 	returnCode = KErrGeneral;
  2922         retBuf.Num(returnCode,retFormat);
  3337         retBuf.Num(returnCode,retFormat);
  2923         OpenFile();
  3338         OpenFile();
  2924         LogFile.Write(_L8("\nreturnCode : "));
  3339         LogFile.Write(_L8("\nreturnCode : "));
  2925         LogFile.Write(retBuf);
  3340         LogFile.Write(retBuf);
  2926         CloseFile();
  3341         CloseFile();
  2927    		}
  3342         }
  2928     
  3343 
  2929     else
  3344     else
  2930       	{
  3345         {
  2931     	returnCode = KErrGeneral;	
  3346         returnCode = KErrGeneral;	
  2932     	}
  3347         }
  2933     /*aRequestorStack.Close();
  3348     /*aRequestorStack.Close();
  2934     delete identityInfo;*/
  3349     delete identityInfo;*/
  2935     delete CoreObj;
  3350     delete CoreObj;
       
  3351     __UHEAP_MARKEND ;
  2936     return 0;
  3352     return 0;
  2937 	}
  3353     }
  2938 
  3354 
  2939 
  3355 
  2940 TInt CSAPILocTest::TraceLPositionOpts3( CStifItemParser& /*aItem*/ )
  3356 TInt CSAPILocTest::TraceLPositionOpts3( CStifItemParser& /*aItem*/ )
  2941 	{
  3357     {
  2942     returnCode = KErrNone;      
  3358     returnCode = KErrNone;      
  2943     // Print to UI
  3359     // Print to UI
  2944     _LIT( KSAPILocTest, "SAPILocTest" );
  3360     _LIT( KSAPILocTest, "SAPILocTest" );
  2945     _LIT( KExample, "TraceLPositionOpts3" );
  3361     _LIT( KExample, "TraceLPositionOpts3" );
  2946     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3362     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  2947     
  3363 
  2948    __UHEAP_MARK;
  3364     __UHEAP_MARK;
  2949    
  3365 
  2950    TRAPD(err , TraceLFunctionOpts3L()) ;
  3366     TRAPD(err , TraceLFunctionOpts3L()) ;
  2951    
  3367 
  2952    if(err)
  3368     if(err)
  2953    returnCode = KErrGeneral;
  3369         returnCode = KErrGeneral;
  2954    
  3370 
  2955    __UHEAP_MARKEND;
  3371     __UHEAP_MARKEND;
  2956     
  3372 
  2957      return returnCode;  
  3373     return returnCode;  
  2958 	}
  3374     }
  2959 
  3375 
  2960 // -----------------------------------------------------------------------------
  3376 // -----------------------------------------------------------------------------
  2961 // CSAPILocTest::CancelService1
  3377 // CSAPILocTest::CancelService1
  2962 // -----------------------------------------------------------------------------
  3378 // -----------------------------------------------------------------------------
  2963 //
  3379 //
  2964 TInt CancelFunction1L()
  3380 TInt CancelFunction1L()
  2965 	{
  3381     {
       
  3382     __UHEAP_MARK ;
  2966     TInt ret1,ret2;
  3383     TInt ret1,ret2;
  2967     CLocationService *CoreObj = CLocationService ::NewL() ;
  3384     CLocationService *CoreObj = CLocationService ::NewL() ;
  2968     
  3385 
  2969     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3386     _LIT(Kidentity ,"Coreclass Testing" ) ;
  2970 	//not needed any more
  3387     //not needed any more
  2971 	/*RRequestorStack aRequestorStack;
  3388     /*RRequestorStack aRequestorStack;
  2972 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3389 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  2973     aRequestorStack.Insert(identityInfo,0);
  3390     aRequestorStack.Insert(identityInfo,0);
  2974     
  3391 
  2975     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3392     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  2976     
  3393 
  2977     ret1 = CoreObj->CancelOnGoingService(0) ;
  3394     ret1 = CoreObj->CancelOnGoingService(0) ;
  2978     
  3395 
  2979     ret2 = CoreObj->CancelOnGoingService(1) ;
  3396     ret2 = CoreObj->CancelOnGoingService(1) ;
  2980     
  3397 
  2981     if( KErrNotFound == ret1 && KErrNotFound == ret2 )
  3398     if( KErrNotFound == ret1 && KErrNotFound == ret2 )
  2982     	{
  3399         {
  2983       	OpenFile();
  3400         OpenFile();
  2984 	 	LogFile.Write(_L8("\n<CancelService1 test>\n"));
  3401         LogFile.Write(_L8("\n<CancelService1 test>\n"));
  2985 	 	LogFile.Write(_L8("Passed..\n"));
  3402         LogFile.Write(_L8("Passed..\n"));
  2986 	 	CloseFile();
  3403         CloseFile();
  2987 	 	returnCode = KErrNone; 
  3404         returnCode = KErrNone; 
  2988    		}
  3405         }
  2989     
  3406 
  2990     else
  3407     else
  2991     	{
  3408         {
  2992     	returnCode = KErrGeneral;	
  3409         returnCode = KErrGeneral;	
  2993     	}
  3410         }
  2994     	
  3411 
  2995     /*aRequestorStack.Close();
  3412     /*aRequestorStack.Close();
  2996     delete identityInfo;*/
  3413     delete identityInfo;*/
  2997     delete CoreObj;
  3414     delete CoreObj;
       
  3415     __UHEAP_MARKEND ;
  2998     return 0;
  3416     return 0;
  2999 	}
  3417     }
  3000 
  3418 
  3001 TInt CSAPILocTest::CancelService1( CStifItemParser& /*aItem*/ )
  3419 TInt CSAPILocTest::CancelService1( CStifItemParser& /*aItem*/ )
  3002 	{
  3420     {
  3003     returnCode = KErrNone;
  3421     returnCode = KErrNone;
  3004     // Print to UI
  3422     // Print to UI
  3005     _LIT( KSAPILocTest, "SAPILocTest" );
  3423     _LIT( KSAPILocTest, "SAPILocTest" );
  3006     _LIT( KExample, "CancelService1" );
  3424     _LIT( KExample, "CancelService1" );
  3007     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3425     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3008     
  3426 
  3009     __UHEAP_MARK;
  3427     __UHEAP_MARK;
  3010     
  3428 
  3011     TRAPD(err , CancelFunction1L()) ;
  3429     TRAPD(err , CancelFunction1L()) ;
  3012     if(err)
  3430     if(err)
  3013     returnCode = KErrGeneral;
  3431         returnCode = KErrGeneral;
  3014     
  3432 
  3015     __UHEAP_MARKEND;
  3433     __UHEAP_MARKEND;
  3016     
  3434 
  3017     return returnCode;  
  3435     return returnCode;  
  3018 	}
  3436     }
  3019 
  3437 
  3020 // -----------------------------------------------------------------------------
  3438 // -----------------------------------------------------------------------------
  3021 // CSAPILocTest::CancelService2
  3439 // CSAPILocTest::CancelService2
  3022 // -----------------------------------------------------------------------------
  3440 // -----------------------------------------------------------------------------
  3023 //
  3441 //
  3024 TInt CancelFunction2L()
  3442 TInt CancelFunction2L()
  3025 	{
  3443     {
       
  3444     __UHEAP_MARK ;
  3026     TInt ret1,ret2;
  3445     TInt ret1,ret2;
  3027     CLocationService *CoreObj = CLocationService ::NewL() ;
  3446     CLocationService *CoreObj = CLocationService ::NewL() ;
  3028     
  3447 
  3029     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3448     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3030 	//not needed any more
  3449     //not needed any more
  3031 	/*RRequestorStack aRequestorStack;
  3450     /*RRequestorStack aRequestorStack;
  3032 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3451 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3033     aRequestorStack.Insert(identityInfo,0);
  3452     aRequestorStack.Insert(identityInfo,0);
  3034     
  3453 
  3035     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3454     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3036     
  3455 
  3037     ret1 = CoreObj->CancelOnGoingService(4) ;
  3456     ret1 = CoreObj->CancelOnGoingService(4) ;
  3038     
  3457 
  3039     ret2 = CoreObj->CancelOnGoingService(6) ;
  3458     ret2 = CoreObj->CancelOnGoingService(6) ;
  3040     
  3459 
  3041     if( KErrArgument == ret1 && KErrArgument == ret2 )
  3460     if( KErrArgument == ret1 && KErrArgument == ret2 )
  3042     	{
  3461         {
  3043       	OpenFile();
  3462         OpenFile();
  3044 	 	LogFile.Write(_L8("\n<CancelService2 test>\n"));
  3463         LogFile.Write(_L8("\n<CancelService2 test>\n"));
  3045 	 	LogFile.Write(_L8("Passed..\n"));
  3464         LogFile.Write(_L8("Passed..\n"));
  3046 	 	CloseFile();
  3465         CloseFile();
  3047 	 	returnCode = KErrNone; 
  3466         returnCode = KErrNone; 
  3048    		}
  3467         }
  3049     
  3468 
  3050     else
  3469     else
  3051        	{
  3470         {
  3052     	returnCode = KErrGeneral;	
  3471         returnCode = KErrGeneral;	
  3053     	}
  3472         }
  3054     	
  3473 
  3055     /*aRequestorStack.Close();
  3474     /*aRequestorStack.Close();
  3056     delete identityInfo;*/
  3475     delete identityInfo;*/
  3057     delete CoreObj;
  3476     delete CoreObj;
       
  3477     __UHEAP_MARKEND ;
  3058     return 0;
  3478     return 0;
  3059 	}
  3479     }
  3060 
  3480 
  3061 
  3481 
  3062 TInt CSAPILocTest::CancelService2( CStifItemParser& /*aItem*/ )
  3482 TInt CSAPILocTest::CancelService2( CStifItemParser& /*aItem*/ )
  3063 	{
  3483     {
  3064     returnCode = KErrNone;
  3484     returnCode = KErrNone;
  3065      // Print to UI
  3485     // Print to UI
  3066     _LIT( KSAPILocTest, "SAPILocTest" );
  3486     _LIT( KSAPILocTest, "SAPILocTest" );
  3067     _LIT( KExample, "CancelService2" );
  3487     _LIT( KExample, "CancelService2" );
  3068     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3488     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3069     __UHEAP_MARK;
  3489     __UHEAP_MARK;
  3070     
  3490 
  3071     TRAPD(err , CancelFunction2L()) ;
  3491     TRAPD(err , CancelFunction2L()) ;
  3072     if(err)
  3492     if(err)
  3073     returnCode = KErrGeneral;
  3493         returnCode = KErrGeneral;
  3074     __UHEAP_MARKEND;
  3494     __UHEAP_MARKEND;
  3075     
  3495 
  3076      return returnCode;  
  3496     return returnCode;  
  3077 	}
  3497     }
  3078 
  3498 
  3079 // -----------------------------------------------------------------------------
  3499 // -----------------------------------------------------------------------------
  3080 // CSAPILocTest::GetTime
  3500 // CSAPILocTest::GetTime
  3081 // -----------------------------------------------------------------------------
  3501 // -----------------------------------------------------------------------------
  3082 //
  3502 //
  3083 TInt CSAPILocTest::GetTime( CStifItemParser& /*aItem*/ )
  3503 TInt CSAPILocTest::GetTime( CStifItemParser& /*aItem*/ )
  3084 	{
  3504     {
  3085 	TInt ret;
  3505     TInt ret;
  3086 	TPositionInfo currPos;
  3506     TPositionInfo currPos;
  3087 	TPosition currPos1;
  3507     TPosition currPos1;
  3088 	TTime currPosTime;
  3508     TTime currPosTime;
  3089 	TDateTime currPosDateTime;
  3509     TDateTime currPosDateTime;
  3090 	TBuf8<50> buf ;
  3510     TBuf8<50> buf ;
  3091 	TRealFormat format ;
  3511     TRealFormat format ;
  3092   	returnCode = KErrNone;
  3512     returnCode = KErrNone;
  3093   	// Print to UI
  3513     // Print to UI
  3094  	_LIT( KSAPILocTest, "SAPILocTest" );
  3514     _LIT( KSAPILocTest, "SAPILocTest" );
  3095   	_LIT( KExample, "GetTime" );
  3515     _LIT( KExample, "GetTime" );
  3096   	TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3516     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3097     
  3517 
  3098  	 __UHEAP_MARK;
  3518     __UHEAP_MARK;
  3099   
  3519 
  3100  	 CLocationService *CoreObj = CLocationService :: NewL();
  3520     CLocationService *CoreObj = CLocationService :: NewL();
  3101   
  3521 
  3102  	 if( NULL == CoreObj)
  3522     if( NULL == CoreObj)
  3103   		{
  3523         {
  3104   		OpenFile();
  3524         OpenFile();
  3105 		LogFile.Write(_L8("\n<GetTime Test>\n"));
  3525         LogFile.Write(_L8("\n<GetTime Test>\n"));
  3106 		LogFile.Write(_L8("Failed..\n"));
  3526         LogFile.Write(_L8("Failed..\n"));
  3107 		CloseFile();
  3527         CloseFile();
  3108    		returnCode = KErrGeneral;
  3528         returnCode = KErrGeneral;
  3109  		}
  3529         }
  3110   
  3530 
  3111     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3531     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3112 	//not needed any more
  3532     //not needed any more
  3113 	/*RRequestorStack aRequestorStack;
  3533     /*RRequestorStack aRequestorStack;
  3114 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3534 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3115     aRequestorStack.Insert(identityInfo,0);
  3535     aRequestorStack.Insert(identityInfo,0);
  3116     
  3536 
  3117     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3537     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3118     
  3538 
  3119   	ret = CoreObj->GetLocationL(&currPos);
  3539     TRAP(ret , CoreObj->GetLocationL(&currPos));
  3120   	
  3540 
  3121   	if(KErrNone == ret)
  3541     if(KErrNone == ret)
  3122   	  {
  3542         {
  3123       currPos.GetPosition(currPos1);
  3543         currPos.GetPosition(currPos1);
  3124 	  currPosTime = currPos1.Time();
  3544         currPosTime = currPos1.Time();
  3125 	  currPosDateTime = currPosTime.DateTime();
  3545         currPosDateTime = currPosTime.DateTime();
  3126 	  
  3546 
  3127 	  TInt aDay = currPosDateTime.Day();
  3547         TInt aDay = currPosDateTime.Day();
  3128 	  TInt aHour = currPosDateTime.Hour();
  3548         TInt aHour = currPosDateTime.Hour();
  3129 	  TInt aMicroSecond = currPosDateTime.MicroSecond();
  3549         TInt aMicroSecond = currPosDateTime.MicroSecond();
  3130 	  TInt aMinute = currPosDateTime.Minute();
  3550         TInt aMinute = currPosDateTime.Minute();
  3131 	  TInt aMonth = currPosDateTime.Month();
  3551         TInt aMonth = currPosDateTime.Month();
  3132 	  TInt aSecond = currPosDateTime.Second();
  3552         TInt aSecond = currPosDateTime.Second();
  3133 	  TInt aYear = currPosDateTime.Year();
  3553         TInt aYear = currPosDateTime.Year();
  3134 	  TReal32 aVerAcc = currPos1.VerticalAccuracy();
  3554         TReal32 aVerAcc = currPos1.VerticalAccuracy();
  3135 	  TReal32 aHorAcc = currPos1.HorizontalAccuracy();
  3555         TReal32 aHorAcc = currPos1.HorizontalAccuracy();
  3136 	    
  3556 
  3137 	  OpenFile();
  3557         OpenFile();
  3138 
  3558 
  3139   	  LogFile.Write(_L8("\n<GetTime test> \n"));
  3559         LogFile.Write(_L8("\n<GetTime test> \n"));
  3140 	  buf.Num(aHorAcc,format);
  3560         buf.Num(aHorAcc,format);
  3141 	  LogFile.Write(_L8("Horizontal Acc = "));
  3561         LogFile.Write(_L8("Horizontal Acc = "));
  3142 	  LogFile.Write(buf) ;
  3562         LogFile.Write(buf) ;
  3143 	  LogFile.Write(_L8("\n")) ;
  3563         LogFile.Write(_L8("\n")) ;
  3144 	
  3564 
  3145   	  buf.Num(aVerAcc,format);
  3565         buf.Num(aVerAcc,format);
  3146 	  LogFile.Write(_L8("Vertical Acc = "));
  3566         LogFile.Write(_L8("Vertical Acc = "));
  3147 	  LogFile.Write(buf) ;
  3567         LogFile.Write(buf) ;
  3148 	  LogFile.Write(_L8("\n")) ;
  3568         LogFile.Write(_L8("\n")) ;
  3149 	
  3569 
  3150   	  buf.Num(aDay , format) ;
  3570         buf.Num(aDay , format) ;
  3151 	  LogFile.Write(_L8("Time = "));
  3571         LogFile.Write(_L8("Time = "));
  3152 	  LogFile.Write(buf) ;
  3572         LogFile.Write(buf) ;
  3153 	  LogFile.Write(_L8("-")) ;
  3573         LogFile.Write(_L8("-")) ;
  3154 	
  3574 
  3155  	  buf.Num(aMonth , format) ;
  3575         buf.Num(aMonth , format) ;
  3156   	  LogFile.Write(buf) ;
  3576         LogFile.Write(buf) ;
  3157 	  LogFile.Write(_L8("-")) ;
  3577         LogFile.Write(_L8("-")) ;
  3158 	
  3578 
  3159 	  buf.Num(aYear , format) ;
  3579         buf.Num(aYear , format) ;
  3160 	  LogFile.Write(buf) ;
  3580         LogFile.Write(buf) ;
  3161 	  LogFile.Write(_L8("  ")) ;
  3581         LogFile.Write(_L8("  ")) ;
  3162 	
  3582 
  3163 	  buf.Num(aHour , format) ;
  3583         buf.Num(aHour , format) ;
  3164 	  LogFile.Write(buf) ;
  3584         LogFile.Write(buf) ;
  3165 	  LogFile.Write(_L8(":")) ;
  3585         LogFile.Write(_L8(":")) ;
  3166 	
  3586 
  3167 	  buf.Num(aMinute , format) ;
  3587         buf.Num(aMinute , format) ;
  3168 	  LogFile.Write(buf) ;
  3588         LogFile.Write(buf) ;
  3169 	  LogFile.Write(_L8(":")) ;
  3589         LogFile.Write(_L8(":")) ;
  3170 	
  3590 
  3171 	  buf.Num(aSecond , format) ;
  3591         buf.Num(aSecond , format) ;
  3172 	  LogFile.Write(buf) ;
  3592         LogFile.Write(buf) ;
  3173 	  LogFile.Write(_L8(":")) ;
  3593         LogFile.Write(_L8(":")) ;
  3174 	
  3594 
  3175 	  buf.Num(aMicroSecond , format) ;
  3595         buf.Num(aMicroSecond , format) ;
  3176 	  LogFile.Write(buf) ;
  3596         LogFile.Write(buf) ;
  3177 	  LogFile.Write(_L8("\n")) ;
  3597         LogFile.Write(_L8("\n")) ;
  3178 	  CloseFile();
  3598         CloseFile();
  3179 		
  3599 
  3180 	  ValidatePosition(currPos1);
  3600         ValidatePosition(currPos1);
  3181       }
  3601         }
  3182 	else
  3602     else
  3183 		{
  3603         {
  3184 	  	OpenFile();
  3604         OpenFile();
  3185 	  	LogFile.Write(_L8("\n<GetTime Test>\n"));
  3605         LogFile.Write(_L8("\n<GetTime Test>\n"));
  3186 	  	LogFile.Write(_L8("Failed..\n"));
  3606         LogFile.Write(_L8("Failed..\n"));
  3187 	  	CloseFile();
  3607         CloseFile();
  3188 	  	returnCode = KErrGeneral;	
  3608         returnCode = KErrGeneral;	
  3189   		}
  3609         }
  3190 	  	 /*aRequestorStack.Close();
  3610     /*aRequestorStack.Close();
  3191 	    delete identityInfo;*/
  3611 	    delete identityInfo;*/
  3192 	    delete CoreObj;
  3612     delete CoreObj;
  3193 	    
  3613 
  3194 	__UHEAP_MARKEND;       
  3614     __UHEAP_MARKEND;       
  3195 	    
  3615 
  3196 	return returnCode;    
  3616     return returnCode;    
  3197 	}
  3617     }
  3198 
  3618 
  3199 
  3619 
  3200     
  3620 
  3201 // -----------------------------------------------------------------------------
  3621 // -----------------------------------------------------------------------------
  3202 // CSAPILocTest::GetSpeed
  3622 // CSAPILocTest::GetSpeed
  3203 // -----------------------------------------------------------------------------
  3623 // -----------------------------------------------------------------------------
  3204 //
  3624 //
  3205 TInt CSAPILocTest::GetSpeed( CStifItemParser& /*aItem*/ )
  3625 TInt CSAPILocTest::GetSpeed( CStifItemParser& /*aItem*/ )
  3206     {
  3626     {
  3207 	TInt ret;
  3627     TInt ret;
  3208 	TPositionInfo currPos;
  3628     TPositionInfo currPos;
  3209 	TPosition currPos1,fromPos;
  3629     TPosition currPos1,fromPos;
  3210 	TTime currPosTime;
  3630     TTime currPosTime;
  3211 	TTime fromPosTime;
  3631     TTime fromPosTime;
  3212 	TDateTime currPosDateTime;
  3632     TDateTime currPosDateTime;
  3213 	TReal64 aLatitude1  = 8;
  3633     TReal64 aLatitude1  = 8;
  3214 	TReal64 aLongitude1 = 70;
  3634     TReal64 aLongitude1 = 70;
  3215 	TReal32 aAltitude1  = 700;
  3635     TReal32 aAltitude1  = 700;
  3216 	TReal32 aSpeed;
  3636     TReal32 aSpeed;
  3217 	fromPosTime = 63342890700000000;
  3637     fromPosTime = 63342890700000000;
  3218 	
  3638 
  3219 	fromPos.SetCoordinate(aLatitude1,aLongitude1,aAltitude1);
  3639     fromPos.SetCoordinate(aLatitude1,aLongitude1,aAltitude1);
  3220 	fromPos.SetTime(fromPosTime);
  3640     fromPos.SetTime(fromPosTime);
  3221 	
  3641 
  3222 	returnCode =KErrNone;
  3642     returnCode =KErrNone;
  3223 		
  3643 
  3224     // Print to UI
  3644     // Print to UI
  3225     _LIT( KSAPILocTest, "SAPILocTest" );
  3645     _LIT( KSAPILocTest, "SAPILocTest" );
  3226     _LIT( KExample, "GetSpeed" );
  3646     _LIT( KExample, "GetSpeed" );
  3227     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3647     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3228    
  3648 
  3229     __UHEAP_MARK;
  3649     __UHEAP_MARK;
  3230     
  3650 
  3231     CLocationService *CoreObj = CLocationService :: NewL();
  3651     CLocationService *CoreObj = CLocationService :: NewL();
  3232     
  3652 
  3233     if( NULL == CoreObj)
  3653     if( NULL == CoreObj)
  3234     	{
  3654         {
  3235     	OpenFile();
  3655         OpenFile();
  3236 	    LogFile.Write(_L8("\n<GetSpeed Test>\n"));
  3656         LogFile.Write(_L8("\n<GetSpeed Test>\n"));
  3237 	    LogFile.Write(_L8("Failed(CoreObj creation)..\n"));
  3657         LogFile.Write(_L8("Failed(CoreObj creation)..\n"));
  3238 	    CloseFile();
  3658         CloseFile();
  3239 	   	returnCode = KErrGeneral;
  3659         returnCode = KErrGeneral;
  3240    		}
  3660         }
  3241     //not needed any more
  3661     //not needed any more
  3242     /*_LIT(Kidentity ,"Coreclass Testing" ) ;
  3662     /*_LIT(Kidentity ,"Coreclass Testing" ) ;
  3243 	RRequestorStack aRequestorStack;
  3663 	RRequestorStack aRequestorStack;
  3244 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3664 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3245     aRequestorStack.Insert(identityInfo,0);
  3665     aRequestorStack.Insert(identityInfo,0);
  3246     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3666     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3247     	
  3667 
  3248     User::After(120000000);
  3668     // User::After(120000000);
  3249     ret = CoreObj->GetLocationL(&currPos);
  3669     TRAP(ret , CoreObj->GetLocationL(&currPos));
  3250     
  3670 
  3251     if(KErrNone == ret)
  3671     if(KErrNone == ret)
  3252     	{
  3672         {
  3253     	currPos.GetPosition(currPos1);
  3673         currPos.GetPosition(currPos1);
  3254 	    currPos1.Speed(fromPos,aSpeed);
  3674         currPos1.Speed(fromPos,aSpeed);
  3255 	    
  3675 
  3256 		OpenFile();
  3676         OpenFile();
  3257 		TBuf8<50> buf ;
  3677         TBuf8<50> buf ;
  3258 		TRealFormat format ;
  3678         TRealFormat format ;
  3259 		LogFile.Write(_L8("\n<GetSpeed test> \n"));
  3679         LogFile.Write(_L8("\n<GetSpeed test> \n"));
  3260 		buf.Num(aSpeed , format) ;
  3680         buf.Num(aSpeed , format) ;
  3261 		LogFile.Write(_L8("Speed = "));
  3681         LogFile.Write(_L8("Speed = "));
  3262 		LogFile.Write(buf) ;
  3682         LogFile.Write(buf) ;
  3263 		LogFile.Write(_L8("\n")) ;
  3683         LogFile.Write(_L8("\n")) ;
  3264 		CloseFile();
  3684         CloseFile();
  3265 	    ValidatePosition(currPos1);
  3685         ValidatePosition(currPos1);
  3266 	    returnCode = KErrNone;
  3686         returnCode = KErrNone;
  3267 	   	}
  3687         }
  3268 	  else
  3688     else
  3269 	  	{
  3689         {
  3270 	  	OpenFile();
  3690         OpenFile();
  3271 	  	LogFile.Write(_L8("\n<GetSpeed Test>\n"));
  3691         LogFile.Write(_L8("\n<GetSpeed Test>\n"));
  3272 	  	LogFile.Write(_L8("Failed(getloc error)..\n"));
  3692         LogFile.Write(_L8("Failed(getloc error)..\n"));
  3273 	  	
  3693 
  3274 		TBuf8<50> buf ;
  3694         TBuf8<50> buf ;
  3275 		TRealFormat format ;
  3695         TRealFormat format ;
  3276 		LogFile.Write(_L8("\n<GetSpeed test> \n"));
  3696         LogFile.Write(_L8("\n<GetSpeed test> \n"));
  3277 		buf.Num(ret , format) ;
  3697         buf.Num(ret , format) ;
  3278 	  	LogFile.Write(buf);
  3698         LogFile.Write(buf);
  3279 	  	CloseFile();
  3699         CloseFile();
  3280 	   	returnCode = KErrGeneral;
  3700         returnCode = KErrGeneral;
  3281     	
  3701 
  3282 	  	}
  3702         }
  3283     
  3703 
  3284     /*aRequestorStack.Close();
  3704     /*aRequestorStack.Close();
  3285 	delete identityInfo;*/
  3705 	delete identityInfo;*/
  3286 	delete CoreObj;
  3706     delete CoreObj;
  3287     __UHEAP_MARKEND;       
  3707     __UHEAP_MARKEND;       
  3288    
  3708 
  3289     return returnCode;    
  3709     return returnCode;    
  3290     }
  3710     }
  3291     
  3711 
  3292     
  3712 
  3293 // -----------------------------------------------------------------------------
  3713 // -----------------------------------------------------------------------------
  3294 // CSAPILocTest::GetPositionOpts
  3714 // CSAPILocTest::GetPositionOpts
  3295 // -----------------------------------------------------------------------------
  3715 // -----------------------------------------------------------------------------
  3296 //
  3716 //
  3297 TInt CSAPILocTest::GetPositionOpts( CStifItemParser& /*aItem*/ )
  3717 TInt CSAPILocTest::GetPositionOpts( CStifItemParser& /*aItem*/ )
  3298 	{
  3718     {
  3299 	TInt ret;
  3719     TInt ret;
  3300 	TPositionInfo currPos;
  3720     TPositionInfo currPos;
  3301 	TPosition currPos1;
  3721     TPosition currPos1;
  3302 	TPositionUpdateOptions aOptions;
  3722     TPositionUpdateOptions aOptions;
  3303 	TTimeIntervalMicroSeconds aTimeOut = 100;
  3723     TTimeIntervalMicroSeconds aTimeOut = 100;
  3304 	returnCode = KErrNone;
  3724     returnCode = KErrNone;
  3305 	
  3725 
  3306 	// Print to UI
  3726     // Print to UI
  3307 	_LIT( KSAPILocTest, "SAPILocTest" );
  3727     _LIT( KSAPILocTest, "SAPILocTest" );
  3308 	_LIT( KExample, "GetPositionOpts" );
  3728     _LIT( KExample, "GetPositionOpts" );
  3309 	TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3729     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3310 
  3730 
  3311 	 __UHEAP_MARK;
  3731     __UHEAP_MARK;
  3312 	
  3732 
  3313 	CLocationService *CoreObj = CLocationService :: NewL();
  3733     CLocationService *CoreObj = CLocationService :: NewL();
  3314 
  3734 
  3315 	if( NULL == CoreObj)
  3735     if( NULL == CoreObj)
  3316 		{
  3736         {
  3317 		OpenFile();
  3737         OpenFile();
  3318 		LogFile.Write(_L8("\n<GetPositionOpts Test>\n"));
  3738         LogFile.Write(_L8("\n<GetPositionOpts Test>\n"));
  3319 		LogFile.Write(_L8("Failed..\n"));
  3739         LogFile.Write(_L8("Failed..\n"));
  3320 		CloseFile();
  3740         CloseFile();
  3321 		return KErrGeneral;
  3741         return KErrGeneral;
  3322 		}
  3742         }
  3323 	//not needed any more
  3743     //not needed any more
  3324     /*_LIT(Kidentity ,"Coreclass Testing" ) ;
  3744     /*_LIT(Kidentity ,"Coreclass Testing" ) ;
  3325 	RRequestorStack aRequestorStack;
  3745 	RRequestorStack aRequestorStack;
  3326 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3746 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3327     aRequestorStack.Insert(identityInfo,0);
  3747     aRequestorStack.Insert(identityInfo,0);
  3328     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3748     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3329     
  3749 
  3330 	aOptions.SetUpdateTimeOut(aTimeOut);
  3750     aOptions.SetUpdateTimeOut(aTimeOut);
  3331 	
  3751 
  3332 	ret = CoreObj->GetLocationL(&currPos,&aOptions);
  3752     TRAP(ret , CoreObj->GetLocationL(&currPos,&aOptions));
  3333 	    
  3753 
  3334 	if(KErrTimedOut==ret)
  3754     if(KErrTimedOut==ret)
  3335 		{
  3755         {
  3336 		OpenFile();
  3756         OpenFile();
  3337 		LogFile.Write(_L8("\n<GetPositionOpts Test>\n"));
  3757         LogFile.Write(_L8("\n<GetPositionOpts Test>\n"));
  3338 		LogFile.Write(_L8("Passed..\n"));
  3758         LogFile.Write(_L8("Passed..\n"));
  3339 		CloseFile();
  3759         CloseFile();
  3340 	  	returnCode = KErrNone;	
  3760         returnCode = KErrNone;	
  3341 		}
  3761         }
  3342 	else
  3762     else
  3343 		{
  3763         {
  3344 		OpenFile();
  3764         OpenFile();
  3345 		LogFile.Write(_L8("\n<GetPositionOpts Test>\n"));
  3765         LogFile.Write(_L8("\n<GetPositionOpts Test>\n"));
  3346 		LogFile.Write(_L8("Failed..\n"));
  3766         LogFile.Write(_L8("Failed..\n"));
  3347 		CloseFile();
  3767         CloseFile();
  3348 		returnCode = KErrGeneral;
  3768         returnCode = KErrGeneral;
  3349 		}
  3769         }
  3350 		
  3770 
  3351 	/*aRequestorStack.Close();
  3771     /*aRequestorStack.Close();
  3352     delete identityInfo;*/
  3772     delete identityInfo;*/
  3353     delete CoreObj;
  3773     delete CoreObj;
  3354 	
  3774 
  3355 	__UHEAP_MARKEND; 
  3775     __UHEAP_MARKEND; 
  3356 	
  3776 
  3357 	return returnCode;
  3777     return returnCode;
  3358 	
  3778 
  3359 	}
  3779     }
  3360     
  3780 
  3361 
  3781 
  3362 // -----------------------------------------------------------------------------
  3782 // -----------------------------------------------------------------------------
  3363 // CSAPILocTest::GetPositionOpts1
  3783 // CSAPILocTest::GetPositionOpts1
  3364 // -----------------------------------------------------------------------------
  3784 // -----------------------------------------------------------------------------
  3365 //
  3785 //
  3368     TInt ret;
  3788     TInt ret;
  3369     TPositionInfo currPos;
  3789     TPositionInfo currPos;
  3370     TPositionUpdateOptions options;
  3790     TPositionUpdateOptions options;
  3371     TTimeIntervalMicroSeconds aTimeOut = 0;
  3791     TTimeIntervalMicroSeconds aTimeOut = 0;
  3372     returnCode = KErrNone;
  3792     returnCode = KErrNone;
  3373     
  3793 
  3374     // Print to UI
  3794     // Print to UI
  3375     _LIT( KSAPILocTest, "SAPILocTest" );
  3795     _LIT( KSAPILocTest, "SAPILocTest" );
  3376     _LIT( KExample, "GetPositionOpts1" );
  3796     _LIT( KExample, "GetPositionOpts1" );
  3377     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3797     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3378    
  3798 
  3379     __UHEAP_MARK;
  3799     __UHEAP_MARK;
  3380     
  3800 
  3381     CLocationService *CoreObj = CLocationService :: NewL();
  3801     CLocationService *CoreObj = CLocationService :: NewL();
  3382     
  3802 
  3383     if( NULL == CoreObj)
  3803     if( NULL == CoreObj)
  3384     	{
  3804         {
  3385     	OpenFile();
  3805         OpenFile();
  3386 		LogFile.Write(_L8("\n<GetPositionOpts1 Test>\n"));
  3806         LogFile.Write(_L8("\n<GetPositionOpts1 Test>\n"));
  3387 		LogFile.Write(_L8("Failed..\n"));
  3807         LogFile.Write(_L8("Failed..\n"));
  3388 		CloseFile();
  3808         CloseFile();
  3389 	   	return KErrGeneral;
  3809         return KErrGeneral;
  3390    		}
  3810         }
  3391     
  3811 
  3392     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3812     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3393 	//not needed any more
  3813     //not needed any more
  3394 	/*RRequestorStack aRequestorStack;
  3814     /*RRequestorStack aRequestorStack;
  3395 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3815 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3396     aRequestorStack.Insert(identityInfo,0);
  3816     aRequestorStack.Insert(identityInfo,0);
  3397     
  3817 
  3398     CoreObj->SetRequestorIdentityL(aRequestorStack) ;
  3818     CoreObj->SetRequestorIdentityL(aRequestorStack) ;
  3399     
  3819 
  3400     options.SetUpdateTimeOut(aTimeOut);
  3820     options.SetUpdateTimeOut(aTimeOut);
  3401     
  3821 
  3402     ret = CoreObj->GetLocationL(&currPos,&options);*/
  3822     ret = CoreObj->GetLocationL(&currPos,&options);*/
  3403         
  3823 
  3404     if(KErrTimedOut==ret)
  3824     if(KErrTimedOut==ret)
  3405     	{
  3825         {
  3406     	OpenFile();
  3826         OpenFile();
  3407     	LogFile.Write(_L8("\n<GetPositionOpts1 Test>\n"));
  3827         LogFile.Write(_L8("\n<GetPositionOpts1 Test>\n"));
  3408     	LogFile.Write(_L8("Failed(timed out)..\n"));
  3828         LogFile.Write(_L8("Failed(timed out)..\n"));
  3409     	CloseFile();
  3829         CloseFile();
  3410     	returnCode = KErrGeneral;	
  3830         returnCode = KErrGeneral;	
  3411     	}
  3831         }
  3412     else
  3832     else
  3413     	{
  3833         {
  3414     	OpenFile();
  3834         OpenFile();
  3415     	LogFile.Write(_L8("\n<GetPositionOpts1 Test>\n"));
  3835         LogFile.Write(_L8("\n<GetPositionOpts1 Test>\n"));
  3416     	LogFile.Write(_L8("Passed..\n"));
  3836         LogFile.Write(_L8("Passed..\n"));
  3417     	CloseFile();
  3837         CloseFile();
  3418     	returnCode = KErrNone;
  3838         returnCode = KErrNone;
  3419     	}
  3839         }
  3420     
  3840 
  3421     /*aRequestorStack.Close();
  3841     /*aRequestorStack.Close();
  3422     delete identityInfo;*/
  3842     delete identityInfo;*/
  3423     delete CoreObj;
  3843     delete CoreObj;
  3424      __UHEAP_MARKEND; 
  3844     __UHEAP_MARKEND; 
  3425      
  3845 
  3426      return returnCode;
  3846     return returnCode;
  3427      }
  3847     }
  3428     
  3848 
  3429     
  3849 
  3430  // -----------------------------------------------------------------------------
  3850 // -----------------------------------------------------------------------------
  3431 // CSAPILocTest::GetPositionOpts2
  3851 // CSAPILocTest::GetPositionOpts2
  3432 // -----------------------------------------------------------------------------
  3852 // -----------------------------------------------------------------------------
  3433 //
  3853 //
  3434 TInt CSAPILocTest::GetPositionOpts2( CStifItemParser& /*aItem*/ )
  3854 TInt CSAPILocTest::GetPositionOpts2( CStifItemParser& /*aItem*/ )
  3435 	{
  3855     {
  3436 	TInt ret1,ret2;
  3856     TInt ret1,ret2;
  3437 	TPositionInfo currPos1,currPos2;
  3857     TPositionInfo currPos1,currPos2;
  3438 	TPosition cPos1,cPos2;
  3858     TPosition cPos1,cPos2;
  3439 	TPositionUpdateOptions options;
  3859     TPositionUpdateOptions options;
  3440 //	TTimeIntervalMicroSeconds aTimeOut = 0;
  3860     //	TTimeIntervalMicroSeconds aTimeOut = 0;
  3441 //	TTimeIntervalMicroSeconds aInterval = 30000000;
  3861     //	TTimeIntervalMicroSeconds aInterval = 30000000;
  3442 	TTimeIntervalMicroSeconds aActualInterval;
  3862     TTimeIntervalMicroSeconds aActualInterval;
  3443 	TTime start;
  3863     TTime start;
  3444 	TTime end;
  3864     TTime end;
  3445 	TInt64 aActualInt;
  3865     TInt64 aActualInt;
  3446 	returnCode = KErrNone;
  3866     returnCode = KErrNone;
  3447 	
  3867 
  3448   	// Print to UI
  3868     // Print to UI
  3449   	_LIT( KSAPILocTest, "SAPILocTest" );
  3869     _LIT( KSAPILocTest, "SAPILocTest" );
  3450  	_LIT( KExample, "GetPostionOpts2" );
  3870     _LIT( KExample, "GetPostionOpts2" );
  3451  	TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3871     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3452   
  3872 
  3453   	__UHEAP_MARK;
  3873     __UHEAP_MARK;
  3454   	
  3874 
  3455   	CLocationService *CoreObj = CLocationService :: NewL();
  3875     CLocationService *CoreObj = CLocationService :: NewL();
  3456     
  3876 
  3457  	 if( NULL == CoreObj)
  3877     if( NULL == CoreObj)
  3458   		{
  3878         {
  3459     	OpenFile();
  3879         OpenFile();
  3460   		LogFile.Write(_L8("\n<GetPositionOpts2 Test>\n"));
  3880         LogFile.Write(_L8("\n<GetPositionOpts2 Test>\n"));
  3461   		LogFile.Write(_L8("Failed..\n"));
  3881         LogFile.Write(_L8("Failed..\n"));
  3462   		CloseFile();
  3882         CloseFile();
  3463    		return KErrGeneral;
  3883         return KErrGeneral;
  3464    		}
  3884         }
  3465     
  3885 
  3466     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3886     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3467 	//not needed any more
  3887     //not needed any more
  3468 	/*RRequestorStack aRequestorStack;
  3888     /*RRequestorStack aRequestorStack;
  3469 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3889 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3470     aRequestorStack.Insert(identityInfo,0);
  3890     aRequestorStack.Insert(identityInfo,0);
  3471     
  3891 
  3472     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3892     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3473     
  3893 
  3474  //   options.SetUpdateTimeOut(aTimeOut);
  3894     //   options.SetUpdateTimeOut(aTimeOut);
  3475     
  3895 
  3476  //   options.SetUpdateInterval(aInterval);
  3896     //   options.SetUpdateInterval(aInterval);
  3477     
  3897 
  3478     User::After(120000000);
  3898     //User::After(120000000);
  3479     ret1 = CoreObj->GetLocationL(&currPos1/*,&options*/);
  3899     TRAP(ret1 , CoreObj->GetLocationL(&currPos1/*,&options*/));
  3480     
  3900 
  3481     
  3901 
  3482     
  3902 
  3483     if( (KErrNone != ret1))
  3903     if( (KErrNone != ret1))
  3484     	{
  3904         {
  3485     	OpenFile();
  3905         OpenFile();
  3486     	LogFile.Write(_L8("\n<GetPositionOpts2 Test>\n"));
  3906         LogFile.Write(_L8("\n<GetPositionOpts2 Test>\n"));
  3487     	LogFile.Write(_L8("Failed(coreobj 1)..\n"));
  3907         LogFile.Write(_L8("Failed(coreobj 1)..\n"));
  3488     	CloseFile();
  3908         CloseFile();
  3489     	returnCode = KErrGeneral;
  3909         returnCode = KErrGeneral;
  3490     	}
  3910         }
  3491     else
  3911     else
  3492    	    {
  3912         {
  3493 		
  3913 
  3494 		start.HomeTime();
  3914         start.HomeTime();
  3495 	    ret2 = CoreObj->GetLocationL(&currPos2/*,&options*/);
  3915         TRAP(ret2 , CoreObj->GetLocationL(&currPos2/*,&options*/));
  3496 	    end.HomeTime();
  3916         end.HomeTime();
  3497 	    
  3917 
  3498 	    aActualInterval=end.MicroSecondsFrom(start);
  3918         aActualInterval=end.MicroSecondsFrom(start);
  3499 	    aActualInt = aActualInterval.Int64();
  3919         aActualInt = aActualInterval.Int64();
  3500 	    if(KErrNone == ret2)
  3920         if(KErrNone == ret2)
  3501 		    {
  3921             {
  3502 		    OpenFile();
  3922             OpenFile();
  3503 		   	TBuf8<50> buf ;
  3923             TBuf8<50> buf ;
  3504 			TRealFormat format ;
  3924             TRealFormat format ;
  3505 			LogFile.Write(_L8("\n<GetPositionOpts2 Test>\n"));
  3925             LogFile.Write(_L8("\n<GetPositionOpts2 Test>\n"));
  3506 			buf.Num(aActualInt, format) ;
  3926             buf.Num(aActualInt, format) ;
  3507 			LogFile.Write(_L8("TimeTaken = "));
  3927             LogFile.Write(_L8("TimeTaken = "));
  3508 		 	LogFile.Write(buf) ;
  3928             LogFile.Write(buf) ;
  3509 		    CloseFile();
  3929             CloseFile();
  3510 		    currPos1.GetPosition(cPos1);
  3930             currPos1.GetPosition(cPos1);
  3511 		    currPos2.GetPosition(cPos2);
  3931             currPos2.GetPosition(cPos2);
  3512 		    ValidatePosition(cPos1);
  3932             ValidatePosition(cPos1);
  3513 		    ValidatePosition(cPos2);
  3933             ValidatePosition(cPos2);
  3514 		    returnCode = KErrNone;	
  3934             returnCode = KErrNone;	
  3515 		    }
  3935             }
  3516 		 else
  3936         else
  3517 		 	{
  3937             {
  3518 		 	OpenFile();
  3938             OpenFile();
  3519 	    	LogFile.Write(_L8("\n<GetPositionOpts2 Test>\n"));
  3939             LogFile.Write(_L8("\n<GetPositionOpts2 Test>\n"));
  3520 	    	LogFile.Write(_L8("Failed(coreObj 2)..\n"));
  3940             LogFile.Write(_L8("Failed(coreObj 2)..\n"));
  3521 	    	CloseFile();
  3941             CloseFile();
  3522 	    	returnCode = KErrGeneral;	
  3942             returnCode = KErrGeneral;	
  3523 		 	}
  3943             }
  3524         }
  3944         }
  3525    
  3945 
  3526     /*aRequestorStack.Close();
  3946     /*aRequestorStack.Close();
  3527     delete identityInfo;*/
  3947     delete identityInfo;*/
  3528     delete CoreObj;
  3948     delete CoreObj;
  3529 
  3949 
  3530     __UHEAP_MARKEND; 
  3950     __UHEAP_MARKEND; 
  3531    
  3951 
  3532     return returnCode;
  3952     return returnCode;
  3533 	}
  3953     }
  3534    
  3954 
  3535    
  3955 
  3536 // -----------------------------------------------------------------------------
  3956 // -----------------------------------------------------------------------------
  3537 // CSAPILocTest::GetPositionOpts3
  3957 // CSAPILocTest::GetPositionOpts3
  3538 // -----------------------------------------------------------------------------
  3958 // -----------------------------------------------------------------------------
  3539 //
  3959 //
  3540 TInt CSAPILocTest::GetPositionOpts3( CStifItemParser& /*aItem*/ )
  3960 TInt CSAPILocTest::GetPositionOpts3( CStifItemParser& /*aItem*/ )
  3541 	{
  3961     {
  3542 	TInt ret1,ret2,ret3;
  3962     TInt ret1,ret2,ret3;
  3543 	TPositionInfo currPos1,currPos2,currPos3;
  3963     TPositionInfo currPos1,currPos2,currPos3;
  3544 	TPosition cPos1,cPos2,cPos3;
  3964     TPosition cPos1,cPos2,cPos3;
  3545 	TPositionUpdateOptions options;
  3965     TPositionUpdateOptions options;
  3546 	TTimeIntervalMicroSeconds aTimeOut =  30000000;
  3966     TTimeIntervalMicroSeconds aTimeOut =  30000000;
  3547 	TTimeIntervalMicroSeconds aInterval = 120000000;
  3967     TTimeIntervalMicroSeconds aInterval = 120000000;
  3548 	TTimeIntervalMicroSeconds aActualInterval;
  3968     TTimeIntervalMicroSeconds aActualInterval;
  3549 	returnCode = KErrNone;
  3969     returnCode = KErrNone;
  3550     
  3970 
  3551   // Print to UI
  3971     // Print to UI
  3552   _LIT( KSAPILocTest, "SAPILocTest" );
  3972     _LIT( KSAPILocTest, "SAPILocTest" );
  3553   _LIT( KExample, "GetPostionOpts3");
  3973     _LIT( KExample, "GetPostionOpts3");
  3554   TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3974     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
       
  3975 
       
  3976     __UHEAP_MARK;
       
  3977 
       
  3978     CLocationService *CoreObj = CLocationService :: NewL();
       
  3979 
       
  3980     if( NULL == CoreObj)
       
  3981         {
       
  3982         OpenFile();
       
  3983         LogFile.Write(_L8("\n<GetPositionOpts3 Test>\n"));
       
  3984         LogFile.Write(_L8("Failed..\n"));
       
  3985         CloseFile();
       
  3986         return KErrGeneral;
       
  3987         }
       
  3988 
       
  3989     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3555   
  3990   
  3556   __UHEAP_MARK;
  3991 
  3557   
       
  3558   CLocationService *CoreObj = CLocationService :: NewL();
       
  3559   
       
  3560   if( NULL == CoreObj)
       
  3561   	{
       
  3562   	OpenFile();
       
  3563     LogFile.Write(_L8("\n<GetPositionOpts3 Test>\n"));
       
  3564     LogFile.Write(_L8("Failed..\n"));
       
  3565     CloseFile();
       
  3566    	return KErrGeneral;
       
  3567  	}
       
  3568   
       
  3569     _LIT(Kidentity ,"Coreclass Testing" ) ;
       
  3570 	//not needed any more
       
  3571 	/*RRequestorStack aRequestorStack;
       
  3572 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
       
  3573     aRequestorStack.Insert(identityInfo,0);
       
  3574     
       
  3575     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
       
  3576     
       
  3577     options.SetUpdateTimeOut(aTimeOut);
  3992     options.SetUpdateTimeOut(aTimeOut);
  3578     options.SetUpdateInterval(aInterval);
  3993     options.SetUpdateInterval(aInterval);
  3579   
  3994 
  3580     ret1 = CoreObj->GetLocationL(&currPos1,&options);
  3995     TRAP(ret1 , CoreObj->GetLocationL(&currPos1,&options));
  3581     ret2 = CoreObj->GetLocationL(&currPos2,&options);
  3996     TRAP(ret2 , CoreObj->GetLocationL(&currPos2,&options));
  3582     ret3 = CoreObj->GetLocationL(&currPos2,&options);
  3997     TRAP(ret3 , CoreObj->GetLocationL(&currPos2,&options));
  3583    
  3998 
  3584   
  3999 
  3585   if( KErrArgument == ret1 && KErrArgument == ret2 && KErrArgument == ret3 )
  4000     if( KErrArgument == ret1 && KErrArgument == ret2 && KErrArgument == ret3 )
  3586 	  {
  4001         {
  3587 	  OpenFile();
  4002         OpenFile();
  3588 	  LogFile.Write(_L8("\n<GetPositionOpts3 Test>\n"));
  4003         LogFile.Write(_L8("\n<GetPositionOpts3 Test>\n"));
  3589 	  LogFile.Write(_L8("Passed..\n"));
  4004         LogFile.Write(_L8("Passed..\n"));
  3590 	  CloseFile();
  4005         CloseFile();
  3591 	  returnCode = KErrNone;
  4006         returnCode = KErrNone;
  3592 	  }
  4007         }
  3593   
  4008 
  3594   else
  4009     else
  3595   	  {
  4010         {
  3596       OpenFile();
  4011         OpenFile();
  3597 	  LogFile.Write(_L8("\n<GetPositionOpts3 Test>\n"));
  4012         LogFile.Write(_L8("\n<GetPositionOpts3 Test>\n"));
  3598 	  LogFile.Write(_L8("Failed..\n"));
  4013         LogFile.Write(_L8("Failed..\n"));
  3599 	  CloseFile();
  4014         CloseFile();
  3600    	  returnCode = KErrGeneral;
  4015         returnCode = KErrGeneral;
  3601       }
  4016         }
  3602   
  4017 
  3603   /*aRequestorStack.Close();
  4018     /*aRequestorStack.Close();
  3604   delete identityInfo;*/
  4019   delete identityInfo;*/
  3605   delete CoreObj;
  4020     delete CoreObj;
  3606 	 
  4021 
  3607   __UHEAP_MARKEND; 
  4022     __UHEAP_MARKEND; 
  3608    
  4023 
  3609   return returnCode; 
  4024     return returnCode; 
  3610  }
  4025     }
  3611    
  4026 
  3612 // -----------------------------------------------------------------------------
  4027 // -----------------------------------------------------------------------------
  3613 // CSAPILocTest::GetPositionOpts4
  4028 // CSAPILocTest::GetPositionOpts4
  3614 // -----------------------------------------------------------------------------
  4029 // -----------------------------------------------------------------------------
  3615 //
  4030 //
  3616 TInt CSAPILocTest::GetPositionOpts4( CStifItemParser& /*aItem*/ )
  4031 TInt CSAPILocTest::GetPositionOpts4( CStifItemParser& /*aItem*/ )
  3617 	{
  4032     {
  3618 	TInt ret1,ret2;
  4033     TInt ret1,ret2;
  3619 	TPositionInfo currPos1,currPos2,currPos3;
  4034     TPositionInfo currPos1,currPos2,currPos3;
  3620 	TPosition cPos1,cPos2,cPos3;
  4035     TPosition cPos1,cPos2,cPos3;
  3621 	TPositionUpdateOptions options;
  4036     TPositionUpdateOptions options;
  3622 	TTimeIntervalMicroSeconds aTimeOut =  80000000;
  4037     TTimeIntervalMicroSeconds aTimeOut =  80000000;
  3623 	TTimeIntervalMicroSeconds aInterval = 10000000;
  4038     TTimeIntervalMicroSeconds aInterval = 10000000;
  3624 	TTimeIntervalMicroSeconds aMaxAge = 5000000;
  4039     TTimeIntervalMicroSeconds aMaxAge = 5000000;
  3625 	TTimeIntervalMicroSeconds aActualInterval;
  4040     TTimeIntervalMicroSeconds aActualInterval;
  3626 	TTime start;
  4041     TTime start;
  3627 	TTime end;
  4042     TTime end;
  3628 	TInt64 aActualInt;
  4043     TInt64 aActualInt;
  3629     returnCode = KErrNone;
  4044     returnCode = KErrNone;
  3630     
  4045 
  3631   // Print to UI
  4046     // Print to UI
  3632   _LIT( KSAPILocTest, "SAPILocTest" );
  4047     _LIT( KSAPILocTest, "SAPILocTest" );
  3633   _LIT( KExample, "GetPostionOpts4");
  4048     _LIT( KExample, "GetPostionOpts4");
  3634   TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4049     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3635   
  4050 
  3636   __UHEAP_MARK;
  4051     __UHEAP_MARK;
  3637   
  4052 
  3638   CLocationService *CoreObj = CLocationService :: NewL();
  4053     CLocationService *CoreObj = CLocationService :: NewL();
  3639     
  4054 
  3640   if( NULL == CoreObj)
  4055     if( NULL == CoreObj)
  3641   	{
  4056         {
  3642   	OpenFile();
  4057         OpenFile();
  3643   	LogFile.Write(_L8("\n<GetPositionOpts4 Test>\n"));
  4058         LogFile.Write(_L8("\n<GetPositionOpts4 Test>\n"));
  3644   	LogFile.Write(_L8("Failed..\n"));
  4059         LogFile.Write(_L8("Failed..\n"));
  3645   	CloseFile();
  4060         CloseFile();
  3646    	return KErrGeneral;
  4061         return KErrGeneral;
  3647  	}
  4062         }
  3648     
  4063 
  3649     _LIT(Kidentity ,"Coreclass Testing" ) ;
  4064     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3650 	//not needed any more
  4065     //not needed any more
  3651 	/*RRequestorStack aRequestorStack;
  4066     /*RRequestorStack aRequestorStack;
  3652 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  4067 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3653     aRequestorStack.Insert(identityInfo,0);
  4068     aRequestorStack.Insert(identityInfo,0);
  3654     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  4069     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3655     
  4070 
  3656     options.SetUpdateTimeOut(aTimeOut);
  4071     options.SetUpdateTimeOut(aTimeOut);
  3657     options.SetUpdateInterval(aInterval);
  4072     options.SetUpdateInterval(aInterval);
  3658     options.SetMaxUpdateAge(aMaxAge);
  4073     options.SetMaxUpdateAge(aMaxAge);
  3659     
  4074 
  3660     ret1 = CoreObj->GetLocationL(&currPos1,&options);
  4075     TRAP(ret1 , CoreObj->GetLocationL(&currPos1,&options));
  3661     
  4076 
  3662     start.HomeTime();
  4077     start.HomeTime();
  3663     ret2 = CoreObj->GetLocationL(&currPos2,&options);
  4078     TRAP(ret2 , CoreObj->GetLocationL(&currPos2,&options));
  3664     end.HomeTime();
  4079     end.HomeTime();
  3665     
  4080 
  3666     aActualInterval=end.MicroSecondsFrom(start);
  4081     aActualInterval=end.MicroSecondsFrom(start);
  3667     
  4082 
  3668   //  if( aActualInterval<=10000000 || ret1 || ret2 )
  4083     //  if( aActualInterval<=10000000 || ret1 || ret2 )
  3669     if( (KErrNone == ret1) && (KErrNone == ret2 ))
  4084     if( (KErrNone == ret1) && (KErrNone == ret2 ))
  3670     	{
  4085         {
  3671       	aActualInt = aActualInterval.Int64();
  4086         aActualInt = aActualInterval.Int64();
  3672     	OpenFile();
  4087         OpenFile();
  3673     	TBuf8<50> buf ;
  4088         TBuf8<50> buf ;
  3674  		TRealFormat format ;
  4089         TRealFormat format ;
  3675  		LogFile.Write(_L8("\n<GetPositionOpts4 Test> \n"));
  4090         LogFile.Write(_L8("\n<GetPositionOpts4 Test> \n"));
  3676  		buf.Num(aActualInt, format) ;
  4091         buf.Num(aActualInt, format) ;
  3677  		LogFile.Write(_L8("TimeTaken = "));
  4092         LogFile.Write(_L8("TimeTaken = "));
  3678  		LogFile.Write(buf) ;
  4093         LogFile.Write(buf) ;
  3679      	CloseFile();
  4094         CloseFile();
  3680      	currPos1.GetPosition(cPos1);
  4095         currPos1.GetPosition(cPos1);
  3681      	currPos2.GetPosition(cPos2);
  4096         currPos2.GetPosition(cPos2);
  3682      //	ValidatePosition(cPos1);
  4097         //	ValidatePosition(cPos1);
  3683      //	ValidatePosition(cPos2);
  4098         //	ValidatePosition(cPos2);
  3684      	returnCode = KErrNone;	
  4099         returnCode = KErrNone;	
  3685       	
  4100 
  3686     	}
  4101         }
  3687     else
  4102     else
  3688     	{
  4103         {
  3689         OpenFile();
  4104         OpenFile();
  3690     	LogFile.Write(_L8("\n<GetPositionOpts4 Test>\n"));
  4105         LogFile.Write(_L8("\n<GetPositionOpts4 Test>\n"));
  3691     	LogFile.Write(_L8("Failed(error in ret values)..\n"));
  4106         LogFile.Write(_L8("Failed(error in ret values)..\n"));
  3692     	CloseFile();	
  4107         CloseFile();	
  3693     	returnCode = KErrGeneral;
  4108         returnCode = KErrGeneral;
  3694         }
  4109         }
  3695         
  4110 
  3696     /*aRequestorStack.Close();
  4111     /*aRequestorStack.Close();
  3697     delete identityInfo;*/
  4112     delete identityInfo;*/
  3698     delete CoreObj;
  4113     delete CoreObj;
  3699     
  4114 
  3700     __UHEAP_MARKEND; 
  4115     __UHEAP_MARKEND; 
  3701     
  4116 
  3702 	  return returnCode;
  4117     return returnCode;
  3703 	}
  4118     }
  3704    
  4119 
  3705 
  4120 
  3706 // -----------------------------------------------------------------------------
  4121 // -----------------------------------------------------------------------------
  3707 // CSAPILocTest::GetPositionOpts5
  4122 // CSAPILocTest::GetPositionOpts5
  3708 // -----------------------------------------------------------------------------
  4123 // -----------------------------------------------------------------------------
  3709 //
  4124 //
  3710 TInt CSAPILocTest::GetPositionOpts5( CStifItemParser& /*aItem*/ )
  4125 TInt CSAPILocTest::GetPositionOpts5( CStifItemParser& /*aItem*/ )
  3711 	{
  4126     {
  3712 	TInt ret1,ret2;
  4127     TInt ret1,ret2;
  3713 	TInt64 aTime1,aTime2;
  4128     TInt64 aTime1,aTime2;
  3714 	TPositionInfo currPos1,currPos2;
  4129     TPositionInfo currPos1,currPos2;
  3715 	TPosition cPos1,cPos2;
  4130     TPosition cPos1,cPos2;
  3716 	TPositionUpdateOptions options;
  4131     TPositionUpdateOptions options;
  3717 	TTimeIntervalMicroSeconds aTimeOut =  10000000;
  4132     TTimeIntervalMicroSeconds aTimeOut =  10000000;
  3718 	TTimeIntervalMicroSeconds aInterval = 2000000;
  4133     TTimeIntervalMicroSeconds aInterval = 2000000;
  3719 	TTimeIntervalMicroSeconds aActualInterval;
  4134     TTimeIntervalMicroSeconds aActualInterval;
  3720 	TTime aTimeStamp1,aTimeStamp2;
  4135     TTime aTimeStamp1,aTimeStamp2;
  3721 	TBool aAcceptPartialUpdates = ETrue;
  4136     TBool aAcceptPartialUpdates = ETrue;
  3722     returnCode = KErrNone;
  4137     returnCode = KErrNone;
  3723   
  4138 
  3724   // Print to UI
  4139     // Print to UI
  3725   _LIT( KSAPILocTest, "SAPILocTest" );
  4140     _LIT( KSAPILocTest, "SAPILocTest" );
  3726   _LIT( KExample, "GetPostionOpts5");
  4141     _LIT( KExample, "GetPostionOpts5");
  3727   TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4142     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3728   
  4143 
  3729   __UHEAP_MARK;
  4144     __UHEAP_MARK;
  3730   
  4145 
  3731   CLocationService *CoreObj = CLocationService :: NewL();
  4146     CLocationService *CoreObj = CLocationService :: NewL();
  3732   
  4147 
  3733   if( NULL == CoreObj)
  4148     if( NULL == CoreObj)
  3734   	{
  4149         {
  3735   	OpenFile();
  4150         OpenFile();
  3736     LogFile.Write(_L8("\n<GetPositionOpts5 Test>\n"));
  4151         LogFile.Write(_L8("\n<GetPositionOpts5 Test>\n"));
  3737     LogFile.Write(_L8("Failed(Null CoreObj)..\n"));
  4152         LogFile.Write(_L8("Failed(Null CoreObj)..\n"));
  3738     CloseFile();
  4153         CloseFile();
  3739    	return KErrGeneral;
  4154         return KErrGeneral;
  3740    	}
  4155         }
  3741     
  4156 
  3742     _LIT(Kidentity ,"Coreclass Testing" ) ;
  4157     _LIT(Kidentity ,"Coreclass Testing" ) ;
  3743 	//not needed any more
  4158     //not needed any more
  3744 	/*RRequestorStack aRequestorStack;
  4159     /*RRequestorStack aRequestorStack;
  3745 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  4160 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  3746     aRequestorStack.Insert(identityInfo,0);
  4161     aRequestorStack.Insert(identityInfo,0);
  3747   
  4162 
  3748     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  4163     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  3749     
  4164 
  3750     options.SetUpdateTimeOut(aTimeOut);
  4165     options.SetUpdateTimeOut(aTimeOut);
  3751     options.SetUpdateInterval(aInterval);
  4166     options.SetUpdateInterval(aInterval);
  3752     options.SetAcceptPartialUpdates(aAcceptPartialUpdates);
  4167     options.SetAcceptPartialUpdates(aAcceptPartialUpdates);
  3753     
  4168 
  3754     User::After(120000000);
  4169     //User::After(120000000);
  3755     ret1 = CoreObj->GetLocationL(&currPos1,&options);
  4170     TRAP(ret1 , CoreObj->GetLocationL(&currPos1,&options));
  3756   
  4171 
  3757     if(KErrNone == ret1)
  4172     if(KErrNone == ret1)
  3758     	{
  4173         {
  3759 	    ret2 = CoreObj->GetLocationL(&currPos2,&options);
  4174         TRAP(ret2 , CoreObj->GetLocationL(&currPos2,&options));
  3760 	    if(KErrNone == ret2)
  4175         if(KErrNone == ret2)
  3761 		    {
  4176             {
  3762 		    currPos1.GetPosition(cPos1);
  4177             currPos1.GetPosition(cPos1);
  3763 		    currPos2.GetPosition(cPos2);
  4178             currPos2.GetPosition(cPos2);
  3764 		    aTimeStamp1 = cPos1.Time();
  4179             aTimeStamp1 = cPos1.Time();
  3765 		    aTimeStamp2 = cPos2.Time();
  4180             aTimeStamp2 = cPos2.Time();
  3766 		    aTime1 = aTimeStamp1.Int64();
  4181             aTime1 = aTimeStamp1.Int64();
  3767 		    aTime2 = aTimeStamp2.Int64();
  4182             aTime2 = aTimeStamp2.Int64();
  3768 		    if((aTime1) && (aTime2))
  4183             if((aTime1) && (aTime2))
  3769 		      	{
  4184                 {
  3770 		        OpenFile();
  4185                 OpenFile();
  3771 		       	LogFile.Write(_L8("\n<GetPositionOpts5 Test>\n"));
  4186                 LogFile.Write(_L8("\n<GetPositionOpts5 Test>\n"));
  3772 		       	LogFile.Write(_L8("Passed..\n"));
  4187                 LogFile.Write(_L8("Passed..\n"));
  3773 		       	CloseFile();
  4188                 CloseFile();
  3774 		        returnCode = KErrNone;	
  4189                 returnCode = KErrNone;	
  3775 		        }
  4190                 }
  3776 		     else
  4191             else
  3777 		      	{
  4192                 {
  3778 		        OpenFile();
  4193                 OpenFile();
  3779 		    	LogFile.Write(_L8("\n<GetPositionOpts5 Test>\n"));
  4194                 LogFile.Write(_L8("\n<GetPositionOpts5 Test>\n"));
  3780 		    	LogFile.Write(_L8("Failed(no timeStamp)..\n"));
  4195                 LogFile.Write(_L8("Failed(no timeStamp)..\n"));
  3781 		    	CloseFile();
  4196                 CloseFile();
  3782 		       	returnCode = KErrGeneral;	
  4197                 returnCode = KErrGeneral;	
  3783 		      	}
  4198                 }
  3784 		    }
  4199             }
  3785 		 else
  4200         else
  3786 		 	{
  4201             {
  3787 		 	OpenFile();
  4202             OpenFile();
  3788 		    LogFile.Write(_L8("\n<GetPositionOpts5 Test>\n"));
  4203             LogFile.Write(_L8("\n<GetPositionOpts5 Test>\n"));
  3789 		    LogFile.Write(_L8("Failed(getLoc2 error)..\n"));
  4204             LogFile.Write(_L8("Failed(getLoc2 error)..\n"));
  3790 		    CloseFile();
  4205             CloseFile();
  3791 		    returnCode = KErrGeneral;		
  4206             returnCode = KErrGeneral;		
  3792 		 	}
  4207             }
  3793     	}
  4208         }
  3794    
  4209 
  3795     else
  4210     else
  3796     	{
  4211         {
  3797 	    OpenFile();
  4212         OpenFile();
  3798 	    LogFile.Write(_L8("\n<GetPositionOpts5 Test>\n"));
  4213         LogFile.Write(_L8("\n<GetPositionOpts5 Test>\n"));
  3799 	    LogFile.Write(_L8("Failed(getLoc error)..\n"));
  4214         LogFile.Write(_L8("Failed(getLoc error)..\n"));
  3800 	    CloseFile();
  4215         CloseFile();
  3801 	    returnCode = KErrGeneral;	
  4216         returnCode = KErrGeneral;	
  3802    		}
  4217         }
  3803 
  4218 
  3804 	/*aRequestorStack.Close();
  4219     /*aRequestorStack.Close();
  3805 	delete identityInfo;*/
  4220 	delete identityInfo;*/
  3806 	delete CoreObj;
  4221     delete CoreObj;
  3807 	__UHEAP_MARKEND;   
  4222     __UHEAP_MARKEND;   
  3808 	return returnCode;
  4223     return returnCode;
  3809 	}
  4224     }
  3810    
  4225 
  3811  // -----------------------------------------------------------------------------
  4226 // -----------------------------------------------------------------------------
  3812 // CSAPILocTest::GetLastPosition
  4227 // CSAPILocTest::GetLastPosition
  3813 // -----------------------------------------------------------------------------
  4228 // -----------------------------------------------------------------------------
  3814 //
  4229 //
  3815 //TInt CSAPILocTest::GetLastPosition( CStifItemParser& /*aItem*/ )
  4230 //TInt CSAPILocTest::GetLastPosition( CStifItemParser& /*aItem*/ )
  3816   /*  {
  4231 /*  {
  3817     	TInt ret;
  4232     	TInt ret;
  3818     	TPosition currPos;
  4233     	TPosition currPos;
  3819     	TTime currPosTime;
  4234     	TTime currPosTime;
  3820     	TDateTime currPosDateTime;
  4235     	TDateTime currPosDateTime;
  3821     // Print to UI
  4236     // Print to UI
  3822     _LIT( KSAPILocTest, "SAPILocTest" );
  4237     _LIT( KSAPILocTest, "SAPILocTest" );
  3823     _LIT( KExample, "GetLastPosition" );
  4238     _LIT( KExample, "GetLastPosition" );
  3824     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4239     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3825     
  4240 
  3826     // Print to log file
  4241     // Print to log file
  3827     iLog->Log( KExample );
  4242     iLog->Log( KExample );
  3828 
  4243 
  3829     __UHEAP_MARK;
  4244     __UHEAP_MARK;
  3830     CLocationService *CoreObj = CLocationService :: NewL();
  4245     CLocationService *CoreObj = CLocationService :: NewL();
  3831     
  4246 
  3832     if( NULL == CoreObj)
  4247     if( NULL == CoreObj)
  3833     {
  4248     {
  3834     	iLog->Log( _L("CLocationService object creation failed") );	
  4249     	iLog->Log( _L("CLocationService object creation failed") );	
  3835    		return KErrGeneral;
  4250    		return KErrGeneral;
  3836    	}
  4251    	}
  3837     
  4252 
  3838     ret = CoreObj->GetLastKnownLoc(currPos);
  4253     ret = CoreObj->GetLastKnownLoc(currPos);
  3839     if( KErrUnknown==ret )
  4254     if( KErrUnknown==ret )
  3840     {
  4255     {
  3841     	iLog->Log( _L("GetLastLocation failed to return values") );
  4256     	iLog->Log( _L("GetLastLocation failed to return values") );
  3842     	 aRequestorStack.Close();
  4257     	 aRequestorStack.Close();
  3843 	    delete identityInfo;
  4258 	    delete identityInfo;
  3844 	    delete CoreObj;
  4259 	    delete CoreObj;
  3845     	 __UHEAP_MARKEND;
  4260     	 __UHEAP_MARKEND;
  3846     	return KErrNone;	
  4261     	return KErrNone;	
  3847     }
  4262     }
  3848     
  4263 
  3849     else
  4264     else
  3850     {
  4265     {
  3851     	iLog->Log( _L("GetLastLocation returned") );
  4266     	iLog->Log( _L("GetLastLocation returned") );
  3852     	 aRequestorStack.Close();
  4267     	 aRequestorStack.Close();
  3853 	    delete identityInfo;
  4268 	    delete identityInfo;
  3854 	    delete CoreObj;
  4269 	    delete CoreObj;
  3855     	 __UHEAP_MARKEND;
  4270     	 __UHEAP_MARKEND;
  3856     	return KErrGeneral;
  4271     	return KErrGeneral;
  3857     }
  4272     }
  3858     
  4273 
  3859        
  4274 
  3860     }*/
  4275     }*/
  3861     
  4276 
  3862     
  4277 
  3863  // -----------------------------------------------------------------------------
  4278 // -----------------------------------------------------------------------------
  3864 // CSAPILocTest::GetLastPosition1
  4279 // CSAPILocTest::GetLastPosition1
  3865 // -----------------------------------------------------------------------------
  4280 // -----------------------------------------------------------------------------
  3866 //
  4281 //
  3867 //TInt CSAPILocTest::GetLastPosition1( CStifItemParser& /*aItem*/ )
  4282 //TInt CSAPILocTest::GetLastPosition1( CStifItemParser& /*aItem*/ )
  3868 /*    {
  4283 /*    {
  3875     	TReal32 aAltitude1,aAltitude2; 
  4290     	TReal32 aAltitude1,aAltitude2; 
  3876     // Print to UI
  4291     // Print to UI
  3877     _LIT( KSAPILocTest, "SAPILocTest" );
  4292     _LIT( KSAPILocTest, "SAPILocTest" );
  3878     _LIT( KExample, "GetLastPosition1" );
  4293     _LIT( KExample, "GetLastPosition1" );
  3879     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4294     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3880     
  4295 
  3881     // Print to log file
  4296     // Print to log file
  3882     iLog->Log( KExample );
  4297     iLog->Log( KExample );
  3883 
  4298 
  3884     __UHEAP_MARK;
  4299     __UHEAP_MARK;
  3885     CLocationService *CoreObj = CLocationService :: NewL();
  4300     CLocationService *CoreObj = CLocationService :: NewL();
  3886     
  4301 
  3887     if( NULL == CoreObj)
  4302     if( NULL == CoreObj)
  3888     {
  4303     {
  3889     	iLog->Log( _L("CLocationService object creation failed") );	
  4304     	iLog->Log( _L("CLocationService object creation failed") );	
  3890    		__UHEAP_MARKEND;
  4305    		__UHEAP_MARKEND;
  3891    		return KErrGeneral;
  4306    		return KErrGeneral;
  3892    	}
  4307    	}
  3893     
  4308 
  3894     aRet = CoreObj->GetLocationL(aCurrPos);
  4309     aRet = CoreObj->GetLocationL(aCurrPos);
  3895     if(aRet)
  4310     if(aRet)
  3896     {
  4311     {
  3897     	iLog->Log( _L("GetLocationL failed") );
  4312     	iLog->Log( _L("GetLocationL failed") );
  3898     	 aRequestorStack.Close();
  4313     	 aRequestorStack.Close();
  3899 	    delete identityInfo;
  4314 	    delete identityInfo;
  3900 	    delete CoreObj;
  4315 	    delete CoreObj;
  3901     	__UHEAP_MARKEND;
  4316     	__UHEAP_MARKEND;
  3902     	return KErrGeneral;	
  4317     	return KErrGeneral;	
  3903     }
  4318     }
  3904     
  4319 
  3905     aCurrPosTime = aCurrPos.Time();
  4320     aCurrPosTime = aCurrPos.Time();
  3906     aRet1 = CoreObj->GetLastKnownLoc(aLastPos);
  4321     aRet1 = CoreObj->GetLastKnownLoc(aLastPos);
  3907     if(!aRet1)
  4322     if(!aRet1)
  3908     {
  4323     {
  3909     	aLastPosTime = aLastPos.Time();
  4324     	aLastPosTime = aLastPos.Time();
  3922     		aLongitude1 = aCurrPos.Longitude();
  4337     		aLongitude1 = aCurrPos.Longitude();
  3923     		aAltitude1 = aCurrPos.Altitude();
  4338     		aAltitude1 = aCurrPos.Altitude();
  3924             aLatitude2  = aLastPos.Latitude();
  4339             aLatitude2  = aLastPos.Latitude();
  3925     		aLongitude2 = aLastPos.Longitude();
  4340     		aLongitude2 = aLastPos.Longitude();
  3926     		aAltitude2 = aLastPos.Altitude();
  4341     		aAltitude2 = aLastPos.Altitude();
  3927     		
  4342 
  3928     		if( (aLatitude1 != aLatitude2) || (aLongitude1 != aLongitude2) || (aAltitude1 != aAltitude2 ))
  4343     		if( (aLatitude1 != aLatitude2) || (aLongitude1 != aLongitude2) || (aAltitude1 != aAltitude2 ))
  3929     		{
  4344     		{
  3930     			iLog->Log( _L("Returned coordinates are wrong") );
  4345     			iLog->Log( _L("Returned coordinates are wrong") );
  3931     			 aRequestorStack.Close();
  4346     			 aRequestorStack.Close();
  3932 	    delete identityInfo;
  4347 	    delete identityInfo;
  3941 	    delete identityInfo;
  4356 	    delete identityInfo;
  3942 	    delete CoreObj;
  4357 	    delete CoreObj;
  3943     			__UHEAP_MARKEND;
  4358     			__UHEAP_MARKEND;
  3944     			return KErrNone;	
  4359     			return KErrNone;	
  3945             }  
  4360             }  
  3946                
  4361 
  3947         }
  4362         }
  3948     }
  4363     }
  3949     
  4364 
  3950        
  4365 
  3951     else
  4366     else
  3952     {
  4367     {
  3953     	iLog->Log( _L("GetLastKnownLoc failed"));
  4368     	iLog->Log( _L("GetLastKnownLoc failed"));
  3954          aRequestorStack.Close();
  4369          aRequestorStack.Close();
  3955 	    delete identityInfo;
  4370 	    delete identityInfo;
  3956 	    delete CoreObj;
  4371 	    delete CoreObj;
  3957 	    __UHEAP_MARKEND;       
  4372 	    __UHEAP_MARKEND;       
  3958         return KErrNone;    
  4373         return KErrNone;    
  3959     }
  4374     }
  3960     
  4375 
  3961     
  4376 
  3962     }*/
  4377     }*/
  3963     
  4378 
  3964     
  4379 
  3965 // -----------------------------------------------------------------------------
  4380 // -----------------------------------------------------------------------------
  3966 // CSAPILocTest::GetDistance
  4381 // CSAPILocTest::GetDistance
  3967 // -----------------------------------------------------------------------------
  4382 // -----------------------------------------------------------------------------
  3968 //
  4383 //
  3969 TInt CSAPILocTest::GetDistance( CStifItemParser& /*aItem*/ )
  4384 TInt CSAPILocTest::GetDistance( CStifItemParser& /*aItem*/ )
  3970     {
  4385     {
  3971     TInt aRet;
  4386     TInt aRet;
  3972     inpparam aInputParam;
  4387     inpparam aInputParam;
  3973     returnCode = KErrNone;
  4388     returnCode = KErrNone;
  3974      // Print to UI
  4389     // Print to UI
  3975     _LIT( KSAPILocTest, "SAPILocTest" );
  4390     _LIT( KSAPILocTest, "SAPILocTest" );
  3976     _LIT( KExample, "GetDistance" );
  4391     _LIT( KExample, "GetDistance" );
  3977     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4392     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  3978   
  4393 
  3979     __UHEAP_MARK;
  4394     __UHEAP_MARK;
  3980     
  4395 
  3981     CLocationService *CoreObj = CLocationService :: NewL();
  4396     CLocationService *CoreObj = CLocationService :: NewL();
  3982   
  4397 
  3983     if( NULL == CoreObj)
  4398     if( NULL == CoreObj)
  3984     	{
  4399         {
  3985     	OpenFile();
  4400         OpenFile();
  3986 	    LogFile.Write(_L8("\n<GetDistance Test>\n"));
  4401         LogFile.Write(_L8("\n<GetDistance Test>\n"));
  3987 	    LogFile.Write(_L8("Failed..\n"));
  4402         LogFile.Write(_L8("Failed..\n"));
  3988 	    CloseFile();
  4403         CloseFile();
  3989    		return KErrGeneral;
  4404         return KErrGeneral;
  3990    		}
  4405         }
  3991     
  4406 
  3992     aInputParam.servicechoice = 0;
  4407     aInputParam.servicechoice = 0;
  3993     aRet = CoreObj->MathOperation(aInputParam);
  4408     aRet = CoreObj->MathOperation(aInputParam);
  3994     if( KErrArgument == aRet )
  4409     if( KErrArgument == aRet )
  3995 		{
  4410         {
  3996 		OpenFile();
  4411         OpenFile();
  3997     	LogFile.Write(_L8("\n<GetDistance test> \n"));
  4412         LogFile.Write(_L8("\n<GetDistance test> \n"));
  3998  		LogFile.Write(_L8("Passed..\n")) ;
  4413         LogFile.Write(_L8("Passed..\n")) ;
  3999  		CloseFile();
  4414         CloseFile();
  4000       	returnCode = KErrNone;  
  4415         returnCode = KErrNone;  
  4001 		}
  4416         }
  4002     else
  4417     else
  4003     	{
  4418         {
  4004  		OpenFile();
  4419         OpenFile();
  4005  		LogFile.Write(_L8("\n<GetDistance test> \n"));
  4420         LogFile.Write(_L8("\n<GetDistance test> \n"));
  4006  		LogFile.Write(_L8("Failed..\n")) ;
  4421         LogFile.Write(_L8("Failed..\n")) ;
  4007  		CloseFile();
  4422         CloseFile();
  4008       	returnCode = KErrGeneral;     	
  4423         returnCode = KErrGeneral;     	
  4009     	}		
  4424         }		
  4010    
  4425 
  4011    
  4426 
  4012    delete CoreObj;
  4427     delete CoreObj;
  4013 
  4428 
  4014 	__UHEAP_MARKEND;       
  4429     __UHEAP_MARKEND;       
  4015     return KErrNone;    
  4430     return KErrNone;    
  4016   }
  4431     }
  4017     
  4432 
  4018 // -----------------------------------------------------------------------------
  4433 // -----------------------------------------------------------------------------
  4019 // CSAPILocTest::GetDistance2
  4434 // CSAPILocTest::GetDistance2
  4020 // -----------------------------------------------------------------------------
  4435 // -----------------------------------------------------------------------------
  4021 //
  4436 //
  4022 TInt CSAPILocTest::GetDistance2( CStifItemParser& /*aItem*/ )
  4437 TInt CSAPILocTest::GetDistance2( CStifItemParser& /*aItem*/ )
  4023     {
  4438     {
  4024   	TInt aRet;
  4439     TInt aRet;
  4025  // 	TPositionInfo currPos[2];
  4440     // 	TPositionInfo currPos[2];
  4026   	TPosition currPos1[2];
  4441     TPosition currPos1[2];
  4027   	inpparam aInputParam;
  4442     inpparam aInputParam;
  4028     TReal64 aLatitude1 = 10,aLatitude2 = 20;
  4443     TReal64 aLatitude1 = 10,aLatitude2 = 20;
  4029 	TReal64 aLongitude1 = 120,aLongitude2 = 140;
  4444     TReal64 aLongitude1 = 120,aLongitude2 = 140;
  4030 	TReal32 aAltitude1 = 500,aAltitude2 = 500; 
  4445     TReal32 aAltitude1 = 500,aAltitude2 = 500; 
  4031   	returnCode = KErrNone;
  4446     returnCode = KErrNone;
  4032   	
  4447 
  4033     // Print to UI
  4448     // Print to UI
  4034     _LIT( KSAPILocTest, "SAPILocTest" );
  4449     _LIT( KSAPILocTest, "SAPILocTest" );
  4035     _LIT( KExample, "GetDistance2" );
  4450     _LIT( KExample, "GetDistance2" );
  4036     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4451     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4037     
  4452 
  4038     __UHEAP_MARK;
  4453     __UHEAP_MARK;
  4039   
  4454 
  4040     CLocationService *CoreObj = CLocationService :: NewL();
  4455     CLocationService *CoreObj = CLocationService :: NewL();
  4041     
  4456 
  4042     if( NULL == CoreObj)
  4457     if( NULL == CoreObj)
  4043     	{
  4458         {
  4044     	OpenFile();
  4459         OpenFile();
  4045 	    LogFile.Write(_L8("\n<GetDistance2 Test>\n"));
  4460         LogFile.Write(_L8("\n<GetDistance2 Test>\n"));
  4046 	    LogFile.Write(_L8("Failed(CoreObj Creation)..\n"));
  4461         LogFile.Write(_L8("Failed(CoreObj Creation)..\n"));
  4047 	    CloseFile();
  4462         CloseFile();
  4048    		return KErrGeneral;
  4463         return KErrGeneral;
  4049    		}
  4464         }
  4050     
  4465 
  4051     _LIT(Kidentity ,"Coreclass Testing" ) ;
  4466     _LIT(Kidentity ,"Coreclass Testing" ) ;
  4052 	//not needed any more
  4467     //not needed any more
  4053 	/*RRequestorStack aRequestorStack;
  4468     /*RRequestorStack aRequestorStack;
  4054 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  4469 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  4055     aRequestorStack.Insert(identityInfo,0);
  4470     aRequestorStack.Insert(identityInfo,0);
  4056     
  4471 
  4057     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  4472     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  4058     
  4473 
  4059     /*for( TInt i=0;i<2;i++)
  4474     /*for( TInt i=0;i<2;i++)
  4060     	{
  4475     	{
  4061         ret[i] = CoreObj->GetLocationL(&currPos[i]);
  4476         ret[i] = CoreObj->GetLocationL(&currPos[i]);
  4062     	}
  4477     	}
  4063     if( !ret[0] && !ret[1])
  4478     if( !ret[0] && !ret[1])
  4064     	{
  4479     	{
  4065     
  4480 
  4066     	
  4481 
  4067    		currPos[0].GetPosition(currPos1[0]);
  4482    		currPos[0].GetPosition(currPos1[0]);
  4068     	currPos[1].GetPosition(currPos1[1]);
  4483     	currPos[1].GetPosition(currPos1[1]);
  4069     	
  4484 
  4070     	aLatitude1  = currPos1[0].Latitude();
  4485     	aLatitude1  = currPos1[0].Latitude();
  4071 		aLongitude1 = currPos1[0].Longitude() ;
  4486 		aLongitude1 = currPos1[0].Longitude() ;
  4072 		aAltitude1  = currPos1[0].Altitude() ;
  4487 		aAltitude1  = currPos1[0].Altitude() ;
  4073 	   	aLatitude2  = currPos1[1].Latitude();
  4488 	   	aLatitude2  = currPos1[1].Latitude();
  4074 		aLongitude2 = currPos1[1].Longitude() ;
  4489 		aLongitude2 = currPos1[1].Longitude() ;
  4075 		aAltitude2  = currPos1[1].Altitude() ;
  4490 		aAltitude2  = currPos1[1].Altitude() ;
  4076 	*/	
  4491      */	
  4077     	aInputParam.servicechoice = 10;
  4492     aInputParam.servicechoice = 10;
  4078     	aInputParam.source.SetCoordinate(aLatitude1,aLongitude1,aAltitude1);
  4493     aInputParam.source.SetCoordinate(aLatitude1,aLongitude1,aAltitude1);
  4079     	aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2,aAltitude2);
  4494     aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2,aAltitude2);
  4080     	
  4495 
  4081     	aRet = CoreObj->MathOperation(aInputParam);
  4496     aRet = CoreObj->MathOperation(aInputParam);
  4082     	
  4497 
  4083     	if(KErrNotSupported == aRet)
  4498     if(KErrNotSupported == aRet)
  4084     		{
  4499         {
  4085     		OpenFile();
  4500         OpenFile();
  4086 	    	TBuf8<50> buf ;
  4501         TBuf8<50> buf ;
  4087 	 		TRealFormat format; 
  4502         TRealFormat format; 
  4088 	 		LogFile.Write(_L8("\n<GetDistance2 test> \n"));
  4503         LogFile.Write(_L8("\n<GetDistance2 test> \n"));
  4089 	 		LogFile.Write(_L8("Passed..\n"));
  4504         LogFile.Write(_L8("Passed..\n"));
  4090 	 		CloseFile();
  4505         CloseFile();
  4091 	        returnCode = KErrNone;  
  4506         returnCode = KErrNone;  
  4092     		}
  4507         }
  4093 	    else
  4508     else
  4094        		{
  4509         {
  4095    			OpenFile();
  4510         OpenFile();
  4096      		LogFile.Write(_L8("\n<GetDistance2 test> \n"));
  4511         LogFile.Write(_L8("\n<GetDistance2 test> \n"));
  4097  		 	LogFile.Write(_L8("Failed(Wrong error)..\n"));
  4512         LogFile.Write(_L8("Failed(Wrong error)..\n"));
  4098  		 	CloseFile();
  4513         CloseFile();
  4099  		 	returnCode = KErrGeneral;
  4514         returnCode = KErrGeneral;
  4100        		}
  4515         }
  4101     /*	}
  4516     /*	}
  4102     else
  4517     else
  4103     	{
  4518     	{
  4104     	OpenFile();
  4519     	OpenFile();
  4105     	LogFile.Write(_L8("\n<GetDistance2 test> \n"));
  4520     	LogFile.Write(_L8("\n<GetDistance2 test> \n"));
  4106  	    LogFile.Write(_L8("Failed..\n"));
  4521  	    LogFile.Write(_L8("Failed..\n"));
  4107  	    CloseFile();
  4522  	    CloseFile();
  4108  	    returnCode = KErrGeneral;	
  4523  	    returnCode = KErrGeneral;	
  4109     	}
  4524     	}
  4110     */
  4525      */
  4111    /*aRequestorStack.Close();
  4526     /*aRequestorStack.Close();
  4112    delete identityInfo;*/
  4527    delete identityInfo;*/
  4113    delete CoreObj;
  4528     delete CoreObj;
  4114    
  4529 
  4115    __UHEAP_MARKEND;
  4530     __UHEAP_MARKEND;
  4116    return returnCode;
  4531     return returnCode;
  4117     }
  4532     }
  4118 // -----------------------------------------------------------------------------
  4533 // -----------------------------------------------------------------------------
  4119 // CSAPILocTest::GetDistance3
  4534 // CSAPILocTest::GetDistance3
  4120 // -----------------------------------------------------------------------------
  4535 // -----------------------------------------------------------------------------
  4121 //
  4536 //
  4122 TInt CSAPILocTest::GetDistance3( CStifItemParser& /*aItem*/ )
  4537 TInt CSAPILocTest::GetDistance3( CStifItemParser& /*aItem*/ )
  4123     {
  4538     {
  4124   	TInt ret[2],aRet;
  4539     TInt ret[2],aRet;
  4125   	TPositionInfo currPos[2];
  4540     TPositionInfo currPos[2];
  4126   	TPosition currPos1[2];
  4541     TPosition currPos1[2];
  4127   	inpparam aInputParam;
  4542     inpparam aInputParam;
  4128     returnCode = KErrNone;
  4543     returnCode = KErrNone;
  4129     TReal64 aLatitude1,aLatitude2;
  4544     TReal64 aLatitude1,aLatitude2;
  4130 	TReal64 aLongitude1,aLongitude2;
  4545     TReal64 aLongitude1,aLongitude2;
  4131 	TReal32 aAltitude1,aAltitude2; 
  4546     TReal32 aAltitude1,aAltitude2; 
  4132       // Print to UI
  4547     // Print to UI
  4133     _LIT( KSAPILocTest, "SAPILocTest" );
  4548     _LIT( KSAPILocTest, "SAPILocTest" );
  4134     _LIT( KExample, "GetDistance3" );
  4549     _LIT( KExample, "GetDistance3" );
  4135     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4550     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4136   
  4551 
  4137     __UHEAP_MARK;
  4552     __UHEAP_MARK;
  4138   
  4553 
  4139     CLocationService *CoreObj = CLocationService :: NewL();
  4554     CLocationService *CoreObj = CLocationService :: NewL();
  4140     
  4555 
  4141     if( NULL == CoreObj)
  4556     if( NULL == CoreObj)
  4142     	{
  4557         {
  4143     	OpenFile();
  4558         OpenFile();
  4144 	    LogFile.Write(_L8("\n<GetDistance3 Test>\n"));
  4559         LogFile.Write(_L8("\n<GetDistance3 Test>\n"));
  4145 	    LogFile.Write(_L8("Failed..\n"));
  4560         LogFile.Write(_L8("Failed..\n"));
  4146 	    CloseFile();
  4561         CloseFile();
  4147    		return KErrGeneral;
  4562         return KErrGeneral;
  4148    		}
  4563         }
  4149     
  4564 
  4150     _LIT(Kidentity ,"Coreclass Testing" ) ;
  4565     _LIT(Kidentity ,"Coreclass Testing" ) ;
  4151     //not needed any more
  4566     //not needed any more
  4152 	/*RRequestorStack aRequestorStack;
  4567     /*RRequestorStack aRequestorStack;
  4153 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  4568 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  4154     aRequestorStack.Insert(identityInfo,0);
  4569     aRequestorStack.Insert(identityInfo,0);
  4155     
  4570 
  4156     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  4571     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  4157     
  4572 
  4158     for( TInt i=0;i<2;i++)
  4573     for( TInt i=0;i<2;i++)
  4159     	{
  4574         {
  4160         ret[i] = CoreObj->GetLocationL(&currPos[i]);
  4575         TRAP(ret[i] , CoreObj->GetLocationL(&currPos[i]));
  4161     	}
  4576         }
  4162     if( (KErrNone == ret[0]) && (KErrNone == ret[1] ))
  4577     if( (KErrNone == ret[0]) && (KErrNone == ret[1] ))
  4163     	{
  4578         {
  4164     	currPos[0].GetPosition(currPos1[0]);
  4579         currPos[0].GetPosition(currPos1[0]);
  4165     	currPos[1].GetPosition(currPos1[1]);
  4580         currPos[1].GetPosition(currPos1[1]);
  4166     	aLatitude1  = currPos1[0].Latitude();
  4581         aLatitude1  = currPos1[0].Latitude();
  4167 		aLongitude1 = currPos1[0].Longitude() ;
  4582         aLongitude1 = currPos1[0].Longitude() ;
  4168 		aAltitude1  = currPos1[0].Altitude() ;
  4583         aAltitude1  = currPos1[0].Altitude() ;
  4169 	   	aLatitude2  = currPos1[1].Latitude();
  4584         aLatitude2  = currPos1[1].Latitude();
  4170 		aLongitude2 = currPos1[1].Longitude() ;
  4585         aLongitude2 = currPos1[1].Longitude() ;
  4171 		aAltitude2  = currPos1[1].Altitude() ;
  4586         aAltitude2  = currPos1[1].Altitude() ;
  4172 	    
  4587 
  4173 	    aInputParam.servicechoice = 0;
  4588         aInputParam.servicechoice = 0;
  4174     	aInputParam.source.SetCoordinate(aLatitude1,aLongitude1,aAltitude1);
  4589         aInputParam.source.SetCoordinate(aLatitude1,aLongitude1,aAltitude1);
  4175     	aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2,aAltitude2);
  4590         aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2,aAltitude2);
  4176     	
  4591 
  4177     	aRet = CoreObj->MathOperation(aInputParam);
  4592         aRet = CoreObj->MathOperation(aInputParam);
  4178     	
  4593 
  4179     	if( KErrNone == aRet )
  4594         if( KErrNone == aRet )
  4180     		{
  4595             {
  4181     		OpenFile();
  4596             OpenFile();
  4182 	    	TBuf8<50> buf ;
  4597             TBuf8<50> buf ;
  4183 	 		TRealFormat format; 
  4598             TRealFormat format; 
  4184 	 		LogFile.Write(_L8("\n<GetDistance3 test> \n"));
  4599             LogFile.Write(_L8("\n<GetDistance3 test> \n"));
  4185 	 		buf.Num(aInputParam.result, format) ;
  4600             buf.Num(aInputParam.result, format) ;
  4186 	 		LogFile.Write(_L8("Distance = "));
  4601             LogFile.Write(_L8("Distance = "));
  4187 	 		LogFile.Write(buf) ;
  4602             LogFile.Write(buf) ;
  4188 	 		LogFile.Write(_L8("\n")) ;
  4603             LogFile.Write(_L8("\n")) ;
  4189 	 		CloseFile();
  4604             CloseFile();
  4190 	      	if( aInputParam.result<0 )
  4605             if( aInputParam.result<0 )
  4191 	      		{
  4606                 {
  4192 	      		returnCode = KErrGeneral; 
  4607                 returnCode = KErrGeneral; 
  4193 	      		}
  4608                 }
  4194 	      	else
  4609             else
  4195 	      		{
  4610                 {
  4196 	      		returnCode = KErrNone;  
  4611                 returnCode = KErrNone;  
  4197 	      		}
  4612                 }
  4198 	      	}
  4613             }
  4199     	else
  4614         else
  4200     		{
  4615             {
  4201     		OpenFile();
  4616             OpenFile();
  4202        		LogFile.Write(_L8("\n<GetDistance3 test> \n"));
  4617             LogFile.Write(_L8("\n<GetDistance3 test> \n"));
  4203 	    	LogFile.Write(_L8("Failed(Math op).. \n"));
  4618             LogFile.Write(_L8("Failed(Math op).. \n"));
  4204 	 	    CloseFile();
  4619             CloseFile();
  4205 	 	    returnCode = KErrGeneral;
  4620             returnCode = KErrGeneral;
  4206     		}
  4621             }
  4207 	   	}
  4622         }
  4208     else
  4623     else
  4209     	{  
  4624         {  
  4210     	OpenFile();
  4625         OpenFile();
  4211      	LogFile.Write(_L8("\n<GetDistance3 test> \n"));
  4626         LogFile.Write(_L8("\n<GetDistance3 test> \n"));
  4212 	   	LogFile.Write(_L8("Failed(getloc error).. \n"));
  4627         LogFile.Write(_L8("Failed(getloc error).. \n"));
  4213 	    CloseFile();
  4628         CloseFile();
  4214 	    returnCode = KErrGeneral;	
  4629         returnCode = KErrGeneral;	
  4215     	}
  4630         }
  4216    
  4631 
  4217    /*aRequestorStack.Close();
  4632     /*aRequestorStack.Close();
  4218    delete identityInfo;*/
  4633    delete identityInfo;*/
  4219    delete CoreObj;
  4634     delete CoreObj;
  4220 	  
  4635 
  4221 	  __UHEAP_MARKEND; 	
  4636     __UHEAP_MARKEND; 	
  4222    
  4637 
  4223     return returnCode;
  4638     return returnCode;
  4224     }
  4639     }
  4225         
  4640 
  4226 // -----------------------------------------------------------------------------
  4641 // -----------------------------------------------------------------------------
  4227 // CSAPILocTest::GetDistance4
  4642 // CSAPILocTest::GetDistance4
  4228 // -----------------------------------------------------------------------------
  4643 // -----------------------------------------------------------------------------
  4229 //
  4644 //
  4230 TInt CSAPILocTest::GetDistance4( CStifItemParser& /*aItem*/ )
  4645 TInt CSAPILocTest::GetDistance4( CStifItemParser& /*aItem*/ )
  4231     {
  4646     {
  4232     TInt aRet;
  4647     TInt aRet;
  4233   	inpparam aInputParam;
  4648     inpparam aInputParam;
  4234     TTime aCurrentTime;
  4649     TTime aCurrentTime;
  4235     returnCode = KErrNone;
  4650     returnCode = KErrNone;
  4236     
  4651 
  4237     TCoordinate  aCoordinate1(90,180),aCoordinate2(-90,0);
  4652     TCoordinate  aCoordinate1(90,180),aCoordinate2(-90,0);
  4238 //	TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5);
  4653     //	TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5);
  4239 //	TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime);
  4654     //	TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime);
  4240 		 
  4655 
  4241 		// Print to UI
  4656     // Print to UI
  4242     _LIT( KSAPILocTest, "SAPILocTest" );
  4657     _LIT( KSAPILocTest, "SAPILocTest" );
  4243     _LIT( KExample, "GetDistance4" );
  4658     _LIT( KExample, "GetDistance4" );
  4244     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4659     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4245   
  4660 
  4246     __UHEAP_MARK;
  4661     __UHEAP_MARK;
  4247   
  4662 
  4248     CLocationService *CoreObj = CLocationService :: NewL();
  4663     CLocationService *CoreObj = CLocationService :: NewL();
  4249     
  4664 
  4250     if( NULL == CoreObj)
  4665     if( NULL == CoreObj)
  4251     	{
  4666         {
  4252     	OpenFile();
  4667         OpenFile();
  4253 	    LogFile.Write(_L8("\n<GetDistance4 Test>\n"));
  4668         LogFile.Write(_L8("\n<GetDistance4 Test>\n"));
  4254 	    LogFile.Write(_L8("Failed..\n"));
  4669         LogFile.Write(_L8("Failed..\n"));
  4255 	    CloseFile();
  4670         CloseFile();
  4256    		return KErrGeneral;
  4671         return KErrGeneral;
  4257    		}
  4672         }
  4258     
  4673 
  4259    		
  4674 
  4260     	aInputParam.servicechoice = 0;
  4675     aInputParam.servicechoice = 0;
  4261       	aInputParam.source = aCoordinate1;
  4676     aInputParam.source = aCoordinate1;
  4262       	aInputParam.destination = aCoordinate2;
  4677     aInputParam.destination = aCoordinate2;
  4263     //	aInputParam.source.SetPosition(aPosition1);
  4678     //	aInputParam.source.SetPosition(aPosition1);
  4264     //	aInputParam.destination.SetPosition(aPosition2);
  4679     //	aInputParam.destination.SetPosition(aPosition2);
  4265     	
  4680 
  4266     	aRet = CoreObj->MathOperation(aInputParam);
  4681     aRet = CoreObj->MathOperation(aInputParam);
  4267     	if(KErrNone == aRet)
  4682     if(KErrNone == aRet)
  4268     		{
  4683         {
  4269     		OpenFile();
  4684         OpenFile();
  4270 	    	TBuf8<50> buf ;
  4685         TBuf8<50> buf ;
  4271 	 		TRealFormat format; 
  4686         TRealFormat format; 
  4272 	 		LogFile.Write(_L8("\n<GetDistance4 test> \n"));
  4687         LogFile.Write(_L8("\n<GetDistance4 test> \n"));
  4273 	 		buf.Num(aInputParam.result, format) ;
  4688         buf.Num(aInputParam.result, format) ;
  4274 	 		LogFile.Write(_L8("Distance = "));
  4689         LogFile.Write(_L8("Distance = "));
  4275 	 		LogFile.Write(buf) ;
  4690         LogFile.Write(buf) ;
  4276 	 		LogFile.Write(_L8("\n")) ;
  4691         LogFile.Write(_L8("\n")) ;
  4277 	 		CloseFile();
  4692         CloseFile();
  4278 	        
  4693 
  4279 	        if( aInputParam.result<0 )
  4694         if( aInputParam.result<0 )
  4280 	      		{
  4695             {
  4281 	      		returnCode = KErrGeneral; 
  4696             returnCode = KErrGeneral; 
  4282 	      		}
  4697             }
  4283 	      	else
  4698         else
  4284 	      		{
  4699             {
  4285 	      		returnCode = KErrNone;  
  4700             returnCode = KErrNone;  
  4286 	      		}
  4701             }
  4287     		
  4702 
  4288     		}
  4703         }
  4289 	    
  4704 
  4290      else
  4705     else
  4291         {
  4706         {
  4292         OpenFile();
  4707         OpenFile();
  4293     	LogFile.Write(_L8("\n<GetDistance4 test> \n"));
  4708         LogFile.Write(_L8("\n<GetDistance4 test> \n"));
  4294  	    LogFile.Write(_L8("Failed..\n"));
  4709         LogFile.Write(_L8("Failed..\n"));
  4295  	    CloseFile();
  4710         CloseFile();
  4296  	    returnCode = KErrGeneral;	
  4711         returnCode = KErrGeneral;	
  4297         }
  4712         }
  4298     delete CoreObj;
  4713     delete CoreObj;
  4299     
  4714 
  4300     __UHEAP_MARKEND;	
  4715     __UHEAP_MARKEND;	
  4301     
  4716 
  4302     return returnCode;	
  4717     return returnCode;	
  4303 	}
  4718     }
  4304 
  4719 
  4305 
  4720 
  4306 // -----------------------------------------------------------------------------
  4721 // -----------------------------------------------------------------------------
  4307 // CSAPILocTest::GetDistance5
  4722 // CSAPILocTest::GetDistance5
  4308 // -----------------------------------------------------------------------------
  4723 // -----------------------------------------------------------------------------
  4309 //
  4724 //
  4310 TInt CSAPILocTest::GetDistance5( CStifItemParser& /*aItem*/ )
  4725 TInt CSAPILocTest::GetDistance5( CStifItemParser& /*aItem*/ )
  4311     {
  4726     {
  4312     TInt aRet;
  4727     TInt aRet;
  4313   	inpparam aInputParam;
  4728     inpparam aInputParam;
  4314     TTime aCurrentTime;
  4729     TTime aCurrentTime;
  4315     returnCode = KErrNone;
  4730     returnCode = KErrNone;
  4316     
  4731 
  4317     TCoordinate  aCoordinate1(0,0),aCoordinate2(0,0);
  4732     TCoordinate  aCoordinate1(0,0),aCoordinate2(0,0);
  4318 //	TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5);
  4733     //	TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5);
  4319 //	TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime);
  4734     //	TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime);
  4320 	 
  4735 
  4321 		// Print to UI
  4736     // Print to UI
  4322     _LIT( KSAPILocTest, "SAPILocTest" );
  4737     _LIT( KSAPILocTest, "SAPILocTest" );
  4323     _LIT( KExample, "GetDistance5" );
  4738     _LIT( KExample, "GetDistance5" );
  4324     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4739     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4325   
  4740 
  4326    __UHEAP_MARK;
  4741     __UHEAP_MARK;
  4327   
  4742 
  4328    CLocationService *CoreObj = CLocationService :: NewL();
  4743     CLocationService *CoreObj = CLocationService :: NewL();
  4329     
  4744 
  4330     if( NULL == CoreObj)
  4745     if( NULL == CoreObj)
  4331     	{
  4746         {
  4332     	OpenFile();
  4747         OpenFile();
  4333 	    LogFile.Write(_L8("\n<GetDistance5 Test>\n"));
  4748         LogFile.Write(_L8("\n<GetDistance5 Test>\n"));
  4334 	    LogFile.Write(_L8("Failed..\n"));
  4749         LogFile.Write(_L8("Failed..\n"));
  4335 	    CloseFile();
  4750         CloseFile();
  4336    		return KErrGeneral;
  4751         return KErrGeneral;
  4337    		}
  4752         }
  4338     
  4753 
  4339    	
  4754 
  4340     	aInputParam.servicechoice = 0;
  4755     aInputParam.servicechoice = 0;
  4341     	aInputParam.source = aCoordinate1;
  4756     aInputParam.source = aCoordinate1;
  4342     	aInputParam.destination = aCoordinate2;
  4757     aInputParam.destination = aCoordinate2;
  4343     //	aInputParam.source.SetPosition(aPosition1);
  4758     //	aInputParam.source.SetPosition(aPosition1);
  4344     //	aInputParam.destination.SetPosition(aPosition2);
  4759     //	aInputParam.destination.SetPosition(aPosition2);
  4345     	
  4760 
  4346     	aRet = CoreObj->MathOperation(aInputParam);
  4761     aRet = CoreObj->MathOperation(aInputParam);
  4347     	
  4762 
  4348     	if(( KErrNone == aRet ) && (aInputParam.result == 0))
  4763     if(( KErrNone == aRet ) && (aInputParam.result == 0))
  4349     		{
  4764         {
  4350     		OpenFile();
  4765         OpenFile();
  4351 	    	TBuf8<50> buf ;
  4766         TBuf8<50> buf ;
  4352 	 		TRealFormat format; 
  4767         TRealFormat format; 
  4353 	 		LogFile.Write(_L8("\n<GetDistance5 test> \n"));
  4768         LogFile.Write(_L8("\n<GetDistance5 test> \n"));
  4354 	 		buf.Num(aInputParam.result, format) ;
  4769         buf.Num(aInputParam.result, format) ;
  4355 	 		LogFile.Write(_L8("Distance = "));
  4770         LogFile.Write(_L8("Distance = "));
  4356 	 		LogFile.Write(buf) ;
  4771         LogFile.Write(buf) ;
  4357 	 		LogFile.Write(_L8("\n")) ;
  4772         LogFile.Write(_L8("\n")) ;
  4358 	 		CloseFile();
  4773         CloseFile();
  4359 	      	
  4774 
  4360 	      	if( aInputParam.result<0 )
  4775         if( aInputParam.result<0 )
  4361 	      		{
  4776             {
  4362 	      		returnCode = KErrGeneral; 
  4777             returnCode = KErrGeneral; 
  4363 	      		}
  4778             }
  4364 	      	else
  4779         else
  4365 	      		{
  4780             {
  4366 	      		returnCode = KErrNone;  
  4781             returnCode = KErrNone;  
  4367 	      		} 
  4782             } 
  4368     		}
  4783         }
  4369 	   
  4784 
  4370 	    else
  4785     else
  4371         {
  4786         {
  4372         OpenFile();
  4787         OpenFile();
  4373     	LogFile.Write(_L8("\n<GetDistance5 test> \n"));
  4788         LogFile.Write(_L8("\n<GetDistance5 test> \n"));
  4374  	    LogFile.Write(_L8("Failed..\n"));
  4789         LogFile.Write(_L8("Failed..\n"));
  4375  	    CloseFile();
  4790         CloseFile();
  4376  	    returnCode = KErrGeneral;	
  4791         returnCode = KErrGeneral;	
  4377         }
  4792         }
  4378         
  4793 
  4379      delete CoreObj;
  4794     delete CoreObj;
  4380 	  __UHEAP_MARKEND;
  4795     __UHEAP_MARKEND;
  4381  	  return returnCode;  		
  4796     return returnCode;  		
  4382    	 }
  4797     }
  4383 
  4798 
  4384 // -----------------------------------------------------------------------------
  4799 // -----------------------------------------------------------------------------
  4385 // CSAPILocTest::GetDistance6
  4800 // CSAPILocTest::GetDistance6
  4386 // -----------------------------------------------------------------------------
  4801 // -----------------------------------------------------------------------------
  4387 //
  4802 //
  4388 TInt CSAPILocTest::GetDistance6( CStifItemParser& /*aItem*/ )
  4803 TInt CSAPILocTest::GetDistance6( CStifItemParser& /*aItem*/ )
  4389     {
  4804     {
  4390     TInt aRet;
  4805     TInt aRet;
  4391   	inpparam aInputParam;
  4806     inpparam aInputParam;
  4392     TTime aCurrentTime;
  4807     TTime aCurrentTime;
  4393     returnCode = KErrNone;
  4808     returnCode = KErrNone;
  4394     TCoordinate  aCordinate1(80,190),aCordinate2(-80,-210);
  4809     TCoordinate  aCordinate1(80,190),aCordinate2(-80,-210);
  4395 //	TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5);
  4810     //	TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5);
  4396 //	TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime);
  4811     //	TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime);
  4397 	 
  4812 
  4398 		// Print to UI
  4813     // Print to UI
  4399     _LIT( KSAPILocTest, "SAPILocTest" );
  4814     _LIT( KSAPILocTest, "SAPILocTest" );
  4400     _LIT( KExample, "GetDistance6" );
  4815     _LIT( KExample, "GetDistance6" );
  4401     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4816     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4402   
  4817 
  4403     __UHEAP_MARK;
  4818     __UHEAP_MARK;
  4404   
  4819 
  4405     CLocationService *CoreObj = CLocationService :: NewL();
  4820     CLocationService *CoreObj = CLocationService :: NewL();
  4406     
  4821 
  4407     if( NULL == CoreObj)
  4822     if( NULL == CoreObj)
  4408     	{
  4823         {
  4409     	OpenFile();
  4824         OpenFile();
  4410 	    LogFile.Write(_L8("\n<GetDistance6 Test>\n"));
  4825         LogFile.Write(_L8("\n<GetDistance6 Test>\n"));
  4411 	    LogFile.Write(_L8("Failed..\n"));
  4826         LogFile.Write(_L8("Failed..\n"));
  4412 	    CloseFile();
  4827         CloseFile();
  4413    		return KErrGeneral;
  4828         return KErrGeneral;
  4414    		}
  4829         }
  4415     
  4830 
  4416    	
  4831 
  4417     	aInputParam.servicechoice = 0;
  4832     aInputParam.servicechoice = 0;
  4418     	aInputParam.source = aCordinate1;
  4833     aInputParam.source = aCordinate1;
  4419     	aInputParam.destination = aCordinate2;
  4834     aInputParam.destination = aCordinate2;
  4420   //  	aInputParam.source.SetPosition(aPosition1);
  4835     //  	aInputParam.source.SetPosition(aPosition1);
  4421   //  	aInputParam.destination.SetPosition(aPosition2);
  4836     //  	aInputParam.destination.SetPosition(aPosition2);
  4422     	
  4837 
  4423     	aRet = CoreObj->MathOperation(aInputParam);
  4838     aRet = CoreObj->MathOperation(aInputParam);
  4424     	
  4839 
  4425     	if( KErrNone == aRet )
  4840     if( KErrNone == aRet )
  4426     		{
  4841         {
  4427     		OpenFile();
  4842         OpenFile();
  4428 	    	TBuf8<50> buf ;
  4843         TBuf8<50> buf ;
  4429 	 		TRealFormat format; 
  4844         TRealFormat format; 
  4430 	 		LogFile.Write(_L8("\n<GetDistance6 test> \n"));
  4845         LogFile.Write(_L8("\n<GetDistance6 test> \n"));
  4431 	 		buf.Num(aInputParam.result, format) ;
  4846         buf.Num(aInputParam.result, format) ;
  4432 	 		LogFile.Write(_L8("Distance = "));
  4847         LogFile.Write(_L8("Distance = "));
  4433 	 		LogFile.Write(buf) ;
  4848         LogFile.Write(buf) ;
  4434 	 		LogFile.Write(_L8("\n")) ;
  4849         LogFile.Write(_L8("\n")) ;
  4435 	 		CloseFile();
  4850         CloseFile();
  4436       		
  4851 
  4437       		if( aInputParam.result<0 )
  4852         if( aInputParam.result<0 )
  4438 	      		{
  4853             {
  4439 	      		returnCode = KErrGeneral; 
  4854             returnCode = KErrGeneral; 
  4440 	      		}
  4855             }
  4441 	      	else
  4856         else
  4442 	      		{
  4857             {
  4443 	      		returnCode = KErrNone;  
  4858             returnCode = KErrNone;  
  4444 	      		}
  4859             }
  4445     		}
  4860         }
  4446 	    
  4861 
  4447        else
  4862     else
  4448        	{
  4863         {
  4449        	OpenFile();
  4864         OpenFile();
  4450     	LogFile.Write(_L8("\n<GetDistance6 test> \n"));
  4865         LogFile.Write(_L8("\n<GetDistance6 test> \n"));
  4451  	    LogFile.Write(_L8("Failed..\n"));
  4866         LogFile.Write(_L8("Failed..\n"));
  4452  	    CloseFile();
  4867         CloseFile();
  4453  	    returnCode = KErrGeneral;	
  4868         returnCode = KErrGeneral;	
  4454        	} 
  4869         } 
  4455        	
  4870 
  4456    delete CoreObj;
  4871     delete CoreObj;
  4457    __UHEAP_MARKEND; 
  4872     __UHEAP_MARKEND; 
  4458    return returnCode; 		
  4873     return returnCode; 		
  4459    }
  4874     }
  4460 
  4875 
  4461 
  4876 
  4462 // -----------------------------------------------------------------------------
  4877 // -----------------------------------------------------------------------------
  4463 // CSAPILocTest::GetDistance7
  4878 // CSAPILocTest::GetDistance7
  4464 // -----------------------------------------------------------------------------
  4879 // -----------------------------------------------------------------------------
  4465 //
  4880 //
  4466 TInt CSAPILocTest::GetDistance7( CStifItemParser& /*aItem*/ )
  4881 TInt CSAPILocTest::GetDistance7( CStifItemParser& /*aItem*/ )
  4467     {
  4882     {
  4468     TInt aRet;
  4883     TInt aRet;
  4469   	inpparam aInputParam;
  4884     inpparam aInputParam;
  4470     TTime aCurrentTime;
  4885     TTime aCurrentTime;
  4471     returnCode = KErrNone;
  4886     returnCode = KErrNone;
  4472     
  4887 
  4473     TCoordinate  aCordinate1(105,190),aCordinate2(-105,-210);
  4888     TCoordinate  aCordinate1(105,190),aCordinate2(-105,-210);
  4474 //	TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5);
  4889     //	TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5);
  4475 //	TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime);
  4890     //	TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime);
  4476 	 
  4891 
  4477 		// Print to UI
  4892     // Print to UI
  4478     _LIT( KSAPILocTest, "SAPILocTest" );
  4893     _LIT( KSAPILocTest, "SAPILocTest" );
  4479     _LIT( KExample, "GetDistance7" );
  4894     _LIT( KExample, "GetDistance7" );
  4480     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4895     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4481     
  4896 
  4482     __UHEAP_MARK;
  4897     __UHEAP_MARK;
  4483     
  4898 
  4484     CLocationService *CoreObj = CLocationService :: NewL();
  4899     CLocationService *CoreObj = CLocationService :: NewL();
  4485     
  4900 
  4486     if( NULL == CoreObj)
  4901     if( NULL == CoreObj)
  4487     	{
  4902         {
  4488     	OpenFile();
  4903         OpenFile();
  4489 	    LogFile.Write(_L8("\n<GetDistance7 Test>\n"));
  4904         LogFile.Write(_L8("\n<GetDistance7 Test>\n"));
  4490 	    LogFile.Write(_L8("Failed..\n"));
  4905         LogFile.Write(_L8("Failed..\n"));
  4491 	    CloseFile();
  4906         CloseFile();
  4492    		return KErrGeneral;
  4907         return KErrGeneral;
  4493    		}
  4908         }
  4494        	
  4909 
  4495     	aInputParam.servicechoice = 0;
  4910     aInputParam.servicechoice = 0;
  4496     	aInputParam.source = aCordinate1;
  4911     aInputParam.source = aCordinate1;
  4497     	aInputParam.destination = aCordinate2;
  4912     aInputParam.destination = aCordinate2;
  4498 //    	aInputParam.source.SetPosition(aPosition1);
  4913     //    	aInputParam.source.SetPosition(aPosition1);
  4499 //    	aInputParam.destination.SetPosition(aPosition2);
  4914     //    	aInputParam.destination.SetPosition(aPosition2);
  4500     	aRet = CoreObj->MathOperation(aInputParam);
  4915     aRet = CoreObj->MathOperation(aInputParam);
  4501     	
  4916 
  4502     	if( KErrNone == aRet)
  4917     if( KErrNone == aRet)
  4503     		{
  4918         {
  4504     		OpenFile();
  4919         OpenFile();
  4505 	    	TBuf8<50> buf ;
  4920         TBuf8<50> buf ;
  4506 	 		TRealFormat format; 
  4921         TRealFormat format; 
  4507 	 		LogFile.Write(_L8("\n<GetDistance7 test> \n"));
  4922         LogFile.Write(_L8("\n<GetDistance7 test> \n"));
  4508 	 		buf.Num(aInputParam.result, format) ;
  4923         buf.Num(aInputParam.result, format) ;
  4509 	 		LogFile.Write(_L8("Distance = "));
  4924         LogFile.Write(_L8("Distance = "));
  4510 	 		LogFile.Write(buf) ;
  4925         LogFile.Write(buf) ;
  4511 	 		LogFile.Write(_L8("\n")) ;
  4926         LogFile.Write(_L8("\n")) ;
  4512 	 		CloseFile();
  4927         CloseFile();
  4513 	      	
  4928 
  4514 	      	if( aInputParam.result<0 )
  4929         if( aInputParam.result<0 )
  4515 	      		{
  4930             {
  4516 	      		returnCode = KErrGeneral; 
  4931             returnCode = KErrGeneral; 
  4517 	      		}
  4932             }
  4518 	      	else
  4933         else
  4519 	      		{
  4934             {
  4520 	      		returnCode = KErrNone;  
  4935             returnCode = KErrNone;  
  4521 	      		}
  4936             }
  4522     		}
  4937         }
  4523 	    else
  4938     else
  4524         	{
  4939         {
  4525        		OpenFile();
  4940         OpenFile();
  4526 	    	LogFile.Write(_L8("\n<GetDistance7 position returned error> \n"));
  4941         LogFile.Write(_L8("\n<GetDistance7 position returned error> \n"));
  4527 	 	    LogFile.Write(_L8("Failed..\n"));
  4942         LogFile.Write(_L8("Failed..\n"));
  4528 	 	    CloseFile();
  4943         CloseFile();
  4529 	 	    returnCode = KErrGeneral;
  4944         returnCode = KErrGeneral;
  4530 	 	  	}
  4945         }
  4531 	 	  
  4946 
  4532    delete CoreObj;
  4947     delete CoreObj;
  4533    __UHEAP_MARKEND;
  4948     __UHEAP_MARKEND;
  4534    return returnCode;	
  4949     return returnCode;	
  4535    }
  4950     }
  4536 
  4951 
  4537 // -----------------------------------------------------------------------------
  4952 // -----------------------------------------------------------------------------
  4538 // CSAPILocTest::GetDistance8
  4953 // CSAPILocTest::GetDistance8
  4539 // -----------------------------------------------------------------------------
  4954 // -----------------------------------------------------------------------------
  4540 //
  4955 //
  4541 TInt CSAPILocTest::GetDistance8( CStifItemParser& /*aItem*/ )
  4956 TInt CSAPILocTest::GetDistance8( CStifItemParser& /*aItem*/ )
  4542 	{
  4957     {
  4543     TInt aRet;
  4958     TInt aRet;
  4544   	inpparam aInputParam;
  4959     inpparam aInputParam;
  4545     TTime aCurrentTime;
  4960     TTime aCurrentTime;
  4546     returnCode = KErrNone;
  4961     returnCode = KErrNone;
  4547     
  4962 
  4548     TCoordinate  aCordinate1(360,400),aCordinate2(200,480);
  4963     TCoordinate  aCordinate1(360,400),aCordinate2(200,480);
  4549 //	TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5);
  4964     //	TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5);
  4550 //	TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime);
  4965     //	TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime);
  4551 		 
  4966 
  4552 		// Print to UI
  4967     // Print to UI
  4553     _LIT( KSAPILocTest, "SAPILocTest" );
  4968     _LIT( KSAPILocTest, "SAPILocTest" );
  4554     _LIT( KExample, "GetDistance8" );
  4969     _LIT( KExample, "GetDistance8" );
  4555     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4970     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4556    
  4971 
  4557     __UHEAP_MARK;
  4972     __UHEAP_MARK;
  4558    
  4973 
  4559     CLocationService *CoreObj = CLocationService :: NewL();
  4974     CLocationService *CoreObj = CLocationService :: NewL();
  4560     
  4975 
  4561     if( NULL == CoreObj)
  4976     if( NULL == CoreObj)
  4562     	{
  4977         {
  4563     	OpenFile();
  4978         OpenFile();
  4564 	    LogFile.Write(_L8("\n<GetDistance8 Test>\n"));
  4979         LogFile.Write(_L8("\n<GetDistance8 Test>\n"));
  4565 	    LogFile.Write(_L8("Failed..\n"));
  4980         LogFile.Write(_L8("Failed..\n"));
  4566 	    CloseFile();
  4981         CloseFile();
  4567    		return KErrGeneral;
  4982         return KErrGeneral;
  4568    		}
  4983         }
  4569     
  4984 
  4570    	
  4985 
  4571     	aInputParam.servicechoice = 0;
  4986     aInputParam.servicechoice = 0;
  4572     	aInputParam.source = aCordinate1;
  4987     aInputParam.source = aCordinate1;
  4573     	aInputParam.destination = aCordinate2;
  4988     aInputParam.destination = aCordinate2;
  4574 //    	aInputParam.source.SetPosition(aPosition1);
  4989     //    	aInputParam.source.SetPosition(aPosition1);
  4575 //    	aInputParam.destination.SetPosition(aPosition2);
  4990     //    	aInputParam.destination.SetPosition(aPosition2);
  4576     	
  4991 
  4577     	aRet = CoreObj->MathOperation(aInputParam);
  4992     aRet = CoreObj->MathOperation(aInputParam);
  4578     
  4993 
  4579     	if( KErrNone == aRet )
  4994     if( KErrNone == aRet )
  4580     		{
  4995         {
  4581     		OpenFile();
  4996         OpenFile();
  4582 	    	TBuf8<50> buf ;
  4997         TBuf8<50> buf ;
  4583 	 		TRealFormat format; 
  4998         TRealFormat format; 
  4584 	 		LogFile.Write(_L8("\n<GetDistance8 test> \n"));
  4999         LogFile.Write(_L8("\n<GetDistance8 test> \n"));
  4585 	 		buf.Num(aInputParam.result, format) ;
  5000         buf.Num(aInputParam.result, format) ;
  4586 	 		LogFile.Write(_L8("Distance = "));
  5001         LogFile.Write(_L8("Distance = "));
  4587 	 		LogFile.Write(buf) ;
  5002         LogFile.Write(buf) ;
  4588 	 		LogFile.Write(_L8("\n")) ;
  5003         LogFile.Write(_L8("\n")) ;
  4589 	 		CloseFile();
  5004         CloseFile();
  4590 	      	if( aInputParam.result<0 )
  5005         if( aInputParam.result<0 )
  4591 	      		{
  5006             {
  4592 	      		returnCode = KErrGeneral; 
  5007             returnCode = KErrGeneral; 
  4593 	      		}
  5008             }
  4594 	      	else
  5009         else
  4595 	      		{
  5010             {
  4596 	      		returnCode = KErrNone;  
  5011             returnCode = KErrNone;  
  4597 	      		}  
  5012             }  
  4598     		}
  5013         }
  4599 	   	else
  5014     else
  4600 	   		{
  5015         {
  4601 		   	OpenFile();
  5016         OpenFile();
  4602 		   	LogFile.Write(_L8("\n<GetDistance8 test> \n"));
  5017         LogFile.Write(_L8("\n<GetDistance8 test> \n"));
  4603 		   	LogFile.Write(_L8("Failed..\n"));
  5018         LogFile.Write(_L8("Failed..\n"));
  4604             CloseFile();
  5019         CloseFile();
  4605 		    returnCode = KErrGeneral;
  5020         returnCode = KErrGeneral;
  4606 		 	}
  5021         }
  4607 		 	
  5022 
  4608     delete CoreObj;
  5023     delete CoreObj;
  4609  	__UHEAP_MARKEND;
  5024     __UHEAP_MARKEND;
  4610     return returnCode;	
  5025     return returnCode;	
  4611    }
  5026     }
  4612 
  5027 
  4613 // -----------------------------------------------------------------------------
  5028 // -----------------------------------------------------------------------------
  4614 // CSAPILocTest::GetDistance9
  5029 // CSAPILocTest::GetDistance9
  4615 // -----------------------------------------------------------------------------
  5030 // -----------------------------------------------------------------------------
  4616 //
  5031 //
  4617 TInt CSAPILocTest::GetDistance9( CStifItemParser& /*aItem*/ )
  5032 TInt CSAPILocTest::GetDistance9( CStifItemParser& /*aItem*/ )
  4618 	{
  5033     {
  4619     TInt aRet;
  5034     TInt aRet;
  4620   	inpparam aInputParam;
  5035     inpparam aInputParam;
  4621     TTime aCurrentTime;
  5036     TTime aCurrentTime;
  4622     returnCode = KErrNone;
  5037     returnCode = KErrNone;
  4623     TRealX nan;
  5038     TRealX nan;
  4624     nan.SetNaN();
  5039     nan.SetNaN();
  4625     TCoordinate  aCordinate1(nan,170),aCordinate2(70,170);
  5040     TCoordinate  aCordinate1(nan,170),aCordinate2(70,170);
  4626 
  5041 
  4627 	// Print to UI
  5042     // Print to UI
  4628     _LIT( KSAPILocTest, "SAPILocTest" );
  5043     _LIT( KSAPILocTest, "SAPILocTest" );
  4629     _LIT( KExample, "GetDistance9" );
  5044     _LIT( KExample, "GetDistance9" );
  4630     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5045     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4631    
  5046 
  4632     __UHEAP_MARK;
  5047     __UHEAP_MARK;
  4633    
  5048 
  4634     CLocationService *CoreObj = CLocationService :: NewL();
  5049     CLocationService *CoreObj = CLocationService :: NewL();
  4635     
  5050 
  4636     if( NULL == CoreObj)
  5051     if( NULL == CoreObj)
  4637     	{
  5052         {
  4638     	OpenFile();
  5053         OpenFile();
  4639 	    LogFile.Write(_L8("\n<GetDistance9 Test>\n"));
  5054         LogFile.Write(_L8("\n<GetDistance9 Test>\n"));
  4640 	    LogFile.Write(_L8("Failed..\n"));
  5055         LogFile.Write(_L8("Failed..\n"));
  4641 	    CloseFile();
  5056         CloseFile();
  4642    		return KErrGeneral;
  5057         return KErrGeneral;
  4643    		}
  5058         }
  4644     
  5059 
  4645    	
  5060 
  4646     	aInputParam.servicechoice = 0;
  5061     aInputParam.servicechoice = 0;
  4647     	aInputParam.source = aCordinate1;
  5062     aInputParam.source = aCordinate1;
  4648     	aInputParam.destination = aCordinate2;
  5063     aInputParam.destination = aCordinate2;
  4649   		aRet = CoreObj->MathOperation(aInputParam);
  5064     aRet = CoreObj->MathOperation(aInputParam);
  4650     
  5065 
  4651     	if( KErrArgument == aRet )
  5066     if( KErrArgument == aRet )
  4652     		{
  5067         {
  4653     		OpenFile();
  5068         OpenFile();
  4654 	    	LogFile.Write(_L8("\n<GetDistance9 test> \n"));
  5069         LogFile.Write(_L8("\n<GetDistance9 test> \n"));
  4655 	 		LogFile.Write(_L8("Passed..\n")) ;
  5070         LogFile.Write(_L8("Passed..\n")) ;
  4656 	 		CloseFile();
  5071         CloseFile();
  4657 	      	returnCode = KErrNone;  
  5072         returnCode = KErrNone;  
  4658     		}
  5073         }
  4659 	   	else
  5074     else
  4660 	   		{
  5075         {
  4661 		   	OpenFile();
  5076         OpenFile();
  4662 		   	LogFile.Write(_L8("\n<GetDistance9 test> \n"));
  5077         LogFile.Write(_L8("\n<GetDistance9 test> \n"));
  4663 		   	LogFile.Write(_L8("Failed..\n"));
  5078         LogFile.Write(_L8("Failed..\n"));
  4664             CloseFile();
  5079         CloseFile();
  4665 		    returnCode = KErrGeneral;
  5080         returnCode = KErrGeneral;
  4666 		 	}
  5081         }
  4667 		 	
  5082 
  4668     delete CoreObj;
  5083     delete CoreObj;
  4669  	__UHEAP_MARKEND;
  5084     __UHEAP_MARKEND;
  4670     return returnCode;	
  5085     return returnCode;	
  4671    }
  5086     }
  4672 
  5087 
  4673 
  5088 
  4674 // -----------------------------------------------------------------------------
  5089 // -----------------------------------------------------------------------------
  4675 // CSAPILocTest::GetDistance10
  5090 // CSAPILocTest::GetDistance10
  4676 // -----------------------------------------------------------------------------
  5091 // -----------------------------------------------------------------------------
  4677 //
  5092 //
  4678 TInt CSAPILocTest::GetDistance10( CStifItemParser& /*aItem*/ )
  5093 TInt CSAPILocTest::GetDistance10( CStifItemParser& /*aItem*/ )
  4679 	{
  5094     {
  4680     TInt aRet;
  5095     TInt aRet;
  4681   	inpparam aInputParam;
  5096     inpparam aInputParam;
  4682     TTime aCurrentTime;
  5097     TTime aCurrentTime;
  4683     returnCode = KErrNone;
  5098     returnCode = KErrNone;
  4684     TRealX nan;
  5099     TRealX nan;
  4685     nan.SetNaN();
  5100     nan.SetNaN();
  4686     TCoordinate  aCordinate1(30,nan),aCordinate2(70,170);
  5101     TCoordinate  aCordinate1(30,nan),aCordinate2(70,170);
  4687 
  5102 
  4688 	// Print to UI
  5103     // Print to UI
  4689     _LIT( KSAPILocTest, "SAPILocTest" );
  5104     _LIT( KSAPILocTest, "SAPILocTest" );
  4690     _LIT( KExample, "GetDistance10" );
  5105     _LIT( KExample, "GetDistance10" );
  4691     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5106     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4692    
  5107 
  4693     __UHEAP_MARK;
  5108     __UHEAP_MARK;
  4694    
  5109 
  4695     CLocationService *CoreObj = CLocationService :: NewL();
  5110     CLocationService *CoreObj = CLocationService :: NewL();
  4696     
  5111 
  4697     if( NULL == CoreObj)
  5112     if( NULL == CoreObj)
  4698     	{
  5113         {
  4699     	OpenFile();
  5114         OpenFile();
  4700 	    LogFile.Write(_L8("\n<GetDistance10 Test>\n"));
  5115         LogFile.Write(_L8("\n<GetDistance10 Test>\n"));
  4701 	    LogFile.Write(_L8("Failed..\n"));
  5116         LogFile.Write(_L8("Failed..\n"));
  4702 	    CloseFile();
  5117         CloseFile();
  4703    		return KErrGeneral;
  5118         return KErrGeneral;
  4704    		}
  5119         }
  4705     
  5120 
  4706    	
  5121 
  4707     	aInputParam.servicechoice = 0;
  5122     aInputParam.servicechoice = 0;
  4708     	aInputParam.source = aCordinate1;
  5123     aInputParam.source = aCordinate1;
  4709     	aInputParam.destination = aCordinate2;
  5124     aInputParam.destination = aCordinate2;
  4710   		aRet = CoreObj->MathOperation(aInputParam);
  5125     aRet = CoreObj->MathOperation(aInputParam);
  4711     
  5126 
  4712     	if( KErrArgument == aRet )
  5127     if( KErrArgument == aRet )
  4713     		{
  5128         {
  4714     		OpenFile();
  5129         OpenFile();
  4715 	    	LogFile.Write(_L8("\n<GetDistance10 test> \n"));
  5130         LogFile.Write(_L8("\n<GetDistance10 test> \n"));
  4716 	 		LogFile.Write(_L8("Passed..\n")) ;
  5131         LogFile.Write(_L8("Passed..\n")) ;
  4717 	 		CloseFile();
  5132         CloseFile();
  4718 	      	returnCode = KErrNone;  
  5133         returnCode = KErrNone;  
  4719     		}
  5134         }
  4720 	   	else
  5135     else
  4721 	   		{
  5136         {
  4722 		   	OpenFile();
  5137         OpenFile();
  4723 		   	LogFile.Write(_L8("\n<GetDistance10 test> \n"));
  5138         LogFile.Write(_L8("\n<GetDistance10 test> \n"));
  4724 		   	LogFile.Write(_L8("Failed..\n"));
  5139         LogFile.Write(_L8("Failed..\n"));
  4725             CloseFile();
  5140         CloseFile();
  4726 		    returnCode = KErrGeneral;
  5141         returnCode = KErrGeneral;
  4727 		 	}
  5142         }
  4728 		 	
  5143 
  4729    delete CoreObj;
  5144     delete CoreObj;
  4730  	__UHEAP_MARKEND;
  5145     __UHEAP_MARKEND;
  4731     return returnCode;	
  5146     return returnCode;	
  4732    }
  5147     }
  4733 
  5148 
  4734 
  5149 
  4735 // -----------------------------------------------------------------------------
  5150 // -----------------------------------------------------------------------------
  4736 // CSAPILocTest::GetDistance11
  5151 // CSAPILocTest::GetDistance11
  4737 // -----------------------------------------------------------------------------
  5152 // -----------------------------------------------------------------------------
  4738 //
  5153 //
  4739 TInt CSAPILocTest::GetDistance11( CStifItemParser& /*aItem*/ )
  5154 TInt CSAPILocTest::GetDistance11( CStifItemParser& /*aItem*/ )
  4740 	{
  5155     {
  4741     TInt aRet;
  5156     TInt aRet;
  4742   	inpparam aInputParam;
  5157     inpparam aInputParam;
  4743     TTime aCurrentTime;
  5158     TTime aCurrentTime;
  4744     returnCode = KErrNone;
  5159     returnCode = KErrNone;
  4745     TRealX nan;
  5160     TRealX nan;
  4746     nan.SetNaN();
  5161     nan.SetNaN();
  4747     TCoordinate  aCordinate1(30,110),aCordinate2(nan,170);
  5162     TCoordinate  aCordinate1(30,110),aCordinate2(nan,170);
  4748 
  5163 
  4749 	// Print to UI
  5164     // Print to UI
  4750     _LIT( KSAPILocTest, "SAPILocTest" );
  5165     _LIT( KSAPILocTest, "SAPILocTest" );
  4751     _LIT( KExample, "GetDistance11" );
  5166     _LIT( KExample, "GetDistance11" );
  4752     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5167     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4753    
  5168 
  4754     __UHEAP_MARK;
  5169     __UHEAP_MARK;
  4755    
  5170 
  4756     CLocationService *CoreObj = CLocationService :: NewL();
  5171     CLocationService *CoreObj = CLocationService :: NewL();
  4757     
  5172 
  4758     if( NULL == CoreObj)
  5173     if( NULL == CoreObj)
  4759     	{
  5174         {
  4760     	OpenFile();
  5175         OpenFile();
  4761 	    LogFile.Write(_L8("\n<GetDistance11 Test>\n"));
  5176         LogFile.Write(_L8("\n<GetDistance11 Test>\n"));
  4762 	    LogFile.Write(_L8("Failed..\n"));
  5177         LogFile.Write(_L8("Failed..\n"));
  4763 	    CloseFile();
  5178         CloseFile();
  4764    		return KErrGeneral;
  5179         return KErrGeneral;
  4765    		}
  5180         }
  4766     
  5181 
  4767    	
  5182 
  4768 	aInputParam.servicechoice = 0;
  5183     aInputParam.servicechoice = 0;
  4769 	aInputParam.source = aCordinate1;
  5184     aInputParam.source = aCordinate1;
  4770 	aInputParam.destination = aCordinate2;
  5185     aInputParam.destination = aCordinate2;
  4771 	aRet = CoreObj->MathOperation(aInputParam);
  5186     aRet = CoreObj->MathOperation(aInputParam);
  4772 
  5187 
  4773 	if( KErrArgument == aRet )
  5188     if( KErrArgument == aRet )
  4774 		{
  5189         {
  4775 		OpenFile();
  5190         OpenFile();
  4776     	LogFile.Write(_L8("\n<GetDistance11 test> \n"));
  5191         LogFile.Write(_L8("\n<GetDistance11 test> \n"));
  4777  		LogFile.Write(_L8("Passed..\n")) ;
  5192         LogFile.Write(_L8("Passed..\n")) ;
  4778  		CloseFile();
  5193         CloseFile();
  4779       	returnCode = KErrNone;  
  5194         returnCode = KErrNone;  
  4780 		}
  5195         }
  4781    	else
  5196     else
  4782    		{
  5197         {
  4783 	   	OpenFile();
  5198         OpenFile();
  4784 	   	LogFile.Write(_L8("\n<GetDistance11 test> \n"));
  5199         LogFile.Write(_L8("\n<GetDistance11 test> \n"));
  4785 	   	LogFile.Write(_L8("Failed..\n"));
  5200         LogFile.Write(_L8("Failed..\n"));
  4786         CloseFile();
  5201         CloseFile();
  4787 	    returnCode = KErrGeneral;
  5202         returnCode = KErrGeneral;
  4788 	 	}
  5203         }
  4789 		 	
  5204 
  4790     delete CoreObj;
  5205     delete CoreObj;
  4791  	__UHEAP_MARKEND;
  5206     __UHEAP_MARKEND;
  4792     return returnCode;	
  5207     return returnCode;	
  4793    }
  5208     }
  4794 
  5209 
  4795 
  5210 
  4796 // -----------------------------------------------------------------------------
  5211 // -----------------------------------------------------------------------------
  4797 // CSAPILocTest::GetDistance12
  5212 // CSAPILocTest::GetDistance12
  4798 // -----------------------------------------------------------------------------
  5213 // -----------------------------------------------------------------------------
  4799 //
  5214 //
  4800 TInt CSAPILocTest::GetDistance12( CStifItemParser& /*aItem*/ )
  5215 TInt CSAPILocTest::GetDistance12( CStifItemParser& /*aItem*/ )
  4801 	{
  5216     {
  4802     TInt aRet;
  5217     TInt aRet;
  4803   	inpparam aInputParam;
  5218     inpparam aInputParam;
  4804     TTime aCurrentTime;
  5219     TTime aCurrentTime;
  4805     returnCode = KErrNone;
  5220     returnCode = KErrNone;
  4806     TRealX nan;
  5221     TRealX nan;
  4807     nan.SetNaN();
  5222     nan.SetNaN();
  4808     TCoordinate  aCordinate1(30,110),aCordinate2(40,nan);
  5223     TCoordinate  aCordinate1(30,110),aCordinate2(40,nan);
  4809 
  5224 
  4810 	// Print to UI
  5225     // Print to UI
  4811     _LIT( KSAPILocTest, "SAPILocTest" );
  5226     _LIT( KSAPILocTest, "SAPILocTest" );
  4812     _LIT( KExample, "GetDistance12" );
  5227     _LIT( KExample, "GetDistance12" );
  4813     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5228     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4814    
  5229 
  4815     __UHEAP_MARK;
  5230     __UHEAP_MARK;
  4816    
  5231 
  4817     CLocationService *CoreObj = CLocationService :: NewL();
  5232     CLocationService *CoreObj = CLocationService :: NewL();
  4818     
  5233 
  4819     if( NULL == CoreObj)
  5234     if( NULL == CoreObj)
  4820     	{
  5235         {
  4821     	OpenFile();
  5236         OpenFile();
  4822 	    LogFile.Write(_L8("\n<GetDistance12 Test>\n"));
  5237         LogFile.Write(_L8("\n<GetDistance12 Test>\n"));
  4823 	    LogFile.Write(_L8("Failed..\n"));
  5238         LogFile.Write(_L8("Failed..\n"));
  4824 	    CloseFile();
  5239         CloseFile();
  4825    		return KErrGeneral;
  5240         return KErrGeneral;
  4826    		}
  5241         }
  4827     
  5242 
  4828    	
  5243 
  4829 	aInputParam.servicechoice = 0;
  5244     aInputParam.servicechoice = 0;
  4830 	aInputParam.source = aCordinate1;
  5245     aInputParam.source = aCordinate1;
  4831 	aInputParam.destination = aCordinate2;
  5246     aInputParam.destination = aCordinate2;
  4832 	aRet = CoreObj->MathOperation(aInputParam);
  5247     aRet = CoreObj->MathOperation(aInputParam);
  4833 
  5248 
  4834 	if( KErrArgument == aRet )
  5249     if( KErrArgument == aRet )
  4835 		{
  5250         {
  4836 		OpenFile();
  5251         OpenFile();
  4837     	LogFile.Write(_L8("\n<GetDistance12 test> \n"));
  5252         LogFile.Write(_L8("\n<GetDistance12 test> \n"));
  4838  		LogFile.Write(_L8("Passed..\n")) ;
  5253         LogFile.Write(_L8("Passed..\n")) ;
  4839  		CloseFile();
  5254         CloseFile();
  4840       	returnCode = KErrNone;  
  5255         returnCode = KErrNone;  
  4841 		}
  5256         }
  4842    	else
  5257     else
  4843    		{
  5258         {
  4844 	   	OpenFile();
  5259         OpenFile();
  4845 	   	LogFile.Write(_L8("\n<GetDistance12 test> \n"));
  5260         LogFile.Write(_L8("\n<GetDistance12 test> \n"));
  4846 	   	LogFile.Write(_L8("Failed..\n"));
  5261         LogFile.Write(_L8("Failed..\n"));
  4847         CloseFile();
  5262         CloseFile();
  4848 	    returnCode = KErrGeneral;
  5263         returnCode = KErrGeneral;
  4849 	 	}
  5264         }
  4850 		 	
  5265 
  4851     delete CoreObj;
  5266     delete CoreObj;
  4852  	__UHEAP_MARKEND;
  5267     __UHEAP_MARKEND;
  4853     return returnCode;	
  5268     return returnCode;	
  4854    }
  5269     }
  4855 
  5270 
  4856 // -----------------------------------------------------------------------------
  5271 // -----------------------------------------------------------------------------
  4857 // CSAPILocTest::GetBearing
  5272 // CSAPILocTest::GetBearing
  4858 // -----------------------------------------------------------------------------
  5273 // -----------------------------------------------------------------------------
  4859 //
  5274 //
  4860 TInt CSAPILocTest::GetBearing( CStifItemParser& /*aItem*/ )
  5275 TInt CSAPILocTest::GetBearing( CStifItemParser& /*aItem*/ )
  4861 	{
  5276     {
  4862     TInt aRet;
  5277     TInt aRet;
  4863   	inpparam aInputParam;
  5278     inpparam aInputParam;
  4864     TTime aCurrentTime;
  5279     TTime aCurrentTime;
  4865     returnCode = KErrNone;
  5280     returnCode = KErrNone;
  4866     
  5281 
  4867 	// Print to UI
  5282     // Print to UI
  4868     _LIT( KSAPILocTest, "SAPILocTest" );
  5283     _LIT( KSAPILocTest, "SAPILocTest" );
  4869     _LIT( KExample, "GetBearing" );
  5284     _LIT( KExample, "GetBearing" );
  4870     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5285     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4871    
  5286 
  4872     __UHEAP_MARK;
  5287     __UHEAP_MARK;
  4873    
  5288 
  4874     CLocationService *CoreObj = CLocationService :: NewL();
  5289     CLocationService *CoreObj = CLocationService :: NewL();
  4875     
  5290 
  4876     if( NULL == CoreObj)
  5291     if( NULL == CoreObj)
  4877     	{
  5292         {
  4878     	OpenFile();
  5293         OpenFile();
  4879 	    LogFile.Write(_L8("\n<GetBearing Test>\n"));
  5294         LogFile.Write(_L8("\n<GetBearing Test>\n"));
  4880 	    LogFile.Write(_L8("Failed..\n"));
  5295         LogFile.Write(_L8("Failed..\n"));
  4881 	    CloseFile();
  5296         CloseFile();
  4882    		return KErrGeneral;
  5297         return KErrGeneral;
  4883    		}
  5298         }
  4884     
  5299 
  4885    	
  5300 
  4886 	aInputParam.servicechoice = 1;
  5301     aInputParam.servicechoice = 1;
  4887 	aRet = CoreObj->MathOperation(aInputParam);
  5302     aRet = CoreObj->MathOperation(aInputParam);
  4888 
  5303 
  4889 	if( KErrArgument == aRet )
  5304     if( KErrArgument == aRet )
  4890 		{
  5305         {
  4891 		OpenFile();
  5306         OpenFile();
  4892     	LogFile.Write(_L8("\n<GetBearing test> \n"));
  5307         LogFile.Write(_L8("\n<GetBearing test> \n"));
  4893  		LogFile.Write(_L8("Passed..\n")) ;
  5308         LogFile.Write(_L8("Passed..\n")) ;
  4894  		CloseFile();
  5309         CloseFile();
  4895       	returnCode = KErrNone;  
  5310         returnCode = KErrNone;  
  4896 		}
  5311         }
  4897    	else
  5312     else
  4898    		{
  5313         {
  4899 	   	OpenFile();
  5314         OpenFile();
  4900 	   	LogFile.Write(_L8("\n<GetBearing test> \n"));
  5315         LogFile.Write(_L8("\n<GetBearing test> \n"));
  4901 	   	LogFile.Write(_L8("Failed..\n"));
  5316         LogFile.Write(_L8("Failed..\n"));
  4902         CloseFile();
  5317         CloseFile();
  4903 	    returnCode = KErrGeneral;
  5318         returnCode = KErrGeneral;
  4904 	 	}
  5319         }
  4905 		 	
  5320 
  4906     delete CoreObj;
  5321     delete CoreObj;
  4907  	__UHEAP_MARKEND;
  5322     __UHEAP_MARKEND;
  4908     return returnCode;	
  5323     return returnCode;	
  4909    }
  5324     }
  4910 
  5325 
  4911 
  5326 
  4912 // -----------------------------------------------------------------------------
  5327 // -----------------------------------------------------------------------------
  4913 // CSAPILocTest::GetBearing1
  5328 // CSAPILocTest::GetBearing1
  4914 // -----------------------------------------------------------------------------
  5329 // -----------------------------------------------------------------------------
  4915 //
  5330 //
  4916 TInt CSAPILocTest::GetBearing1( CStifItemParser& /*aItem*/ )
  5331 TInt CSAPILocTest::GetBearing1( CStifItemParser& /*aItem*/ )
  4917 	{
  5332     {
  4918     TInt ret[2],aRet;
  5333     TInt ret[2],aRet;
  4919   	TPositionInfo currPos[2];
  5334     TPositionInfo currPos[2];
  4920   	TPosition currPos1[2];
  5335     TPosition currPos1[2];
  4921   	inpparam aInputParam;
  5336     inpparam aInputParam;
  4922     TReal64 aLatitude1,aLatitude2;
  5337     TReal64 aLatitude1,aLatitude2;
  4923 	TReal64 aLongitude1,aLongitude2;
  5338     TReal64 aLongitude1,aLongitude2;
  4924 	TReal32 aAltitude1,aAltitude2; 
  5339     TReal32 aAltitude1,aAltitude2; 
  4925   	returnCode = KErrNone;
  5340     returnCode = KErrNone;
  4926     
  5341 
  4927 	// Print to UI
  5342     // Print to UI
  4928     _LIT( KSAPILocTest, "SAPILocTest" );
  5343     _LIT( KSAPILocTest, "SAPILocTest" );
  4929     _LIT( KExample, "GetBearing1" );
  5344     _LIT( KExample, "GetBearing1" );
  4930     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5345     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  4931    
  5346 
  4932     __UHEAP_MARK;
  5347     __UHEAP_MARK;
  4933     
  5348 
  4934     CLocationService *CoreObj = CLocationService :: NewL();
  5349     CLocationService *CoreObj = CLocationService :: NewL();
  4935     
  5350 
  4936     if( NULL == CoreObj)
  5351     if( NULL == CoreObj)
  4937     	{
  5352         {
  4938     	OpenFile();
  5353         OpenFile();
  4939 	    LogFile.Write(_L8("\n<GetBearing1 Test>\n"));
  5354         LogFile.Write(_L8("\n<GetBearing1 Test>\n"));
  4940 	    LogFile.Write(_L8("Failed..\n"));
  5355         LogFile.Write(_L8("Failed..\n"));
  4941 	    CloseFile();
  5356         CloseFile();
  4942    		return KErrGeneral;
  5357         return KErrGeneral;
  4943    		}
  5358         }
  4944     
  5359 
  4945     _LIT(Kidentity ,"Coreclass Testing" ) ;
  5360     _LIT(Kidentity ,"Coreclass Testing" ) ;
  4946 	//not needed any more
  5361     //not needed any more
  4947 	/*RRequestorStack aRequestorStack;
  5362     /*RRequestorStack aRequestorStack;
  4948 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  5363 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  4949     aRequestorStack.Insert(identityInfo,0);
  5364     aRequestorStack.Insert(identityInfo,0);
  4950     
  5365 
  4951     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  5366     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  4952     
  5367 
  4953    /* for( TInt i=0;i<2;i++)
  5368     /* for( TInt i=0;i<2;i++)
  4954     	{
  5369     	{
  4955       ret[i] = CoreObj->GetLocationL(&currPos[i]);
  5370       ret[i] = CoreObj->GetLocationL(&currPos[i]);
  4956     	}
  5371     	}
  4957    */
  5372      */
  4958     
  5373 
  4959     ret[0] = CoreObj->GetLocationL(&currPos[0]) ;
  5374     TRAP(ret[0] , CoreObj->GetLocationL(&currPos[0]) );
  4960     
  5375 
  4961     User::After(30000000) ;
  5376     //User::After(30000000) ;
  4962     
  5377 
  4963     ret[1] = CoreObj->GetLocationL(&currPos[1]) ;
  5378     TRAP(ret[1] , CoreObj->GetLocationL(&currPos[1]) );
  4964     
  5379 
  4965     if( !ret[0] && !ret[1])
  5380     if( !ret[0] && !ret[1])
  4966     	{
  5381         {
  4967     	aInputParam.servicechoice = 1;
  5382         aInputParam.servicechoice = 1;
  4968     	currPos[0].GetPosition(currPos1[0]);
  5383         currPos[0].GetPosition(currPos1[0]);
  4969     	currPos[1].GetPosition(currPos1[1]);
  5384         currPos[1].GetPosition(currPos1[1]);
  4970     	aLatitude1  = currPos1[0].Latitude();
  5385         aLatitude1  = currPos1[0].Latitude();
  4971 		aLongitude1 = currPos1[0].Longitude() ;
  5386         aLongitude1 = currPos1[0].Longitude() ;
  4972 		//aAltitude1  = currPos1[0].Altitude() ;
  5387         //aAltitude1  = currPos1[0].Altitude() ;
  4973 		//aAltitude1  = NaN;
  5388         //aAltitude1  = NaN;
  4974 	   	aLatitude2  = currPos1[1].Latitude();
  5389         aLatitude2  = currPos1[1].Latitude();
  4975 		aLongitude2 = currPos1[1].Longitude() ;
  5390         aLongitude2 = currPos1[1].Longitude() ;
  4976 		//aAltitude2  = currPos1[1].Altitude() ;
  5391         //aAltitude2  = currPos1[1].Altitude() ;
  4977 		
  5392 
  4978     	aInputParam.source.SetCoordinate(aLatitude1,aLongitude1/*,aAltitude1*/);
  5393         aInputParam.source.SetCoordinate(aLatitude1,aLongitude1/*,aAltitude1*/);
  4979     	aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2/*,aAltitude2*/);
  5394         aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2/*,aAltitude2*/);
  4980     	
  5395 
  4981     	aRet = CoreObj->MathOperation(aInputParam);
  5396         aRet = CoreObj->MathOperation(aInputParam);
  4982     	
  5397 
  4983     	if(KErrNone == aRet)
  5398         if(KErrNone == aRet)
  4984     		{
  5399             {
  4985     		OpenFile();
  5400             OpenFile();
  4986 	    	TBuf8<50> buf ;
  5401             TBuf8<50> buf ;
  4987 	 		TRealFormat format; 
  5402             TRealFormat format; 
  4988 	 		LogFile.Write(_L8("\n<GetBearing1 test> \n"));
  5403             LogFile.Write(_L8("\n<GetBearing1 test> \n"));
  4989 	 		buf.Num(aInputParam.result, format) ;
  5404             buf.Num(aInputParam.result, format) ;
  4990 	 		LogFile.Write(_L8("Bearing = "));
  5405             LogFile.Write(_L8("Bearing = "));
  4991 	 		LogFile.Write(buf) ;
  5406             LogFile.Write(buf) ;
  4992 	 		LogFile.Write(_L8("\n")) ;
  5407             LogFile.Write(_L8("\n")) ;
  4993 	 		CloseFile();
  5408             CloseFile();
  4994 	      	returnCode = KErrNone;  
  5409             returnCode = KErrNone;  
  4995     		}
  5410             }
  4996     	else if(aRet == KErrPositionIncalculable )
  5411         else if(aRet == KErrPositionIncalculable )
  4997 	    	{
  5412             {
  4998 	    	CloseFile();
  5413             CloseFile();
  4999 	      	returnCode = KErrNone; 
  5414             returnCode = KErrNone; 
  5000 	    		
  5415 
  5001 	    	}
  5416             }
  5002 	    else
  5417         else
  5003        		{
  5418             {
  5004    			OpenFile();
  5419             OpenFile();
  5005      		LogFile.Write(_L8("\n<GetBearing1 test> \n"));
  5420             LogFile.Write(_L8("\n<GetBearing1 test> \n"));
  5006  		 	LogFile.Write(_L8("Failed @ math op..\n"));
  5421             LogFile.Write(_L8("Failed @ math op..\n"));
  5007  		 	CloseFile();
  5422             CloseFile();
  5008  		 	returnCode = KErrGeneral;
  5423             returnCode = KErrGeneral;
  5009        		}
  5424             }
  5010     	}
  5425         }
  5011     else
  5426     else
  5012     	{
  5427         {
  5013     	OpenFile();
  5428         OpenFile();
  5014     	LogFile.Write(_L8("\n<GetBearing1 test> \n"));
  5429         LogFile.Write(_L8("\n<GetBearing1 test> \n"));
  5015  	    LogFile.Write(_L8("Failed * coreob..\n"));
  5430         LogFile.Write(_L8("Failed * coreob..\n"));
  5016  	    CloseFile();
  5431         CloseFile();
  5017  	    returnCode = KErrGeneral;	
  5432         returnCode = KErrGeneral;	
  5018     	}
  5433         }
  5019     
  5434 
  5020    
  5435 
  5021    delete CoreObj;
  5436     delete CoreObj;
  5022    __UHEAP_MARKEND;
  5437     __UHEAP_MARKEND;
  5023    return returnCode;
  5438     return returnCode;
  5024    }
  5439     }
  5025 
  5440 
  5026 
  5441 
  5027 // -----------------------------------------------------------------------------
  5442 // -----------------------------------------------------------------------------
  5028 // CSAPILocTest::GetBearing2
  5443 // CSAPILocTest::GetBearing2
  5029 // -----------------------------------------------------------------------------
  5444 // -----------------------------------------------------------------------------
  5030 //
  5445 //
  5031 TInt CSAPILocTest::GetBearing2( CStifItemParser& /*aItem*/ )
  5446 TInt CSAPILocTest::GetBearing2( CStifItemParser& /*aItem*/ )
  5032     {
  5447     {
  5033     TInt aRet;
  5448     TInt aRet;
  5034   	inpparam aInputParam;
  5449     inpparam aInputParam;
  5035     returnCode = KErrNone;
  5450     returnCode = KErrNone;
  5036     
  5451 
  5037     TCoordinate  aCordinate1(90,90),aCordinate2(90,90);
  5452     TCoordinate  aCordinate1(90,90),aCordinate2(90,90);
  5038 
  5453 
  5039 	// Print to UI
  5454     // Print to UI
  5040     _LIT( KSAPILocTest, "SAPILocTest" );
  5455     _LIT( KSAPILocTest, "SAPILocTest" );
  5041     _LIT( KExample, "GetBearing2" );
  5456     _LIT( KExample, "GetBearing2" );
  5042     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5457     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5043     
  5458 
  5044     __UHEAP_MARK;
  5459     __UHEAP_MARK;
  5045     
  5460 
  5046     CLocationService *CoreObj = CLocationService :: NewL();
  5461     CLocationService *CoreObj = CLocationService :: NewL();
  5047     
  5462 
  5048     if( NULL == CoreObj)
  5463     if( NULL == CoreObj)
  5049     	{
  5464         {
  5050     	OpenFile();
  5465         OpenFile();
  5051 	    LogFile.Write(_L8("\n<GetBearing2 Test>\n"));
  5466         LogFile.Write(_L8("\n<GetBearing2 Test>\n"));
  5052 	    LogFile.Write(_L8("Failed..\n"));
  5467         LogFile.Write(_L8("Failed..\n"));
  5053 	    CloseFile();
  5468         CloseFile();
  5054    		return KErrGeneral;
  5469         return KErrGeneral;
  5055    		}
  5470         }
  5056        	
  5471 
  5057 	aInputParam.servicechoice = 1;
  5472     aInputParam.servicechoice = 1;
  5058 	aInputParam.source = aCordinate1;
  5473     aInputParam.source = aCordinate1;
  5059 	aInputParam.destination = aCordinate2;
  5474     aInputParam.destination = aCordinate2;
  5060 
  5475 
  5061 	aRet = CoreObj->MathOperation(aInputParam);
  5476     aRet = CoreObj->MathOperation(aInputParam);
  5062 	
  5477 
  5063 	if(KErrPositionIncalculable == aRet)
  5478     if(KErrPositionIncalculable == aRet)
  5064 		{
  5479         {
  5065 		OpenFile();
  5480         OpenFile();
  5066     	TBuf8<50> buf ;
  5481         TBuf8<50> buf ;
  5067  		TRealFormat format; 
  5482         TRealFormat format; 
  5068  		LogFile.Write(_L8("\n<GetBearing2 test> \n"));
  5483         LogFile.Write(_L8("\n<GetBearing2 test> \n"));
  5069  		LogFile.Write(_L8("Passed..\n"));
  5484         LogFile.Write(_L8("Passed..\n"));
  5070  		CloseFile();
  5485         CloseFile();
  5071         returnCode = KErrNone;  
  5486         returnCode = KErrNone;  
  5072 		}
  5487         }
  5073     else
  5488     else
  5074    		{
  5489         {
  5075 		OpenFile();
  5490         OpenFile();
  5076  		LogFile.Write(_L8("\n<GetBearing2 test> \n"));
  5491         LogFile.Write(_L8("\n<GetBearing2 test> \n"));
  5077 	 	LogFile.Write(_L8("Failed..\n"));
  5492         LogFile.Write(_L8("Failed..\n"));
  5078 	 	CloseFile();
  5493         CloseFile();
  5079 	 	returnCode = KErrGeneral;
  5494         returnCode = KErrGeneral;
  5080    		}
  5495         }
  5081    delete CoreObj;
  5496     delete CoreObj;
  5082    __UHEAP_MARKEND;
  5497     __UHEAP_MARKEND;
  5083    return returnCode;	
  5498     return returnCode;	
  5084    }
  5499     }
  5085 
  5500 
  5086 
  5501 
  5087 // -----------------------------------------------------------------------------
  5502 // -----------------------------------------------------------------------------
  5088 // CSAPILocTest::GetBearing3
  5503 // CSAPILocTest::GetBearing3
  5089 // -----------------------------------------------------------------------------
  5504 // -----------------------------------------------------------------------------
  5090 //
  5505 //
  5091 TInt CSAPILocTest::GetBearing3( CStifItemParser& /*aItem*/ )
  5506 TInt CSAPILocTest::GetBearing3( CStifItemParser& /*aItem*/ )
  5092     {
  5507     {
  5093     TInt aRet;
  5508     TInt aRet;
  5094   	inpparam aInputParam;
  5509     inpparam aInputParam;
  5095     returnCode = KErrNone;
  5510     returnCode = KErrNone;
  5096     
  5511 
  5097     TCoordinate  aCordinate1(0,0),aCordinate2(0,0);
  5512     TCoordinate  aCordinate1(0,0),aCordinate2(0,0);
  5098 
  5513 
  5099 	// Print to UI
  5514     // Print to UI
  5100     _LIT( KSAPILocTest, "SAPILocTest" );
  5515     _LIT( KSAPILocTest, "SAPILocTest" );
  5101     _LIT( KExample, "GetBearing3" );
  5516     _LIT( KExample, "GetBearing3" );
  5102     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5517     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5103     
  5518 
  5104     __UHEAP_MARK;
  5519     __UHEAP_MARK;
  5105     
  5520 
  5106     CLocationService *CoreObj = CLocationService :: NewL();
  5521     CLocationService *CoreObj = CLocationService :: NewL();
  5107     
  5522 
  5108     if( NULL == CoreObj)
  5523     if( NULL == CoreObj)
  5109     	{
  5524         {
  5110     	OpenFile();
  5525         OpenFile();
  5111 	    LogFile.Write(_L8("\n<GetBearing3 Test>\n"));
  5526         LogFile.Write(_L8("\n<GetBearing3 Test>\n"));
  5112 	    LogFile.Write(_L8("Failed..\n"));
  5527         LogFile.Write(_L8("Failed..\n"));
  5113 	    CloseFile();
  5528         CloseFile();
  5114    		return KErrGeneral;
  5529         return KErrGeneral;
  5115    		}
  5530         }
  5116        	
  5531 
  5117 	aInputParam.servicechoice = 1;
  5532     aInputParam.servicechoice = 1;
  5118 	aInputParam.source = aCordinate1;
  5533     aInputParam.source = aCordinate1;
  5119 	aInputParam.destination = aCordinate2;
  5534     aInputParam.destination = aCordinate2;
  5120 
  5535 
  5121 	aRet = CoreObj->MathOperation(aInputParam);
  5536     aRet = CoreObj->MathOperation(aInputParam);
  5122 	
  5537 
  5123 	if(KErrPositionIncalculable == aRet )
  5538     if(KErrPositionIncalculable == aRet )
  5124 		{
  5539         {
  5125 		OpenFile();
  5540         OpenFile();
  5126     	TBuf8<50> buf ;
  5541         TBuf8<50> buf ;
  5127  		TRealFormat format; 
  5542         TRealFormat format; 
  5128  		LogFile.Write(_L8("\n<GetBearing3 test> \n"));
  5543         LogFile.Write(_L8("\n<GetBearing3 test> \n"));
  5129  		LogFile.Write(_L8("Passed..\n"));
  5544         LogFile.Write(_L8("Passed..\n"));
  5130  		CloseFile();
  5545         CloseFile();
  5131         returnCode = KErrNone;  
  5546         returnCode = KErrNone;  
  5132 		}
  5547         }
  5133    	else
  5548     else
  5134    		{
  5549         {
  5135 	   	OpenFile();
  5550         OpenFile();
  5136 	   	LogFile.Write(_L8("\n<GetBearing3 test> \n"));
  5551         LogFile.Write(_L8("\n<GetBearing3 test> \n"));
  5137 	   	LogFile.Write(_L8("Failed..\n"));
  5552         LogFile.Write(_L8("Failed..\n"));
  5138         CloseFile();
  5553         CloseFile();
  5139 	    returnCode = KErrGeneral;
  5554         returnCode = KErrGeneral;
  5140 	 	}
  5555         }
  5141    delete CoreObj;
  5556     delete CoreObj;
  5142    __UHEAP_MARKEND;
  5557     __UHEAP_MARKEND;
  5143    return returnCode;	
  5558     return returnCode;	
  5144    }
  5559     }
  5145 
  5560 
  5146 
  5561 
  5147 // -----------------------------------------------------------------------------
  5562 // -----------------------------------------------------------------------------
  5148 // CSAPILocTest::GetBearing4
  5563 // CSAPILocTest::GetBearing4
  5149 // -----------------------------------------------------------------------------
  5564 // -----------------------------------------------------------------------------
  5150 //
  5565 //
  5151 TInt CSAPILocTest::GetBearing4( CStifItemParser& /*aItem*/ )
  5566 TInt CSAPILocTest::GetBearing4( CStifItemParser& /*aItem*/ )
  5152     {
  5567     {
  5153     TInt aRet;
  5568     TInt aRet;
  5154   	inpparam aInputParam;
  5569     inpparam aInputParam;
  5155     returnCode = KErrNone;
  5570     returnCode = KErrNone;
  5156     
  5571 
  5157     TCoordinate  aCordinate1(40,90),aCordinate2(30,120);
  5572     TCoordinate  aCordinate1(40,90),aCordinate2(30,120);
  5158 
  5573 
  5159 	// Print to UI
  5574     // Print to UI
  5160     _LIT( KSAPILocTest, "SAPILocTest" );
  5575     _LIT( KSAPILocTest, "SAPILocTest" );
  5161     _LIT( KExample, "GetBearing4" );
  5576     _LIT( KExample, "GetBearing4" );
  5162     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5577     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5163     
  5578 
  5164     __UHEAP_MARK;
  5579     __UHEAP_MARK;
  5165     
  5580 
  5166     CLocationService *CoreObj = CLocationService :: NewL();
  5581     CLocationService *CoreObj = CLocationService :: NewL();
  5167     
  5582 
  5168     if( NULL == CoreObj)
  5583     if( NULL == CoreObj)
  5169     	{
  5584         {
  5170     	OpenFile();
  5585         OpenFile();
  5171 	    LogFile.Write(_L8("\n<GetBearing4 Test>\n"));
  5586         LogFile.Write(_L8("\n<GetBearing4 Test>\n"));
  5172 	    LogFile.Write(_L8("Failed..\n"));
  5587         LogFile.Write(_L8("Failed..\n"));
  5173 	    CloseFile();
  5588         CloseFile();
  5174    		return KErrGeneral;
  5589         return KErrGeneral;
  5175    		}
  5590         }
  5176        	
  5591 
  5177 	aInputParam.servicechoice = 1;
  5592     aInputParam.servicechoice = 1;
  5178 	aInputParam.source = aCordinate1;
  5593     aInputParam.source = aCordinate1;
  5179 	aInputParam.destination = aCordinate2;
  5594     aInputParam.destination = aCordinate2;
  5180 
  5595 
  5181 	aRet = CoreObj->MathOperation(aInputParam);
  5596     aRet = CoreObj->MathOperation(aInputParam);
  5182 	
  5597 
  5183 	if( KErrNone == aRet )
  5598     if( KErrNone == aRet )
  5184 		{
  5599         {
  5185 		OpenFile();
  5600         OpenFile();
  5186     	TBuf8<50> buf ;
  5601         TBuf8<50> buf ;
  5187  		TRealFormat format; 
  5602         TRealFormat format; 
  5188  		LogFile.Write(_L8("\n<GetBearing4 test> \n"));
  5603         LogFile.Write(_L8("\n<GetBearing4 test> \n"));
  5189  		buf.Num(aInputParam.result, format) ;
  5604         buf.Num(aInputParam.result, format) ;
  5190  		LogFile.Write(_L8("Bearing = "));
  5605         LogFile.Write(_L8("Bearing = "));
  5191  		LogFile.Write(buf) ;
  5606         LogFile.Write(buf) ;
  5192  		LogFile.Write(_L8("\n")) ;
  5607         LogFile.Write(_L8("\n")) ;
  5193  		CloseFile();
  5608         CloseFile();
  5194       	returnCode = KErrNone;  
  5609         returnCode = KErrNone;  
  5195 		}
  5610         }
  5196    	else
  5611     else
  5197    		{
  5612         {
  5198 	   	OpenFile();
  5613         OpenFile();
  5199 	   	LogFile.Write(_L8("\n<GetBearing4 test> \n"));
  5614         LogFile.Write(_L8("\n<GetBearing4 test> \n"));
  5200 	   	LogFile.Write(_L8("Failed..\n"));
  5615         LogFile.Write(_L8("Failed..\n"));
  5201         CloseFile();
  5616         CloseFile();
  5202 	    returnCode = KErrGeneral;
  5617         returnCode = KErrGeneral;
  5203 	 	}
  5618         }
  5204    delete CoreObj;
  5619     delete CoreObj;
  5205    __UHEAP_MARKEND;
  5620     __UHEAP_MARKEND;
  5206    return returnCode;	
  5621     return returnCode;	
  5207    }
  5622     }
  5208 
  5623 
  5209 
  5624 
  5210 // -----------------------------------------------------------------------------
  5625 // -----------------------------------------------------------------------------
  5211 // CSAPILocTest::GetBearing5
  5626 // CSAPILocTest::GetBearing5
  5212 // -----------------------------------------------------------------------------
  5627 // -----------------------------------------------------------------------------
  5213 //
  5628 //
  5214 TInt CSAPILocTest::GetBearing5( CStifItemParser& /*aItem*/ )
  5629 TInt CSAPILocTest::GetBearing5( CStifItemParser& /*aItem*/ )
  5215     {
  5630     {
  5216     TInt aRet;
  5631     TInt aRet;
  5217   	inpparam aInputParam;
  5632     inpparam aInputParam;
  5218     returnCode = KErrNone;
  5633     returnCode = KErrNone;
  5219     
  5634 
  5220     TCoordinate  aCordinate1(90,180),aCordinate2(-90,-180);
  5635     TCoordinate  aCordinate1(90,180),aCordinate2(-90,-180);
  5221 
  5636 
  5222 	// Print to UI
  5637     // Print to UI
  5223     _LIT( KSAPILocTest, "SAPILocTest" );
  5638     _LIT( KSAPILocTest, "SAPILocTest" );
  5224     _LIT( KExample, "GetBearing5" );
  5639     _LIT( KExample, "GetBearing5" );
  5225     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5640     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5226     
  5641 
  5227     __UHEAP_MARK;
  5642     __UHEAP_MARK;
  5228     
  5643 
  5229     CLocationService *CoreObj = CLocationService :: NewL();
  5644     CLocationService *CoreObj = CLocationService :: NewL();
  5230     
  5645 
  5231     if( NULL == CoreObj)
  5646     if( NULL == CoreObj)
  5232     	{
  5647         {
  5233     	OpenFile();
  5648         OpenFile();
  5234 	    LogFile.Write(_L8("\n<GetBearing5 Test>\n"));
  5649         LogFile.Write(_L8("\n<GetBearing5 Test>\n"));
  5235 	    LogFile.Write(_L8("Failed..\n"));
  5650         LogFile.Write(_L8("Failed..\n"));
  5236 	    CloseFile();
  5651         CloseFile();
  5237    		return KErrGeneral;
  5652         return KErrGeneral;
  5238    		}
  5653         }
  5239        	
  5654 
  5240 	aInputParam.servicechoice = 1;
  5655     aInputParam.servicechoice = 1;
  5241 	aInputParam.source = aCordinate1;
  5656     aInputParam.source = aCordinate1;
  5242 	aInputParam.destination = aCordinate2;
  5657     aInputParam.destination = aCordinate2;
  5243 
  5658 
  5244 	aRet = CoreObj->MathOperation(aInputParam);
  5659     aRet = CoreObj->MathOperation(aInputParam);
  5245 	
  5660 
  5246 	if(KErrPositionIncalculable == aRet )
  5661     if(KErrPositionIncalculable == aRet )
  5247 		{
  5662         {
  5248 		OpenFile();
  5663         OpenFile();
  5249     	TBuf8<50> buf ;
  5664         TBuf8<50> buf ;
  5250  		TRealFormat format; 
  5665         TRealFormat format; 
  5251  		LogFile.Write(_L8("\n<GetBearing5 test> \n"));
  5666         LogFile.Write(_L8("\n<GetBearing5 test> \n"));
  5252  		LogFile.Write(_L8("Passed..\n"));
  5667         LogFile.Write(_L8("Passed..\n"));
  5253  		CloseFile();
  5668         CloseFile();
  5254         returnCode = KErrNone;  
  5669         returnCode = KErrNone;  
  5255 		}
  5670         }
  5256    	else
  5671     else
  5257    		{
  5672         {
  5258 	   	OpenFile();
  5673         OpenFile();
  5259 	   	LogFile.Write(_L8("\n<GetBearing5 test> \n"));
  5674         LogFile.Write(_L8("\n<GetBearing5 test> \n"));
  5260 	   	LogFile.Write(_L8("Failed..\n"));
  5675         LogFile.Write(_L8("Failed..\n"));
  5261         CloseFile();
  5676         CloseFile();
  5262 	    returnCode = KErrGeneral;
  5677         returnCode = KErrGeneral;
  5263 	 	}
  5678         }
  5264    delete CoreObj;
  5679     delete CoreObj;
  5265    __UHEAP_MARKEND;
  5680     __UHEAP_MARKEND;
  5266    return returnCode;	
  5681     return returnCode;	
  5267    }
  5682     }
  5268 
  5683 
  5269 
  5684 
  5270 // -----------------------------------------------------------------------------
  5685 // -----------------------------------------------------------------------------
  5271 // CSAPILocTest::GetBearing6
  5686 // CSAPILocTest::GetBearing6
  5272 // -----------------------------------------------------------------------------
  5687 // -----------------------------------------------------------------------------
  5273 //
  5688 //
  5274 TInt CSAPILocTest::GetBearing6( CStifItemParser& /*aItem*/ )
  5689 TInt CSAPILocTest::GetBearing6( CStifItemParser& /*aItem*/ )
  5275     {
  5690     {
  5276     TInt aRet;
  5691     TInt aRet;
  5277   	inpparam aInputParam;
  5692     inpparam aInputParam;
  5278     returnCode = KErrNone;
  5693     returnCode = KErrNone;
  5279     
  5694 
  5280     TCoordinate  aCordinate1(-120,-180),aCordinate2(160,180);
  5695     TCoordinate  aCordinate1(-120,-180),aCordinate2(160,180);
  5281 
  5696 
  5282 	// Print to UI
  5697     // Print to UI
  5283     _LIT( KSAPILocTest, "SAPILocTest" );
  5698     _LIT( KSAPILocTest, "SAPILocTest" );
  5284     _LIT( KExample, "GetBearing6" );
  5699     _LIT( KExample, "GetBearing6" );
  5285     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5700     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5286     
  5701 
  5287     __UHEAP_MARK;
  5702     __UHEAP_MARK;
  5288     
  5703 
  5289     CLocationService *CoreObj = CLocationService :: NewL();
  5704     CLocationService *CoreObj = CLocationService :: NewL();
  5290     
  5705 
  5291     if( NULL == CoreObj)
  5706     if( NULL == CoreObj)
  5292     	{
  5707         {
  5293     	OpenFile();
  5708         OpenFile();
  5294 	    LogFile.Write(_L8("\n<GetBearing6 Test>\n"));
  5709         LogFile.Write(_L8("\n<GetBearing6 Test>\n"));
  5295 	    LogFile.Write(_L8("Failed..\n"));
  5710         LogFile.Write(_L8("Failed..\n"));
  5296 	    CloseFile();
  5711         CloseFile();
  5297    		return KErrGeneral;
  5712         return KErrGeneral;
  5298    		}
  5713         }
  5299        	
  5714 
  5300 	aInputParam.servicechoice = 1;
  5715     aInputParam.servicechoice = 1;
  5301 	aInputParam.source = aCordinate1;
  5716     aInputParam.source = aCordinate1;
  5302 	aInputParam.destination = aCordinate2;
  5717     aInputParam.destination = aCordinate2;
  5303 
  5718 
  5304 	aRet = CoreObj->MathOperation(aInputParam);
  5719     aRet = CoreObj->MathOperation(aInputParam);
  5305 	
  5720 
  5306 	if( KErrNone == aRet )
  5721     if( KErrNone == aRet )
  5307 		{
  5722         {
  5308 		OpenFile();
  5723         OpenFile();
  5309     	TBuf8<50> buf ;
  5724         TBuf8<50> buf ;
  5310  		TRealFormat format; 
  5725         TRealFormat format; 
  5311  		LogFile.Write(_L8("\n<GetBearing6 test> \n"));
  5726         LogFile.Write(_L8("\n<GetBearing6 test> \n"));
  5312  		buf.Num(aInputParam.result, format) ;
  5727         buf.Num(aInputParam.result, format) ;
  5313  		LogFile.Write(_L8("Bearing = "));
  5728         LogFile.Write(_L8("Bearing = "));
  5314  		LogFile.Write(buf) ;
  5729         LogFile.Write(buf) ;
  5315  		LogFile.Write(_L8("\n")) ;
  5730         LogFile.Write(_L8("\n")) ;
  5316  		CloseFile();
  5731         CloseFile();
  5317       	returnCode = KErrNone;  
  5732         returnCode = KErrNone;  
  5318 		}
  5733         }
  5319    	else
  5734     else
  5320    		{
  5735         {
  5321 	   	OpenFile();
  5736         OpenFile();
  5322 	   	LogFile.Write(_L8("\n<GetBearing6 test> \n"));
  5737         LogFile.Write(_L8("\n<GetBearing6 test> \n"));
  5323 	   	LogFile.Write(_L8("Failed..\n"));
  5738         LogFile.Write(_L8("Failed..\n"));
  5324         CloseFile();
  5739         CloseFile();
  5325 	    returnCode = KErrGeneral;
  5740         returnCode = KErrGeneral;
  5326 	 	}
  5741         }
  5327  	  
  5742 
  5328    delete CoreObj;
  5743     delete CoreObj;
  5329    __UHEAP_MARKEND;
  5744     __UHEAP_MARKEND;
  5330    return returnCode;	
  5745     return returnCode;	
  5331    }
  5746     }
  5332 
  5747 
  5333 
  5748 
  5334 // -----------------------------------------------------------------------------
  5749 // -----------------------------------------------------------------------------
  5335 // CSAPILocTest::GetBearing7
  5750 // CSAPILocTest::GetBearing7
  5336 // -----------------------------------------------------------------------------
  5751 // -----------------------------------------------------------------------------
  5337 //
  5752 //
  5338 TInt CSAPILocTest::GetBearing7( CStifItemParser& /*aItem*/ )
  5753 TInt CSAPILocTest::GetBearing7( CStifItemParser& /*aItem*/ )
  5339     {
  5754     {
  5340     TInt aRet;
  5755     TInt aRet;
  5341   	inpparam aInputParam;
  5756     inpparam aInputParam;
  5342     returnCode = KErrNone;
  5757     returnCode = KErrNone;
  5343     
  5758 
  5344     TCoordinate  aCordinate1(35,360),aCordinate2(-80,-200);
  5759     TCoordinate  aCordinate1(35,360),aCordinate2(-80,-200);
  5345 
  5760 
  5346 	// Print to UI
  5761     // Print to UI
  5347     _LIT( KSAPILocTest, "SAPILocTest" );
  5762     _LIT( KSAPILocTest, "SAPILocTest" );
  5348     _LIT( KExample, "GetBearing7" );
  5763     _LIT( KExample, "GetBearing7" );
  5349     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5764     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5350     
  5765 
  5351     __UHEAP_MARK;
  5766     __UHEAP_MARK;
  5352     
  5767 
  5353     CLocationService *CoreObj = CLocationService :: NewL();
  5768     CLocationService *CoreObj = CLocationService :: NewL();
  5354     
  5769 
  5355     if( NULL == CoreObj)
  5770     if( NULL == CoreObj)
  5356     	{
  5771         {
  5357     	OpenFile();
  5772         OpenFile();
  5358 	    LogFile.Write(_L8("\n<GetBearing7 Test>\n"));
  5773         LogFile.Write(_L8("\n<GetBearing7 Test>\n"));
  5359 	    LogFile.Write(_L8("Failed..\n"));
  5774         LogFile.Write(_L8("Failed..\n"));
  5360 	    CloseFile();
  5775         CloseFile();
  5361    		return KErrGeneral;
  5776         return KErrGeneral;
  5362    		}
  5777         }
  5363        	
  5778 
  5364 	aInputParam.servicechoice = 1;
  5779     aInputParam.servicechoice = 1;
  5365 	aInputParam.source = aCordinate1;
  5780     aInputParam.source = aCordinate1;
  5366 	aInputParam.destination = aCordinate2;
  5781     aInputParam.destination = aCordinate2;
  5367 
  5782 
  5368 	aRet = CoreObj->MathOperation(aInputParam);
  5783     aRet = CoreObj->MathOperation(aInputParam);
  5369 	
  5784 
  5370 	if( KErrNone == aRet )
  5785     if( KErrNone == aRet )
  5371 		{
  5786         {
  5372 		OpenFile();
  5787         OpenFile();
  5373     	TBuf8<50> buf ;
  5788         TBuf8<50> buf ;
  5374  		TRealFormat format; 
  5789         TRealFormat format; 
  5375  		LogFile.Write(_L8("\n<GetBearing7 test> \n"));
  5790         LogFile.Write(_L8("\n<GetBearing7 test> \n"));
  5376  		buf.Num(aInputParam.result, format) ;
  5791         buf.Num(aInputParam.result, format) ;
  5377  		LogFile.Write(_L8("Bearing = "));
  5792         LogFile.Write(_L8("Bearing = "));
  5378  		LogFile.Write(buf) ;
  5793         LogFile.Write(buf) ;
  5379  		LogFile.Write(_L8("\n")) ;
  5794         LogFile.Write(_L8("\n")) ;
  5380  		CloseFile();
  5795         CloseFile();
  5381       	returnCode = KErrNone;  
  5796         returnCode = KErrNone;  
  5382 		}
  5797         }
  5383    	else
  5798     else
  5384    		{
  5799         {
  5385 	   	OpenFile();
  5800         OpenFile();
  5386 	   	LogFile.Write(_L8("\n<GetBearing7 test> \n"));
  5801         LogFile.Write(_L8("\n<GetBearing7 test> \n"));
  5387 	   	LogFile.Write(_L8("Failed..\n"));
  5802         LogFile.Write(_L8("Failed..\n"));
  5388         CloseFile();
  5803         CloseFile();
  5389 	    returnCode = KErrGeneral;
  5804         returnCode = KErrGeneral;
  5390 	 	}
  5805         }
  5391 	 	
  5806 
  5392    delete CoreObj;
  5807     delete CoreObj;
  5393    __UHEAP_MARKEND;
  5808     __UHEAP_MARKEND;
  5394    return returnCode;	
  5809     return returnCode;	
  5395    }
  5810     }
  5396 
  5811 
  5397 
  5812 
  5398 // -----------------------------------------------------------------------------
  5813 // -----------------------------------------------------------------------------
  5399 // CSAPILocTest::GetBearing8
  5814 // CSAPILocTest::GetBearing8
  5400 // -----------------------------------------------------------------------------
  5815 // -----------------------------------------------------------------------------
  5401 //
  5816 //
  5402 TInt CSAPILocTest::GetBearing8( CStifItemParser& /*aItem*/ )
  5817 TInt CSAPILocTest::GetBearing8( CStifItemParser& /*aItem*/ )
  5403     {
  5818     {
  5404     TInt aRet;
  5819     TInt aRet;
  5405   	inpparam aInputParam;
  5820     inpparam aInputParam;
  5406     returnCode = KErrNone;
  5821     returnCode = KErrNone;
  5407     
  5822 
  5408     TCoordinate  aCordinate1(-30,160),aCordinate2(120,240);
  5823     TCoordinate  aCordinate1(-30,160),aCordinate2(120,240);
  5409 
  5824 
  5410 	// Print to UI
  5825     // Print to UI
  5411     _LIT( KSAPILocTest, "SAPILocTest" );
  5826     _LIT( KSAPILocTest, "SAPILocTest" );
  5412     _LIT( KExample, "GetBearing8" );
  5827     _LIT( KExample, "GetBearing8" );
  5413     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5828     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5414     
  5829 
  5415     __UHEAP_MARK;
  5830     __UHEAP_MARK;
  5416     
  5831 
  5417     CLocationService *CoreObj = CLocationService :: NewL();
  5832     CLocationService *CoreObj = CLocationService :: NewL();
  5418     
  5833 
  5419     if( NULL == CoreObj)
  5834     if( NULL == CoreObj)
  5420     	{
  5835         {
  5421     	OpenFile();
  5836         OpenFile();
  5422 	    LogFile.Write(_L8("\n<GetBearing8 Test>\n"));
  5837         LogFile.Write(_L8("\n<GetBearing8 Test>\n"));
  5423 	    LogFile.Write(_L8("Failed..\n"));
  5838         LogFile.Write(_L8("Failed..\n"));
  5424 	    CloseFile();
  5839         CloseFile();
  5425    		return KErrGeneral;
  5840         return KErrGeneral;
  5426    		}
  5841         }
  5427        	
  5842 
  5428 	aInputParam.servicechoice = 1;
  5843     aInputParam.servicechoice = 1;
  5429 	aInputParam.source = aCordinate1;
  5844     aInputParam.source = aCordinate1;
  5430 	aInputParam.destination = aCordinate2;
  5845     aInputParam.destination = aCordinate2;
  5431 
  5846 
  5432 	aRet = CoreObj->MathOperation(aInputParam);
  5847     aRet = CoreObj->MathOperation(aInputParam);
  5433 	
  5848 
  5434    	if( KErrNone == aRet )
  5849     if( KErrNone == aRet )
  5435 		{
  5850         {
  5436 		OpenFile();
  5851         OpenFile();
  5437     	TBuf8<50> buf ;
  5852         TBuf8<50> buf ;
  5438  		TRealFormat format; 
  5853         TRealFormat format; 
  5439  		LogFile.Write(_L8("\n<GetBearing8 test> \n"));
  5854         LogFile.Write(_L8("\n<GetBearing8 test> \n"));
  5440  		buf.Num(aInputParam.result, format) ;
  5855         buf.Num(aInputParam.result, format) ;
  5441  		LogFile.Write(_L8("Bearing = "));
  5856         LogFile.Write(_L8("Bearing = "));
  5442  		LogFile.Write(buf) ;
  5857         LogFile.Write(buf) ;
  5443  		LogFile.Write(_L8("\n")) ;
  5858         LogFile.Write(_L8("\n")) ;
  5444  		CloseFile();
  5859         CloseFile();
  5445       	returnCode = KErrNone;  
  5860         returnCode = KErrNone;  
  5446 		}
  5861         }
  5447    	else
  5862     else
  5448    		{
  5863         {
  5449 	   	OpenFile();
  5864         OpenFile();
  5450 	   	LogFile.Write(_L8("\n<GetBearing8 test> \n"));
  5865         LogFile.Write(_L8("\n<GetBearing8 test> \n"));
  5451 	   	LogFile.Write(_L8("Failed..\n"));
  5866         LogFile.Write(_L8("Failed..\n"));
  5452         CloseFile();
  5867         CloseFile();
  5453 	    returnCode = KErrGeneral;
  5868         returnCode = KErrGeneral;
  5454 	 	}
  5869         }
  5455 	 	
  5870 
  5456    delete CoreObj;
  5871     delete CoreObj;
  5457    __UHEAP_MARKEND;
  5872     __UHEAP_MARKEND;
  5458    return returnCode;	
  5873     return returnCode;	
  5459    }
  5874     }
  5460    
  5875 
  5461 
  5876 
  5462 // -----------------------------------------------------------------------------
  5877 // -----------------------------------------------------------------------------
  5463 // CSAPILocTest::GetBearing9
  5878 // CSAPILocTest::GetBearing9
  5464 // -----------------------------------------------------------------------------
  5879 // -----------------------------------------------------------------------------
  5465 //
  5880 //
  5466 TInt CSAPILocTest::GetBearing9( CStifItemParser& /*aItem*/ )
  5881 TInt CSAPILocTest::GetBearing9( CStifItemParser& /*aItem*/ )
  5467     {
  5882     {
  5468     TInt aRet;
  5883     TInt aRet;
  5469   	inpparam aInputParam;
  5884     inpparam aInputParam;
  5470     returnCode = KErrNone;
  5885     returnCode = KErrNone;
  5471     
  5886 
  5472     TCoordinate  aCordinate1(105,190),aCordinate2(-105,-210);
  5887     TCoordinate  aCordinate1(105,190),aCordinate2(-105,-210);
  5473 
  5888 
  5474 	// Print to UI
  5889     // Print to UI
  5475     _LIT( KSAPILocTest, "SAPILocTest" );
  5890     _LIT( KSAPILocTest, "SAPILocTest" );
  5476     _LIT( KExample, "GetBearing9" );
  5891     _LIT( KExample, "GetBearing9" );
  5477     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5892     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5478     
  5893 
  5479     __UHEAP_MARK;
  5894     __UHEAP_MARK;
  5480     
  5895 
  5481     CLocationService *CoreObj = CLocationService :: NewL();
  5896     CLocationService *CoreObj = CLocationService :: NewL();
  5482     
  5897 
  5483     if( NULL == CoreObj)
  5898     if( NULL == CoreObj)
  5484     	{
  5899         {
  5485     	OpenFile();
  5900         OpenFile();
  5486 	    LogFile.Write(_L8("\n<GetBearing9 Test>\n"));
  5901         LogFile.Write(_L8("\n<GetBearing9 Test>\n"));
  5487 	    LogFile.Write(_L8("Failed..\n"));
  5902         LogFile.Write(_L8("Failed..\n"));
  5488 	    CloseFile();
  5903         CloseFile();
  5489    		return KErrGeneral;
  5904         return KErrGeneral;
  5490    		}
  5905         }
  5491        	
  5906 
  5492 	aInputParam.servicechoice = 1;
  5907     aInputParam.servicechoice = 1;
  5493 	aInputParam.source = aCordinate1;
  5908     aInputParam.source = aCordinate1;
  5494 	aInputParam.destination = aCordinate2;
  5909     aInputParam.destination = aCordinate2;
  5495 
  5910 
  5496 	aRet = CoreObj->MathOperation(aInputParam);
  5911     aRet = CoreObj->MathOperation(aInputParam);
  5497     	
  5912 
  5498     if( KErrNone == aRet )
  5913     if( KErrNone == aRet )
  5499 		{
  5914         {
  5500 		OpenFile();
  5915         OpenFile();
  5501     	TBuf8<50> buf ;
  5916         TBuf8<50> buf ;
  5502  		TRealFormat format; 
  5917         TRealFormat format; 
  5503  		LogFile.Write(_L8("\n<GetBearing9 test> \n"));
  5918         LogFile.Write(_L8("\n<GetBearing9 test> \n"));
  5504  		buf.Num(aInputParam.result, format) ;
  5919         buf.Num(aInputParam.result, format) ;
  5505  		LogFile.Write(_L8("Bearing = "));
  5920         LogFile.Write(_L8("Bearing = "));
  5506  		LogFile.Write(buf) ;
  5921         LogFile.Write(buf) ;
  5507  		LogFile.Write(_L8("\n")) ;
  5922         LogFile.Write(_L8("\n")) ;
  5508  		CloseFile();
  5923         CloseFile();
  5509       	returnCode = KErrNone;  
  5924         returnCode = KErrNone;  
  5510 		}
  5925         }
  5511    	else
  5926     else
  5512    		{
  5927         {
  5513 	   	OpenFile();
  5928         OpenFile();
  5514 	   	LogFile.Write(_L8("\n<GetBearing9 test> \n"));
  5929         LogFile.Write(_L8("\n<GetBearing9 test> \n"));
  5515 	   	LogFile.Write(_L8("Failed..\n"));
  5930         LogFile.Write(_L8("Failed..\n"));
  5516         CloseFile();
  5931         CloseFile();
  5517 	    returnCode = KErrGeneral;
  5932         returnCode = KErrGeneral;
  5518 	 	}
  5933         }
  5519 	 	  
  5934 
  5520    delete CoreObj;
  5935     delete CoreObj;
  5521    __UHEAP_MARKEND;
  5936     __UHEAP_MARKEND;
  5522    return returnCode;	
  5937     return returnCode;	
  5523    }
  5938     }
  5524 
  5939 
  5525 
  5940 
  5526 // -----------------------------------------------------------------------------
  5941 // -----------------------------------------------------------------------------
  5527 // CSAPILocTest::GetBearing10
  5942 // CSAPILocTest::GetBearing10
  5528 // -----------------------------------------------------------------------------
  5943 // -----------------------------------------------------------------------------
  5529 //
  5944 //
  5530 TInt CSAPILocTest::GetBearing10( CStifItemParser& /*aItem*/ )
  5945 TInt CSAPILocTest::GetBearing10( CStifItemParser& /*aItem*/ )
  5531     {
  5946     {
  5532     TInt aRet;
  5947     TInt aRet;
  5533   	inpparam aInputParam;
  5948     inpparam aInputParam;
  5534     returnCode = KErrNone;
  5949     returnCode = KErrNone;
  5535     
  5950 
  5536     TCoordinate  aCordinate1(75,190),aCordinate2(-20,-220);
  5951     TCoordinate  aCordinate1(75,190),aCordinate2(-20,-220);
  5537 
  5952 
  5538 	// Print to UI
  5953     // Print to UI
  5539     _LIT( KSAPILocTest, "SAPILocTest" );
  5954     _LIT( KSAPILocTest, "SAPILocTest" );
  5540     _LIT( KExample, "GetBearing10" );
  5955     _LIT( KExample, "GetBearing10" );
  5541     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5956     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5542     
  5957 
  5543     __UHEAP_MARK;
  5958     __UHEAP_MARK;
  5544     
  5959 
  5545     CLocationService *CoreObj = CLocationService :: NewL();
  5960     CLocationService *CoreObj = CLocationService :: NewL();
  5546     
  5961 
  5547     if( NULL == CoreObj)
  5962     if( NULL == CoreObj)
  5548     	{
  5963         {
  5549     	OpenFile();
  5964         OpenFile();
  5550 	    LogFile.Write(_L8("\n<GetBearing10 Test>\n"));
  5965         LogFile.Write(_L8("\n<GetBearing10 Test>\n"));
  5551 	    LogFile.Write(_L8("Failed..\n"));
  5966         LogFile.Write(_L8("Failed..\n"));
  5552 	    CloseFile();
  5967         CloseFile();
  5553    		return KErrGeneral;
  5968         return KErrGeneral;
  5554    		}
  5969         }
  5555        	
  5970 
  5556 	aInputParam.servicechoice = 1;
  5971     aInputParam.servicechoice = 1;
  5557 	aInputParam.source = aCordinate1;
  5972     aInputParam.source = aCordinate1;
  5558 	aInputParam.destination = aCordinate2;
  5973     aInputParam.destination = aCordinate2;
  5559 
  5974 
  5560 	aRet = CoreObj->MathOperation(aInputParam);
  5975     aRet = CoreObj->MathOperation(aInputParam);
  5561     	
  5976 
  5562 	if( KErrNone == aRet )
  5977     if( KErrNone == aRet )
  5563 		{
  5978         {
  5564 		OpenFile();
  5979         OpenFile();
  5565     	TBuf8<50> buf ;
  5980         TBuf8<50> buf ;
  5566  		TRealFormat format; 
  5981         TRealFormat format; 
  5567  		LogFile.Write(_L8("\n<GetBearing10 test> \n"));
  5982         LogFile.Write(_L8("\n<GetBearing10 test> \n"));
  5568  		buf.Num(aInputParam.result, format) ;
  5983         buf.Num(aInputParam.result, format) ;
  5569  		LogFile.Write(_L8("Bearing = "));
  5984         LogFile.Write(_L8("Bearing = "));
  5570  		LogFile.Write(buf) ;
  5985         LogFile.Write(buf) ;
  5571  		LogFile.Write(_L8("\n")) ;
  5986         LogFile.Write(_L8("\n")) ;
  5572  		CloseFile();
  5987         CloseFile();
  5573       	returnCode = KErrNone;  
  5988         returnCode = KErrNone;  
  5574 		}
  5989         }
  5575    	else
  5990     else
  5576    		{
  5991         {
  5577 	   	OpenFile();
  5992         OpenFile();
  5578 	   	LogFile.Write(_L8("\n<GetBearing10 test> \n"));
  5993         LogFile.Write(_L8("\n<GetBearing10 test> \n"));
  5579 	   	LogFile.Write(_L8("Failed..\n"));
  5994         LogFile.Write(_L8("Failed..\n"));
  5580         CloseFile();
  5995         CloseFile();
  5581 	    returnCode = KErrGeneral;
  5996         returnCode = KErrGeneral;
  5582 	 	}
  5997         }
  5583 	 	
  5998 
  5584    delete CoreObj;
  5999     delete CoreObj;
  5585    __UHEAP_MARKEND;
  6000     __UHEAP_MARKEND;
  5586    return returnCode;	
  6001     return returnCode;	
  5587    }
  6002     }
  5588 
  6003 
  5589 
  6004 
  5590 // -----------------------------------------------------------------------------
  6005 // -----------------------------------------------------------------------------
  5591 // CSAPILocTest::GetBearing11
  6006 // CSAPILocTest::GetBearing11
  5592 // -----------------------------------------------------------------------------
  6007 // -----------------------------------------------------------------------------
  5593 //
  6008 //
  5594 TInt CSAPILocTest::GetBearing11( CStifItemParser& /*aItem*/ )
  6009 TInt CSAPILocTest::GetBearing11( CStifItemParser& /*aItem*/ )
  5595     {
  6010     {
  5596     TInt aRet;
  6011     TInt aRet;
  5597   	inpparam aInputParam;
  6012     inpparam aInputParam;
  5598     returnCode = KErrNone;
  6013     returnCode = KErrNone;
  5599     TRealX nan;
  6014     TRealX nan;
  5600     nan.SetNaN();
  6015     nan.SetNaN();
  5601     TCoordinate  aCordinate1(nan,190),aCordinate2(-20,-220);
  6016     TCoordinate  aCordinate1(nan,190),aCordinate2(-20,-220);
  5602 
  6017 
  5603 	// Print to UI
  6018     // Print to UI
  5604     _LIT( KSAPILocTest, "SAPILocTest" );
  6019     _LIT( KSAPILocTest, "SAPILocTest" );
  5605     _LIT( KExample, "GetBearing11" );
  6020     _LIT( KExample, "GetBearing11" );
  5606     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6021     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5607     
  6022 
  5608     __UHEAP_MARK;
  6023     __UHEAP_MARK;
  5609     
  6024 
  5610     CLocationService *CoreObj = CLocationService :: NewL();
  6025     CLocationService *CoreObj = CLocationService :: NewL();
  5611     
  6026 
  5612     if( NULL == CoreObj)
  6027     if( NULL == CoreObj)
  5613     	{
  6028         {
  5614     	OpenFile();
  6029         OpenFile();
  5615 	    LogFile.Write(_L8("\n<GetBearing11 Test>\n"));
  6030         LogFile.Write(_L8("\n<GetBearing11 Test>\n"));
  5616 	    LogFile.Write(_L8("Failed..\n"));
  6031         LogFile.Write(_L8("Failed..\n"));
  5617 	    CloseFile();
  6032         CloseFile();
  5618    		return KErrGeneral;
  6033         return KErrGeneral;
  5619    		}
  6034         }
  5620        	
  6035 
  5621 	aInputParam.servicechoice = 1;
  6036     aInputParam.servicechoice = 1;
  5622 	aInputParam.source = aCordinate1;
  6037     aInputParam.source = aCordinate1;
  5623 	aInputParam.destination = aCordinate2;
  6038     aInputParam.destination = aCordinate2;
  5624 
  6039 
  5625 	aRet = CoreObj->MathOperation(aInputParam);
  6040     aRet = CoreObj->MathOperation(aInputParam);
  5626 	
  6041 
  5627 	if( KErrArgument == aRet )
  6042     if( KErrArgument == aRet )
  5628 		{
  6043         {
  5629 		OpenFile();
  6044         OpenFile();
  5630     	LogFile.Write(_L8("\n<GetBearing11 test> \n"));
  6045         LogFile.Write(_L8("\n<GetBearing11 test> \n"));
  5631  		LogFile.Write(_L8("Passed..\n")) ;
  6046         LogFile.Write(_L8("Passed..\n")) ;
  5632  		CloseFile();
  6047         CloseFile();
  5633       	returnCode = KErrNone;  
  6048         returnCode = KErrNone;  
  5634 		}
  6049         }
  5635    	else
  6050     else
  5636    		{
  6051         {
  5637 	   	OpenFile();
  6052         OpenFile();
  5638 	   	LogFile.Write(_L8("\n<GetBearing11 test> \n"));
  6053         LogFile.Write(_L8("\n<GetBearing11 test> \n"));
  5639 	   	LogFile.Write(_L8("Failed..\n"));
  6054         LogFile.Write(_L8("Failed..\n"));
  5640         CloseFile();
  6055         CloseFile();
  5641 	    returnCode = KErrGeneral;
  6056         returnCode = KErrGeneral;
  5642 	 	}
  6057         }
  5643    delete CoreObj;
  6058     delete CoreObj;
  5644    __UHEAP_MARKEND;
  6059     __UHEAP_MARKEND;
  5645    return returnCode;	
  6060     return returnCode;	
  5646    }
  6061     }
  5647 
  6062 
  5648 
  6063 
  5649 // -----------------------------------------------------------------------------
  6064 // -----------------------------------------------------------------------------
  5650 // CSAPILocTest::GetBearing12
  6065 // CSAPILocTest::GetBearing12
  5651 // -----------------------------------------------------------------------------
  6066 // -----------------------------------------------------------------------------
  5652 //
  6067 //
  5653 TInt CSAPILocTest::GetBearing12( CStifItemParser& /*aItem*/ )
  6068 TInt CSAPILocTest::GetBearing12( CStifItemParser& /*aItem*/ )
  5654     {
  6069     {
  5655     TInt aRet;
  6070     TInt aRet;
  5656   	inpparam aInputParam;
  6071     inpparam aInputParam;
  5657     returnCode = KErrNone;
  6072     returnCode = KErrNone;
  5658     TRealX nan;
  6073     TRealX nan;
  5659     nan.SetNaN();
  6074     nan.SetNaN();
  5660     TCoordinate  aCordinate1(40,nan),aCordinate2(-20,-220);
  6075     TCoordinate  aCordinate1(40,nan),aCordinate2(-20,-220);
  5661 
  6076 
  5662 	// Print to UI
  6077     // Print to UI
  5663     _LIT( KSAPILocTest, "SAPILocTest" );
  6078     _LIT( KSAPILocTest, "SAPILocTest" );
  5664     _LIT( KExample, "GetBearing12" );
  6079     _LIT( KExample, "GetBearing12" );
  5665     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6080     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5666     
  6081 
  5667     __UHEAP_MARK;
  6082     __UHEAP_MARK;
  5668     
  6083 
  5669     CLocationService *CoreObj = CLocationService :: NewL();
  6084     CLocationService *CoreObj = CLocationService :: NewL();
  5670     
  6085 
  5671     if( NULL == CoreObj)
  6086     if( NULL == CoreObj)
  5672     	{
  6087         {
  5673     	OpenFile();
  6088         OpenFile();
  5674 	    LogFile.Write(_L8("\n<GetBearing12 Test>\n"));
  6089         LogFile.Write(_L8("\n<GetBearing12 Test>\n"));
  5675 	    LogFile.Write(_L8("Failed..\n"));
  6090         LogFile.Write(_L8("Failed..\n"));
  5676 	    CloseFile();
  6091         CloseFile();
  5677    		return KErrGeneral;
  6092         return KErrGeneral;
  5678    		}
  6093         }
  5679        	
  6094 
  5680 	aInputParam.servicechoice = 1;
  6095     aInputParam.servicechoice = 1;
  5681 	aInputParam.source = aCordinate1;
  6096     aInputParam.source = aCordinate1;
  5682 	aInputParam.destination = aCordinate2;
  6097     aInputParam.destination = aCordinate2;
  5683 
  6098 
  5684 	aRet = CoreObj->MathOperation(aInputParam);
  6099     aRet = CoreObj->MathOperation(aInputParam);
  5685 	
  6100 
  5686     if( KErrArgument == aRet )
  6101     if( KErrArgument == aRet )
  5687     	{
  6102         {
  5688 		OpenFile();
  6103         OpenFile();
  5689     	LogFile.Write(_L8("\n<GetBearing12 test> \n"));
  6104         LogFile.Write(_L8("\n<GetBearing12 test> \n"));
  5690  		LogFile.Write(_L8("Passed..\n")) ;
  6105         LogFile.Write(_L8("Passed..\n")) ;
  5691  		CloseFile();
  6106         CloseFile();
  5692       	returnCode = KErrNone;  
  6107         returnCode = KErrNone;  
  5693 		}
  6108         }
  5694    	else
  6109     else
  5695    		{
  6110         {
  5696 	   	OpenFile();
  6111         OpenFile();
  5697 	   	LogFile.Write(_L8("\n<GetBearing12 test> \n"));
  6112         LogFile.Write(_L8("\n<GetBearing12 test> \n"));
  5698 	   	LogFile.Write(_L8("Failed..\n"));
  6113         LogFile.Write(_L8("Failed..\n"));
  5699         CloseFile();
  6114         CloseFile();
  5700 	    returnCode = KErrGeneral;
  6115         returnCode = KErrGeneral;
  5701 	 	}
  6116         }
  5702    delete CoreObj;
  6117     delete CoreObj;
  5703    __UHEAP_MARKEND;
  6118     __UHEAP_MARKEND;
  5704    return returnCode;	
  6119     return returnCode;	
  5705    }
  6120     }
  5706 
  6121 
  5707 
  6122 
  5708 
  6123 
  5709 // -----------------------------------------------------------------------------
  6124 // -----------------------------------------------------------------------------
  5710 // CSAPILocTest::GetBearing13
  6125 // CSAPILocTest::GetBearing13
  5711 // -----------------------------------------------------------------------------
  6126 // -----------------------------------------------------------------------------
  5712 //
  6127 //
  5713 TInt CSAPILocTest::GetBearing13( CStifItemParser& /*aItem*/ )
  6128 TInt CSAPILocTest::GetBearing13( CStifItemParser& /*aItem*/ )
  5714     {
  6129     {
  5715     TInt aRet;
  6130     TInt aRet;
  5716   	inpparam aInputParam;
  6131     inpparam aInputParam;
  5717     returnCode = KErrNone;
  6132     returnCode = KErrNone;
  5718     TRealX nan;
  6133     TRealX nan;
  5719     nan.SetNaN();
  6134     nan.SetNaN();
  5720     TCoordinate  aCordinate1(40,140),aCordinate2(nan,-220);
  6135     TCoordinate  aCordinate1(40,140),aCordinate2(nan,-220);
  5721 
  6136 
  5722 	// Print to UI
  6137     // Print to UI
  5723     _LIT( KSAPILocTest, "SAPILocTest" );
  6138     _LIT( KSAPILocTest, "SAPILocTest" );
  5724     _LIT( KExample, "GetBearing13" );
  6139     _LIT( KExample, "GetBearing13" );
  5725     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6140     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5726     
  6141 
  5727     __UHEAP_MARK;
  6142     __UHEAP_MARK;
  5728     
  6143 
  5729     CLocationService *CoreObj = CLocationService :: NewL();
  6144     CLocationService *CoreObj = CLocationService :: NewL();
  5730     
  6145 
  5731     if( NULL == CoreObj)
  6146     if( NULL == CoreObj)
  5732     	{
  6147         {
  5733     	OpenFile();
  6148         OpenFile();
  5734 	    LogFile.Write(_L8("\n<GetBearing13 Test>\n"));
  6149         LogFile.Write(_L8("\n<GetBearing13 Test>\n"));
  5735 	    LogFile.Write(_L8("Failed..\n"));
  6150         LogFile.Write(_L8("Failed..\n"));
  5736 	    CloseFile();
  6151         CloseFile();
  5737    		return KErrGeneral;
  6152         return KErrGeneral;
  5738    		}
  6153         }
  5739        	
  6154 
  5740 	aInputParam.servicechoice = 1;
  6155     aInputParam.servicechoice = 1;
  5741 	aInputParam.source = aCordinate1;
  6156     aInputParam.source = aCordinate1;
  5742 	aInputParam.destination = aCordinate2;
  6157     aInputParam.destination = aCordinate2;
  5743 
  6158 
  5744 	aRet = CoreObj->MathOperation(aInputParam);
  6159     aRet = CoreObj->MathOperation(aInputParam);
  5745 	
  6160 
  5746 	if( KErrArgument == aRet )
  6161     if( KErrArgument == aRet )
  5747 		{
  6162         {
  5748 		OpenFile();
  6163         OpenFile();
  5749     	LogFile.Write(_L8("\n<GetBearing13 test> \n"));
  6164         LogFile.Write(_L8("\n<GetBearing13 test> \n"));
  5750  		LogFile.Write(_L8("Passed..\n")) ;
  6165         LogFile.Write(_L8("Passed..\n")) ;
  5751  		CloseFile();
  6166         CloseFile();
  5752       	returnCode = KErrNone;  
  6167         returnCode = KErrNone;  
  5753 		}
  6168         }
  5754    	else
  6169     else
  5755    		{
  6170         {
  5756 	   	OpenFile();
  6171         OpenFile();
  5757 	   	LogFile.Write(_L8("\n<GetBearing13 test> \n"));
  6172         LogFile.Write(_L8("\n<GetBearing13 test> \n"));
  5758 	   	LogFile.Write(_L8("Failed..\n"));
  6173         LogFile.Write(_L8("Failed..\n"));
  5759         CloseFile();
  6174         CloseFile();
  5760 	    returnCode = KErrGeneral;
  6175         returnCode = KErrGeneral;
  5761 	 	}
  6176         }
  5762 	 	  
  6177 
  5763    delete CoreObj;
  6178     delete CoreObj;
  5764    __UHEAP_MARKEND;
  6179     __UHEAP_MARKEND;
  5765    return returnCode;	
  6180     return returnCode;	
  5766    }
  6181     }
  5767 
  6182 
  5768 
  6183 
  5769 
  6184 
  5770 // -----------------------------------------------------------------------------
  6185 // -----------------------------------------------------------------------------
  5771 // CSAPILocTest::GetBearing14
  6186 // CSAPILocTest::GetBearing14
  5772 // -----------------------------------------------------------------------------
  6187 // -----------------------------------------------------------------------------
  5773 //
  6188 //
  5774 TInt CSAPILocTest::GetBearing14( CStifItemParser& /*aItem*/ )
  6189 TInt CSAPILocTest::GetBearing14( CStifItemParser& /*aItem*/ )
  5775     {
  6190     {
  5776     TInt aRet;
  6191     TInt aRet;
  5777   	inpparam aInputParam;
  6192     inpparam aInputParam;
  5778     returnCode = KErrNone;
  6193     returnCode = KErrNone;
  5779     TRealX nan;
  6194     TRealX nan;
  5780     nan.SetNaN();
  6195     nan.SetNaN();
  5781     TCoordinate  aCordinate1(40,140),aCordinate2(60,nan);
  6196     TCoordinate  aCordinate1(40,140),aCordinate2(60,nan);
  5782 
  6197 
  5783 	// Print to UI
  6198     // Print to UI
  5784     _LIT( KSAPILocTest, "SAPILocTest" );
  6199     _LIT( KSAPILocTest, "SAPILocTest" );
  5785     _LIT( KExample, "GetBearing14" );
  6200     _LIT( KExample, "GetBearing14" );
  5786     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6201     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5787     
  6202 
  5788     __UHEAP_MARK;
  6203     __UHEAP_MARK;
  5789     
  6204 
  5790     CLocationService *CoreObj = CLocationService :: NewL();
  6205     CLocationService *CoreObj = CLocationService :: NewL();
  5791     
  6206 
  5792     if( NULL == CoreObj)
  6207     if( NULL == CoreObj)
  5793     	{
  6208         {
  5794     	OpenFile();
  6209         OpenFile();
  5795 	    LogFile.Write(_L8("\n<GetBearing14 Test>\n"));
  6210         LogFile.Write(_L8("\n<GetBearing14 Test>\n"));
  5796 	    LogFile.Write(_L8("Failed..\n"));
  6211         LogFile.Write(_L8("Failed..\n"));
  5797 	    CloseFile();
  6212         CloseFile();
  5798    		return KErrGeneral;
  6213         return KErrGeneral;
  5799    		}
  6214         }
  5800        	
  6215 
  5801 	aInputParam.servicechoice = 1;
  6216     aInputParam.servicechoice = 1;
  5802 	aInputParam.source = aCordinate1;
  6217     aInputParam.source = aCordinate1;
  5803 	aInputParam.destination = aCordinate2;
  6218     aInputParam.destination = aCordinate2;
  5804 
  6219 
  5805 	aRet = CoreObj->MathOperation(aInputParam);
  6220     aRet = CoreObj->MathOperation(aInputParam);
  5806 	
  6221 
  5807 	if( KErrArgument == aRet )
  6222     if( KErrArgument == aRet )
  5808 		{
  6223         {
  5809 		OpenFile();
  6224         OpenFile();
  5810     	LogFile.Write(_L8("\n<GetBearing14 test> \n"));
  6225         LogFile.Write(_L8("\n<GetBearing14 test> \n"));
  5811  		LogFile.Write(_L8("Passed..\n")) ;
  6226         LogFile.Write(_L8("Passed..\n")) ;
  5812  		CloseFile();
  6227         CloseFile();
  5813       	returnCode = KErrNone;  
  6228         returnCode = KErrNone;  
  5814 		}
  6229         }
  5815    	else
  6230     else
  5816    		{
  6231         {
  5817 	   	OpenFile();
  6232         OpenFile();
  5818 	   	LogFile.Write(_L8("\n<GetBearing14 test> \n"));
  6233         LogFile.Write(_L8("\n<GetBearing14 test> \n"));
  5819 	   	LogFile.Write(_L8("Failed..\n"));
  6234         LogFile.Write(_L8("Failed..\n"));
  5820         CloseFile();
  6235         CloseFile();
  5821 	    returnCode = KErrGeneral;
  6236         returnCode = KErrGeneral;
  5822 	 	}
  6237         }
  5823    delete CoreObj;
  6238     delete CoreObj;
  5824    __UHEAP_MARKEND;
  6239     __UHEAP_MARKEND;
  5825    return returnCode;	
  6240     return returnCode;	
  5826    }
  6241     }
  5827 
  6242 
  5828 
  6243 
  5829 // -----------------------------------------------------------------------------
  6244 // -----------------------------------------------------------------------------
  5830 // CSAPILocTest::Move1
  6245 // CSAPILocTest::Move1
  5831 // -----------------------------------------------------------------------------
  6246 // -----------------------------------------------------------------------------
  5832 //
  6247 //
  5833 TInt CSAPILocTest::Move1( CStifItemParser& /*aItem*/ )
  6248 TInt CSAPILocTest::Move1( CStifItemParser& /*aItem*/ )
  5834     {
  6249     {
  5835     TInt aRet;
  6250     TInt aRet;
  5836   	inpparam aInputParam;
  6251     inpparam aInputParam;
  5837     returnCode = KErrNone;
  6252     returnCode = KErrNone;
  5838     TRealX nan;
  6253     TRealX nan;
  5839     nan.SetNaN();
  6254     nan.SetNaN();
  5840     TCoordinate  aCordinate1(nan,140);
  6255     TCoordinate  aCordinate1(nan,140);
  5841 	TReal32 aDist=1000,aBearing=100;
  6256     TReal32 aDist=1000,aBearing=100;
  5842 	// Print to UI
  6257     // Print to UI
  5843     _LIT( KSAPILocTest, "SAPILocTest" );
  6258     _LIT( KSAPILocTest, "SAPILocTest" );
  5844     _LIT( KExample, "Move1" );
  6259     _LIT( KExample, "Move1" );
  5845     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6260     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5846     
  6261 
  5847     __UHEAP_MARK;
  6262     __UHEAP_MARK;
  5848     
  6263 
  5849     CLocationService *CoreObj = CLocationService :: NewL();
  6264     CLocationService *CoreObj = CLocationService :: NewL();
  5850     
  6265 
  5851     if( NULL == CoreObj)
  6266     if( NULL == CoreObj)
  5852     	{
  6267         {
  5853     	OpenFile();
  6268         OpenFile();
  5854 	    LogFile.Write(_L8("\n<Move1 Test>\n"));
  6269         LogFile.Write(_L8("\n<Move1 Test>\n"));
  5855 	    LogFile.Write(_L8("Failed..\n"));
  6270         LogFile.Write(_L8("Failed..\n"));
  5856 	    CloseFile();
  6271         CloseFile();
  5857    		return KErrGeneral;
  6272         return KErrGeneral;
  5858    		}
  6273         }
  5859        	
  6274 
  5860 	aInputParam.servicechoice = 2;
  6275     aInputParam.servicechoice = 2;
  5861 	aInputParam.source = aCordinate1;
  6276     aInputParam.source = aCordinate1;
  5862 	aInputParam.bearing = aBearing;
  6277     aInputParam.bearing = aBearing;
  5863 	aInputParam.distance = aDist;
  6278     aInputParam.distance = aDist;
  5864 	
  6279 
  5865 	aRet = CoreObj->MathOperation(aInputParam);
  6280     aRet = CoreObj->MathOperation(aInputParam);
  5866 	
  6281 
  5867 	if( KErrArgument == aRet )
  6282     if( KErrArgument == aRet )
  5868 		{
  6283         {
  5869 		OpenFile();
  6284         OpenFile();
  5870     	LogFile.Write(_L8("\n<Move1 test> \n"));
  6285         LogFile.Write(_L8("\n<Move1 test> \n"));
  5871  		LogFile.Write(_L8("Passed..\n")) ;
  6286         LogFile.Write(_L8("Passed..\n")) ;
  5872  		CloseFile();
  6287         CloseFile();
  5873       	returnCode = KErrNone;  
  6288         returnCode = KErrNone;  
  5874 		}
  6289         }
  5875    	else
  6290     else
  5876    		{
  6291         {
  5877 	   	OpenFile();
  6292         OpenFile();
  5878 	   	LogFile.Write(_L8("\n<Move1 test> \n"));
  6293         LogFile.Write(_L8("\n<Move1 test> \n"));
  5879 	   	LogFile.Write(_L8("Failed..\n"));
  6294         LogFile.Write(_L8("Failed..\n"));
  5880         CloseFile();
  6295         CloseFile();
  5881 	    returnCode = KErrGeneral;
  6296         returnCode = KErrGeneral;
  5882 	 	}
  6297         }
  5883    delete CoreObj;
  6298     delete CoreObj;
  5884    __UHEAP_MARKEND;
  6299     __UHEAP_MARKEND;
  5885    return returnCode;	
  6300     return returnCode;	
  5886    }
  6301     }
  5887 
  6302 
  5888 
  6303 
  5889 
  6304 
  5890 // -----------------------------------------------------------------------------
  6305 // -----------------------------------------------------------------------------
  5891 // CSAPILocTest::Move2
  6306 // CSAPILocTest::Move2
  5892 // -----------------------------------------------------------------------------
  6307 // -----------------------------------------------------------------------------
  5893 //
  6308 //
  5894 TInt CSAPILocTest::Move2( CStifItemParser& /*aItem*/ )
  6309 TInt CSAPILocTest::Move2( CStifItemParser& /*aItem*/ )
  5895     {
  6310     {
  5896     TInt aRet;
  6311     TInt aRet;
  5897   	inpparam aInputParam;
  6312     inpparam aInputParam;
  5898     returnCode = KErrNone;
  6313     returnCode = KErrNone;
  5899     TRealX nan;
  6314     TRealX nan;
  5900     nan.SetNaN();
  6315     nan.SetNaN();
  5901     TCoordinate  aCordinate1(40,nan);
  6316     TCoordinate  aCordinate1(40,nan);
  5902 	TReal32 aDist=1000,aBearing=100;
  6317     TReal32 aDist=1000,aBearing=100;
  5903 	// Print to UI
  6318     // Print to UI
  5904     _LIT( KSAPILocTest, "SAPILocTest" );
  6319     _LIT( KSAPILocTest, "SAPILocTest" );
  5905     _LIT( KExample, "Move2" );
  6320     _LIT( KExample, "Move2" );
  5906     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6321     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5907     
  6322 
  5908     __UHEAP_MARK;
  6323     __UHEAP_MARK;
  5909     
  6324 
  5910     CLocationService *CoreObj = CLocationService :: NewL();
  6325     CLocationService *CoreObj = CLocationService :: NewL();
  5911     
  6326 
  5912     if( NULL == CoreObj)
  6327     if( NULL == CoreObj)
  5913     	{
  6328         {
  5914     	OpenFile();
  6329         OpenFile();
  5915 	    LogFile.Write(_L8("\n<Move2 Test>\n"));
  6330         LogFile.Write(_L8("\n<Move2 Test>\n"));
  5916 	    LogFile.Write(_L8("Failed..\n"));
  6331         LogFile.Write(_L8("Failed..\n"));
  5917 	    CloseFile();
  6332         CloseFile();
  5918    		return KErrGeneral;
  6333         return KErrGeneral;
  5919    		}
  6334         }
  5920        	
  6335 
  5921 	aInputParam.servicechoice = 2;
  6336     aInputParam.servicechoice = 2;
  5922 	aInputParam.source = aCordinate1;
  6337     aInputParam.source = aCordinate1;
  5923 	aInputParam.bearing = aBearing;
  6338     aInputParam.bearing = aBearing;
  5924 	aInputParam.distance = aDist;
  6339     aInputParam.distance = aDist;
  5925 	
  6340 
  5926 	aRet = CoreObj->MathOperation(aInputParam);
  6341     aRet = CoreObj->MathOperation(aInputParam);
  5927 	
  6342 
  5928 	if( KErrArgument == aRet )
  6343     if( KErrArgument == aRet )
  5929 		{
  6344         {
  5930 		OpenFile();
  6345         OpenFile();
  5931     	LogFile.Write(_L8("\n<Move2 test> \n"));
  6346         LogFile.Write(_L8("\n<Move2 test> \n"));
  5932  		LogFile.Write(_L8("Passed..\n")) ;
  6347         LogFile.Write(_L8("Passed..\n")) ;
  5933  		CloseFile();
  6348         CloseFile();
  5934       	returnCode = KErrNone;  
  6349         returnCode = KErrNone;  
  5935 		}
  6350         }
  5936    	else
  6351     else
  5937    		{
  6352         {
  5938 	   	OpenFile();
  6353         OpenFile();
  5939 	   	LogFile.Write(_L8("\n<Move2 test> \n"));
  6354         LogFile.Write(_L8("\n<Move2 test> \n"));
  5940 	   	LogFile.Write(_L8("Failed..\n"));
  6355         LogFile.Write(_L8("Failed..\n"));
  5941         CloseFile();
  6356         CloseFile();
  5942 	    returnCode = KErrGeneral;
  6357         returnCode = KErrGeneral;
  5943 	 	}
  6358         }
  5944    delete CoreObj;
  6359     delete CoreObj;
  5945    __UHEAP_MARKEND;
  6360     __UHEAP_MARKEND;
  5946    return returnCode;	
  6361     return returnCode;	
  5947    }
  6362     }
  5948 
  6363 
  5949 
  6364 
  5950 
  6365 
  5951 // -----------------------------------------------------------------------------
  6366 // -----------------------------------------------------------------------------
  5952 // CSAPILocTest::Move3
  6367 // CSAPILocTest::Move3
  5953 // -----------------------------------------------------------------------------
  6368 // -----------------------------------------------------------------------------
  5954 //
  6369 //
  5955 TInt CSAPILocTest::Move3( CStifItemParser& /*aItem*/ )
  6370 TInt CSAPILocTest::Move3( CStifItemParser& /*aItem*/ )
  5956     {
  6371     {
  5957     TInt aRet;
  6372     TInt aRet;
  5958   	inpparam aInputParam;
  6373     inpparam aInputParam;
  5959     returnCode = KErrNone;
  6374     returnCode = KErrNone;
  5960     TRealX nan;
  6375     TRealX nan;
  5961     nan.SetNaN();
  6376     nan.SetNaN();
  5962     TCoordinate  aCordinate1(90,0);
  6377     TCoordinate  aCordinate1(90,0);
  5963 	TReal32 aDist=1000,aBearing=100;
  6378     TReal32 aDist=1000,aBearing=100;
  5964 	// Print to UI
  6379     // Print to UI
  5965     _LIT( KSAPILocTest, "SAPILocTest" );
  6380     _LIT( KSAPILocTest, "SAPILocTest" );
  5966     _LIT( KExample, "Move3" );
  6381     _LIT( KExample, "Move3" );
  5967     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6382     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  5968     
  6383 
  5969     __UHEAP_MARK;
  6384     __UHEAP_MARK;
  5970     
  6385 
  5971     CLocationService *CoreObj = CLocationService :: NewL();
  6386     CLocationService *CoreObj = CLocationService :: NewL();
  5972     
  6387 
  5973     if( NULL == CoreObj)
  6388     if( NULL == CoreObj)
  5974     	{
  6389         {
  5975     	OpenFile();
  6390         OpenFile();
  5976 	    LogFile.Write(_L8("\n<Move3 Test>\n"));
  6391         LogFile.Write(_L8("\n<Move3 Test>\n"));
  5977 	    LogFile.Write(_L8("Failed..\n"));
  6392         LogFile.Write(_L8("Failed..\n"));
  5978 	    CloseFile();
  6393         CloseFile();
  5979    		return KErrGeneral;
  6394         return KErrGeneral;
  5980    		}
  6395         }
  5981        	
  6396 
  5982 	aInputParam.servicechoice = 2;
  6397     aInputParam.servicechoice = 2;
  5983 	aInputParam.source = aCordinate1;
  6398     aInputParam.source = aCordinate1;
  5984 	aInputParam.bearing = aBearing;
  6399     aInputParam.bearing = aBearing;
  5985 	aInputParam.distance = aDist;
  6400     aInputParam.distance = aDist;
  5986 	
  6401 
  5987 	aRet = CoreObj->MathOperation(aInputParam);
  6402     aRet = CoreObj->MathOperation(aInputParam);
  5988 	
  6403 
  5989 	if( KErrPositionIncalculable == aRet )
  6404     if( KErrPositionIncalculable == aRet )
  5990 		{
  6405         {
  5991 		OpenFile();
  6406         OpenFile();
  5992     	LogFile.Write(_L8("\n<Move3 test> \n"));
  6407         LogFile.Write(_L8("\n<Move3 test> \n"));
  5993  		LogFile.Write(_L8("Passed..\n")) ;
  6408         LogFile.Write(_L8("Passed..\n")) ;
  5994  		CloseFile();
  6409         CloseFile();
  5995       	returnCode = KErrNone;  
  6410         returnCode = KErrNone;  
  5996 		}
  6411         }
  5997    	else
  6412     else
  5998    		{
  6413         {
  5999 	   	OpenFile();
  6414         OpenFile();
  6000 	   	LogFile.Write(_L8("\n<Move3 test> \n"));
  6415         LogFile.Write(_L8("\n<Move3 test> \n"));
  6001 	   	LogFile.Write(_L8("Failed..\n"));
  6416         LogFile.Write(_L8("Failed..\n"));
  6002         CloseFile();
  6417         CloseFile();
  6003 	    returnCode = KErrGeneral;
  6418         returnCode = KErrGeneral;
  6004 	 	}
  6419         }
  6005 	 	  
  6420 
  6006    delete CoreObj;
  6421     delete CoreObj;
  6007    __UHEAP_MARKEND;
  6422     __UHEAP_MARKEND;
  6008    return returnCode;	
  6423     return returnCode;	
  6009    }
  6424     }
  6010 
  6425 
  6011 
  6426 
  6012 
  6427 
  6013 
  6428 
  6014 // -----------------------------------------------------------------------------
  6429 // -----------------------------------------------------------------------------
  6016 // -----------------------------------------------------------------------------
  6431 // -----------------------------------------------------------------------------
  6017 //
  6432 //
  6018 TInt CSAPILocTest::Move4( CStifItemParser& /*aItem*/ )
  6433 TInt CSAPILocTest::Move4( CStifItemParser& /*aItem*/ )
  6019     {
  6434     {
  6020     TInt aRet;
  6435     TInt aRet;
  6021   	inpparam aInputParam;
  6436     inpparam aInputParam;
  6022     returnCode = KErrNone;
  6437     returnCode = KErrNone;
  6023     TRealX nan;
  6438     TRealX nan;
  6024     nan.SetNaN();
  6439     nan.SetNaN();
  6025     TCoordinate  aCordinate1(-90,0);
  6440     TCoordinate  aCordinate1(-90,0);
  6026 	TReal32 aDist=1000,aBearing=100;
  6441     TReal32 aDist=1000,aBearing=100;
  6027 	// Print to UI
  6442     // Print to UI
  6028     _LIT( KSAPILocTest, "SAPILocTest" );
  6443     _LIT( KSAPILocTest, "SAPILocTest" );
  6029     _LIT( KExample, "Move4" );
  6444     _LIT( KExample, "Move4" );
  6030     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6445     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6031     
  6446 
  6032     __UHEAP_MARK;
  6447     __UHEAP_MARK;
  6033     
  6448 
  6034     CLocationService *CoreObj = CLocationService :: NewL();
  6449     CLocationService *CoreObj = CLocationService :: NewL();
  6035     
  6450 
  6036     if( NULL == CoreObj)
  6451     if( NULL == CoreObj)
  6037     	{
  6452         {
  6038     	OpenFile();
  6453         OpenFile();
  6039 	    LogFile.Write(_L8("\n<Move4 Test>\n"));
  6454         LogFile.Write(_L8("\n<Move4 Test>\n"));
  6040 	    LogFile.Write(_L8("Failed..\n"));
  6455         LogFile.Write(_L8("Failed..\n"));
  6041 	    CloseFile();
  6456         CloseFile();
  6042    		return KErrGeneral;
  6457         return KErrGeneral;
  6043    		}
  6458         }
  6044        	
  6459 
  6045 	aInputParam.servicechoice = 2;
  6460     aInputParam.servicechoice = 2;
  6046 	aInputParam.source = aCordinate1;
  6461     aInputParam.source = aCordinate1;
  6047 	aInputParam.bearing = aBearing;
  6462     aInputParam.bearing = aBearing;
  6048 	aInputParam.distance = aDist;
  6463     aInputParam.distance = aDist;
  6049 	
  6464 
  6050 	aRet = CoreObj->MathOperation(aInputParam);
  6465     aRet = CoreObj->MathOperation(aInputParam);
  6051 	
  6466 
  6052 	if( KErrPositionIncalculable == aRet )
  6467     if( KErrPositionIncalculable == aRet )
  6053 		{
  6468         {
  6054 		OpenFile();
  6469         OpenFile();
  6055     	LogFile.Write(_L8("\n<Move4 test> \n"));
  6470         LogFile.Write(_L8("\n<Move4 test> \n"));
  6056  		LogFile.Write(_L8("Passed..\n")) ;
  6471         LogFile.Write(_L8("Passed..\n")) ;
  6057  		CloseFile();
  6472         CloseFile();
  6058       	returnCode = KErrNone;  
  6473         returnCode = KErrNone;  
  6059 		}
  6474         }
  6060    	else
  6475     else
  6061    		{
  6476         {
  6062 	   	OpenFile();
  6477         OpenFile();
  6063 	   	LogFile.Write(_L8("\n<Move4 test> \n"));
  6478         LogFile.Write(_L8("\n<Move4 test> \n"));
  6064 	   	LogFile.Write(_L8("Failed..\n"));
  6479         LogFile.Write(_L8("Failed..\n"));
  6065         CloseFile();
  6480         CloseFile();
  6066 	    returnCode = KErrGeneral;
  6481         returnCode = KErrGeneral;
  6067 	 	}
  6482         }
  6068 	 	  
  6483 
  6069    delete CoreObj;
  6484     delete CoreObj;
  6070    __UHEAP_MARKEND;
  6485     __UHEAP_MARKEND;
  6071    return returnCode;	
  6486     return returnCode;	
  6072    }
  6487     }
  6073 
  6488 
  6074 
  6489 
  6075 
  6490 
  6076 
  6491 
  6077 // -----------------------------------------------------------------------------
  6492 // -----------------------------------------------------------------------------
  6079 // -----------------------------------------------------------------------------
  6494 // -----------------------------------------------------------------------------
  6080 //
  6495 //
  6081 TInt CSAPILocTest::Move5( CStifItemParser& /*aItem*/ )
  6496 TInt CSAPILocTest::Move5( CStifItemParser& /*aItem*/ )
  6082     {
  6497     {
  6083     TInt aRet;
  6498     TInt aRet;
  6084   	inpparam aInputParam;
  6499     inpparam aInputParam;
  6085     returnCode = KErrNone;
  6500     returnCode = KErrNone;
  6086     TRealX nan;
  6501     TRealX nan;
  6087     nan.SetNaN();
  6502     nan.SetNaN();
  6088     TCoordinate  aCordinate1(0,0);
  6503     TCoordinate  aCordinate1(0,0);
  6089 	TReal32 aDist=1000,aBearing=100;
  6504     TReal32 aDist=1000,aBearing=100;
  6090 	// Print to UI
  6505     // Print to UI
  6091     _LIT( KSAPILocTest, "SAPILocTest" );
  6506     _LIT( KSAPILocTest, "SAPILocTest" );
  6092     _LIT( KExample, "Move5" );
  6507     _LIT( KExample, "Move5" );
  6093     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6508     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6094     
  6509 
  6095     __UHEAP_MARK;
  6510     __UHEAP_MARK;
  6096     
  6511 
  6097     CLocationService *CoreObj = CLocationService :: NewL();
  6512     CLocationService *CoreObj = CLocationService :: NewL();
  6098     
  6513 
  6099     if( NULL == CoreObj)
  6514     if( NULL == CoreObj)
  6100     	{
  6515         {
  6101     	OpenFile();
  6516         OpenFile();
  6102 	    LogFile.Write(_L8("\n<Move5 Test>\n"));
  6517         LogFile.Write(_L8("\n<Move5 Test>\n"));
  6103 	    LogFile.Write(_L8("Failed..\n"));
  6518         LogFile.Write(_L8("Failed..\n"));
  6104 	    CloseFile();
  6519         CloseFile();
  6105    		return KErrGeneral;
  6520         return KErrGeneral;
  6106    		}
  6521         }
  6107        	
  6522 
  6108 	aInputParam.servicechoice = 2;
  6523     aInputParam.servicechoice = 2;
  6109 	aInputParam.source = aCordinate1;
  6524     aInputParam.source = aCordinate1;
  6110 	aInputParam.bearing = aBearing;
  6525     aInputParam.bearing = aBearing;
  6111 	aInputParam.distance = aDist;
  6526     aInputParam.distance = aDist;
  6112 	
  6527 
  6113 	aRet = CoreObj->MathOperation(aInputParam);
  6528     aRet = CoreObj->MathOperation(aInputParam);
  6114 	
  6529 
  6115 	if( KErrNone == aRet )
  6530     if( KErrNone == aRet )
  6116 		{
  6531         {
  6117 		OpenFile();
  6532         OpenFile();
  6118     	LogFile.Write(_L8("\n<Move5 test> \n"));
  6533         LogFile.Write(_L8("\n<Move5 test> \n"));
  6119  		LogFile.Write(_L8("Passed..\n")) ;
  6534         LogFile.Write(_L8("Passed..\n")) ;
  6120  		CloseFile();
  6535         CloseFile();
  6121       	returnCode = KErrNone;  
  6536         returnCode = KErrNone;  
  6122 		}
  6537         }
  6123    	else
  6538     else
  6124    		{
  6539         {
  6125 	   	OpenFile();
  6540         OpenFile();
  6126 	   	LogFile.Write(_L8("\n<Move5 test> \n"));
  6541         LogFile.Write(_L8("\n<Move5 test> \n"));
  6127 	   	LogFile.Write(_L8("Failed..\n"));
  6542         LogFile.Write(_L8("Failed..\n"));
  6128         CloseFile();
  6543         CloseFile();
  6129 	    returnCode = KErrGeneral;
  6544         returnCode = KErrGeneral;
  6130 	 	}
  6545         }
  6131 	 	  
  6546 
  6132    delete CoreObj;
  6547     delete CoreObj;
  6133    __UHEAP_MARKEND;
  6548     __UHEAP_MARKEND;
  6134    return returnCode;	
  6549     return returnCode;	
  6135    }
  6550     }
  6136 
  6551 
  6137 
  6552 
  6138 // -----------------------------------------------------------------------------
  6553 // -----------------------------------------------------------------------------
  6139 // CSAPILocTest::Move6
  6554 // CSAPILocTest::Move6
  6140 // -----------------------------------------------------------------------------
  6555 // -----------------------------------------------------------------------------
  6141 //
  6556 //
  6142 TInt CSAPILocTest::Move6( CStifItemParser& /*aItem*/ )
  6557 TInt CSAPILocTest::Move6( CStifItemParser& /*aItem*/ )
  6143     {
  6558     {
  6144     TInt aRet;
  6559     TInt aRet;
  6145   	inpparam aInputParam;
  6560     inpparam aInputParam;
  6146     returnCode = KErrNone;
  6561     returnCode = KErrNone;
  6147     TRealX nan;
  6562     TRealX nan;
  6148     nan.SetNaN();
  6563     nan.SetNaN();
  6149     TCoordinate  aCordinate1(20,120);
  6564     TCoordinate  aCordinate1(20,120);
  6150 	TReal32 aDist=1000,aBearing=100;
  6565     TReal32 aDist=1000,aBearing=100;
  6151 	// Print to UI
  6566     // Print to UI
  6152     _LIT( KSAPILocTest, "SAPILocTest" );
  6567     _LIT( KSAPILocTest, "SAPILocTest" );
  6153     _LIT( KExample, "Move6" );
  6568     _LIT( KExample, "Move6" );
  6154     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6569     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6155     
  6570 
  6156     __UHEAP_MARK;
  6571     __UHEAP_MARK;
  6157     
  6572 
  6158     CLocationService *CoreObj = CLocationService :: NewL();
  6573     CLocationService *CoreObj = CLocationService :: NewL();
  6159     
  6574 
  6160     if( NULL == CoreObj)
  6575     if( NULL == CoreObj)
  6161     	{
  6576         {
  6162     	OpenFile();
  6577         OpenFile();
  6163 	    LogFile.Write(_L8("\n<Move6 Test>\n"));
  6578         LogFile.Write(_L8("\n<Move6 Test>\n"));
  6164 	    LogFile.Write(_L8("Failed..\n"));
  6579         LogFile.Write(_L8("Failed..\n"));
  6165 	    CloseFile();
  6580         CloseFile();
  6166    		return KErrGeneral;
  6581         return KErrGeneral;
  6167    		}
  6582         }
  6168        	
  6583 
  6169 	aInputParam.servicechoice = 2;
  6584     aInputParam.servicechoice = 2;
  6170 	aInputParam.source = aCordinate1;
  6585     aInputParam.source = aCordinate1;
  6171 	aInputParam.bearing = aBearing;
  6586     aInputParam.bearing = aBearing;
  6172 	aInputParam.distance = aDist;
  6587     aInputParam.distance = aDist;
  6173 	
  6588 
  6174 	aRet = CoreObj->MathOperation(aInputParam);
  6589     aRet = CoreObj->MathOperation(aInputParam);
  6175 	
  6590 
  6176 	if( KErrNone == aRet )
  6591     if( KErrNone == aRet )
  6177 		{
  6592         {
  6178 		OpenFile();
  6593         OpenFile();
  6179 		TBuf8<50> buf ;
  6594         TBuf8<50> buf ;
  6180  		TRealFormat format; 
  6595         TRealFormat format; 
  6181  	   	LogFile.Write(_L8("\n<Move6 test> \n"));
  6596         LogFile.Write(_L8("\n<Move6 test> \n"));
  6182  		TReal64 aLatitude  = aCordinate1.Latitude();
  6597         TReal64 aLatitude  = aCordinate1.Latitude();
  6183  		buf.Num(aLatitude, format) ;
  6598         buf.Num(aLatitude, format) ;
  6184  		LogFile.Write(_L8("Latitude = "));
  6599         LogFile.Write(_L8("Latitude = "));
  6185  		LogFile.Write(buf) ;
  6600         LogFile.Write(buf) ;
  6186  		TReal64 aLongitude  = aCordinate1.Longitude();
  6601         TReal64 aLongitude  = aCordinate1.Longitude();
  6187  		buf.Num(aLongitude, format) ;
  6602         buf.Num(aLongitude, format) ;
  6188  		LogFile.Write(_L8("Longitude = "));
  6603         LogFile.Write(_L8("Longitude = "));
  6189  		LogFile.Write(buf) ;
  6604         LogFile.Write(buf) ;
  6190  		LogFile.Write(_L8("Passed..\n")) ;
  6605         LogFile.Write(_L8("Passed..\n")) ;
  6191  		CloseFile();
  6606         CloseFile();
  6192       	returnCode = KErrNone;  
  6607         returnCode = KErrNone;  
  6193 		}
  6608         }
  6194    	else
  6609     else
  6195    		{
  6610         {
  6196 	   	OpenFile();
  6611         OpenFile();
  6197 	   	LogFile.Write(_L8("\n<Move6 test> \n"));
  6612         LogFile.Write(_L8("\n<Move6 test> \n"));
  6198 	   	LogFile.Write(_L8("Failed..\n"));
  6613         LogFile.Write(_L8("Failed..\n"));
  6199         CloseFile();
  6614         CloseFile();
  6200 	    returnCode = KErrGeneral;
  6615         returnCode = KErrGeneral;
  6201 	 	}
  6616         }
  6202 	 	  
  6617 
  6203    delete CoreObj;
  6618     delete CoreObj;
  6204    __UHEAP_MARKEND;
  6619     __UHEAP_MARKEND;
  6205    return returnCode;	
  6620     return returnCode;	
  6206    }
  6621     }
  6207 
  6622 
  6208 // -----------------------------------------------------------------------------
  6623 // -----------------------------------------------------------------------------
  6209 // CSAPILocTest::Move7
  6624 // CSAPILocTest::Move7
  6210 // -----------------------------------------------------------------------------
  6625 // -----------------------------------------------------------------------------
  6211 //
  6626 //
  6212 TInt CSAPILocTest::Move7( CStifItemParser& /*aItem*/ )
  6627 TInt CSAPILocTest::Move7( CStifItemParser& /*aItem*/ )
  6213     {
  6628     {
  6214     TInt aRet;
  6629     TInt aRet;
  6215   	inpparam aInputParam;
  6630     inpparam aInputParam;
  6216     returnCode = KErrNone;
  6631     returnCode = KErrNone;
  6217     TRealX nan;
  6632     TRealX nan;
  6218     nan.SetNaN();
  6633     nan.SetNaN();
  6219     TCoordinate  aCordinate1(-30,-70);
  6634     TCoordinate  aCordinate1(-30,-70);
  6220 	TReal32 aDist=1000,aBearing=100;
  6635     TReal32 aDist=1000,aBearing=100;
  6221 	// Print to UI
  6636     // Print to UI
  6222     _LIT( KSAPILocTest, "SAPILocTest" );
  6637     _LIT( KSAPILocTest, "SAPILocTest" );
  6223     _LIT( KExample, "Move7" );
  6638     _LIT( KExample, "Move7" );
  6224     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6639     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6225     
  6640 
  6226     __UHEAP_MARK;
  6641     __UHEAP_MARK;
  6227     
  6642 
  6228     CLocationService *CoreObj = CLocationService :: NewL();
  6643     CLocationService *CoreObj = CLocationService :: NewL();
  6229     
  6644 
  6230     if( NULL == CoreObj)
  6645     if( NULL == CoreObj)
  6231     	{
  6646         {
  6232     	OpenFile();
  6647         OpenFile();
  6233 	    LogFile.Write(_L8("\n<Move7 Test>\n"));
  6648         LogFile.Write(_L8("\n<Move7 Test>\n"));
  6234 	    LogFile.Write(_L8("Failed..\n"));
  6649         LogFile.Write(_L8("Failed..\n"));
  6235 	    CloseFile();
  6650         CloseFile();
  6236    		return KErrGeneral;
  6651         return KErrGeneral;
  6237    		}
  6652         }
  6238        	
  6653 
  6239 	aInputParam.servicechoice = 2;
  6654     aInputParam.servicechoice = 2;
  6240 	aInputParam.source = aCordinate1;
  6655     aInputParam.source = aCordinate1;
  6241 	aInputParam.bearing = aBearing;
  6656     aInputParam.bearing = aBearing;
  6242 	aInputParam.distance = aDist;
  6657     aInputParam.distance = aDist;
  6243 	
  6658 
  6244 	aRet = CoreObj->MathOperation(aInputParam);
  6659     aRet = CoreObj->MathOperation(aInputParam);
  6245 	
  6660 
  6246 	if( KErrNone == aRet )
  6661     if( KErrNone == aRet )
  6247 		{
  6662         {
  6248 		OpenFile();
  6663         OpenFile();
  6249 		TBuf8<50> buf ;
  6664         TBuf8<50> buf ;
  6250  		TRealFormat format; 
  6665         TRealFormat format; 
  6251  	   	LogFile.Write(_L8("\n<Move7 test> \n"));
  6666         LogFile.Write(_L8("\n<Move7 test> \n"));
  6252  		TReal64 aLatitude  = aCordinate1.Latitude();
  6667         TReal64 aLatitude  = aCordinate1.Latitude();
  6253  		buf.Num(aLatitude, format) ;
  6668         buf.Num(aLatitude, format) ;
  6254  		LogFile.Write(_L8("Latitude = "));
  6669         LogFile.Write(_L8("Latitude = "));
  6255  		LogFile.Write(buf) ;
  6670         LogFile.Write(buf) ;
  6256  		TReal64 aLongitude  = aCordinate1.Longitude();
  6671         TReal64 aLongitude  = aCordinate1.Longitude();
  6257  		buf.Num(aLongitude, format) ;
  6672         buf.Num(aLongitude, format) ;
  6258  		LogFile.Write(_L8("Longitude = "));
  6673         LogFile.Write(_L8("Longitude = "));
  6259  		LogFile.Write(buf) ;
  6674         LogFile.Write(buf) ;
  6260  		LogFile.Write(_L8("Passed..\n")) ;
  6675         LogFile.Write(_L8("Passed..\n")) ;
  6261  		CloseFile();
  6676         CloseFile();
  6262       	returnCode = KErrNone;  
  6677         returnCode = KErrNone;  
  6263 		}
  6678         }
  6264    	else
  6679     else
  6265    		{
  6680         {
  6266 	   	OpenFile();
  6681         OpenFile();
  6267 	   	LogFile.Write(_L8("\n<Move7 test> \n"));
  6682         LogFile.Write(_L8("\n<Move7 test> \n"));
  6268 	   	LogFile.Write(_L8("Failed..\n"));
  6683         LogFile.Write(_L8("Failed..\n"));
  6269         CloseFile();
  6684         CloseFile();
  6270 	    returnCode = KErrGeneral;
  6685         returnCode = KErrGeneral;
  6271 	 	}
  6686         }
  6272 	 	  
  6687 
  6273     delete CoreObj;
  6688     delete CoreObj;
  6274    __UHEAP_MARKEND;
  6689     __UHEAP_MARKEND;
  6275    return returnCode;	
  6690     return returnCode;	
  6276    }
  6691     }
  6277 
  6692 
  6278 
  6693 
  6279 // -----------------------------------------------------------------------------
  6694 // -----------------------------------------------------------------------------
  6280 // CSAPILocTest::Move8
  6695 // CSAPILocTest::Move8
  6281 // -----------------------------------------------------------------------------
  6696 // -----------------------------------------------------------------------------
  6282 //
  6697 //
  6283 TInt CSAPILocTest::Move8( CStifItemParser& /*aItem*/ )
  6698 TInt CSAPILocTest::Move8( CStifItemParser& /*aItem*/ )
  6284     {
  6699     {
  6285     TInt aRet;
  6700     TInt aRet;
  6286   	inpparam aInputParam;
  6701     inpparam aInputParam;
  6287     returnCode = KErrNone;
  6702     returnCode = KErrNone;
  6288     TRealX nan;
  6703     TRealX nan;
  6289     nan.SetNaN();
  6704     nan.SetNaN();
  6290     TCoordinate  aCordinate1(20,120);
  6705     TCoordinate  aCordinate1(20,120);
  6291 	TReal32 aDist=0,aBearing=0;
  6706     TReal32 aDist=0,aBearing=0;
  6292 	// Print to UI
  6707     // Print to UI
  6293     _LIT( KSAPILocTest, "SAPILocTest" );
  6708     _LIT( KSAPILocTest, "SAPILocTest" );
  6294     _LIT( KExample, "Move8" );
  6709     _LIT( KExample, "Move8" );
  6295     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6710     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6296     
  6711 
  6297     __UHEAP_MARK;
  6712     __UHEAP_MARK;
  6298     
  6713 
  6299     CLocationService *CoreObj = CLocationService :: NewL();
  6714     CLocationService *CoreObj = CLocationService :: NewL();
  6300     
  6715 
  6301     if( NULL == CoreObj)
  6716     if( NULL == CoreObj)
  6302     	{
  6717         {
  6303     	OpenFile();
  6718         OpenFile();
  6304 	    LogFile.Write(_L8("\n<Move8 Test>\n"));
  6719         LogFile.Write(_L8("\n<Move8 Test>\n"));
  6305 	    LogFile.Write(_L8("Failed..\n"));
  6720         LogFile.Write(_L8("Failed..\n"));
  6306 	    CloseFile();
  6721         CloseFile();
  6307    		return KErrGeneral;
  6722         return KErrGeneral;
  6308    		}
  6723         }
  6309        	
  6724 
  6310 	aInputParam.servicechoice = 2;
  6725     aInputParam.servicechoice = 2;
  6311 	aInputParam.source = aCordinate1;
  6726     aInputParam.source = aCordinate1;
  6312 	aInputParam.bearing = aBearing;
  6727     aInputParam.bearing = aBearing;
  6313 	aInputParam.distance = aDist;
  6728     aInputParam.distance = aDist;
  6314 	
  6729 
  6315 	aRet = CoreObj->MathOperation(aInputParam);
  6730     aRet = CoreObj->MathOperation(aInputParam);
  6316 	
  6731 
  6317 	if( KErrNone == aRet )
  6732     if( KErrNone == aRet )
  6318 		{
  6733         {
  6319 		OpenFile();
  6734         OpenFile();
  6320 		TBuf8<50> buf ;
  6735         TBuf8<50> buf ;
  6321  		TRealFormat format; 
  6736         TRealFormat format; 
  6322  	   	LogFile.Write(_L8("\n<Move8 test> \n"));
  6737         LogFile.Write(_L8("\n<Move8 test> \n"));
  6323  		TReal64 aLatitude  = aCordinate1.Latitude();
  6738         TReal64 aLatitude  = aCordinate1.Latitude();
  6324  		buf.Num(aLatitude, format) ;
  6739         buf.Num(aLatitude, format) ;
  6325  		LogFile.Write(_L8("Latitude = "));
  6740         LogFile.Write(_L8("Latitude = "));
  6326  		LogFile.Write(buf) ;
  6741         LogFile.Write(buf) ;
  6327  		TReal64 aLongitude  = aCordinate1.Longitude();
  6742         TReal64 aLongitude  = aCordinate1.Longitude();
  6328  		buf.Num(aLongitude, format) ;
  6743         buf.Num(aLongitude, format) ;
  6329  		LogFile.Write(_L8("Longitude = "));
  6744         LogFile.Write(_L8("Longitude = "));
  6330  		LogFile.Write(buf) ;
  6745         LogFile.Write(buf) ;
  6331  		CloseFile();
  6746         CloseFile();
  6332       	if( aLatitude != 20 || aLongitude != 120)
  6747         if( aLatitude != 20 || aLongitude != 120)
  6333       		returnCode = KErrGeneral;
  6748             returnCode = KErrGeneral;
  6334       	else
  6749         else
  6335       		returnCode = KErrNone;  
  6750             returnCode = KErrNone;  
  6336 		}
  6751         }
  6337    	else
  6752     else
  6338    		{
  6753         {
  6339 	   	OpenFile();
  6754         OpenFile();
  6340 	   	LogFile.Write(_L8("\n<Move8 test> \n"));
  6755         LogFile.Write(_L8("\n<Move8 test> \n"));
  6341 	   	LogFile.Write(_L8("Failed..\n"));
  6756         LogFile.Write(_L8("Failed..\n"));
  6342         CloseFile();
  6757         CloseFile();
  6343 	    returnCode = KErrGeneral;
  6758         returnCode = KErrGeneral;
  6344 	 	}
  6759         }
  6345 	 	  
  6760 
  6346    delete CoreObj;
  6761     delete CoreObj;
  6347    __UHEAP_MARKEND;
  6762     __UHEAP_MARKEND;
  6348    return returnCode;	
  6763     return returnCode;	
  6349    }
  6764     }
  6350 
  6765 
  6351 // -----------------------------------------------------------------------------
  6766 // -----------------------------------------------------------------------------
  6352 // CSAPILocTest::Modinfo1
  6767 // CSAPILocTest::Modinfo1
  6353 // -----------------------------------------------------------------------------
  6768 // -----------------------------------------------------------------------------
  6354 //
  6769 //
  6355 //TInt CSAPILocTest::Modinfo1( CStifItemParser& /*aItem*/ )
  6770 //TInt CSAPILocTest::Modinfo1( CStifItemParser& /*aItem*/ )
  6356   /*  {
  6771 /*  {
  6357     TInt aRet;
  6772     TInt aRet;
  6358     TPositionModuleInfo currPos;
  6773     TPositionModuleInfo currPos;
  6359   	inpparam aInputParam;
  6774   	inpparam aInputParam;
  6360     returnCode = KErrNone;
  6775     returnCode = KErrNone;
  6361     TReal32 aDist=0,aBearing=0;
  6776     TReal32 aDist=0,aBearing=0;
  6362 	// Print to UI
  6777 	// Print to UI
  6363     _LIT( KSAPILocTest, "SAPILocTest" );
  6778     _LIT( KSAPILocTest, "SAPILocTest" );
  6364     _LIT( KExample, "Modinfo1" );
  6779     _LIT( KExample, "Modinfo1" );
  6365     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6780     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6366     
  6781 
  6367     __UHEAP_MARK;
  6782     __UHEAP_MARK;
  6368     
  6783 
  6369     CLocationService *CoreObj = CLocationService :: NewL();
  6784     CLocationService *CoreObj = CLocationService :: NewL();
  6370     
  6785 
  6371     if( NULL == CoreObj)
  6786     if( NULL == CoreObj)
  6372     	{
  6787     	{
  6373     	OpenFile();
  6788     	OpenFile();
  6374 	    LogFile.Write(_L8("\n<Move8 Test>\n"));
  6789 	    LogFile.Write(_L8("\n<Move8 Test>\n"));
  6375 	    LogFile.Write(_L8("Failed..\n"));
  6790 	    LogFile.Write(_L8("Failed..\n"));
  6376 	    CloseFile();
  6791 	    CloseFile();
  6377    		return KErrGeneral;
  6792    		return KErrGeneral;
  6378    		}
  6793    		}
  6379        	
  6794 
  6380 	aRet = CoreObj->GetModuleInfo(currPos);
  6795 	aRet = CoreObj->GetModuleInfo(currPos);
  6381 	TPositionModuleInfo :: TCapabilities  currCapability  = currPos.Capabilities() ;
  6796 	TPositionModuleInfo :: TCapabilities  currCapability  = currPos.Capabilities() ;
  6382 	
  6797 
  6383 	if ( iLocinfoCategory == EGenericInfo )
  6798 	if ( iLocinfoCategory == EGenericInfo )
  6384 	    {
  6799 	    {
  6385 	    if(currCapability & TPositionModuleInfo :: ECapabilitySpeed) //Populate output param with speed info
  6800 	    if(currCapability & TPositionModuleInfo :: ECapabilitySpeed) //Populate output param with speed info
  6386         {
  6801         {
  6387         TReal32 speedinfo = 0 ;
  6802         TReal32 speedinfo = 0 ;
  6489 	            {
  6904 	            {
  6490 	            iOutParmList->AppendL(TAiwGenericParam (KPositionFieldNMEASentencesStart , TAiwVariant(nmeaSentences))) ;	
  6905 	            iOutParmList->AppendL(TAiwGenericParam (KPositionFieldNMEASentencesStart , TAiwVariant(nmeaSentences))) ;	
  6491 	            }
  6906 	            }
  6492 	        }
  6907 	        }
  6493 
  6908 
  6494 	 	  
  6909 
  6495     aRequestorStack.Close();
  6910     aRequestorStack.Close();
  6496 	    delete identityInfo;
  6911 	    delete identityInfo;
  6497 	    delete CoreObj;
  6912 	    delete CoreObj;
  6498    __UHEAP_MARKEND;
  6913    __UHEAP_MARKEND;
  6499    return returnCode;	
  6914    return returnCode;	
  6503 // -----------------------------------------------------------------------------
  6918 // -----------------------------------------------------------------------------
  6504 // CSAPILocTest::Modinfo1
  6919 // CSAPILocTest::Modinfo1
  6505 // -----------------------------------------------------------------------------
  6920 // -----------------------------------------------------------------------------
  6506 //
  6921 //
  6507 class Modinfo1CallBack : public MLocationCallBack
  6922 class Modinfo1CallBack : public MLocationCallBack
  6508 	{
  6923     {
  6509     TInt iCount ;
  6924     TInt iCount ;
  6510     TInt iRetStatus ;
  6925     TInt iRetStatus ;
  6511     CLocationService *iCoreObj; 
  6926     CLocationService *iCoreObj; 
       
  6927     TInt iTransactionId;
       
  6928     TInt iRequestType;
  6512     public :
  6929     public :
  6513     TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  6930         TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ;
  6514     Modinfo1CallBack(CLocationService *obj,TInt cnt=0,TInt retStatus=KErrGeneral) 
  6931         Modinfo1CallBack(TInt transId,TInt req,CLocationService *obj,TInt cnt=0,TInt retStatus=KErrGeneral) 
  6515     	{
  6932             {
  6516 		iCoreObj = obj;
  6933             iTransactionId = transId;
  6517 		iCount = cnt;
  6934             iRequestType = req;
  6518 		iRetStatus = retStatus;    
  6935             iCoreObj = obj;
  6519     	}
  6936             iCount = cnt;
  6520 	};
  6937             iRetStatus = retStatus;    
  6521   
  6938             }
  6522    
  6939 
       
  6940         inline TUint GetRequestType(void) 
       
  6941             {
       
  6942             return iRequestType ;
       
  6943             }
       
  6944 
       
  6945 
       
  6946         /**
       
  6947          * GetTransactionId function returns transcation id associated with current async object
       
  6948          *
       
  6949          */
       
  6950         inline TInt32 GetTransactionId(void)
       
  6951             {
       
  6952             return iTransactionId ;
       
  6953             }
       
  6954     };
       
  6955 
       
  6956 
  6523 TInt Modinfo1CallBack :: HandleNotifyL(HPositionGenericInfo *currPos , TInt /*aError*/)
  6957 TInt Modinfo1CallBack :: HandleNotifyL(HPositionGenericInfo *currPos , TInt /*aError*/)
  6524 	{
  6958     {
  6525 	TInt aRetVal = KErrNone;
  6959     TInt aRetVal = KErrNone;
  6526 	TPositionModuleInfo modInfo;
  6960     TPositionModuleInfo modInfo;
  6527 	OpenFile();
  6961     OpenFile();
  6528 	LogFile.Write(_L8("\n<Modinfo1 Test>\n "));
  6962     LogFile.Write(_L8("\n<Modinfo1 Test>\n "));
  6529 	CloseFile();
  6963     CloseFile();
  6530 	TPosition outPos ;
  6964     TPosition outPos ;
  6531   	currPos->GetPosition(outPos) ;
  6965     currPos->GetPosition(outPos) ;
  6532 	aRetVal = ValidatePosition(outPos);
  6966     aRetVal = ValidatePosition(outPos);
  6533     
  6967 
  6534     if( KErrNone == aRetVal )
  6968     if( KErrNone == aRetVal )
  6535 	    {
  6969         {
  6536     	aRetVal = iCoreObj->GetModuleInfo(modInfo);
  6970         aRetVal = iCoreObj->GetModuleInfo(modInfo);
  6537     	TPositionModuleInfo :: TCapabilities  currCapability  = modInfo.Capabilities() ;
  6971         TPositionModuleInfo :: TCapabilities  currCapability  = modInfo.Capabilities() ;
  6538 	
  6972 
  6539 	//	if ( iLocinfoCategory == EGenericInfo )
  6973         //	if ( iLocinfoCategory == EGenericInfo )
  6540 	 //   	{
  6974         //   	{
  6541 	    	//if( (currCapability & TPositionModuleInfo :: ECapabilitySpeed) && returnCode == KErrNone) //Populate output param with speed info
  6975         //if( (currCapability & TPositionModuleInfo :: ECapabilitySpeed) && returnCode == KErrNone) //Populate output param with speed info
  6542         	if (currCapability & TPositionModuleInfo :: ECapabilitySpeed)	
  6976         if (currCapability & TPositionModuleInfo :: ECapabilitySpeed)	
  6543         		{
  6977             {
  6544         		TReal32 speedinfo = 0 ;
  6978             TReal32 speedinfo = 0 ;
  6545 
  6979 
  6546         		if(!currPos->GetValue(EPositionFieldHorizontalSpeed , speedinfo) ) //Extract speed 
  6980             if(!currPos->GetValue(EPositionFieldHorizontalSpeed , speedinfo) ) //Extract speed 
  6547             		{
  6981                 {
  6548             		TBuf8<50> buf ;
  6982                 TBuf8<50> buf ;
  6549 					TRealFormat format ;
  6983                 TRealFormat format ;
  6550 					buf.Num(speedinfo , format) ;
  6984                 buf.Num(speedinfo , format) ;
  6551 					OpenFile();
  6985                 OpenFile();
  6552 					LogFile.Write(_L8("HorizontalSpeed = "));
  6986                 LogFile.Write(_L8("HorizontalSpeed = "));
  6553 					LogFile.Write(buf) ;
  6987                 LogFile.Write(buf) ;
  6554 					LogFile.Write(_L8("\n")) ;
  6988                 LogFile.Write(_L8("\n")) ;
  6555 					CloseFile();
  6989                 CloseFile();
  6556            			}
  6990                 }
  6557 
  6991 
  6558 		        else if(!currPos->GetValue(EPositionFieldHorizontalSpeedError , speedinfo))
  6992             else if(!currPos->GetValue(EPositionFieldHorizontalSpeedError , speedinfo))
  6559 		            {
  6993                 {
  6560 		            TBuf8<50> buf ;
  6994                 TBuf8<50> buf ;
  6561 					TRealFormat format ;
  6995                 TRealFormat format ;
  6562 					buf.Num(speedinfo , format) ;
  6996                 buf.Num(speedinfo , format) ;
  6563 					OpenFile();
  6997                 OpenFile();
  6564 					LogFile.Write(_L8("HorizontalSpeedError = "));
  6998                 LogFile.Write(_L8("HorizontalSpeedError = "));
  6565 					LogFile.Write(buf) ;
  6999                 LogFile.Write(buf) ;
  6566 					LogFile.Write(_L8("\n")) ;
  7000                 LogFile.Write(_L8("\n")) ;
  6567 					CloseFile();
  7001                 CloseFile();
  6568 		            }
  7002                 }
  6569 		      /*   else
  7003             /*   else
  6570 		         {
  7004 		         {
  6571 		         	returnCode = KErrGeneral;
  7005 		         	returnCode = KErrGeneral;
  6572 		         }
  7006 		         }
  6573               */    
  7007              */    
  6574         	}   //End of EcapabilitySpeed 
  7008             }   //End of EcapabilitySpeed 
  6575 
  7009 
  6576 
  7010 
  6577 	  //  if((currCapability & TPositionModuleInfo :: ECapabilitySatellite) && returnCode == KErrNone ) //Extract satellitinfo if any and append it
  7011         //  if((currCapability & TPositionModuleInfo :: ECapabilitySatellite) && returnCode == KErrNone ) //Extract satellitinfo if any and append it
  6578 	     if(currCapability & TPositionModuleInfo :: ECapabilitySatellite)   
  7012         if(currCapability & TPositionModuleInfo :: ECapabilitySatellite)   
  6579 	        {																//as part of out parm list
  7013             {																//as part of out parm list
  6580 	        TInt8 satinfo  = 0;
  7014             TInt8 satinfo  = 0;
  6581 
  7015 
  6582 	        if(!currPos->GetValue(EPositionFieldSatelliteNumInView , satinfo))
  7016             if(!currPos->GetValue(EPositionFieldSatelliteNumInView , satinfo))
  6583 	            {
  7017                 {
  6584 	            TBuf8<50> buf ;
  7018                 TBuf8<50> buf ;
  6585 				TRealFormat format ;
  7019                 TRealFormat format ;
  6586 				buf.Num(satinfo , format) ;
  7020                 buf.Num(satinfo , format) ;
  6587 				OpenFile();
  7021                 OpenFile();
  6588 				LogFile.Write(_L8("SatelliteNumInView = "));
  7022                 LogFile.Write(_L8("SatelliteNumInView = "));
  6589 				LogFile.Write(buf) ;
  7023                 LogFile.Write(buf) ;
  6590 				LogFile.Write(_L8("\n")) ;
  7024                 LogFile.Write(_L8("\n")) ;
  6591 				CloseFile();
  7025                 CloseFile();
  6592 	            }
  7026                 }
  6593 	        /* else
  7027             /* else
  6594 	         	{
  7028 	         	{
  6595 	         	returnCode = KErrGeneral;
  7029 	         	returnCode = KErrGeneral;
  6596 	         	}
  7030 	         	}
  6597 	        */
  7031              */
  6598 	        }
  7032             }
  6599 
  7033 
  6600 	    if( (currCapability & TPositionModuleInfo :: ECapabilityDirection) && returnCode == KErrNone) //Extract direction info if any and append it 
  7034         if( (currCapability & TPositionModuleInfo :: ECapabilityDirection) && returnCode == KErrNone) //Extract direction info if any and append it 
  6601 	        {                                                               // as part of out parm list
  7035             {                                                               // as part of out parm list
  6602 	        TReal32 direcinfo = 0;
  7036             TReal32 direcinfo = 0;
  6603 
  7037 
  6604 	        if(!currPos->GetValue(EPositionFieldTrueCourse , direcinfo) )
  7038             if(!currPos->GetValue(EPositionFieldTrueCourse , direcinfo) )
  6605 	            {
  7039                 {
  6606 	            TBuf8<50> buf ;
  7040                 TBuf8<50> buf ;
  6607 				TRealFormat format ;
  7041                 TRealFormat format ;
  6608 				buf.Num(direcinfo , format) ;
  7042                 buf.Num(direcinfo , format) ;
  6609 				OpenFile();
  7043                 OpenFile();
  6610 				LogFile.Write(_L8("TrueCourse  = "));
  7044                 LogFile.Write(_L8("TrueCourse  = "));
  6611 				LogFile.Write(buf) ;
  7045                 LogFile.Write(buf) ;
  6612 				LogFile.Write(_L8("\n")) ;
  7046                 LogFile.Write(_L8("\n")) ;
  6613 				CloseFile();
  7047                 CloseFile();
  6614 	            }
  7048                 }
  6615 
  7049 
  6616 	        else if(!currPos->GetValue(EPositionFieldTrueCourseError , direcinfo) )
  7050             else if(!currPos->GetValue(EPositionFieldTrueCourseError , direcinfo) )
  6617 	            {
  7051                 {
  6618 				TBuf8<50> buf ;
  7052                 TBuf8<50> buf ;
  6619 				TRealFormat format ;
  7053                 TRealFormat format ;
  6620 				buf.Num(direcinfo , format) ;
  7054                 buf.Num(direcinfo , format) ;
  6621 				OpenFile();
  7055                 OpenFile();
  6622 				LogFile.Write(_L8("TrueCourseError = "));
  7056                 LogFile.Write(_L8("TrueCourseError = "));
  6623 				LogFile.Write(buf) ;
  7057                 LogFile.Write(buf) ;
  6624 				LogFile.Write(_L8("\n")) ;
  7058                 LogFile.Write(_L8("\n")) ;
  6625 				CloseFile();	            
  7059                 CloseFile();	            
  6626 				}
  7060                 }
  6627 
  7061 
  6628 	        else if(!currPos->GetValue(EPositionFieldMagneticCourseError , direcinfo) )
  7062             else if(!currPos->GetValue(EPositionFieldMagneticCourseError , direcinfo) )
  6629 	            {
  7063                 {
  6630 				TBuf8<50> buf ;
  7064                 TBuf8<50> buf ;
  6631 				TRealFormat format ;
  7065                 TRealFormat format ;
  6632 				buf.Num(direcinfo , format) ;
  7066                 buf.Num(direcinfo , format) ;
  6633 				OpenFile();
  7067                 OpenFile();
  6634 				LogFile.Write(_L8("MagneticCourseError = "));
  7068                 LogFile.Write(_L8("MagneticCourseError = "));
  6635 				LogFile.Write(buf) ;
  7069                 LogFile.Write(buf) ;
  6636 				LogFile.Write(_L8("\n")) ;
  7070                 LogFile.Write(_L8("\n")) ;
  6637 				CloseFile();	           
  7071                 CloseFile();	           
  6638 				}
  7072                 }
  6639 
  7073 
  6640 	        else if(!currPos->GetValue(EPositionFieldMagneticCourse , direcinfo) )
  7074             else if(!currPos->GetValue(EPositionFieldMagneticCourse , direcinfo) )
  6641 	            {
  7075                 {
  6642 				TBuf8<50> buf ;
  7076                 TBuf8<50> buf ;
  6643 				TRealFormat format ;
  7077                 TRealFormat format ;
  6644 				buf.Num(direcinfo , format) ;
  7078                 buf.Num(direcinfo , format) ;
  6645 				OpenFile();
  7079                 OpenFile();
  6646 				LogFile.Write(_L8("MagneticCourse = "));
  7080                 LogFile.Write(_L8("MagneticCourse = "));
  6647 				LogFile.Write(buf) ;
  7081                 LogFile.Write(buf) ;
  6648 				LogFile.Write(_L8("\n")) ;
  7082                 LogFile.Write(_L8("\n")) ;
  6649 				CloseFile();	 	            
  7083                 CloseFile();	 	            
  6650 				}
  7084                 }
  6651 			/*else
  7085             /*else
  6652 				{
  7086 				{
  6653 				returnCode = KErrGeneral;
  7087 				returnCode = KErrGeneral;
  6654 				}
  7088 				}
  6655              */
  7089              */
  6656 	        }
  7090             }
  6657 
  7091 
  6658 
  7092 
  6659 	    //if((currCapability & TPositionModuleInfo :: ECapabilityCompass) && returnCode == KErrNone) //Extract compass info if any and append it 
  7093         //if((currCapability & TPositionModuleInfo :: ECapabilityCompass) && returnCode == KErrNone) //Extract compass info if any and append it 
  6660 	      if(currCapability & TPositionModuleInfo :: ECapabilityCompass)
  7094         if(currCapability & TPositionModuleInfo :: ECapabilityCompass)
  6661 	        {                                                               // as part of out parm list
  7095             {                                                               // as part of out parm list
  6662 	        TReal32 compassinfo ;
  7096             TReal32 compassinfo ;
  6663 
  7097 
  6664 	        if(!currPos->GetValue(EPositionFieldHeading , compassinfo) )
  7098             if(!currPos->GetValue(EPositionFieldHeading , compassinfo) )
  6665 	            {
  7099                 {
  6666 				TBuf8<50> buf ;
  7100                 TBuf8<50> buf ;
  6667 				TRealFormat format ;
  7101                 TRealFormat format ;
  6668 				buf.Num(compassinfo , format) ;
  7102                 buf.Num(compassinfo , format) ;
  6669 				OpenFile();
  7103                 OpenFile();
  6670 				LogFile.Write(_L8("FieldHeading = "));
  7104                 LogFile.Write(_L8("FieldHeading = "));
  6671 				LogFile.Write(buf) ;
  7105                 LogFile.Write(buf) ;
  6672 				LogFile.Write(_L8("\n")) ;
  7106                 LogFile.Write(_L8("\n")) ;
  6673 				CloseFile();	           
  7107                 CloseFile();	           
  6674 				}
  7108                 }
  6675 
  7109 
  6676 
  7110 
  6677 	        else if(!currPos->GetValue(EPositionFieldHeadingError , compassinfo) )
  7111             else if(!currPos->GetValue(EPositionFieldHeadingError , compassinfo) )
  6678 	            {
  7112                 {
  6679 				TBuf8<50> buf ;
  7113                 TBuf8<50> buf ;
  6680 				TRealFormat format ;
  7114                 TRealFormat format ;
  6681 				buf.Num(compassinfo , format) ;
  7115                 buf.Num(compassinfo , format) ;
  6682 				OpenFile();
  7116                 OpenFile();
  6683 				LogFile.Write(_L8("FieldHeadingError = "));
  7117                 LogFile.Write(_L8("FieldHeadingError = "));
  6684 				LogFile.Write(buf) ;
  7118                 LogFile.Write(buf) ;
  6685 				LogFile.Write(_L8("\n")) ;
  7119                 LogFile.Write(_L8("\n")) ;
  6686 				CloseFile();		           
  7120                 CloseFile();		           
  6687 				}
  7121                 }
  6688 
  7122 
  6689 	        else if(!currPos->GetValue(EPositionFieldMagneticHeading , compassinfo) )
  7123             else if(!currPos->GetValue(EPositionFieldMagneticHeading , compassinfo) )
  6690 	            {
  7124                 {
  6691 				TBuf8<50> buf ;
  7125                 TBuf8<50> buf ;
  6692 				TRealFormat format ;
  7126                 TRealFormat format ;
  6693 				buf.Num(compassinfo , format) ;
  7127                 buf.Num(compassinfo , format) ;
  6694 				OpenFile();
  7128                 OpenFile();
  6695 				LogFile.Write(_L8("MagneticHeading = "));
  7129                 LogFile.Write(_L8("MagneticHeading = "));
  6696 				LogFile.Write(buf) ;
  7130                 LogFile.Write(buf) ;
  6697 				LogFile.Write(_L8("\n")) ;
  7131                 LogFile.Write(_L8("\n")) ;
  6698 				CloseFile();		           
  7132                 CloseFile();		           
  6699 				}
  7133                 }
  6700 	
  7134 
  6701 	        else if(!currPos->GetValue(EPositionFieldMagneticHeadingError , compassinfo) )
  7135             else if(!currPos->GetValue(EPositionFieldMagneticHeadingError , compassinfo) )
  6702 	            {
  7136                 {
  6703 				TBuf8<50> buf ;
  7137                 TBuf8<50> buf ;
  6704 				TRealFormat format ;
  7138                 TRealFormat format ;
  6705 				buf.Num(compassinfo , format) ;
  7139                 buf.Num(compassinfo , format) ;
  6706 				OpenFile();
  7140                 OpenFile();
  6707 				LogFile.Write(_L8("MagneticHeadingError = "));
  7141                 LogFile.Write(_L8("MagneticHeadingError = "));
  6708 				LogFile.Write(buf) ;
  7142                 LogFile.Write(buf) ;
  6709 				LogFile.Write(_L8("\n")) ;
  7143                 LogFile.Write(_L8("\n")) ;
  6710 				CloseFile();	            
  7144                 CloseFile();	            
  6711 				}
  7145                 }
  6712 
  7146 
  6713 			/*else
  7147             /*else
  6714 				{
  7148 				{
  6715 				returnCode = KErrGeneral; 
  7149 				returnCode = KErrGeneral; 
  6716 				}
  7150 				}
  6717             */  
  7151              */  
  6718 	        }
  7152             }
  6719 
  7153 
  6720 	    //if( (currCapability & TPositionModuleInfo :: ECapabilityNmea) && returnCode == KErrNone )//Extract Nmea info if any and append it 	
  7154         //if( (currCapability & TPositionModuleInfo :: ECapabilityNmea) && returnCode == KErrNone )//Extract Nmea info if any and append it 	
  6721 	      if(currCapability & TPositionModuleInfo :: ECapabilityNmea)  
  7155         if(currCapability & TPositionModuleInfo :: ECapabilityNmea)  
  6722 	      		{                                                             //as part of out param list  
  7156             {                                                             //as part of out param list  
  6723 	        	TUint8 numSentences ;
  7157             TUint8 numSentences ;
  6724 				TBuf8 <20> nmeaSentences ;
  7158             TBuf8 <20> nmeaSentences ;
  6725 	        	if(!currPos->GetValue(EPositionFieldNMEASentences , numSentences) )
  7159             if(!currPos->GetValue(EPositionFieldNMEASentences , numSentences) )
  6726 	            {
  7160                 {
  6727 				TBuf8<50> buf ;
  7161                 TBuf8<50> buf ;
  6728 				TRealFormat format ;
  7162                 TRealFormat format ;
  6729 				buf.Num(numSentences , format) ;
  7163                 buf.Num(numSentences , format) ;
  6730 				OpenFile();
  7164                 OpenFile();
  6731 				LogFile.Write(_L8("NMEASentences = "));
  7165                 LogFile.Write(_L8("NMEASentences = "));
  6732 				LogFile.Write(buf) ;
  7166                 LogFile.Write(buf) ;
  6733 				LogFile.Write(_L8("\n")) ;
  7167                 LogFile.Write(_L8("\n")) ;
  6734 				CloseFile();	            
  7168                 CloseFile();	            
  6735 				}
  7169                 }
  6736 
  7170 
  6737 	       else if(!currPos->GetValue(EPositionFieldNMEASentencesStart , nmeaSentences) )
  7171             else if(!currPos->GetValue(EPositionFieldNMEASentencesStart , nmeaSentences) )
  6738 	            {
  7172                 {
  6739 				TRealFormat format ;
  7173                 TRealFormat format ;
  6740 				OpenFile();
  7174                 OpenFile();
  6741 				LogFile.Write(_L8("NMEASentencesStart = "));
  7175                 LogFile.Write(_L8("NMEASentencesStart = "));
  6742 				LogFile.Write(nmeaSentences) ;
  7176                 LogFile.Write(nmeaSentences) ;
  6743 				LogFile.Write(_L8("\n")) ;
  7177                 LogFile.Write(_L8("\n")) ;
  6744 				CloseFile();	            
  7178                 CloseFile();	            
  6745 				}
  7179                 }
  6746 		/*	else
  7180             /*	else
  6747 				{
  7181 				{
  6748 				returnCode = KErrGeneral;
  7182 				returnCode = KErrGeneral;
  6749 				}
  7183 				}
  6750 	     */ 
  7184              */ 
  6751 	        }
  7185             }
  6752 
  7186 
  6753 	    }
  7187         }
  6754    else
  7188     else
  6755 	   	{
  7189         {
  6756    		OpenFile();
  7190         OpenFile();
  6757    		LogFile.Write(_L8("Failed..\n"));
  7191         LogFile.Write(_L8("Failed..\n"));
  6758    		CloseFile();
  7192         CloseFile();
  6759    		returnCode = KErrGeneral;
  7193         returnCode = KErrGeneral;
  6760 	   	}
  7194         }
  6761     
  7195 
  6762     CActiveScheduler *Current = CActiveScheduler :: Current() ;
  7196     CActiveScheduler *Current = CActiveScheduler :: Current() ;
  6763 	Current->Stop() ;
  7197     Current->Stop() ;
  6764 	return KErrNone ;
  7198     return KErrNone ;
  6765 	}
  7199     }
  6766 
  7200 
  6767 TInt ModinfoFunctionL()
  7201 TInt ModinfoFunctionL()
  6768 	{
  7202     {
       
  7203     __UHEAP_MARK ;
  6769     CLocationService *CoreObj = CLocationService ::NewL() ;
  7204     CLocationService *CoreObj = CLocationService ::NewL() ;
  6770     
  7205 
  6771     if( NULL == CoreObj )
  7206     if( NULL == CoreObj )
  6772     	{
  7207         {
  6773     	OpenFile();
  7208         OpenFile();
  6774 	    LogFile.Write(_L8("\n<Modinfo1 Test>\n"));
  7209         LogFile.Write(_L8("\n<Modinfo1 Test>\n"));
  6775 	    LogFile.Write(_L8("Failed..\n"));
  7210         LogFile.Write(_L8("Failed..\n"));
  6776 	    CloseFile();
  7211         CloseFile();
  6777    		return KErrGeneral;
  7212         return KErrGeneral;
  6778    		}
  7213         }
  6779     
  7214 
  6780     _LIT(Kidentity ,"Coreclass Testing" ) ;
  7215     _LIT(Kidentity ,"Coreclass Testing" ) ;
  6781     //not needed any more
  7216     //not needed any more
  6782 	/*RRequestorStack aRequestorStack;
  7217     /*RRequestorStack aRequestorStack;
  6783 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  7218 	const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ;
  6784     aRequestorStack.Insert(identityInfo,0);
  7219     aRequestorStack.Insert(identityInfo,0);
  6785     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  7220     CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/
  6786 		
  7221 
  6787     Modinfo1CallBack MyUpdates(CoreObj)  ;
  7222     Modinfo1CallBack MyUpdates(25,GETLOCATION,CoreObj)  ;
  6788     CoreObj->GetLocationL(&MyUpdates) ;
  7223     CoreObj->GetLocationL(&MyUpdates) ;
  6789     CActiveScheduler :: Start() ;
  7224     CActiveScheduler :: Start() ;
  6790      /*aRequestorStack.Close();
  7225     /*aRequestorStack.Close();
  6791 	    delete identityInfo;*/
  7226 	    delete identityInfo;*/
  6792 	    delete CoreObj;
  7227     delete CoreObj;
       
  7228     __UHEAP_MARKEND ;
  6793     return 0;
  7229     return 0;
  6794 	}
  7230     }
  6795 
  7231 
  6796 TInt CSAPILocTest::Modinfo1( CStifItemParser& /*aItem*/ )
  7232 TInt CSAPILocTest::Modinfo1( CStifItemParser& /*aItem*/ )
  6797 	{
  7233     {
  6798     TRequestStatus status = KRequestPending;
  7234     TRequestStatus status = KRequestPending;
  6799     TInt aRet = KErrNone;
  7235     TInt aRet = KErrNone;
  6800     returnCode = KErrNone;
  7236     returnCode = KErrNone;
  6801     // Print to UI
  7237     // Print to UI
  6802     _LIT( KSAPILocTest, "SAPILocTest" );
  7238     _LIT( KSAPILocTest, "SAPILocTest" );
  6803     _LIT( KExample, "Modinfo1" );
  7239     _LIT( KExample, "Modinfo1" );
  6804     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  7240     TestModuleIf().Printf( 0, KSAPILocTest, KExample );
  6805     
  7241 
  6806      __UHEAP_MARK;
  7242     __UHEAP_MARK;
  6807     
  7243 
  6808     TRAPD(err , aRet = ModinfoFunctionL()) ;
  7244     TRAPD(err , aRet = ModinfoFunctionL()) ;
  6809     if( err || aRet )
  7245     if( err || aRet )
  6810     returnCode = KErrGeneral; 
  7246         returnCode = KErrGeneral; 
  6811     
  7247 
  6812     __UHEAP_MARKEND;
  7248     __UHEAP_MARKEND;
  6813  
  7249 
  6814     return returnCode;  
  7250     return returnCode;  
  6815     }
  7251     }
  6816     
  7252 
  6817