|
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 mtlr22Step.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "mtlr22Step.h" |
|
23 #include "te_suplprotocolsuitedefs.h" |
|
24 |
|
25 /** |
|
26 Destructor |
|
27 */ |
|
28 Cmtlr22Step::~Cmtlr22Step() |
|
29 |
|
30 { |
|
31 } |
|
32 |
|
33 /** |
|
34 Constructor |
|
35 */ |
|
36 Cmtlr22Step::Cmtlr22Step() |
|
37 { |
|
38 SetTestStepName(Kmtlr22Step); |
|
39 } |
|
40 |
|
41 /** |
|
42 @return - TVerdict code |
|
43 Override of base class virtual |
|
44 */ |
|
45 TVerdict Cmtlr22Step::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 Cmtlr22Step 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 Cmtlr22Step::doTestStepL() |
|
69 { |
|
70 INFO_PRINTF1(_L("\t********************************************************************")); |
|
71 INFO_PRINTF1(_L("\tMTLR - user chooses to ignore SUPL INIT)")); |
|
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 = 12345; |
|
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 (EPrivacyResponseIgnored)")); |
|
112 CLbsNetworkProtocolBase::TLbsPrivacyResponse privacyResponse = CLbsNetworkProtocolBase::EPrivacyResponseIgnored; |
|
113 iModule->RespondPrivacyRequest(iGatewayObserver->SessionIdValue(), privacyResponse, 0); |
|
114 |
|
115 // Check that Gateway receives a session complete |
|
116 if (EFail == CheckGatewayCallbackL( |
|
117 CSuplGatewayObserver::EProcessSessionComplete)) |
|
118 { |
|
119 SetTestStepResult(EFail); |
|
120 return TestStepResult(); |
|
121 } |
|
122 INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); |
|
123 |
|
124 // Check if more observer activity takes place |
|
125 if (iGatewayObserver->IsMoreObserverActivity() || |
|
126 iNetworkObserver->IsMoreObserverActivity()) |
|
127 { |
|
128 SetTestStepResult(EFail); |
|
129 return TestStepResult(); |
|
130 } |
|
131 INFO_PRINTF1(_L("- END -")); |
|
132 |
|
133 |
|
134 SetTestStepResult(EPass); |
|
135 return TestStepResult(); |
|
136 |
|
137 } |
|
138 |
|
139 |
|
140 /** |
|
141 * @return - TVerdict code |
|
142 * Override of base class virtual |
|
143 */ |
|
144 TVerdict Cmtlr22Step::doTestStepPostambleL() |
|
145 { |
|
146 delete iModule; |
|
147 |
|
148 delete iSuplPush; |
|
149 delete iSuplInitGenerator; |
|
150 |
|
151 // Call base class method for post test actions |
|
152 CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); |
|
153 return TestStepResult(); |
|
154 } |
|
155 |
|
156 |
|
157 /** |
|
158 Overrides the pure virtual MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent. |
|
159 Receives the result of the message sending. |
|
160 |
|
161 @param aError [In] The error code or KErrNone if successful. |
|
162 |
|
163 @see MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent |
|
164 @see CTe_LbsSuplSmsTriggerSender::SendMessage |
|
165 */ |
|
166 void Cmtlr22Step::OnSuplInitComplete(TLbsSuplPushChannel /*aChannel*/, TLbsSuplPushRequestId /*aReqId*/, TInt aError, TInt /*aReserved*/) |
|
167 { |
|
168 iSmsSendError = aError; |
|
169 if (iSmsSendError != KErrNone) |
|
170 { |
|
171 User::Invariant(); |
|
172 } |
|
173 } |
|
174 |