|
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 mtlr9Step.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "mtlr9Step.h" |
|
23 #include "te_suplprotocolsuitedefs.h" |
|
24 |
|
25 /** |
|
26 Destructor |
|
27 */ |
|
28 Cmtlr9Step::~Cmtlr9Step() |
|
29 |
|
30 { |
|
31 } |
|
32 |
|
33 /** |
|
34 Constructor |
|
35 */ |
|
36 Cmtlr9Step::Cmtlr9Step() |
|
37 { |
|
38 SetTestStepName(Kmtlr9Step); |
|
39 } |
|
40 |
|
41 /** |
|
42 @return - TVerdict code |
|
43 Override of base class virtual |
|
44 */ |
|
45 TVerdict Cmtlr9Step::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 Cmtlr9Step 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 Cmtlr9Step::doTestStepL() |
|
69 { |
|
70 INFO_PRINTF1(_L("\t********************************************************************")); |
|
71 INFO_PRINTF1(_L("\tMTLR basic procedure followed - position method == NO POSITION")); |
|
72 INFO_PRINTF1(_L("\t********************************************************************")); |
|
73 INFO_PRINTF1(_L("- START -")); |
|
74 |
|
75 // Initiate MT-LR |
|
76 // Generate received SUPL INIT message (test message content #5) |
|
77 TPtr8 messagePtr(iReceiveBuffer.Des()); |
|
78 TInt err = iSuplInitGenerator->GenerateSuplInitL(5, 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 = 12345; |
|
88 TPtrC8 message(messagePtr); |
|
89 iSuplPush->SuplInit(reqId, message, 0); |
|
90 |
|
91 // Check Gateway receives a Privacy request |
|
92 INFO_PRINTF1(_L("\tLBS <- ProcessPrivacyRequest()")); |
|
93 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessPrivacyRequest)) |
|
94 { |
|
95 SetTestStepResult(EFail); |
|
96 return TestStepResult(); |
|
97 } |
|
98 |
|
99 // LBS delivers privacy response |
|
100 INFO_PRINTF1(_L("\tLBS -> RespondPrivacyRequest ()")); |
|
101 CLbsNetworkProtocolBase::TLbsPrivacyResponse privacyResponse = CLbsNetworkProtocolBase::EPrivacyResponseAccepted; |
|
102 iModule->RespondPrivacyRequest(iGatewayObserver->SessionIdValue(), privacyResponse, 0); |
|
103 |
|
104 // Check Connection Manager receives a request for connecting |
|
105 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq)) |
|
106 { |
|
107 SetTestStepResult(EFail); |
|
108 return TestStepResult(); |
|
109 } |
|
110 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET")); |
|
111 |
|
112 // Simulate the connection is up (inject that event) |
|
113 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET")); |
|
114 iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId()); |
|
115 |
|
116 |
|
117 // Check Connection Manager receives a request to send a SUPL END with status code "User Accepted" |
|
118 // with the assistance data mask requested by the gateway |
|
119 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplEndSendReq)) |
|
120 { |
|
121 SetTestStepResult(EFail); |
|
122 return TestStepResult(); |
|
123 } |
|
124 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END -> NET")); |
|
125 |
|
126 |
|
127 // Check gateway session completed |
|
128 if (EFail == CheckGatewayCallbackL( |
|
129 CSuplGatewayObserver::EProcessSessionComplete)) |
|
130 { |
|
131 SetTestStepResult(EFail); |
|
132 return TestStepResult(); |
|
133 } |
|
134 INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); |
|
135 |
|
136 // Check Connection Manager receives a disconnection request |
|
137 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq)) |
|
138 { |
|
139 SetTestStepResult(EFail); |
|
140 return TestStepResult(); |
|
141 } |
|
142 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET")); |
|
143 |
|
144 // Check if more observer activity takes place |
|
145 if (iGatewayObserver->IsMoreObserverActivity() || |
|
146 iNetworkObserver->IsMoreObserverActivity()) |
|
147 { |
|
148 SetTestStepResult(EFail); |
|
149 return TestStepResult(); |
|
150 } |
|
151 INFO_PRINTF1(_L("- END -")); |
|
152 |
|
153 SetTestStepResult(EPass); |
|
154 return TestStepResult(); |
|
155 |
|
156 } |
|
157 |
|
158 |
|
159 /** |
|
160 * @return - TVerdict code |
|
161 * Override of base class virtual |
|
162 */ |
|
163 TVerdict Cmtlr9Step::doTestStepPostambleL() |
|
164 { |
|
165 delete iModule; |
|
166 |
|
167 delete iSuplPush; |
|
168 delete iSuplInitGenerator; |
|
169 |
|
170 // Call base class method for post test actions |
|
171 CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); |
|
172 return TestStepResult(); |
|
173 } |
|
174 |
|
175 |
|
176 /** |
|
177 Overrides the pure virtual MLbsSuplPushObserver::OnSuplInitComplete. |
|
178 Receives the result of the message sending. |
|
179 |
|
180 @param aError [In] The error code or KErrNone if successful. |
|
181 |
|
182 @see MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent |
|
183 @see CTe_LbsSuplSmsTriggerSender::SendMessage |
|
184 */ |
|
185 void Cmtlr9Step::OnSuplInitComplete(TLbsSuplPushChannel /*aChannel*/, TLbsSuplPushRequestId /*aReqId*/, TInt aError, TInt /*aReserved*/) |
|
186 { |
|
187 iSmsSendError = aError; |
|
188 if (iSmsSendError != KErrNone) |
|
189 { |
|
190 User::Invariant(); |
|
191 } |
|
192 } |
|
193 |