36
|
1 |
// Copyright (c) 2007-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 |
//
|
|
15 |
|
|
16 |
// LBS includes.
|
|
17 |
#include <lbs/lbsnetprotocolbase.h>
|
|
18 |
#include <lbs/lbsassistancedatabuilderset.h>
|
|
19 |
#include <lbs/lbsloccommon.h>
|
|
20 |
|
|
21 |
// LBS test includes.
|
|
22 |
#include "ctlbsuebasedmtlr.h"
|
|
23 |
#include <lbs/test/tlbsutils.h>
|
|
24 |
#include "argutils.h"
|
|
25 |
#include <lbs/test/activeyield.h>
|
|
26 |
|
|
27 |
/**
|
|
28 |
Static Constructor
|
|
29 |
*/
|
|
30 |
CT_LbsUEBasedMTLR* CT_LbsUEBasedMTLR::New(CT_LbsHybridMTLRServer& aParent)
|
|
31 |
{
|
|
32 |
// Note the lack of ELeave.
|
|
33 |
// This means that having insufficient memory will return NULL;
|
|
34 |
CT_LbsUEBasedMTLR* testStep = new CT_LbsUEBasedMTLR(aParent);
|
|
35 |
if (testStep)
|
|
36 |
{
|
|
37 |
TInt err = KErrNone;
|
|
38 |
|
|
39 |
TRAP(err, testStep->ConstructL());
|
|
40 |
if (err)
|
|
41 |
{
|
|
42 |
delete testStep;
|
|
43 |
testStep = NULL;
|
|
44 |
}
|
|
45 |
}
|
|
46 |
return testStep;
|
|
47 |
}
|
|
48 |
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Constructor
|
|
52 |
*/
|
|
53 |
CT_LbsUEBasedMTLR::CT_LbsUEBasedMTLR(CT_LbsHybridMTLRServer& aParent) : CT_LbsHybridMTLRStep(aParent)
|
|
54 |
{
|
|
55 |
SetTestStepName(KLbsUEBasedMTLR);
|
|
56 |
iSessionId.SetSessionOwner(KRequestUid);
|
|
57 |
iSessionId.SetSessionNum(0x0001);
|
|
58 |
iPositionUpdateRef = EFalse;
|
|
59 |
iState = EInitializing;
|
|
60 |
}
|
|
61 |
|
|
62 |
|
|
63 |
void CT_LbsUEBasedMTLR::ConstructL()
|
|
64 |
{
|
|
65 |
// Create the base class objects.
|
|
66 |
CT_LbsHybridMTLRStep::ConstructL();
|
|
67 |
iController = CLbsPrivacyController::NewL(*this);
|
|
68 |
iProxy = CNetProtocolProxy::NewL();
|
|
69 |
}
|
|
70 |
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Destructor
|
|
74 |
*/
|
|
75 |
CT_LbsUEBasedMTLR::~CT_LbsUEBasedMTLR()
|
|
76 |
{
|
|
77 |
delete iController;
|
|
78 |
delete iProxy;
|
|
79 |
}
|
|
80 |
|
|
81 |
|
|
82 |
TVerdict CT_LbsUEBasedMTLR::doTestStepL()
|
|
83 |
{
|
|
84 |
INFO_PRINTF1(_L("CT_LbsUEBasedMTLR::doTestStepL()"));
|
|
85 |
// Stop the test if the preamble failed
|
|
86 |
TESTL(TestStepResult() == EPass);
|
|
87 |
|
|
88 |
const TInt KTimeOut = 60*1000*1000;
|
|
89 |
const TInt KAdviceSystemStatusTimeout = 40*1000*1000;
|
|
90 |
|
|
91 |
// >> AdviceSystemStatus(0)
|
|
92 |
TESTL(iProxy->WaitForResponse(KAdviceSystemStatusTimeout) == ENetMsgGetCurrentCapabilitiesResponse);
|
|
93 |
CLbsNetworkProtocolBase::TLbsSystemStatus status;
|
|
94 |
CleanupStack::PopAndDestroy(iProxy->GetArgsLC(ENetMsgGetCurrentCapabilitiesResponse, &status));
|
|
95 |
TESTL(status == CLbsNetworkProtocolBase::ESystemStatusNone);
|
|
96 |
|
|
97 |
// Initiate MTLR Start
|
|
98 |
|
|
99 |
// << ProcessStatusUpdate()
|
|
100 |
MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask activeServiceMask = MLbsNetworkProtocolObserver::EServiceMobileTerminated;
|
|
101 |
iProxy->CallL(ENetMsgProcessStatusUpdate, &activeServiceMask);
|
|
102 |
|
|
103 |
// << ProcessPrivacyRequest()
|
|
104 |
const TBool emergency = ETrue;
|
|
105 |
TLbsNetPosRequestPrivacy privacy = ArgUtils::Privacy();
|
|
106 |
TLbsExternalRequestInfo requestInfo = ArgUtils::RequestInfo();
|
|
107 |
iProxy->CallL(ENetMsgProcessPrivacyRequest, &iSessionId, &emergency, &privacy, &requestInfo);
|
|
108 |
|
|
109 |
// >> Callback from RespondNetworkLocationRequest(ERequestAccepted)
|
|
110 |
CheckForObserverEventTestsL(KTimeOut, *this);
|
|
111 |
|
|
112 |
// >> Respond Privacy Request
|
|
113 |
TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRespondPrivacyRequest);
|
|
114 |
|
|
115 |
TLbsNetSessionId* getSessionId = NULL;
|
|
116 |
CLbsNetworkProtocolBase::TLbsPrivacyResponse getPrivacy;
|
|
117 |
TInt cleanupCnt;
|
|
118 |
cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondPrivacyRequest, &getSessionId, &getPrivacy);
|
|
119 |
TESTL(getSessionId->SessionNum()==iSessionId.SessionNum());
|
|
120 |
TESTL(getPrivacy==CLbsNetworkProtocolBase::EPrivacyResponseAccepted);
|
|
121 |
CleanupStack::PopAndDestroy(cleanupCnt);
|
|
122 |
|
|
123 |
// Initiate MTLR End
|
|
124 |
|
|
125 |
// MTLR Reference Position Notification Start
|
|
126 |
|
|
127 |
// << ProcessLocationUpdate()
|
|
128 |
TPositionInfo positionInfo = ArgUtils::ReferencePositionInfo();
|
|
129 |
iProxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &positionInfo);
|
|
130 |
|
|
131 |
// MTLR Reference Position Notification Stop
|
|
132 |
|
|
133 |
// MTLR Assistance Data Notification Start
|
|
134 |
|
|
135 |
// << ProcessAssistanceData()
|
|
136 |
TLbsAsistanceDataGroup dataRequestMask = EAssistanceDataReferenceTime;
|
|
137 |
RLbsAssistanceDataBuilderSet assistanceData;
|
|
138 |
ArgUtils::PopulateLC(assistanceData);
|
|
139 |
TInt reason = KErrNone;
|
|
140 |
iProxy->CallL(ENetMsgProcessAssistanceData, &dataRequestMask, &assistanceData, &reason);
|
|
141 |
CleanupStack::PopAndDestroy();
|
|
142 |
|
|
143 |
// MTLR Assistance Data Notification Stop
|
|
144 |
|
|
145 |
// MTLR Network Location Request Start
|
|
146 |
|
|
147 |
// << ProcessLocationRequest()
|
|
148 |
MLbsNetworkProtocolObserver::TLbsNetProtocolService service = MLbsNetworkProtocolObserver::EServiceMobileTerminated;
|
|
149 |
TLbsNetPosRequestQuality quality = ArgUtils::QualityAlpha2();
|
|
150 |
TLbsNetPosRequestMethod method = ArgUtils::RequestHybridMethod();
|
|
151 |
iProxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);
|
|
152 |
|
|
153 |
// MTLR Network Location Request Stop
|
|
154 |
|
|
155 |
// >> Callback from ProcessNetworkPostionUpdate(refPosition)
|
|
156 |
CheckForObserverEventTestsL(KTimeOut, *this);
|
|
157 |
|
|
158 |
// >> Callback from ProcessNetworkPostionUpdate(GPS Location)
|
|
159 |
CheckForObserverEventTestsL(KTimeOut, *this);
|
|
160 |
|
|
161 |
// >> RequestAssistanceData(0)
|
|
162 |
TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData);
|
|
163 |
TLbsAsistanceDataGroup dataGroup;
|
|
164 |
CleanupStack::PopAndDestroy(iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataGroup));
|
|
165 |
TESTL(dataGroup == EAssistanceDataNone);
|
|
166 |
|
|
167 |
// >> RespondLocationRequest()
|
|
168 |
TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRespondLocationRequest);
|
|
169 |
getSessionId = NULL;
|
|
170 |
TInt getReason = KErrNone;
|
|
171 |
TPositionExtendedSatelliteInfo* getPositionInfo = NULL;
|
|
172 |
cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &getSessionId, &getReason, &getPositionInfo);
|
|
173 |
TESTL(getPositionInfo->PositionClassType() == (EPositionInfoClass|EPositionCourseInfoClass|EPositionSatelliteInfoClass|EPositionExtendedSatelliteInfoClass));
|
|
174 |
TESTL(getSessionId->SessionNum() == iSessionId.SessionNum());
|
|
175 |
TESTL(getReason == KErrNone);
|
|
176 |
/* Check whether ExtendedSatelliteInfo data received by protocol module is the same as data fed to the GPS module or not.
|
|
177 |
Latitude(51.5015),Longitude(-0.105),Altitude(50),HorizontalAccuracy(2),VerticalAccuracy(3),
|
|
178 |
speed(26.0),vertical speed(20.0),heading(25.0),course(30.0),SPEED_ACCURACY(2.0),VERTICAL_SPEED_ACCURACY(3.0),
|
|
179 |
HEADING_ACCURACY(10.0),COURSE_ACCURACY(4.0),SD_OF_LONG_ERROR(5.0),SD_OF_LAT_ERROR(6.0),SD_OF_ALT_ERROR(7.0),
|
|
180 |
SD_OF_SEMI_MAJOR_AXIS_ERROR(8.0),SD_OF_SEMI_MINOR_AXIS_ERROR(9.0),ORIEN_OF_SEMI_MAJOR_AXIS_ERROR(10.0),
|
|
181 |
RMS_VAL_OF_SD_OF_RANGE(11.0),GEOIDAL_SEPARATION(12.0),MAGNETIC_VARIATION(13.0),COURSE_OVER_GROUND_MAGNETIC(14.0)
|
|
182 |
GPS_TIMING_OF_CELL_MsPart(16383),GPS_TIMING_OF_CELL_LsPart(4294967295),REFERENCE_IDENTITY(511)
|
|
183 |
SFN(4095)*/
|
|
184 |
|
|
185 |
TPosition gpsPos;
|
|
186 |
getPositionInfo->GetPosition(gpsPos);
|
|
187 |
TESTL(gpsPos.Latitude()==51.5015 && gpsPos.Longitude()== -0.105 && gpsPos.Altitude()==50
|
|
188 |
&& gpsPos.HorizontalAccuracy()==2 && gpsPos.VerticalAccuracy()==3);
|
|
189 |
TCourse course;
|
|
190 |
getPositionInfo->GetCourse(course);
|
|
191 |
|
|
192 |
TESTL(course.Speed()==26.0 && course.VerticalSpeed()==20.0 && course.Heading()==25.0 && course.Course()==30.0 &&
|
|
193 |
course.SpeedAccuracy()==2.0 && course.VerticalSpeedAccuracy()==3.0 && course.HeadingAccuracy()==10.0 &&
|
|
194 |
course.CourseAccuracy()==4.0);
|
|
195 |
|
|
196 |
TDetailedErrorReport detErrRep;
|
|
197 |
getPositionInfo->GetDetailedErrorReport(detErrRep);
|
|
198 |
TESTL(detErrRep.StanDeviOfLongitudeError()==5.0 && detErrRep.StanDeviOfLatiitudeError()==6.0 &&
|
|
199 |
detErrRep.StanDeviOfAltitudeError()==7.0 && detErrRep.StanDeviOfSemiMajorAxisError()==8.0 &&
|
|
200 |
detErrRep.StanDeviOfSemiMinorAxisError()==9.0 && detErrRep.OrientationOfSemiMajorAxisError()==10.0 &&
|
|
201 |
detErrRep.RmsValOfStanDeviOfRange()==11.0);
|
|
202 |
|
|
203 |
TGpsTimingMeasurementData gpsTimingData;
|
|
204 |
getPositionInfo->GetGpsTimingData(gpsTimingData);
|
|
205 |
|
|
206 |
TESTL(gpsTimingData.DataType()== TGpsTimingMeasurementData::EGpsTimingDataTypeUtran &&
|
|
207 |
gpsTimingData.NetworkMode()== TGpsTimingMeasurementData::ENetworkModeFdd &&
|
|
208 |
gpsTimingData.GPSTimingOfCellMsPart()==16383 && gpsTimingData.GPSTimingOfCellLsPart()==4294967295UL &&
|
|
209 |
gpsTimingData.ReferenceIdentity()==511 && gpsTimingData.Sfn()==4095);
|
|
210 |
|
|
211 |
|
|
212 |
TESTL(getPositionInfo->GeoidalSeparation()==12.0 && getPositionInfo->MagneticVariation()==13.0 &&
|
|
213 |
getPositionInfo->CourseOverGroundMagnetic()==14.0);
|
|
214 |
|
|
215 |
CleanupStack::PopAndDestroy(cleanupCnt);
|
|
216 |
|
|
217 |
// MTLR Session Completion Start
|
|
218 |
// << ProcessSessionComplete()
|
|
219 |
reason = KErrNone;
|
|
220 |
iProxy->CallL(ENetMsgProcessSessionComplete, &iSessionId, &reason);
|
|
221 |
|
|
222 |
// << ProcessStatusUpdate()
|
|
223 |
MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask activeServiceMask2 = MLbsNetworkProtocolObserver::EServiceNone;
|
|
224 |
iProxy->CallL(ENetMsgProcessStatusUpdate, &activeServiceMask2);
|
|
225 |
|
|
226 |
// >> Callback from ProcessRequestComplete()
|
|
227 |
CheckForObserverEventTestsL(KTimeOut, *this);
|
|
228 |
// MTLR Session Completion Stop
|
|
229 |
|
|
230 |
// Verify that the last callback was to ProcessSessionComplete()
|
|
231 |
TESTL(iState==ERequestComplete);
|
|
232 |
|
|
233 |
return TestStepResult();
|
|
234 |
}
|
|
235 |
|
|
236 |
void CT_LbsUEBasedMTLR::ProcessNetworkLocationRequest(TUint aRequestId, const TLbsExternalRequestInfo& /*aRequestInfo*/, const TNotificationType& /*aNotificationType*/)
|
|
237 |
{
|
|
238 |
INFO_PRINTF1(_L(">>CT_LbsUEBasedMTLR::ProcessNetworkLocationRequest()"));
|
|
239 |
TEST(iState==EInitializing);
|
|
240 |
iController->RespondNetworkLocationRequest(aRequestId, CLbsPrivacyController::ERequestAccepted);
|
|
241 |
iState = EPrivacyCheckOk;
|
|
242 |
ReturnToTestStep();
|
|
243 |
}
|
|
244 |
|
|
245 |
void CT_LbsUEBasedMTLR::ProcessNetworkPositionUpdate(TUint /*aRequestId*/, const TPositionInfo& /*aPosInfo*/)
|
|
246 |
{
|
|
247 |
INFO_PRINTF1(_L(">>CT_LbsUEBasedMTLR::ProcessNetworkPositionUpdate()"));
|
|
248 |
if(!iPositionUpdateRef)
|
|
249 |
{
|
|
250 |
TEST(iState==EPrivacyCheckOk);
|
|
251 |
iState=ERefLocReceived;
|
|
252 |
iPositionUpdateRef = ETrue;
|
|
253 |
}
|
|
254 |
else
|
|
255 |
{
|
|
256 |
//This function is called back twice. First time when it returns the ref loc and second time when it returns a Gps loc
|
|
257 |
//We need to test iState for different state
|
|
258 |
TEST(iState==ERefLocReceived);
|
|
259 |
iState=EGpsLocReceived;
|
|
260 |
}
|
|
261 |
ReturnToTestStep();
|
|
262 |
}
|
|
263 |
|
|
264 |
void CT_LbsUEBasedMTLR::ProcessRequestComplete(TUint /*aRequestId*/, TInt /*aReason*/)
|
|
265 |
{
|
|
266 |
INFO_PRINTF1(_L(">>CT_LbsUEBasedMTLR::ProcessRequestComplete()"));
|
|
267 |
TEST(iState==EGpsLocReceived);
|
|
268 |
iState=ERequestComplete;
|
|
269 |
ReturnToTestStep();
|
|
270 |
}
|
|
271 |
|
|
272 |
|
|
273 |
|
|
274 |
|