datasourcemodules/gpspositioningmodule/lbsagpspsy/test/src/te_lbsagpspsyposupdatestep.cpp
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 // Copyright (c) 2008-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // The test step testing simple notify position update scenarios for the AGPS PSY.
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "te_lbsagpspsyposupdatestep.h"
       
    19 #include "te_lbspsyrequest.h"
       
    20 #include "te_lbspsypositioner.h"
       
    21 #include "te_lbspsyresponse.h"
       
    22 #include "te_lbspsystaticdata.h"
       
    23 
       
    24 CTe_LbsAgpsPsyPosUpdateStep* CTe_LbsAgpsPsyPosUpdateStep::NewL(MTe_LbsPsyStaticData* aPsyStaticData)
       
    25 	{
       
    26 	CTe_LbsAgpsPsyPosUpdateStep* self = new(ELeave) CTe_LbsAgpsPsyPosUpdateStep(aPsyStaticData);
       
    27 	return self;
       
    28 	}
       
    29 	
       
    30 CTe_LbsAgpsPsyPosUpdateStep::CTe_LbsAgpsPsyPosUpdateStep(MTe_LbsPsyStaticData* aPsyStaticData) :
       
    31 CTe_LbsNotifyPositionUpdateStep(aPsyStaticData)
       
    32 	{
       
    33 	}
       
    34 
       
    35 void CTe_LbsAgpsPsyPosUpdateStep::ReallyDoTestStepImpL()
       
    36 	{
       
    37 	
       
    38 	CTe_LbsNotifyPositionUpdateStep::ReallyDoTestStepImpL();
       
    39 	
       
    40 	//POSITION UPDATE WITH REF POS (Scenario 4.0)
       
    41 	INFO_PRINTF1(_L("POSITION UPDATE WITH REF POS (Scenario 4.0) START"));
       
    42 	INFO_PRINTF1(_L("Create positioner and the position update object"));
       
    43 	CTe_PsyPositioner* positioner = MakePositionerLC(); 
       
    44 	CTe_PsyRequest* updateRequest = CTe_PsyRequest::NewLC(*this);
       
    45 	
       
    46 	INFO_PRINTF1(_L("Call NotifyPositionUpdate() PSY->ALM"));
       
    47 	updateRequest->NotifyPsyRequest();
       
    48 	positioner->NotifyPositionUpdate();
       
    49 	StartSchedulerWaitL(KUsualTimeout, 1);
       
    50 			
       
    51 	updateRequest->ExpectDefaultUpdateRequest();
       
    52 	updateRequest->UpdateRequest().NewClient() = ETrue;
       
    53 	updateRequest->CheckPosUpdateOrReqReceivedL();
       
    54 	updateRequest->NotifyPsyRequest();
       
    55 			
       
    56 	INFO_PRINTF1(_L("Set a reference position update on the bus ALM->PSY"));
       
    57 	CTe_PsyResponse* posUpdate = 
       
    58 		CTe_PsyResponse::IssueRefPosUpdateLC(TPositionModuleInfo::ETechnologyNetwork);
       
    59 	INFO_PRINTF2(_L("Start the active scheduler for %d microsec"), KUsualTimeout);
       
    60 	StartSchedulerWaitL(KUsualTimeout, 1);
       
    61 	INFO_PRINTF1(_L("The active scheduler stopped"));
       
    62 	positioner->CheckPosUpdateReceivedL(*posUpdate);
       
    63 	updateRequest->CheckNothingReceivedL();
       
    64 	CleanupStack::PopAndDestroy(posUpdate);
       
    65 			
       
    66 	positioner->NotifyPositionUpdate();
       
    67 	posUpdate = CTe_PsyResponse::IssueSimplePosUpdateLC(TPositionModuleInfo::ETechnologyTerminal|
       
    68 				TPositionModuleInfo::ETechnologyAssisted);
       
    69 	StartSchedulerWaitL(KUsualTimeout, 1);
       
    70 			
       
    71 	updateRequest->ExpectDefaultUpdateRequest();
       
    72 	updateRequest->CheckPosUpdateOrReqReceivedL();		
       
    73 			
       
    74 	positioner->CheckPosUpdateReceivedL(*posUpdate);
       
    75 	INFO_PRINTF1(_L("POSITION UPDATE WITH REF POS START (Scenario 4.0) END"));
       
    76 	
       
    77 	//To make power stanby timer work
       
    78 	StartSchedulerWaitL(2*KUsualTimeout, 1);
       
    79 	
       
    80 	//SETTING MAXAGE AND USING CACHED REF POS UPDATE (Scenario 4.1)
       
    81 	INFO_PRINTF1(_L("SETTING MAXAGE AND USING CACHED REF POS UPDATE (Scenario 4.1) START"));
       
    82 	INFO_PRINTF1(_L("Create positioner and the position update object"));
       
    83 		
       
    84 	TTime someTimeAgo;
       
    85 	someTimeAgo.UniversalTime();
       
    86 	someTimeAgo-=(TTimeIntervalSeconds(KOldPosUpdateAge+KUsualTimeout));
       
    87 	positioner->SetMaxAge(someTimeAgo);
       
    88 		
       
    89 	updateRequest->NotifyPsyRequest();
       
    90 	INFO_PRINTF1(_L("Call NotifyPositionUpdate() PSY->ALM"));
       
    91 	positioner->NotifyPositionUpdate();
       
    92 		
       
    93 	INFO_PRINTF2(_L("Start the active scheduler for %d microsec"), KUsualTimeout);
       
    94 	StartSchedulerWaitL(KUsualTimeout, 1);
       
    95 	INFO_PRINTF1(_L("The active scheduler stopped"));
       
    96 		
       
    97 	positioner->CheckPosUpdateReceivedL(*posUpdate);
       
    98 	updateRequest->CheckNothingReceivedL();
       
    99 	updateRequest->Cancel();
       
   100 	CleanupStack::PopAndDestroy(posUpdate);
       
   101 	positioner->SetMaxAge(0);
       
   102 	INFO_PRINTF1(_L("SETTING MAXAGE AND USING CACHED REF POS UPDATE (Scenario 4.1) END"));
       
   103 			
       
   104 		
       
   105 	//POSITION UPDATE WITH REF POS & FINAL NET POS (Scenario 4.2)
       
   106 	INFO_PRINTF1(_L("POSITION UPDATE WITH REF POS & FINAL NET POS (Scenario 4.2) START"));
       
   107 	INFO_PRINTF1(_L("Create positioner and the position update object"));
       
   108 				
       
   109 	INFO_PRINTF1(_L("Call NotifyPositionUpdate() PSY->ALM"));
       
   110 	updateRequest->NotifyPsyRequest();
       
   111 	positioner->NotifyPositionUpdate();
       
   112 	
       
   113 	WaitCheckNotifyReqReceivedL(*updateRequest);
       
   114 				
       
   115 	INFO_PRINTF1(_L("Set a reference position update on the bus ALM->PSY"));
       
   116 	posUpdate = CTe_PsyResponse::IssueRefPosUpdateLC(TPositionModuleInfo::ETechnologyNetwork);
       
   117 	INFO_PRINTF2(_L("Start the active scheduler for %d microsec"), KUsualTimeout);
       
   118 	StartSchedulerWaitL(KUsualTimeout, 1);
       
   119 	INFO_PRINTF1(_L("The active scheduler stopped"));
       
   120 	positioner->CheckPosUpdateReceivedL(*posUpdate);
       
   121 	updateRequest->CheckNothingReceivedL();
       
   122 	CleanupStack::PopAndDestroy(posUpdate);
       
   123 				
       
   124 	positioner->NotifyPositionUpdate();
       
   125 	posUpdate = CTe_PsyResponse::IssueFinalNetPosUpdateLC(TPositionModuleInfo::ETechnologyNetwork|
       
   126 				TPositionModuleInfo::ETechnologyAssisted);
       
   127 	StartSchedulerWaitL(KUsualTimeout, 1);
       
   128 				
       
   129 	updateRequest->ExpectDefaultCancelRequest();
       
   130 	updateRequest->CheckPosUpdateOrReqReceivedL();		
       
   131 				
       
   132 	positioner->CheckPosUpdateReceivedL(*posUpdate);
       
   133 				
       
   134 	INFO_PRINTF1(_L("POSITION UPDATE WITH REF POS & FINAL NET POS (Scenario 4.2) END"));
       
   135 	
       
   136 	//To make power stanby timer work
       
   137 	StartSchedulerWaitL(2*KUsualTimeout, 1);
       
   138 	
       
   139 	//SETTING MAXAGE AND USING CACHED FN POS (Scenario 4.3) UPDATE
       
   140 	INFO_PRINTF1(_L("SETTING MAXAGE AND USING CACHED FN POS UPDATE (Scenario 4.3) START"));
       
   141 	INFO_PRINTF1(_L("Create positioner and the position update object"));
       
   142 			
       
   143 	someTimeAgo.UniversalTime();
       
   144 	someTimeAgo-=(TTimeIntervalSeconds(KOldPosUpdateAge+KUsualTimeout));
       
   145 	positioner->SetMaxAge(someTimeAgo);
       
   146 			
       
   147 	updateRequest->NotifyPsyRequest();
       
   148 	INFO_PRINTF1(_L("Call NotifyPositionUpdate() PSY->ALM"));
       
   149 	positioner->NotifyPositionUpdate();
       
   150 			
       
   151 	INFO_PRINTF2(_L("Start the active scheduler for %d microsec"), KUsualTimeout);
       
   152 	StartSchedulerWaitL(KUsualTimeout, 1);
       
   153 	INFO_PRINTF1(_L("The active scheduler stopped"));
       
   154 			
       
   155 	positioner->CheckPosUpdateReceivedL(*posUpdate);
       
   156 	updateRequest->CheckNothingReceivedL();
       
   157 	updateRequest->Cancel();
       
   158 	CleanupStack::PopAndDestroy(posUpdate);
       
   159 	positioner->SetMaxAge(0);
       
   160 	INFO_PRINTF1(_L("SETTING MAXAGE AND USING CACHED FN POS UPDATE (Scenario 4.3) END"));
       
   161 		
       
   162 	
       
   163 	CleanupStack::PopAndDestroy(updateRequest);
       
   164 	CleanupStack::PopAndDestroy(positioner);
       
   165 		
       
   166 	INFO_PRINTF1(_L("CTe_LbsAgpsPsyPosUpdateStep::ReallyDoTestStepL() end"));
       
   167 		
       
   168 	if(TestStepResult()!=EPass)
       
   169 		{
       
   170 		User::Leave(EFail);
       
   171 		}
       
   172 	}
       
   173