|
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 SendSMS in the SAT. |
|
20 */ |
|
21 |
|
22 #include <etel.h> |
|
23 #include <etelmm.h> |
|
24 |
|
25 #include <satcs.h> |
|
26 #include <ctsy/ltsy/sat_defs.h> |
|
27 |
|
28 #include <test/tmockltsydata.h> |
|
29 #include <test/mockltsyindicatorids.h> |
|
30 #include <ctsy/ltsy/mltsydispatchsatinterface.h> |
|
31 //#include "csatnotificationstsy.h" |
|
32 #include "ccsatsendsmsfu.h" |
|
33 |
|
34 const TUint8 KTestPCmdNumber = 1; |
|
35 _LIT8(KDialingNumberString8,"112233445566778"); |
|
36 _LIT16(KDialingNumberString16,"112233445566778"); |
|
37 |
|
38 |
|
39 CTestSuite* CCSatSendSMSFU::CreateSuiteL(const TDesC& aName) |
|
40 { |
|
41 SUB_SUITE; |
|
42 |
|
43 ADD_TEST_STEP_ISO_CPP(CCSatSendSMSFU, TestNotifySendSmPCmd0001L); |
|
44 ADD_TEST_STEP_ISO_CPP(CCSatSendSMSFU, TestNotifySendSmPCmd0002L); |
|
45 ADD_TEST_STEP_ISO_CPP(CCSatSendSMSFU, TestNotifySendSmPCmd0004L); |
|
46 |
|
47 END_SUITE; |
|
48 } |
|
49 |
|
50 // |
|
51 // Actual test cases |
|
52 // |
|
53 |
|
54 /** |
|
55 @SYMTestCaseID BA-CSAT-SSMS-SNSSMPC-0001 |
|
56 @SYMPREQ 1780 |
|
57 @SYMComponent telephony_csat |
|
58 @SYMTestCaseDesc Test support in CSAT for RSat::NotifySendSmPCmd |
|
59 @SYMTestPriority High |
|
60 @SYMTestActions Invokes RSat::NotifySendSmPCmd |
|
61 @SYMTestExpectedResults Pass |
|
62 @SYMTestType CT |
|
63 */ |
|
64 void CCSatSendSMSFU::TestNotifySendSmPCmd0001L() |
|
65 { |
|
66 |
|
67 OpenEtelServerL(EUseExtendedError); |
|
68 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
69 OpenPhoneL(); |
|
70 OpenSatL(); |
|
71 |
|
72 //------------------------------------------------------------------------- |
|
73 // TEST C: Successful completion request of RSat::NotifySendSmPCmd |
|
74 //------------------------------------------------------------------------- |
|
75 // Run some of test sequences listed in 3GPP TS 31.124 clause 27.22.4.10 "SEND SHORT MESSAGE" |
|
76 DoPositiveNotifySendSmPCmdTestL(ETestSequence14); |
|
77 DoPositiveNotifySendSmPCmdTestL(ETestSequence15); |
|
78 DoPositiveNotifySendSmPCmdTestL(ETestSequence16); |
|
79 DoPositiveNotifySendSmPCmdTestL(ETestSequence17); |
|
80 DoPositiveNotifySendSmPCmdTestL(ETestSequence18); |
|
81 DoPositiveNotifySendSmPCmdTestL(ETestSequence31A); |
|
82 DoPositiveNotifySendSmPCmdTestL(ETestSequence31B); |
|
83 DoPositiveNotifySendSmPCmdTestL(ETestSequence32A); |
|
84 DoPositiveNotifySendSmPCmdTestL(ETestSequence32B); |
|
85 |
|
86 //------------------------------------------------------------------------- |
|
87 // TEST E: Unsolicited completion of RSat::NotifySendSmPCmd |
|
88 // from LTSY. |
|
89 //------------------------------------------------------------------------- |
|
90 |
|
91 TRequestStatus mockLtsyStatus; |
|
92 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
93 |
|
94 // Create unsolicted "SEND SHORT MESSAGE" |
|
95 TTpdu tpdu; |
|
96 MockCompleteSendSmPCmdL(tpdu,ETestUnsolictedCompletion); |
|
97 |
|
98 // Prime Mock for forthcoming "TERMINAL RESPONSE" that is invoked internally by SAT TSY |
|
99 MockPrimeSendSmTerminalResponseL(ETestUnsolictedCompletion); |
|
100 |
|
101 User::WaitForRequest(mockLtsyStatus); |
|
102 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
103 AssertMockLtsyStatusL(); |
|
104 |
|
105 //------------------------------------------------------------------------- |
|
106 // TEST F: Coverage test(s) for RSat::NotifySendSmPCmd |
|
107 //------------------------------------------------------------------------- |
|
108 DoPositiveNotifySendSmPCmdTestL(ETestMissingAddressType); |
|
109 DoPositiveNotifySendSmPCmdTestL(ETestMissingDiallingNumber); |
|
110 DoPositiveNotifySendSmPCmdTestL(ETestSmsCommand); |
|
111 DoPositiveNotifySendSmPCmdTestL(ETestRelativeVPF); |
|
112 DoPositiveNotifySendSmPCmdTestL(ETestEnchancedVPF); |
|
113 DoPositiveNotifySendSmPCmdTestL(ETestAbsoluteVPF); |
|
114 DoPositiveNotifySendSmPCmdTestL(ETestRelativeVPFPacked); |
|
115 DoPositiveNotifySendSmPCmdTestL(ETestEnchancedVPFPacked); |
|
116 |
|
117 DoNegativeNotifySendSmPCmdTestL(ETestTooBigSmsCommand); |
|
118 DoNegativeNotifySendSmPCmdTestL(ETestTooBigSmsSubmit8bit); |
|
119 DoNegativeNotifySendSmPCmdTestL(ETestTooBigSmsSubmit7bit); |
|
120 DoNegativeNotifySendSmPCmdTestL(ETestTooBigSmsSubmit8bitPacked); |
|
121 DoNegativeNotifySendSmPCmdTestL(ETestTooBigSmsSubmit7bitPacked); |
|
122 DoNegativeNotifySendSmPCmdTestL(ETestMissingSmsTpdu); |
|
123 |
|
124 DoTestTerminalResponseL(); |
|
125 |
|
126 DoPositiveNotifySendSmPCmdTestL(ETestAbsoluteVPFPacked); |
|
127 |
|
128 //------------------------------------------------------------------------- |
|
129 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
130 //------------------------------------------------------------------------- |
|
131 |
|
132 tpdu.Zero(); |
|
133 MockPrimeSendSmPCmdL(tpdu,ETestSequence11,KErrUnknown); |
|
134 |
|
135 TRequestStatus reqStatus; |
|
136 |
|
137 RSat::TSendSmV1 sendSm; |
|
138 RSat::TSendSmV1Pckg sendSmPckg(sendSm); |
|
139 iSat.NotifySendSmPCmd(reqStatus,sendSmPckg); |
|
140 User::WaitForRequest(reqStatus); |
|
141 ASSERT_EQUALS(KErrUnknown, reqStatus.Int()); |
|
142 |
|
143 AssertMockLtsyStatusL(); |
|
144 |
|
145 CleanupStack::PopAndDestroy(this); |
|
146 |
|
147 } |
|
148 |
|
149 |
|
150 /** |
|
151 @SYMTestCaseID BA-CSAT-SSMS-SNSSMPC-0002 |
|
152 @SYMPREQ 1780 |
|
153 @SYMComponent telephony_csat |
|
154 @SYMTestCaseDesc Test support in CSAT for cancelling of RSat::NotifySendSmPCmd |
|
155 @SYMTestPriority High |
|
156 @SYMTestActions Invokes cancelling of RSat::NotifySendSmPCmd |
|
157 @SYMTestExpectedResults Pass |
|
158 @SYMTestType CT |
|
159 */ |
|
160 void CCSatSendSMSFU::TestNotifySendSmPCmd0002L() |
|
161 { |
|
162 |
|
163 OpenEtelServerL(EUseExtendedError); |
|
164 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
165 OpenPhoneL(); |
|
166 OpenSatL(); |
|
167 |
|
168 // tell Mock about forthcoming RSat::NotifySendSmPCmd |
|
169 const TUint8 KPcmdCode = KSendShortMessage; |
|
170 const TPckgC<TUint8> KPcmdCodePckg(KPcmdCode); |
|
171 |
|
172 iMockLTSY.ExpectL(MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId,KPcmdCodePckg); |
|
173 |
|
174 //------------------------------------------------------------------------- |
|
175 // Test cancelling of RSat::NotifySendSmPCmd |
|
176 //------------------------------------------------------------------------- |
|
177 |
|
178 TRequestStatus reqStatus; |
|
179 |
|
180 RSat::TSendSmV1 sendSm; |
|
181 RSat::TSendSmV1Pckg sendSmPckg(sendSm); |
|
182 iSat.NotifySendSmPCmd(reqStatus,sendSmPckg); |
|
183 iSat.CancelAsyncRequest(ESatNotifySendSmPCmd); |
|
184 ASSERT_EQUALS(KErrCancel, reqStatus.Int()); |
|
185 |
|
186 AssertMockLtsyStatusL(); |
|
187 |
|
188 CleanupStack::PopAndDestroy(this); |
|
189 |
|
190 } |
|
191 |
|
192 /** |
|
193 @SYMTestCaseID BA-CSAT-SSMS-SNSSMPC-0004 |
|
194 @SYMPREQ 1780 |
|
195 @SYMComponent telephony_csat |
|
196 @SYMTestCaseDesc Test support in CSAT for multiple client requests to RSat::NotifySendSmPCmd |
|
197 @SYMTestPriority High |
|
198 @SYMTestActions Invokes multiple client requests to RSat::NotifySendSmPCmd |
|
199 @SYMTestExpectedResults Pass |
|
200 @SYMTestType CT |
|
201 */ |
|
202 void CCSatSendSMSFU::TestNotifySendSmPCmd0004L() |
|
203 { |
|
204 // Note: Most likely this test should be fixed. |
|
205 // Currently *all simultenious* RSat::NotifyXXXXPCmd() requests complete |
|
206 // with KErrNone when corresponding proactive command arrives succesfully. |
|
207 // That's the problem because once a RSat client gets a proactive command |
|
208 // it should reply with appropriate "TERMINAL RESPONSE" after processing it. |
|
209 // So if there are *two or more* independant clients listening for the same |
|
210 // proactive command then *two or more* "TERMINAL RESPONSE"s for that command |
|
211 // are likely. Such behaviour seems to be erroneous because once a SIM application |
|
212 // has issued a proactive command it would expect a *single* "TERMINAL RESPONSE" |
|
213 // in reply but not two or more. |
|
214 |
|
215 OpenEtelServerL(EUseExtendedError); |
|
216 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
217 OpenPhoneL(); |
|
218 OpenSatL(); |
|
219 |
|
220 // Open second client |
|
221 RTelServer telServer2; |
|
222 TInt ret = telServer2.Connect(); |
|
223 ASSERT_EQUALS(KErrNone, ret); |
|
224 CleanupClosePushL(telServer2); |
|
225 |
|
226 RMobilePhone phone2; |
|
227 ret = phone2.Open(telServer2,KMmTsyPhoneName); |
|
228 ASSERT_EQUALS(KErrNone, ret); |
|
229 CleanupClosePushL(phone2); |
|
230 |
|
231 RSat sat2; |
|
232 ret = sat2.Open(phone2); |
|
233 ASSERT_EQUALS(KErrNone, ret); |
|
234 CleanupClosePushL(sat2); |
|
235 |
|
236 //------------------------------------------------------------------------- |
|
237 // Test A: Test multiple clients requesting RSat::NotifySendSmPCmd |
|
238 //------------------------------------------------------------------------- |
|
239 |
|
240 // Prime Mock with "SEND SHORT MESSAGE" proactive command |
|
241 TTpdu tpdu; |
|
242 MockPrimeSendSmPCmdL(tpdu, ETestSequence11); |
|
243 |
|
244 // Invoke 1-st client RSat::NotifySendSmPCmd() |
|
245 TRequestStatus reqStatus1; |
|
246 |
|
247 RSat::TSendSmV1 sendSm1; |
|
248 RSat::TSendSmV1Pckg sendSmPckg1(sendSm1); |
|
249 iSat.NotifySendSmPCmd(reqStatus1,sendSmPckg1); |
|
250 |
|
251 // Invoke 2-nd client RSat::NotifySendSmPCmd() |
|
252 TRequestStatus reqStatus2; |
|
253 RSat::TSendSmV1 sendSm2; |
|
254 RSat::TSendSmV1Pckg sendSmPckg2(sendSm2); |
|
255 sat2.NotifySendSmPCmd(reqStatus2,sendSmPckg2); |
|
256 |
|
257 User::WaitForRequest(reqStatus1); |
|
258 User::WaitForRequest(reqStatus2); |
|
259 |
|
260 // Check both results |
|
261 ASSERT_EQUALS(KErrNone, reqStatus1.Int()); |
|
262 ASSERT_EQUALS(KErrNone, reqStatus2.Int()); // KErrNone or KErrServerBusy ? See the note at the top. |
|
263 ASSERT_EQUALS(KTestPCmdNumber, sendSm1.PCmdNumber()); |
|
264 ASSERT_EQUALS(KTestPCmdNumber, sendSm2.PCmdNumber()); |
|
265 ASSERT_EQUALS(sendSm1.iAlphaId.iStatus, ExpectedAlphaIdStatus(ETestSequence11)); |
|
266 ASSERT_EQUALS(sendSm2.iAlphaId.iStatus, ExpectedAlphaIdStatus(ETestSequence11)); |
|
267 ASSERT_TRUE(sendSm1.iAlphaId.iAlphaId == ExpectedAlphaId(ETestSequence11)); |
|
268 ASSERT_TRUE(sendSm2.iAlphaId.iAlphaId == ExpectedAlphaId(ETestSequence11)); |
|
269 ASSERT_EQUALS(sendSm1.iAddress.iTypeOfNumber, ExpectedTypeOfNumber(ETestSequence11)); |
|
270 ASSERT_EQUALS(sendSm2.iAddress.iTypeOfNumber, ExpectedTypeOfNumber(ETestSequence11)); |
|
271 ASSERT_EQUALS(sendSm1.iAddress.iNumberPlan, ExpectedNumberPlan(ETestSequence11)); |
|
272 ASSERT_EQUALS(sendSm2.iAddress.iNumberPlan, ExpectedNumberPlan(ETestSequence11)); |
|
273 ASSERT_TRUE(sendSm1.iAddress.iTelNumber == KDialingNumberString16); |
|
274 ASSERT_TRUE(sendSm2.iAddress.iTelNumber == KDialingNumberString16); |
|
275 ASSERT_TRUE(sendSm1.iSmsTpdu == tpdu); |
|
276 ASSERT_TRUE(sendSm2.iSmsTpdu == tpdu); |
|
277 |
|
278 // Prime MOCK with appropriate "TERMINAL RESPONSE" |
|
279 RSat::TSendSmRspV1 rsp; |
|
280 RSat::TSendSmRspV1Pckg rspPckg(rsp); |
|
281 FillResponse(rsp,ETestSequence11); |
|
282 MockPrimeSendSmTerminalResponseL(ETestSequence11,rsp); |
|
283 |
|
284 // Invoke 1-st RSat:TerminalRsp |
|
285 TRequestStatus rspStatus1; |
|
286 iSat.TerminalRsp(rspStatus1,RSat::ESendSm,rspPckg); |
|
287 User::WaitForRequest(rspStatus1); |
|
288 ASSERT_EQUALS(KErrNone, rspStatus1.Int()); |
|
289 |
|
290 // Prime MOCK once again with "TERMINAL RESPONSE" |
|
291 MockPrimeSendSmTerminalResponseL(ETestSequence11,rsp); |
|
292 |
|
293 // Invoke 2-nd RSat:TerminalRsp |
|
294 TRequestStatus rspStatus2; |
|
295 sat2.TerminalRsp(rspStatus2,RSat::ESendSm,rspPckg); |
|
296 User::WaitForRequest(rspStatus2); |
|
297 ASSERT_EQUALS(KErrNone, rspStatus2.Int()); |
|
298 |
|
299 AssertMockLtsyStatusL(); |
|
300 |
|
301 CleanupStack::PopAndDestroy(4, this); // sat2, phone2, telServer2, this |
|
302 |
|
303 } |
|
304 |
|
305 // *************************** |
|
306 // * TLV tags used for testing |
|
307 // *************************** |
|
308 #if 1 |
|
309 // TLV tags without CR bit |
|
310 const TUint8 KTestCommandDetailsTag = KTlvCommandDetailsTag; |
|
311 const TUint8 KTestDeviceIdentityTag = KTlvDeviceIdentityTag; |
|
312 const TUint8 KTestAlphaIdentifierTag = KTlvAlphaIdentifierTag; |
|
313 const TUint8 KTestAddressTag = KTlvAddressTag; |
|
314 const TUint8 KTestSmsTpduTag = KTlvSmsTpduTag; |
|
315 const TUint8 KTestResultTag = KTlvResultTag; |
|
316 const TUint8 KTestIconIdentifierTag = KTlvIconIdentifierTag; |
|
317 #else |
|
318 // TLV tags with CR (Comprehension Required) bit set. |
|
319 // It is not quite clear how exacly it should be used in "TERMINAL RESPONSE" |
|
320 // but current SAT TSY implementation never sets it there for tags other |
|
321 // than "command details" though terminal responses listed in TS 31.124 have it set |
|
322 // for all tags. Is that a defect ?? |
|
323 const TUint8 KTestCommandDetailsTag = (KTlvCommandDetailsTag | KTagCrMask); |
|
324 const TUint8 KTestDeviceIdentityTag = (KTlvDeviceIdentityTag | KTagCrMask); |
|
325 const TUint8 KTestAlphaIdentifierTag = (KTlvAlphaIdentifierTag | KTagCrMask); |
|
326 const TUint8 KTestAddressTag = (KTlvAddressTag | KTagCrMask); |
|
327 const TUint8 KTestSmsTpduTag = (KTlvSmsTpduTag | KTagCrMask); |
|
328 const TUint8 KTestResultTag = (KTlvResultTag | KTagCrMask); |
|
329 const TUint8 KTestIconIdentifierTag = (KTlvIconIdentifierTag | KTagCrMask); |
|
330 #endif |
|
331 |
|
332 // ****************************** |
|
333 // * TLV values used for testing |
|
334 // ****************************** |
|
335 |
|
336 // Type of address, see ETSI TS 102 223 (v8.1.0) clause 8.1 |
|
337 // Possible TON (i.e. "Type Of Number") values: |
|
338 // 0x00 (000) - Unknown |
|
339 // 0x01 (001) - International Number |
|
340 // 0x02 (010) - National Number |
|
341 // 0x03 (011) - Network Specific Number |
|
342 // the below values are defined in 3GPP TS 23.040 V8.2.0 |
|
343 // 0x04 (100) Subscriber number |
|
344 // 0x05 (101) Alphanumeric, (coded according to 3GPP TS 23.038 [9] GSM 7-bit default alphabet) |
|
345 // 0x06 (110) Abbreviated number |
|
346 // 0x07 (111) Reserved for extension |
|
347 |
|
348 // Possible NPI (i.e. "Numbering Plan Identification") values: |
|
349 // 0x00 (0000) - Unknown |
|
350 // 0x01 (0001) - ISDN/telephony numbering plan (ITU-T Recommendations E.164 and E.163) |
|
351 // 0x03 (0011) - Data numbering plan (ITU-T Recommendation X.121) |
|
352 // 0x04 (0100) - Telex numbering plan (ITU-T Recommendation F.69) |
|
353 // 0x09 (1001) - Private numbering plan |
|
354 // 0x0F (1111) - Reserved for extension |
|
355 // the below values are defined in 3GPP TS 23.040 V8.2.0 |
|
356 // 0x05 (0101) Service Centre Specific plan |
|
357 // 0x06 (0110) Service Centre Specific plan |
|
358 // 0x08 (1000) National numbering plan |
|
359 // 0x0A (1010) ERMES numbering plan (ETSI DE/PS 3 01-3) |
|
360 const TUint8 KTestTypeOfAddress = (0x80 | (0x01 << 4) | 0x01); // International number + ISDN/telephony numbering plan |
|
361 |
|
362 // Icon identifier (a number of a record in EFimg) |
|
363 const TUint8 KTestIconIdentifier = 1; |
|
364 |
|
365 // TP-Protocol-Identifier (TP-PID) values, see 3GPP TS 23.040 V8.2.0, clause 9.2.3.9 |
|
366 // 0x40 (01000000) Short Message Type 0 |
|
367 // 0x41 (01000001) Replace Short Message Type 1 |
|
368 // 0x42 (01000010) Replace Short Message Type 2 |
|
369 // 0x43 (01000011) Replace Short Message Type 3 |
|
370 // 0x44 (01000100) Replace Short Message Type 4 |
|
371 // 0x45 (01000101) Replace Short Message Type 5 |
|
372 // 0x46 (01000110) Replace Short Message Type 6 |
|
373 // 0x46 (01000111) Replace Short Message Type 7 |
|
374 // 0x5E (01011110) Enhanced Message Service (Obsolete) |
|
375 // 0x5F (01011111) Return Call Message |
|
376 // 0x7C (01111100) ANSI-136 R-DATA |
|
377 // 0x7D (01111101) ME Data download |
|
378 // 0x7E (01111110) ME De-personalization Short Message |
|
379 // 0x7F (01111111) (U)SIM Data download |
|
380 const TUint8 KShortMessageType0 = 0x40; //Short message type 0 |
|
381 |
|
382 |
|
383 //********************** |
|
384 // Strings used in tests |
|
385 //********************** |
|
386 |
|
387 _LIT8(KDestinationAddressString8,"012345678"); |
|
388 _LIT8(KShortDestinationAddressString8,"01"); |
|
389 _LIT8(KTestMessageString8,"Test Message"); |
|
390 _LIT8(KSendSmString8,"Send SM"); |
|
391 _LIT16(KSendSmString16,"Send SM"); |
|
392 _LIT8(KShortMessageString8,"Short Message"); |
|
393 _LIT16(KShortMessageString16,"Short Message"); |
|
394 _LIT8(KNoIconString8,"NO ICON"); |
|
395 _LIT16(KNoIconString16,"NO ICON"); |
|
396 |
|
397 // GSM7 coded "Short Message" |
|
398 _LIT8(KShortMessageStringGSM7,"\x53\xF4\x5B\x4E\x07\x35\xCB\xF3\x79\xF8\x5C\x06"); |
|
399 |
|
400 // GSM7 encoded "The address data object holds the RP_Destination_Address" |
|
401 _LIT8(KSequence14AlphaString8, |
|
402 "\x54\x68\x65\x20\x61\x64\x64\x72\x65\x73\x73\x20\x64\x61\x74\x61\ |
|
403 \x20\x6F\x62\x6A\x65\x63\x74\x20\x68\x6F\x6C\x64\x73\x20\x74\x68\ |
|
404 \x65\x20\x52\x50\x11\x44\x65\x73\x74\x69\x6E\x61\x74\x69\x6F\x6E\ |
|
405 \x11\x41\x64\x64\x72\x65\x73\x73"); |
|
406 |
|
407 _LIT(KSequence14AlphaString16, |
|
408 "The address data object holds the RP_Destination_Address"); |
|
409 |
|
410 _LIT8(KSequence15AlphaString8, |
|
411 "The address data object holds the RP Destination Address"); |
|
412 |
|
413 _LIT(KSequence15AlphaString16, |
|
414 "The address data object holds the RP Destination Address"); |
|
415 |
|
416 _LIT8(KSequence16AlphaString8, |
|
417 "Two types are defined: - A short message to be sent to the network in an \ |
|
418 SMS-SUBMIT message, or an SMS-COMMAND message, where the user data can \ |
|
419 be passed transparently; - A short message to be sent to the network in an \ |
|
420 SMS-SUBMIT "); |
|
421 |
|
422 _LIT(KSequence16AlphaString16, |
|
423 "Two types are defined: - A short message to be sent to the network in an \ |
|
424 SMS-SUBMIT message, or an SMS-COMMAND message, where the user data can \ |
|
425 be passed transparently; - A short message to be sent to the network in an \ |
|
426 SMS-SUBMIT "); |
|
427 |
|
428 _LIT8(KLongUserDataString8, |
|
429 "Two types are defined: - A short message to be sent to the network in an \ |
|
430 SMS-SUBMIT message, or an SMS-COMMAND message, where the user data can \ |
|
431 be passed transp"); |
|
432 |
|
433 // GSM7 encoded K160CharsString |
|
434 //"Two types are defined: - A short message to be sent to the network in an " |
|
435 //"SMS-SUBMIT message, or an SMS-COMMAND message, where the user data can " |
|
436 //"be passed transp" |
|
437 _LIT8(KLongUserDataStringGSM7, |
|
438 "\xD4\xFB\x1B\x44\xCF\xC3\xCB\x73\x50\x58\x5E\x06\ |
|
439 \x91\xCB\xE6\xB4\xBB\x4C\xD6\x81\x5A\xA0\x20\x68\ |
|
440 \x8E\x7E\xCB\xE9\xA0\x76\x79\x3E\x0F\x9F\xCB\x20\ |
|
441 \xFA\x1B\x24\x2E\x83\xE6\x65\x37\x1D\x44\x7F\x83\ |
|
442 \xE8\xE8\x32\xC8\x5D\xA6\xDF\xDF\xF2\x35\x28\xED\ |
|
443 \x06\x85\xDD\xA0\x69\x73\xDA\x9A\x56\x85\xCD\x24\ |
|
444 \x15\xD4\x2E\xCF\xE7\xE1\x73\x99\x05\x7A\xCB\x41\ |
|
445 \x61\x37\x68\xDA\x9C\xB6\x86\xCF\x66\x33\xE8\x24\ |
|
446 \x82\xDA\xE5\xF9\x3C\x7C\x2E\xB3\x40\x77\x74\x59\ |
|
447 \x5E\x06\xD1\xD1\x65\x50\x7D\x5E\x96\x83\xC8\x61\ |
|
448 \x7A\x18\x34\x0E\xBB\x41\xE2\x32\x08\x1E\x9E\xCF\ |
|
449 \xCB\x64\x10\x5D\x1E\x76\xCF\xE1"); |
|
450 |
|
451 _LIT8(KSingleSpaceUserData8," "); |
|
452 |
|
453 // ********************* |
|
454 // Below TPDUs are taken from 3GPP TS 31.124 (see SMS-PP (SEND SHORT MESSAGE) |
|
455 // codings for each test sequence where command qualifier is set to "packing required") |
|
456 // The only difference is that MR values (the 2-nd byte) are "0" instead of "1" as |
|
457 // in the original document. |
|
458 // ********************* |
|
459 |
|
460 _LIT8(KSequence12ExpectedTpdu, |
|
461 "\x01\x00\x09\x91\x10\x32\x54\x76\xF8\x40\xF0\x07\xD3\xB2\x9B\x0C\x9A\x36\x01"); |
|
462 |
|
463 _LIT8(KSequence14ExpectedTpdu, |
|
464 "\x01\x00\x09\x91\x10\x32\x54\x76\xF8\x40\xF0\ |
|
465 \xA0\xD4\xFB\x1B\x44\xCF\xC3\xCB\x73\x50\x58\x5E\ |
|
466 \x06\x91\xCB\xE6\xB4\xBB\x4C\xD6\x81\x5A\xA0\x20\ |
|
467 \x68\x8E\x7E\xCB\xE9\xA0\x76\x79\x3E\x0F\x9F\xCB\ |
|
468 \x20\xFA\x1B\x24\x2E\x83\xE6\x65\x37\x1D\x44\x7F\ |
|
469 \x83\xE8\xE8\x32\xC8\x5D\xA6\xDF\xDF\xF2\x35\x28\ |
|
470 \xED\x06\x85\xDD\xA0\x69\x73\xDA\x9A\x56\x85\xCD\ |
|
471 \x24\x15\xD4\x2E\xCF\xE7\xE1\x73\x99\x05\x7A\xCB\ |
|
472 \x41\x61\x37\x68\xDA\x9C\xB6\x86\xCF\x66\x33\xE8\ |
|
473 \x24\x82\xDA\xE5\xF9\x3C\x7C\x2E\xB3\x40\x77\x74\ |
|
474 \x59\x5E\x06\xD1\xD1\x65\x50\x7D\x5E\x96\x83\xC8\ |
|
475 \x61\x7A\x18\x34\x0E\xBB\x41\xE2\x32\x08\x1E\x9E\ |
|
476 \xCF\xCB\x64\x10\x5D\x1E\x76\xCF\xE1"); |
|
477 |
|
478 // ************************* |
|
479 // Fake TP-VP values used in |
|
480 // ************************* |
|
481 _LIT8(KFakeRelativeValidityValue,"\x00"); |
|
482 _LIT8(KFakeAbsoluteOrEnchancedValidityValue,"\x00\x00\x00\x00\x00\x00\x00"); |
|
483 |
|
484 // ********************* |
|
485 // below 3 TPDUs are made of KSequence12ExpectedTpdu combined with |
|
486 // KFakeRelativeValidityValue and KFakeAbsoluteOrEnchancedValidityValue appropriately |
|
487 // Once the above strings are changed the below should be changed too |
|
488 // ********************* |
|
489 _LIT8(KTestRelativeVPFPackedExpectedTpdu, |
|
490 "\x11\x00\x09\x91\x10\x32\x54\x76\xF8\x40\xF0\x00\x07\xD3\xB2\x9B\x0C\x9A\x36\x01"); |
|
491 |
|
492 _LIT8(KTestEnchancedVPFPackedExpectedTpdu, |
|
493 "\x09\x00\x09\x91\x10\x32\x54\x76\xF8\x40\xF0\x00\x00\x00\x00\x00\x00\x00\x07\xD3\xB2\x9B\x0C\x9A\x36\x01"); |
|
494 |
|
495 _LIT8(KTestAbsoluteVPFPackedExpectedTpdu, |
|
496 "\x19\x00\x09\x91\x10\x32\x54\x76\xF8\x40\xF0\x00\x00\x00\x00\x00\x00\x00\x07\xD3\xB2\x9B\x0C\x9A\x36\x01"); |
|
497 |
|
498 /** |
|
499 * Executes "positive" RSat::NotifySendSmPCmd() test identified by aTC |
|
500 * @param aTC testcase identifier |
|
501 */ |
|
502 void CCSatSendSMSFU::DoPositiveNotifySendSmPCmdTestL(TSendSmTC aTC) |
|
503 { |
|
504 // Prime Mock with appopriate "SEND SHORT MESSAGE" proactive command |
|
505 TTpdu tpdu; |
|
506 MockPrimeSendSmPCmdL(tpdu, aTC); |
|
507 |
|
508 // Invoke RSat::NotifySendSmPCmd() |
|
509 TRequestStatus reqStatus; |
|
510 |
|
511 RSat::TSendSmV1 sendSm; |
|
512 RSat::TSendSmV1Pckg sendSmPckg(sendSm); |
|
513 iSat.NotifySendSmPCmd(reqStatus,sendSmPckg); |
|
514 User::WaitForRequest(reqStatus); |
|
515 |
|
516 // Check the result |
|
517 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
518 ASSERT_EQUALS(KTestPCmdNumber, sendSm.PCmdNumber()); |
|
519 if(AlphaIdIsUsed(aTC)) |
|
520 { |
|
521 ASSERT_EQUALS(sendSm.iAlphaId.iStatus, ExpectedAlphaIdStatus(aTC)); |
|
522 ASSERT_TRUE(sendSm.iAlphaId.iAlphaId == ExpectedAlphaId(aTC)); |
|
523 } |
|
524 else |
|
525 { |
|
526 ASSERT_EQUALS(RSat::EAlphaIdNotPresent, sendSm.iAlphaId.iStatus); |
|
527 } |
|
528 ASSERT_EQUALS(sendSm.iAddress.iTypeOfNumber, ExpectedTypeOfNumber(aTC)); |
|
529 ASSERT_EQUALS(sendSm.iAddress.iNumberPlan, ExpectedNumberPlan(aTC)); |
|
530 if(CompleteAddressIsUsed(aTC)) |
|
531 { |
|
532 ASSERT_TRUE(sendSm.iAddress.iTelNumber == KDialingNumberString16); |
|
533 } |
|
534 if(IsIconRelatedTC(aTC)) |
|
535 { |
|
536 ASSERT_EQUALS(sendSm.iIconId.iQualifier, ExpectedIconQualifier(aTC)); |
|
537 ASSERT_EQUALS(sendSm.iIconId.iIdentifier, KTestIconIdentifier); |
|
538 } |
|
539 if(PackingIsUsed(aTC)) |
|
540 { |
|
541 ASSERT_TRUE(sendSm.iSmsTpdu == ExpectedTpdu(aTC)); |
|
542 } |
|
543 else |
|
544 { |
|
545 ASSERT_TRUE(sendSm.iSmsTpdu == tpdu); |
|
546 } |
|
547 |
|
548 // Prime MOCK with appropriate "TERMINAL RESPONSE" |
|
549 RSat::TSendSmRspV1 rsp; |
|
550 FillResponse(rsp,aTC); |
|
551 MockPrimeSendSmTerminalResponseL(aTC,rsp); |
|
552 |
|
553 // Invoke RSat::TerminalRsp |
|
554 RSat::TSendSmRspV1Pckg rspPckg(rsp); |
|
555 TerminalResponseL(RSat::ESendSm,rspPckg); |
|
556 } |
|
557 |
|
558 /** |
|
559 * Executes "negative" RSat::NotifySendSmPCmd() test identified by aTC |
|
560 * @param aTC testcase identifier |
|
561 */ |
|
562 void CCSatSendSMSFU::DoNegativeNotifySendSmPCmdTestL(TSendSmTC aTC) |
|
563 { |
|
564 // Tell Mock to issue "SEND SHORT MESSAGE" with some corrupted data |
|
565 TTpdu tpdu; |
|
566 MockPrimeSendSmPCmdL(tpdu, aTC); |
|
567 |
|
568 // Prime Mock with appropriate "TERMINAL RESPONSE" because |
|
569 // in case of error SAT TSY inokes it internally |
|
570 MockPrimeSendSmTerminalResponseL(aTC); |
|
571 |
|
572 // Call RSat::NotifySendSmPCmd() |
|
573 TRequestStatus reqStatus; |
|
574 |
|
575 RSat::TSendSmV1 sendSm; |
|
576 RSat::TSendSmV1Pckg sendSmPckg(sendSm); |
|
577 iSat.NotifySendSmPCmd(reqStatus,sendSmPckg); |
|
578 User::WaitForRequest(reqStatus); |
|
579 ASSERT_EQUALS(KErrCorrupt, reqStatus.Int()); |
|
580 } |
|
581 |
|
582 /** |
|
583 * Tests all possible "TERMINAL RESPONSE" cases. |
|
584 * API should return KErrNone for all valid responses and KErrCorrupt |
|
585 * for those that can not be used with "SEND SHORT MESSAGE" command |
|
586 */ |
|
587 void CCSatSendSMSFU::DoTestTerminalResponseL() |
|
588 { |
|
589 static const struct |
|
590 { |
|
591 RSat::TPCmdResult iGeneralResult; |
|
592 RSat::TAdditionalInfoType iInfoType; |
|
593 TBool iIntentionallyOmmitAdditionalInfo; |
|
594 TUint8 iAdditionalInfo; |
|
595 TInt iExpectedResult; |
|
596 } |
|
597 KResponsesToTest[] = |
|
598 { |
|
599 { |
|
600 // 0x01 - Command performed with partial comprehension; |
|
601 RSat::KPartialComprehension, |
|
602 RSat::KNoAdditionalInfo, |
|
603 ETrue, |
|
604 0, |
|
605 KErrCorrupt |
|
606 }, |
|
607 { |
|
608 // 0x02 - Command performed, with missing information; |
|
609 RSat::KMissingInformation, |
|
610 RSat::KNoAdditionalInfo, |
|
611 ETrue, |
|
612 0, |
|
613 KErrCorrupt |
|
614 }, |
|
615 { |
|
616 // 0x03 - REFRESH performed with additional EFs read; |
|
617 RSat::KRefreshAdditionEFRead, |
|
618 RSat::KNoAdditionalInfo, |
|
619 ETrue, |
|
620 0, |
|
621 KErrCorrupt |
|
622 }, |
|
623 { |
|
624 // 0x04 - Command performed successfully, but requested icon could not be displayed; |
|
625 RSat::KSuccessRequestedIconNotDisplayed, |
|
626 RSat::KNoAdditionalInfo, |
|
627 ETrue, |
|
628 0, |
|
629 KErrNone |
|
630 }, |
|
631 { |
|
632 // 0x05 - Command performed, but modified by call control by NAA; |
|
633 RSat::KModifiedByCallControl, |
|
634 RSat::KNoAdditionalInfo, |
|
635 ETrue, |
|
636 0, |
|
637 KErrNone |
|
638 }, |
|
639 { |
|
640 // 0x06 - Command performed successfully, limited service; |
|
641 RSat::KSuccessLimitedService, |
|
642 RSat::KNoAdditionalInfo, |
|
643 ETrue, |
|
644 0, |
|
645 KErrCorrupt |
|
646 }, |
|
647 { |
|
648 // 0x07 - Command performed with modification; |
|
649 RSat::KPerformedWithModifications, |
|
650 RSat::KNoAdditionalInfo, |
|
651 ETrue, |
|
652 0, |
|
653 KErrCorrupt |
|
654 }, |
|
655 { |
|
656 // 0x08 - REFRESH performed but indicated NAA was not active; |
|
657 RSat::KRefreshUSIMNotActive, |
|
658 RSat::KNoAdditionalInfo, |
|
659 ETrue, |
|
660 0, |
|
661 KErrCorrupt |
|
662 }, |
|
663 { |
|
664 // 0x09 - Command performed successfully, tone not played; |
|
665 RSat::KPlayTonePerformedSuccessfully, |
|
666 RSat::KNoAdditionalInfo, |
|
667 ETrue, |
|
668 0, |
|
669 KErrCorrupt |
|
670 }, |
|
671 { |
|
672 // 0x10 - Proactive UICC session terminated by the user; |
|
673 RSat::KPSessionTerminatedByUser, |
|
674 RSat::KNoAdditionalInfo, |
|
675 ETrue, |
|
676 0, |
|
677 KErrCorrupt |
|
678 }, |
|
679 { |
|
680 // 0x11 - Backward move in the proactive UICC session requested by the user; |
|
681 RSat::KBackwardModeRequestedByUser, |
|
682 RSat::KNoAdditionalInfo, |
|
683 ETrue, |
|
684 0, |
|
685 KErrCorrupt |
|
686 }, |
|
687 { |
|
688 // 0x12 - No response from user; |
|
689 RSat::KNoResponseFromUser, |
|
690 RSat::KNoAdditionalInfo, |
|
691 ETrue, |
|
692 0, |
|
693 KErrCorrupt |
|
694 }, |
|
695 { |
|
696 // 0x13 - Help information required by the user; |
|
697 RSat::KHelpRequestedByUser, |
|
698 RSat::KNoAdditionalInfo, |
|
699 ETrue, |
|
700 0, |
|
701 KErrCorrupt |
|
702 }, |
|
703 { |
|
704 // 0x14 - reserved for GSM/3G. |
|
705 RSat::KUssdTransactionTerminatedByUser, |
|
706 RSat::KNoAdditionalInfo, |
|
707 ETrue, |
|
708 0, |
|
709 KErrCorrupt |
|
710 }, |
|
711 { |
|
712 // 0x20 - terminal currently unable to process command; |
|
713 RSat::KMeUnableToProcessCmd, |
|
714 RSat::KMeProblem, |
|
715 EFalse, |
|
716 0, |
|
717 KErrNone |
|
718 }, |
|
719 { |
|
720 // 0x20 without additional information (erroneous) |
|
721 RSat::KMeUnableToProcessCmd, |
|
722 RSat::KMeProblem, |
|
723 ETrue, // Intentional error ! |
|
724 0, |
|
725 KErrCorrupt |
|
726 }, |
|
727 { |
|
728 // 0x21 - Network currently unable to process command; |
|
729 RSat::KNetworkUnableToProcessCmd, |
|
730 RSat::KSatNetworkErrorInfo, |
|
731 EFalse, |
|
732 0, |
|
733 KErrCorrupt |
|
734 }, |
|
735 { |
|
736 // 0x21 without additional information (erroneous) |
|
737 RSat::KNetworkUnableToProcessCmd, |
|
738 RSat::KSatNetworkErrorInfo, |
|
739 ETrue, // Intentional error ! |
|
740 0, |
|
741 KErrCorrupt |
|
742 }, |
|
743 { |
|
744 // 0x22 - User did not accept the proactive command; |
|
745 RSat::KPCmdNotAcceptedByUser, |
|
746 RSat::KNoAdditionalInfo, |
|
747 ETrue, |
|
748 0, |
|
749 KErrCorrupt |
|
750 }, |
|
751 { |
|
752 // 0x23 - User cleared down call before connection or network release; |
|
753 RSat::KCallClearedBeforeConnectionOrReleased, |
|
754 RSat::KNoAdditionalInfo, |
|
755 ETrue, |
|
756 0, |
|
757 KErrCorrupt |
|
758 }, |
|
759 { |
|
760 // 0x24 - Action in contradiction with the current timer state; |
|
761 RSat::KContradictionWithTimerState, |
|
762 RSat::KNoAdditionalInfo, |
|
763 ETrue, |
|
764 0, |
|
765 KErrCorrupt |
|
766 }, |
|
767 { |
|
768 // 0x25 - Interaction with call control by NAA, temporary problem; |
|
769 RSat::KInteractionWithCCTemporaryError, |
|
770 RSat::KNoAdditionalInfo, |
|
771 ETrue, |
|
772 0, |
|
773 KErrCorrupt |
|
774 }, |
|
775 { |
|
776 // 0x26 - Launch browser generic error code; |
|
777 RSat::KLaunchBrowserError, |
|
778 RSat::KNoAdditionalInfo, |
|
779 ETrue, |
|
780 0, |
|
781 KErrCorrupt |
|
782 }, |
|
783 { |
|
784 // 0x26 without additional information (erroneous) |
|
785 RSat::KLaunchBrowserError, |
|
786 RSat::KMeProblem, |
|
787 ETrue, // Intentional error ! |
|
788 0, |
|
789 KErrCorrupt |
|
790 }, |
|
791 { |
|
792 // 0x27 - MMS temporary problem. |
|
793 RSat::KMMSTemporaryProblem, |
|
794 RSat::KNoAdditionalInfo, |
|
795 ETrue, |
|
796 0, |
|
797 KErrCorrupt |
|
798 }, |
|
799 { |
|
800 // 0x30 - Command beyond terminal's capabilities; |
|
801 RSat::KCmdBeyondMeCapabilities, |
|
802 RSat::KNoAdditionalInfo, |
|
803 ETrue, |
|
804 0, |
|
805 KErrNone |
|
806 }, |
|
807 { |
|
808 // 0x31 - Command type not understood by terminal; |
|
809 RSat::KCmdTypeNotUnderstood, |
|
810 RSat::KNoAdditionalInfo, |
|
811 ETrue, |
|
812 0, |
|
813 KErrCorrupt |
|
814 }, |
|
815 { |
|
816 // 0x32 - Command data not understood by terminal; |
|
817 RSat::KCmdDataNotUnderstood, |
|
818 RSat::KNoAdditionalInfo, |
|
819 ETrue, |
|
820 0, |
|
821 KErrCorrupt |
|
822 }, |
|
823 { |
|
824 // 0x33 - Command number not known by terminal; |
|
825 RSat::KCmdNumberNotKnown, |
|
826 RSat::KNoAdditionalInfo, |
|
827 ETrue, |
|
828 0, |
|
829 KErrCorrupt |
|
830 }, |
|
831 { |
|
832 // 0x34 - reserved for GSM/3G; |
|
833 RSat::KSsReturnError, |
|
834 RSat::KNoAdditionalInfo, |
|
835 ETrue, |
|
836 0, |
|
837 KErrCorrupt |
|
838 }, |
|
839 { |
|
840 // 0x35 - reserved for GSM/3G; |
|
841 RSat::KSmsRpError, |
|
842 RSat::KNoAdditionalInfo, |
|
843 ETrue, |
|
844 0, |
|
845 KErrNone |
|
846 }, |
|
847 { |
|
848 // 0x36 - Error, required values are missing; |
|
849 RSat::KErrorRequiredValuesMissing, |
|
850 RSat::KNoAdditionalInfo, |
|
851 ETrue, |
|
852 0, |
|
853 KErrCorrupt |
|
854 }, |
|
855 { |
|
856 // 0x37 - reserved for GSM/3G; |
|
857 RSat::KUssdReturnError, |
|
858 RSat::KNoAdditionalInfo, |
|
859 ETrue, |
|
860 0, |
|
861 KErrCorrupt |
|
862 }, |
|
863 { |
|
864 // 0x38 - MultipleCard commands error; |
|
865 RSat::KMultipleCardCmdsError, |
|
866 RSat::KNoAdditionalInfo, |
|
867 ETrue, |
|
868 0, |
|
869 KErrCorrupt |
|
870 }, |
|
871 { |
|
872 // 0x38 without additional information (erroneous) |
|
873 RSat::KMultipleCardCmdsError, |
|
874 RSat::KMeProblem, |
|
875 ETrue, // Intentional error |
|
876 0, |
|
877 KErrCorrupt |
|
878 }, |
|
879 { |
|
880 // 0x39 - Interaction with call control by NAA, permanent problem; |
|
881 RSat::KInteractionWithCCPermanentError, |
|
882 RSat::KControlInteraction, |
|
883 EFalse, |
|
884 0, |
|
885 KErrNone |
|
886 }, |
|
887 { |
|
888 // 0x39 without additional information (erroneous) |
|
889 RSat::KInteractionWithCCPermanentError, |
|
890 RSat::KControlInteraction, |
|
891 ETrue, // Intentional error |
|
892 0, |
|
893 KErrCorrupt |
|
894 }, |
|
895 { |
|
896 // 0x3A - Bearer Independent Protocol error; |
|
897 RSat::KBearerIndepProtocolError, |
|
898 RSat::KNoAdditionalInfo, |
|
899 ETrue, |
|
900 0, |
|
901 KErrCorrupt |
|
902 }, |
|
903 { |
|
904 // 0x3A without additional information (erroneous) |
|
905 RSat::KBearerIndepProtocolError, |
|
906 RSat::KMeProblem, |
|
907 ETrue, // Intentional error |
|
908 0, |
|
909 KErrCorrupt |
|
910 }, |
|
911 { |
|
912 // 0x3B - Access Technology unable to process command; |
|
913 RSat::KAccessTechUnableProcessCmd, |
|
914 RSat::KNoAdditionalInfo, |
|
915 ETrue, |
|
916 0, |
|
917 KErrCorrupt |
|
918 }, |
|
919 { |
|
920 // 0x3C - Frames error; |
|
921 RSat::KFramesError, |
|
922 RSat::KNoAdditionalInfo, |
|
923 ETrue, |
|
924 0, |
|
925 KErrCorrupt |
|
926 }, |
|
927 { |
|
928 // 0x3C without additional information (erroneous) |
|
929 RSat::KFramesError, |
|
930 RSat::KMeProblem, |
|
931 ETrue, // Intentional error |
|
932 0, |
|
933 KErrCorrupt |
|
934 }, |
|
935 { |
|
936 // 0x3D - MMS Error. |
|
937 RSat::KMMSError, |
|
938 RSat::KNoAdditionalInfo, |
|
939 ETrue, |
|
940 0, |
|
941 KErrCorrupt |
|
942 }, |
|
943 { |
|
944 // 0x3D without additional information (erroneous) |
|
945 RSat::KMMSError, |
|
946 RSat::KMeProblem, |
|
947 ETrue, // Intensional error ! |
|
948 0, |
|
949 KErrCorrupt |
|
950 } |
|
951 }; |
|
952 |
|
953 const TInt KNumberOfResponsesToTest = sizeof(KResponsesToTest)/ sizeof(KResponsesToTest[0]); |
|
954 |
|
955 for(TInt i = 0; i <= KNumberOfResponsesToTest; i++) |
|
956 { |
|
957 // Prime Mock with some successfull "SEND SHORT MESSAGE" proactive command |
|
958 TTpdu tpdu; |
|
959 MockPrimeSendSmPCmdL(tpdu, ETestSequence11); |
|
960 |
|
961 // Invoke RSat::NotifySendSmPCmd() to get the result |
|
962 TRequestStatus reqStatus; |
|
963 |
|
964 RSat::TSendSmV1 sendSm; |
|
965 RSat::TSendSmV1Pckg sendSmPckg(sendSm); |
|
966 iSat.NotifySendSmPCmd(reqStatus,sendSmPckg); |
|
967 User::WaitForRequest(reqStatus); |
|
968 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
969 |
|
970 // now test a "TERMINAL RESPONSE" specific to this loop |
|
971 TInt expectedResult; |
|
972 |
|
973 RSat::TSendSmRspV1 rsp; |
|
974 rsp.SetPCmdNumber(KTestPCmdNumber); |
|
975 |
|
976 if(i < KNumberOfResponsesToTest) |
|
977 { |
|
978 // looping through KResponsesToTest table |
|
979 rsp.iGeneralResult = KResponsesToTest[i].iGeneralResult; |
|
980 rsp.iInfoType = KResponsesToTest[i].iInfoType; |
|
981 if(rsp.iInfoType != RSat::KNoAdditionalInfo && |
|
982 !KResponsesToTest[i].iIntentionallyOmmitAdditionalInfo) |
|
983 { |
|
984 rsp.iAdditionalInfo.Append(KResponsesToTest[i].iAdditionalInfo); |
|
985 } |
|
986 expectedResult = KResponsesToTest[i].iExpectedResult; |
|
987 // tell Mock to dispatch the forthcoming RSat::TerminalRsp() succesfully |
|
988 MockPrimeSendSmTerminalResponseL(ETestSequence11,rsp); |
|
989 } |
|
990 else |
|
991 { |
|
992 // finished with KResponsesToTest table |
|
993 // now tell Mock to return KErrUnknown when dispatching forthcoming RSat::TerminalRsp() |
|
994 rsp.iGeneralResult = RSat::KSuccess; |
|
995 rsp.iInfoType = RSat::KNoAdditionalInfo; |
|
996 expectedResult = KErrUnknown; |
|
997 MockPrimeSendSmTerminalResponseL(ETestSequence11,rsp,expectedResult); |
|
998 } |
|
999 |
|
1000 // and finally send "TERMINAL RESPONSE" and analyse the result |
|
1001 RSat::TSendSmRspV1Pckg rspPckg(rsp); |
|
1002 iSat.TerminalRsp(reqStatus, RSat::ESendSm, rspPckg); |
|
1003 User::WaitForRequest(reqStatus); |
|
1004 ASSERT_EQUALS(reqStatus.Int(),expectedResult); |
|
1005 |
|
1006 AssertMockLtsyStatusL(); |
|
1007 } |
|
1008 } |
|
1009 |
|
1010 /** |
|
1011 * Given a testcase primes MOCK with appropriate "SEND SHORT MESSAGE" data |
|
1012 * @param aTpdu created SMS TPDU |
|
1013 * @param aTC testcase identifier |
|
1014 * @param aResultCode result code to be returned by RSat::NotifySendSmPCmd |
|
1015 */ |
|
1016 void CCSatSendSMSFU::MockPrimeSendSmPCmdL(TTpdu& aTpdu, TSendSmTC aTC, TInt aResultCode) |
|
1017 { |
|
1018 // prime Mock with pending "SEND SHORT MESSAGE" request |
|
1019 const TUint8 KPcmdCode = KSendShortMessage; |
|
1020 const TPckgC<TUint8> KPcmdCodePckg(KPcmdCode); |
|
1021 |
|
1022 iMockLTSY.ExpectL(MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId,KPcmdCodePckg); |
|
1023 |
|
1024 // trigger "SEND SHORT MESSAGE" event |
|
1025 MockCompleteSendSmPCmdL(aTpdu,aTC,aResultCode); |
|
1026 } |
|
1027 |
|
1028 /** |
|
1029 * Given a testcase primes MOCK with appropriate "TERMINAL RESPONSE" data |
|
1030 * @param aTC testcase identifier |
|
1031 */ |
|
1032 void CCSatSendSMSFU::MockPrimeSendSmTerminalResponseL(TSendSmTC aTC) |
|
1033 { |
|
1034 RSat::TSendSmRspV1 rsp; |
|
1035 FillResponse(rsp,aTC); |
|
1036 MockPrimeSendSmTerminalResponseL(aTC,rsp); |
|
1037 } |
|
1038 |
|
1039 /** |
|
1040 * Given a testcase and filled RSat::TSendSmRspV1 strucuture primes MOCK with appropriate "TERMINAL RESPONSE" data |
|
1041 * @param aTC testcase identifier |
|
1042 * @param aRsp a result to be passed to RSat::TerminalRsp() |
|
1043 * @param aResultCode result code to be returned by RSat::TerminalRsp() |
|
1044 */ |
|
1045 void CCSatSendSMSFU::MockPrimeSendSmTerminalResponseL(TSendSmTC aTC, const RSat::TSendSmRspV1& aRsp, TInt aResultCode) |
|
1046 { |
|
1047 RBuf8 data; |
|
1048 data.CleanupClosePushL(); |
|
1049 |
|
1050 TTlv tlv; |
|
1051 const TUint8 qualifier = CommandQualifier(aTC); |
|
1052 TDesC8* dataPtr = &const_cast<TDesC8&>(CreateSendSmTerminalResponseTlv(tlv,qualifier,aRsp)); |
|
1053 TMockLtsyData1<TDesC8*> termRespData(dataPtr); |
|
1054 termRespData.SerialiseL(data); |
|
1055 iMockLTSY.ExpectL(MLtsyDispatchSatTerminalRsp::KLtsyDispatchSatTerminalRspApiId, data,aResultCode); |
|
1056 CleanupStack::PopAndDestroy(); |
|
1057 } |
|
1058 |
|
1059 /** |
|
1060 * Triggers "SEND SHORT MESSAGE" event |
|
1061 * @param aTpdu created SMS TPDU |
|
1062 * @param aTC testcase identifier |
|
1063 * @param aResultCode result code to be returned by RSat::NotifySendSmPCmd |
|
1064 */ |
|
1065 void CCSatSendSMSFU::MockCompleteSendSmPCmdL(TTpdu& aTpdu, TSendSmTC aTC, TInt aResultCode) |
|
1066 { |
|
1067 RBuf8 data; |
|
1068 CleanupClosePushL(data); |
|
1069 |
|
1070 CreateSmsTpdu(aTpdu,aTC); |
|
1071 |
|
1072 TTlvBuf<KTlvMaxSize + 1> tlv; |
|
1073 TDesC8* dataPtr = &const_cast<TDesC8&>(CreateSendSmTlv(tlv,aTpdu,aTC)); |
|
1074 TMockLtsyData1<TDesC8*> tlvPack(dataPtr); |
|
1075 tlvPack.SerialiseL(data); |
|
1076 iMockLTSY.CompleteL(KMockLtsyDispatchSatPcmdIndId,aResultCode,data); |
|
1077 |
|
1078 CleanupStack::PopAndDestroy(); // data |
|
1079 } |
|
1080 |
|
1081 /** |
|
1082 * returns ETrue if command qualifier is set to "packing required" for a given testcase |
|
1083 * @param aTC testcase identifier |
|
1084 * @return ETrue if "packing required" EFalse otherwise |
|
1085 */ |
|
1086 TBool CCSatSendSMSFU::PackingIsUsed(TSendSmTC aTC) |
|
1087 { |
|
1088 TBool result; |
|
1089 switch(aTC) |
|
1090 { |
|
1091 case ETestSequence12: |
|
1092 case ETestSequence14: |
|
1093 case ETestTooBigSmsSubmit8bitPacked: |
|
1094 case ETestTooBigSmsSubmit7bitPacked: |
|
1095 case ETestRelativeVPFPacked: |
|
1096 case ETestEnchancedVPFPacked: |
|
1097 case ETestAbsoluteVPFPacked: |
|
1098 result = ETrue; |
|
1099 break; |
|
1100 |
|
1101 default: |
|
1102 result = EFalse; |
|
1103 } |
|
1104 return result; |
|
1105 } |
|
1106 |
|
1107 /** |
|
1108 * returns expected TPDU for a given testcase |
|
1109 * Should be called only if PackingIsUsed() returns ETrue |
|
1110 * @param aTC testcase identifier |
|
1111 * @return a reference to a descriptor containing expected TPDU |
|
1112 */ |
|
1113 const TDesC8& CCSatSendSMSFU::ExpectedTpdu(TSendSmTC aTC) |
|
1114 { |
|
1115 __ASSERT_ALWAYS(PackingIsUsed(aTC),User::Invariant()); |
|
1116 switch(aTC) |
|
1117 { |
|
1118 case ETestSequence12: |
|
1119 return KSequence12ExpectedTpdu(); |
|
1120 |
|
1121 case ETestRelativeVPFPacked: |
|
1122 return KTestRelativeVPFPackedExpectedTpdu(); |
|
1123 |
|
1124 case ETestEnchancedVPFPacked: |
|
1125 return KTestEnchancedVPFPackedExpectedTpdu(); |
|
1126 |
|
1127 case ETestAbsoluteVPFPacked: |
|
1128 return KTestAbsoluteVPFPackedExpectedTpdu(); |
|
1129 |
|
1130 default: |
|
1131 // ETestSequence14: |
|
1132 return KSequence14ExpectedTpdu(); |
|
1133 |
|
1134 } |
|
1135 } |
|
1136 |
|
1137 /** |
|
1138 * Given a testcase returns corresponding TP-VPF value |
|
1139 * that should be used in the testcase, see clause 9.2.3.3 of the 3GPP TS 23.040 |
|
1140 * @param aTC testcase identifier |
|
1141 * @return TP-VPF value |
|
1142 */ |
|
1143 TUint8 CCSatSendSMSFU::ValidityPeriodFormat(TSendSmTC aTC) |
|
1144 { |
|
1145 TUint8 vpf; |
|
1146 switch(aTC) |
|
1147 { |
|
1148 case ETestRelativeVPF: |
|
1149 case ETestRelativeVPFPacked: |
|
1150 vpf = KSmsVPFRelative; |
|
1151 break; |
|
1152 |
|
1153 case ETestEnchancedVPF: |
|
1154 case ETestEnchancedVPFPacked: |
|
1155 vpf = KSmsVPFEnhanced; |
|
1156 break; |
|
1157 |
|
1158 case ETestAbsoluteVPF: |
|
1159 case ETestAbsoluteVPFPacked: |
|
1160 vpf = KSmsVPFAbsolute; |
|
1161 break; |
|
1162 |
|
1163 default: |
|
1164 vpf = 0; |
|
1165 } |
|
1166 return vpf; |
|
1167 } |
|
1168 |
|
1169 /** |
|
1170 * Given a testcase returns corresponding destination address |
|
1171 * that should be used in the testcase |
|
1172 * @param aTC testcase identifier |
|
1173 * @return a reference to a descriptor containing destination address |
|
1174 */ |
|
1175 const TDesC8& CCSatSendSMSFU::DestinationAddress(TSendSmTC aTC) |
|
1176 { |
|
1177 if(aTC == ETestSequence16) |
|
1178 { |
|
1179 return KShortDestinationAddressString8(); |
|
1180 } |
|
1181 else |
|
1182 { |
|
1183 return KDestinationAddressString8(); |
|
1184 } |
|
1185 } |
|
1186 |
|
1187 /** |
|
1188 * Given a testcase returns corresponding data coding scheme |
|
1189 * that should be used in the testcase |
|
1190 * @param aTC testcase identifier |
|
1191 * @return data coding scheme value |
|
1192 */ |
|
1193 TUint8 CCSatSendSMSFU::DataCodingScheme(TSendSmTC aTC) |
|
1194 { |
|
1195 // Possible TP-DSC (TP-Data-Coding-Scheme) values (see 3GPP TS 23.038 clause 4) |
|
1196 // 0xF0 - Message coding: GSM 7 bit default alphabet |
|
1197 // Message class : Class 0 |
|
1198 |
|
1199 // 0xF1 - Message coding: GSM 7 bit default alphabet |
|
1200 // Message class : Class 1 default meaning: ME-specific. |
|
1201 |
|
1202 // 0xF2 - Message coding: GSM 7 bit default alphabet |
|
1203 // Message class : Class 2 (U)SIM-specific message. |
|
1204 |
|
1205 // 0xF3 - Message coding: GSM 7 bit default alphabet |
|
1206 // Message class : Class 3 default meaning: TE specific |
|
1207 |
|
1208 // 0xF4 - Message coding: 8-bit data |
|
1209 // Message class : Class 0 |
|
1210 |
|
1211 // 0xF5 - Message coding: 8-bit data |
|
1212 // Message class : Class 1 default meaning: ME-specific. |
|
1213 |
|
1214 // 0xF6 - Message coding: 8-bit data |
|
1215 // Message class : Class 2 (U)SIM-specific message. |
|
1216 |
|
1217 // 0xF7 - Message coding: 8-bit data |
|
1218 // Message class : Class 3 default meaning: TE specific |
|
1219 switch(aTC) |
|
1220 { |
|
1221 case ETestSequence13: |
|
1222 case ETestSequence15: |
|
1223 case ETestSequence16: |
|
1224 case ETestTooBigSmsSubmit7bit: |
|
1225 return 0xF0; // GSM 7 bit default alphabet + Class 0 |
|
1226 |
|
1227 default: |
|
1228 return 0xF4; // 8-bit + Class 0 |
|
1229 } |
|
1230 } |
|
1231 |
|
1232 /** |
|
1233 * Given a testcase returns corresponding TP-User-Data-Length value |
|
1234 * that should be used in the testcase |
|
1235 * @param aTC testcase identifier |
|
1236 * @return TP-UDL value |
|
1237 */ |
|
1238 TUint8 CCSatSendSMSFU::UserDataLength(TSendSmTC aTC) |
|
1239 { |
|
1240 switch(aTC) |
|
1241 { |
|
1242 case ETestSequence12: |
|
1243 case ETestRelativeVPFPacked: |
|
1244 case ETestEnchancedVPFPacked: |
|
1245 case ETestAbsoluteVPFPacked: |
|
1246 return KSendSmString8().Length(); |
|
1247 |
|
1248 case ETestSequence13: |
|
1249 return KShortMessageString8().Length(); |
|
1250 |
|
1251 case ETestSequence14: |
|
1252 case ETestSequence15: |
|
1253 return KLongUserDataString8().Length(); |
|
1254 |
|
1255 case ETestSequence16: |
|
1256 return KSingleSpaceUserData8().Length(); |
|
1257 |
|
1258 default: |
|
1259 return KTestMessageString8().Length(); |
|
1260 } |
|
1261 } |
|
1262 |
|
1263 /** |
|
1264 * Given a testcase returns corresponding TP-User-Data value |
|
1265 * that should be used in the testcase |
|
1266 * @param aTC testcase identifier |
|
1267 * @return a reference to a descriptor containing TP-UD |
|
1268 */ |
|
1269 const TDesC8& CCSatSendSMSFU::UserData(TSendSmTC aTC) |
|
1270 { |
|
1271 switch(aTC) |
|
1272 { |
|
1273 case ETestSequence12: |
|
1274 case ETestRelativeVPFPacked: |
|
1275 case ETestEnchancedVPFPacked: |
|
1276 case ETestAbsoluteVPFPacked: |
|
1277 return KSendSmString8(); |
|
1278 |
|
1279 case ETestSequence13: |
|
1280 // return GSM 7 bit encoded string |
|
1281 return KShortMessageStringGSM7(); |
|
1282 |
|
1283 case ETestSequence14: |
|
1284 return KLongUserDataString8(); |
|
1285 |
|
1286 case ETestSequence15: |
|
1287 return KLongUserDataStringGSM7(); |
|
1288 |
|
1289 case ETestSequence16: |
|
1290 return KSingleSpaceUserData8(); |
|
1291 |
|
1292 default: |
|
1293 return KTestMessageString8(); |
|
1294 } |
|
1295 } |
|
1296 |
|
1297 /** |
|
1298 * Given a testcase returns corresponding command qualifier |
|
1299 * that should be used in the testcase |
|
1300 * @param aTC testcase identifier |
|
1301 * @return command qualifier value |
|
1302 */ |
|
1303 TUint8 CCSatSendSMSFU::CommandQualifier(TSendSmTC aTC) |
|
1304 { |
|
1305 // possible "command qualifier" values for "SEND SHORT MESSAGE" are |
|
1306 // 0 = packing not required; |
|
1307 // 1 = SMS packing by the ME required. |
|
1308 return static_cast<TUint8>(PackingIsUsed(aTC)); |
|
1309 } |
|
1310 |
|
1311 /** |
|
1312 * returns ETrue if alpha identifier is used in a given testcase |
|
1313 * @param aTC testcase identifier |
|
1314 * @return ETrue if alpha identifier is used |
|
1315 */ |
|
1316 TBool CCSatSendSMSFU::AlphaIdIsUsed(TSendSmTC aTC) |
|
1317 { |
|
1318 TBool result = ETrue; |
|
1319 if(aTC == ETestSequence18) |
|
1320 { |
|
1321 result = EFalse; |
|
1322 } |
|
1323 return result; |
|
1324 } |
|
1325 |
|
1326 /** |
|
1327 * Given a testcase returns corresponding alpha identifier |
|
1328 * that should be used in the testcase |
|
1329 * @param aTC testcase identifier |
|
1330 * @return a reference to a descriptor containing alpha identifier |
|
1331 */ |
|
1332 const TDesC8& CCSatSendSMSFU::AlphaId(TSendSmTC aTC) |
|
1333 { |
|
1334 switch(aTC) |
|
1335 { |
|
1336 case ETestSequence31A: |
|
1337 case ETestSequence31B: |
|
1338 return KNoIconString8(); |
|
1339 |
|
1340 case ETestSequence13: |
|
1341 return KShortMessageString8(); |
|
1342 |
|
1343 case ETestSequence14: |
|
1344 return KSequence14AlphaString8(); |
|
1345 |
|
1346 case ETestSequence15: |
|
1347 return KSequence15AlphaString8(); |
|
1348 |
|
1349 case ETestSequence16: |
|
1350 return KSequence16AlphaString8(); |
|
1351 |
|
1352 case ETestSequence17: |
|
1353 return KNullDesC8(); |
|
1354 |
|
1355 default: |
|
1356 return KSendSmString8(); |
|
1357 } |
|
1358 } |
|
1359 |
|
1360 /** |
|
1361 * Given a testcase returns an alpha identifier |
|
1362 * that should be returned by RSat API |
|
1363 * @param aTC testcase identifier |
|
1364 * @return a reference to a descriptor containing expected alpha identifier |
|
1365 */ |
|
1366 const TDesC& CCSatSendSMSFU::ExpectedAlphaId(TSendSmTC aTC) |
|
1367 { |
|
1368 switch(aTC) |
|
1369 { |
|
1370 case ETestSequence31A: |
|
1371 case ETestSequence31B: |
|
1372 return KNoIconString16(); |
|
1373 |
|
1374 case ETestSequence13: |
|
1375 return KShortMessageString16(); |
|
1376 |
|
1377 case ETestSequence14: |
|
1378 return KSequence14AlphaString16(); |
|
1379 |
|
1380 case ETestSequence15: |
|
1381 return KSequence15AlphaString16(); |
|
1382 |
|
1383 case ETestSequence16: |
|
1384 return KSequence16AlphaString16(); |
|
1385 |
|
1386 case ETestSequence17: |
|
1387 return KNullDesC(); |
|
1388 |
|
1389 default: |
|
1390 return KSendSmString16(); |
|
1391 } |
|
1392 } |
|
1393 |
|
1394 /** |
|
1395 * Given a testcase returns alpha identifier status |
|
1396 * that should be returned by RSat API |
|
1397 * Should be called only if AlphaIdIsUsed() returns ETrue |
|
1398 * @param aTC testcase identifier |
|
1399 * @return expected alpha identifier status |
|
1400 */ |
|
1401 RSat::TAlphaIdStatus CCSatSendSMSFU::ExpectedAlphaIdStatus(TSendSmTC aTC) |
|
1402 { |
|
1403 __ASSERT_ALWAYS(AlphaIdIsUsed(aTC),User::Invariant()); |
|
1404 RSat::TAlphaIdStatus status = RSat::EAlphaIdProvided; |
|
1405 if(aTC == ETestSequence17) |
|
1406 { |
|
1407 status = RSat::EAlphaIdNull; |
|
1408 } |
|
1409 return status; |
|
1410 } |
|
1411 |
|
1412 /** |
|
1413 * Returns ETrue if address TLV is completely initialized for a given testcase |
|
1414 * @param aTC testcase identifier |
|
1415 * @return ETrue if TLV is completely initialized |
|
1416 */ |
|
1417 TBool CCSatSendSMSFU::CompleteAddressIsUsed(TSendSmTC aTC) |
|
1418 { |
|
1419 TBool result = ETrue; |
|
1420 if(aTC == ETestSequence16 || aTC == ETestMissingAddressType || aTC == ETestMissingDiallingNumber) |
|
1421 { |
|
1422 result = EFalse; |
|
1423 } |
|
1424 return result; |
|
1425 } |
|
1426 |
|
1427 /** |
|
1428 * Given a testcase returns a numbering plan that should be returned by RSat API |
|
1429 * @param aTC testcase identifier |
|
1430 * @return a numbering plan |
|
1431 */ |
|
1432 RSat::TNumberingPlan CCSatSendSMSFU::ExpectedNumberPlan(TSendSmTC aTC) |
|
1433 { |
|
1434 if(CompleteAddressIsUsed(aTC)) |
|
1435 { |
|
1436 // All "SEND SHORT MESSAGE" test sequences listed in 3GPP TS 31.124 |
|
1437 // except 1.6 are using this NPI |
|
1438 return RSat::EIsdnNumberPlan; |
|
1439 } |
|
1440 |
|
1441 if(aTC == ETestSequence16) |
|
1442 { |
|
1443 // Address TLV is omitted in this test |
|
1444 return RSat::ENumberingPlanNotSet; |
|
1445 } |
|
1446 |
|
1447 // aTC is either ETestMissingAddressType or ETestMissingDiallingNumber |
|
1448 return RSat::EUnknownNumberingPlan; |
|
1449 } |
|
1450 |
|
1451 /** |
|
1452 * Given a testcase returns a type of a dialling number that should be returned by RSat API |
|
1453 * @param aTC testcase identifier |
|
1454 * @return expected TON value |
|
1455 */ |
|
1456 RSat::TTypeOfNumber CCSatSendSMSFU::ExpectedTypeOfNumber(TSendSmTC aTC) |
|
1457 { |
|
1458 if(CompleteAddressIsUsed(aTC)) |
|
1459 { |
|
1460 // All "SEND SHORT MESSAGE" test sequences listed in 3GPP TS 31.124 |
|
1461 // except 1.6 are using this TON |
|
1462 return RSat::EInternationalNumber; |
|
1463 } |
|
1464 |
|
1465 if(aTC == ETestSequence16) |
|
1466 { |
|
1467 // Address TLV is omitted in this test |
|
1468 return RSat::ETypeOfNumberNotSet; |
|
1469 } |
|
1470 |
|
1471 // aTC is either ETestMissingAddressType or ETestMissingDiallingNumber |
|
1472 return RSat::EUnknownNumber; |
|
1473 } |
|
1474 |
|
1475 /** |
|
1476 * Returns ETrue if the given testcase is icon-related |
|
1477 * @param aTC testcase identifier |
|
1478 * @return ETrue is the testcase is icon-related |
|
1479 */ |
|
1480 TBool CCSatSendSMSFU::IsIconRelatedTC(TSendSmTC aTC) |
|
1481 { |
|
1482 TBool result = EFalse; |
|
1483 if( aTC == ETestSequence31A || |
|
1484 aTC == ETestSequence31B || |
|
1485 aTC == ETestSequence32A || |
|
1486 aTC == ETestSequence32B ) |
|
1487 { |
|
1488 result = ETrue; |
|
1489 } |
|
1490 return result; |
|
1491 } |
|
1492 |
|
1493 /** |
|
1494 * Given a testcase returns corresponding TLV tag for icon data |
|
1495 * that should be used in the testcase |
|
1496 * @param aTC testcase identifier |
|
1497 * @return TLV tag value |
|
1498 */ |
|
1499 TUint8 CCSatSendSMSFU::IconTlvTag(TSendSmTC aTC) |
|
1500 { |
|
1501 TUint8 tag; |
|
1502 if(aTC == ETestSequence31A || aTC == ETestSequence31B) |
|
1503 { |
|
1504 tag = KTestIconIdentifierTag; |
|
1505 } |
|
1506 else |
|
1507 { |
|
1508 tag = KTlvIconIdentifierTag; |
|
1509 } |
|
1510 return tag; |
|
1511 } |
|
1512 |
|
1513 /** |
|
1514 * Given a testcase returns corresponding icon qualifier |
|
1515 * that should be used in the testcase |
|
1516 * @param aTC testcase identifier |
|
1517 * @return icon qualifier |
|
1518 */ |
|
1519 TUint8 CCSatSendSMSFU::IconQualifier(TSendSmTC aTC) |
|
1520 { |
|
1521 TUint quailfier; |
|
1522 if(aTC == ETestSequence31A || aTC == ETestSequence31B) |
|
1523 { |
|
1524 quailfier = 0; // "self-explanatory" |
|
1525 } |
|
1526 else |
|
1527 { |
|
1528 quailfier = 1; // "not self-explanatory" |
|
1529 } |
|
1530 return quailfier; |
|
1531 } |
|
1532 |
|
1533 /** |
|
1534 * Given a testcase returns an icon qualifier that is expected to be |
|
1535 * returned by RSat API |
|
1536 * @param aTC testcase identifier |
|
1537 * @return expected icon qualifier |
|
1538 */ |
|
1539 RSat::TIconQualifier CCSatSendSMSFU::ExpectedIconQualifier(TSendSmTC aTC) |
|
1540 { |
|
1541 RSat::TIconQualifier quailfier; |
|
1542 if(aTC == ETestSequence31A || aTC == ETestSequence31B) |
|
1543 { |
|
1544 quailfier = RSat::ESelfExplanatory; |
|
1545 } |
|
1546 else |
|
1547 { |
|
1548 quailfier = RSat::ENotSelfExplanatory; |
|
1549 } |
|
1550 return quailfier; |
|
1551 } |
|
1552 |
|
1553 /** |
|
1554 * Given a testcase fills RSat::TSendSmRspV1 appropriately |
|
1555 * @param aTC testcase identifier |
|
1556 * @param aRsp a response to fill |
|
1557 */ |
|
1558 void CCSatSendSMSFU::FillResponse(RSat::TSendSmRspV1& aRsp,TSendSmTC aTC) |
|
1559 { |
|
1560 aRsp.SetPCmdNumber(KTestPCmdNumber); |
|
1561 aRsp.iInfoType = RSat::KNoAdditionalInfo; |
|
1562 |
|
1563 switch(aTC) |
|
1564 { |
|
1565 case ETestSequence31B: |
|
1566 case ETestSequence32B: |
|
1567 aRsp.iGeneralResult = RSat::KSuccessRequestedIconNotDisplayed; |
|
1568 break; |
|
1569 |
|
1570 case ETestTooBigSmsSubmit7bit: |
|
1571 case ETestTooBigSmsSubmit8bit: |
|
1572 case ETestTooBigSmsSubmit7bitPacked: |
|
1573 case ETestTooBigSmsSubmit8bitPacked: |
|
1574 case ETestTooBigSmsCommand: |
|
1575 aRsp.iGeneralResult = RSat::KCmdDataNotUnderstood; |
|
1576 break; |
|
1577 |
|
1578 case ETestMissingSmsTpdu: |
|
1579 aRsp.iGeneralResult = RSat::KErrorRequiredValuesMissing; |
|
1580 break; |
|
1581 |
|
1582 case ETestUnsolictedCompletion: |
|
1583 aRsp.iGeneralResult = RSat::KMeUnableToProcessCmd; |
|
1584 aRsp.iInfoType = RSat::KMeProblem; |
|
1585 aRsp.iAdditionalInfo.Append(0); |
|
1586 break; |
|
1587 |
|
1588 default: |
|
1589 aRsp.iGeneralResult = RSat::KSuccess; |
|
1590 } |
|
1591 } |
|
1592 |
|
1593 /** |
|
1594 * Given a testcase creates appropriate "SMS-SUBMIT" TPDU |
|
1595 * @param aTC testcase identifier |
|
1596 * @param aTpdu a TPDU to create |
|
1597 */ |
|
1598 void CCSatSendSMSFU::CreateSmsSubmitTpdu(TTpdu& aTpdu, TSendSmTC aTC) |
|
1599 { |
|
1600 // See 3GPP TS 23.040 v8.2.0 clause 9.2.2.2 for details |
|
1601 |
|
1602 // TP-MTI (TP-Message-Type-Indicator, first 2 bits) |
|
1603 // Possible values: |
|
1604 // 0x00 (00) SMS-DELIVER (in the direction SC(i.e."Service Center") to MS(i.e."Mobile Station")) |
|
1605 // 0x00 (00) SMS-DELIVER REPORT (in the direction MS to SC) |
|
1606 // 0x02 (10) SMS-STATUS-REPORT (in the direction SC to MS) |
|
1607 // 0x02 (10) SMS-COMMAND (in the direction MS to SC) |
|
1608 // 0x01 (01) SMS-SUBMIT (in the direction MS to SC) |
|
1609 // 0x01 (01) SMS-SUBMIT-REPORT (in the direction SC to MS) |
|
1610 // 0x03 (11) Reserved |
|
1611 TUint8 tpduProtocolByte = 0x01; // SMS-SUBMIT |
|
1612 |
|
1613 // TP-VPF (TP-Validity-Period-Format, 4-th and 5-th bits) |
|
1614 // Parameter indicating whether or not the TP-VP field is present |
|
1615 // Possible values: |
|
1616 // 0x00 (00) TP-VP field not present |
|
1617 // 0x02 (10) TP-VP field present - relative format |
|
1618 // 0x01 (01) TP-VP field present - enhanced format |
|
1619 // 0x03 (11) TP-VP field present - absolute format |
|
1620 const TUint8 KValidityPeriodFormat = ValidityPeriodFormat(aTC); |
|
1621 tpduProtocolByte |= KValidityPeriodFormat; |
|
1622 |
|
1623 aTpdu.Append(tpduProtocolByte); |
|
1624 |
|
1625 // TP-MR (TP-Message-Reference) |
|
1626 aTpdu.Append(0x00); |
|
1627 |
|
1628 // TP-DA (TP-Destination-Address) |
|
1629 const TDesC8& destinationAddress = DestinationAddress(aTC); |
|
1630 //Number of semi-octets |
|
1631 aTpdu.Append(destinationAddress.Length()); |
|
1632 //Type of address |
|
1633 aTpdu.Append(KTestTypeOfAddress); |
|
1634 // Address value |
|
1635 TBuf8<KMaxAddressLength >> 1> bcdAddress; |
|
1636 TSatUtility::AsciiToBCD(destinationAddress,bcdAddress); |
|
1637 aTpdu.Append(bcdAddress); |
|
1638 |
|
1639 // TP-PID (TP-Protocol-Identifier) |
|
1640 aTpdu.Append(KShortMessageType0); |
|
1641 |
|
1642 // TP-DCS (TP-Data-Coding Scheme) |
|
1643 aTpdu.Append(DataCodingScheme(aTC)); |
|
1644 |
|
1645 // TP-VP (TP-Validity-Period) |
|
1646 // Note: there is no need to set any meaningfull TP-VP values. |
|
1647 // The only thing SAT TSY cares about is TP-VP's length |
|
1648 if(KValidityPeriodFormat == KSmsVPFRelative) |
|
1649 { |
|
1650 // 1-byte TP-VP |
|
1651 aTpdu.Append(KFakeRelativeValidityValue); |
|
1652 } |
|
1653 else if(KValidityPeriodFormat == KSmsVPFAbsolute || |
|
1654 KValidityPeriodFormat == KSmsVPFEnhanced) |
|
1655 { |
|
1656 // 7-bytes TP-VP |
|
1657 aTpdu.Append(KFakeAbsoluteOrEnchancedValidityValue); |
|
1658 } |
|
1659 |
|
1660 // TP-UDL (TP-User-Data-Length) |
|
1661 aTpdu.Append(UserDataLength(aTC)); |
|
1662 |
|
1663 // TP-UD (TP-User-Data) |
|
1664 aTpdu.Append(UserData(aTC)); |
|
1665 } |
|
1666 |
|
1667 /** |
|
1668 * Creates simple "SMS-COMMAND" TPDU |
|
1669 * @param aTpdu a TPDU to create |
|
1670 */ |
|
1671 void CCSatSendSMSFU::CreateSmsCommandTpdu(TTpdu& aTpdu) |
|
1672 { |
|
1673 // See 3GPP TS 23.040 v8.2.0 clause 9.2.2.4 for details |
|
1674 |
|
1675 // set TP-MTI to "SMS-COMMAND", set TP-UDHI and TP-SRR to zero |
|
1676 TUint8 tpduProtocolByte = 0x02; |
|
1677 aTpdu.Append(tpduProtocolByte); |
|
1678 |
|
1679 // TP-MR (TP-Message-Reference) |
|
1680 aTpdu.Append(0x00); |
|
1681 |
|
1682 // TP-PID (TP-Protocol-Identifier) |
|
1683 aTpdu.Append(KShortMessageType0); |
|
1684 |
|
1685 // TP-CT (TP-Command-Type) |
|
1686 aTpdu.Append(0x01); // Cancel Status Report Request relating to previously submitted short message |
|
1687 |
|
1688 // TP-MN (TP-Message-Number) |
|
1689 aTpdu.Append(0x00); |
|
1690 |
|
1691 // TP-DA (TP-Destination-Address) |
|
1692 //Number of semi-octets |
|
1693 aTpdu.Append(KDestinationAddressString8().Length()); |
|
1694 //Type of address |
|
1695 aTpdu.Append(KTestTypeOfAddress); |
|
1696 // Address value |
|
1697 TBuf8<KMaxAddressLength >> 1> bcdAddress; |
|
1698 TSatUtility::AsciiToBCD(KDestinationAddressString8,bcdAddress); |
|
1699 aTpdu.Append(bcdAddress); |
|
1700 |
|
1701 // TP-CDL (TP-Command-Data-Length) |
|
1702 aTpdu.Append(0x00); |
|
1703 } |
|
1704 |
|
1705 /** |
|
1706 * Given a testcase creates SMS TPDU with too big TP-UDL or TP-CDL value |
|
1707 * @param aTC testcase identifier |
|
1708 * @param aTpdu a TPDU to create |
|
1709 */ |
|
1710 void CCSatSendSMSFU::CreateCorruptedSmsTpdu(TTpdu& aTpdu, TSendSmTC aTC) |
|
1711 { |
|
1712 TUint8 smsType; |
|
1713 if(aTC == ETestTooBigSmsCommand) |
|
1714 { |
|
1715 smsType = 0x02; //SMS-COMMAND |
|
1716 } |
|
1717 else |
|
1718 { |
|
1719 smsType = 0x01; //SMS-SUBMIT |
|
1720 } |
|
1721 aTpdu.Append(smsType); |
|
1722 |
|
1723 // TP-MR (TP-Message-Reference) |
|
1724 aTpdu.Append(0x00); |
|
1725 |
|
1726 if(aTC == ETestTooBigSmsCommand) |
|
1727 { |
|
1728 // TP-PID (TP-Protocol-Identifier) |
|
1729 aTpdu.Append(KShortMessageType0); |
|
1730 |
|
1731 // TP-CT (TP-Command-Type) |
|
1732 aTpdu.Append(0x01); // Cancel Status Report Request relating to previously submitted short message |
|
1733 |
|
1734 // TP-MN (TP-Message-Number) |
|
1735 aTpdu.Append(0x00); |
|
1736 } |
|
1737 |
|
1738 // TP-DA (TP-Destination-Address) |
|
1739 //Number of semi-octets |
|
1740 aTpdu.Append(KDestinationAddressString8().Length()); |
|
1741 //Type of address |
|
1742 aTpdu.Append(KTestTypeOfAddress); |
|
1743 // Address value |
|
1744 TBuf8<KMaxAddressLength >> 1> bcdAddress; |
|
1745 TSatUtility::AsciiToBCD(KDestinationAddressString8,bcdAddress); |
|
1746 aTpdu.Append(bcdAddress); |
|
1747 |
|
1748 if(aTC != ETestTooBigSmsCommand) |
|
1749 { |
|
1750 // TP-PID (TP-Protocol-Identifier) |
|
1751 aTpdu.Append(KShortMessageType0); |
|
1752 |
|
1753 // TP-DCS (TP-Data-Coding Scheme) |
|
1754 aTpdu.Append(DataCodingScheme(aTC)); |
|
1755 } |
|
1756 |
|
1757 // TP-CDL (TP-Command-Data-Length) / TP-UDL (TP-User-Data-Length) |
|
1758 aTpdu.Append(KSmsMaxSize + 1); |
|
1759 } |
|
1760 |
|
1761 /** |
|
1762 * Given a testcase creates appropriate SMS TPDU |
|
1763 * @param aTC testcase identifier |
|
1764 * @param aTpdu a TPDU to create |
|
1765 */ |
|
1766 void CCSatSendSMSFU::CreateSmsTpdu(TTpdu& aTpdu, TSendSmTC aTC) |
|
1767 { |
|
1768 switch(aTC) |
|
1769 { |
|
1770 case ETestSmsCommand: |
|
1771 CreateSmsCommandTpdu(aTpdu); |
|
1772 break; |
|
1773 |
|
1774 case ETestTooBigSmsSubmit7bit: |
|
1775 case ETestTooBigSmsSubmit8bit: |
|
1776 case ETestTooBigSmsSubmit7bitPacked: |
|
1777 case ETestTooBigSmsSubmit8bitPacked: |
|
1778 case ETestTooBigSmsCommand: |
|
1779 CreateCorruptedSmsTpdu(aTpdu,aTC); |
|
1780 break; |
|
1781 |
|
1782 default: |
|
1783 CreateSmsSubmitTpdu(aTpdu,aTC); |
|
1784 } |
|
1785 } |
|
1786 |
|
1787 /** |
|
1788 * Given a testcase and SMS TPDU creates appropriate "SEND SHORT MESSAGE" TLV data |
|
1789 * @param aTlv a TLV to create |
|
1790 * @param aTpdu SMS TPDU |
|
1791 * @param aTC testcase identifier |
|
1792 */ |
|
1793 const TDesC8& CCSatSendSMSFU::CreateSendSmTlv(TTlvBase& aTlv, const TTpdu& aTpdu, TSendSmTC aTC) |
|
1794 { |
|
1795 aTlv.Begin(KBerTlvProactiveSimCommandTag); |
|
1796 |
|
1797 // ---------------- |
|
1798 // command details |
|
1799 // ---------------- |
|
1800 aTlv.AddTag(KTestCommandDetailsTag); |
|
1801 aTlv.AddByte(KTestPCmdNumber); |
|
1802 aTlv.AddByte(KSendShortMessage); |
|
1803 aTlv.AddByte(CommandQualifier(aTC)); |
|
1804 |
|
1805 // ------------------ |
|
1806 // device identities |
|
1807 // ------------------ |
|
1808 aTlv.AddTag(KTestDeviceIdentityTag); |
|
1809 aTlv.AddByte(KSim); |
|
1810 aTlv.AddByte(KNetwork); |
|
1811 |
|
1812 // --------------------------- |
|
1813 // alpha identifier (optional) |
|
1814 // --------------------------- |
|
1815 if(AlphaIdIsUsed(aTC)) |
|
1816 { |
|
1817 aTlv.AddTag(KTestAlphaIdentifierTag); |
|
1818 aTlv.AddData(AlphaId(aTC)); |
|
1819 } |
|
1820 |
|
1821 // ------------------ |
|
1822 // address (optional) |
|
1823 // ------------------ |
|
1824 if(CompleteAddressIsUsed(aTC)) |
|
1825 { |
|
1826 // add fully initalized address TLV |
|
1827 aTlv.AddTag(KTestAddressTag); |
|
1828 aTlv.AddByte(KTestTypeOfAddress); |
|
1829 |
|
1830 // Dialing number string |
|
1831 TBuf8<RSat::KMaxMobileTelNumberSize >> 1> dialingNumberString; |
|
1832 TSatUtility::AsciiToBCD(KDialingNumberString8,dialingNumberString); |
|
1833 |
|
1834 aTlv.AddData(dialingNumberString); |
|
1835 } |
|
1836 else |
|
1837 { |
|
1838 if(aTC == ETestMissingAddressType || aTC == ETestMissingDiallingNumber) |
|
1839 { |
|
1840 // add partially initialized address TLV |
|
1841 // first add the tag ... |
|
1842 aTlv.AddTag(KTestAddressTag); |
|
1843 if(aTC == ETestMissingDiallingNumber) |
|
1844 { |
|
1845 // ... now add NPI and TON but not the dialling number |
|
1846 aTlv.AddByte(KTestTypeOfAddress); |
|
1847 } |
|
1848 } |
|
1849 } |
|
1850 |
|
1851 if(aTC != ETestMissingSmsTpdu) |
|
1852 { |
|
1853 // -------- |
|
1854 // SMS TPDU |
|
1855 // -------- |
|
1856 aTlv.AddTag(KTestSmsTpduTag); |
|
1857 aTlv.AddData(aTpdu); |
|
1858 |
|
1859 // --------------- |
|
1860 // Icon identifier |
|
1861 // --------------- |
|
1862 if(IsIconRelatedTC(aTC)) |
|
1863 { |
|
1864 aTlv.AddTag(IconTlvTag(aTC)); |
|
1865 aTlv.AddByte(IconQualifier(aTC)); |
|
1866 aTlv.AddByte(KTestIconIdentifier); |
|
1867 } |
|
1868 } |
|
1869 |
|
1870 const TDesC8& result = aTlv.End(); |
|
1871 |
|
1872 return result; |
|
1873 } |
|
1874 |
|
1875 /** |
|
1876 * Given a testcase and filled RSat::TSendSmRspV1 structure creates appropriate "TERMINAL RESPONSE" TLV |
|
1877 * @param aTlv a TLV to create |
|
1878 * @param aCommandQualifier a command qualifer to be placed to TLV |
|
1879 * @param aRsp terminal response data |
|
1880 */ |
|
1881 const TDesC8& CCSatSendSMSFU::CreateSendSmTerminalResponseTlv(TTlvBase& aTlv, |
|
1882 TUint8 aCommandQualifier, |
|
1883 const RSat::TSendSmRspV1& aRsp) |
|
1884 { |
|
1885 // ---------------- |
|
1886 // command details |
|
1887 // ---------------- |
|
1888 aTlv.AddTag(KTestCommandDetailsTag); |
|
1889 aTlv.AddByte(KTestPCmdNumber); |
|
1890 aTlv.AddByte(KSendShortMessage); |
|
1891 aTlv.AddByte(aCommandQualifier); |
|
1892 |
|
1893 // ------------------ |
|
1894 // device identities |
|
1895 // ------------------ |
|
1896 aTlv.AddTag(KTestDeviceIdentityTag); |
|
1897 aTlv.AddByte(KMe); |
|
1898 aTlv.AddByte(KSim); |
|
1899 |
|
1900 // ------------------ |
|
1901 // result |
|
1902 // ------------------ |
|
1903 aTlv.AddTag(KTestResultTag); |
|
1904 aTlv.AddByte(aRsp.iGeneralResult); |
|
1905 if(aRsp.iInfoType != RSat::KNoAdditionalInfo ) |
|
1906 { |
|
1907 TBuf8<RSat::KAdditionalInfoMaxSize> info; |
|
1908 info.Copy(aRsp.iAdditionalInfo); |
|
1909 aTlv.AddData(info); |
|
1910 } |
|
1911 |
|
1912 const TDesC8& result = aTlv.GetDataWithoutTopLevelTag(); |
|
1913 |
|
1914 return result; |
|
1915 } |
|
1916 |