|
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 // @file ctlbsconflictstep.h |
|
15 // This contains the header file for LBS Conflict Test Step Base |
|
16 // |
|
17 // |
|
18 |
|
19 #ifndef __CT_LBS_CONFLICT_STEP_H__ |
|
20 #define __CT_LBS_CONFLICT_STEP_H__ |
|
21 |
|
22 |
|
23 // EPOC includes. |
|
24 #include <test/testexecutestepbase.h> |
|
25 |
|
26 // LBS test includes. |
|
27 #include <lbs/test/lbsnetsimtest.h> |
|
28 #include <lbs/test/lbsnetsimtestobserver.h> |
|
29 |
|
30 #include "ctlbsconflictserver.h" |
|
31 #include <lbs/test/ctlbstimerutils.h> |
|
32 |
|
33 |
|
34 const TInt KLbsKeepAlivePeriod = 10000; |
|
35 const TUint KLbsAbortPeriod = 10000000; // The test case should finish before 10 seconds, use different value if not in test step code. |
|
36 |
|
37 const TInt KKeepAliveTimerId = 0; |
|
38 const TInt KAbortTimerId = 1; |
|
39 |
|
40 // X3P helper items. |
|
41 _LIT(KTransmitPushDestination, "02"); |
|
42 _LIT(KTransmitMenuDestination, "08"); |
|
43 _LIT(KTransmitTimerDestination, "10"); |
|
44 |
|
45 _LIT(KTransmitPush2Destination, "02"); |
|
46 _LIT(KTransmitMenu2Destination, "08"); |
|
47 |
|
48 const TUint KTransmitPushPriority = 0x02; |
|
49 const TUint KTransmitMenuPriority = 0x08; |
|
50 const TUint KTransmitTimerPriority = 0x10; |
|
51 |
|
52 const TUint KTransmitPush2Priority = 0x02; |
|
53 const TUint KTransmitMenu2Priority = 0x08; |
|
54 |
|
55 const TInt KLbsConflictX3PPushId = 0x02; |
|
56 const TInt KLbsConflictX3PMenuId = 0x08; |
|
57 const TInt KLbsConflictX3PTimerId = 0x10; |
|
58 |
|
59 const TInt KLbsConflictX3PPush2Id = 0x022; |
|
60 const TInt KLbsConflictX3PMenu2Id = 0x088; |
|
61 |
|
62 |
|
63 class CT_LbsConflictStep : |
|
64 public CTestStep, |
|
65 public MT_LbsTimerUtilsObserver, |
|
66 public MLbsNetSimTestObserver |
|
67 { |
|
68 |
|
69 public: |
|
70 virtual ~CT_LbsConflictStep(); |
|
71 |
|
72 virtual TVerdict doTestStepPreambleL(); |
|
73 virtual TVerdict doTestStepPostambleL(); |
|
74 |
|
75 // From MLbsNetSimTestObserver. |
|
76 virtual void Connected(); |
|
77 virtual void Disconnected(); |
|
78 virtual void NotifyRegisterLcsMoLr(const TDesC& aData); |
|
79 virtual void NotifyReleaseLcsMoLr(TInt aReason); |
|
80 virtual void NotifyMeasurementControlLocation(const TPositionInfo& aPosition, const RLbsAssistanceDataBuilderSet& aData, const TLbsNetPosRequestQuality& aQuality); |
|
81 virtual void NotifyReleaseLcsLocationNotification(const CLbsNetworkProtocolBase::TLbsPrivacyResponse& aResult); |
|
82 virtual void NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition); |
|
83 virtual void NotifyMeasurementReportLocation(const TPositionInfo& aPosition); |
|
84 virtual void NotifyMeasurementReportRequestMoreAssistanceData(const TLbsAssistanceDataGroup& aFilter); |
|
85 virtual void NotifyMeasurementReportControlFailure(TInt aReason); |
|
86 virtual void NotifyError(MLbsNetSimTestObserver::EFunction aFunction, int aError); |
|
87 virtual void ProcessMeasurementControlLocationError(TInt aError); |
|
88 |
|
89 protected: |
|
90 CT_LbsConflictStep(CT_LbsConflictServer& aParent); |
|
91 |
|
92 void ConstructL(); |
|
93 |
|
94 TInt OpenNetSim(MLbsNetSimTestObserver* aObserver); |
|
95 void CloseNetSim(); |
|
96 |
|
97 void EnterEmergencyState(); |
|
98 void ExitEmergencyState(); |
|
99 void StartNetworkPrivacyRequest(); |
|
100 void SetVerifySeqEvent(TInt aSeqEventId); |
|
101 void SetVerifyAdhocEvent(TInt aAdhocEventId); |
|
102 void SetCurrentSeqEvent(TInt aSeqEventId); |
|
103 TBool VerifySeqEvents(); |
|
104 |
|
105 |
|
106 // From MT_LbsTimerUtilsObserver - keep alive timer to ensure we recvice all callbacks. |
|
107 virtual void HandleTimerL(TInt aTimerId, const TTime& aTargetTime); |
|
108 |
|
109 enum { |
|
110 // Self Locate. |
|
111 ESelf_MOLR_NetSim_Got_NotifyRegisterLcsMoLr = 0x0010, // --> TO NET |
|
112 ESelf_MOLR_NetSim_Got_NotifyReleaseLcsMoLr, // <-- FROM NET |
|
113 ESelf_MOLR_NetSim_Got_NotifyMeasurementControlLocation, // <-- FROM NET |
|
114 ESelf_MOLR_NetSim_Got_NotifyReleaseLcsLocationNotification, // ?? consider removing |
|
115 ESelf_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult, // <-- FROM NET |
|
116 ESelf_MOLR_NetSim_Got_NotifyMeasurementReportLocation, // --> TO NET |
|
117 ESelf_MOLR_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData, // --> TO NET |
|
118 ESelf_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure, |
|
119 ESelf_MOLR_NetSim_Got_NotifyError, |
|
120 ESelf_MOLR_NetSim_Got_ProcessMeasurementControlLocationError, |
|
121 EClient_Got_PosUpdate_Complete, |
|
122 |
|
123 // X3P MENU. |
|
124 EX3P_MENU_MOLR_NetSim_Got_NotifyRegisterLcsMoLr = 0x0020, |
|
125 EX3P_MENU_MOLR_NetSim_Got_NotifyReleaseLcsMoLr, |
|
126 EX3P_MENU_MOLR_NetSim_Got_NotifyMeasurementControlLocation, |
|
127 EX3P_MENU_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult, |
|
128 EX3P_MENU_MOLR_NetSim_Got_NotifyMeasurementReportLocation, |
|
129 EX3P_MENU_MOLR_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData, |
|
130 EX3P_MENU_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure, |
|
131 EX3P_MENU_MOLR_NetSim_Got_NotifyError, |
|
132 EX3P_MENU_MOLR_NetSim_Got_ProcessMeasurementControlLocationError, |
|
133 |
|
134 // X3P TIMER. |
|
135 EX3P_TIMER_MOLR_NetSim_Got_NotifyRegisterLcsMoLr = 0x0030, |
|
136 EX3P_TIMER_MOLR_NetSim_Got_NotifyReleaseLcsMoLr, |
|
137 EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementControlLocation, |
|
138 EX3P_TIMER_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult, |
|
139 EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementReportLocation, |
|
140 EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData, |
|
141 EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure, |
|
142 EX3P_TIMER_MOLR_NetSim_Got_NotifyError, |
|
143 EX3P_TIMER_MOLR_NetSim_Got_ProcessMeasurementControlLocationError, |
|
144 |
|
145 // X3P PUSH. |
|
146 EX3P_PUSH_MOLR_NetSim_Got_NotifyRegisterLcsMoLr = 0x0040, |
|
147 EX3P_PUSH_MOLR_NetSim_Got_NotifyReleaseLcsMoLr, |
|
148 EX3P_PUSH_MOLR_NetSim_Got_NotifyMeasurementControlLocation, |
|
149 EX3P_PUSH_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult, |
|
150 EX3P_PUSH_MOLR_NetSim_Got_NotifyMeasurementReportLocation, |
|
151 EX3P_PUSH_MOLR_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData, |
|
152 EX3P_PUSH_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure, |
|
153 EX3P_PUSH_MOLR_NetSim_Got_NotifyError, |
|
154 EX3P_PUSH_MOLR_NetSim_Got_ProcessMeasurementControlLocationError, |
|
155 |
|
156 EClient_Got_X3P_Complete, |
|
157 |
|
158 // MTLR. |
|
159 EMTLR_NetSim_Got_NotifyReleaseLcsLocationNotification = 0x0050, // --> TO NET ? |
|
160 EMTLR_NetSim_Got_NotifyMeasurementControlLocation, // <-- FROM NET |
|
161 EMTLR_NetSim_Got_NotifyMeasurementReportLocation, // --> TO NET |
|
162 |
|
163 EMTLR_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData, |
|
164 |
|
165 EMTLR_NetSim_Got_NotifyMeasurementReportControlFailure, |
|
166 EMTLR_NetSim_Got_NotifyError, |
|
167 EMTLR_NetSim_Got_ProcessMeasurementControlLocationError, |
|
168 |
|
169 EClient_Priv_Got_ProcessNetworkLocationRequest, |
|
170 EClient_Priv_Got_ProcessNetworkPositionUpdate, |
|
171 EClient_Priv_Got_ProcessRequestComplete, |
|
172 |
|
173 //X3P MENU2 (SECOND REQ) |
|
174 EX3P_MENU2_MOLR_NetSim_Got_NotifyRegisterLcsMoLr = 0x0060, |
|
175 EX3P_MENU2_MOLR_NetSim_Got_NotifyReleaseLcsMoLr, |
|
176 EX3P_MENU2_MOLR_NetSim_Got_NotifyMeasurementControlLocation, |
|
177 EX3P_MENU2_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult, |
|
178 EX3P_MENU2_MOLR_NetSim_Got_NotifyMeasurementReportLocation, |
|
179 EX3P_MENU2_MOLR_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData, |
|
180 EX3P_MENU2_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure, |
|
181 EX3P_MENU2_MOLR_NetSim_Got_NotifyError, |
|
182 EX3P_MENU2_MOLR_NetSim_Got_ProcessMeasurementControlLocationError, |
|
183 |
|
184 //X3P PUSH2 (SECOND REQ) |
|
185 EX3P_PUSH2_MOLR_NetSim_Got_NotifyRegisterLcsMoLr = 0x0070, |
|
186 EX3P_PUSH2_MOLR_NetSim_Got_NotifyReleaseLcsMoLr, |
|
187 EX3P_PUSH2_MOLR_NetSim_Got_NotifyMeasurementControlLocation, |
|
188 EX3P_PUSH2_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult, |
|
189 EX3P_PUSH2_MOLR_NetSim_Got_NotifyMeasurementReportLocation, |
|
190 EX3P_PUSH2_MOLR_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData, |
|
191 EX3P_PUSH2_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure, |
|
192 EX3P_PUSH2_MOLR_NetSim_Got_NotifyError, |
|
193 EX3P_PUSH2_MOLR_NetSim_Got_ProcessMeasurementControlLocationError |
|
194 }; |
|
195 |
|
196 |
|
197 enum { EConnecting = 0, /** Waiting for the Net Sim to connect to the protocol module. */ |
|
198 EWaiting, /** Waiting for all the callbacks to be fired. */ |
|
199 EAborted, /** Abort timer has fired before all callbacks fired */ |
|
200 EDone, /** All the correct callbacks have been fired (and extended timer, if any, has fired), the test can end. */ |
|
201 ELast}; /** Used to allow extension of enums in derived classes - do not use! */ |
|
202 |
|
203 |
|
204 |
|
205 /** Network Simulator, to allow MT-LRs and to monitor network messages. |
|
206 */ |
|
207 RLbsNetSimTest iNetSim; |
|
208 |
|
209 /** State machine variable for the test step. |
|
210 */ |
|
211 TInt iState; |
|
212 |
|
213 |
|
214 /** Verify sequence array of expected events (callbacks) for a test. |
|
215 */ |
|
216 RArray<TInt> iVerifySeqArr; |
|
217 |
|
218 /** Verify adhoc array of expected events (callbacks) for a test. |
|
219 */ |
|
220 RArray<TInt> iVerifyAdhocArr; |
|
221 |
|
222 /** Current sequence array of actual events which were generated during the test. |
|
223 */ |
|
224 RArray<TInt> iCurrentSeqArr; |
|
225 |
|
226 |
|
227 /** Reference position used to setup Net sim and later verification. */ |
|
228 TPosition iRefPos; |
|
229 |
|
230 |
|
231 /** Timer used to ensure the test step keeps processing until all the required callbacks |
|
232 have been called. Otherwise we would execute the test step calls and return from the |
|
233 doTestStepL function and miss the callbacks being fired. |
|
234 */ |
|
235 CT_LbsTimerUtils* iKeepAliveTimer; |
|
236 |
|
237 /** Timer used to abort the test step if all callbacks have not fired. Individual test |
|
238 cases can start this time with appropriate time. |
|
239 */ |
|
240 CT_LbsTimerUtils* iAbortTimer; |
|
241 |
|
242 |
|
243 /** Gives access to server member variables. |
|
244 */ |
|
245 CT_LbsConflictServer& iParent; |
|
246 }; |
|
247 |
|
248 #endif // __CT_LBS_CONFLICT_STEP_H__ |