|
1 // Copyright (c) 1997-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 // This file implements various transmit tests. The scripts driven include new and old |
|
15 // pdu formats and existence and non-existence of prefixes and sca information. |
|
16 // See CDataCall.cpp for fully documented test scenario. |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file |
|
22 */ |
|
23 |
|
24 #include <e32test.h> |
|
25 #include <mmretrieve.h> |
|
26 #include <etelmm.h> |
|
27 #include "Te_LoopBackctxmess.h" |
|
28 #include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint |
|
29 |
|
30 |
|
31 // |
|
32 // Test-side class |
|
33 // With the assistance of the base class, this class must start the emulator |
|
34 // and drive the ETel API. |
|
35 // |
|
36 CTestDriveTxMess* CTestDriveTxMess::NewL(const TScriptList aScriptListEntry) |
|
37 { |
|
38 CTestDriveTxMess* aA = new (ELeave) CTestDriveTxMess(aScriptListEntry); |
|
39 CleanupStack::PushL(aA); |
|
40 aA->ConstructL(); |
|
41 CleanupStack::Pop(); |
|
42 return (aA); |
|
43 } |
|
44 |
|
45 CTestDriveTxMess::CTestDriveTxMess(const TScriptList aScriptListEntry) : |
|
46 iScriptListEntry(aScriptListEntry) |
|
47 {} |
|
48 |
|
49 CTestDriveTxMess::~CTestDriveTxMess() |
|
50 {} |
|
51 |
|
52 TInt CTestDriveTxMess::RunTestL() |
|
53 { |
|
54 iCurrentScript = iScriptListEntry; |
|
55 return (StartEmulatorL()); |
|
56 } |
|
57 |
|
58 TInt CTestDriveTxMess::DriveETelApiL() |
|
59 // |
|
60 // This function contains the real meat of the Client-side test code |
|
61 // |
|
62 { |
|
63 // Sending SMS in Multimode ETel API is not vastly different to the |
|
64 // GSM API version. There are slight differences because the TSms class |
|
65 // no longer exists. The TPDU data is split from the message attributes |
|
66 // and clients will have to create a descriptor to hold the TPDU in 8-bit |
|
67 // data format. The client will also create and populate an instance of a |
|
68 // "message attribute" class. There is only one method SendMessage in the |
|
69 // Multimode ETel API and this is the equivalent of RSmsMessaging::SendMessage |
|
70 // and RAdvGsmSmsMessaging:: SendAdvSmsMessage. The difference between the |
|
71 // two GSM versions is that the latter also returned the submit report for |
|
72 // the sent SMS. In Multimode ETel API, the client can ask for the submit |
|
73 // report by using the TMobileSmsSendAttributesV1 class within the |
|
74 // RMobileSmsMessaging::SendMessage. |
|
75 |
|
76 TRequestStatus reqStatus1; |
|
77 |
|
78 INFO_PRINTF1(_L("Opening SMS Messaging...\n")); |
|
79 RMobileSmsMessaging sms; |
|
80 TESTL(sms.Open(iPhone) == KErrNone); |
|
81 |
|
82 INFO_PRINTF1(_L("Initialising the Phone...\n")); |
|
83 |
|
84 RMobilePhone::TMMTableSettings tableSettings; |
|
85 tableSettings.iLocId=KInternetAccessPoint; |
|
86 RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings); |
|
87 iPhone.InitialiseMM(reqStatus1, tableSettingsPckg); |
|
88 |
|
89 User::WaitForRequest(reqStatus1); |
|
90 TESTL(reqStatus1 == KErrNone); |
|
91 |
|
92 // Successful send... |
|
93 TPtrC8 pduA(KTestTxPduA, sizeof(KTestTxPduA)); // has "SCA Prepended" set by default |
|
94 RMobileSmsMessaging::TMobileSmsSendAttributesV1 smsSendAttributes; |
|
95 |
|
96 // set the flags according to TMobileSmsAttributeFlags |
|
97 smsSendAttributes.iFlags = |
|
98 (RMobileSmsMessaging::KSmsDataFormat || |
|
99 RMobileSmsMessaging::KGsmServiceCentre || |
|
100 RMobileSmsMessaging::KRemotePartyInfo || |
|
101 RMobileSmsMessaging::KStorageLocation || |
|
102 RMobileSmsMessaging::KIncomingStatus || |
|
103 RMobileSmsMessaging::KMessageReference || |
|
104 RMobileSmsMessaging::KGsmSubmitReport || |
|
105 RMobileSmsMessaging::KMoreToSend); |
|
106 |
|
107 smsSendAttributes.iMore = EFalse; |
|
108 |
|
109 RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg smsSendAttributesPckg(smsSendAttributes); |
|
110 sms.SendMessage(reqStatus1, pduA, smsSendAttributesPckg); |
|
111 User::WaitForRequest(reqStatus1); |
|
112 TESTL(reqStatus1 == KErrNone); |
|
113 smsSendAttributes = smsSendAttributesPckg(); |
|
114 TESTL(smsSendAttributes.iMsgRef == KMsgRefA); |
|
115 INFO_PRINTF1(_L("Closing SMS Messaging...\n")); |
|
116 sms.Close(); |
|
117 User::After(1000000L); |
|
118 return (KErrNone); |
|
119 } |
|
120 |
|
121 // |
|
122 // Test New Standard PDU messages |
|
123 // |
|
124 CTestDriveTxNewStdMess* CTestDriveTxNewStdMess::NewL(const TScriptList aScriptListEntry) |
|
125 { |
|
126 CTestDriveTxNewStdMess* aA = new (ELeave) CTestDriveTxNewStdMess(aScriptListEntry); |
|
127 CleanupStack::PushL(aA); |
|
128 aA->ConstructL(); |
|
129 CleanupStack::Pop(); |
|
130 return (aA); |
|
131 } |
|
132 |
|
133 CTestDriveTxNewStdMess::CTestDriveTxNewStdMess(const TScriptList aScriptListEntry) : |
|
134 iScriptListEntry(aScriptListEntry) |
|
135 {} |
|
136 |
|
137 CTestDriveTxNewStdMess::~CTestDriveTxNewStdMess() |
|
138 {} |
|
139 |
|
140 TInt CTestDriveTxNewStdMess::RunTestL() |
|
141 { |
|
142 iCurrentScript = iScriptListEntry; |
|
143 return (StartEmulatorL()); |
|
144 } |
|
145 |
|
146 TInt CTestDriveTxNewStdMess::DriveETelApiL() |
|
147 // |
|
148 // This function contains the real meat of the Client-side test code |
|
149 // |
|
150 { |
|
151 TRequestStatus reqStatus; |
|
152 |
|
153 INFO_PRINTF1(_L("Initialising the Phone...\n")); |
|
154 |
|
155 RMobilePhone::TMMTableSettings tableSettings; |
|
156 tableSettings.iLocId=KInternetAccessPoint; |
|
157 RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings); |
|
158 iPhone.InitialiseMM(reqStatus , tableSettingsPckg); |
|
159 |
|
160 User::WaitForRequest(reqStatus); |
|
161 TESTL(reqStatus == KErrNone); |
|
162 |
|
163 INFO_PRINTF1(_L("Opening SMS Messaging...\n")); |
|
164 RMobileSmsMessaging sms; |
|
165 TESTL(sms.Open(iPhone) == KErrNone); |
|
166 |
|
167 TPtrC8 pduA(KTestTxPduA, sizeof(KTestTxPduA)); // has "SCA Prepended" set by default |
|
168 |
|
169 |
|
170 RMobileSmsMessaging::TMobileSmsSendAttributesV1 smsSendAttributes; |
|
171 |
|
172 // set the flags according to TMobileSmsAttributeFlags |
|
173 smsSendAttributes.iFlags = |
|
174 (RMobileSmsMessaging::KSmsDataFormat || |
|
175 RMobileSmsMessaging::KGsmServiceCentre || |
|
176 RMobileSmsMessaging::KRemotePartyInfo || |
|
177 RMobileSmsMessaging::KStorageLocation || |
|
178 RMobileSmsMessaging::KIncomingStatus || |
|
179 RMobileSmsMessaging::KMessageReference || |
|
180 RMobileSmsMessaging::KGsmSubmitReport || |
|
181 RMobileSmsMessaging::KMoreToSend); |
|
182 |
|
183 smsSendAttributes.iMore = EFalse; |
|
184 |
|
185 RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg smsSendAttributesPckg(smsSendAttributes); |
|
186 sms.SendMessage(reqStatus, pduA, smsSendAttributesPckg); |
|
187 User::WaitForRequest(reqStatus); |
|
188 TESTL(reqStatus == KErrNone); |
|
189 smsSendAttributes = smsSendAttributesPckg(); |
|
190 TESTL(smsSendAttributes.iMsgRef == KMsgRefA); |
|
191 |
|
192 |
|
193 INFO_PRINTF1(_L("Closing SMS Messaging...\n")); |
|
194 sms.Close(); |
|
195 return (KErrNone); |
|
196 } |
|
197 |
|
198 |
|
199 // |
|
200 // Test transmit with combination of SCA prefix on PDU, and setting of default SCA |
|
201 // |
|
202 CTestDriveTxWithScaCombo* CTestDriveTxWithScaCombo::NewL(const TScriptList aScriptListEntry,TBool aSendScaPrefix,TBool aSetDefaultSca,TBool aNewPduFormat) |
|
203 { |
|
204 CTestDriveTxWithScaCombo* aA = new (ELeave) CTestDriveTxWithScaCombo(aScriptListEntry,aSendScaPrefix,aSetDefaultSca,aNewPduFormat); |
|
205 CleanupStack::PushL(aA); |
|
206 aA->ConstructL(); |
|
207 CleanupStack::Pop(); |
|
208 return (aA); |
|
209 } |
|
210 |
|
211 CTestDriveTxWithScaCombo::CTestDriveTxWithScaCombo(const TScriptList aScriptListEntry,TBool aSendScaPrefix,TBool aSetDefaultSca,TBool aNewPduFormat) |
|
212 : iScriptListEntry(aScriptListEntry), |
|
213 iSendScaPrefix(aSendScaPrefix), |
|
214 iSetDefaultSca(aSetDefaultSca), |
|
215 iNewPduFormat(aNewPduFormat) |
|
216 {} |
|
217 |
|
218 CTestDriveTxWithScaCombo::~CTestDriveTxWithScaCombo() |
|
219 {} |
|
220 |
|
221 TInt CTestDriveTxWithScaCombo::RunTestL() |
|
222 { |
|
223 iCurrentScript = iScriptListEntry; |
|
224 return (StartEmulatorL()); |
|
225 } |
|
226 |
|
227 TInt CTestDriveTxWithScaCombo::DriveETelApiL() |
|
228 // |
|
229 // This function contains the real meat of the Client-side test code |
|
230 // |
|
231 { |
|
232 TRequestStatus reqStatus; |
|
233 |
|
234 INFO_PRINTF1(_L("Initialising the Phone...\n")); |
|
235 |
|
236 RMobilePhone::TMMTableSettings tableSettings; |
|
237 tableSettings.iLocId=KInternetAccessPoint; |
|
238 RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings); |
|
239 iPhone.InitialiseMM(reqStatus , tableSettingsPckg); |
|
240 |
|
241 User::WaitForRequest(reqStatus); |
|
242 TESTL(reqStatus == KErrNone); |
|
243 |
|
244 INFO_PRINTF1(_L("Opening SMS Messaging...\n")); |
|
245 RMobileSmsMessaging sms; |
|
246 TESTL(sms.Open(iPhone) == KErrNone); |
|
247 |
|
248 TPtrC8 pduA(KTestTxPduA, sizeof(KTestTxPduA)); // has "SCA Prepended" set by default |
|
249 |
|
250 TPtrC8 pduB(KTestTxPduB, sizeof(KTestTxPduB)); |
|
251 |
|
252 |
|
253 RMobileSmsMessaging::TMobileSmsSendAttributesV1 smsSendAttributes; |
|
254 |
|
255 // set the flags according to TMobileSmsAttributeFlags |
|
256 smsSendAttributes.iFlags = |
|
257 (RMobileSmsMessaging::KSmsDataFormat || |
|
258 RMobileSmsMessaging::KGsmServiceCentre || |
|
259 RMobileSmsMessaging::KRemotePartyInfo || |
|
260 RMobileSmsMessaging::KStorageLocation || |
|
261 RMobileSmsMessaging::KIncomingStatus || |
|
262 RMobileSmsMessaging::KMessageReference || |
|
263 RMobileSmsMessaging::KGsmSubmitReport || |
|
264 RMobileSmsMessaging::KMoreToSend); |
|
265 |
|
266 |
|
267 smsSendAttributes.iMore = EFalse; |
|
268 RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg smsSendAttributesPckg(smsSendAttributes); |
|
269 |
|
270 TRequestStatus reqStatus1; |
|
271 sms.SendMessage(reqStatus1, pduA, smsSendAttributesPckg); |
|
272 User::WaitForRequest(reqStatus1); |
|
273 TESTL(reqStatus1 == KErrNone); |
|
274 smsSendAttributes = smsSendAttributesPckg(); |
|
275 TESTL(smsSendAttributes.iMsgRef == KMsgRefA); |
|
276 |
|
277 // Another success... |
|
278 sms.SendMessage(reqStatus1, pduB, smsSendAttributesPckg); |
|
279 User::WaitForRequest(reqStatus1); |
|
280 TESTL(reqStatus1 == KErrNone); |
|
281 smsSendAttributes = smsSendAttributesPckg(); |
|
282 TESTL(smsSendAttributes.iMsgRef == KMsgRefB); |
|
283 |
|
284 |
|
285 INFO_PRINTF1(_L("Closing SMS Messaging...\n")); |
|
286 sms.Close(); |
|
287 return (KErrNone); |
|
288 } |
|
289 |
|
290 // |
|
291 // Test transmit with combination of SCA prefix on PDU, and setting of default SCA |
|
292 // |
|
293 CTestDriveTxRx* CTestDriveTxRx::NewL(const TScriptList aScriptListEntry) |
|
294 { |
|
295 CTestDriveTxRx* aA = new (ELeave) CTestDriveTxRx(aScriptListEntry); |
|
296 CleanupStack::PushL(aA); |
|
297 aA->ConstructL(); |
|
298 CleanupStack::Pop(); |
|
299 return (aA); |
|
300 } |
|
301 |
|
302 CTestDriveTxRx::CTestDriveTxRx(const TScriptList aScriptListEntry) |
|
303 : iScriptListEntry(aScriptListEntry) |
|
304 {} |
|
305 |
|
306 CTestDriveTxRx::~CTestDriveTxRx() |
|
307 {} |
|
308 |
|
309 TInt CTestDriveTxRx::RunTestL() |
|
310 { |
|
311 iCurrentScript = iScriptListEntry; |
|
312 return (StartEmulatorL()); |
|
313 } |
|
314 |
|
315 TInt CTestDriveTxRx::DriveETelApiL() |
|
316 // |
|
317 // This function contains the real meat of the Client-side test code |
|
318 // |
|
319 { |
|
320 |
|
321 TRequestStatus reqStatus1;//, reqStatus2; |
|
322 |
|
323 INFO_PRINTF1(_L("Initialising the Phone...\n")); |
|
324 |
|
325 RMobilePhone::TMMTableSettings tableSettings; |
|
326 tableSettings.iLocId=KInternetAccessPoint; |
|
327 RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings); |
|
328 iPhone.InitialiseMM(reqStatus1 , tableSettingsPckg); |
|
329 |
|
330 User::WaitForRequest(reqStatus1); |
|
331 TESTL(reqStatus1 == KErrNone); |
|
332 |
|
333 INFO_PRINTF1(_L("Opening SMS Messaging...\n")); |
|
334 RMobileSmsMessaging sms; |
|
335 TESTL(sms.Open(iPhone) == KErrNone); |
|
336 |
|
337 INFO_PRINTF1(_L("Closing SMS Messaging...\n")); |
|
338 sms.Close(); |
|
339 return (KErrNone); |
|
340 } |
|
341 |
|
342 |
|
343 // |
|
344 // Emulator-side class |
|
345 // With the assistance of the base class, this class must run the designated script |
|
346 // |
|
347 CTestTxMess* CTestTxMess::NewL(const TScript* aScript) |
|
348 { |
|
349 CTestTxMess* aA = new (ELeave) CTestTxMess(aScript); |
|
350 CleanupStack::PushL(aA); |
|
351 aA->ConstructL(); |
|
352 CleanupStack::Pop(); |
|
353 return (aA); |
|
354 } |
|
355 |
|
356 CTestTxMess* CTestTxMess::NewL(const TScript* aScript, const TInt aVarDelay) |
|
357 { |
|
358 CTestTxMess* aA = new(ELeave) CTestTxMess(aScript, aVarDelay); |
|
359 CleanupStack::PushL(aA); |
|
360 aA->ConstructL(); |
|
361 CleanupStack::Pop(); |
|
362 return (aA); |
|
363 } |
|
364 |
|
365 CTestTxMess::CTestTxMess(const TScript* aScript) : |
|
366 CATScriptEng(), iScript(aScript) |
|
367 {} |
|
368 |
|
369 CTestTxMess::CTestTxMess(const TScript* aScript, const TInt aVarDelay) : |
|
370 CATScriptEng(aVarDelay), iScript(aScript) |
|
371 {} |
|
372 |
|
373 void CTestTxMess::ConstructL() |
|
374 { |
|
375 CATScriptEng::ConstructL(); |
|
376 } |
|
377 |
|
378 CTestTxMess::~CTestTxMess() |
|
379 {} |
|
380 |
|
381 TInt CTestTxMess::Start() |
|
382 { |
|
383 StartScript(iScript); |
|
384 return (KErrNone); |
|
385 } |
|
386 |
|
387 void CTestTxMess::SpecificAlgorithmL(TInt /* aParam */) |
|
388 { |
|
389 } |
|
390 |
|
391 void CTestTxMess::Complete(TInt aError) |
|
392 { |
|
393 iReturnValue = aError; |
|
394 CActiveScheduler::Stop(); |
|
395 } |