36
|
1 |
// Copyright (c) 2006-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 |
// Example CTestStep derived implementation
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file man0Step.cpp
|
|
20 |
*/
|
|
21 |
#include "man0Step.h"
|
|
22 |
#include "Te_manSuiteDefs.h"
|
|
23 |
#include "LbsInternalInterface.h"
|
|
24 |
#include "cprocesslaunch.h"
|
|
25 |
#include "tprocessstartparams.h"
|
|
26 |
#include "lbsassistancedatacacheapi.h"
|
|
27 |
#include "lbsnetinternalapi.h"
|
|
28 |
#include "lbsnetregstatusint.h"
|
|
29 |
#include "LbsLocSourceTestChannel.h"
|
|
30 |
#include "lbsprocesssupervisor.h"
|
|
31 |
|
|
32 |
#include <lbs/lbsextendedsatellite.h>
|
|
33 |
|
|
34 |
Cman0Step::~Cman0Step()
|
|
35 |
/**
|
|
36 |
* Destructor
|
|
37 |
*/
|
|
38 |
{
|
|
39 |
}
|
|
40 |
|
|
41 |
Cman0Step::Cman0Step()
|
|
42 |
/**
|
|
43 |
* Constructor
|
|
44 |
*/
|
|
45 |
{
|
|
46 |
// **MUST** call SetTestStepName in the constructor as the controlling
|
|
47 |
// framework uses the test step name immediately following construction to set
|
|
48 |
// up the step's unique logging ID.
|
|
49 |
iStepCount = 0;
|
|
50 |
SetTestStepName(Kman0Step);
|
|
51 |
}
|
|
52 |
|
|
53 |
TVerdict Cman0Step::doTestStepPreambleL()
|
|
54 |
/**
|
|
55 |
* @return - TVerdict code
|
|
56 |
* Override of base class virtual
|
|
57 |
*/
|
|
58 |
{
|
|
59 |
//INFO_PRINTF1(_L("Please delete this line or modify it. I am in Test Step Preamble in Class Cman0Step"));
|
|
60 |
// uncomment the following 3 lines if you have common pre setting to all the test steps in there
|
|
61 |
CTe_manSuiteStepBase::doTestStepPreambleL();
|
|
62 |
// if (TestStepResult()!=EPass)
|
|
63 |
// return TestStepResult();
|
|
64 |
// process some pre setting to this test step then set SetTestStepResult to EFail or Epass.
|
|
65 |
SetTestStepResult(EPass);
|
|
66 |
return TestStepResult();
|
|
67 |
}
|
|
68 |
|
|
69 |
|
|
70 |
TVerdict Cman0Step::doTestStepL()
|
|
71 |
/**
|
|
72 |
* @return - TVerdict code
|
|
73 |
* Override of base class pure virtual
|
|
74 |
* Our implementation only gets called if the base class doTestStepPreambleL() did
|
|
75 |
* not leave. That being the case, the current test result value will be EPass.
|
|
76 |
*/
|
|
77 |
{
|
|
78 |
if (TestStepResult()==EPass)
|
|
79 |
{
|
|
80 |
|
|
81 |
// Start test version of AGPS manager and use a test version if integration module
|
|
82 |
// The test version of AGPS manager is same as actual but does not use the
|
|
83 |
// ECOM plugin interface.
|
|
84 |
|
|
85 |
// for real thing this is done by route (lbs startup) process
|
|
86 |
TPositionExtendedSatelliteInfo posSatInfo;
|
|
87 |
RLbsPositionUpdates::InitializeL(posSatInfo); // used to publish position
|
|
88 |
|
|
89 |
TPositionModuleStatus defaultPositionModuleStatus;
|
|
90 |
RLbsModuleStatus::InitializeL(defaultPositionModuleStatus);
|
|
91 |
|
|
92 |
RLbsPositionUpdateRequests::InitializeL();
|
|
93 |
RLbsNetworkRegistrationStatus::InitializeL();
|
|
94 |
RLbsNetChannel::InitializeL(RLbsNetChannel::EChannelAGPS2NG);
|
|
95 |
RLbsNetChannel::InitializeL(RLbsNetChannel::EChannelNG2AGPS);
|
|
96 |
RAssistanceDataCache::InitializeL();
|
|
97 |
RAgpsModuleTestChannel::InitialiseL();
|
|
98 |
|
|
99 |
RLbsGpsMeasurementUpdates::InitializeL();
|
|
100 |
|
|
101 |
/*
|
|
102 |
* Define the properties used by the Root Process API
|
|
103 |
*/
|
|
104 |
RLbsProcessSupervisor::InitializeL();
|
|
105 |
|
|
106 |
TProcessStartParams params;
|
|
107 |
_LIT(KDummyFileName, "\\sys\\bin\\testlbsgpslocmanager.exe");
|
|
108 |
_LIT(KDummyProcessName, "testlbsgpslocmanager");
|
|
109 |
params.SetProcessFileName(KDummyFileName);
|
|
110 |
params.SetProcessName(KDummyProcessName);
|
|
111 |
params.SetRendezvousRequired(ETrue);
|
|
112 |
TInt r = CProcessLaunch::ProcessLaunch(params);
|
|
113 |
User::LeaveIfError(r);
|
|
114 |
|
|
115 |
INFO_PRINTF1(_L("AGPSManagerProcess started in the file man0Step.cpp")); //Block start
|
|
116 |
INFO_PRINTF1(_L("Advise test integration module EPowerModeStandby"));
|
|
117 |
TLbsPositionUpdateRequestStatus request;
|
|
118 |
request.Tracking() = ETrue;
|
|
119 |
request.SetPowerAdvice(TLbsPositionUpdateRequestBase::EPowerAdviceStandby);
|
|
120 |
RLbsPositionUpdateRequests posReqs;
|
|
121 |
posReqs.OpenL(KChannelArray[0]);
|
|
122 |
CleanupClosePushL(posReqs);
|
|
123 |
|
|
124 |
const TUint KLbsGpsLocManagerUidValue = 0x10281D44;
|
|
125 |
const TUid KLbsGpsLocManagerUid = {KLbsGpsLocManagerUidValue};
|
|
126 |
|
|
127 |
RLbsModuleStatus modStatus;
|
|
128 |
modStatus.OpenL(KLbsGpsLocManagerUid);
|
|
129 |
CleanupClosePushL(modStatus);
|
|
130 |
TRequestStatus stat;
|
|
131 |
modStatus.NotifyModuleStatusChange(stat);
|
|
132 |
|
|
133 |
User::LeaveIfError(posReqs.SetPositionUpdateRequest(request));
|
|
134 |
/* now enable active scheduler and wait for call bacl to be called which exits sceduler */
|
|
135 |
|
|
136 |
|
|
137 |
User::WaitForRequest(stat);
|
|
138 |
if(stat.Int()!=KErrNone) User::Leave(KErrGeneral);
|
|
139 |
|
|
140 |
TPositionModuleStatus status;
|
|
141 |
TPositionModuleStatusEventBase::TModuleEvent occurredEvents =
|
|
142 |
TPositionModuleStatusEventBase::EEventNone;
|
|
143 |
User::LeaveIfError(modStatus.GetModuleStatus(&status, sizeof(TPositionModuleStatus), occurredEvents));
|
|
144 |
|
|
145 |
if(status.DeviceStatus() != TPositionModuleStatus::EDeviceStandBy)
|
|
146 |
{
|
|
147 |
User::Leave(KErrNotFound);
|
|
148 |
}
|
|
149 |
INFO_PRINTF1(_L("Test integration module correctly responds with EDeviceStandBy"));
|
|
150 |
|
|
151 |
// now iterate around all eight values for TDeviceStatus and
|
|
152 |
// check correct publishing to CPosIntGpsHwStatus
|
|
153 |
|
|
154 |
|
|
155 |
CPosIntGpsHwStatus* posIntGpsHwStatus = CPosIntGpsHwStatus::NewL(*this);
|
|
156 |
CleanupStack::PushL(posIntGpsHwStatus);
|
|
157 |
|
|
158 |
CActiveScheduler* temp = CActiveScheduler::Current();
|
|
159 |
|
|
160 |
// this test checks that the correct hardware status is
|
|
161 |
// sent to the OnStatusUpdateEvent (see MPosIntGpsHwStatusObserver)
|
|
162 |
// The strategy is for the test to send eight EPowerAdviceClosed
|
|
163 |
// messages to the AGPS manager which then passes each in turn
|
|
164 |
// to a test agps module which responds to each with one of an 8 ordered list
|
|
165 |
// of hw status updates to the agps manager.
|
|
166 |
// The manager publishes each value onto the api and
|
|
167 |
// this test checks that the correct values are oberved on OnStatusUpdateEvent.
|
|
168 |
for (TUint i= 0; i < 8; i++)
|
|
169 |
{
|
|
170 |
request.SetPowerAdvice(TLbsPositionUpdateRequestBase::EPowerAdviceClosed);
|
|
171 |
//request.SetPowerAdvice((TLbsPositionUpdateRequestBase::TPowerAdvice)(TInt)(TLbsPositionUpdateRequestBase::EPowerAdviceClosed+1));
|
|
172 |
User::LeaveIfError(posReqs.SetPositionUpdateRequest(request));
|
|
173 |
temp->Start();
|
|
174 |
|
|
175 |
}
|
|
176 |
|
|
177 |
CleanupStack::PopAndDestroy(posIntGpsHwStatus);
|
|
178 |
CleanupStack::PopAndDestroy(&modStatus);
|
|
179 |
CleanupStack::PopAndDestroy(&posReqs);
|
|
180 |
// Set the network registration status to 'home network' - as this is what most of
|
|
181 |
// the tests expect
|
|
182 |
RLbsNetworkRegistrationStatus netRegStatus;
|
|
183 |
netRegStatus.OpenL();
|
|
184 |
CleanupClosePushL(netRegStatus);
|
|
185 |
netRegStatus.SetNetworkRegistrationStatus(RLbsNetworkRegistrationStatus::ERegisteredHomeNetwork);
|
|
186 |
|
|
187 |
CleanupStack::PopAndDestroy(&netRegStatus);
|
|
188 |
|
|
189 |
// ************** Block end ****************
|
|
190 |
|
|
191 |
SetTestStepResult(EPass);
|
|
192 |
}
|
|
193 |
return TestStepResult();
|
|
194 |
}
|
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
static const CPosIntGpsHwStatus::TIntGpsHwStatus KResultStatusTable[8] =
|
|
200 |
{
|
|
201 |
CPosIntGpsHwStatus::EStatusOff, // EDeviceUnknown -> EStatusOff
|
|
202 |
CPosIntGpsHwStatus::EStatusOn, // EDeviceInitialising -> EStatusOn
|
|
203 |
CPosIntGpsHwStatus::EStatusOff, // EDeviceError -> EStatusOff
|
|
204 |
CPosIntGpsHwStatus::EStatusOn, // EDeviceStandBy -> EStatusOn
|
|
205 |
CPosIntGpsHwStatus::EStatusOff, // EDeviceDisabled -> EStatusOff
|
|
206 |
CPosIntGpsHwStatus::EStatusOn, // EDeviceReady -> EStatusOn
|
|
207 |
CPosIntGpsHwStatus::EStatusOff, // EDeviceInactive -> EStatusOff
|
|
208 |
CPosIntGpsHwStatus::EStatusActive // EDeviceActive -> EStatusActive
|
|
209 |
};
|
|
210 |
|
|
211 |
void Cman0Step::OnStatusUpdateEvent(CPosIntGpsHwStatus::TIntGpsHwStatus aStatus, TInt /*aError*/)
|
|
212 |
{
|
|
213 |
INFO_PRINTF3(_L("Received TIntGpsHwStatus %d and expected %d"), aStatus , KResultStatusTable[iStepCount]);
|
|
214 |
|
|
215 |
if (KResultStatusTable[iStepCount] != aStatus)
|
|
216 |
{
|
|
217 |
INFO_PRINTF1(_L("Test Failed"));
|
|
218 |
}
|
|
219 |
|
|
220 |
TESTL(aStatus == KResultStatusTable[iStepCount]);
|
|
221 |
iStepCount++;
|
|
222 |
|
|
223 |
CActiveScheduler::Stop();
|
|
224 |
}
|
|
225 |
|
|
226 |
TVerdict Cman0Step::doTestStepPostambleL()
|
|
227 |
/**
|
|
228 |
* @return - TVerdict code
|
|
229 |
* Override of base class virtual
|
|
230 |
*/
|
|
231 |
{
|
|
232 |
CTe_manSuiteStepBase::doTestStepPostambleL();
|
|
233 |
return TestStepResult();
|
|
234 |
}
|