|
1 // Copyright (c) 2008-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 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file The TEFUnit test suite for SendUSSD in the SAT. |
|
20 */ |
|
21 |
|
22 #include "ccsatsendussdfu.h" |
|
23 #include <etel.h> |
|
24 #include <etelmm.h> |
|
25 |
|
26 #include <test/tmockltsydata.h> |
|
27 #include <cstktsy/ttlv.h> |
|
28 #include <satcs.h> // Etel SAT IPC definitions |
|
29 #include <ctsy/ltsy/mltsydispatchsatinterface.h> |
|
30 #include <test/mockltsyindicatorids.h> |
|
31 |
|
32 // It means that text is uncompressed and bits 1 to 0 are reserved and have no message class meaning |
|
33 //Reference: 3gpp ts 23.038 |
|
34 static const TUint8 KDataCodingGroup4 = 0x40; |
|
35 static const TUint8 KPcmdNumber = 1; |
|
36 |
|
37 _LIT8(KAlphaId8,"7-bit USSD"); |
|
38 _LIT16(KAlphaId16,"7-bit USSD"); |
|
39 |
|
40 CTestSuite* CCSatSendUSSDFU::CreateSuiteL(const TDesC& aName) |
|
41 { |
|
42 SUB_SUITE; |
|
43 |
|
44 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0001L); |
|
45 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0002L); |
|
46 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0004L); |
|
47 |
|
48 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0001bL); |
|
49 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0001cL); |
|
50 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0001dL); |
|
51 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0001eL); |
|
52 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0001fL); |
|
53 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0001gL); |
|
54 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0001hL); |
|
55 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0001iL); |
|
56 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0001jL); |
|
57 ADD_TEST_STEP_ISO_CPP(CCSatSendUSSDFU, TestNotifySendUssdPCmd0001kL); |
|
58 |
|
59 END_SUITE; |
|
60 } |
|
61 |
|
62 |
|
63 // |
|
64 // Actual test cases |
|
65 // |
|
66 |
|
67 |
|
68 /** |
|
69 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0001 |
|
70 @SYMPREQ 1780 |
|
71 @SYMComponent telephony_csat |
|
72 @SYMTestCaseDesc Test support in CSAT for RSat::NotifySendUssdPCmd |
|
73 @SYMTestPriority High |
|
74 @SYMTestActions Invokes RSat::NotifySendUssdPCmd |
|
75 @SYMTestExpectedResults Pass |
|
76 @SYMTestType CT |
|
77 */ |
|
78 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0001L() |
|
79 { |
|
80 OpenEtelServerL(EUseExtendedError); |
|
81 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
82 OpenPhoneL(); |
|
83 OpenSatL(); |
|
84 |
|
85 RBuf8 data; |
|
86 CleanupClosePushL(data); |
|
87 TRequestStatus requestStatus; |
|
88 |
|
89 //------------------------------------------------------------------------- |
|
90 // TEST E: Unsolicited completion of RSat::NotifySendSsPCmd |
|
91 // from LTSY. (put this test first just for coverage) |
|
92 //------------------------------------------------------------------------- |
|
93 |
|
94 // Prepare TLV buffer for CompleteL |
|
95 TTlv localInfoTlv; |
|
96 |
|
97 // prepare 7-bit string |
|
98 PrepareTlvWith7BitStr( localInfoTlv, KAlphaId8); |
|
99 const TDesC8& tlv = localInfoTlv.End(); |
|
100 |
|
101 // Prepare TLV buffer for CompleteL |
|
102 iMockLTSY.NotifyTerminated(requestStatus); |
|
103 // post Complete with KErrNone |
|
104 CompleteMockDispatchSatPcmdL(tlv, KErrNone); |
|
105 |
|
106 // as TerminalResponse is called from CTSY |
|
107 // Prepare here ExpectL for it |
|
108 const TUint8 KNoCause = 0; |
|
109 PrepareTerminalResponseMockDataWithExpL(KPcmdNumber, |
|
110 0,KNullDesC8, RSat::KMeUnableToProcessCmd, KNoCause); |
|
111 |
|
112 User::WaitForRequest(requestStatus); |
|
113 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
114 |
|
115 //------------------------------------------------------------------------- |
|
116 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
117 //------------------------------------------------------------------------- |
|
118 |
|
119 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
120 //and post that ExpectL |
|
121 PrepareMockLDataWithExpL(KSendUssd); |
|
122 |
|
123 // Post Notify itself |
|
124 RSat::TSendUssdV1 ussd; |
|
125 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
126 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
127 |
|
128 // post Complete with KErrNone |
|
129 CompleteMockDispatchSatPcmdL(tlv, KErrUnknown); |
|
130 |
|
131 User::WaitForRequest(requestStatus); |
|
132 |
|
133 ASSERT_EQUALS(KErrUnknown , requestStatus.Int()); |
|
134 |
|
135 //------------------------------------------------------------------------- |
|
136 // TEST C: Successful completion request of |
|
137 // RSat::NotifySendUssdPCmd |
|
138 //------------------------------------------------------------------------- |
|
139 |
|
140 // see test TestNotifySendUssdPCmd0001bL - TestNotifySendUssdPCmd0001iL |
|
141 |
|
142 AssertMockLtsyStatusL(); |
|
143 CleanupStack::PopAndDestroy(2, this); // data, this |
|
144 |
|
145 } |
|
146 |
|
147 |
|
148 /** |
|
149 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0002 |
|
150 @SYMPREQ 1780 |
|
151 @SYMComponent telephony_csat |
|
152 @SYMTestCaseDesc Test support in CSAT for cancelling of RSat::NotifySendUssdPCmd |
|
153 @SYMTestPriority High |
|
154 @SYMTestActions Invokes cancelling of RSat::NotifySendUssdPCmd |
|
155 @SYMTestExpectedResults Pass |
|
156 @SYMTestType CT |
|
157 */ |
|
158 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0002L() |
|
159 { |
|
160 |
|
161 OpenEtelServerL(EUseExtendedError); |
|
162 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
163 OpenPhoneL(); |
|
164 OpenSatL(); |
|
165 |
|
166 TRequestStatus requestStatus; |
|
167 |
|
168 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
169 //and post that ExpectL |
|
170 PrepareMockLDataWithExpL(KSendUssd); |
|
171 |
|
172 // Post Notify itself |
|
173 RSat::TSendUssdV1 ussd; |
|
174 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
175 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
176 |
|
177 iSat.CancelAsyncRequest(ESatNotifySendUssdPCmd); |
|
178 User::WaitForRequest(requestStatus); |
|
179 ASSERT_EQUALS(KErrCancel, requestStatus.Int()); |
|
180 |
|
181 AssertMockLtsyStatusL(); |
|
182 CleanupStack::PopAndDestroy(1); // this |
|
183 } |
|
184 |
|
185 |
|
186 /** |
|
187 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0004 |
|
188 @SYMPREQ 1780 |
|
189 @SYMComponent telephony_csat |
|
190 @SYMTestCaseDesc Test support in CSAT for multiple client requests to RSat::NotifySendUssdPCmd |
|
191 @SYMTestPriority High |
|
192 @SYMTestActions Invokes multiple client requests to RSat::NotifySendUssdPCmd |
|
193 @SYMTestExpectedResults Pass |
|
194 @SYMTestType CT |
|
195 */ |
|
196 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0004L() |
|
197 { |
|
198 OpenEtelServerL(EUseExtendedError); |
|
199 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
200 OpenPhoneL(); |
|
201 OpenSatL(); |
|
202 |
|
203 RBuf8 data; |
|
204 CleanupClosePushL(data); |
|
205 |
|
206 // Open second client |
|
207 RTelServer telServer2; |
|
208 TInt ret = telServer2.Connect(); |
|
209 ASSERT_EQUALS(KErrNone, ret); |
|
210 CleanupClosePushL(telServer2); |
|
211 |
|
212 RMobilePhone phone2; |
|
213 ret = phone2.Open(telServer2,KMmTsyPhoneName); |
|
214 ASSERT_EQUALS(KErrNone, ret); |
|
215 CleanupClosePushL(phone2); |
|
216 |
|
217 RSat sat2; |
|
218 User::LeaveIfError(sat2.Open(phone2)); |
|
219 CleanupClosePushL(sat2); |
|
220 |
|
221 TRequestStatus requestStatus; |
|
222 TRequestStatus requestStatus2; |
|
223 //------------------------------------------------------------------------- |
|
224 // Test A: Test multiple clients requesting RSat::NotifySendUssdPCmd |
|
225 // when they both pass the same T-class version |
|
226 //------------------------------------------------------------------------- |
|
227 |
|
228 // Post First Notify |
|
229 PrepareMockLDataWithExpL(KSendUssd); |
|
230 RSat::TSendUssdV1 ussd; |
|
231 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
232 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
233 |
|
234 // Post Second Notify |
|
235 RSat::TSendUssdV1 ussd2; |
|
236 RSat::TSendUssdV1Pckg ussdPck2(ussd2); |
|
237 sat2.NotifySendUssdPCmd(requestStatus2, ussdPck2); |
|
238 |
|
239 // Prepare TLV buffer for CompleteL |
|
240 TTlv localInfoTlv; |
|
241 _LIT(KUssdString,"ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz-1234567890"); |
|
242 TPtrC strToCompare(KUssdString); |
|
243 |
|
244 // prepare 7-bit string |
|
245 PrepareTlvWith7BitStr( localInfoTlv, KAlphaId8); |
|
246 |
|
247 // post Complete with KErrNone |
|
248 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
249 |
|
250 // wait for the first Complete |
|
251 User::WaitForRequest(requestStatus); |
|
252 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
253 ASSERT_EQUALS(RSat::EAlphaIdProvided, ussd.iAlphaId.iStatus); |
|
254 ASSERT_EQUALS(0, ussd.iAlphaId.iAlphaId.Compare(KAlphaId16)); // as we got iAlphaId in UNICODE |
|
255 ASSERT_EQUALS(static_cast<TUint8> (ESms7BitDcs), ussd.iUssdString.iDcs); |
|
256 ASSERT_EQUALS(0, ussd.iUssdString.iUssdString.Compare(strToCompare)); |
|
257 ASSERT_EQUALS(RSat::ENoIconId , ussd.iIconId.iQualifier); |
|
258 ASSERT_EQUALS(static_cast<TUint8>(0), ussd.iIconId.iIdentifier); |
|
259 |
|
260 // wait for the second Complete |
|
261 User::WaitForRequest(requestStatus2); |
|
262 ASSERT_EQUALS(KErrNone, requestStatus2.Int()); |
|
263 ASSERT_EQUALS(RSat::EAlphaIdProvided, ussd2.iAlphaId.iStatus); |
|
264 ASSERT_EQUALS(0, ussd2.iAlphaId.iAlphaId.Compare(KAlphaId16)); // as we got iAlphaId in UNICODE |
|
265 ASSERT_EQUALS(static_cast<TUint8> (ESms7BitDcs), ussd2.iUssdString.iDcs); |
|
266 ASSERT_EQUALS(0, ussd2.iUssdString.iUssdString.Compare(strToCompare)); |
|
267 ASSERT_EQUALS(RSat::ENoIconId , ussd2.iIconId.iQualifier); |
|
268 ASSERT_EQUALS(static_cast<TUint8>(0), ussd2.iIconId.iIdentifier); |
|
269 |
|
270 |
|
271 _LIT(KTextString,"USSD string received from SS"); |
|
272 // USSD string received from SS |
|
273 // in 7bit codding (taken from 3GPP TS 31.124 V7.4.0 (2008-06)) |
|
274 static const TUint8 textStr[] = {0xD5, 0xE9, 0x94, 0x08, 0x9A, 0xD3, 0xE5, 0x69, |
|
275 0xF7, 0x19, 0x24, 0x2F, 0x8F, 0xCB, 0x69, 0x7B, 0x99, |
|
276 0x0C, 0x32, 0xCB, 0xDF, 0x6D, 0xD0, 0x74, 0x0A}; |
|
277 TBuf8<RSat::KStringMaxSize> text7bit; |
|
278 text7bit.Append(textStr, sizeof (textStr)); |
|
279 |
|
280 // Prepare and call TerminalResponse from the first Client |
|
281 PrepareTerminalResponseMockDataWithExpL( |
|
282 KPcmdNumber, |
|
283 ESms7BitDcs, |
|
284 text7bit); |
|
285 // call TerminalRsp |
|
286 RSat::TSendUssdRspV1 resp; |
|
287 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
288 resp.iGeneralResult = RSat::KSuccess; |
|
289 resp.iUssdString.iDcs = ESms7BitDcs; |
|
290 resp.iUssdString.iUssdString.Copy(KTextString); |
|
291 resp.SetPCmdNumber(KPcmdNumber); |
|
292 TerminalResponseL(respPckg); |
|
293 |
|
294 // Prepare and call TerminalResponse from the second Client |
|
295 // with some error data |
|
296 PrepareTerminalResponseMockDataWithExpL( |
|
297 KPcmdNumber, |
|
298 ESms7BitDcs, |
|
299 KNullDesC8, |
|
300 RSat::KMeUnableToProcessCmd, |
|
301 0, |
|
302 EFalse); |
|
303 |
|
304 resp.iGeneralResult = RSat::KMeUnableToProcessCmd; |
|
305 TerminalResponseL(respPckg); |
|
306 |
|
307 AssertMockLtsyStatusL(); |
|
308 CleanupStack::PopAndDestroy(5, this); // ..., data, this |
|
309 } |
|
310 |
|
311 /** |
|
312 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0001b |
|
313 @SYMPREQ 1780 |
|
314 @SYMComponent telephony_csat |
|
315 @SYMTestCaseDesc Expected Sequence 1.1 (SEND USSD, 7-bit data, successful) |
|
316 @SYMTestPriority High |
|
317 @SYMTestActions Invokes RSat::NotifySendUssdPCmd |
|
318 @SYMTestExpectedResults Pass |
|
319 @SYMTestType CT |
|
320 */ |
|
321 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0001bL() |
|
322 { |
|
323 OpenEtelServerL(EUseExtendedError); |
|
324 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
325 OpenPhoneL(); |
|
326 OpenSatL(); |
|
327 |
|
328 RBuf8 data; |
|
329 CleanupClosePushL(data); |
|
330 TRequestStatus requestStatus; |
|
331 |
|
332 // |
|
333 // Expected Sequence 1.1 (SEND USSD, 7-bit data, successful) |
|
334 // see 27.22.4.12 of 3GPP TS 31.124 V7.4.0 (2008-06) |
|
335 // |
|
336 |
|
337 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
338 //and post that ExpectL |
|
339 PrepareMockLDataWithExpL(KSendUssd); |
|
340 |
|
341 // Post Notify itself |
|
342 RSat::TSendUssdV1 ussd; |
|
343 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
344 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
345 |
|
346 // Prepare TLV buffer for CompleteL |
|
347 TTlv localInfoTlv; |
|
348 _LIT(KUssdString,"ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz-1234567890"); |
|
349 TPtrC strToCompare(KUssdString); |
|
350 |
|
351 // prepare 7-bit string |
|
352 PrepareTlvWith7BitStr( localInfoTlv, KAlphaId8); |
|
353 |
|
354 // post Complete with KErrNone |
|
355 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
356 |
|
357 User::WaitForRequest(requestStatus); |
|
358 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
359 ASSERT_EQUALS(RSat::EAlphaIdProvided, ussd.iAlphaId.iStatus); |
|
360 ASSERT_EQUALS(0, ussd.iAlphaId.iAlphaId.Compare(KAlphaId16)); // as we got iAlphaId in UNICODE |
|
361 ASSERT_EQUALS(static_cast<TUint8> (ESms7BitDcs), ussd.iUssdString.iDcs); |
|
362 ASSERT_EQUALS(0, ussd.iUssdString.iUssdString.Compare(strToCompare)); |
|
363 ASSERT_EQUALS(RSat::ENoIconId , ussd.iIconId.iQualifier); |
|
364 ASSERT_EQUALS(static_cast<TUint8>(0), ussd.iIconId.iIdentifier); |
|
365 |
|
366 // there is no sence in emulation of transmission between ME and USS here |
|
367 // so prepare and send Terminal response |
|
368 _LIT(KTextString,"USSD string received from SS"); |
|
369 // USSD string received from SS |
|
370 // in 7bit codding (taken from 3GPP TS 31.124 V7.4.0 (2008-06)) |
|
371 static const TUint8 textStr[] = {0xD5, 0xE9, 0x94, 0x08, 0x9A, 0xD3, 0xE5, 0x69, |
|
372 0xF7, 0x19, 0x24, 0x2F, 0x8F, 0xCB, 0x69, 0x7B, 0x99, |
|
373 0x0C, 0x32, 0xCB, 0xDF, 0x6D, 0xD0, 0x74, 0x0A}; |
|
374 TBuf8<RSat::KStringMaxSize> text7bit; |
|
375 text7bit.Append(textStr, sizeof (textStr)); |
|
376 PrepareTerminalResponseMockDataWithExpL( |
|
377 KPcmdNumber, |
|
378 ESms7BitDcs, |
|
379 text7bit); |
|
380 |
|
381 // call TerminalRsp |
|
382 RSat::TSendUssdRspV1 resp; |
|
383 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
384 resp.iGeneralResult = RSat::KSuccess; |
|
385 resp.iUssdString.iDcs = ESms7BitDcs; |
|
386 resp.iUssdString.iUssdString.Copy(KTextString); |
|
387 resp.SetPCmdNumber(KPcmdNumber); |
|
388 TerminalResponseL(respPckg); |
|
389 |
|
390 AssertMockLtsyStatusL(); |
|
391 CleanupStack::PopAndDestroy(2, this); // data, this |
|
392 } |
|
393 |
|
394 |
|
395 |
|
396 /** |
|
397 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0001c |
|
398 @SYMPREQ 1780 |
|
399 @SYMComponent telephony_csat |
|
400 @SYMTestCaseDesc Expected Sequence 1.2 (SEND USSD, 8-bit data, successful) |
|
401 @SYMTestPriority High |
|
402 @SYMTestActions Invokes RSat::NotifySendUssdPCmd |
|
403 @SYMTestExpectedResults Pass |
|
404 @SYMTestType CT |
|
405 */ |
|
406 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0001cL() |
|
407 { |
|
408 OpenEtelServerL(EUseExtendedError); |
|
409 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
410 OpenPhoneL(); |
|
411 OpenSatL(); |
|
412 |
|
413 RBuf8 data; |
|
414 CleanupClosePushL(data); |
|
415 TRequestStatus requestStatus; |
|
416 |
|
417 // |
|
418 // Expected Sequence 1.2 (SEND USSD, 8-bit data, successful) |
|
419 // see 27.22.4.12 of 3GPP TS 31.124 V7.4.0 (2008-06) |
|
420 // |
|
421 |
|
422 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
423 //and post that ExpectL |
|
424 PrepareMockLDataWithExpL(KSendUssd); |
|
425 |
|
426 // Post Notify itself |
|
427 RSat::TSendUssdV1 ussd; |
|
428 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
429 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
430 |
|
431 // Prepare TLV buffer for CompleteL |
|
432 TTlv localInfoTlv; |
|
433 _LIT8(KAlphaId8bit8, "8-bit USSD"); |
|
434 _LIT16(KAlphaId8bit16, "8-bit USSD"); |
|
435 _LIT8(KUssdString,"ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz-1234567890"); |
|
436 PrepareTlv(localInfoTlv, ESms8BitDcs|KDataCodingGroup4, KUssdString, KAlphaId8bit8); |
|
437 |
|
438 // post Complete with KErrNone |
|
439 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
440 |
|
441 User::WaitForRequest(requestStatus); |
|
442 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
443 |
|
444 ASSERT_EQUALS(RSat::EAlphaIdProvided, ussd.iAlphaId.iStatus); |
|
445 ASSERT_EQUALS(0, ussd.iAlphaId.iAlphaId.Compare(KAlphaId8bit16)); // as we got iAlphaId in UNICODE |
|
446 ASSERT_EQUALS(static_cast<TUint8> (ESms8BitDcs|KDataCodingGroup4), ussd.iUssdString.iDcs); |
|
447 |
|
448 // prepare 16-bit string |
|
449 TBuf16<RSat::KStringMaxSize> string16bit; |
|
450 string16bit.Copy(KUssdString); |
|
451 |
|
452 ASSERT_EQUALS(0, ussd.iUssdString.iUssdString.Compare(string16bit)); |
|
453 ASSERT_EQUALS(RSat::ENoIconId , ussd.iIconId.iQualifier); |
|
454 ASSERT_EQUALS(static_cast<TUint8>(0), ussd.iIconId.iIdentifier); |
|
455 |
|
456 // there is no sence in emulation of transmission ME <-> USS and ME<->USER here |
|
457 // so prepare and send Terminal response |
|
458 _LIT8(KTextString, "USSD string received from SS"); |
|
459 PrepareTerminalResponseMockDataWithExpL( |
|
460 KPcmdNumber, |
|
461 ESms8BitDcs, |
|
462 KTextString); |
|
463 |
|
464 // call TerminalRsp |
|
465 RSat::TSendUssdRspV1 resp; |
|
466 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
467 resp.iGeneralResult = RSat::KSuccess; |
|
468 resp.iUssdString.iDcs = ESms8BitDcs|KDataCodingGroup4; |
|
469 resp.iUssdString.iUssdString.Copy(KTextString); |
|
470 resp.SetPCmdNumber(KPcmdNumber); |
|
471 TerminalResponseL(respPckg); |
|
472 |
|
473 AssertMockLtsyStatusL(); |
|
474 CleanupStack::PopAndDestroy(2, this); // data, this |
|
475 } |
|
476 |
|
477 |
|
478 /** |
|
479 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0001d |
|
480 @SYMPREQ 1780 |
|
481 @SYMComponent telephony_csat |
|
482 @SYMTestCaseDesc Expected Sequence 1.3 (SEND USSD, UCS2 data, successful) |
|
483 @SYMTestPriority High |
|
484 @SYMTestActions Invokes RSat::NotifySendUssdPCmd |
|
485 @SYMTestExpectedResults Pass |
|
486 @SYMTestType CT |
|
487 */ |
|
488 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0001dL() |
|
489 { |
|
490 OpenEtelServerL(EUseExtendedError); |
|
491 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
492 OpenPhoneL(); |
|
493 OpenSatL(); |
|
494 |
|
495 RBuf8 data; |
|
496 CleanupClosePushL(data); |
|
497 TRequestStatus requestStatus; |
|
498 |
|
499 // |
|
500 // Expected Sequence 1.3 (SEND USSD, UCS2 data, successful) |
|
501 // see 27.22.4.12 of 3GPP TS 31.124 V7.4.0 (2008-06) |
|
502 // |
|
503 |
|
504 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
505 //and post that ExpectL |
|
506 PrepareMockLDataWithExpL(KSendUssd); |
|
507 |
|
508 // Post Notify itself |
|
509 RSat::TSendUssdV1 ussd; |
|
510 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
511 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
512 |
|
513 // Prepare TLV buffer for CompleteL |
|
514 TTlv localInfoTlv; |
|
515 |
|
516 // prepare UCS2 string |
|
517 // "Hello" in Russian |
|
518 // (taken from 3GPP TS 31.124 V7.4.0 (2008-06)) |
|
519 TUint8 str[] = {0x04, 0x17, 0x04, 0x14, 0x04, 0x20, 0x04, 0x10, 0x04, 0x12, 0x04, |
|
520 0x21, 0x04, 0x22, 0x04, 0x12, 0x04, 0x23, 0x04, 0x19, 0x04, 0x22, |
|
521 0x04, 0x15}; |
|
522 TUint16 str16[] = { 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, |
|
523 0x0422, 0x0412, 0x0423, 0x0419, 0x0422, 0x0415}; |
|
524 TBuf8<RSat::KStringMaxSize> stringUCS2; |
|
525 TBuf<RSat::KStringMaxSize> strToCompare;; |
|
526 stringUCS2.Append(str, sizeof (str)); |
|
527 strToCompare.Append(str16, sizeof (str16)/2); |
|
528 PrepareTlv(localInfoTlv, ESms16BitDcs|KDataCodingGroup4, stringUCS2, KAlphaId8); |
|
529 |
|
530 // post Complete with KErrNone |
|
531 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
532 |
|
533 User::WaitForRequest(requestStatus); |
|
534 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
535 ASSERT_EQUALS(RSat::EAlphaIdProvided, ussd.iAlphaId.iStatus); |
|
536 ASSERT_EQUALS(0, ussd.iAlphaId.iAlphaId.Compare(KAlphaId16)); // as we got iAlphaId in UNICODE |
|
537 ASSERT_EQUALS(static_cast<TUint8> (ESms16BitDcs|KDataCodingGroup4), ussd.iUssdString.iDcs); |
|
538 ASSERT_EQUALS(0, ussd.iUssdString.iUssdString.Compare(strToCompare)); |
|
539 ASSERT_EQUALS(RSat::ENoIconId , ussd.iIconId.iQualifier); |
|
540 ASSERT_EQUALS(static_cast<TUint8>(0), ussd.iIconId.iIdentifier); |
|
541 |
|
542 // there is no sence in emulation of transmission between ME and USS here |
|
543 // so prepare and send Terminal response |
|
544 _LIT(KTextString,"USSD string received from SS"); |
|
545 |
|
546 // "USSD string received from SS" |
|
547 static const TUint8 textStr[] = {0x00, 0x55, 0x00, 0x53, 0x00, 0x53, 0x00, |
|
548 0x44, 0x00, 0x20, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, |
|
549 0x00, 0x6E, 0x00, 0x67, 0x00, 0x20, 0x00, 0x72, 0x00, 0x65, 0x00, |
|
550 0x63, 0x00, 0x65, 0x00, 0x69, 0x00, 0x76, 0x00, 0x65, 0x00, 0x64, |
|
551 0x00, 0x20, 0x00, 0x66, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x6D, 0x00, |
|
552 0x20, 0x00, 0x53, 0x00, 0x53}; |
|
553 TBuf8<RSat::KStringMaxSize> text; |
|
554 text.Append(textStr, sizeof (textStr)); |
|
555 PrepareTerminalResponseMockDataWithExpL( |
|
556 KPcmdNumber, |
|
557 ESms16BitDcs, |
|
558 text); |
|
559 |
|
560 // call TerminalRsp |
|
561 RSat::TSendUssdRspV1 resp; |
|
562 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
563 resp.iGeneralResult = RSat::KSuccess; |
|
564 resp.iUssdString.iDcs = ESms16BitDcs|KDataCodingGroup4; |
|
565 resp.iUssdString.iUssdString.Copy(KTextString); |
|
566 resp.SetPCmdNumber(KPcmdNumber); |
|
567 TerminalResponseL(respPckg); |
|
568 |
|
569 AssertMockLtsyStatusL(); |
|
570 CleanupStack::PopAndDestroy(2, this); // data, this |
|
571 } |
|
572 |
|
573 /** |
|
574 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0001e |
|
575 @SYMPREQ 1780 |
|
576 @SYMComponent telephony_csat |
|
577 @SYMTestCaseDesc Expected Sequence 1.4 ( SEND USSD, 7-bit data, unsuccessful (Return Error) ) |
|
578 @SYMTestPriority High |
|
579 @SYMTestActions Invokes RSat::NotifySendUssdPCmd |
|
580 @SYMTestExpectedResults Pass |
|
581 @SYMTestType CT |
|
582 */ |
|
583 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0001eL() |
|
584 { |
|
585 OpenEtelServerL(EUseExtendedError); |
|
586 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
587 OpenPhoneL(); |
|
588 OpenSatL(); |
|
589 |
|
590 RBuf8 data; |
|
591 CleanupClosePushL(data); |
|
592 TRequestStatus requestStatus; |
|
593 |
|
594 // |
|
595 // Expected Sequence 1.4 (SEND USSD, 7-bit data, unsuccessful (Return Error)) |
|
596 // see 27.22.4.12 of 3GPP TS 31.124 V7.4.0 (2008-06) |
|
597 // |
|
598 |
|
599 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
600 //and post that ExpectL |
|
601 PrepareMockLDataWithExpL(KSendUssd); |
|
602 |
|
603 // Post Notify itself |
|
604 RSat::TSendUssdV1 ussd; |
|
605 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
606 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
607 |
|
608 // Prepare TLV buffer for CompleteL |
|
609 TTlv localInfoTlv; |
|
610 _LIT(KUssdString,"ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz-1234567890"); |
|
611 TPtrC strToCompare(KUssdString); |
|
612 |
|
613 // prepare 7-bit string |
|
614 PrepareTlvWith7BitStr( localInfoTlv, KAlphaId8); |
|
615 |
|
616 // post Complete with KErrNone |
|
617 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
618 |
|
619 User::WaitForRequest(requestStatus); |
|
620 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
621 ASSERT_EQUALS(RSat::EAlphaIdProvided, ussd.iAlphaId.iStatus); |
|
622 ASSERT_EQUALS(0, ussd.iAlphaId.iAlphaId.Compare(KAlphaId16)); // as we got iAlphaId in UNICODE |
|
623 ASSERT_EQUALS(static_cast<TUint8> (ESms7BitDcs), ussd.iUssdString.iDcs); |
|
624 ASSERT_EQUALS(0, ussd.iUssdString.iUssdString.Compare(strToCompare)); |
|
625 ASSERT_EQUALS(RSat::ENoIconId , ussd.iIconId.iQualifier); |
|
626 ASSERT_EQUALS(static_cast<TUint8>(0), ussd.iIconId.iIdentifier); |
|
627 |
|
628 // there is no sence in emulation of transmission between ME and USS here |
|
629 // so prepare and send Terminal response |
|
630 const TUint8 EUnknownAlphabet = 0x47; // An error described in 3ggp 31.124 |
|
631 PrepareTerminalResponseMockDataWithExpL( |
|
632 KPcmdNumber, |
|
633 ESms7BitDcs, |
|
634 KNullDesC8, |
|
635 RSat::KUssdReturnError, |
|
636 EUnknownAlphabet); |
|
637 // call TerminalRsp |
|
638 RSat::TSendUssdRspV1 resp; |
|
639 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
640 resp.iGeneralResult = RSat::KUssdReturnError; |
|
641 resp.iInfoType = RSat::KSatNetworkErrorInfo; |
|
642 resp.iAdditionalInfo.Append(EUnknownAlphabet); |
|
643 resp.SetPCmdNumber(KPcmdNumber); |
|
644 TerminalResponseL(respPckg); |
|
645 |
|
646 AssertMockLtsyStatusL(); |
|
647 CleanupStack::PopAndDestroy(2, this); // data, this |
|
648 } |
|
649 |
|
650 |
|
651 /** |
|
652 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0001f |
|
653 @SYMPREQ 1780 |
|
654 @SYMComponent telephony_csat |
|
655 @SYMTestCaseDesc Expected Sequence 1.5 ( SEND USSD, 7-bit data, unsuccessful (Reject)) |
|
656 @SYMTestPriority High |
|
657 @SYMTestActions Invokes RSat::NotifySendUssdPCmd |
|
658 @SYMTestExpectedResults Pass |
|
659 @SYMTestType CT |
|
660 */ |
|
661 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0001fL() |
|
662 { |
|
663 OpenEtelServerL(EUseExtendedError); |
|
664 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
665 OpenPhoneL(); |
|
666 OpenSatL(); |
|
667 |
|
668 RBuf8 data; |
|
669 CleanupClosePushL(data); |
|
670 TRequestStatus requestStatus; |
|
671 |
|
672 // |
|
673 // Expected Sequence 1.5 (SEND USSD, 7-bit data, unsuccessful (Reject)) |
|
674 // see 27.22.4.12 of 3GPP TS 31.124 V7.4.0 (2008-06) |
|
675 // |
|
676 |
|
677 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
678 //and post that ExpectL |
|
679 PrepareMockLDataWithExpL(KSendUssd); |
|
680 |
|
681 // Post Notify itself |
|
682 RSat::TSendUssdV1 ussd; |
|
683 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
684 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
685 |
|
686 // Prepare TLV buffer for CompleteL |
|
687 TTlv localInfoTlv; |
|
688 _LIT(KUssdString,"ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz-1234567890"); |
|
689 TPtrC strToCompare(KUssdString); |
|
690 |
|
691 // prepare 7-bit string |
|
692 PrepareTlvWith7BitStr( localInfoTlv, KAlphaId8); |
|
693 |
|
694 // post Complete with KErrNone |
|
695 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
696 |
|
697 User::WaitForRequest(requestStatus); |
|
698 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
699 ASSERT_EQUALS(RSat::EAlphaIdProvided, ussd.iAlphaId.iStatus); |
|
700 ASSERT_EQUALS(0, ussd.iAlphaId.iAlphaId.Compare(KAlphaId16)); // as we got iAlphaId in UNICODE |
|
701 ASSERT_EQUALS(static_cast<TUint8> (ESms7BitDcs), ussd.iUssdString.iDcs); |
|
702 ASSERT_EQUALS(0, ussd.iUssdString.iUssdString.Compare(strToCompare)); |
|
703 ASSERT_EQUALS(RSat::ENoIconId , ussd.iIconId.iQualifier); |
|
704 ASSERT_EQUALS(static_cast<TUint8>(0), ussd.iIconId.iIdentifier); |
|
705 |
|
706 // there is no sence in emulation of transmission between ME and USS here |
|
707 // so prepare and send Terminal response |
|
708 PrepareTerminalResponseMockDataWithExpL( |
|
709 KPcmdNumber, |
|
710 ESms7BitDcs, |
|
711 KNullDesC8, |
|
712 RSat::KUssdReturnError, |
|
713 RSat::KNoSpecificMeProblem); |
|
714 // call TerminalRsp |
|
715 RSat::TSendUssdRspV1 resp; |
|
716 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
717 resp.iGeneralResult = RSat::KUssdReturnError; |
|
718 resp.iInfoType = RSat::KSatNetworkErrorInfo; |
|
719 resp.iAdditionalInfo.Append(RSat::KNoSpecificMeProblem); |
|
720 resp.SetPCmdNumber(KPcmdNumber); |
|
721 TerminalResponseL(respPckg); |
|
722 |
|
723 AssertMockLtsyStatusL(); |
|
724 CleanupStack::PopAndDestroy(2, this); // data, this |
|
725 } |
|
726 |
|
727 |
|
728 |
|
729 /** |
|
730 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0001g |
|
731 @SYMPREQ 1780 |
|
732 @SYMComponent telephony_csat |
|
733 @SYMTestCaseDesc Expected Sequence 1.7 (SEND USSD, 7-bit data, successful, no alpha identifier) |
|
734 @SYMTestPriority High |
|
735 @SYMTestActions Invokes RSat::NotifySendUssdPCmd |
|
736 @SYMTestExpectedResults Pass |
|
737 @SYMTestType CT |
|
738 */ |
|
739 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0001gL() |
|
740 { |
|
741 OpenEtelServerL(EUseExtendedError); |
|
742 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
743 OpenPhoneL(); |
|
744 OpenSatL(); |
|
745 |
|
746 RBuf8 data; |
|
747 CleanupClosePushL(data); |
|
748 TRequestStatus requestStatus; |
|
749 |
|
750 // |
|
751 // Expected Sequence 1.7 (SEND USSD, 7-bit data, successful, no alpha identifier) |
|
752 // see 27.22.4.12 of 3GPP TS 31.124 V7.4.0 (2008-06) |
|
753 // |
|
754 |
|
755 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
756 //and post that ExpectL |
|
757 PrepareMockLDataWithExpL(KSendUssd); |
|
758 |
|
759 // Post Notify itself |
|
760 RSat::TSendUssdV1 ussd; |
|
761 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
762 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
763 |
|
764 // Prepare TLV buffer for CompleteL |
|
765 TTlv localInfoTlv; |
|
766 _LIT(KUssdString,"ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz-1234567890"); |
|
767 TPtrC strToCompare(KUssdString); |
|
768 |
|
769 // prepare 7-bit string |
|
770 PrepareTlvWith7BitStr( localInfoTlv, KNullDesC8, EFalse); |
|
771 |
|
772 // post Complete with KErrNone |
|
773 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
774 |
|
775 User::WaitForRequest(requestStatus); |
|
776 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
777 ASSERT_EQUALS(RSat::EAlphaIdNotPresent, ussd.iAlphaId.iStatus); |
|
778 ASSERT_EQUALS(static_cast<TUint8> (ESms7BitDcs), ussd.iUssdString.iDcs); |
|
779 ASSERT_EQUALS(0, ussd.iUssdString.iUssdString.Compare(strToCompare)); |
|
780 ASSERT_EQUALS(RSat::ENoIconId , ussd.iIconId.iQualifier); |
|
781 ASSERT_EQUALS(static_cast<TUint8>(0), ussd.iIconId.iIdentifier); |
|
782 |
|
783 // there is no sence in emulation of transmission between ME and USS here |
|
784 // so prepare and send Terminal response |
|
785 _LIT(KTextString,"USSD string received from SS"); |
|
786 // USSD string received from SS |
|
787 // in 7bit codding (taken from 3GPP TS 31.124 V7.4.0 (2008-06)) |
|
788 static const TUint8 textStr[] = {0xD5, 0xE9, 0x94, 0x08, 0x9A, 0xD3, 0xE5, 0x69, |
|
789 0xF7, 0x19, 0x24, 0x2F, 0x8F, 0xCB, 0x69, 0x7B, 0x99, |
|
790 0x0C, 0x32, 0xCB, 0xDF, 0x6D, 0xD0, 0x74, 0x0A}; |
|
791 TBuf8<RSat::KStringMaxSize> text7bit; |
|
792 text7bit.Append(textStr, sizeof (textStr)); |
|
793 PrepareTerminalResponseMockDataWithExpL( |
|
794 KPcmdNumber, |
|
795 ESms7BitDcs, |
|
796 text7bit); |
|
797 |
|
798 // call TerminalRsp |
|
799 RSat::TSendUssdRspV1 resp; |
|
800 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
801 resp.iGeneralResult = RSat::KSuccess; |
|
802 resp.iUssdString.iDcs = ESms7BitDcs; |
|
803 resp.iUssdString.iUssdString.Copy(KTextString); |
|
804 resp.SetPCmdNumber(KPcmdNumber); |
|
805 TerminalResponseL(respPckg); |
|
806 |
|
807 AssertMockLtsyStatusL(); |
|
808 CleanupStack::PopAndDestroy(2, this); // data, this |
|
809 } |
|
810 |
|
811 |
|
812 /** |
|
813 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0001h |
|
814 @SYMPREQ 1780 |
|
815 @SYMComponent telephony_csat |
|
816 @SYMTestCaseDesc Expected Sequence 1.8 (SEND USSD, 7-bit data, successful, null length alpha identifier) |
|
817 @SYMTestPriority High |
|
818 @SYMTestActions Invokes RSat::NotifySendUssdPCmd |
|
819 @SYMTestExpectedResults Pass |
|
820 @SYMTestType CT |
|
821 */ |
|
822 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0001hL() |
|
823 { |
|
824 OpenEtelServerL(EUseExtendedError); |
|
825 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
826 OpenPhoneL(); |
|
827 OpenSatL(); |
|
828 |
|
829 RBuf8 data; |
|
830 CleanupClosePushL(data); |
|
831 TRequestStatus requestStatus; |
|
832 |
|
833 // |
|
834 // Expected Sequence 1.8 (SEND USSD, 7-bit data, successful, null length alpha identifier) |
|
835 // see 27.22.4.12 of 3GPP TS 31.124 V7.4.0 (2008-06) |
|
836 // |
|
837 |
|
838 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
839 //and post that ExpectL |
|
840 PrepareMockLDataWithExpL(KSendUssd); |
|
841 |
|
842 // Post Notify itself |
|
843 RSat::TSendUssdV1 ussd; |
|
844 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
845 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
846 |
|
847 // Prepare TLV buffer for CompleteL |
|
848 TTlv localInfoTlv; |
|
849 _LIT(KUssdString,"ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz-1234567890"); |
|
850 TPtrC strToCompare(KUssdString); |
|
851 |
|
852 // prepare 7-bit string |
|
853 PrepareTlvWith7BitStr( localInfoTlv, KNullDesC8);// KNullDesC8 -- means null length alpha identifier |
|
854 |
|
855 // post Complete with KErrNone |
|
856 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
857 |
|
858 User::WaitForRequest(requestStatus); |
|
859 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
860 ASSERT_EQUALS(RSat::EAlphaIdNull, ussd.iAlphaId.iStatus); |
|
861 ASSERT_EQUALS(static_cast<TUint8> (ESms7BitDcs), ussd.iUssdString.iDcs); |
|
862 ASSERT_EQUALS(0, ussd.iUssdString.iUssdString.Compare(strToCompare)); |
|
863 ASSERT_EQUALS(RSat::ENoIconId , ussd.iIconId.iQualifier); |
|
864 ASSERT_EQUALS(static_cast<TUint8>(0), ussd.iIconId.iIdentifier); |
|
865 |
|
866 // there is no sence in emulation of transmission between ME and USS here |
|
867 // so prepare and send Terminal response |
|
868 _LIT(KTextString,"USSD string received from SS"); |
|
869 // USSD string received from SS |
|
870 // in 7bit codding (taken from 3GPP TS 31.124 V7.4.0 (2008-06)) |
|
871 static const TUint8 textStr[] = {0xD5, 0xE9, 0x94, 0x08, 0x9A, 0xD3, 0xE5, 0x69, |
|
872 0xF7, 0x19, 0x24, 0x2F, 0x8F, 0xCB, 0x69, 0x7B, 0x99, |
|
873 0x0C, 0x32, 0xCB, 0xDF, 0x6D, 0xD0, 0x74, 0x0A}; |
|
874 TBuf8<RSat::KStringMaxSize> text7bit; |
|
875 text7bit.Append(textStr, sizeof (textStr)); |
|
876 PrepareTerminalResponseMockDataWithExpL( |
|
877 KPcmdNumber, |
|
878 ESms7BitDcs, |
|
879 text7bit); |
|
880 |
|
881 // call TerminalRsp |
|
882 RSat::TSendUssdRspV1 resp; |
|
883 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
884 resp.iGeneralResult = RSat::KSuccess; |
|
885 resp.iUssdString.iDcs = ESms7BitDcs; |
|
886 resp.iUssdString.iUssdString.Copy(KTextString); |
|
887 resp.SetPCmdNumber(KPcmdNumber); |
|
888 TerminalResponseL(respPckg); |
|
889 |
|
890 AssertMockLtsyStatusL(); |
|
891 CleanupStack::PopAndDestroy(2, this); // data, this |
|
892 } |
|
893 |
|
894 |
|
895 /** |
|
896 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0001i |
|
897 @SYMPREQ 1780 |
|
898 @SYMComponent telephony_csat |
|
899 @SYMTestCaseDesc Expected Sequence 2.1A (SEND USSD, 7-bit data, successful, basic icon self explanatory, successful) |
|
900 @SYMTestPriority High |
|
901 @SYMTestActions Invokes RSat::NotifySendUssdPCmd |
|
902 @SYMTestExpectedResults Pass |
|
903 @SYMTestType CT |
|
904 */ |
|
905 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0001iL() |
|
906 { |
|
907 OpenEtelServerL(EUseExtendedError); |
|
908 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
909 OpenPhoneL(); |
|
910 OpenSatL(); |
|
911 |
|
912 RBuf8 data; |
|
913 CleanupClosePushL(data); |
|
914 TRequestStatus requestStatus; |
|
915 |
|
916 // |
|
917 // Expected Sequence 2.1A (SEND USSD, 7-bit data, successful, basic icon self explanatory, successful) |
|
918 // see 27.22.4.12 of 3GPP TS 31.124 V7.4.0 (2008-06) |
|
919 // |
|
920 |
|
921 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
922 //and post that ExpectL |
|
923 PrepareMockLDataWithExpL(KSendUssd); |
|
924 |
|
925 // Post Notify itself |
|
926 RSat::TSendUssdV1 ussd; |
|
927 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
928 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
929 |
|
930 // Prepare TLV buffer for CompleteL |
|
931 TTlv localInfoTlv; |
|
932 _LIT(KUssdString,"ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz-1234567890"); |
|
933 TPtrC strToCompare(KUssdString); |
|
934 |
|
935 // prepare 7-bit string |
|
936 PrepareTlvWith7BitStr( localInfoTlv, KAlphaId8); |
|
937 |
|
938 // add data about icon to tlv buffer |
|
939 localInfoTlv.AddTag(KTlvIconIdentifierTag); |
|
940 TUint8 quailfier = 0x00; // icon is self-explanatory |
|
941 localInfoTlv.AddByte(quailfier); |
|
942 TUint8 recNumber = 0x01; // record 1 in EF(IMG) |
|
943 localInfoTlv.AddByte(recNumber); |
|
944 |
|
945 // post Complete with KErrNone |
|
946 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
947 |
|
948 User::WaitForRequest(requestStatus); |
|
949 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
950 ASSERT_EQUALS(RSat::EAlphaIdProvided, ussd.iAlphaId.iStatus); |
|
951 ASSERT_EQUALS(0, ussd.iAlphaId.iAlphaId.Compare(KAlphaId16)); // as we got iAlphaId in UNICODE |
|
952 ASSERT_EQUALS(static_cast<TUint8> (ESms7BitDcs), ussd.iUssdString.iDcs); |
|
953 ASSERT_EQUALS(0, ussd.iUssdString.iUssdString.Compare(strToCompare)); |
|
954 ASSERT_EQUALS(RSat::ESelfExplanatory , ussd.iIconId.iQualifier); |
|
955 ASSERT_EQUALS(recNumber, ussd.iIconId.iIdentifier); |
|
956 |
|
957 // there is no sence in emulation of transmission between ME and USS here |
|
958 // so prepare and send Terminal response |
|
959 _LIT(KTextString,"USSD string received from SS"); |
|
960 // USSD string received from SS |
|
961 // in 7bit codding (taken from 3GPP TS 31.124 V7.4.0 (2008-06)) |
|
962 static const TUint8 textStr[] = {0xD5, 0xE9, 0x94, 0x08, 0x9A, 0xD3, 0xE5, 0x69, |
|
963 0xF7, 0x19, 0x24, 0x2F, 0x8F, 0xCB, 0x69, 0x7B, 0x99, |
|
964 0x0C, 0x32, 0xCB, 0xDF, 0x6D, 0xD0, 0x74, 0x0A}; |
|
965 TBuf8<RSat::KStringMaxSize> text7bit; |
|
966 text7bit.Append(textStr, sizeof (textStr)); |
|
967 PrepareTerminalResponseMockDataWithExpL( |
|
968 KPcmdNumber, |
|
969 ESms7BitDcs, |
|
970 text7bit); |
|
971 |
|
972 // call TerminalRsp |
|
973 RSat::TSendUssdRspV1 resp; |
|
974 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
975 resp.iGeneralResult = RSat::KSuccess; |
|
976 resp.iUssdString.iDcs = ESms7BitDcs; |
|
977 resp.iUssdString.iUssdString.Copy(KTextString); |
|
978 resp.SetPCmdNumber(KPcmdNumber); |
|
979 TerminalResponseL(respPckg); |
|
980 |
|
981 AssertMockLtsyStatusL(); |
|
982 CleanupStack::PopAndDestroy(2, this); // data, this |
|
983 } |
|
984 |
|
985 /** |
|
986 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0001j |
|
987 @SYMPREQ 1780 |
|
988 @SYMComponent telephony_csat |
|
989 @SYMTestCaseDesc Test for coverage. |
|
990 @SYMTestPriority High |
|
991 @SYMTestActions Invokes RSat::NotifySendUssdPCmd |
|
992 @SYMTestExpectedResults Pass |
|
993 @SYMTestType CT |
|
994 */ |
|
995 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0001jL() |
|
996 { |
|
997 OpenEtelServerL(EUseExtendedError); |
|
998 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
999 OpenPhoneL(); |
|
1000 OpenSatL(); |
|
1001 |
|
1002 RBuf8 data; |
|
1003 CleanupClosePushL(data); |
|
1004 TRequestStatus requestStatus; |
|
1005 |
|
1006 // |
|
1007 // Test without Ussd string |
|
1008 // |
|
1009 |
|
1010 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
1011 //and post that ExpectL |
|
1012 PrepareMockLDataWithExpL(KSendUssd); |
|
1013 |
|
1014 // Post Notify itself |
|
1015 RSat::TSendUssdV1 ussd; |
|
1016 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
1017 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
1018 |
|
1019 TTlv localInfoTlv; |
|
1020 PrepareTlv(localInfoTlv, ESms7BitDcs, KNullDesC8, KAlphaId8); |
|
1021 // post Complete with KErrNone |
|
1022 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
1023 |
|
1024 // In this case TerminalResponse is called from CTSY |
|
1025 //so prepare Mock for it |
|
1026 PrepareTerminalResponseMockDataWithExpL (KPcmdNumber, |
|
1027 ESms7BitDcs, |
|
1028 KNullDesC8, |
|
1029 RSat::KErrorRequiredValuesMissing, |
|
1030 0, |
|
1031 EFalse, |
|
1032 KErrNone, |
|
1033 EFalse); |
|
1034 |
|
1035 User::WaitForRequest(requestStatus); |
|
1036 ASSERT_EQUALS(KErrCorrupt, requestStatus.Int()); |
|
1037 AssertMockLtsyStatusL(); |
|
1038 |
|
1039 // |
|
1040 // Test with USSD DCS as a reserved value |
|
1041 // |
|
1042 |
|
1043 // Post Notify itself |
|
1044 PrepareMockLDataWithExpL(KSendUssd); |
|
1045 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
1046 |
|
1047 TTlv localInfoTlv2; |
|
1048 _LIT8(KSomeString, "SomeString"); |
|
1049 TUint8 wrongDCS = 0xA0; |
|
1050 PrepareTlv(localInfoTlv2, wrongDCS, KSomeString, KAlphaId8); |
|
1051 |
|
1052 // post Complete with KErrNone |
|
1053 CompleteMockDispatchSatPcmdL(localInfoTlv2.End(), KErrNone); |
|
1054 |
|
1055 // In this case TerminalResponse is called from CTSY |
|
1056 //so prepare Mock for it |
|
1057 PrepareTerminalResponseMockDataWithExpL (KPcmdNumber, |
|
1058 ESms7BitDcs, |
|
1059 KNullDesC8, |
|
1060 RSat::KCmdDataNotUnderstood, |
|
1061 0, |
|
1062 EFalse, |
|
1063 KErrNone, |
|
1064 EFalse); |
|
1065 |
|
1066 User::WaitForRequest(requestStatus); |
|
1067 ASSERT_EQUALS(KErrCorrupt, requestStatus.Int()); |
|
1068 AssertMockLtsyStatusL(); |
|
1069 |
|
1070 // |
|
1071 // Test CSatNotifySendUssd::TerminalResponseL |
|
1072 // with USSD DCS wrong and RSat::KTextStringas info type |
|
1073 // |
|
1074 |
|
1075 //and post that ExpectL |
|
1076 PrepareMockLDataWithExpL(KSendUssd); |
|
1077 // Post Notify itself |
|
1078 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
1079 |
|
1080 TTlv localInfoTlv3; |
|
1081 PrepareTlv(localInfoTlv3, ESms7BitDcs, KSomeString, KAlphaId8); |
|
1082 |
|
1083 // post Complete with KErrNone |
|
1084 CompleteMockDispatchSatPcmdL(localInfoTlv3.End(), KErrNone); |
|
1085 |
|
1086 User::WaitForRequest(requestStatus); |
|
1087 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
1088 |
|
1089 // prepare data for TerminalRsp |
|
1090 PrepareTerminalResponseMockDataWithExpL (KPcmdNumber, |
|
1091 ESmsUnknownOrReservedDcs, |
|
1092 KNullDesC8, |
|
1093 RSat::KSuccess, |
|
1094 0, |
|
1095 EFalse, |
|
1096 KErrNone, |
|
1097 ETrue); |
|
1098 |
|
1099 // call TerminalRsp |
|
1100 RSat::TSendUssdRspV1 resp; |
|
1101 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
1102 resp.iGeneralResult = RSat::KSuccess; |
|
1103 resp.iUssdString.iDcs = wrongDCS; |
|
1104 resp.iUssdString.iUssdString.Copy(KSomeString); |
|
1105 TUint8 KSomeAddInfo = 0xAA; |
|
1106 resp.iAdditionalInfo.Append(KSomeAddInfo); |
|
1107 resp.iInfoType = RSat::KTextString; |
|
1108 resp.SetPCmdNumber(KPcmdNumber); |
|
1109 TerminalResponseL(respPckg); |
|
1110 |
|
1111 AssertMockLtsyStatusL(); |
|
1112 |
|
1113 CleanupStack::PopAndDestroy(2, this); // data, this |
|
1114 } |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 /** |
|
1120 @SYMTestCaseID BA-CSAT-SUSSD-SNSUPC-0001k |
|
1121 @SYMPREQ 1780 |
|
1122 @SYMComponent telephony_csat |
|
1123 @SYMTestCaseDesc Test CSatNotifySendUssd::CreateTerminalRespL() |
|
1124 @SYMTestPriority High |
|
1125 @SYMTestActions Invokes RSat::NotifySendUssdPCmd |
|
1126 @SYMTestExpectedResults Pass |
|
1127 @SYMTestType CT |
|
1128 */ |
|
1129 void CCSatSendUSSDFU::TestNotifySendUssdPCmd0001kL() |
|
1130 { |
|
1131 OpenEtelServerL(EUseExtendedError); |
|
1132 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1133 OpenPhoneL(); |
|
1134 OpenSatL(); |
|
1135 |
|
1136 // test all possible parameters for CSatNotifySendUssd::CreateTerminalRespL() |
|
1137 |
|
1138 DoTestTerminalResponseL(); |
|
1139 |
|
1140 AssertMockLtsyStatusL(); |
|
1141 CleanupStack::PopAndDestroy(1, this); //this |
|
1142 } |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 //---------------------------------------------------------------------------------------------------------- |
|
1148 // Utility functions |
|
1149 //---------------------------------------------------------------------------------------------------------- |
|
1150 |
|
1151 /** |
|
1152 * Prepare data for ExpectL() for NotifySendUssdPCmd() and post ExpectL. |
|
1153 * @param aPCmdNumber - command number |
|
1154 */ |
|
1155 void CCSatSendUSSDFU::PrepareMockLDataWithExpL( TUint8 aPCmdNumber ) |
|
1156 { |
|
1157 TPckg<TUint8> pcmdCodePckg(aPCmdNumber); |
|
1158 iMockLTSY.ExpectL(MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId, pcmdCodePckg); |
|
1159 } |
|
1160 |
|
1161 /** |
|
1162 * prepare tlv buffer for SEND USSD proactive command |
|
1163 * @param aTlv - tlv buffer to prepare |
|
1164 * @param aDataCodingScheme - |
|
1165 * @param aUssdString - Ussd String |
|
1166 * @param aAlphaIdentifier - Alpha Identifier |
|
1167 * @param aIsAlphaIdentifierUsed - flag, "If AlphaIdentifier is used " |
|
1168 */ |
|
1169 void CCSatSendUSSDFU::PrepareTlv(TTlv& aTlv, TUint8 aDataCodingScheme, const TDesC8& aUssdString, |
|
1170 const TDesC8& aAlphaIdentifier, TBool aIsAlphaIdentifierUsed) |
|
1171 { |
|
1172 aTlv.Begin(KBerTlvProactiveSimCommandTag); |
|
1173 aTlv.AddTag(KTlvCommandDetailsTag); |
|
1174 aTlv.AddByte(0x01);//ETLV_CommandNumber |
|
1175 aTlv.AddByte(KSendUssd); //ETLV_TypeOfCommand |
|
1176 aTlv.AddByte(0x00); //ETLV_CommandQualifier |
|
1177 aTlv.AddTag(KTlvDeviceIdentityTag); |
|
1178 aTlv.AddByte(KSim); //ETLV_SourceDeviceIdentity |
|
1179 aTlv.AddByte(KNetwork); |
|
1180 |
|
1181 if (aIsAlphaIdentifierUsed) |
|
1182 { |
|
1183 aTlv.AddTag(KTlvAlphaIdentifierTag); |
|
1184 for (TInt i = 0; i < aAlphaIdentifier.Length(); i++) |
|
1185 { |
|
1186 aTlv.AddByte(aAlphaIdentifier[i]); |
|
1187 } |
|
1188 } |
|
1189 |
|
1190 if (aUssdString.Length()) |
|
1191 { |
|
1192 aTlv.AddTag(KTlvUssdStringTag); |
|
1193 aTlv.AddByte(aDataCodingScheme); |
|
1194 for (TInt i = 0; i < aUssdString.Length(); i++) |
|
1195 { |
|
1196 aTlv.AddByte(aUssdString[i]); |
|
1197 } |
|
1198 } |
|
1199 |
|
1200 } |
|
1201 |
|
1202 /** |
|
1203 * prepare tlv buffer for SEND USSD proactive command |
|
1204 * @param aTlv - tlv buffer to prepare |
|
1205 * @param aAlphaIdentifier - Alpha Identifier |
|
1206 * @param aIsAlphaIdentifierUsed - flag, "If AlphaIdentifier is used " |
|
1207 */ |
|
1208 void CCSatSendUSSDFU::PrepareTlvWith7BitStr( TTlv& aTlv, |
|
1209 const TDesC8& aAlphaIdentifier, |
|
1210 TBool aIsAlphaIdentifierUsed) |
|
1211 { |
|
1212 // prepare 7-bit string |
|
1213 // ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz-1234567890 |
|
1214 // in 7bit codding (taken from 3GPP TS 31.124 V7.4.0 (2008-06)) |
|
1215 static const TUint8 str[] = {0x41, 0xE1, 0x90, 0x58, 0x34, 0x1E, 0x91, 0x49, 0xE5, 0x92, 0xD9, 0x74, 0x3E, 0xA1, 0x51, 0xE9, |
|
1216 0x94, 0x5A, 0xB5, 0x5E, 0xB1, 0x59, 0x6D, 0x2B, 0x2C, 0x1E, 0x93, 0xCB, 0xE6, 0x33, 0x3A, 0xAD, |
|
1217 0x5E, 0xB3, 0xDB, 0xEE, 0x37, 0x3C, 0x2E, 0x9F, 0xD3, 0xEB, 0xF6, 0x3B, 0x3E, 0xAF, 0x6F, 0xC5, |
|
1218 0x64, 0x33, 0x5A, 0xCD, 0x76, 0xC3, 0xE5, 0x60}; |
|
1219 TBuf8<RSat::KStringMaxSize> string7bit; |
|
1220 string7bit.Append(str, sizeof (str)); |
|
1221 PrepareTlv(aTlv, ESms7BitDcs, string7bit, aAlphaIdentifier, aIsAlphaIdentifierUsed); |
|
1222 } |
|
1223 |
|
1224 |
|
1225 |
|
1226 /** |
|
1227 * prepare mock for processing of proactive command |
|
1228 * @param aCompleteTlv - tlv buffer to send |
|
1229 * @param aError - result for request completion |
|
1230 */ |
|
1231 void CCSatSendUSSDFU::CompleteMockDispatchSatPcmdL( TPtrC8 aCompleteTlv, TInt aError ) |
|
1232 { |
|
1233 RBuf8 data; |
|
1234 CleanupClosePushL(data); |
|
1235 |
|
1236 TDesC8* tlvPtr = &aCompleteTlv; |
|
1237 TMockLtsyData1<TDesC8*> dspTxtDscPack(tlvPtr); |
|
1238 dspTxtDscPack.SerialiseL(data); |
|
1239 iMockLTSY.CompleteL(KMockLtsyDispatchSatPcmdIndId, aError, data, 10); |
|
1240 |
|
1241 CleanupStack::PopAndDestroy(&data); |
|
1242 } |
|
1243 |
|
1244 /** |
|
1245 * prepare data and call iMockLTSY.ExpectL(MLtsyDispatchSatTerminalRsp::KLtsyDispatchSatTerminalRspApiId, data); |
|
1246 * @param aPCmdNumber - command number |
|
1247 * @param aDataCodingScheme - Coding Scheme |
|
1248 * @param aTextString - string to compare |
|
1249 * @param aAdditionalInfoTlv - tlv buffer |
|
1250 * @param aGeneralResult - for request completion |
|
1251 * @param aResultAddInfo - result additional info |
|
1252 */ |
|
1253 void CCSatSendUSSDFU::PrepareTerminalResponseMockDataWithExpL( |
|
1254 TUint8 aPCmdNumber, |
|
1255 TUint8 aDataCodingScheme, |
|
1256 const TDesC8& aTextString, |
|
1257 RSat::TPCmdResult aGeneralResult, |
|
1258 TUint8 aResultAddInfo, |
|
1259 TBool aIsResultAddInfoUsed, |
|
1260 TInt aErrorForExpect, |
|
1261 TBool aUseEmptyText) |
|
1262 { |
|
1263 RBuf8 data; |
|
1264 CleanupClosePushL(data); |
|
1265 |
|
1266 RBuf8 terminalRsp; |
|
1267 CleanupClosePushL(terminalRsp); |
|
1268 terminalRsp.CreateL(KTlvMaxSize); |
|
1269 |
|
1270 TTlv tlv; |
|
1271 tlv.AddTag(KTlvCommandDetailsTag); |
|
1272 tlv.AddByte(aPCmdNumber);//ETLV_CommandNumber |
|
1273 tlv.AddByte(KSendUssd); //ETLV_TypeOfCommand |
|
1274 tlv.AddByte(0x00); //ETLV_CommandQualifier |
|
1275 |
|
1276 tlv.AddTag(KTlvDeviceIdentityTag); |
|
1277 tlv.AddByte(KMe); |
|
1278 tlv.AddByte(KSim); |
|
1279 |
|
1280 tlv.AddTag(KTlvResultTag); |
|
1281 tlv.AddByte(aGeneralResult); |
|
1282 if (RSat::KSuccess != aGeneralResult && |
|
1283 aIsResultAddInfoUsed) |
|
1284 { |
|
1285 // add result additional info |
|
1286 tlv.AddByte(aResultAddInfo); |
|
1287 } |
|
1288 |
|
1289 if (aTextString.Length()) |
|
1290 { |
|
1291 tlv.AddTag(KTlvTextStringTag); |
|
1292 tlv.AddByte(aDataCodingScheme); |
|
1293 |
|
1294 for (TInt i = 0; i < aTextString.Length(); i++) |
|
1295 { |
|
1296 tlv.AddByte(aTextString[i]); |
|
1297 } |
|
1298 } |
|
1299 |
|
1300 if (aUseEmptyText && !aTextString.Length() ) |
|
1301 { |
|
1302 // just use tags |
|
1303 tlv.AddTag(KTlvTextStringTag); |
|
1304 tlv.AddByte(aDataCodingScheme); |
|
1305 } |
|
1306 |
|
1307 terminalRsp.Append(tlv.GetDataWithoutTopLevelTag()); |
|
1308 |
|
1309 TDesC8* terminalRspPtr = &terminalRsp; |
|
1310 TMockLtsyData1<TDesC8*> termRespData(terminalRspPtr); |
|
1311 termRespData.SerialiseL(data); |
|
1312 |
|
1313 iMockLTSY.ExpectL(MLtsyDispatchSatTerminalRsp::KLtsyDispatchSatTerminalRspApiId, data, aErrorForExpect); |
|
1314 |
|
1315 CleanupStack::PopAndDestroy(&terminalRsp); |
|
1316 CleanupStack::PopAndDestroy(&data); |
|
1317 } |
|
1318 |
|
1319 /** |
|
1320 * prepare data and call iSat.TerminalRsp(reqStatus, aRSatTypeOfCommand, aRspPckg); |
|
1321 * @param aRspPckg - data for response |
|
1322 * @param aExpectedError - error, which is expected from CTSY |
|
1323 */ |
|
1324 void CCSatSendUSSDFU::TerminalResponseL(const TDesC8& aRspPckg, TInt aExpectedError) |
|
1325 { |
|
1326 TRequestStatus reqStatus; |
|
1327 iSat.TerminalRsp(reqStatus, RSat::ESendUssd, aRspPckg); |
|
1328 User::WaitForRequest(reqStatus); |
|
1329 ASSERT_EQUALS(aExpectedError, reqStatus.Int()); |
|
1330 } |
|
1331 |
|
1332 /** |
|
1333 * Tests all possible "TERMINAL RESPONSE" cases. |
|
1334 * API should return KErrNone for all valid responses and KErrCorrupt |
|
1335 * for those that can not be used with "SEND USSD" command |
|
1336 */ |
|
1337 void CCSatSendUSSDFU::DoTestTerminalResponseL() |
|
1338 { |
|
1339 static const struct |
|
1340 { |
|
1341 RSat::TPCmdResult iGeneralResult; |
|
1342 RSat::TAdditionalInfoType iInfoType; |
|
1343 TBool iIntentionallyOmmitAdditionalInfo; // skip AdditionalInfo |
|
1344 TUint8 iAdditionalInfo; |
|
1345 TInt iExpectedResult; |
|
1346 } |
|
1347 KResponsesToTest[] = |
|
1348 { |
|
1349 { |
|
1350 // 0x01 - Command performed with partial comprehension; |
|
1351 RSat::KPartialComprehension, |
|
1352 RSat::KNoAdditionalInfo, |
|
1353 ETrue, |
|
1354 0, |
|
1355 KErrNone |
|
1356 }, |
|
1357 { |
|
1358 // 0x02 - Command performed, with missing information; |
|
1359 RSat::KMissingInformation, |
|
1360 RSat::KNoAdditionalInfo, |
|
1361 ETrue, |
|
1362 0, |
|
1363 KErrNone |
|
1364 }, |
|
1365 { |
|
1366 // 0x03 - REFRESH performed with additional EFs read; |
|
1367 RSat::KRefreshAdditionEFRead, |
|
1368 RSat::KNoAdditionalInfo, |
|
1369 ETrue, |
|
1370 0, |
|
1371 KErrCorrupt |
|
1372 }, |
|
1373 { |
|
1374 // 0x04 - Command performed successfully, but requested icon could not be displayed; |
|
1375 RSat::KSuccessRequestedIconNotDisplayed, |
|
1376 RSat::KNoAdditionalInfo, |
|
1377 ETrue, |
|
1378 0, |
|
1379 KErrNone |
|
1380 }, |
|
1381 { |
|
1382 // 0x05 - Command performed, but modified by call control by NAA; |
|
1383 RSat::KModifiedByCallControl, |
|
1384 RSat::KNoAdditionalInfo, |
|
1385 ETrue, |
|
1386 0, |
|
1387 KErrNone |
|
1388 }, |
|
1389 { |
|
1390 // 0x06 - Command performed successfully, limited service; |
|
1391 RSat::KSuccessLimitedService, |
|
1392 RSat::KNoAdditionalInfo, |
|
1393 ETrue, |
|
1394 0, |
|
1395 KErrCorrupt |
|
1396 }, |
|
1397 { |
|
1398 // 0x07 - Command performed with modification; |
|
1399 RSat::KPerformedWithModifications, |
|
1400 RSat::KNoAdditionalInfo, |
|
1401 ETrue, |
|
1402 0, |
|
1403 KErrCorrupt |
|
1404 }, |
|
1405 { |
|
1406 // 0x08 - REFRESH performed but indicated NAA was not active; |
|
1407 RSat::KRefreshUSIMNotActive, |
|
1408 RSat::KNoAdditionalInfo, |
|
1409 ETrue, |
|
1410 0, |
|
1411 KErrCorrupt |
|
1412 }, |
|
1413 { |
|
1414 // 0x09 - Command performed successfully, tone not played; |
|
1415 RSat::KPlayTonePerformedSuccessfully, |
|
1416 RSat::KNoAdditionalInfo, |
|
1417 ETrue, |
|
1418 0, |
|
1419 KErrCorrupt |
|
1420 }, |
|
1421 { |
|
1422 // 0x10 - Proactive UICC session terminated by the user; |
|
1423 RSat::KPSessionTerminatedByUser, |
|
1424 RSat::KNoAdditionalInfo, |
|
1425 ETrue, |
|
1426 0, |
|
1427 KErrCorrupt |
|
1428 }, |
|
1429 { |
|
1430 // 0x11 - Backward move in the proactive UICC session requested by the user; |
|
1431 RSat::KBackwardModeRequestedByUser, |
|
1432 RSat::KNoAdditionalInfo, |
|
1433 ETrue, |
|
1434 0, |
|
1435 KErrCorrupt |
|
1436 }, |
|
1437 { |
|
1438 // 0x12 - No response from user; |
|
1439 RSat::KNoResponseFromUser, |
|
1440 RSat::KNoAdditionalInfo, |
|
1441 ETrue, |
|
1442 0, |
|
1443 KErrCorrupt |
|
1444 }, |
|
1445 { |
|
1446 // 0x13 - Help information required by the user; |
|
1447 RSat::KHelpRequestedByUser, |
|
1448 RSat::KNoAdditionalInfo, |
|
1449 ETrue, |
|
1450 0, |
|
1451 KErrCorrupt |
|
1452 }, |
|
1453 { |
|
1454 // 0x14 - reserved for GSM/3G. |
|
1455 RSat::KUssdTransactionTerminatedByUser, |
|
1456 RSat::KNoAdditionalInfo, |
|
1457 ETrue, |
|
1458 0, |
|
1459 KErrNone |
|
1460 }, |
|
1461 { |
|
1462 // 0x20 - terminal currently unable to process command; |
|
1463 RSat::KMeUnableToProcessCmd, |
|
1464 RSat::KMeProblem, |
|
1465 EFalse, |
|
1466 0, |
|
1467 KErrNone |
|
1468 }, |
|
1469 { |
|
1470 // 0x20 without additional information (erroneous) |
|
1471 RSat::KMeUnableToProcessCmd, |
|
1472 RSat::KMeProblem, |
|
1473 ETrue, // Intentional error ! |
|
1474 0, |
|
1475 KErrCorrupt |
|
1476 }, |
|
1477 |
|
1478 { |
|
1479 // 0x21 - Network currently unable to process command; |
|
1480 RSat::KNetworkUnableToProcessCmd, |
|
1481 RSat::KSatNetworkErrorInfo, |
|
1482 EFalse, |
|
1483 0, |
|
1484 KErrNone |
|
1485 }, |
|
1486 { |
|
1487 // 0x22 - User did not accept the proactive command; |
|
1488 RSat::KPCmdNotAcceptedByUser, |
|
1489 RSat::KNoAdditionalInfo, |
|
1490 ETrue, |
|
1491 0, |
|
1492 KErrCorrupt |
|
1493 }, |
|
1494 { |
|
1495 // 0x23 - User cleared down call before connection or network release; |
|
1496 RSat::KCallClearedBeforeConnectionOrReleased, |
|
1497 RSat::KNoAdditionalInfo, |
|
1498 ETrue, |
|
1499 0, |
|
1500 KErrCorrupt |
|
1501 }, |
|
1502 { |
|
1503 // 0x24 - Action in contradiction with the current timer state; |
|
1504 RSat::KContradictionWithTimerState, |
|
1505 RSat::KNoAdditionalInfo, |
|
1506 ETrue, |
|
1507 0, |
|
1508 KErrCorrupt |
|
1509 }, |
|
1510 { |
|
1511 // 0x25 - Interaction with call control by NAA, temporary problem; |
|
1512 RSat::KInteractionWithCCTemporaryError, |
|
1513 RSat::KNoAdditionalInfo, |
|
1514 ETrue, |
|
1515 0, |
|
1516 KErrNone |
|
1517 }, |
|
1518 { |
|
1519 // 0x26 - Launch browser generic error code; |
|
1520 RSat::KLaunchBrowserError, |
|
1521 RSat::KNoAdditionalInfo, |
|
1522 ETrue, |
|
1523 0, |
|
1524 KErrCorrupt |
|
1525 }, |
|
1526 { |
|
1527 // 0x27 - MMS temporary problem. |
|
1528 RSat::KMMSTemporaryProblem, |
|
1529 RSat::KNoAdditionalInfo, |
|
1530 ETrue, |
|
1531 0, |
|
1532 KErrCorrupt |
|
1533 }, |
|
1534 { |
|
1535 // 0x30 - Command beyond terminal's capabilities; |
|
1536 RSat::KCmdBeyondMeCapabilities, |
|
1537 RSat::KNoAdditionalInfo, |
|
1538 EFalse, |
|
1539 0, |
|
1540 KErrNone |
|
1541 }, |
|
1542 { |
|
1543 // 0x31 - Command type not understood by terminal; |
|
1544 RSat::KCmdTypeNotUnderstood, |
|
1545 RSat::KNoAdditionalInfo, |
|
1546 EFalse, |
|
1547 0, |
|
1548 KErrNone |
|
1549 }, |
|
1550 { |
|
1551 // 0x32 - Command data not understood by terminal; |
|
1552 RSat::KCmdDataNotUnderstood, |
|
1553 RSat::KNoAdditionalInfo, |
|
1554 EFalse, |
|
1555 0, |
|
1556 KErrNone |
|
1557 }, |
|
1558 { |
|
1559 // 0x33 - Command number not known by terminal; |
|
1560 RSat::KCmdNumberNotKnown, |
|
1561 RSat::KNoAdditionalInfo, |
|
1562 EFalse, |
|
1563 0, |
|
1564 KErrNone |
|
1565 }, |
|
1566 { |
|
1567 // 0x34 - reserved for GSM/3G; |
|
1568 RSat::KSsReturnError, |
|
1569 RSat::KNoAdditionalInfo, |
|
1570 ETrue, |
|
1571 0, |
|
1572 KErrCorrupt |
|
1573 }, |
|
1574 { |
|
1575 // 0x35 - reserved for GSM/3G; |
|
1576 RSat::KSmsRpError, |
|
1577 RSat::KNoAdditionalInfo, |
|
1578 ETrue, |
|
1579 0, |
|
1580 KErrCorrupt |
|
1581 }, |
|
1582 { |
|
1583 // 0x36 - Error, required values are missing; |
|
1584 RSat::KErrorRequiredValuesMissing, |
|
1585 RSat::KNoAdditionalInfo, |
|
1586 ETrue, |
|
1587 0, |
|
1588 KErrNone |
|
1589 }, |
|
1590 { |
|
1591 // 0x37 - reserved for GSM/3G; |
|
1592 RSat::KUssdReturnError, |
|
1593 RSat::KSatNetworkErrorInfo, |
|
1594 EFalse, |
|
1595 0, |
|
1596 KErrNone |
|
1597 }, |
|
1598 { |
|
1599 // 0x38 - MultipleCard commands error; |
|
1600 RSat::KMultipleCardCmdsError, |
|
1601 RSat::KMeProblem, |
|
1602 EFalse, |
|
1603 0, |
|
1604 KErrCorrupt |
|
1605 }, |
|
1606 { |
|
1607 // 0x39 - Interaction with call control by NAA, permanent problem; |
|
1608 RSat::KInteractionWithCCPermanentError, |
|
1609 RSat::KNoAdditionalInfo, |
|
1610 EFalse, |
|
1611 0, |
|
1612 KErrNone |
|
1613 }, |
|
1614 |
|
1615 { |
|
1616 // 0x3A - Bearer Independent Protocol error; |
|
1617 RSat::KBearerIndepProtocolError, |
|
1618 RSat::KMeProblem, |
|
1619 EFalse, |
|
1620 RSat::KNoSpecificBIPError, |
|
1621 KErrCorrupt |
|
1622 }, |
|
1623 { |
|
1624 // 0x3A without additional information (erroneous) |
|
1625 RSat::KBearerIndepProtocolError, |
|
1626 RSat::KMeProblem, |
|
1627 ETrue, // Intentional error |
|
1628 0, |
|
1629 KErrCorrupt |
|
1630 }, |
|
1631 { |
|
1632 // 0x3B - Access Technology unable to process command; |
|
1633 RSat::KAccessTechUnableProcessCmd, |
|
1634 RSat::KNoAdditionalInfo, |
|
1635 EFalse, |
|
1636 0, |
|
1637 KErrCorrupt |
|
1638 }, |
|
1639 { |
|
1640 // 0x3C - Frames error; |
|
1641 RSat::KFramesError, |
|
1642 RSat::KMeProblem, |
|
1643 EFalse, |
|
1644 RSat::KNoSpecificCauseCanBeGiven, |
|
1645 KErrCorrupt |
|
1646 }, |
|
1647 { |
|
1648 // 0x3D - MMS Error. |
|
1649 RSat::KMMSError, |
|
1650 RSat::KNoAdditionalInfo, |
|
1651 EFalse, |
|
1652 0, |
|
1653 KErrCorrupt |
|
1654 } |
|
1655 }; |
|
1656 |
|
1657 const TInt KNumberOfResponsesToTest = sizeof(KResponsesToTest)/ sizeof(KResponsesToTest[0]); |
|
1658 |
|
1659 _LIT(KTextString,"USSD string received from SS"); |
|
1660 // USSD string received from SS |
|
1661 // in 7bit codding (taken from 3GPP TS 31.124 V7.4.0 (2008-06)) |
|
1662 static const TUint8 textStr[] = {0xD5, 0xE9, 0x94, 0x08, 0x9A, 0xD3, 0xE5, 0x69, |
|
1663 0xF7, 0x19, 0x24, 0x2F, 0x8F, 0xCB, 0x69, 0x7B, 0x99, |
|
1664 0x0C, 0x32, 0xCB, 0xDF, 0x6D, 0xD0, 0x74, 0x0A}; |
|
1665 TBuf8<RSat::KStringMaxSize> text7bit; |
|
1666 text7bit.Append(textStr, sizeof (textStr)); |
|
1667 TTlv tlv; |
|
1668 |
|
1669 |
|
1670 PrepareTlvWith7BitStr(tlv, KAlphaId8); |
|
1671 const TDesC8& tlvEnd = tlv.End(); |
|
1672 |
|
1673 TRequestStatus requestStatus; |
|
1674 RSat::TSendUssdV1 ussd; |
|
1675 RSat::TSendUssdV1Pckg ussdPck(ussd); |
|
1676 |
|
1677 for(TInt i = 0; i < KNumberOfResponsesToTest; i++) |
|
1678 { |
|
1679 //Prepare data for ExpectL needed by NotifySendUssdPCmd |
|
1680 //and post that ExpectL |
|
1681 PrepareMockLDataWithExpL(KSendUssd); |
|
1682 |
|
1683 // Post Notify itself |
|
1684 iSat.NotifySendUssdPCmd(requestStatus, ussdPck); |
|
1685 |
|
1686 // post Complete with KErrNone |
|
1687 CompleteMockDispatchSatPcmdL(tlvEnd, KErrNone); |
|
1688 User::WaitForRequest(requestStatus); |
|
1689 ASSERT_EQUALS(KErrNone, requestStatus.Int()); // All TSendUssdV1 members were checked in 001b, 001c and so on tests |
|
1690 AssertMockLtsyStatusL(); |
|
1691 |
|
1692 // now test a "TERMINAL RESPONSE" specific to this loop |
|
1693 RSat::TSendUssdRspV1 resp; |
|
1694 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
1695 resp.SetPCmdNumber(KPcmdNumber); |
|
1696 |
|
1697 if(i < KNumberOfResponsesToTest) |
|
1698 { |
|
1699 TPtrC8 expectText(KNullDesC8); |
|
1700 switch(KResponsesToTest[i].iGeneralResult) |
|
1701 { |
|
1702 case RSat::KSuccess: |
|
1703 case RSat::KPartialComprehension: |
|
1704 case RSat::KMissingInformation: |
|
1705 case RSat::KRefreshAdditionEFRead: |
|
1706 case RSat::KSuccessRequestedIconNotDisplayed: |
|
1707 case RSat::KModifiedByCallControl: |
|
1708 case RSat::KSuccessLimitedService: |
|
1709 case RSat::KPerformedWithModifications: |
|
1710 case RSat::KRefreshUSIMNotActive: |
|
1711 { |
|
1712 expectText.Set(text7bit); |
|
1713 break; |
|
1714 } |
|
1715 default: |
|
1716 { |
|
1717 // Do nothing, expectText is set above |
|
1718 } |
|
1719 } |
|
1720 TBool expectAdditionalInfo = EFalse; |
|
1721 if ( ( RSat::KMeUnableToProcessCmd == KResponsesToTest[i].iGeneralResult ) || |
|
1722 ( RSat::KNetworkUnableToProcessCmd == KResponsesToTest[i].iGeneralResult ) || |
|
1723 ( RSat::KUssdReturnError == KResponsesToTest[i].iGeneralResult) || |
|
1724 ( RSat::KMultipleCardCmdsError == KResponsesToTest[i].iGeneralResult) ) |
|
1725 { |
|
1726 if((KResponsesToTest[i].iInfoType != RSat::KNoAdditionalInfo) && (!KResponsesToTest[i].iIntentionallyOmmitAdditionalInfo)) |
|
1727 { |
|
1728 expectAdditionalInfo = ETrue; |
|
1729 } |
|
1730 } |
|
1731 // Prepare ExpectL for TerminalResponseL |
|
1732 PrepareTerminalResponseMockDataWithExpL( |
|
1733 KPcmdNumber, |
|
1734 ESms7BitDcs, |
|
1735 expectText, // text |
|
1736 KResponsesToTest[i].iGeneralResult, |
|
1737 KResponsesToTest[i].iAdditionalInfo, |
|
1738 expectAdditionalInfo); // isResultAddInfoUsed |
|
1739 |
|
1740 // prepare data for TerminalResponseL |
|
1741 resp.iGeneralResult = KResponsesToTest[i].iGeneralResult; |
|
1742 resp.iInfoType = KResponsesToTest[i].iInfoType; |
|
1743 resp.iUssdString.iDcs = ESms7BitDcs; |
|
1744 resp.iUssdString.iUssdString.Copy(KTextString); |
|
1745 if( resp.iInfoType != RSat::KNoAdditionalInfo && |
|
1746 !KResponsesToTest[i].iIntentionallyOmmitAdditionalInfo) |
|
1747 { |
|
1748 resp.iAdditionalInfo.Append(KResponsesToTest[i].iAdditionalInfo); |
|
1749 } |
|
1750 // call TerminalRsp |
|
1751 TerminalResponseL(respPckg, KResponsesToTest[i].iExpectedResult); |
|
1752 |
|
1753 } |
|
1754 AssertMockLtsyStatusL(); |
|
1755 } |
|
1756 |
|
1757 |
|
1758 // now tell Mock to return KErrUnknown when dispatching forthcoming RSat::TerminalRsp() |
|
1759 // something like "Test A" of 001 test for TerminalResponse |
|
1760 PrepareTerminalResponseMockDataWithExpL( |
|
1761 KPcmdNumber, |
|
1762 ESms7BitDcs, |
|
1763 text7bit, |
|
1764 RSat::KSuccess, |
|
1765 0, |
|
1766 EFalse, |
|
1767 KErrUnknown); |
|
1768 |
|
1769 // call TerminalRsp |
|
1770 RSat::TSendUssdRspV1 resp; |
|
1771 RSat::TSendUssdRspV1Pckg respPckg(resp); |
|
1772 resp.SetPCmdNumber(KPcmdNumber); |
|
1773 resp.iGeneralResult = RSat::KSuccess; |
|
1774 resp.iInfoType = RSat::KNoAdditionalInfo; |
|
1775 resp.iUssdString.iDcs = ESms7BitDcs; |
|
1776 resp.iUssdString.iUssdString.Copy(KTextString); |
|
1777 TerminalResponseL(respPckg, KErrUnknown); |
|
1778 |
|
1779 AssertMockLtsyStatusL(); |
|
1780 } |
|
1781 |