|
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 ProvideLocalInfo in the SAT. |
|
20 */ |
|
21 |
|
22 #include <cstktsy/bertlv_defs.h> |
|
23 #include <etel.h> |
|
24 #include <etelmm.h> |
|
25 #include <etelsat.h> |
|
26 #include <ctsy/serviceapi/gsmerror.h> |
|
27 #include <ctsy/mmtsy_names.h> |
|
28 #include <ctsy/ltsy/sat_defs.h> |
|
29 |
|
30 #include <ctsy/ltsy/mltsydispatchsatinterface.h> |
|
31 #include <ctsy/ltsy/mltsydispatchphoneinterface.h> |
|
32 #include <test/mockltsyindicatorids.h> |
|
33 #include <test/tmockltsydata.h> |
|
34 #include <cstktsy/ttlv.h> |
|
35 #include <satcs.h> // Etel SAT IPC definitions |
|
36 #include "ccsatprovidelocalinfofu.h" |
|
37 |
|
38 |
|
39 typedef TBuf8<KImeiLength> TImeiBuf; |
|
40 |
|
41 CTestSuite* CCSatProvideLocalInfoFU::CreateSuiteL(const TDesC& aName) |
|
42 { |
|
43 SUB_SUITE; |
|
44 |
|
45 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0001L); |
|
46 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0002L); |
|
47 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0004L); |
|
48 |
|
49 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0001bL); |
|
50 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0001cL); |
|
51 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0001dL); |
|
52 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0001eL); |
|
53 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0001fL); |
|
54 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0001gL); |
|
55 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0001hL); |
|
56 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0001iL); |
|
57 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0001jL); |
|
58 ADD_TEST_STEP_ISO_CPP(CCSatProvideLocalInfoFU, TestNotifyLocalInfoPCmd0001kL); |
|
59 |
|
60 END_SUITE; |
|
61 } |
|
62 |
|
63 |
|
64 // |
|
65 // Actual test cases |
|
66 // |
|
67 |
|
68 /** |
|
69 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0001 |
|
70 @SYMPREQ 1780 |
|
71 @SYMComponent telephony_ctsy |
|
72 @SYMTestCaseDesc Test support in CTSY for RSat::NotifyLocalInfoPCmd |
|
73 @SYMTestPriority High |
|
74 @SYMTestActions Invokes RSat::NotifyLocalInfoPCmd |
|
75 @SYMTestExpectedResults Pass |
|
76 @SYMTestType CT |
|
77 */ |
|
78 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0001L() |
|
79 { |
|
80 OpenEtelServerL(EUseExtendedError); |
|
81 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
82 OpenPhoneL(); |
|
83 OpenSatL(); |
|
84 |
|
85 RBuf8 data; |
|
86 CleanupClosePushL(data); |
|
87 |
|
88 //------------------------------------------------------------------------- |
|
89 // TEST B: failure on completion of pending request from LTSY->SATTSY |
|
90 //------------------------------------------------------------------------- |
|
91 |
|
92 //Prepare data for ExpectL needed by NotifyLocalInfoPCmd |
|
93 //and post that ExpectL |
|
94 PrepareMockLDataWithExpL(KProvideLocalInformation); |
|
95 |
|
96 // post request |
|
97 RSat::TLocalInfoV6 localInfo; |
|
98 RSat::TLocalInfoV6Pckg localInfoPckg(localInfo); |
|
99 TRequestStatus stat; |
|
100 iSat.NotifyLocalInfoPCmd(stat, localInfoPckg); |
|
101 |
|
102 // Prepare TLV buffer for CompleteL |
|
103 TUint8 pcmdNumber = 1; |
|
104 TTlv localInfoTlv; |
|
105 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInfoLanguage); |
|
106 TPtrC8 tlv(localInfoTlv.End()); |
|
107 |
|
108 |
|
109 // post Complete with KErrGeneral |
|
110 CompleteMockDispatchSatPcmdL(tlv, KErrUnknown); |
|
111 |
|
112 User::WaitForRequest(stat); |
|
113 ASSERT_EQUALS(KErrUnknown, stat.Int()); |
|
114 AssertMockLtsyStatusL(); |
|
115 |
|
116 //------------------------------------------------------------------------- |
|
117 // TEST C: see tests TestProvideLocalInfo0001bL, TestProvideLocalInfo0001cL, ... |
|
118 //------------------------------------------------------------------------- |
|
119 |
|
120 //------------------------------------------------------------------------- |
|
121 // TEST E: Unsolicited completion of RSat::NotifyLocalInfoPCmd |
|
122 // from LTSY. |
|
123 //------------------------------------------------------------------------- |
|
124 |
|
125 // post request |
|
126 TRequestStatus requestStatus; |
|
127 iMockLTSY.NotifyTerminated(requestStatus); |
|
128 |
|
129 // post CompleteL |
|
130 CompleteMockDispatchSatPcmdL(tlv, KErrNone); |
|
131 |
|
132 // prepare data and call |
|
133 // iMockLTSY.ExpectL(MLtsyDispatchSatTerminalRsp::KLtsyDispatchSatTerminalRspApiId, data); |
|
134 RSat::TAdditionalInfo additionalInfo; |
|
135 additionalInfo.Append(RSat::KNoSpecificMeProblem); |
|
136 PrepareTerminalResponseMockDataWithExpL( |
|
137 pcmdNumber, |
|
138 RSat::KProvideLocalInfoLanguage, |
|
139 additionalInfo, |
|
140 RSat::KMeUnableToProcessCmd, |
|
141 KNullDesC8); |
|
142 |
|
143 User::WaitForRequest(requestStatus); |
|
144 AssertMockLtsyStatusL(); |
|
145 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
146 |
|
147 CleanupStack::PopAndDestroy(2, this); // data, this |
|
148 } |
|
149 |
|
150 |
|
151 /** |
|
152 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0002 |
|
153 @SYMPREQ 1780 |
|
154 @SYMComponent telephony_ctsy |
|
155 @SYMTestCaseDesc Test support in CTSY for cancelling of RSat::NotifyLocalInfoPCmd |
|
156 @SYMTestPriority High |
|
157 @SYMTestActions Invokes cancelling of RSat::NotifyLocalInfoPCmd |
|
158 @SYMTestExpectedResults Pass |
|
159 @SYMTestType CT |
|
160 */ |
|
161 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0002L() |
|
162 { |
|
163 OpenEtelServerL(EUseExtendedError); |
|
164 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
165 OpenPhoneL(); |
|
166 OpenSatL(); |
|
167 |
|
168 RBuf8 data; |
|
169 CleanupClosePushL(data); |
|
170 |
|
171 //------------------------------------------------------------------------- |
|
172 // Test cancelling of RSat::NotifyLocalInfoPCmd |
|
173 //------------------------------------------------------------------------- |
|
174 |
|
175 //Prepare data for ExpectL needed by NotifyLocalInfoPCmd |
|
176 //and post that ExpectL |
|
177 PrepareMockLDataWithExpL(KProvideLocalInformation); |
|
178 |
|
179 RSat::TLocalInfoV6 localInfo; |
|
180 RSat::TLocalInfoV6Pckg localInfoPckg(localInfo); |
|
181 TRequestStatus stat; |
|
182 iSat.NotifyLocalInfoPCmd(stat, localInfoPckg); |
|
183 |
|
184 iSat.CancelAsyncRequest(ESatNotifyLocalInfoPCmd); |
|
185 User::WaitForRequest(stat); |
|
186 ASSERT_EQUALS(KErrCancel, stat.Int()); |
|
187 |
|
188 AssertMockLtsyStatusL(); |
|
189 CleanupStack::PopAndDestroy(2, this); // data, this |
|
190 } |
|
191 |
|
192 |
|
193 /** |
|
194 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0004 |
|
195 @SYMPREQ 1780 |
|
196 @SYMComponent telephony_ctsy |
|
197 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RSat::NotifyLocalInfoPCmd |
|
198 @SYMTestPriority High |
|
199 @SYMTestActions Invokes multiple client requests to RSat::NotifyLocalInfoPCmd |
|
200 @SYMTestExpectedResults Pass |
|
201 @SYMTestType CT |
|
202 */ |
|
203 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0004L() |
|
204 { |
|
205 OpenEtelServerL(EUseExtendedError); |
|
206 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
207 OpenPhoneL(); |
|
208 OpenSatL(); |
|
209 |
|
210 RBuf8 data; |
|
211 CleanupClosePushL(data); |
|
212 |
|
213 // Open second client |
|
214 RTelServer telServer2; |
|
215 TInt ret = telServer2.Connect(); |
|
216 ASSERT_EQUALS(KErrNone, ret); |
|
217 CleanupClosePushL(telServer2); |
|
218 |
|
219 RMobilePhone phone2; |
|
220 ret = phone2.Open(telServer2,KMmTsyPhoneName); |
|
221 ASSERT_EQUALS(KErrNone, ret); |
|
222 CleanupClosePushL(phone2); |
|
223 |
|
224 RSat sat2; |
|
225 User::LeaveIfError(sat2.Open(phone2)); |
|
226 CleanupClosePushL(sat2); |
|
227 |
|
228 //------------------------------------------------------------------------- |
|
229 // Test multiple clients requesting RSat::NotifyLocalInfoPCmd |
|
230 //------------------------------------------------------------------------- |
|
231 //Prepare data for ExpectL needed by NotifyLocalInfoPCmd |
|
232 //and post that ExpectL |
|
233 PrepareMockLDataWithExpL(KProvideLocalInformation); |
|
234 |
|
235 // Request from first client |
|
236 RSat::TLocalInfoV6 localInfo; |
|
237 RSat::TLocalInfoV6Pckg localInfoPckg(localInfo); |
|
238 TRequestStatus stat; |
|
239 iSat.NotifyLocalInfoPCmd(stat, localInfoPckg); |
|
240 |
|
241 // Request from second client |
|
242 RSat::TLocalInfoV6 localInfo2; |
|
243 RSat::TLocalInfoV6Pckg localInfoPckg2(localInfo2); |
|
244 TRequestStatus stat2; |
|
245 sat2.NotifyLocalInfoPCmd(stat2, localInfoPckg2); |
|
246 |
|
247 // Prepare TLV buffer for CompleteL |
|
248 TUint8 pcmdNumber = 1; |
|
249 TTlv localInfoTlv; |
|
250 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInfoLanguage); |
|
251 |
|
252 // post Complete with KErrNone |
|
253 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
254 |
|
255 // Wait for first client complete |
|
256 User::WaitForRequest(stat); |
|
257 ASSERT_EQUALS(KErrNone, stat.Int()); |
|
258 ASSERT_EQUALS(RSat::KUICC, localInfo.iDevideId); |
|
259 ASSERT_EQUALS(RSat::KProvideLocalInfoLanguage, localInfo.iInfoType); |
|
260 |
|
261 // Wait for second client complete |
|
262 User::WaitForRequest(stat2); |
|
263 ASSERT_EQUALS(KErrNone, stat2.Int()); |
|
264 ASSERT_EQUALS(RSat::KUICC, localInfo2.iDevideId); |
|
265 ASSERT_EQUALS(RSat::KProvideLocalInfoLanguage, localInfo2.iInfoType); |
|
266 |
|
267 |
|
268 //Now prepare the FIRST terminal response |
|
269 _LIT(KTermRespLangCode,"EN"); //language code |
|
270 TTlv termRespAddInfo; |
|
271 termRespAddInfo.AddTag( KTlvLanguageTag ); |
|
272 TBuf8<2> character; |
|
273 TSatUtility::Copy16to8LE( KTermRespLangCode, character); |
|
274 termRespAddInfo.AddData( character ); |
|
275 const TDesC8& termRespAddInfoData = termRespAddInfo.GetDataWithoutTopLevelTag(); |
|
276 |
|
277 PrepareTerminalResponseMockDataWithExpL( |
|
278 pcmdNumber, |
|
279 RSat::KProvideLocalInfoLanguage, |
|
280 KNullDesC, |
|
281 RSat::KSuccess, |
|
282 termRespAddInfoData); |
|
283 |
|
284 // call the FIRST TerminalRsp |
|
285 RSat::TLocalInfoRspV3 resp; |
|
286 RSat::TLocalInfoRspV3Pckg respPckg(resp); |
|
287 resp.iGeneralResult = RSat::KSuccess; |
|
288 resp.iInfoType = RSat::KProvideLocalInfoLanguage; |
|
289 resp.iAdditionalInfo = KTermRespLangCode; //language code |
|
290 resp.SetPCmdNumber(pcmdNumber); |
|
291 TerminalResponseL(respPckg); |
|
292 |
|
293 // There is an ambiguity: should be there the Terminal Response from the SECOND client |
|
294 // and should such Response has a successful flow? |
|
295 |
|
296 // So, consider that the SECOND cliend doesn't know about the FIRST one, |
|
297 // prepare and... |
|
298 PrepareTerminalResponseMockDataWithExpL( |
|
299 pcmdNumber, |
|
300 RSat::KProvideLocalInfoLanguage, |
|
301 KNullDesC, |
|
302 RSat::KSuccess, |
|
303 termRespAddInfoData); |
|
304 // ...post the SECOND Terminal Response |
|
305 sat2.TerminalRsp(stat, RSat::ELocalInfo, respPckg); |
|
306 User::WaitForRequest(stat); |
|
307 ASSERT_EQUALS(KErrNone, stat.Int()); |
|
308 |
|
309 AssertMockLtsyStatusL(); |
|
310 CleanupStack::PopAndDestroy(5, this); |
|
311 } |
|
312 |
|
313 /** |
|
314 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0001b |
|
315 @SYMPREQ 1780 |
|
316 @SYMComponent telephony_ctsy |
|
317 @SYMTestCaseDesc Expected Sequence 1.1 (PROVIDE LOCAL INFORMATION, Local Info) |
|
318 @SYMTestPriority High |
|
319 @SYMTestActions Invokes RSat::NotifyLocalInfoPCmd |
|
320 @SYMTestExpectedResults Pass |
|
321 @SYMTestType CT |
|
322 */ |
|
323 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0001bL() |
|
324 { |
|
325 OpenEtelServerL(EUseExtendedError); |
|
326 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
327 OpenPhoneL(); |
|
328 OpenSatL(); |
|
329 |
|
330 RBuf8 data; |
|
331 CleanupClosePushL(data); |
|
332 |
|
333 // |
|
334 // Expected Sequence 1.1 See ETSI TS 100 607-4 27.22.4.15.4.2, Expected Sequence 1.1. |
|
335 // (PROVIDE LOCAL INFORMATION, Local Info) |
|
336 // |
|
337 |
|
338 // Prepare TLV buffer for CompleteL |
|
339 TUint8 pcmdNumber = 1; |
|
340 TTlv localInfoTlv; |
|
341 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInfo); |
|
342 |
|
343 // post Complete with KErrNone |
|
344 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
345 |
|
346 // Prepare ExpectL needed by previous complete; |
|
347 iMockLTSY.ExpectL(MLtsyDispatchSatProvideLocationInfo::KLtsyDispatchSatProvideLocationInfoApiId); |
|
348 |
|
349 TRequestStatus reqStatus; |
|
350 iMockLTSY.NotifyTerminated(reqStatus); |
|
351 User::WaitForRequest(reqStatus); |
|
352 ASSERT_TRUE(reqStatus.Int() == KErrNone); |
|
353 |
|
354 // Complete |
|
355 _LIT8(operatorCode,"926"); //code of some operator in Moscow |
|
356 TLocalInformation localInfoPCmdData; |
|
357 localInfoPCmdData.iCellId = KCellId; |
|
358 localInfoPCmdData.iLocationAreaCode = KLocationAreaCode; |
|
359 localInfoPCmdData.iOperatorCode = operatorCode; |
|
360 TDesC8* operatorCodePtr = &localInfoPCmdData.iOperatorCode; |
|
361 TMockLtsyData3<TUint16,TUint16,TDesC8* > locationInfoPCmdDataPack( localInfoPCmdData.iLocationAreaCode, |
|
362 localInfoPCmdData.iCellId, |
|
363 operatorCodePtr); |
|
364 locationInfoPCmdDataPack.SerialiseL(data); |
|
365 iMockLTSY.CompleteL(MLtsyDispatchSatProvideLocationInfo::KLtsyDispatchSatProvideLocationInfoApiId, KErrNone, data); |
|
366 |
|
367 // --- Now prepare the terminal response --- |
|
368 TTlv termRespAddInfo; |
|
369 termRespAddInfo.AddTag( KTlvLocationInformationTag ); |
|
370 termRespAddInfo.AddData( operatorCode ); |
|
371 termRespAddInfo.AddByte( static_cast<TUint8>( KLocationAreaCode >> 8 ) );//msb |
|
372 termRespAddInfo.AddByte( static_cast<TUint8>( KLocationAreaCode));//lsb |
|
373 termRespAddInfo.AddByte( static_cast<TUint8>( KCellId >> 8 ) );//msb |
|
374 termRespAddInfo.AddByte( static_cast<TUint8>( KCellId));//lsb |
|
375 |
|
376 PrepareTerminalResponseMockDataWithExpL( |
|
377 pcmdNumber, |
|
378 RSat::KProvideLocalInfo, |
|
379 KNullDesC, |
|
380 RSat::KSuccess, |
|
381 termRespAddInfo.GetDataWithoutTopLevelTag()); |
|
382 |
|
383 // Terminal response is called from CTSY |
|
384 iMockLTSY.NotifyTerminated(reqStatus); |
|
385 User::WaitForRequest(reqStatus); |
|
386 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
387 |
|
388 AssertMockLtsyStatusL(); |
|
389 CleanupStack::PopAndDestroy(2, this); // data, this |
|
390 } |
|
391 |
|
392 |
|
393 /** |
|
394 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0001c |
|
395 @SYMPREQ 1780 |
|
396 @SYMComponent telephony_ctsy |
|
397 @SYMTestCaseDesc Expected Sequence 1.2 (PROVIDE LOCAL INFORMATION, IMEI of the Terminal) |
|
398 @SYMTestPriority High |
|
399 @SYMTestActions Invokes RSat::NotifyLocalInfoPCmd |
|
400 @SYMTestExpectedResults Pass |
|
401 @SYMTestType CT |
|
402 */ |
|
403 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0001cL() |
|
404 { |
|
405 OpenEtelServerL(EUseExtendedError); |
|
406 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
407 OpenPhoneL(); |
|
408 OpenSatL(); |
|
409 |
|
410 RBuf8 data; |
|
411 CleanupClosePushL(data); |
|
412 |
|
413 // |
|
414 // Expected Sequence 1.1 See ETSI TS 102 384 in subclause 27.22.4.15.4.2, Expected Sequence 1.2. |
|
415 // (PROVIDE LOCAL INFORMATION, IMEI of the Terminal) |
|
416 // |
|
417 |
|
418 // Prepare TLV buffer for CompleteL |
|
419 TUint8 pcmdNumber = 1; |
|
420 TTlv localInfoTlv; |
|
421 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInfoImei); |
|
422 const TDesC8& tlv = localInfoTlv.End(); |
|
423 |
|
424 // post Complete with KErrNone |
|
425 CompleteMockDispatchSatPcmdL(tlv, KErrNone); |
|
426 |
|
427 // prepare Tlv buffer with additional info |
|
428 TTlv termRespAddInfo; |
|
429 termRespAddInfo.AddTag( KTlvImeiTag ); |
|
430 TBuf8<KImeiLength/2> bcdImei; |
|
431 _LIT8 (KDigits, "*12345670"); |
|
432 // Convert IMEI to BCD format |
|
433 TSatUtility::AsciiToBCD( KDigits(), bcdImei ); |
|
434 // Add IMEI code to the terminal response |
|
435 termRespAddInfo.AddData( bcdImei ); |
|
436 |
|
437 PrepareTerminalResponseMockDataWithExpL( |
|
438 pcmdNumber, |
|
439 RSat::KProvideLocalInfoImei, |
|
440 KNullDesC, |
|
441 RSat::KSuccess, |
|
442 termRespAddInfo.GetDataWithoutTopLevelTag()); |
|
443 |
|
444 // Terminal response is called from CTSY |
|
445 TRequestStatus reqStatus; |
|
446 iMockLTSY.NotifyTerminated(reqStatus); |
|
447 User::WaitForRequest(reqStatus); |
|
448 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
449 |
|
450 AssertMockLtsyStatusL(); |
|
451 CleanupStack::PopAndDestroy(2, this); // data, this |
|
452 } |
|
453 |
|
454 |
|
455 /** |
|
456 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0001d |
|
457 @SYMPREQ 1780 |
|
458 @SYMComponent telephony_ctsy |
|
459 @SYMTestCaseDesc Expected Sequence 1.3 (PROVIDE LOCAL INFORMATION, Network Measurement Results) |
|
460 @SYMTestPriority High |
|
461 @SYMTestActions Invokes RSat::NotifyLocalInfoPCmd |
|
462 @SYMTestExpectedResults Pass |
|
463 @SYMTestType CT |
|
464 */ |
|
465 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0001dL() |
|
466 { |
|
467 OpenEtelServerL(EUseExtendedError); |
|
468 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
469 OpenPhoneL(); |
|
470 OpenSatL(); |
|
471 |
|
472 RBuf8 data; |
|
473 CleanupClosePushL(data); |
|
474 // |
|
475 // Expected Sequence 1.3 See ETSI TS 100 607-4 27.22.4.15.4.2, Expected Sequence 1.3. |
|
476 // (PROVIDE LOCAL INFORMATION, Network Measurement Results) |
|
477 // |
|
478 |
|
479 // Prepare TLV buffer for CompleteL |
|
480 TUint8 pcmdNumber = 105; |
|
481 TTlv localInfoTlv; |
|
482 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInformationNmr); |
|
483 // post Complete with KErrNone |
|
484 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
485 |
|
486 // Prepare ExpectL and CompleteL needed by |
|
487 // TInt CSatNotifyLocalInfo::CompleteNotifyL() |
|
488 _LIT8(KNmrResults,"qwerty"); |
|
489 TDesC8* nmr = &const_cast<TDesC8&>(KNmrResults()); |
|
490 _LIT(KBcchList,"ytrewq"); |
|
491 TDesC* bcch = &const_cast<TDesC&>(KBcchList()); |
|
492 TMockLtsyData2<TDesC8*,TDesC*> nmrMockData(nmr,bcch); |
|
493 nmrMockData.SerialiseL(data); |
|
494 iMockLTSY.ExpectL(MLtsyDispatchSatLocalInformationNmr::KLtsyDispatchSatLocalInformationNmrApiId); |
|
495 iMockLTSY.CompleteL(MLtsyDispatchSatLocalInformationNmr::KLtsyDispatchSatLocalInformationNmrApiId, KErrNone, data); |
|
496 |
|
497 //Now prepare and generate CTSY Terminal response |
|
498 TTlv tlvAddInfo; |
|
499 tlvAddInfo.AddTag( KTlvNetworkMeasurementResultsTag ); |
|
500 tlvAddInfo.AddData(KNmrResults); |
|
501 tlvAddInfo.AddTag (KTlvBccdChannelListTag); |
|
502 TUint8 charData[]={30, 71, 65, 200, 101, 29, 199, 16}; |
|
503 |
|
504 for (int i = 0; i < 8; i++) |
|
505 { |
|
506 tlvAddInfo.AddByte( charData[i] ); |
|
507 } |
|
508 |
|
509 PrepareTerminalResponseMockDataWithExpL( |
|
510 pcmdNumber, |
|
511 RSat::KProvideLocalInformationNmr, |
|
512 KNullDesC, |
|
513 RSat::KSuccess, |
|
514 tlvAddInfo.GetDataWithoutTopLevelTag()); |
|
515 |
|
516 // Terminal response is called from CTSY |
|
517 TRequestStatus reqStatus; |
|
518 iMockLTSY.NotifyTerminated(reqStatus); |
|
519 User::WaitForRequest(reqStatus); |
|
520 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
521 |
|
522 AssertMockLtsyStatusL(); |
|
523 CleanupStack::PopAndDestroy(2, this); // data, this |
|
524 } |
|
525 |
|
526 |
|
527 /** |
|
528 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0001e |
|
529 @SYMPREQ 1780 |
|
530 @SYMComponent telephony_ctsy |
|
531 @SYMTestCaseDesc Expected Sequence 1.4 (PROVIDE LOCAL INFORMATION, Date, Time, Time Zone)) |
|
532 @SYMTestPriority High |
|
533 @SYMTestActions Invokes RSat::NotifyLocalInfoPCmd |
|
534 @SYMTestExpectedResults Pass |
|
535 @SYMTestType CT |
|
536 */ |
|
537 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0001eL() |
|
538 { |
|
539 OpenEtelServerL(EUseExtendedError); |
|
540 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
541 OpenPhoneL(); |
|
542 OpenSatL(); |
|
543 |
|
544 RBuf8 data; |
|
545 CleanupClosePushL(data); |
|
546 |
|
547 TRequestStatus reqStatus; |
|
548 TUint8 pcmdNumber = 1; |
|
549 // |
|
550 // See ETSI TS 102 384 in subclause 27.22.4.15.4.2, Expected Sequence 1.4. |
|
551 // (PROVIDE LOCAL INFORMATION, Date, Time, Time Zone)) |
|
552 // |
|
553 |
|
554 // set same Time Zone Parameter |
|
555 iMockLTSY.NotifyTerminated(reqStatus); |
|
556 TUint8 timeZone(123); |
|
557 TMockLtsyData1<TUint8> mockData(timeZone); |
|
558 mockData.SerialiseL(data); |
|
559 iMockLTSY.CompleteL(KMockLtsyDispatchSatTimeZoneChangeIndId, KErrNone, data); |
|
560 |
|
561 // wait for Time Zone setting |
|
562 User::WaitForRequest(reqStatus); |
|
563 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
564 |
|
565 // Prepare TLV buffer for CompleteL |
|
566 TTlv localInfoTlv; |
|
567 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInfoDateTimeTimeZone); |
|
568 // post Complete with KErrNone |
|
569 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
570 |
|
571 // prepare Tlv buffer with additional info |
|
572 TTlv termRespAddInfo; |
|
573 termRespAddInfo.AddTag( KTlvDateTimeAndTimeZoneTag ); |
|
574 RSat::TLocalInfoRspV3 localInfoRspV3; |
|
575 SetDateTimeTimeZone ( localInfoRspV3, timeZone ); |
|
576 |
|
577 for ( int i = 0; i < localInfoRspV3.iAdditionalInfo.Length(); i++ ) |
|
578 { |
|
579 termRespAddInfo.AddByte( static_cast<TUint8>( localInfoRspV3.iAdditionalInfo[i] |
|
580 & 0x00FF ) ); |
|
581 } |
|
582 |
|
583 PrepareTerminalResponseMockDataWithExpL( |
|
584 pcmdNumber, |
|
585 RSat::KProvideLocalInfoDateTimeTimeZone, |
|
586 KNullDesC, |
|
587 RSat::KSuccess, |
|
588 termRespAddInfo.GetDataWithoutTopLevelTag()); |
|
589 |
|
590 // Terminal response is called from CTSY |
|
591 iMockLTSY.NotifyTerminated(reqStatus); |
|
592 User::WaitForRequest(reqStatus); |
|
593 |
|
594 // It's not a defect!!! |
|
595 // We can't prepare correct time, because CTSY get's Universal time. |
|
596 // Time befor sendinq request to CTSY and time in CTSY is different. |
|
597 // That's why we don't check got error |
|
598 |
|
599 CleanupStack::PopAndDestroy(2, this); // data, this |
|
600 } |
|
601 |
|
602 /** |
|
603 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0001f |
|
604 @SYMPREQ 1780 |
|
605 @SYMComponent telephony_ctsy |
|
606 @SYMTestCaseDesc Expected Sequence 1.5 (PROVIDE LOCAL INFORMATION, Language setting) |
|
607 @SYMTestPriority High |
|
608 @SYMTestActions Invokes RSat::NotifyLocalInfoPCmd |
|
609 @SYMTestExpectedResults Pass |
|
610 @SYMTestType CT |
|
611 */ |
|
612 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0001fL() |
|
613 { |
|
614 OpenEtelServerL(EUseExtendedError); |
|
615 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
616 OpenPhoneL(); |
|
617 OpenSatL(); |
|
618 |
|
619 RBuf8 data; |
|
620 CleanupClosePushL(data); |
|
621 |
|
622 // |
|
623 // Expected Sequence 1.5 See ETSI TS 102 384 in subclause 27.22.4.15.4.2, Expected Sequence 1.5. |
|
624 // (PROVIDE LOCAL INFORMATION, Language setting) |
|
625 // |
|
626 |
|
627 //Prepare data for ExpectL needed by NotifyLocalInfoPCmd |
|
628 //and post that ExpectL |
|
629 PrepareMockLDataWithExpL(KProvideLocalInformation); |
|
630 |
|
631 RSat::TLocalInfoV6 localInfo; |
|
632 RSat::TLocalInfoV6Pckg localInfoPckg(localInfo); |
|
633 TRequestStatus stat; |
|
634 iSat.NotifyLocalInfoPCmd(stat, localInfoPckg); |
|
635 |
|
636 // Prepare TLV buffer for CompleteL |
|
637 TUint8 pcmdNumber = 1; |
|
638 TTlv localInfoTlv; |
|
639 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInfoLanguage); |
|
640 |
|
641 // post Complete with KErrNone |
|
642 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
643 |
|
644 User::WaitForRequest(stat); |
|
645 ASSERT_EQUALS(KErrNone, stat.Int()); |
|
646 ASSERT_EQUALS(RSat::KUICC, localInfo.iDevideId); |
|
647 ASSERT_EQUALS(RSat::KProvideLocalInfoLanguage, localInfo.iInfoType); |
|
648 |
|
649 //Now prepare the terminal response |
|
650 _LIT(KTermRespLangCode,"EN"); //language code |
|
651 TTlv termRespAddInfo; |
|
652 termRespAddInfo.AddTag( KTlvLanguageTag ); |
|
653 TBuf8<2> character; |
|
654 TSatUtility::Copy16to8LE( KTermRespLangCode, character); |
|
655 termRespAddInfo.AddData( character ); |
|
656 |
|
657 PrepareTerminalResponseMockDataWithExpL( |
|
658 pcmdNumber, |
|
659 RSat::KProvideLocalInfoLanguage, |
|
660 KNullDesC, |
|
661 RSat::KSuccess, |
|
662 termRespAddInfo.GetDataWithoutTopLevelTag()); |
|
663 |
|
664 |
|
665 // call TerminalRsp |
|
666 RSat::TLocalInfoRspV3 resp; |
|
667 RSat::TLocalInfoRspV3Pckg respPckg(resp); |
|
668 resp.iGeneralResult = RSat::KSuccess; |
|
669 resp.iInfoType = RSat::KProvideLocalInfoLanguage; |
|
670 resp.iAdditionalInfo = KTermRespLangCode; //language code |
|
671 resp.SetPCmdNumber(pcmdNumber); |
|
672 TerminalResponseL(respPckg); |
|
673 |
|
674 AssertMockLtsyStatusL(); |
|
675 CleanupStack::PopAndDestroy(2, this); // data, this |
|
676 } |
|
677 |
|
678 |
|
679 /** |
|
680 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0001g |
|
681 @SYMPREQ 1780 |
|
682 @SYMComponent telephony_ctsy |
|
683 @SYMTestCaseDesc Expected Sequence 1.6 (PROVIDE LOCAL INFORMATION, Timing advance) |
|
684 @SYMTestPriority High |
|
685 @SYMTestActions Invokes RSat::NotifyLocalInfoPCmd |
|
686 @SYMTestExpectedResults Pass |
|
687 @SYMTestType CT |
|
688 */ |
|
689 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0001gL() |
|
690 { |
|
691 OpenEtelServerL(EUseExtendedError); |
|
692 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
693 OpenPhoneL(); |
|
694 OpenSatL(); |
|
695 |
|
696 RBuf8 data; |
|
697 CleanupClosePushL(data); |
|
698 |
|
699 // |
|
700 // Expected Sequence 1.5 See ETSI TS 100 607-4 V8.14.0 in subclause 27.22.4.15.4.2, Expected Sequence 1.6. |
|
701 // ((PROVIDE LOCAL INFORMATION, Timing advance) |
|
702 // |
|
703 |
|
704 // Prepare TLV buffer for CompleteL |
|
705 TUint8 pcmdNumber = 1; |
|
706 TTlv localInfoTlv; |
|
707 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInfoTimingAdv); |
|
708 |
|
709 // post Complete with KErrNone |
|
710 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
711 TBool localInfoIsOngoing = ETrue; |
|
712 TMockLtsyData1<TBool> mockData(localInfoIsOngoing); |
|
713 mockData.SerialiseL(data); |
|
714 iMockLTSY.ExpectL(MLtsyDispatchSatTimingAdvance::KLtsyDispatchSatTimingAdvanceApiId, data); |
|
715 TUint8 timingAdvance(0x11); |
|
716 TUint8 meStatus(0x22); |
|
717 TMockLtsyData2<TUint8, TUint8> mockData2(timingAdvance, meStatus); |
|
718 data.Close(); |
|
719 mockData2.SerialiseL(data); |
|
720 iMockLTSY.CompleteL(MLtsyDispatchSatTimingAdvance::KLtsyDispatchSatTimingAdvanceApiId, KErrNone, data); |
|
721 |
|
722 TTlv termRespAddInfo; |
|
723 termRespAddInfo.AddTag( KTlvTimingAdvanceTag ); |
|
724 termRespAddInfo.AddByte( meStatus ); |
|
725 termRespAddInfo.AddByte( timingAdvance ); |
|
726 |
|
727 PrepareTerminalResponseMockDataWithExpL( |
|
728 pcmdNumber, |
|
729 RSat::KProvideLocalInfoTimingAdv, |
|
730 KNullDesC, |
|
731 RSat::KSuccess, |
|
732 termRespAddInfo.GetDataWithoutTopLevelTag()); |
|
733 |
|
734 // Terminal response is called from CTSY |
|
735 TRequestStatus reqStatus; |
|
736 iMockLTSY.NotifyTerminated(reqStatus); |
|
737 User::WaitForRequest(reqStatus); |
|
738 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
739 |
|
740 AssertMockLtsyStatusL(); |
|
741 CleanupStack::PopAndDestroy(2, this); // data, this |
|
742 } |
|
743 |
|
744 |
|
745 /** |
|
746 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0001h |
|
747 @SYMPREQ 1780 |
|
748 @SYMComponent telephony_ctsy |
|
749 @SYMTestCaseDesc Expected Sequence 1.7 PROVIDE LOCAL INFORMATION, Access Technology |
|
750 @SYMTestPriority High |
|
751 @SYMTestActions Invokes RSat::NotifyLocalInfoPCmd |
|
752 @SYMTestExpectedResults Pass |
|
753 @SYMTestType CT |
|
754 */ |
|
755 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0001hL() |
|
756 { |
|
757 OpenEtelServerL(EUseExtendedError); |
|
758 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
759 OpenPhoneL(); |
|
760 OpenSatL(); |
|
761 |
|
762 RBuf8 data; |
|
763 CleanupClosePushL(data); |
|
764 |
|
765 TRequestStatus reqStatus; |
|
766 // |
|
767 // This Sequence isn't describe in docs. It's used just for coverage |
|
768 // Expected Sequence 1.7 (PROVIDE LOCAL INFORMATION, Access Technology) |
|
769 // The test method is not defined in the present document as it depends on a present NAA. |
|
770 // see ETSI TS 102 384 V6.5.0 |
|
771 |
|
772 // Prepare TLV buffer for CompleteL |
|
773 TUint8 pcmdNumber = 1; |
|
774 TTlv localInfoTlv; |
|
775 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInfoAccTech); |
|
776 |
|
777 // post Complete with KErrNone |
|
778 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
779 TBool localInfoIsOngoing = ETrue; |
|
780 TMockLtsyData1<TBool> mockData(localInfoIsOngoing); |
|
781 mockData.SerialiseL(data); |
|
782 iMockLTSY.ExpectL(MLtsyDispatchSatGetAccessTechnology::KLtsyDispatchSatGetAccessTechnologyApiId, data); |
|
783 |
|
784 // wait for CompleteMockDispatchSatPcmdL |
|
785 iMockLTSY.NotifyTerminated(reqStatus); |
|
786 User::WaitForRequest(reqStatus); |
|
787 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
788 |
|
789 // set up data for CSatNotifyLocalInfo::iCurrentAccTech |
|
790 TUint8 currentAccTech(0xAA); |
|
791 TMockLtsyData1<TUint8> mockData2(currentAccTech); |
|
792 data.Close(); |
|
793 mockData2.SerialiseL(data); |
|
794 iMockLTSY.CompleteL(MLtsyDispatchSatGetAccessTechnology::KLtsyDispatchSatGetAccessTechnologyApiId, KErrNone, data); |
|
795 |
|
796 // Prepare Terminal Response |
|
797 TTlv termRespAddInfo; |
|
798 termRespAddInfo.AddTag( KTlvAccessTechnologyTag ); |
|
799 termRespAddInfo.AddByte( currentAccTech ); |
|
800 PrepareTerminalResponseMockDataWithExpL( |
|
801 pcmdNumber, |
|
802 RSat::KProvideLocalInfoAccTech, |
|
803 KNullDesC, |
|
804 RSat::KSuccess, |
|
805 termRespAddInfo.GetDataWithoutTopLevelTag()); |
|
806 |
|
807 // Terminal response is called from CTSY |
|
808 // so, just wait for it |
|
809 iMockLTSY.NotifyTerminated(reqStatus); |
|
810 User::WaitForRequest(reqStatus); |
|
811 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
812 |
|
813 AssertMockLtsyStatusL(); |
|
814 CleanupStack::PopAndDestroy(2, this); // data, this |
|
815 } |
|
816 |
|
817 |
|
818 /** |
|
819 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0001i |
|
820 @SYMPREQ 1780 |
|
821 @SYMComponent telephony_ctsy |
|
822 @SYMTestCaseDesc Test error flow of Terminal responce |
|
823 @SYMTestPriority High |
|
824 @SYMTestActions Invokes RSat::NotifyLocalInfoPCmd |
|
825 @SYMTestExpectedResults Pass |
|
826 @SYMTestType CT |
|
827 */ |
|
828 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0001iL() |
|
829 { |
|
830 OpenEtelServerL(EUseExtendedError); |
|
831 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
832 OpenPhoneL(); |
|
833 OpenSatL(); |
|
834 |
|
835 RBuf8 data; |
|
836 CleanupClosePushL(data); |
|
837 |
|
838 // |
|
839 // Test error flow of Terminal responce |
|
840 // This test is just for coverage and has NO references in documents |
|
841 // |
|
842 |
|
843 //Prepare data for ExpectL needed by NotifyLocalInfoPCmd |
|
844 //and post that ExpectL |
|
845 PrepareMockLDataWithExpL(KProvideLocalInformation); |
|
846 |
|
847 RSat::TLocalInfoV6 localInfo; |
|
848 RSat::TLocalInfoV6Pckg localInfoPckg(localInfo); |
|
849 TRequestStatus stat; |
|
850 iSat.NotifyLocalInfoPCmd(stat, localInfoPckg); |
|
851 |
|
852 // Prepare TLV buffer for CompleteL |
|
853 TUint8 pcmdNumber = 1; |
|
854 TTlv localInfoTlv; |
|
855 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInfoLanguage); |
|
856 |
|
857 // post Complete with KErrNone |
|
858 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
859 User::WaitForRequest(stat); |
|
860 |
|
861 //PrepareTerminalResponse |
|
862 PrepareTerminalResponseMockDataWithExpL( |
|
863 pcmdNumber, |
|
864 RSat::KProvideLocalInfoLanguage, |
|
865 KNullDesC, |
|
866 RSat::KNoResponseFromUser, |
|
867 KNullDesC8); |
|
868 |
|
869 // call TerminalRsp with some ERROR |
|
870 RSat::TLocalInfoRspV3 resp; |
|
871 RSat::TLocalInfoRspV3Pckg respPckg(resp); |
|
872 resp.iGeneralResult = RSat::KNoResponseFromUser; |
|
873 resp.iInfoType = RSat::KMeProblem; |
|
874 resp.SetPCmdNumber(pcmdNumber); |
|
875 // Call TerminalResponse with expected error = KErrCorrupt |
|
876 TerminalResponseL(respPckg, KErrCorrupt); |
|
877 |
|
878 AssertMockLtsyStatusL(); |
|
879 CleanupStack::PopAndDestroy(2, this); // data, this |
|
880 } |
|
881 |
|
882 |
|
883 /** |
|
884 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0001j |
|
885 @SYMPREQ 1780 |
|
886 @SYMComponent telephony_ctsy |
|
887 @SYMTestCaseDesc test not supported commands (KProvideLocalInfoESN, KProvideLocalInfoIMEISV and KProvideLocalInfoSearchMode) |
|
888 @SYMTestPriority High |
|
889 @SYMTestActions Invokes RSat::NotifyLocalInfoPCmd |
|
890 @SYMTestExpectedResults Pass |
|
891 @SYMTestType CT |
|
892 */ |
|
893 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0001jL() |
|
894 { |
|
895 OpenEtelServerL(EUseExtendedError); |
|
896 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
897 OpenPhoneL(); |
|
898 OpenSatL(); |
|
899 |
|
900 RBuf8 data; |
|
901 CleanupClosePushL(data); |
|
902 |
|
903 TRequestStatus reqStatus; |
|
904 |
|
905 // |
|
906 //Test not supported commands |
|
907 // |
|
908 |
|
909 // --- KProvideLocalInfoESN --- |
|
910 TUint8 pcmdNumber = 1; |
|
911 TTlv localInfoTlv; |
|
912 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInfoESN); |
|
913 |
|
914 // post Complete with KErrNone |
|
915 CompleteMockDispatchSatPcmdL(localInfoTlv.End(), KErrNone); |
|
916 |
|
917 // Prepare Terminal Response |
|
918 PrepareTerminalResponseMockDataWithExpL( |
|
919 pcmdNumber, |
|
920 RSat::KProvideLocalInfoESN, |
|
921 KNullDesC, |
|
922 RSat::KCmdBeyondMeCapabilities, |
|
923 KNullDesC8); |
|
924 |
|
925 // Terminal response is called from CTSY |
|
926 // so, just wait for it |
|
927 iMockLTSY.NotifyTerminated(reqStatus); |
|
928 User::WaitForRequest(reqStatus); |
|
929 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
930 |
|
931 |
|
932 // --- KProvideLocalInfoIMEISV --- |
|
933 TTlv localInfoTlv2; |
|
934 PrepareTlv(localInfoTlv2, pcmdNumber, RSat::KProvideLocalInfoIMEISV); |
|
935 |
|
936 // post Complete with KErrNone |
|
937 CompleteMockDispatchSatPcmdL(localInfoTlv2.End(), KErrNone); |
|
938 |
|
939 // Prepare Terminal Response |
|
940 PrepareTerminalResponseMockDataWithExpL( |
|
941 pcmdNumber, |
|
942 RSat::KProvideLocalInfoIMEISV, |
|
943 KNullDesC, |
|
944 RSat::KCmdTypeNotUnderstood, |
|
945 KNullDesC8); |
|
946 |
|
947 // Terminal response is called from CTSY |
|
948 // so, just wait for it |
|
949 iMockLTSY.NotifyTerminated(reqStatus); |
|
950 User::WaitForRequest(reqStatus); |
|
951 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
952 |
|
953 |
|
954 // --- KProvideLocalInfoSearchMode --- |
|
955 TTlv localInfoTlv3; |
|
956 PrepareTlv(localInfoTlv3, pcmdNumber, RSat::KProvideLocalInfoSearchMode); |
|
957 |
|
958 // post Complete with KErrNone |
|
959 CompleteMockDispatchSatPcmdL(localInfoTlv3.End(), KErrNone); |
|
960 |
|
961 // Prepare Terminal Response |
|
962 PrepareTerminalResponseMockDataWithExpL( |
|
963 pcmdNumber, |
|
964 RSat::KProvideLocalInfoSearchMode, |
|
965 KNullDesC, |
|
966 RSat::KCmdTypeNotUnderstood, |
|
967 KNullDesC8); |
|
968 |
|
969 // Terminal response is called from CTSY |
|
970 // so, just wait for it |
|
971 iMockLTSY.NotifyTerminated(reqStatus); |
|
972 User::WaitForRequest(reqStatus); |
|
973 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
974 |
|
975 AssertMockLtsyStatusL(); |
|
976 CleanupStack::PopAndDestroy(2, this); // data, this |
|
977 } |
|
978 |
|
979 |
|
980 /** |
|
981 @SYMTestCaseID BA-CSAT-PLI-SNLIPC-0001k |
|
982 @SYMPREQ 1780 |
|
983 @SYMComponent telephony_ctsy |
|
984 @SYMTestCaseDesc Just for coverage increasing. Test zeroed IMEI |
|
985 @SYMTestPriority High |
|
986 @SYMTestActions Invokes RSat::NotifyLocalInfoPCmd |
|
987 @SYMTestExpectedResults Pass |
|
988 @SYMTestType CT |
|
989 */ |
|
990 void CCSatProvideLocalInfoFU::TestNotifyLocalInfoPCmd0001kL() |
|
991 { |
|
992 OpenEtelServerL(EUseExtendedError); |
|
993 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
994 OpenPhoneL(); |
|
995 |
|
996 RBuf8 data; |
|
997 CleanupClosePushL(data); |
|
998 |
|
999 // Open Sat with NULL-Length IMEI |
|
1000 OpenSatWithZeroImeiL(); |
|
1001 |
|
1002 // |
|
1003 //Test (PROVIDE LOCAL INFORMATION, IMEI of the Terminal) with IMEI of NULL-Length |
|
1004 // |
|
1005 TUint8 pcmdNumber = 1; |
|
1006 TTlv localInfoTlv; |
|
1007 PrepareTlv(localInfoTlv, pcmdNumber, RSat::KProvideLocalInfoImei); |
|
1008 const TDesC8& tlv = localInfoTlv.End(); |
|
1009 |
|
1010 // post Complete with KErrNone |
|
1011 CompleteMockDispatchSatPcmdL(tlv, KErrNone); |
|
1012 |
|
1013 TBuf<RSat::KAdditionalInfoMaxSize> additionalInfo; |
|
1014 additionalInfo.Append(KNoSpecificCauseCanBeGiven ); |
|
1015 |
|
1016 PrepareTerminalResponseMockDataWithExpL( |
|
1017 pcmdNumber, |
|
1018 RSat::KProvideLocalInfoImei, |
|
1019 additionalInfo, |
|
1020 RSat::KMeUnableToProcessCmd, |
|
1021 KNullDesC8); |
|
1022 |
|
1023 // Terminal response is called from CTSY |
|
1024 TRequestStatus reqStatus; |
|
1025 iMockLTSY.NotifyTerminated(reqStatus); |
|
1026 User::WaitForRequest(reqStatus); |
|
1027 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
1028 |
|
1029 AssertMockLtsyStatusL(); |
|
1030 CleanupStack::PopAndDestroy(2, this); // data, this |
|
1031 } |
|
1032 |
|
1033 |
|
1034 //---------------------------------------------------------------------------------------------------------- |
|
1035 // Utility functions |
|
1036 //---------------------------------------------------------------------------------------------------------- |
|
1037 /** |
|
1038 * Prepare data for ExpectL() for NotifyLocalInfoPCmd() and post ExpectL. |
|
1039 * @param aPCmdNumber - command number |
|
1040 */ |
|
1041 void CCSatProvideLocalInfoFU::PrepareMockLDataWithExpL( TUint8 aPCmdNumber ) |
|
1042 { |
|
1043 TPckg<TUint8> pcmdCodePckg(aPCmdNumber); |
|
1044 iMockLTSY.ExpectL(MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId, pcmdCodePckg); |
|
1045 } |
|
1046 |
|
1047 /** |
|
1048 * prepare tlv buffer for PROVIDE LOCAL INFO proactive command |
|
1049 * @param aTlv - tlv buffer to prepare |
|
1050 * @param aPCmdNumber - command number |
|
1051 * @param aLocalInfoQualifier - type of command |
|
1052 */ |
|
1053 void CCSatProvideLocalInfoFU::PrepareTlv(TTlv& aTlv, TUint8 aPCmdNumber, TUint8 aLocalInfoQualifier) |
|
1054 { |
|
1055 aTlv.Begin(KBerTlvProactiveSimCommandTag); |
|
1056 aTlv.AddTag(KTlvCommandDetailsTag); |
|
1057 aTlv.AddByte(aPCmdNumber);//ETLV_CommandNumber |
|
1058 aTlv.AddByte(KProvideLocalInformation); //ETLV_TypeOfCommand |
|
1059 aTlv.AddByte(aLocalInfoQualifier); //ETLV_CommandQualifier |
|
1060 aTlv.AddTag(KTlvDeviceIdentityTag); |
|
1061 aTlv.AddByte(KSim); //ETLV_SourceDeviceIdentity |
|
1062 aTlv.AddByte(KMe); |
|
1063 } |
|
1064 |
|
1065 /** |
|
1066 * prepare mock for processing of proactive command |
|
1067 * @param aCompleteTlv - tlv buffer to send |
|
1068 * @param aError - result for request completion |
|
1069 */ |
|
1070 void CCSatProvideLocalInfoFU::CompleteMockDispatchSatPcmdL( TPtrC8 aCompleteTlv, TInt aError ) |
|
1071 { |
|
1072 RBuf8 data; |
|
1073 CleanupClosePushL(data); |
|
1074 |
|
1075 TDesC8* tlvPtr = &aCompleteTlv; |
|
1076 TMockLtsyData1<TDesC8*> dspTxtDscPack(tlvPtr); |
|
1077 dspTxtDscPack.SerialiseL(data); |
|
1078 iMockLTSY.CompleteL(KMockLtsyDispatchSatPcmdIndId, aError, data, 10); |
|
1079 |
|
1080 CleanupStack::PopAndDestroy(&data); |
|
1081 } |
|
1082 |
|
1083 /** |
|
1084 * prepare data and call iMockLTSY.ExpectL(MLtsyDispatchSatTerminalRsp::KLtsyDispatchSatTerminalRspApiId, data); |
|
1085 * @param aPCmdNumber - command number |
|
1086 * @param aCommandQualifier - type of PROVIDE LOCAL INFO - command |
|
1087 * @param aGeneralResultAddInfo - additional info for complete |
|
1088 * @param aGeneralResult - for request completion |
|
1089 * @param aAdditionalInfoTlv - tlv buffer |
|
1090 */ |
|
1091 void CCSatProvideLocalInfoFU::PrepareTerminalResponseMockDataWithExpL( |
|
1092 TUint8 aPCmdNumber, |
|
1093 TUint8 aCommandQualifier, |
|
1094 const TDesC& aGeneralResultAddInfo, |
|
1095 RSat::TPCmdResult aGeneralResult, |
|
1096 const TDesC8& aAdditionalInfoTlv) |
|
1097 { |
|
1098 RBuf8 data; |
|
1099 CleanupClosePushL(data); |
|
1100 |
|
1101 RBuf8 terminalRsp; |
|
1102 CleanupClosePushL(terminalRsp); |
|
1103 terminalRsp.CreateL(KTlvMaxSize); |
|
1104 |
|
1105 TTlv tlv; |
|
1106 tlv.AddTag(KTlvCommandDetailsTag); |
|
1107 tlv.AddByte(aPCmdNumber);//ETLV_CommandNumber |
|
1108 tlv.AddByte(KProvideLocalInformation); //ETLV_TypeOfCommand |
|
1109 tlv.AddByte(aCommandQualifier); //ETLV_CommandQualifier |
|
1110 |
|
1111 tlv.AddTag(KTlvDeviceIdentityTag); |
|
1112 tlv.AddByte(KMe); |
|
1113 tlv.AddByte(KSim); |
|
1114 |
|
1115 tlv.AddTag(KTlvResultTag); |
|
1116 tlv.AddByte(aGeneralResult); |
|
1117 TUint genResAddInfoLength = aGeneralResultAddInfo.Length(); |
|
1118 for (TUint i = 0; i < genResAddInfoLength; i++) |
|
1119 { |
|
1120 tlv.AddByte( static_cast< TUint8 >(aGeneralResultAddInfo[i]) ); |
|
1121 } |
|
1122 |
|
1123 terminalRsp.Zero(); |
|
1124 terminalRsp.Append(tlv.GetDataWithoutTopLevelTag()); |
|
1125 terminalRsp.Append(aAdditionalInfoTlv); |
|
1126 |
|
1127 TDesC8* terminalRspPtr = &terminalRsp; |
|
1128 |
|
1129 TMockLtsyData1<TDesC8*> termRespData(terminalRspPtr); |
|
1130 termRespData.SerialiseL(data); |
|
1131 |
|
1132 iMockLTSY.ExpectL(MLtsyDispatchSatTerminalRsp::KLtsyDispatchSatTerminalRspApiId, data); |
|
1133 |
|
1134 CleanupStack::PopAndDestroy(&terminalRsp); |
|
1135 CleanupStack::PopAndDestroy(&data); |
|
1136 } |
|
1137 |
|
1138 /** |
|
1139 * prepare data and call iSat.TerminalRsp(reqStatus, aRSatTypeOfCommand, aRspPckg); |
|
1140 * @param aRspPckg - data for response (RSat::TLocalInfoRspV3Pckg) |
|
1141 * @param aExpectedError - error, which is expected from CTSY |
|
1142 */ |
|
1143 void CCSatProvideLocalInfoFU::TerminalResponseL(const TDesC8& aRspPckg, TInt aExpectedError) |
|
1144 { |
|
1145 TRequestStatus reqStatus; |
|
1146 iSat.TerminalRsp(reqStatus, RSat::ELocalInfo, aRspPckg); |
|
1147 User::WaitForRequest(reqStatus); |
|
1148 ASSERT_EQUALS(aExpectedError, reqStatus.Int()); |
|
1149 } |
|
1150 |
|
1151 |
|
1152 void CCSatProvideLocalInfoFU::SetDateTimeTimeZone ( RSat::TLocalInfoRspV3& aLocalInfoRspV3, TUint8 aTimeZone) |
|
1153 { |
|
1154 TTime time; |
|
1155 TLocale locale; |
|
1156 TDateTime dateTime; |
|
1157 // Get Universal time |
|
1158 time.UniversalTime(); |
|
1159 // Get Universal time offset ( Time zone in seconds ) |
|
1160 TTimeIntervalSeconds universalTimeOffset( |
|
1161 locale.UniversalTimeOffset() ); |
|
1162 // Add locale's universal time offset to universal time |
|
1163 // to get the local time |
|
1164 time += universalTimeOffset; |
|
1165 // Converts a TTime object into a TDateTime object |
|
1166 dateTime = time.DateTime(); |
|
1167 // Get and conver year |
|
1168 TUint8 temp( TSatUtility::ConvertToSemiOctet( |
|
1169 dateTime.Year() ) ); |
|
1170 // Append year to additional info |
|
1171 aLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
1172 // Convert month |
|
1173 // Offset from zero. So adding one. |
|
1174 temp = TSatUtility::ConvertToSemiOctet( |
|
1175 dateTime.Month() + 1 ); |
|
1176 // Append month value to the additional info |
|
1177 aLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
1178 // Convert day to the semi-octec presentation |
|
1179 // The day.Offset from zero, so add one before displaying |
|
1180 // the day number. |
|
1181 temp = TSatUtility::ConvertToSemiOctet( |
|
1182 dateTime.Day() + 1 ); |
|
1183 // Append the day value to the additional info |
|
1184 aLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
1185 // Conver current time to the semi-octec presentation. |
|
1186 // First hour |
|
1187 temp = TSatUtility::ConvertToSemiOctet( |
|
1188 dateTime.Hour() ); |
|
1189 // Append the hour value to the additional info |
|
1190 aLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
1191 // Minute value |
|
1192 temp = TSatUtility::ConvertToSemiOctet( |
|
1193 dateTime.Minute() ); |
|
1194 // Append the minute value to the additional info |
|
1195 aLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
1196 // Seconds |
|
1197 temp = TSatUtility::ConvertToSemiOctet( |
|
1198 dateTime.Second() ); |
|
1199 // Append the seconds value to the additional info |
|
1200 aLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
1201 |
|
1202 // Append time zone |
|
1203 aLocalInfoRspV3.iAdditionalInfo.Append( aTimeZone ); |
|
1204 // Set generall result as Success |
|
1205 aLocalInfoRspV3.iGeneralResult = RSat::KSuccess; |
|
1206 } |
|
1207 |
|
1208 /** |
|
1209 * Opens Sat with INEI of NULL-Length |
|
1210 */ |
|
1211 void CCSatProvideLocalInfoFU::OpenSatWithZeroImeiL() |
|
1212 { |
|
1213 TRequestStatus reqStatus; |
|
1214 |
|
1215 RBuf8 data; |
|
1216 CleanupClosePushL(data); |
|
1217 |
|
1218 |
|
1219 iMockLTSY.ExpectL(MLtsyDispatchSatGetSmsControlActivated::KLtsyDispatchSatGetSmsControlActivatedApiId); |
|
1220 |
|
1221 TBool smsMoControlActivated = KSmsMoControlEnabled; |
|
1222 TMockLtsyData1<TBool> comLtsyData(smsMoControlActivated); |
|
1223 comLtsyData.SerialiseL(data); |
|
1224 iMockLTSY.CompleteL(MLtsyDispatchSatGetSmsControlActivated::KLtsyDispatchSatGetSmsControlActivatedApiId, KErrNone, data, KDefaultDelay); |
|
1225 |
|
1226 TUint8 pcmdCode = KPollInterval; |
|
1227 TMockLtsyData1<TUint8> expLtsyData(pcmdCode); |
|
1228 data.Close(); |
|
1229 expLtsyData.SerialiseL(data); |
|
1230 iMockLTSY.ExpectL(MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId, data ); |
|
1231 |
|
1232 pcmdCode = KPollingOff; |
|
1233 data.Close(); |
|
1234 expLtsyData.SerialiseL(data); |
|
1235 iMockLTSY.ExpectL(MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId, data ); |
|
1236 |
|
1237 pcmdCode = KMoreTime; |
|
1238 data.Close(); |
|
1239 expLtsyData.SerialiseL(data); |
|
1240 iMockLTSY.ExpectL(MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId, data ); |
|
1241 |
|
1242 pcmdCode = KTimerManagement; |
|
1243 data.Close(); |
|
1244 expLtsyData.SerialiseL(data); |
|
1245 iMockLTSY.ExpectL(MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId, data ); |
|
1246 |
|
1247 iMockLTSY.ExpectL(MLtsyDispatchPhoneGetPhoneId::KLtsyDispatchPhoneGetPhoneIdApiId); |
|
1248 |
|
1249 iMockLTSY.ExpectL(MLtsyDispatchSatGetDefaultBearerCapability::KLtsyDispatchSatGetDefaultBearerCapabilityApiId); |
|
1250 |
|
1251 TBuf8<KMaxLengthDefaultBearerData> bearerCapabilities(_L8("TEST BEARER!")); |
|
1252 TDesC8* bearerCapabilitiesPtr = &bearerCapabilities; |
|
1253 TMockLtsyData1<TDesC8*> bearerCapabilitiesData(bearerCapabilitiesPtr); |
|
1254 data.Close(); |
|
1255 bearerCapabilitiesData.SerialiseL(data); |
|
1256 iMockLTSY.CompleteL(MLtsyDispatchSatGetDefaultBearerCapability::KLtsyDispatchSatGetDefaultBearerCapabilityApiId, KErrNone, data, KDefaultDelay); |
|
1257 |
|
1258 iMockLTSY.ExpectL(MLtsyDispatchSatGetUssdControlSupported::KLtsyDispatchSatGetUssdControlSupportedApiId); |
|
1259 |
|
1260 TBool ussdSupported = KUssdEnabled; |
|
1261 TMockLtsyData1<TBool> ussdSupportedData(ussdSupported); |
|
1262 data.Close(); |
|
1263 ussdSupportedData.SerialiseL(data); |
|
1264 iMockLTSY.CompleteL(MLtsyDispatchSatGetUssdControlSupported::KLtsyDispatchSatGetUssdControlSupportedApiId, KErrNone, data, KDefaultDelay); |
|
1265 iMockLTSY.CompleteL(KMockLtsyDispatchSatUssdControlSupportedChangeIndId, KErrNone, data, KDefaultDelay); //do a future indicator completion as well as this could happen at some point |
|
1266 |
|
1267 iMockLTSY.ExpectL(MLtsyDispatchSatReady::KLtsyDispatchSatReadyApiId); |
|
1268 iMockLTSY.CompleteL(MLtsyDispatchSatReady::KLtsyDispatchSatReadyApiId,KErrNone, KDefaultDelay); |
|
1269 |
|
1270 iMockLTSY.ExpectL(MLtsyDispatchSatGetSmsPpDownloadSupported::KLtsyDispatchSatGetSmsPpDownloadSupportedApiId); |
|
1271 |
|
1272 TBool smsPpDdlSupported = KSmsPpDownloadEnabled; |
|
1273 TMockLtsyData1<TBool> smsPpData(smsPpDdlSupported); |
|
1274 data.Close(); |
|
1275 smsPpData.SerialiseL(data); |
|
1276 iMockLTSY.CompleteL(MLtsyDispatchSatGetSmsPpDownloadSupported::KLtsyDispatchSatGetSmsPpDownloadSupportedApiId, KErrNone, data, KDefaultDelay); |
|
1277 |
|
1278 User::LeaveIfError(iSat.Open(iPhone)); |
|
1279 |
|
1280 iMockLTSY.NotifyTerminated(reqStatus); |
|
1281 User::WaitForRequest(reqStatus); |
|
1282 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
1283 |
|
1284 CleanupStack::PopAndDestroy(1); //data |
|
1285 } |
|
1286 |
|
1287 |