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