lbs/common/src/ctlbsportedstepbase.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 #include "ctlbsportedstepbase.h"
       
    19 #include "ctlbsportedsuitedefs.h"
       
    20 
       
    21 /*
       
    22 * ============================================================================
       
    23 * ============================================================================
       
    24 */
       
    25 
       
    26 //  INCLUDES
       
    27 #include <TestExecuteStepBase.h>
       
    28 #include <EPos_CPosModules.h>
       
    29 #include <EPos_CPosModuleUpdate.h>
       
    30 #include <EPos_CPosModuleIdList.h>
       
    31 #include <SimulationPSYInternalCRKeys.h>
       
    32 #include "ctlbsclientlog.h"
       
    33 
       
    34 // Device driver constants
       
    35 
       
    36 TVerdict CT_LbsPortedStepBase::doTestStepPreambleL()
       
    37 /**
       
    38  * @return - TVerdict
       
    39  * Implementation of CTestStep base class virtual
       
    40  * It is used for doing all initialisation common to derived classes in here.
       
    41  * Make it being able to leave if there are any errors here as there's no point in
       
    42  * trying to run a test step if anything fails.
       
    43  * The leave will be picked up by the framework.
       
    44  */
       
    45 	{
       
    46 	// process some common pre setting to test steps then set SetTestStepResult to EFail or Epass.
       
    47 	SetTestStepResult(EPass);
       
    48 	return TestStepResult();
       
    49 	}
       
    50 
       
    51 TVerdict CT_LbsPortedStepBase::doTestStepPostambleL()
       
    52 /**
       
    53  * @return - TVerdict
       
    54  * Implementation of CTestStep base class virtual
       
    55  * It is used for doing all after test treatment common to derived classes in here.
       
    56  * Make it being able to leave
       
    57  * The leave will be picked up by the framework.
       
    58  */
       
    59 	{
       
    60 	// process some common post setting to test steps then set SetTestStepResult to EFail or Epass.
       
    61 	// SetTestStepResult(EPass);  // or EFail
       
    62 	return TestStepResult();
       
    63 	}
       
    64 
       
    65 // ================= MEMBER FUNCTIONS =======================
       
    66 
       
    67 // C++ default constructor can NOT contain any code, that
       
    68 // might leave.
       
    69 //
       
    70 CT_LbsPortedStepBase::CT_LbsPortedStepBase(CT_LbsServer& aParent): CT_LbsStep(aParent)
       
    71     {
       
    72     iUidExternalGps.iUid 		= KUidExternalGps;
       
    73     iUidManualInput.iUid 		= KUidManualInput;
       
    74     iUidDefault.iUid 			= KUidDefault;
       
    75     iUidStrategy.iUid 			= KUidStrategy;
       
    76     iUidStubPositioner.iUid 	= KUidStubPositioner;
       
    77     iUidSimulationPsy.iUid 		= KUidSimulationPsy;
       
    78     iUidDynDbTestPsy.iUid 		= KUidDynDbTestPsy;      
       
    79     iUidInstallTestPsy.iUid 	= KUidInstallTestPsy;
       
    80     iUidTestPsySimulateIsa.iUid = KUidTestPsySimulateIsa;
       
    81     iUidTestPsy1.iUid       	= KUidTestPsy1;         
       
    82     iUidTestPsy2.iUid       	= KUidTestPsy2;        
       
    83     iUidTestPsy3.iUid       	= KUidTestPsy3;
       
    84     iUidTestPsy4.iUid       	= KUidTestPsy4;        
       
    85     iUidTestPsy5.iUid       	= KUidTestPsy5;        
       
    86     iUidTestPsy6.iUid       	= KUidTestPsy6;         
       
    87     iUidTestPsy7.iUid       	= KUidTestPsy7;         
       
    88     iUidTestPsy8.iUid       	= KUidTestPsy8;         
       
    89     iUidTestPsy9.iUid       	= KUidTestPsy9;         
       
    90     iUidTestPsy10.iUid      	= KUidTestPsy10;         
       
    91     iUidTestPsy11.iUid      	= KUidTestPsy11;         
       
    92     iUidTestPsy12.iUid      	= KUidTestPsy12;
       
    93     iUidTestPsy13.iUid      	= KUidTestPsy13;
       
    94     iUidTestPsyTp176.iUid   	= KUidTestPsyTp176;
       
    95     iUidMultiPsy.iUid       	= KUidMultiPsy;
       
    96     iUidTestPsy256.iUid     	= KUidTestPsy256;        
       
    97     iUidExamplePsy.iUid     	= KUidExamplePsy;
       
    98     iUidTestStatusPsy.iUid  	= KUidTestStatusPsy;
       
    99     iUidTestTimerPsy.iUid   	= KUidTestTimerPsy;
       
   100     iUidPanicPsy.iUid          	= KUidPanicPsy;
       
   101     iUidPsySwitching.iUid      	= KUidPsySwitching;
       
   102     iUidTestPsyPartialUpdate.iUid  = KUidTestPsyPartialUpdate;
       
   103     iUidTestPsyMaxAge.iUid     	= KUidTestPsyMaxAge;
       
   104     iUidTestRangePsy.iUid      	= KUidTestRangePsy;
       
   105     iUidTestSingPsy.iUid       	= KUidTestSingPsy;
       
   106     iUidTestTrackingPsy.iUid   	= KUidTestTrackingPsy;
       
   107     iUidTestProxyPsy1.iUid     	= KTestProxyPsy1;
       
   108     iUidTestProxyPsy2.iUid     	= KTestProxyPsy2;
       
   109     iUidTestProxyPsy3.iUid     	= KTestProxyPsy3;
       
   110     iUidTestProxyPsy4.iUid     	= KTestProxyPsy4;
       
   111     iUidInstallPsyTp273.iUid   	= KInstallPsyTp273;
       
   112     iUidPartialUpdate2.iUid    	= KUidTestPsyPartialUpdate2; 
       
   113     iUidSatInfoPsy.iUid        	= KUidSatInfoPsy;
       
   114     iUidBtgPsy.iUid            	= KUidBtgPsy;
       
   115     iUidIgPsy.iUid             	= KUidIgPsy;
       
   116     }
       
   117 
       
   118 // Destructor
       
   119 CT_LbsPortedStepBase::~CT_LbsPortedStepBase()
       
   120     {
       
   121     iPositioner.Close();
       
   122     iPosServer.Close();
       
   123     delete iScheduler;
       
   124     iFileServer.Close();   
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------
       
   128 // CT_LbsPortedStepBase::StartL
       
   129 //
       
   130 // (other items were commented in a header).
       
   131 // ---------------------------------------------------------
       
   132 //
       
   133 void CT_LbsPortedStepBase::StartL(TInt aIndex)
       
   134     {
       
   135     if (aIndex == 0)
       
   136         {
       
   137         __UHEAP_MARK;
       
   138         
       
   139         iLog = CT_LbsClientLog::NewL(Logger());
       
   140         
       
   141 	// Give extra time for epos server to shut down after previous tests:
       
   142 	User::After(2000000);
       
   143         TRAPD(err, InitTestL());
       
   144         if (err == KErrNone)
       
   145             {
       
   146             TRAP(err, StartL());
       
   147             }
       
   148         CloseTest();
       
   149         
       
   150         delete iLog;
       
   151         __UHEAP_MARKEND;
       
   152         
       
   153         if (err != KErrNone)
       
   154             {
       
   155             User::Leave(err); // Not using LeaveIfError to allow positive error codes
       
   156             }
       
   157         }
       
   158     }
       
   159 
       
   160 // ---------------------------------------------------------
       
   161 // CT_LbsPortedStepBase::SetupPsyL
       
   162 //
       
   163 // (other items were commented in a header).
       
   164 // ---------------------------------------------------------
       
   165 //
       
   166 void CT_LbsPortedStepBase::SetupPsyL(const TUid aPsyUid,
       
   167                            TPosSetupPsyDirective /*aDirective*/)
       
   168     {
       
   169     CPosModules* db = CPosModules::OpenL();
       
   170     CleanupStack::PushL(db);
       
   171     CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC();
       
   172 
       
   173     moduleUpdate->SetUpdateAvailability(EFalse);
       
   174     CPosModuleIdList* prioList = db->ModuleIdListLC();
       
   175 
       
   176     // Disable all PSY:s except aPsyUid
       
   177     for (TInt i = 0 ; i < prioList->Count(); i++)
       
   178         {
       
   179         if ((*prioList)[i] != aPsyUid)
       
   180             {
       
   181             db->UpdateModuleL((*prioList)[i], *moduleUpdate);
       
   182             }
       
   183         }
       
   184 
       
   185     // Enable the PSY that came as an in parameter
       
   186     moduleUpdate->SetUpdateAvailability(ETrue);
       
   187     db->UpdateModuleL(aPsyUid, *moduleUpdate);
       
   188 
       
   189     CleanupStack::PopAndDestroy(prioList);
       
   190     CleanupStack::PopAndDestroy(moduleUpdate);
       
   191     CleanupStack::PopAndDestroy(db);
       
   192     }
       
   193 // ---------------------------------------------------------
       
   194 // CT_LbsPortedStepBase::InitTestL
       
   195 //
       
   196 // (other items were commented in a header).
       
   197 // ---------------------------------------------------------
       
   198 //
       
   199 void CT_LbsPortedStepBase::InitTestL()
       
   200     {
       
   201     }
       
   202 
       
   203 // ---------------------------------------------------------
       
   204 // CT_LbsPortedStepBase::CloseTest
       
   205 //
       
   206 // (other items were commented in a header).
       
   207 // ---------------------------------------------------------
       
   208 //
       
   209 void CT_LbsPortedStepBase::CloseTest()
       
   210     {
       
   211     }
       
   212 
       
   213 // ---------------------------------------------------------
       
   214 // CTe_LbsPortedStepBase::ConnectL
       
   215 //
       
   216 // (other items were commented in a header).
       
   217 // ---------------------------------------------------------
       
   218 //
       
   219 void CT_LbsPortedStepBase::ConnectL()
       
   220 	{
       
   221 	TInt err = iPosServer.Connect();
       
   222 	if (err != KErrNone)
       
   223 		{
       
   224 		_LIT(KOpenError,
       
   225 			"TP%d, part %d failed. Unable to open connection to Epos, err = %d");
       
   226 		TBuf<100> error;
       
   227 		error.Format(KOpenError, iModuleId, iNrOfRequests, err);
       
   228 		LogErrorAndLeaveL(error);
       
   229 		}
       
   230 	}
       
   231 
       
   232 // ---------------------------------------------------------
       
   233 // CT_LbsPortedStepBase::OpenPositionerByName
       
   234 //
       
   235 // (other items were commented in a header).
       
   236 // ---------------------------------------------------------
       
   237 //
       
   238 TInt CT_LbsPortedStepBase::OpenPositionerByName(
       
   239                                   const TUid aPsyUid)
       
   240 	{
       
   241 	TInt err = iPositioner.Open(iPosServer, aPsyUid);
       
   242 	return err;
       
   243 	}
       
   244 
       
   245 // ---------------------------------------------------------
       
   246 // CT_LbsPortedStepBase::OpenPositionerL
       
   247 //
       
   248 // (other items were commented in a header).
       
   249 // ---------------------------------------------------------
       
   250 //
       
   251 TInt CT_LbsPortedStepBase::OpenPositioner()
       
   252 	{
       
   253 	TInt err = iPositioner.Open(iPosServer);
       
   254 	return err;
       
   255 	}
       
   256 
       
   257 // ---------------------------------------------------------
       
   258 // CT_LbsPortedStepBase::ClosePositioner
       
   259 //
       
   260 // (other items were commented in a header).
       
   261 // ---------------------------------------------------------
       
   262 //
       
   263 void CT_LbsPortedStepBase::ClosePositioner()
       
   264     {
       
   265     iPositioner.Close();
       
   266     }
       
   267 
       
   268 // ---------------------------------------------------------
       
   269 // CT_LbsPortedStepBase::Disconnect
       
   270 //
       
   271 // (other items were commented in a header).
       
   272 // ---------------------------------------------------------
       
   273 //
       
   274 void CT_LbsPortedStepBase::Disconnect()
       
   275     {
       
   276     iPosServer.Close();
       
   277     }
       
   278 
       
   279 // ---------------------------------------------------------
       
   280 // CT_LbsPortedStepBase::PerformRequest
       
   281 // (other items were commented in a header).
       
   282 // ---------------------------------------------------------
       
   283 //
       
   284 void CT_LbsPortedStepBase::PerformRequestL(const TDesC& aRequestor,
       
   285             CRequestor::_TRequestorType aRequestorType,
       
   286           CRequestor::_TRequestorFormat aRequestorFormat)
       
   287     {
       
   288     iNrOfRequests++;
       
   289 
       
   290     iModuleInfo = TPositionInfo();
       
   291     TInt err = iPositioner.SetRequestor(aRequestorType,
       
   292                              aRequestorFormat, aRequestor);
       
   293     if (err != KErrNone)
       
   294         {
       
   295         _LIT(KErrRequestor, "Error when setting requestor in PerformRequestL");
       
   296         LogErrorAndLeaveL(KErrRequestor, err);
       
   297         }
       
   298 
       
   299     iPositioner.NotifyPositionUpdate(iModuleInfo, iStatus);
       
   300     }
       
   301 
       
   302 // ---------------------------------------------------------
       
   303 // CTe_LbsPortedStepBase::PerformRequestL
       
   304 // (other items were commented in a header).
       
   305 // ---------------------------------------------------------
       
   306 //
       
   307 void CT_LbsPortedStepBase::PerformRequestL(
       
   308     const TDesC& aService, const TDesC& aContact,
       
   309     CRequestor::_TRequestorType aServiceIdType,
       
   310     CRequestor::_TRequestorType aContactIdType,
       
   311     CRequestor::_TRequestorFormat aServiceFormat,
       
   312     CRequestor::_TRequestorFormat aContactFormat)
       
   313 	{
       
   314 	CRequestor* contactId = 
       
   315         CRequestor::New(aContactIdType, aContactFormat, 
       
   316                     aContact);
       
   317 
       
   318 	CRequestor* servId = 
       
   319     	CRequestor::New(aServiceIdType, aServiceFormat, 
       
   320                     aService);
       
   321     
       
   322 	RRequestorStack stack = RRequestorStack();
       
   323   	stack.Append(contactId);
       
   324   	stack.Append(servId);
       
   325 
       
   326   	CleanupStack::PushL(contactId);
       
   327   	CleanupStack::PushL(servId);
       
   328 
       
   329   	iNrOfRequests++;
       
   330 
       
   331   	TInt err = iPositioner.SetRequestor(stack);
       
   332   	stack.Close();
       
   333   	if (err != KErrNone)
       
   334         {
       
   335         _LIT(KErrRequestor, "Error when setting requestor in PerformRequestL");
       
   336         LogErrorAndLeaveL(KErrRequestor, err);
       
   337         }
       
   338   
       
   339   	CleanupStack::PopAndDestroy(servId);
       
   340   	CleanupStack::PopAndDestroy(contactId);
       
   341   	iModuleInfo = TPositionInfo();
       
   342   	iPositioner.NotifyPositionUpdate(iModuleInfo, iStatus);
       
   343 	}
       
   344 
       
   345 // ---------------------------------------------------------
       
   346 // CT_LbsPortedStepBase::PerformSyncRequestL
       
   347 // 
       
   348 // (other items were commented in a header).
       
   349 // ---------------------------------------------------------
       
   350 //
       
   351 TInt CT_LbsPortedStepBase::PerformSyncRequest(
       
   352                             const TDesC& aServiceName,
       
   353                             TPositionInfoBase* aModuleInfo)
       
   354   {
       
   355   iNrOfRequests++;
       
   356   iPositioner.SetRequestor(CRequestor::ERequestorService,
       
   357                            CRequestor::EFormatApplication, aServiceName);
       
   358 
       
   359   iPositioner.NotifyPositionUpdate(*aModuleInfo, iStatus);
       
   360   
       
   361   User::WaitForRequest(iStatus);
       
   362   TInt err = iStatus.Int();
       
   363   return err;
       
   364   }
       
   365 
       
   366 // ---------------------------------------------------------
       
   367 // CT_LbsPortedStepBase::CheckRequestResultL
       
   368 //
       
   369 // (other items were commented in a header).
       
   370 // ---------------------------------------------------------
       
   371 //
       
   372 void CT_LbsPortedStepBase::CheckRequestResultL(TInt aExpectedErrorCode, TBool aLogFlag)
       
   373     {
       
   374     User::WaitForRequest(iStatus);
       
   375 
       
   376     if (iStatus != aExpectedErrorCode)
       
   377         {
       
   378         _LIT(KError, "TP%d, request %d failed. iStatus = %d");
       
   379         TBuf<100> error;
       
   380         error.Format(KError, iModuleId, iNrOfRequests, iStatus.Int());
       
   381         LogErrorAndLeaveL(error);
       
   382         }
       
   383     else {
       
   384         if (aLogFlag)
       
   385             {
       
   386             _LIT(KMsg, "TP%d, part %d completed.");
       
   387             TBuf<30> msg;
       
   388             msg.Format(KMsg, iModuleId, iNrOfRequests);
       
   389             INFO_PRINTF1(msg);
       
   390             }
       
   391         }    
       
   392     }
       
   393 
       
   394 // ---------------------------------------------------------
       
   395 // CT_LbsPortedStepBase::AssertTrueL
       
   396 //
       
   397 // (other items were commented in a header).
       
   398 // ---------------------------------------------------------
       
   399 //
       
   400 void CT_LbsPortedStepBase::AssertTrueL(TBool aCondition, 
       
   401 	const TDesC& aErrorMsg, TInt aErrorCode)
       
   402 	{
       
   403 	if (!aCondition)
       
   404         {
       
   405         TBuf<100> buf;
       
   406         buf.Format(aErrorMsg, aErrorCode);
       
   407         LogErrorAndLeaveL(buf);
       
   408         }
       
   409 	}
       
   410 
       
   411 // ---------------------------------------------------------
       
   412 // CT_LbsPortedStepBase::AssertTrueL
       
   413 //
       
   414 // (other items were commented in a header).
       
   415 // ---------------------------------------------------------
       
   416 //
       
   417 void CT_LbsPortedStepBase::AssertTrueL(TBool aCondition, 
       
   418 	const TDesC& aErrorMsg)
       
   419 	{
       
   420 	if (!aCondition)
       
   421         {
       
   422         LogErrorAndLeaveL(aErrorMsg);
       
   423         }
       
   424 	}
       
   425 
       
   426 // ---------------------------------------------------------
       
   427 // CTe_LbsPortedStepBase::AllocPositionInfoL
       
   428 //
       
   429 // (other items were commented in a header).
       
   430 // ---------------------------------------------------------
       
   431 //
       
   432 TPositionInfo CT_LbsPortedStepBase::AllocPositionInfoL()
       
   433     {
       
   434     TPositionInfo moduleInfo = TPositionInfo();
       
   435     iPositioner.GetLastKnownPosition(moduleInfo, iStatus);
       
   436     return moduleInfo;
       
   437     }
       
   438 
       
   439 // ---------------------------------------------------------
       
   440 // CT_LbsPortedStepBase::VerifyPsyLoadedL
       
   441 //
       
   442 // (other items were commented in a header).
       
   443 // ---------------------------------------------------------
       
   444 //
       
   445 void CT_LbsPortedStepBase::VerifyPsyLoadedL(TPositionModuleId aUid)                           
       
   446     {
       
   447     _LIT(KVerPSYLoaded, "Verifies if PSY: %x, is loaded by getting its status");   
       
   448     TBuf<100> buf;
       
   449     buf.Format(KVerPSYLoaded, aUid.iUid);
       
   450     INFO_PRINTF1(buf);   
       
   451   
       
   452     _LIT(KDevStatusErr, "The PSY has not reported expected Device Status."); 
       
   453     TPositionModuleStatus moduleStatus;
       
   454     iPosServer.GetModuleStatus (moduleStatus, aUid); 
       
   455     AssertTrueL(TPositionModuleStatus::EDeviceReady == moduleStatus.DeviceStatus(), 
       
   456     		KDevStatusErr, KErrGeneral);
       
   457     }
       
   458 
       
   459 // ---------------------------------------------------------
       
   460 // CT_LbsPortedStepBase::VerifyPsyUnloadedL
       
   461 //
       
   462 // (other items were commented in a header).
       
   463 // ---------------------------------------------------------
       
   464 //
       
   465 void CT_LbsPortedStepBase::VerifyPsyUnloadedL(TPositionModuleId aUid)                           
       
   466     {
       
   467     _LIT(KVerPSYUnloaded, "Verifies if PSY: %x, is unloaded by getting its status");   
       
   468     TBuf<100> buf;
       
   469     buf.Format(KVerPSYUnloaded, aUid.iUid);
       
   470     INFO_PRINTF1(buf);   
       
   471     
       
   472     _LIT(KDevStatusErr, "The PSY has not reported expected Device Status."); 
       
   473     TPositionModuleStatus moduleStatus;
       
   474     iPosServer.GetModuleStatus(moduleStatus, aUid); 
       
   475     AssertTrueL(TPositionModuleStatus::EDeviceInactive == moduleStatus.DeviceStatus(), 
       
   476     		KDevStatusErr, KErrGeneral);
       
   477     }
       
   478 
       
   479 // ---------------------------------------------------------
       
   480 // CT_LbsPortedStepBase::RequestL
       
   481 //
       
   482 // (other items were commented in a header).
       
   483 // ---------------------------------------------------------
       
   484 //
       
   485 void CT_LbsPortedStepBase::RequestL(TPositionInfo& aPosInfo, 
       
   486                                     const TInt& aRequestIndex, 
       
   487                                     const TInt& aExpectedErrorCode)
       
   488     {
       
   489     TBuf<100> info;
       
   490     _LIT(KInfo, "Making request: %d");
       
   491     _LIT(KInfoCompCode, "Making request: %d, expecting completion code: %d.");
       
   492     if (aExpectedErrorCode != 999)
       
   493     	{
       
   494         info.Format(KInfoCompCode, aRequestIndex, aExpectedErrorCode);
       
   495     	}
       
   496     else 
       
   497     	{
       
   498         info.Format(KInfo, aRequestIndex);    
       
   499     	}    
       
   500     INFO_PRINTF1(info);
       
   501 
       
   502     aPosInfo.SetUpdateType(aRequestIndex); // Used here as request index
       
   503 
       
   504     TTime starttime, stoptime;
       
   505     starttime.UniversalTime();    
       
   506 
       
   507     TRequestStatus status;
       
   508     iPositioner.NotifyPositionUpdate(aPosInfo, status);
       
   509     User::WaitForRequest(status);
       
   510     
       
   511     stoptime.UniversalTime();
       
   512     iRequestTime = stoptime.Int64() - starttime.Int64();
       
   513 
       
   514     if (aExpectedErrorCode != 999)
       
   515     	{
       
   516         _LIT(KUnexpectedErrCode, "Unexpected error code %d, expected %d.");
       
   517         TBuf<200> buf;
       
   518         buf.Format(KUnexpectedErrCode, status.Int(), aExpectedErrorCode);
       
   519         AssertTrueL(status.Int() == aExpectedErrorCode, buf);
       
   520     	}
       
   521     }
       
   522 
       
   523 // ---------------------------------------------------------
       
   524 // CT_LbsPortedStepBase::LogErrorAndLeave
       
   525 //
       
   526 // (other items were commented in a header).
       
   527 // ---------------------------------------------------------
       
   528 // 
       
   529 EXPORT_C void CT_LbsPortedStepBase::LogErrorAndLeaveL(const TDesC& aErrorInfo,
       
   530                                               const TInt   aReason)
       
   531     {
       
   532     ERR_PRINTF2(aErrorInfo, aReason);
       
   533     User::Leave(aReason);
       
   534     }
       
   535 
       
   536 TVerdict CT_LbsPortedStepBase::doTestStepL()
       
   537 /**
       
   538  * @return - TVerdict code
       
   539  * Override of base class pure virtual
       
   540  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
   541  * not leave. That being the case, the current test result value will be EPass.
       
   542  */
       
   543 	{
       
   544     if (TestStepResult() == EPass)
       
   545         {
       
   546         CActiveScheduler* sched = new (ELeave) CActiveScheduler;
       
   547         sched->Install(sched);
       
   548         CleanupStack::PushL(sched);
       
   549         StartL(0);
       
   550         CleanupStack::PopAndDestroy(sched);
       
   551 
       
   552         SetTestStepResult(EPass);
       
   553         }
       
   554     return TestStepResult();
       
   555 	}
       
   556 
       
   557 // ---------------------------------------------------------
       
   558 // CPosSimulationPSYTestProcedureBase::SetSimDataFile()
       
   559 // 
       
   560 // (other items were commented in a header).
       
   561 // ---------------------------------------------------------
       
   562 //
       
   563 void CT_LbsPortedStepBase::SetSimDataFileL(const TDesC& aFileName)
       
   564     {
       
   565     CRepository* repository =
       
   566     CRepository::NewLC(KCRUidSimulationPSY);
       
   567     TInt err = repository->Set(KCRKeySimPSYSimulationFile,
       
   568                         aFileName);
       
   569     if (err != KErrNone)
       
   570     	{
       
   571     	_LIT(KErr, "CRepository::Set(KCRKeySimPSYSimulationFile...) returned error");
       
   572     	INFO_PRINTF1(KErr);
       
   573     	LogErrorAndLeaveL(KErr);
       
   574     	}
       
   575     	          
       
   576     CleanupStack::PopAndDestroy(repository); 
       
   577     }
       
   578 
       
   579 // ---------------------------------------------------------
       
   580 // CPosSimulationPSYTestProcedureBase::ResetDefaultPSYLastWorkingExtGPSPSYL()
       
   581 // 
       
   582 // (other items were commented in a header).
       
   583 // ---------------------------------------------------------
       
   584 //
       
   585 void CT_LbsPortedStepBase::ResetDefaultPSYLastWorkingExtGPSPSYL()
       
   586     {
       
   587     TPositionModuleId modId = KPositionNullModuleId;
       
   588     
       
   589     CRepository* repos = CRepository::NewL( KCRUidDefaultProxyConfiguration );    
       
   590     TBuf<40> idBuf;
       
   591     idBuf.AppendNumFixedWidth( modId.iUid, EHex, 8);    
       
   592     TInt err = repos->Set(KDefaultProxyLastWorkingGpsPsy, idBuf);
       
   593     delete repos;
       
   594     User::LeaveIfError(err);
       
   595     
       
   596 	_LIT(KInfo, "ResetDefaultPSYLastWorkingExtGPSPSYL successfully executed.");
       
   597 	INFO_PRINTF1(KInfo);
       
   598     }
       
   599 	
       
   600 // ---------------------------------------------------------
       
   601 // CPosSimulationPSYTestProcedureBase::VerifyPositionFromL
       
   602 // 
       
   603 // (other items were commented in a header).
       
   604 // ---------------------------------------------------------
       
   605 //
       
   606 void CT_LbsPortedStepBase::VerifyPositionFromL(TPositionInfo& aPosInfo, 
       
   607 	TPositionModuleId& aModuleId)
       
   608     {
       
   609     if (aModuleId.iUid != aPosInfo.ModuleId().iUid)
       
   610 	   {		
       
   611 	   _LIT(KIncorrPsyErr,
       
   612 	   		"Position from wrong PSY received, got position from: %x, expected: %x.");
       
   613 	   TBuf<200> buf;
       
   614 	   buf.Format(KIncorrPsyErr, aPosInfo.ModuleId().iUid, aModuleId.iUid);
       
   615 	   LogErrorAndLeaveL(buf);
       
   616 	   }    
       
   617     }
       
   618 
       
   619 // ---------------------------------------------------------
       
   620 // CPosSimulationPSYTestProcedureBase::VerifyPositionL
       
   621 // 
       
   622 // (other items were commented in a header).
       
   623 // ---------------------------------------------------------
       
   624 //
       
   625 void CT_LbsPortedStepBase::VerifyPositionL(TPositionInfo& aPosInfo, 
       
   626 	TReal64 aLat, TReal64 aLong, TReal64 aAlt)
       
   627 	{
       
   628 	_LIT(KWrongFix, "Wrong Fix");
       
   629 	TPosition pos;
       
   630 	aPosInfo.GetPosition(pos);
       
   631 	AssertTrueL( aLat == pos.Latitude(), KWrongFix);
       
   632 	AssertTrueL( aLong == pos.Longitude(), KWrongFix);
       
   633 	AssertTrueL( aAlt == pos.Altitude(), KWrongFix);
       
   634 	}
       
   635 
       
   636 // ---------------------------------------------------------
       
   637 // CPosSimulationPSYTestProcedureBase::VerifyRequestTimeLessThanL
       
   638 // 
       
   639 // (other items were commented in a header).
       
   640 // ---------------------------------------------------------
       
   641 //
       
   642 void CT_LbsPortedStepBase::VerifyRequestTimeLessThanL(TInt aExpectedReqTime)
       
   643 	{
       
   644     if (iRequestTime > aExpectedReqTime)
       
   645 	    {
       
   646 	    _LIT(KTime, "Request time for last request was more than: %d");
       
   647 	    TBuf<100> buf;
       
   648 	    buf.Format(KTime, aExpectedReqTime);
       
   649 	    INFO_PRINTF1(buf);
       
   650 	    }
       
   651 	}
       
   652 
       
   653 void CT_LbsPortedStepBase::ConstructL()
       
   654 	{
       
   655 	iScheduler = new ( ELeave ) CActiveScheduler;
       
   656 	CActiveScheduler::Install(iScheduler);
       
   657     User::LeaveIfError(iFileServer.Connect());
       
   658 	}
       
   659 // End of File