748
|
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 the License "Symbian Foundation License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// @file ctlbsNetsimstep.h
|
|
15 |
// This contains the header file for LBS Net Sim Test Step Base
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
#ifndef __CT_LBS_NET_SIM_STEP_H__
|
|
20 |
#define __CT_LBS_NET_SIM_STEP_H__
|
|
21 |
|
|
22 |
// EPOC includes.
|
|
23 |
#include <testexecutestepbase.h>
|
|
24 |
|
|
25 |
// LBS test includes.
|
|
26 |
#include <lbsnetsimtest.h>
|
|
27 |
#include <lbsnetsimtestobserver.h>
|
|
28 |
|
|
29 |
#include "ctlbstimerutils.h"
|
|
30 |
|
|
31 |
|
|
32 |
const TInt KLbsKeepAlivePeriod = 10000;
|
|
33 |
|
|
34 |
const TInt KKeepAliveTimerId = 0;
|
|
35 |
const TInt KAbortTimerId = 34;
|
|
36 |
|
|
37 |
/** Callback flags held as bits in a 32 bit word.
|
|
38 |
*/
|
|
39 |
typedef TUint32 TLbsCallbackFlags;
|
|
40 |
|
|
41 |
const TLbsCallbackFlags KLbsCallback_None = 0x0000;
|
|
42 |
|
|
43 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_Connect = 0x0001;
|
|
44 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_Disconnect = 0x0002;
|
|
45 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr = 0x0004;
|
|
46 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr = 0x0008;
|
|
47 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation = 0x0010;
|
|
48 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyReleaseLcsLocationNotification = 0x0020;
|
|
49 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult = 0x0040;
|
|
50 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation = 0x0080;
|
|
51 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData = 0x0100;
|
|
52 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure = 0x0200;
|
|
53 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyError = 0x0400;
|
|
54 |
const TLbsCallbackFlags KLbsCallback_NetSim_Got_ProcessMeasurementControlLocationError = 0x0800;
|
|
55 |
|
|
56 |
// NOTE: Derived test case will assume that they create new flags starting at 0x1000. If you add additional
|
|
57 |
// flags here, the derived test cases will have to be updated also.
|
|
58 |
|
|
59 |
const TLbsCallbackFlags KLbsCallback_MoLr =
|
|
60 |
KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr | // --> NET
|
|
61 |
KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation | // <-- NET
|
|
62 |
KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation | // --> NET
|
|
63 |
KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult | // <-- NET
|
|
64 |
KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr; // --> NET
|
|
65 |
|
|
66 |
//const TLbsCallbackFlags KLbsCallback_NetworkBasedLocation =
|
|
67 |
// KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr | // --> NET
|
|
68 |
// KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation | // <-- NET
|
|
69 |
// KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure | // --> NET
|
|
70 |
|
|
71 |
// KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr; // --> NET
|
|
72 |
|
|
73 |
const TLbsCallbackFlags KLbsCallback_NetworkBasedLocation =
|
|
74 |
KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr | // --> NET
|
|
75 |
KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation | // <-- NET
|
|
76 |
KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation | // --> NET
|
|
77 |
KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult | // <-- NET
|
|
78 |
KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr; // --> NET
|
|
79 |
|
|
80 |
const TLbsCallbackFlags KLbsCallback_MtLr =
|
|
81 |
// note: we get no notification of the
|
|
82 |
KLbsCallback_NetSim_Got_NotifyReleaseLcsLocationNotification | // response to privacy request
|
|
83 |
KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation | // location request
|
|
84 |
KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation;
|
|
85 |
|
|
86 |
|
|
87 |
class CT_LbsNetSimStep : public CTestStep,
|
|
88 |
public MT_LbsTimerUtilsObserver,
|
|
89 |
public MLbsNetSimTestObserver
|
|
90 |
{
|
|
91 |
|
|
92 |
public:
|
|
93 |
|
|
94 |
virtual ~CT_LbsNetSimStep();
|
|
95 |
|
|
96 |
virtual TVerdict doTestStepPreambleL();
|
|
97 |
virtual TVerdict doTestStepPostambleL();
|
|
98 |
|
|
99 |
|
|
100 |
// From MLbsNetSimTestObserver.
|
|
101 |
virtual void Connected();
|
|
102 |
virtual void Disconnected();
|
|
103 |
virtual void NotifyRegisterLcsMoLr(const TDesC& aData);
|
|
104 |
virtual void NotifyReleaseLcsMoLr(TInt aReason);
|
|
105 |
virtual void NotifyMeasurementControlLocation(const TPositionInfo& aPosition, const RLbsAssistanceDataBuilderSet& aData, const TLbsNetPosRequestQuality& aQuality);
|
|
106 |
virtual void NotifyReleaseLcsLocationNotification(const CLbsNetworkProtocolBase::TLbsPrivacyResponse& aResult);
|
|
107 |
virtual void NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition);
|
|
108 |
virtual void NotifyMeasurementReportLocation(const TPositionInfo& aPosition);
|
|
109 |
virtual void NotifyMeasurementReportRequestMoreAssistanceData(const TLbsAssistanceDataGroup& aFilter);
|
|
110 |
virtual void NotifyMeasurementReportControlFailure(TInt aReason);
|
|
111 |
virtual void NotifyError(MLbsNetSimTestObserver::EFunction aFunction, int aError);
|
|
112 |
virtual void ProcessMeasurementControlLocationError(TInt aError);
|
|
113 |
|
|
114 |
protected:
|
|
115 |
|
|
116 |
CT_LbsNetSimStep();
|
|
117 |
|
|
118 |
/** If aHaltTimerInterval is set, the test will continue for this period of time after all halt flags have been set
|
|
119 |
*/
|
|
120 |
void ConstructL(TTimeIntervalMicroSeconds32 aHaltTimerInterval = 0);
|
|
121 |
|
|
122 |
/** Can be used to set the extended timer interval if not known at construct time
|
|
123 |
*/
|
|
124 |
void SetExtendedTimerInterval(TTimeIntervalMicroSeconds32 aHaltTimerInterval);
|
|
125 |
|
|
126 |
void SetCallbackFlag(TLbsCallbackFlags aCallbackFlag);
|
|
127 |
TBool TestCallbackFlags(TLbsCallbackFlags aExpectedFlags);
|
|
128 |
|
|
129 |
|
|
130 |
// From MT_LbsTimerUtilsObserver - keep alive timer to ensure we recvice all callbacks.
|
|
131 |
virtual void HandleTimerL(TInt aTimerId, const TTime& aTargetTime);
|
|
132 |
|
|
133 |
|
|
134 |
enum { EConnecting = 0, /** Waiting for the Net Sim to connect to the protocol module. */
|
|
135 |
EWaiting, /** Waiting for all the callbacks to be fired. */
|
|
136 |
EExtendedWaiting, /** Waiting for extended timer to fire */
|
|
137 |
EAborted, /** Abort timer has fired before all callbacks fired */
|
|
138 |
EDone, /** All the correct callbacks have been fired (and extended timer, if any, has fired), the test can end. */
|
|
139 |
ELast}; /** Used to allow extension of enums in derived classes - do not use! */
|
|
140 |
|
|
141 |
/** State machine variable for the test step.
|
|
142 |
*/
|
|
143 |
TInt iState;
|
|
144 |
|
|
145 |
|
|
146 |
/** Used to keep a record off all the callback events.
|
|
147 |
*/
|
|
148 |
TLbsCallbackFlags iCallbackFlags;
|
|
149 |
|
|
150 |
|
|
151 |
/** Expected callback flags at test end.
|
|
152 |
*/
|
|
153 |
TLbsCallbackFlags iFlagsToHaltOn;
|
|
154 |
|
|
155 |
/** If this is non-zero, the test will continue for this period of time after all halt flags have been set
|
|
156 |
*/
|
|
157 |
TTimeIntervalMicroSeconds32 iExtendedTimerInterval;
|
|
158 |
|
|
159 |
/** Network Simulator, to allow MT-LRs and to monitor network messages.
|
|
160 |
*/
|
|
161 |
RLbsNetSimTest iNetSim;
|
|
162 |
|
|
163 |
|
|
164 |
/** Timer used to ensure the test step keeps processing until all the required callbacks
|
|
165 |
have been called. Otherwise we would execute the test step calls and return from the
|
|
166 |
doTestStepL function and miss the callbacks being fired.
|
|
167 |
*/
|
|
168 |
CT_LbsTimerUtils* iKeepAliveTimer;
|
|
169 |
|
|
170 |
/** Timer used to abort the test step if all callbacks have not fired. Individual test cases can start this time with appropriate time.
|
|
171 |
|
|
172 |
*/
|
|
173 |
CT_LbsTimerUtils* iAbortTimer;
|
|
174 |
|
|
175 |
};
|
|
176 |
|
|
177 |
#endif // __CT_LBS_STEP_H__
|