|
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 SendSS in the SAT. |
|
20 */ |
|
21 |
|
22 #include "ccsatsendssfu.h" |
|
23 #include <cstktsy/bertlv_defs.h> |
|
24 #include <etel.h> |
|
25 #include <etelmm.h> |
|
26 #include <etelsat.h> |
|
27 #include <ctsy/serviceapi/gsmerror.h> |
|
28 #include <ctsy/mmtsy_names.h> |
|
29 #include <satcs.h> |
|
30 #include <ctsy/ltsy/sat_defs.h> |
|
31 #include <cstktsy/ttlv.h> |
|
32 |
|
33 #include <ctsy/ltsy/mltsydispatchsatinterface.h> |
|
34 #include <ctsy/ltsy/mltsydispatchphoneinterface.h> |
|
35 #include <test/mockltsyindicatorids.h> |
|
36 #include <test/tmockltsydata.h> |
|
37 |
|
38 |
|
39 static const TUint8 KCmdId = 1; |
|
40 static const TUint8 KCmdDetails = 0x00; |
|
41 // 1 bit always on, ton - international number, npi - isdn |
|
42 static const TUint8 KInternationalNumIsdn = (0x80 | 0x10 | 0x01); |
|
43 static const TInt KDelay = 10; |
|
44 |
|
45 // please see documentation for RSat::KSsReturnError |
|
46 // facilityNotSupported (according to TS 29.080), CODE local:21 (defined in TS 29.002) |
|
47 static const TUint8 KNetworkError = 0x15; |
|
48 |
|
49 _LIT8(KNoAlpha, "No Alpha"); |
|
50 _LIT8(KSSString, "**21*01234567890123456789*10#"); |
|
51 _LIT8(KSSStringWithPlus, "**21*+01234567890123456789*10#"); |
|
52 |
|
53 // see 3GPP TS 31.124 TERMINAL RESPONSE: SEND SS 1.1.1A |
|
54 _LIT16(KSSOpCodeAndParameters,"\x0A\xA0\x1A\x04\x01\x21\x30\x15\x30\x13\x83\ |
|
55 \x01\x00\x84\x01\x07\x89\x0B\x91\x10\x32\x54\x76\x98\x10\x32\x54\x76\x98"); |
|
56 |
|
57 |
|
58 CTestSuite* CCSatSendSSFU::CreateSuiteL(const TDesC& aName) |
|
59 { |
|
60 SUB_SUITE; |
|
61 |
|
62 ADD_TEST_STEP_ISO_CPP(CCSatSendSSFU, TestNotifySendSsPCmd0001L); |
|
63 ADD_TEST_STEP_ISO_CPP(CCSatSendSSFU, TestNotifySendSsPCmd0002L); |
|
64 ADD_TEST_STEP_ISO_CPP(CCSatSendSSFU, TestNotifySendSsPCmd0004L); |
|
65 |
|
66 END_SUITE; |
|
67 } |
|
68 |
|
69 |
|
70 // |
|
71 // Actual test cases |
|
72 // |
|
73 |
|
74 |
|
75 /** |
|
76 @SYMTestCaseID BA-CSAT-SSS-SNSSPC-0001 |
|
77 @SYMPREQ 1780 |
|
78 @SYMComponent telephony_csat |
|
79 @SYMTestCaseDesc Test support in CSAT for RSat::NotifySendSsPCmd |
|
80 @SYMTestPriority High |
|
81 @SYMTestActions Invokes RSat::NotifySendSsPCmd |
|
82 @SYMTestExpectedResults Pass |
|
83 @SYMTestType CT |
|
84 */ |
|
85 void CCSatSendSSFU::TestNotifySendSsPCmd0001L() |
|
86 { |
|
87 OpenEtelServerL(EUseExtendedError); |
|
88 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
89 OpenPhoneL(); |
|
90 OpenSatL(); |
|
91 |
|
92 TTlv tlv; |
|
93 |
|
94 TRequestStatus notifyStatus; |
|
95 RSat::TSendSsV1 sendSs; |
|
96 RSat::TSendSsV1Pckg sendSsPck(sendSs); |
|
97 |
|
98 RBuf8 data; |
|
99 CleanupClosePushL(data); |
|
100 |
|
101 //------------------------------------------------------------------------- |
|
102 // TEST C1: Successful completion request of RSat::NotifySendSsPCmd |
|
103 // with folowing negative terminal response without concrete error value |
|
104 //------------------------------------------------------------------------- |
|
105 |
|
106 _LIT8(KSSString1, "*#31#"); |
|
107 PrepareTlv( tlv, KSSString1, KNoAlpha); |
|
108 |
|
109 PrepareDispatchL(); |
|
110 iSat.NotifySendSsPCmd(notifyStatus, sendSsPck); |
|
111 |
|
112 CompleteDispatchL( tlv.End()); |
|
113 User::WaitForRequest(notifyStatus); |
|
114 ASSERT_EQUALS(KErrNone, notifyStatus.Int()); |
|
115 ASSERT_EQUALS( RSat::EInternationalNumber, sendSs.iSsString.iTypeOfNumber); |
|
116 ASSERT_EQUALS( RSat::EIsdnNumberPlan, sendSs.iSsString.iNumberPlan); |
|
117 ASSERT_EQUALS( 0, sendSs.iSsString.iSsString.Compare(KSSString1)); |
|
118 ASSERT_EQUALS( RSat::ENoIconId, sendSs.iIconId.iQualifier); |
|
119 ASSERT_EQUALS( RSat::EAlphaIdNotPresent, sendSs.iAlphaId.iStatus); |
|
120 ASSERT_EQUALS( KCmdId, sendSs.PCmdNumber()); |
|
121 |
|
122 RSat::TSendSsRspV2 rsp; |
|
123 RSat::TSendSsRspV2Pckg rspPckg(rsp); |
|
124 rsp.SetPCmdNumber(KCmdId); |
|
125 |
|
126 rsp.iGeneralResult = RSat::KSsReturnError; |
|
127 rsp.iInfoType = RSat::KSatNetworkErrorInfo; |
|
128 |
|
129 rsp.iAdditionalInfo.Zero(); |
|
130 rsp.iAdditionalInfo.Append(RSat::KNoSpecificMeProblem); |
|
131 |
|
132 GenerateTerminalResponseL(KCmdId, KSendSs, KCmdDetails, |
|
133 RSat::ESendSs, rspPckg, rsp.iAdditionalInfo, |
|
134 rsp.iGeneralResult); |
|
135 |
|
136 AssertMockLtsyStatusL(); |
|
137 |
|
138 //------------------------------------------------------------------------- |
|
139 // TEST C2: Completion of NotifySendSsPCmd() with a too large SS string in data |
|
140 //------------------------------------------------------------------------- |
|
141 |
|
142 data.CreateL(RSat::KStringMaxSize); |
|
143 data.AppendFill('*', data.MaxLength()); |
|
144 |
|
145 PrepareTlv( tlv, data, KNullDesC8); |
|
146 |
|
147 PrepareDispatchL(); |
|
148 iSat.NotifySendSsPCmd(notifyStatus, sendSsPck); |
|
149 |
|
150 CompleteDispatchL( tlv.End()); |
|
151 |
|
152 PrepareTerminalResponseMockDataL( KCmdId, KSendSs, KCmdDetails, |
|
153 KNullDesC16, RSat::KCmdDataNotUnderstood, KNullDesC8); |
|
154 |
|
155 User::WaitForRequest(notifyStatus); |
|
156 ASSERT_EQUALS(KErrCorrupt, notifyStatus.Int()); |
|
157 |
|
158 data.Close(); |
|
159 |
|
160 AssertMockLtsyStatusL(); |
|
161 |
|
162 //------------------------------------------------------------------------- |
|
163 // TEST E: Unsolicited completion of RSat::NotifySendSsPCmd |
|
164 // from LTSY. |
|
165 //------------------------------------------------------------------------- |
|
166 |
|
167 PrepareTlv( tlv, KSSString1, KNullDesC8); |
|
168 TDesC8* tlvDscPtr = &const_cast<TDesC8&>(tlv.End()); |
|
169 TMockLtsyData1<TDesC8*> tlvDscPack(tlvDscPtr); |
|
170 |
|
171 TRequestStatus mocklStatus; |
|
172 iMockLTSY.NotifyTerminated(mocklStatus); |
|
173 tlvDscPack.SerialiseL(data); |
|
174 iMockLTSY.CompleteL(KMockLtsyDispatchSatPcmdIndId, KErrNone, data); |
|
175 |
|
176 rsp.iAdditionalInfo.Zero(); |
|
177 rsp.iAdditionalInfo.Append(RSat::KNoSpecificMeProblem); |
|
178 |
|
179 PrepareTerminalResponseMockDataL( KCmdId, KSendSs, KCmdDetails, |
|
180 rsp.iAdditionalInfo, RSat::KMeUnableToProcessCmd, KNullDesC8); |
|
181 |
|
182 User::WaitForRequest(mocklStatus); |
|
183 AssertMockLtsyStatusL(); |
|
184 ASSERT_EQUALS(KErrNone, mocklStatus.Int()); |
|
185 |
|
186 |
|
187 //------------------------------------------------------------------------- |
|
188 // TEST C3: Testing all possible results for Terminal Response |
|
189 //------------------------------------------------------------------------- |
|
190 |
|
191 DoTestTerminalResponseL(); |
|
192 |
|
193 //------------------------------------------------------------------------- |
|
194 // TEST C4: Successful completion request of RSat::NotifySendSsPCmd |
|
195 // with following negative terminal response with RSat::KMeBusyOnSs error |
|
196 //------------------------------------------------------------------------- |
|
197 |
|
198 PrepareDispatchL(); |
|
199 iSat.NotifySendSsPCmd(notifyStatus, sendSsPck); |
|
200 |
|
201 CompleteDispatchL( *tlvDscPtr ); |
|
202 User::WaitForRequest(notifyStatus); |
|
203 ASSERT_EQUALS(KErrNone, notifyStatus.Int()); |
|
204 ASSERT_EQUALS( RSat::EInternationalNumber, sendSs.iSsString.iTypeOfNumber); |
|
205 ASSERT_EQUALS( RSat::EIsdnNumberPlan, sendSs.iSsString.iNumberPlan); |
|
206 ASSERT_EQUALS( 0, sendSs.iSsString.iSsString.Compare(KSSString1)); |
|
207 ASSERT_EQUALS( RSat::ENoIconId, sendSs.iIconId.iQualifier); |
|
208 ASSERT_EQUALS( RSat::EAlphaIdNull, sendSs.iAlphaId.iStatus); |
|
209 ASSERT_EQUALS( KCmdId, sendSs.PCmdNumber()); |
|
210 |
|
211 rsp.iGeneralResult = RSat::KSsReturnError; |
|
212 rsp.iInfoType = RSat::KSatNetworkErrorInfo; |
|
213 rsp.iAdditionalInfo.Zero(); |
|
214 rsp.iAdditionalInfo.Append(KNetworkError); |
|
215 |
|
216 GenerateTerminalResponseL(KCmdId, KSendSs, KCmdDetails, |
|
217 RSat::ESendSs, rspPckg, rsp.iAdditionalInfo, rsp.iGeneralResult); |
|
218 |
|
219 AssertMockLtsyStatusL(); |
|
220 |
|
221 //------------------------------------------------------------------------- |
|
222 // TEST C5: completion of NotifySendSsPCmd() with missing data - passing no SS string |
|
223 //------------------------------------------------------------------------- |
|
224 |
|
225 tlv.Begin(KBerTlvProactiveSimCommandTag); |
|
226 tlv.AddTag(KTlvCommandDetailsTag); |
|
227 tlv.AddByte(KCmdId);//ETLV_CommandNumber |
|
228 tlv.AddByte(KSendSs); //ETLV_TypeOfCommand |
|
229 tlv.AddByte(KCmdDetails); //ETLV_CommandQualifier |
|
230 |
|
231 PrepareDispatchL(); |
|
232 iSat.NotifySendSsPCmd(notifyStatus, sendSsPck); |
|
233 |
|
234 CompleteDispatchL( tlv.End()); |
|
235 |
|
236 PrepareTerminalResponseMockDataL( KCmdId, KSendSs, KCmdDetails, |
|
237 KNullDesC16, RSat::KErrorRequiredValuesMissing, KNullDesC8); |
|
238 |
|
239 User::WaitForRequest(notifyStatus); |
|
240 ASSERT_EQUALS(KErrCorrupt, notifyStatus.Int()); |
|
241 |
|
242 AssertMockLtsyStatusL(); |
|
243 |
|
244 //------------------------------------------------------------------------- |
|
245 // TEST C6: Successful completion request of |
|
246 // RSat::NotifySendSsPCmd |
|
247 // see 3GPP TS 31.124 clause 27.22.4.11.1.4.2 |
|
248 //------------------------------------------------------------------------- |
|
249 |
|
250 _LIT8(KAlpha, "Call Forward"); |
|
251 _LIT16(KAlpha16, "Call Forward"); |
|
252 |
|
253 PrepareTlv( tlv, KSSString, KAlpha); |
|
254 tlv.End(); |
|
255 |
|
256 PrepareDispatchL(); |
|
257 |
|
258 iSat.NotifySendSsPCmd(notifyStatus, sendSsPck); |
|
259 |
|
260 CompleteDispatchL( *tlvDscPtr); |
|
261 |
|
262 User::WaitForRequest(notifyStatus); |
|
263 ASSERT_EQUALS(KErrNone, notifyStatus.Int()); |
|
264 |
|
265 ASSERT_EQUALS( RSat::EInternationalNumber, sendSs.iSsString.iTypeOfNumber); |
|
266 ASSERT_EQUALS( RSat::EIsdnNumberPlan, sendSs.iSsString.iNumberPlan); |
|
267 ASSERT_EQUALS( 0, sendSs.iSsString.iSsString.Compare(KSSStringWithPlus)); |
|
268 ASSERT_EQUALS( RSat::ENoIconId, sendSs.iIconId.iQualifier); |
|
269 ASSERT_EQUALS( RSat::EAlphaIdProvided, sendSs.iAlphaId.iStatus); |
|
270 ASSERT_EQUALS( 0, sendSs.iAlphaId.iAlphaId.Compare(KAlpha16)); |
|
271 ASSERT_EQUALS( KCmdId, sendSs.PCmdNumber()); |
|
272 |
|
273 //terminal response |
|
274 |
|
275 rsp.iGeneralResult = RSat::KSuccess; |
|
276 rsp.iInfoType = RSat::KSendSsInfo; |
|
277 rsp.iAdditionalInfo.Zero(); |
|
278 rsp.iAdditionalInfo.Append(KSSOpCodeAndParameters); |
|
279 |
|
280 // defect, first byte from additional info is deleted in CSatNotifySendSs::TerminalResponseL() |
|
281 |
|
282 GenerateTerminalResponseL(KCmdId, KSendSs, KCmdDetails, |
|
283 RSat::ESendSs, rspPckg, rsp.iAdditionalInfo, |
|
284 rsp.iGeneralResult); |
|
285 |
|
286 AssertMockLtsyStatusL(); |
|
287 |
|
288 //------------------------------------------------------------------------- |
|
289 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
290 //------------------------------------------------------------------------- |
|
291 |
|
292 PrepareDispatchL(); |
|
293 |
|
294 iSat.NotifySendSsPCmd(notifyStatus, sendSsPck); |
|
295 |
|
296 CompleteDispatchL( *tlvDscPtr, KErrUnknown); |
|
297 |
|
298 User::WaitForRequest(notifyStatus); |
|
299 ASSERT_EQUALS(KErrUnknown, notifyStatus.Int()); |
|
300 |
|
301 AssertMockLtsyStatusL(); |
|
302 |
|
303 CleanupStack::PopAndDestroy(2, this); // data, this |
|
304 |
|
305 } |
|
306 |
|
307 |
|
308 /** |
|
309 @SYMTestCaseID BA-CSAT-SSS-SNSSPC-0002 |
|
310 @SYMPREQ 1780 |
|
311 @SYMComponent telephony_csat |
|
312 @SYMTestCaseDesc Test support in CSAT for cancelling of RSat::NotifySendSsPCmd |
|
313 @SYMTestPriority High |
|
314 @SYMTestActions Invokes cancelling of RSat::NotifySendSsPCmd |
|
315 @SYMTestExpectedResults Pass |
|
316 @SYMTestType CT |
|
317 */ |
|
318 void CCSatSendSSFU::TestNotifySendSsPCmd0002L() |
|
319 { |
|
320 OpenEtelServerL(EUseExtendedError); |
|
321 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
322 OpenPhoneL(); |
|
323 OpenSatL(); |
|
324 |
|
325 //------------------------------------------------------------------------- |
|
326 // Test cancelling of RSat::NotifySendSsPCmd |
|
327 //------------------------------------------------------------------------- |
|
328 TRequestStatus notifyStatus; |
|
329 RSat::TSendSsV1 sendSs; |
|
330 RSat::TSendSsV1Pckg sendSsPck(sendSs); |
|
331 |
|
332 PrepareDispatchL(); |
|
333 |
|
334 iSat.NotifySendSsPCmd(notifyStatus, sendSsPck); |
|
335 |
|
336 iSat.CancelAsyncRequest(ESatNotifySendSsPCmd); |
|
337 |
|
338 User::WaitForRequest(notifyStatus); |
|
339 ASSERT_EQUALS( KErrCancel, notifyStatus.Int()); |
|
340 |
|
341 AssertMockLtsyStatusL(); |
|
342 |
|
343 CleanupStack::PopAndDestroy(1, this); |
|
344 } |
|
345 |
|
346 |
|
347 |
|
348 /** |
|
349 @SYMTestCaseID BA-CSAT-SSS-SNSSPC-0004 |
|
350 @SYMPREQ 1780 |
|
351 @SYMComponent telephony_csat |
|
352 @SYMTestCaseDesc Test support in CSAT for multiple client requests to RSat::NotifySendSsPCmd |
|
353 @SYMTestPriority High |
|
354 @SYMTestActions Invokes multiple client requests to RSat::NotifySendSsPCmd |
|
355 @SYMTestExpectedResults Pass |
|
356 @SYMTestType CT |
|
357 */ |
|
358 void CCSatSendSSFU::TestNotifySendSsPCmd0004L() |
|
359 { |
|
360 OpenEtelServerL(EUseExtendedError); |
|
361 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
362 OpenPhoneL(); |
|
363 OpenSatL(); |
|
364 |
|
365 // Open second client |
|
366 RTelServer telServer2; |
|
367 TInt ret = telServer2.Connect(); |
|
368 ASSERT_EQUALS(KErrNone, ret); |
|
369 CleanupClosePushL(telServer2); |
|
370 |
|
371 RMobilePhone phone2; |
|
372 ret = phone2.Open(telServer2,KMmTsyPhoneName); |
|
373 ASSERT_EQUALS(KErrNone, ret); |
|
374 CleanupClosePushL(phone2); |
|
375 |
|
376 RSat sat2; |
|
377 ret = sat2.Open(phone2); |
|
378 ASSERT_EQUALS(KErrNone, ret); |
|
379 CleanupClosePushL(sat2); |
|
380 |
|
381 //------------------------------------------------------------------------- |
|
382 // Test A: Test multiple clients requesting RSat::NotifySendSsPCmd |
|
383 // when they both pass the same T-class version |
|
384 //------------------------------------------------------------------------- |
|
385 |
|
386 TTlv tlv; |
|
387 PrepareTlv( tlv, KSSString, KNullDesC8); |
|
388 TDesC8* tlvDscPtr = &const_cast<TDesC8&>(tlv.End()); |
|
389 TMockLtsyData1<TDesC8*> tlvDscPack(tlvDscPtr); |
|
390 |
|
391 PrepareDispatchL(); |
|
392 |
|
393 TRequestStatus notifyStatus; |
|
394 TRequestStatus notifyStatus2; |
|
395 RSat::TSendSsV1 sendSs; |
|
396 RSat::TSendSsV1 sendSs2; |
|
397 RSat::TSendSsV1Pckg sendSsPck(sendSs); |
|
398 RSat::TSendSsV1Pckg sendSsPck2(sendSs2); |
|
399 |
|
400 iSat.NotifySendSsPCmd(notifyStatus, sendSsPck); |
|
401 sat2.NotifySendSsPCmd(notifyStatus2, sendSsPck2); |
|
402 |
|
403 CompleteDispatchL( *tlvDscPtr); |
|
404 |
|
405 User::WaitForRequest(notifyStatus); |
|
406 ASSERT_EQUALS(KErrNone, notifyStatus.Int()); |
|
407 ASSERT_EQUALS( RSat::EInternationalNumber, sendSs.iSsString.iTypeOfNumber); |
|
408 ASSERT_EQUALS( RSat::EIsdnNumberPlan, sendSs.iSsString.iNumberPlan); |
|
409 ASSERT_EQUALS( 0, sendSs.iSsString.iSsString.Compare(KSSStringWithPlus)); |
|
410 ASSERT_EQUALS( RSat::ENoIconId, sendSs.iIconId.iQualifier); |
|
411 ASSERT_EQUALS( RSat::EAlphaIdNull, sendSs.iAlphaId.iStatus); |
|
412 ASSERT_EQUALS( KCmdId, sendSs.PCmdNumber()); |
|
413 |
|
414 User::WaitForRequest(notifyStatus2); |
|
415 //probably «KErrServerBusy?is more appropriate result here |
|
416 ASSERT_EQUALS(KErrNone, notifyStatus2.Int()); |
|
417 ASSERT_EQUALS( RSat::EInternationalNumber, sendSs2.iSsString.iTypeOfNumber); |
|
418 ASSERT_EQUALS( RSat::EIsdnNumberPlan, sendSs2.iSsString.iNumberPlan); |
|
419 ASSERT_EQUALS( 0, sendSs2.iSsString.iSsString.Compare(KSSStringWithPlus)); |
|
420 ASSERT_EQUALS( RSat::ENoIconId, sendSs2.iIconId.iQualifier); |
|
421 ASSERT_EQUALS( RSat::EAlphaIdNull, sendSs2.iAlphaId.iStatus); |
|
422 ASSERT_EQUALS( KCmdId, sendSs2.PCmdNumber()); |
|
423 |
|
424 AssertMockLtsyStatusL(); |
|
425 |
|
426 CleanupStack::PopAndDestroy(4, this); //sat2 phone2 telServer2 this |
|
427 } |
|
428 |
|
429 |
|
430 |
|
431 /** |
|
432 * prepare tlv buffer for refresh proactive command |
|
433 * @param aTlv - tlv buffer to prepare |
|
434 * @param aCmdQualifier - type of command |
|
435 */ |
|
436 void CCSatSendSSFU::PrepareTlv(TTlv& aTlv, const TDesC8& aSsString, const TDesC8& aAlpha) |
|
437 { |
|
438 aTlv.Begin(KBerTlvProactiveSimCommandTag); |
|
439 aTlv.AddTag(KTlvCommandDetailsTag); |
|
440 aTlv.AddByte(KCmdId);//ETLV_CommandNumber |
|
441 aTlv.AddByte(KSendSs); //ETLV_TypeOfCommand |
|
442 aTlv.AddByte(KCmdDetails); //ETLV_CommandQualifier |
|
443 |
|
444 aTlv.AddTag(KTlvDeviceIdentityTag); |
|
445 aTlv.AddByte(KSim); //ETLV_SourceDeviceIdentity |
|
446 aTlv.AddByte(KNetwork); //ETLV_DestinationDeviceIdentity |
|
447 |
|
448 if(0 != aAlpha.Compare(KNoAlpha)) |
|
449 { |
|
450 aTlv.AddTag(KTlvAlphaIdentifierTag); |
|
451 aTlv.AddData(aAlpha);//ETLV_AlphaIdentifier |
|
452 } |
|
453 |
|
454 aTlv.AddTag(KTlvSsStringTag); |
|
455 aTlv.AddByte(KInternationalNumIsdn); // TON NPI |
|
456 TBuf8<RSat::KStringMaxSize> tempString; |
|
457 TSatUtility::AsciiToBCD( aSsString, tempString ); |
|
458 aTlv.AddData(tempString); //SS string |
|
459 } |
|
460 |
|
461 /** |
|
462 * prepare mock complete for processing of proactive command |
|
463 * @param aTlvDsc - tlv buffer to send |
|
464 * @param aRes - result for request completion |
|
465 */ |
|
466 void CCSatSendSSFU::CompleteDispatchL(const TDesC8& aTlvDsc, TInt aRes) |
|
467 { |
|
468 RBuf8 data; |
|
469 CleanupClosePushL(data); |
|
470 |
|
471 TDesC8* tlvDscPtr = const_cast<TDesC8*>(&aTlvDsc); |
|
472 TMockLtsyData1<TDesC8*> tlvDscPack(tlvDscPtr); |
|
473 |
|
474 tlvDscPack.SerialiseL(data); |
|
475 iMockLTSY.CompleteL(KMockLtsyDispatchSatPcmdIndId, aRes, data, KDelay); |
|
476 |
|
477 CleanupStack::PopAndDestroy(1); |
|
478 } |
|
479 |
|
480 /** |
|
481 * prepare mock for dispatch of sat notification |
|
482 */ |
|
483 void CCSatSendSSFU::PrepareDispatchL() |
|
484 { |
|
485 RBuf8 data; |
|
486 CleanupClosePushL(data); |
|
487 |
|
488 TUint8 pcmdCode = KSendSs; |
|
489 TMockLtsyData1<TUint8> expLtsyData(pcmdCode); |
|
490 expLtsyData.SerialiseL(data); |
|
491 |
|
492 iMockLTSY.ExpectL(MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId,data); |
|
493 |
|
494 CleanupStack::PopAndDestroy(1); |
|
495 } |
|
496 |
|
497 |
|
498 /** |
|
499 * Tests all possible "TERMINAL RESPONSE" cases. |
|
500 * API should return KErrNone for all valid responses and KErrCorrupt |
|
501 * for those that can not be used with "Send SS" command |
|
502 */ |
|
503 void CCSatSendSSFU::DoTestTerminalResponseL() |
|
504 { |
|
505 static const struct |
|
506 { |
|
507 RSat::TPCmdResult iGeneralResult; |
|
508 RSat::TAdditionalInfoType iInfoType; |
|
509 TBool iIntentionallyOmmitAdditionalInfo; |
|
510 TUint8 iAdditionalInfo; |
|
511 TInt iExpectedResult; |
|
512 } |
|
513 KResponsesToTest[] = |
|
514 { |
|
515 { |
|
516 // 0x00 - Command performed successfully; |
|
517 // no additional info provided |
|
518 RSat::KPartialComprehension, |
|
519 RSat::KNoAdditionalInfo, |
|
520 ETrue, |
|
521 0, |
|
522 KErrCorrupt |
|
523 }, |
|
524 { |
|
525 // 0x01 - Command performed with partial comprehension; |
|
526 // no additional info provided |
|
527 RSat::KPartialComprehension, |
|
528 RSat::KNoAdditionalInfo, |
|
529 ETrue, |
|
530 0, |
|
531 KErrCorrupt |
|
532 }, |
|
533 { |
|
534 // 0x01 - Command performed with partial comprehension; |
|
535 // correct additional info provided |
|
536 RSat::KPartialComprehension, |
|
537 RSat::KSendSsInfo, |
|
538 EFalse, |
|
539 0, |
|
540 KErrNone |
|
541 }, |
|
542 { |
|
543 // 0x02 - Command performed, with missing information; |
|
544 // no additional info provided |
|
545 RSat::KMissingInformation, |
|
546 RSat::KNoAdditionalInfo, |
|
547 ETrue, |
|
548 0, |
|
549 KErrCorrupt |
|
550 }, |
|
551 { |
|
552 // 0x02 - Command performed, with missing information; |
|
553 // correct additional info provided |
|
554 RSat::KMissingInformation, |
|
555 RSat::KSendSsInfo, |
|
556 EFalse, |
|
557 0, |
|
558 KErrNone |
|
559 }, |
|
560 { |
|
561 // 0x03 - REFRESH performed with additional EFs read; |
|
562 // no additional info provided |
|
563 RSat::KRefreshAdditionEFRead, |
|
564 RSat::KNoAdditionalInfo, |
|
565 ETrue, |
|
566 0, |
|
567 KErrCorrupt |
|
568 }, |
|
569 { |
|
570 // 0x03 - REFRESH performed with additional EFs read; |
|
571 // correct additional info provided |
|
572 RSat::KRefreshAdditionEFRead, |
|
573 RSat::KSendSsInfo, |
|
574 EFalse, |
|
575 0, |
|
576 KErrCorrupt |
|
577 }, |
|
578 { |
|
579 // 0x04 - Command performed successfully, but requested icon could not be displayed; |
|
580 // no additional info provided |
|
581 RSat::KSuccessRequestedIconNotDisplayed, |
|
582 RSat::KNoAdditionalInfo, |
|
583 ETrue, |
|
584 0, |
|
585 KErrCorrupt |
|
586 }, |
|
587 { |
|
588 // 0x04 - Command performed successfully, but requested icon could not be displayed; |
|
589 // correct additional info provided |
|
590 RSat::KSuccessRequestedIconNotDisplayed, |
|
591 RSat::KSendSsInfo, |
|
592 EFalse, |
|
593 0, |
|
594 KErrNone |
|
595 }, |
|
596 { |
|
597 // 0x05 - Command performed, but modified by call control by NAA; |
|
598 RSat::KModifiedByCallControl, |
|
599 RSat::KNoAdditionalInfo, |
|
600 ETrue, |
|
601 0, |
|
602 KErrCorrupt |
|
603 }, |
|
604 { |
|
605 // 0x06 - Command performed successfully, limited service; |
|
606 RSat::KSuccessLimitedService, |
|
607 RSat::KNoAdditionalInfo, |
|
608 ETrue, |
|
609 0, |
|
610 KErrCorrupt |
|
611 }, |
|
612 { |
|
613 // 0x07 - Command performed with modification; |
|
614 RSat::KPerformedWithModifications, |
|
615 RSat::KNoAdditionalInfo, |
|
616 ETrue, |
|
617 0, |
|
618 KErrCorrupt |
|
619 }, |
|
620 { |
|
621 // 0x08 - REFRESH performed but indicated NAA was not active; |
|
622 RSat::KRefreshUSIMNotActive, |
|
623 RSat::KNoAdditionalInfo, |
|
624 ETrue, |
|
625 0, |
|
626 KErrCorrupt |
|
627 }, |
|
628 { |
|
629 // 0x09 - Command performed successfully, tone not played; |
|
630 RSat::KPlayTonePerformedSuccessfully, |
|
631 RSat::KNoAdditionalInfo, |
|
632 ETrue, |
|
633 0, |
|
634 KErrCorrupt |
|
635 }, |
|
636 { |
|
637 // 0x10 - Proactive UICC session terminated by the user; |
|
638 RSat::KPSessionTerminatedByUser, |
|
639 RSat::KNoAdditionalInfo, |
|
640 ETrue, |
|
641 0, |
|
642 KErrCorrupt |
|
643 }, |
|
644 { |
|
645 // 0x11 - Backward move in the proactive UICC session requested by the user; |
|
646 RSat::KBackwardModeRequestedByUser, |
|
647 RSat::KNoAdditionalInfo, |
|
648 ETrue, |
|
649 0, |
|
650 KErrCorrupt |
|
651 }, |
|
652 { |
|
653 // 0x12 - No response from user; |
|
654 RSat::KNoResponseFromUser, |
|
655 RSat::KNoAdditionalInfo, |
|
656 ETrue, |
|
657 0, |
|
658 KErrCorrupt |
|
659 }, |
|
660 { |
|
661 // 0x13 - Help information required by the user; |
|
662 RSat::KHelpRequestedByUser, |
|
663 RSat::KNoAdditionalInfo, |
|
664 ETrue, |
|
665 0, |
|
666 KErrCorrupt |
|
667 }, |
|
668 { |
|
669 // 0x14 - reserved for GSM/3G. |
|
670 RSat::KUssdTransactionTerminatedByUser, |
|
671 RSat::KNoAdditionalInfo, |
|
672 ETrue, |
|
673 0, |
|
674 KErrNone |
|
675 }, |
|
676 { |
|
677 // 0x20 - terminal currently unable to process command; |
|
678 RSat::KMeUnableToProcessCmd, |
|
679 RSat::KMeProblem, |
|
680 EFalse, |
|
681 RSat::KNoSpecificMeProblem, |
|
682 KErrNone |
|
683 }, |
|
684 { |
|
685 // 0x21 - Network currently unable to process command; |
|
686 RSat::KNetworkUnableToProcessCmd, |
|
687 RSat::KSatNetworkErrorInfo, |
|
688 EFalse, |
|
689 0, |
|
690 KErrNone |
|
691 }, |
|
692 { |
|
693 // 0x22 - User did not accept the proactive command; |
|
694 RSat::KPCmdNotAcceptedByUser, |
|
695 RSat::KNoAdditionalInfo, |
|
696 ETrue, |
|
697 0, |
|
698 KErrCorrupt |
|
699 }, |
|
700 { |
|
701 // 0x23 - User cleared down call before connection or network release; |
|
702 RSat::KCallClearedBeforeConnectionOrReleased, |
|
703 RSat::KNoAdditionalInfo, |
|
704 ETrue, |
|
705 0, |
|
706 KErrCorrupt |
|
707 }, |
|
708 { |
|
709 // 0x24 - Action in contradiction with the current timer state; |
|
710 RSat::KContradictionWithTimerState, |
|
711 RSat::KNoAdditionalInfo, |
|
712 ETrue, |
|
713 0, |
|
714 KErrCorrupt |
|
715 }, |
|
716 { |
|
717 // 0x25 - Interaction with call control by NAA, temporary problem; |
|
718 RSat::KInteractionWithCCTemporaryError, |
|
719 RSat::KNoAdditionalInfo, |
|
720 ETrue, |
|
721 0, |
|
722 KErrNone |
|
723 }, |
|
724 { |
|
725 // 0x26 - Launch browser generic error code; |
|
726 RSat::KLaunchBrowserError, |
|
727 RSat::KMeProblem, |
|
728 EFalse, |
|
729 RSat::KNoSpecificBrowserError, |
|
730 KErrCorrupt |
|
731 }, |
|
732 { |
|
733 // 0x27 - MMS temporary problem. |
|
734 RSat::KMMSTemporaryProblem, |
|
735 RSat::KNoAdditionalInfo, |
|
736 ETrue, |
|
737 0, |
|
738 KErrCorrupt |
|
739 }, |
|
740 { |
|
741 // 0x30 - Command beyond terminal's capabilities; |
|
742 RSat::KCmdBeyondMeCapabilities, |
|
743 RSat::KNoAdditionalInfo, |
|
744 ETrue, |
|
745 0, |
|
746 KErrNone |
|
747 }, |
|
748 { |
|
749 // 0x31 - Command type not understood by terminal; |
|
750 RSat::KCmdTypeNotUnderstood, |
|
751 RSat::KNoAdditionalInfo, |
|
752 ETrue, |
|
753 0, |
|
754 KErrNone |
|
755 }, |
|
756 { |
|
757 // 0x32 - Command data not understood by terminal; |
|
758 RSat::KCmdDataNotUnderstood, |
|
759 RSat::KNoAdditionalInfo, |
|
760 ETrue, |
|
761 0, |
|
762 KErrNone |
|
763 }, |
|
764 { |
|
765 // 0x33 - Command number not known by terminal; |
|
766 RSat::KCmdNumberNotKnown, |
|
767 RSat::KNoAdditionalInfo, |
|
768 ETrue, |
|
769 0, |
|
770 KErrNone |
|
771 }, |
|
772 //0x34 is processed in a special way, checked in TestNotifySendSsPCmd0001L() |
|
773 { |
|
774 // 0x35 - reserved for GSM/3G; |
|
775 RSat::KSmsRpError, |
|
776 RSat::KNoAdditionalInfo, |
|
777 ETrue, |
|
778 0, |
|
779 KErrCorrupt |
|
780 }, |
|
781 { |
|
782 // 0x36 - Error, required values are missing; |
|
783 RSat::KErrorRequiredValuesMissing, |
|
784 RSat::KNoAdditionalInfo, |
|
785 ETrue, |
|
786 0, |
|
787 KErrNone |
|
788 }, |
|
789 { |
|
790 // 0x37 - reserved for GSM/3G; |
|
791 RSat::KUssdReturnError, |
|
792 RSat::KSatNetworkErrorInfo, |
|
793 EFalse, |
|
794 0, |
|
795 KErrCorrupt |
|
796 }, |
|
797 { |
|
798 // 0x38 - MultipleCard commands error; |
|
799 RSat::KMultipleCardCmdsError, |
|
800 RSat::KMeProblem, |
|
801 EFalse, |
|
802 RSat::KNoSpecificMultiCardError, |
|
803 KErrCorrupt |
|
804 }, |
|
805 { |
|
806 // 0x39 - Interaction with call control by NAA, permanent problem; |
|
807 RSat::KInteractionWithCCPermanentError, |
|
808 RSat::KMeProblem, |
|
809 EFalse, |
|
810 RSat::KNoSpecificInteractionError, |
|
811 KErrNone |
|
812 }, |
|
813 { |
|
814 // 0x3A - Bearer Independent Protocol error; |
|
815 RSat::KBearerIndepProtocolError, |
|
816 RSat::KMeProblem, |
|
817 EFalse, |
|
818 RSat::KNoSpecificBIPError, |
|
819 KErrCorrupt |
|
820 }, |
|
821 { |
|
822 // 0x3B - Access Technology unable to process command; |
|
823 RSat::KAccessTechUnableProcessCmd, |
|
824 RSat::KNoAdditionalInfo, |
|
825 ETrue, |
|
826 0, |
|
827 KErrCorrupt |
|
828 }, |
|
829 { |
|
830 // 0x3C - Frames error; |
|
831 RSat::KFramesError, |
|
832 RSat::KMeProblem, |
|
833 EFalse, |
|
834 RSat::KNoSpecificCauseCanBeGiven, |
|
835 KErrCorrupt |
|
836 }, |
|
837 { |
|
838 // 0x3D - MMS Error. |
|
839 RSat::KMMSError, |
|
840 RSat::KMeProblem, |
|
841 EFalse, |
|
842 0, |
|
843 KErrCorrupt |
|
844 } |
|
845 }; |
|
846 |
|
847 const TInt KNumberOfResponsesToTest = sizeof(KResponsesToTest)/ sizeof(KResponsesToTest[0]); |
|
848 |
|
849 TTlv tlv; |
|
850 PrepareTlv( tlv, KSSString, KNullDesC8); |
|
851 |
|
852 TDesC8* tlvDscPtr = &const_cast<TDesC8&>(tlv.End()); |
|
853 |
|
854 TRequestStatus notifyStatus; |
|
855 RSat::TSendSsV1 sendSs; |
|
856 RSat::TSendSsV1Pckg sendSsPck(sendSs); |
|
857 |
|
858 RSat::TSendSsRspV2* rsp = new(ELeave) RSat::TSendSsRspV2(); |
|
859 CleanupStack::PushL(rsp); |
|
860 RSat::TSendSsRspV2Pckg* rspPckg = new(ELeave) RSat::TSendSsRspV2Pckg(*rsp); |
|
861 CleanupStack::PushL(rspPckg); |
|
862 |
|
863 for(TInt i = 0; i <= KNumberOfResponsesToTest; i++) |
|
864 { |
|
865 // notify request |
|
866 PrepareDispatchL(); |
|
867 iSat.NotifySendSsPCmd(notifyStatus, sendSsPck); |
|
868 CompleteDispatchL( *tlvDscPtr ); |
|
869 User::WaitForRequest(notifyStatus); |
|
870 ASSERT_EQUALS(KErrNone, notifyStatus.Int()); |
|
871 |
|
872 AssertMockLtsyStatusL(); |
|
873 |
|
874 // now test a "TERMINAL RESPONSE" specific to this loop |
|
875 rsp->SetPCmdNumber(KCmdId); |
|
876 rsp->iAdditionalInfo.Zero(); |
|
877 |
|
878 if(i < KNumberOfResponsesToTest) |
|
879 { |
|
880 // looping through KResponsesToTest table |
|
881 rsp->iGeneralResult = KResponsesToTest[i].iGeneralResult; |
|
882 rsp->iInfoType = KResponsesToTest[i].iInfoType; |
|
883 if ( !KResponsesToTest[i].iIntentionallyOmmitAdditionalInfo ) |
|
884 { |
|
885 if ( rsp->iInfoType == RSat::KSendSsInfo ) |
|
886 { |
|
887 rsp->iAdditionalInfo.Append( KSSOpCodeAndParameters ); |
|
888 } |
|
889 else |
|
890 { |
|
891 rsp->iAdditionalInfo.Append( KResponsesToTest[i].iAdditionalInfo ); |
|
892 } |
|
893 } |
|
894 GenerateTerminalResponseL(KCmdId, KSendSs, KCmdDetails, |
|
895 RSat::ESendSs, *rspPckg, rsp->iAdditionalInfo, |
|
896 rsp->iGeneralResult, KNullDesC8, KResponsesToTest[i].iExpectedResult); |
|
897 } |
|
898 else |
|
899 { |
|
900 // now tell Mock to return KErrUnknown when dispatching forthcoming RSat::TerminalRsp() |
|
901 rsp->iGeneralResult = RSat::KSuccess; |
|
902 rsp->iInfoType = RSat::KSendSsInfo; |
|
903 rsp->iAdditionalInfo.Append(KSSOpCodeAndParameters); |
|
904 |
|
905 PrepareTerminalResponseMockDataL( KCmdId, KSendSs, KCmdDetails, |
|
906 rsp->iAdditionalInfo, rsp->iGeneralResult, KNullDesC8, KErrUnknown); |
|
907 |
|
908 TerminalResponseL( RSat::ESendSs, *rspPckg, KErrUnknown); |
|
909 } |
|
910 |
|
911 AssertMockLtsyStatusL(); |
|
912 } |
|
913 |
|
914 CleanupStack::PopAndDestroy(2); |
|
915 } |
|
916 |
|
917 |
|
918 |