lbstest/lbstestproduct/lbshybridmolr/src/ctlbshybridueassistedmolrgpsok.cpp
author William Roberts <williamr@symbian.org>
Thu, 22 Jul 2010 16:47:01 +0100
branchGCC_SURGE
changeset 49 5f20f71a57a3
parent 23 2965a06983dc
parent 36 b47902b73a93
permissions -rw-r--r--
Catchup to latest Symbian^4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
// All rights reserved.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
//
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
// Initial Contributors:
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
//
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
// Contributors:
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
//
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
// Description:
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
// This is the class implementation for the MO-LR - Accurate GPS Result scenario Tests
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
// 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
//
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
// LBS includes. 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
#include <lbs/test/lbsnetprotocolproxy.h>
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
#include <lbs/lbsnetprotocolbase.h>
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
#include <lbs/lbsassistancedatabuilderset.h>
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
// LBS test includes.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include "ctlbshybridueassistedmolrgpsok.h"
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include <lbs/test/tlbsutils.h>
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include "argutils.h"
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#include <lbs/test/activeyield.h>
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
const TInt KN(2); // Number of times to send the measurement from GPS to NW
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
/**
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
Static Constructor
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
*/
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
CT_LbsHybridUEAssistedMOLRGPSOk* CT_LbsHybridUEAssistedMOLRGPSOk::New(CT_LbsHybridMOLRServer& aParent)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
	{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
	// Note that we do not use ELeave.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
	// This means that having insufficient memory will return NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
	CT_LbsHybridUEAssistedMOLRGPSOk* testStep = new CT_LbsHybridUEAssistedMOLRGPSOk(aParent);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
	if (testStep)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
		{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
		TInt err = KErrNone;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
		TRAP(err, testStep->ConstructL());
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
		if (err)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
			{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
			delete testStep;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
			testStep = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
			}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
		}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
	return testStep;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
	}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
/**
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
 * Constructor
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
 */
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
CT_LbsHybridUEAssistedMOLRGPSOk::CT_LbsHybridUEAssistedMOLRGPSOk(CT_LbsHybridMOLRServer& aParent) : CT_LbsHybridMOLRStep(aParent)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
	{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
	SetTestStepName(KLbsHybridUEAssistedMOLRGPSOk);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
	iSessionId.SetSessionOwner(KRequestUid);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
	iSessionId.SetSessionNum(0x0005);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
	}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
void CT_LbsHybridUEAssistedMOLRGPSOk::ConstructL()
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
	{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
	// Create the base class objects.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
	CT_LbsHybridMOLRStep::ConstructL();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
	}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
/**
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
 * Destructor
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
 */
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
CT_LbsHybridUEAssistedMOLRGPSOk::~CT_LbsHybridUEAssistedMOLRGPSOk()
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
	{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
	}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
// Hybrid - UE Assisted MO-LR GPS ok
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
TVerdict CT_LbsHybridUEAssistedMOLRGPSOk::doTestStepL()
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
	{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
	INFO_PRINTF1(_L("CT_LbsHybridUEAssistedMOLRGPSOk::doTestStepL()"));	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
	// Stop the test if the preable failed
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
	TESTL(TestStepResult() == EPass);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
	TInt testCaseId;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
	if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId))
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
		{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
		 INFO_PRINTF2(_L("test ID= %d"),testCaseId);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
		}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
	const TInt KTimeOut = 60*1000*1000;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
	// Create Network Protocol Proxy
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
	CNetProtocolProxy* proxy = CNetProtocolProxy::NewL();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
	CleanupStack::PushL(proxy);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
	// >> AdviceSystemStatus(0) - GetCurrentCapabilitiesResponse
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
	TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgGetCurrentCapabilitiesResponse);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
	CLbsNetworkProtocolBase::TLbsSystemStatus status;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
	TInt cleanupCnt;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
	cleanupCnt = proxy->GetArgsLC(ENetMsgGetCurrentCapabilitiesResponse, &status);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
	TESTL(status == CLbsNetworkProtocolBase::ESystemStatusNone);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
	CleanupStack::PopAndDestroy(cleanupCnt);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
	// Start Test Step
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
	RPositionServer server;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
	TESTL(KErrNone == server.Connect());
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
	CleanupClosePushL(server);	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
	RPositioner pos;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
	TESTL(KErrNone == pos.Open(server));
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
	CPosServerWatcher *pWatch = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
	TInt reason = KErrNone;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
			
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
	if (testCaseId == 9)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
		{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
		 // see INC121701
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
		// this tests that a cancel on the P&S bus fron the locserver to the AGPS 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
		// manager does not get overwritten by a status when the sub-session is closed
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
		// Note that here we do not put pos on cleanup stack i.e CleanupClosePushL(pos);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
		// it emans that if the test fails by leaving between now and when we close the 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
		// subsession then there will be a leak!
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
		// This is accepable beacuse if we did push it and then
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
		// CleanupStack::PopAndDestroy(); then the timings change
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
		// and the test is unable to create the back to back  cancel/status scenario
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
		// Set the max fix time for the client request to ensure the location server does not complete the request too soon during the test.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
		TPositionUpdateOptions posOpts(TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(KMOLRFixTime));
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
		pos.SetUpdateOptions(posOpts);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
		pWatch = CPosServerWatcher::NewLC(pos, *this);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
		// Request a self-locate MoLr.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
		pWatch->IssueNotifyPositionUpdate();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
		// >> RequestSelfLocation()
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
		TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestSelfLocation);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
		// Process the response.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
		TLbsNetSessionId* 					sessionId = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
		TLbsNetPosRequestOptionsAssistance*	opts = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
		TInt								cleanupCnt;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
		cleanupCnt = proxy->GetArgsLC(ENetMsgRequestSelfLocation, &sessionId, &opts);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
		iSessionId.SetSessionNum(sessionId->SessionNum());
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
		iSessionId.SetSessionOwner(sessionId->SessionOwner());
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
		CleanupStack::PopAndDestroy(cleanupCnt);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
		sessionId = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
		opts = NULL;	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
		// << ProcessStatusUpdate(EServiceSelfLocation)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
		MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask activeServiceMask = MLbsNetworkProtocolObserver::EServiceSelfLocation;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
		proxy->CallL(ENetMsgProcessStatusUpdate, &activeServiceMask);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
		// do NOT send to LBS a location reques
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
		// thus ensuring that the cancel should arive fron LBS without 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
		// and assistance data requests 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
		pos.CancelRequest(EPositionerNotifyPositionUpdate);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
		CheckForObserverEventTestsL(KTimeOut, *this);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
		pos.Close();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
		// now check that one and ONLY one cancel arrives
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
		// Wait for and process the response.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
		TInt err = proxy->WaitForResponse( 1 * 1000 * 1000) ;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
		// if a status overwrites the cancel on the P&S bus then no cancel will arrive and te test will fail!
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
		if (err==ENetMsgCancelSelfLocation)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
			{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
			INFO_PRINTF1(_L("Received a Cancel, as expected"));	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
			}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
		else
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
			{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
			TESTL(err == ENetMsgCancelSelfLocation);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
			}	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
		// << ProcessSessionComplete(SessionId, KErrCancel)	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
		TInt reason = KErrCancel;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
		proxy->CallL(ENetMsgProcessSessionComplete, &iSessionId, &reason);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
		const TInt KTimeOutOneSecond = 1*1000*1000;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
			
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
		// now no more messages should arrive and definately NOT another cancel!
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
		// in order to demonstrate that this test actually works ..
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
		// in location server's CRequestQ::IssueStatus
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
		// add dleay before sending the cancel:
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
		// For example:
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
		// User::After(2* 1000 *1000);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
		// TRAP_IGNORE(iLocReqBus->PublishRequestL(cancel));
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
		// this ensures that TWO cancels are sent from the location server to the agps manager
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
		// and exercises the code in the manager that prevents TWO cancels being sent to 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
		// the protocol module
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
		// in order to see the test failing when a second cancel arrives also need to 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
		// comment out the line	"if (!iSessionStartedStateAndCancelling)"
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
		// in agps manager's lbsmanagermainlogic.cpp
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
		err = proxy->WaitForResponse( KTimeOutOneSecond) ;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
		if (err==ENetMsgCancelSelfLocation)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
			{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
			INFO_PRINTF1(_L("Test failed: received a SECOND cancel"));	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
			}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
		TESTL(err == ENetMsgTimeoutExpired); 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
		// Done. Now cleanup...
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
		CleanupStack::PopAndDestroy(pWatch);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
		CleanupStack::PopAndDestroy(); // server	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
		CleanupStack::PopAndDestroy(proxy);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
		return TestStepResult();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
		}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
	else
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
		{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
		CleanupClosePushL(pos);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
		// Set the max fix time for the client request to ensure the location server does not complete the request too soon during the test.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
		TPositionUpdateOptions posOpts(TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(KMOLRFixTime));
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
		pos.SetUpdateOptions(posOpts);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
		pWatch = CPosServerWatcher::NewLC(pos, *this);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
		// Request a self-locate MoLr.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
		pWatch->IssueNotifyPositionUpdate();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
		// >> RequestSelfLocation()
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
		TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestSelfLocation);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
		// Process the response.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
		TLbsNetSessionId* 					sessionId = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
		TLbsNetPosRequestOptionsAssistance*	opts = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
		TInt cleanupCnt;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
		cleanupCnt = proxy->GetArgsLC(ENetMsgRequestSelfLocation, &sessionId, &opts);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
		TBool qualitycheck = 	ArgUtils::CompareQuality(	opts, 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
															ETrue, 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
															KMinHorizontalAcc, 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
															KMinVerticalAcc, 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
															KMOLRFixTime,
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
															0, 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
															EAssistanceDataReferenceTime, 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
															(TPositionModuleInfo::ETechnologyTerminal 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
															| TPositionModuleInfo::ETechnologyAssisted)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
														);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
		TESTL(qualitycheck);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
		iSessionId.SetSessionNum(sessionId->SessionNum());
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
		iSessionId.SetSessionOwner(sessionId->SessionOwner());
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
		CleanupStack::PopAndDestroy(cleanupCnt);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
		sessionId = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
		opts = NULL;	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
		// << ProcessStatusUpdate(EServiceSelfLocation)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
		MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask activeServiceMask = MLbsNetworkProtocolObserver::EServiceSelfLocation;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
		proxy->CallL(ENetMsgProcessStatusUpdate, &activeServiceMask);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
		// << ProcessLocationUpdate(SessionId, RefPosition)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
		TPositionInfo refPosInfo = ArgUtils::MolrReferencePositionInfo();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   263
		proxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &refPosInfo);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
		// TEST: Get the ref pos app side.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
		CheckForObserverEventTestsL(KTimeOut, *this);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
		// << ProcessAssistanceData()
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
		TLbsAsistanceDataGroup dataMask = EAssistanceDataReferenceTime;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
		RLbsAssistanceDataBuilderSet assistanceData;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
		ArgUtils::PopulateLC(assistanceData);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
		reason = KErrNone;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
		proxy->CallL(ENetMsgProcessAssistanceData, &dataMask, &assistanceData, &reason);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
		CleanupStack::PopAndDestroy(); // assistanceData
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
		// << ProcessLocationRequest(SessionId, HybridMode, alpha2)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
		TBool emergency = EFalse;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
		MLbsNetworkProtocolObserver::TLbsNetProtocolService service = MLbsNetworkProtocolObserver::EServiceSelfLocation;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
		TLbsNetPosRequestQuality quality = ArgUtils::Quality(); 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
		quality.SetMaxFixTime(ArgUtils::Alpha2());
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
		TLbsNetPosRequestMethod method   = ArgUtils::RequestHybridMethod();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
		proxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
		// Now that the hybrid/alpha2 has been requested, record current time to verify alpha2 timer expires correctly.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
		TTime startTime;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
		startTime.HomeTime();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
		// >> RequestAssistanceData(0)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
		TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
		cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
		TESTL(dataMask == EAssistanceDataNone);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
		CleanupStack::PopAndDestroy(cleanupCnt);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
		// << NotifyPositionUpdate()
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
		pWatch->IssueNotifyPositionUpdate();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
		// >> RequestAssistanceData(0)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
		TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
		cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
		TESTL(dataMask == EAssistanceDataNone);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
		CleanupStack::PopAndDestroy(cleanupCnt);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
		// Determine the value to take off the alpha2 value. This is required because we had to wait for the assistance data response.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
		TTimeIntervalMicroSeconds microseconds;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
		TTime stopTime;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
		stopTime.HomeTime();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
		microseconds = stopTime.MicroSecondsFrom(startTime); 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   307
		TInt64 timeElapsed = microseconds.Int64();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
		TInt delta = 2 * 1000 * 1000; // 2 secs.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
		// >> RespondLocationRequest()
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
		TESTL(proxy->WaitForResponse(ArgUtils::Alpha2() - timeElapsed - delta) == ENetMsgTimeoutExpired);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
		// Wait for and process the response.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
		TESTL(proxy->WaitForResponse(2 * delta) == ENetMsgRespondLocationRequest);		// DONT get because the measurement data bus has not been created...
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   316
		sessionId = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   317
		TPositionGpsMeasurementInfo* measurementInfo = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
		cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &measurementInfo);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
		TESTL(sessionId->SessionNum() == iSessionId.SessionNum());
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   320
		TESTL(reason == KErrNone);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
		CleanupStack::PopAndDestroy(cleanupCnt);//sessionId, measurementInfo
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
		// Recv -> RequestAssistanceData - we get an extra msg as the result of the A-GPS manager re-issueing a location request when it's
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
		//									max fix time timer expries.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
		TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
		cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
		TESTL(dataMask == EAssistanceDataNone);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
		CleanupStack::PopAndDestroy(cleanupCnt);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
		const TInt t = 8 * 1000 * 1000; // 8 secs.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
		quality.SetMaxFixTime(t);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
		TPositionExtendedSatelliteInfo* positionInfo = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
		//TPositionInfo* positionInfo = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
		for (TInt i = 0; i < KN; i++)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
			{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   337
			// << ProcessLocationRequest(SessionId, HybridMode, t)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   338
			proxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
			// >> RequestAssistanceData(0)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
			TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
			cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
			TESTL(dataMask == EAssistanceDataNone);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
			CleanupStack::PopAndDestroy(cleanupCnt);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   346
			// >> RespondLocationRequest() - first measurement, second position.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   347
			TESTL(proxy->WaitForResponse(t + delta) == ENetMsgRespondLocationRequest);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
			sessionId = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   350
			
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
			// Expect measurement first time.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
			if (i < (KN-1))
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
				{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   354
				measurementInfo = NULL;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   355
				cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &measurementInfo);			
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
				// Check it is measurement
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
				TESTL(measurementInfo->PositionClassType() == EPositionGpsMeasurementInfoClass);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   360
				// >> RequestAssistanceData - we get an extra msg as the result of the A-GPS manager re-issueing a location request when it's
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   361
				//									max fix time timer expries.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
				TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   363
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
				cleanupCnt += proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
				TESTL(dataMask == EAssistanceDataNone);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
				TESTL(sessionId->SessionNum() == iSessionId.SessionNum());
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
				TESTL(reason == KErrNone);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
				}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
			
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
			// Expect position second time.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
			else
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   373
				{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
				cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &positionInfo);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   375
				
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   376
				// check it is a position
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   377
				TESTL(positionInfo->PositionClassType() == (EPositionInfoClass|EPositionCourseInfoClass|EPositionSatelliteInfoClass|EPositionExtendedSatelliteInfoClass));
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   378
				TESTL(sessionId->SessionNum() == iSessionId.SessionNum());
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   379
				TESTL(reason == KErrNone);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   380
				/* Check whether ExtendedSatelliteInfo data received by protocol module is the same as data fed to the GPS module or not. 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   381
                Latitude(50.2454),Longitude(0.1668),Altitude(1.0),HorizontalAccuracy(10),VerticalAccuracy(10), speed(26.0),vertical speed(20.0),heading(25.0),course(30.0), 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   382
                SPEED_ACCURACY(2.0),VERTICAL_SPEED_ACCURACY(3.0),HEADING_ACCURACY(10.0),COURSE_ACCURACY(4.0),
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   383
                SD_OF_LONG_ERROR(5.0),SD_OF_LAT_ERROR(6.0),SD_OF_ALT_ERROR(7.0),SD_OF_SEMI_MAJOR_AXIS_ERROR(8.0),
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   384
                SD_OF_SEMI_MINOR_AXIS_ERROR(9.0),ORIEN_OF_SEMI_MAJOR_AXIS_ERROR(10.0),RMS_VAL_OF_SD_OF_RANGE(11.0),
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   385
                GEOIDAL_SEPARATION(12.0),MAGNETIC_VARIATION(13.0),COURSE_OVER_GROUND_MAGNETIC(14.0)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   386
                GPS_TIMING_OF_CELL_MsPart(16383),GPS_TIMING_OF_CELL_LsPart(4294967295),REFERENCE_IDENTITY(511)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   387
                SFN(4095)*/  
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   388
				
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   389
				TPosition gpsPos;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   390
                positionInfo->GetPosition(gpsPos);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   391
                TESTL(gpsPos.Latitude()==50.2454 && gpsPos.Longitude()== 0.1668 && gpsPos.Altitude()==1.0 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   392
                      && gpsPos.HorizontalAccuracy()==10 && gpsPos.VerticalAccuracy()==10);             
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
                TCourse course;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   394
                positionInfo->GetCourse(course);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   395
                     
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   396
                TESTL(course.Speed()==26.0 && course.VerticalSpeed()==20.0 && course.Heading()==25.0 && course.Course()==30.0 && 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
                      course.SpeedAccuracy()==2.0 && course.VerticalSpeedAccuracy()==3.0 && course.HeadingAccuracy()==10.0 &&
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
                      course.CourseAccuracy()==4.0);           
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
                
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   400
                TDetailedErrorReport detErrRep;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   401
                positionInfo->GetDetailedErrorReport(detErrRep);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   402
                TESTL(detErrRep.StanDeviOfLongitudeError()==5.0 && detErrRep.StanDeviOfLatiitudeError()==6.0 && 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   403
                      detErrRep.StanDeviOfAltitudeError()==7.0 && detErrRep.StanDeviOfSemiMajorAxisError()==8.0 && 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   404
                      detErrRep.StanDeviOfSemiMinorAxisError()==9.0 && detErrRep.OrientationOfSemiMajorAxisError()==10.0 && 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   405
                      detErrRep.RmsValOfStanDeviOfRange()==11.0);  
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   406
                
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   407
                TGpsTimingMeasurementData gpsTimingData;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   408
                positionInfo->GetGpsTimingData(gpsTimingData);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   409
                 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
                TESTL(gpsTimingData.DataType()== TGpsTimingMeasurementData::EGpsTimingDataTypeUtran && 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   411
                      gpsTimingData.NetworkMode()== TGpsTimingMeasurementData::ENetworkModeFdd && 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   412
                      gpsTimingData.GPSTimingOfCellMsPart()==16383 && gpsTimingData.GPSTimingOfCellLsPart()==4294967295UL && 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   413
                      gpsTimingData.ReferenceIdentity()==511 && gpsTimingData.Sfn()==4095);  
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   414
                               
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   415
                
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   416
                TESTL(positionInfo->GeoidalSeparation()==12.0 && positionInfo->MagneticVariation()==13.0 && 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   417
                        positionInfo->CourseOverGroundMagnetic()==14.0);  
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   418
                                
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   419
				
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   420
				// Client recv - the gps position determined by the gps module.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   421
				CheckForObserverEventTestsL(KTimeOut, *this);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   422
				TESTL(iState == EGpsLocReceived);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   423
				
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   424
				// << ProcessLocationUpdate(SessionId, FinalNetworkPosition)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   425
				// Return modules' position as FinalNetworkPosition
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   426
				proxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, positionInfo);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   427
				}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   428
			CleanupStack::PopAndDestroy(cleanupCnt);// sessionId, measurementInfo/positionInfo
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   429
			}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   430
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   431
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
		// << ProcessSessionComplete(SessionId, KErrNone)	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
		reason = KErrNone;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
		proxy->CallL(ENetMsgProcessSessionComplete, &iSessionId, &reason);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   435
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   436
		// << ENetMsgProcessStatusUpdate()
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
		MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask serviceMask = MLbsNetworkProtocolObserver::EServiceNone;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   438
		proxy->CallL(ENetMsgProcessStatusUpdate, &serviceMask);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   439
	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
		// Wait for 10 seconds to ensure no additional responses turn up.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
		delta = 10 * 1000 * 1000;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   442
		TNetProtocolResponseType mType = proxy->WaitForResponse(delta);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   443
		TESTL(mType == ENetMsgTimeoutExpired);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   444
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   445
		// Done. Now cleanup...
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   446
		CleanupStack::PopAndDestroy(pWatch);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   447
		CleanupStack::PopAndDestroy(); // pos
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   448
		CleanupStack::PopAndDestroy(); // server	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
		CleanupStack::PopAndDestroy(proxy);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   450
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   451
		return TestStepResult();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   453
		}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   454
	}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   456
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   457
// MPosServerObserver
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
void CT_LbsHybridUEAssistedMOLRGPSOk::OnGetLastKnownPosition(TInt32 /*aErr*/, const TPositionInfoBase& /*aPosInfo*/)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
	{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
	TEST(EFalse); // Shouldn't see this...
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
	ReturnToTestStep();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
	}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
void CT_LbsHybridUEAssistedMOLRGPSOk::OnNotifyPositionUpdate(TInt32 aErr, const TPositionInfoBase& aPosInfo)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   465
	{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
	// Verify error.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
	if (aErr == KErrCancel)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   468
		{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   469
		iState = ERefLocReceived;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   470
		}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   471
	else
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   472
		{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   473
	TEST(aErr == KErrNone);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   475
	// Verify position.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   476
	TEST(aPosInfo.PositionClassType() == EPositionInfoClass);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   477
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   478
	// Expecting ref pos.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
	if (iState == EInitializing)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   480
		{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   481
		iState = ERefLocReceived;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   483
		TEST(aPosInfo.PositionMode() == TPositionModuleInfo::ETechnologyNetwork);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   484
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   485
		// check for refpos details
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
		const TPositionInfo posInfo = static_cast<const TPositionInfo&>(aPosInfo);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
		TESTL(ArgUtils::ComparePositionInfoToMolrRefPos(posInfo));
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
		}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
		
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
	// Expecting network pos.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   491
	else if (iState == ERefLocReceived)
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   492
		{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   493
		iState = EGpsLocReceived;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
		TEST(aPosInfo.PositionMode() == (TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted));
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   496
		}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   497
	
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   498
	// Not expecting anything else.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
	else
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   500
		{
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   501
		TEST(EFalse);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   502
		}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   503
		}
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   504
	ReturnToTestStep();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   505
	}