|
1 // Copyright (c) 2005-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 mtlr26Step.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "mtlr26Step.h" |
|
23 #include "te_suplprotocolsuitedefs.h" |
|
24 |
|
25 /** |
|
26 Destructor |
|
27 */ |
|
28 Cmtlr26Step::~Cmtlr26Step() |
|
29 |
|
30 { |
|
31 } |
|
32 |
|
33 /** |
|
34 Constructor |
|
35 */ |
|
36 Cmtlr26Step::Cmtlr26Step() |
|
37 { |
|
38 SetTestStepName(Kmtlr26Step); |
|
39 } |
|
40 |
|
41 /** |
|
42 @return - TVerdict code |
|
43 Override of base class virtual |
|
44 */ |
|
45 TVerdict Cmtlr26Step::doTestStepPreambleL() |
|
46 { |
|
47 // Call base class method for pre test actions |
|
48 CTe_suplprotocolSuiteStepBase::doTestStepPreambleL(); |
|
49 |
|
50 TLbsNetProtocolModuleParams param(*iGatewayObserver); |
|
51 iModule = CSuplGatewayInterface::NewL(reinterpret_cast<TAny*>(¶m)); |
|
52 |
|
53 // components for generating incoming SMS SUPL INIT |
|
54 iSuplPush = CLbsSuplPush::NewL(ELbsSuplPushChannelSMS, *this); |
|
55 iSuplInitGenerator = CSuplInitGenerator::NewL(); |
|
56 |
|
57 return TestStepResult(); |
|
58 } |
|
59 |
|
60 |
|
61 /** Perform Cmtlr26Step test step. |
|
62 This test verifies that the SUPL Protocol Module correctly handles |
|
63 an MT-LR Network requested Locate Terminal Based sequence (assistance data |
|
64 delivered via an RRLP payload). |
|
65 |
|
66 @return TVerdict test result code |
|
67 */ |
|
68 TVerdict Cmtlr26Step::doTestStepL() |
|
69 { |
|
70 INFO_PRINTF1(_L("\t********************************************************************")); |
|
71 INFO_PRINTF1(_L("\tMTLR - LBS sends response with error code KPositionCalculationFutile)")); |
|
72 INFO_PRINTF1(_L("\t********************************************************************")); |
|
73 INFO_PRINTF1(_L("- START -")); |
|
74 |
|
75 // Initiate MT-LR |
|
76 // Generate received SUPL INIT message (test message content #0) |
|
77 TPtr8 messagePtr(iReceiveBuffer.Des()); |
|
78 TInt err = iSuplInitGenerator->GenerateSuplInitL(0, messagePtr); |
|
79 if (err != KErrNone) |
|
80 { |
|
81 SetTestStepResult(EFail); |
|
82 return TestStepResult(); |
|
83 } |
|
84 |
|
85 // Inject SUPL INIT using the SUPL Push API |
|
86 INFO_PRINTF1(_L("\tLBS (SuplPush) -> OnSuplInit()")); |
|
87 TLbsSuplPushRequestId reqId = 12445; |
|
88 TPtrC8 message(messagePtr); |
|
89 iSuplPush->SuplInit(reqId, message, 0); |
|
90 |
|
91 // Check Gateway receives a Privacy request and Location Request |
|
92 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
93 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessLocationRequest) || |
|
94 !iGatewayObserver->IsPrivReqReceived() || |
|
95 MLbsNetworkProtocolObserver::EServiceMobileTerminated != iGatewayObserver->LocType() ) |
|
96 { |
|
97 SetTestStepResult(EFail); |
|
98 return TestStepResult(); |
|
99 } |
|
100 |
|
101 // Wait a couple of seconds for user instructions |
|
102 INFO_PRINTF1(_L("...user taking a couple of seconds for privacy response")); |
|
103 if (iGatewayObserver->IsMoreObserverActivity() || |
|
104 iNetworkObserver->IsMoreObserverActivity()) |
|
105 { |
|
106 SetTestStepResult(EFail); |
|
107 return TestStepResult(); |
|
108 } |
|
109 |
|
110 // LBS delivers privacy response |
|
111 INFO_PRINTF1(_L("\tLBS -> PrivacyResponse (EPrivacyResponseAccepted)")); |
|
112 CLbsNetworkProtocolBase::TLbsPrivacyResponse privacyResponse = CLbsNetworkProtocolBase::EPrivacyResponseAccepted; |
|
113 iModule->RespondPrivacyRequest(iGatewayObserver->SessionIdValue(), privacyResponse, 0); |
|
114 |
|
115 // Check Connection Manager receives a request for connecting |
|
116 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq)) |
|
117 { |
|
118 SetTestStepResult(EFail); |
|
119 return TestStepResult(); |
|
120 } |
|
121 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET")); |
|
122 |
|
123 |
|
124 // Simulate the connection is up (inject that event) |
|
125 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET")); |
|
126 iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId()); |
|
127 |
|
128 |
|
129 // **************** Location Response is sent by LBS with KPositionCalculationFutile ************* |
|
130 // ************************************************************************************************** |
|
131 |
|
132 // Fake LBS sending results (position) to SPM |
|
133 INFO_PRINTF1(_L("\tLBS -> RespondLocationRequest")); |
|
134 TReal64 latitude = 10; |
|
135 TReal64 longitude = 0; |
|
136 TReal32 HorAccuracy = 10; |
|
137 TPositionInfo mobilePosInfo; |
|
138 TTime utcTime; |
|
139 utcTime.UniversalTime(); |
|
140 TCoordinate coor(latitude,longitude); |
|
141 TPosition mobilePos(TLocality(coor,HorAccuracy),utcTime); |
|
142 mobilePosInfo.SetPosition(mobilePos); |
|
143 iModule->RespondLocationRequest(iGatewayObserver->SessionIdValue(),KPositionCalculationFutile,mobilePosInfo); |
|
144 |
|
145 // Check Connection Manager receives a request to send a SUPL END |
|
146 // with the assistance data mask requested by the gateway |
|
147 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplEndSendReq)) |
|
148 { |
|
149 SetTestStepResult(EFail); |
|
150 return TestStepResult(); |
|
151 } |
|
152 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END -> NET")); |
|
153 |
|
154 // Check gateway session completed |
|
155 if (EFail == CheckGatewayCallbackL( |
|
156 CSuplGatewayObserver::EProcessSessionComplete)) |
|
157 { |
|
158 SetTestStepResult(EFail); |
|
159 return TestStepResult(); |
|
160 } |
|
161 INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); |
|
162 |
|
163 // Check Connection Manager receives a disconnection request |
|
164 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq)) |
|
165 { |
|
166 SetTestStepResult(EFail); |
|
167 return TestStepResult(); |
|
168 } |
|
169 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET")); |
|
170 |
|
171 // Check if more observer activity takes place |
|
172 if (iGatewayObserver->IsMoreObserverActivity() || |
|
173 iNetworkObserver->IsMoreObserverActivity()) |
|
174 { |
|
175 SetTestStepResult(EFail); |
|
176 return TestStepResult(); |
|
177 } |
|
178 INFO_PRINTF1(_L("- END -")); |
|
179 |
|
180 SetTestStepResult(EPass); |
|
181 return TestStepResult(); |
|
182 |
|
183 } |
|
184 |
|
185 |
|
186 /** |
|
187 * @return - TVerdict code |
|
188 * Override of base class virtual |
|
189 */ |
|
190 TVerdict Cmtlr26Step::doTestStepPostambleL() |
|
191 { |
|
192 delete iModule; |
|
193 |
|
194 delete iSuplPush; |
|
195 delete iSuplInitGenerator; |
|
196 |
|
197 // Call base class method for post test actions |
|
198 CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); |
|
199 return TestStepResult(); |
|
200 } |
|
201 |
|
202 |
|
203 /** |
|
204 Overrides the pure virtual MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent. |
|
205 Receives the result of the message sending. |
|
206 |
|
207 @param aError [In] The error code or KErrNone if successful. |
|
208 |
|
209 @see MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent |
|
210 @see CTe_LbsSuplSmsTriggerSender::SendMessage |
|
211 */ |
|
212 void Cmtlr26Step::OnSuplInitComplete(TLbsSuplPushChannel /*aChannel*/, TLbsSuplPushRequestId /*aReqId*/, TInt aError, TInt /*aReserved*/) |
|
213 { |
|
214 iSmsSendError = aError; |
|
215 if (iSmsSendError != KErrNone) |
|
216 { |
|
217 User::Invariant(); |
|
218 } |
|
219 } |
|
220 |