24
|
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 |
// Tests the Sms functionality of the Basic MMTsy.
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "Te_Sms.h"
|
|
23 |
|
|
24 |
|
|
25 |
const TInt KOneSecond = 1000000;
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
CTestSendSms::CTestSendSms()
|
|
30 |
{
|
|
31 |
SetTestStepName(_L("TestSendSms"));
|
|
32 |
}
|
|
33 |
|
|
34 |
enum TVerdict CTestSendSms::doTestStepL()
|
|
35 |
{
|
|
36 |
SendSms();
|
|
37 |
|
|
38 |
return EPass;
|
|
39 |
}
|
|
40 |
|
|
41 |
CTestAckSmsStored::CTestAckSmsStored()
|
|
42 |
{
|
|
43 |
SetTestStepName(_L("TestAckSmsStored"));
|
|
44 |
}
|
|
45 |
|
|
46 |
enum TVerdict CTestAckSmsStored::doTestStepL()
|
|
47 |
/**
|
|
48 |
* This function Tests an API that should return
|
|
49 |
* KErrNotSupported
|
|
50 |
*/
|
|
51 |
{
|
|
52 |
TRequestStatus status;
|
|
53 |
TBuf8<400> buf;
|
|
54 |
TBuf8<400> *NULLbuf =NULL;
|
|
55 |
|
|
56 |
// Create a PDU
|
|
57 |
|
|
58 |
RMobilePhone::TMobileAddress addr;
|
|
59 |
addr.iTypeOfNumber=RMobilePhone::EInternationalNumber;
|
|
60 |
addr.iNumberPlan=RMobilePhone::EIsdnNumberPlan;
|
|
61 |
addr.iTelNumber.Copy(_L("44 7785 016 005"));
|
|
62 |
buf.Zero();
|
|
63 |
AppendAddressToAscii(buf,addr);
|
|
64 |
iSms.AckSmsStored(status, buf);
|
|
65 |
User::WaitForRequest(status);
|
|
66 |
if(status.Int() == KErrNotSupported)
|
|
67 |
{
|
|
68 |
iSms.AckSmsStored(status, *NULLbuf);
|
|
69 |
User::WaitForRequest(status);
|
|
70 |
TESTL(status.Int() == KErrNotSupported);
|
|
71 |
}
|
|
72 |
|
|
73 |
return TestStepResult();
|
|
74 |
}
|
|
75 |
|
|
76 |
CTestAckSmsStoredCancel::CTestAckSmsStoredCancel()
|
|
77 |
{
|
|
78 |
SetTestStepName(_L("TestAckSmsStoredCancel"));
|
|
79 |
}
|
|
80 |
|
|
81 |
enum TVerdict CTestAckSmsStoredCancel::doTestStepL()
|
|
82 |
/**
|
|
83 |
* This function Tests an API that should return
|
|
84 |
* KErrNotSupported
|
|
85 |
*/
|
|
86 |
{
|
|
87 |
// iSms.AckSmsStoredCancel(); // This API doesn't exist anymore
|
|
88 |
|
|
89 |
return EPass;
|
|
90 |
}
|
|
91 |
|
|
92 |
CTestNackSmsStored::CTestNackSmsStored()
|
|
93 |
{
|
|
94 |
SetTestStepName(_L("TestNackSmsStored"));
|
|
95 |
}
|
|
96 |
|
|
97 |
enum TVerdict CTestNackSmsStored::doTestStepL()
|
|
98 |
/**
|
|
99 |
* This function Tests an API that should return
|
|
100 |
* KErrNotSupported
|
|
101 |
*/
|
|
102 |
{
|
|
103 |
TRequestStatus status;
|
|
104 |
TBuf8<400> buf;
|
|
105 |
|
|
106 |
// Create a PDU
|
|
107 |
|
|
108 |
RMobilePhone::TMobileAddress addr;
|
|
109 |
addr.iTypeOfNumber=RMobilePhone::EInternationalNumber;
|
|
110 |
addr.iNumberPlan=RMobilePhone::EIsdnNumberPlan;
|
|
111 |
addr.iTelNumber.Copy(_L("44 7785 016 005"));
|
|
112 |
buf.Zero();
|
|
113 |
AppendAddressToAscii(buf,addr);
|
|
114 |
iSms.NackSmsStored(status, buf, KErrGsmRRInvalidMessage);
|
|
115 |
User::WaitForRequest(status);
|
|
116 |
TEST(status.Int() == KErrNotSupported);
|
|
117 |
|
|
118 |
return TestStepResult();
|
|
119 |
}
|
|
120 |
|
|
121 |
CTestNackSmsStoredCancel::CTestNackSmsStoredCancel()
|
|
122 |
{
|
|
123 |
SetTestStepName(_L("TestNackSmsStoredCancel"));
|
|
124 |
}
|
|
125 |
|
|
126 |
enum TVerdict CTestNackSmsStoredCancel::doTestStepL()
|
|
127 |
/**
|
|
128 |
* This function Tests an API that should return
|
|
129 |
* KErrNotSupported
|
|
130 |
*/
|
|
131 |
{
|
|
132 |
// iSms.NackSmsStoredCancel(); // API doesn't exist anymore
|
|
133 |
|
|
134 |
return EPass;
|
|
135 |
}
|
|
136 |
|
|
137 |
CTestAckSmsStoredWithResponse::CTestAckSmsStoredWithResponse()
|
|
138 |
{
|
|
139 |
SetTestStepName(_L("TestAckSmsStoredWithResponse"));
|
|
140 |
}
|
|
141 |
|
|
142 |
enum TVerdict CTestAckSmsStoredWithResponse::doTestStepL()
|
|
143 |
/**
|
|
144 |
* This function Tests an API that should return
|
|
145 |
* KErrNotSupported
|
|
146 |
*/
|
|
147 |
{
|
|
148 |
// iSms.AckSmsStoredWithResponse(); // API doesn't exist anymore
|
|
149 |
|
|
150 |
return EPass;
|
|
151 |
}
|
|
152 |
|
|
153 |
CTestAckSmsStoredWithResponseCancel::CTestAckSmsStoredWithResponseCancel()
|
|
154 |
{
|
|
155 |
SetTestStepName(_L("TestAckSmsStoredWithResponseCancel"));
|
|
156 |
}
|
|
157 |
|
|
158 |
enum TVerdict CTestAckSmsStoredWithResponseCancel::doTestStepL()
|
|
159 |
/**
|
|
160 |
* This function Tests an API that should return
|
|
161 |
* KErrNotSupported
|
|
162 |
*/
|
|
163 |
{
|
|
164 |
// iSms.AckSmsStoredWithResponseCancel(); // API doesn't exist anymore
|
|
165 |
|
|
166 |
return EPass;
|
|
167 |
}
|
|
168 |
|
|
169 |
CTestNackSmsStoredWithResponse::CTestNackSmsStoredWithResponse()
|
|
170 |
{
|
|
171 |
SetTestStepName(_L("TestNackSmsStoredWithResponse"));
|
|
172 |
}
|
|
173 |
|
|
174 |
enum TVerdict CTestNackSmsStoredWithResponse::doTestStepL()
|
|
175 |
/**
|
|
176 |
* This function Tests an API that should return
|
|
177 |
* KErrNotSupported
|
|
178 |
*/
|
|
179 |
{
|
|
180 |
// iSms.NackSmsStoredWithResponse(); // API doesn't exist anymore
|
|
181 |
|
|
182 |
return EPass;
|
|
183 |
}
|
|
184 |
|
|
185 |
CTestNackSmsStoredWithResponseCancel::CTestNackSmsStoredWithResponseCancel()
|
|
186 |
{
|
|
187 |
SetTestStepName(_L("TestNackSmsStoredWithResponseCancel"));
|
|
188 |
}
|
|
189 |
|
|
190 |
enum TVerdict CTestNackSmsStoredWithResponseCancel::doTestStepL()
|
|
191 |
/**
|
|
192 |
* This function Tests an API that should return
|
|
193 |
* KErrNotSupported
|
|
194 |
*/
|
|
195 |
{
|
|
196 |
// iSms.NackSmsStoredWithResponseCancel(); // API doesn't exist anymore
|
|
197 |
|
|
198 |
return EPass;
|
|
199 |
}
|
|
200 |
|
|
201 |
CTestResumeSmsReception::CTestResumeSmsReception()
|
|
202 |
{
|
|
203 |
SetTestStepName(_L("TestResumeSmsReception"));
|
|
204 |
}
|
|
205 |
|
|
206 |
enum TVerdict CTestResumeSmsReception::doTestStepL()
|
|
207 |
/**
|
|
208 |
* This function Tests an API that should return
|
|
209 |
* KErrNotSupported
|
|
210 |
*/
|
|
211 |
{
|
|
212 |
TRequestStatus status;
|
|
213 |
iSms.ResumeSmsReception(status);
|
|
214 |
User::WaitForRequest(status);
|
|
215 |
TESTL(status.Int() == KErrNotSupported);
|
|
216 |
|
|
217 |
return TestStepResult();
|
|
218 |
}
|
|
219 |
|
|
220 |
CTestNotifySmsEvent::CTestNotifySmsEvent()
|
|
221 |
{
|
|
222 |
SetTestStepName(_L("TestNotifySmsEvent"));
|
|
223 |
}
|
|
224 |
|
|
225 |
enum TVerdict CTestNotifySmsEvent::doTestStepL()
|
|
226 |
/**
|
|
227 |
* This function Tests an API that should return
|
|
228 |
* KErrNotSupported
|
|
229 |
*/
|
|
230 |
{
|
|
231 |
// iSms.NotifySmsEvent(); // API doesn't exist anymore
|
|
232 |
|
|
233 |
return EPass;
|
|
234 |
}
|
|
235 |
|
|
236 |
CTestNotifySmsEventCancel::CTestNotifySmsEventCancel()
|
|
237 |
{
|
|
238 |
SetTestStepName(_L("TestNotifySmsEventCancel"));
|
|
239 |
}
|
|
240 |
|
|
241 |
enum TVerdict CTestNotifySmsEventCancel::doTestStepL()
|
|
242 |
/**
|
|
243 |
* This function Tests an API that should return
|
|
244 |
* KErrNotSupported
|
|
245 |
*/
|
|
246 |
{
|
|
247 |
// iSms.NotifySmsEventCancel(); // API doesn't exist anymore
|
|
248 |
|
|
249 |
return EPass;
|
|
250 |
}
|
|
251 |
|
|
252 |
|
|
253 |
CTestGetCaps::CTestGetCaps()
|
|
254 |
{
|
|
255 |
SetTestStepName(_L("TestGetCaps"));
|
|
256 |
}
|
|
257 |
|
|
258 |
enum TVerdict CTestGetCaps::doTestStepL()
|
|
259 |
/**
|
|
260 |
* This function tests the capabilities API of the Messaging subssession.
|
|
261 |
*/
|
|
262 |
{
|
|
263 |
INFO_PRINTF1(_L("Get Capabilities."));
|
|
264 |
RMobileSmsMessaging::TMobileSmsCapsV1Pckg smsCapsPckg(iSmsCaps);
|
|
265 |
INFO_PRINTF1(_L(".."));
|
|
266 |
|
|
267 |
TESTL(iSms.GetCaps(smsCapsPckg)==KErrNone);
|
|
268 |
INFO_PRINTF1(_L("test(s) passed"));
|
|
269 |
|
|
270 |
return TestStepResult();
|
|
271 |
}
|
|
272 |
|
|
273 |
CTestSmspList::CTestSmspList()
|
|
274 |
{
|
|
275 |
SetTestStepName(_L("TestSmspList"));
|
|
276 |
}
|
|
277 |
|
|
278 |
enum TVerdict CTestSmspList::doTestStepL()
|
|
279 |
/**
|
|
280 |
* This function tests get/set service centre address
|
|
281 |
*/
|
|
282 |
{
|
|
283 |
INFO_PRINTF1(_L("Check TSY's SMSP capabilities.."));
|
|
284 |
if ((iSmsCaps.iSmsControl & RMobileSmsMessaging::KCapsGetSmspList) &&
|
|
285 |
(iSmsCaps.iSmsControl & RMobileSmsMessaging::KCapsSetSmspList))
|
|
286 |
{
|
|
287 |
INFO_PRINTF1(_L("Caps - KCapsGetSmspList supported"));
|
|
288 |
INFO_PRINTF1(_L("Caps - KCapsSetSmspList supported"));
|
|
289 |
RMobileSmsMessaging::TMobileSmspEntryV1 defaultSmspEntry;
|
|
290 |
RMobileSmsMessaging::TMobileSmspEntryV1 newSmspEntry;
|
|
291 |
RMobileSmsMessaging::TMobileSmspEntryV1 checkSmspEntry;
|
|
292 |
INFO_PRINTF1(_L("Retrieve default SMSP list"));
|
|
293 |
TRAPD(ret, GetSmspListL(defaultSmspEntry));
|
|
294 |
TESTL(ret == KErrNone);
|
|
295 |
INFO_PRINTF1(_L("Store new SMSP list"));
|
|
296 |
newSmspEntry.iValidParams = RMobileSmsMessaging::KSCAIncluded;
|
|
297 |
newSmspEntry.iServiceCentre.iTypeOfNumber=RMobilePhone::EInternationalNumber;
|
|
298 |
newSmspEntry.iServiceCentre.iNumberPlan=RMobilePhone:: EIsdnNumberPlan;
|
|
299 |
newSmspEntry.iServiceCentre.iTelNumber.Copy(_L("01632960000"));
|
|
300 |
TRAP(ret, SetSmspListL(newSmspEntry));
|
|
301 |
TESTL(ret == KErrNone);
|
|
302 |
INFO_PRINTF1(_L("Check SMSP list contains new entry"));
|
|
303 |
TRAP(ret, GetSmspListL(checkSmspEntry));
|
|
304 |
TESTL(ret == KErrNone);
|
|
305 |
INFO_PRINTF1(_L("Rewrite default SMSP list"));
|
|
306 |
TRAP(ret, SetSmspListL(defaultSmspEntry));
|
|
307 |
TESTL(ret == KErrNone);
|
|
308 |
INFO_PRINTF1(_L("Check SMSP list contains default entry"));
|
|
309 |
TRAP(ret, GetSmspListL(checkSmspEntry));
|
|
310 |
TESTL(ret == KErrNone);
|
|
311 |
}
|
|
312 |
|
|
313 |
return TestStepResult();
|
|
314 |
}
|
|
315 |
|
|
316 |
CTestMessageStoreInfo::CTestMessageStoreInfo()
|
|
317 |
{
|
|
318 |
SetTestStepName(_L("TestMessageStoreInfo"));
|
|
319 |
}
|
|
320 |
|
|
321 |
enum TVerdict CTestMessageStoreInfo::doTestStepL()
|
|
322 |
/**
|
|
323 |
* This function retrieves the number of message stores supported by the iPhone. It
|
|
324 |
* also gets the details of the supported message stores. It then gets and sets the
|
|
325 |
* Default Service Center Address (SCA) and performs some Cancel Requests.
|
|
326 |
*/
|
|
327 |
{
|
|
328 |
INFO_PRINTF1(_L("Test RMobileSmsMessaging::EnumerateMessageStores.."));
|
|
329 |
TInt ret=KErrNone;
|
|
330 |
TInt count=0;
|
|
331 |
TInt i;
|
|
332 |
ret=iSms.EnumerateMessageStores(count);
|
|
333 |
TEST_CHECKL(ret, KErrNone, _L("Error retrieving message store count"));
|
|
334 |
INFO_PRINTF2(_L("There are %d SMS message stores"), count);
|
|
335 |
INFO_PRINTF1(_L("Test RMobileSmsMessaging::GetMessageStoreInfo..."));
|
|
336 |
TRequestStatus reqStatus;
|
|
337 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1 smsInfo;
|
|
338 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg smsInfoPckg(smsInfo);
|
|
339 |
for (i=0; i<count; i++)
|
|
340 |
{
|
|
341 |
iSms.GetMessageStoreInfo(reqStatus, i, smsInfoPckg);
|
|
342 |
User::WaitForRequest(reqStatus);
|
|
343 |
TESTL(reqStatus==KErrNone);
|
|
344 |
TEST(smsInfo.iType==RMobilePhoneStore::EShortMessageStore);
|
|
345 |
// Print the result
|
|
346 |
INFO_PRINTF1(_L("Information retrieved about the message store"));
|
|
347 |
INFO_PRINTF2(_L("Name : %S"), &smsInfo.iName);
|
|
348 |
INFO_PRINTF2(_L("Total number of entries : %d"), smsInfo.iTotalEntries);
|
|
349 |
INFO_PRINTF2(_L("Number of used entries : %d"), smsInfo.iUsedEntries);
|
|
350 |
INFO_PRINTF2(_L("Capabilities(in hex) : %X"), smsInfo.iCaps);
|
|
351 |
PrintMessageStoreCaps(smsInfo.iCaps);
|
|
352 |
User::After(10000000); // Give user time to see the test results
|
|
353 |
}
|
|
354 |
// Test immediate cancelling of request
|
|
355 |
if (count>0)
|
|
356 |
{
|
|
357 |
INFO_PRINTF1(_L("Test cancelling of GetMessageStoreInfo request"));
|
|
358 |
iSms.GetMessageStoreInfo(reqStatus, 0, smsInfoPckg);
|
|
359 |
iSms.CancelAsyncRequest(EMobileSmsMessagingGetMessageStoreInfo);
|
|
360 |
User::WaitForRequest(reqStatus);
|
|
361 |
if (reqStatus==KErrCancel)
|
|
362 |
INFO_PRINTF1(_L("Request successfully cancelled"));
|
|
363 |
else if (reqStatus==KErrNone)
|
|
364 |
INFO_PRINTF1(_L("Request completed before it could be cancelled"));
|
|
365 |
else
|
|
366 |
{
|
|
367 |
INFO_PRINTF2(_L("Request failed with: %d"), reqStatus.Int());
|
|
368 |
SetTestStepResult(EFail);
|
|
369 |
}
|
|
370 |
}
|
|
371 |
|
|
372 |
// Test delayed cancelling of request
|
|
373 |
if (count>1)
|
|
374 |
{
|
|
375 |
INFO_PRINTF1(_L("Test cancelling of GetMessageStoreInfo request..."));
|
|
376 |
iSms.GetMessageStoreInfo(reqStatus, 1, smsInfoPckg);
|
|
377 |
// User::After(500000);
|
|
378 |
iSms.CancelAsyncRequest(EMobileSmsMessagingGetMessageStoreInfo);
|
|
379 |
User::WaitForRequest(reqStatus);
|
|
380 |
TEST(reqStatus==KErrCancel || reqStatus==KErrNone);
|
|
381 |
if (reqStatus==KErrCancel)
|
|
382 |
INFO_PRINTF1(_L("Request successfully cancelled"));
|
|
383 |
else
|
|
384 |
INFO_PRINTF1(_L("Request completed before it could be cancelled"));
|
|
385 |
}
|
|
386 |
|
|
387 |
return TestStepResult();
|
|
388 |
}
|
|
389 |
|
|
390 |
CTestMessageStoreOps::CTestMessageStoreOps()
|
|
391 |
{
|
|
392 |
SetTestStepName(_L("TestMessageStoreOps"));
|
|
393 |
}
|
|
394 |
|
|
395 |
enum TVerdict CTestMessageStoreOps::doTestStepL()
|
|
396 |
/**
|
|
397 |
* This function performs Message Store Operations.
|
|
398 |
* It opens the SIM and ME Stores, writes & reads sms' to these stores, performs
|
|
399 |
* appropriate Cancel operations and gets information on the SIM and ME stores.
|
|
400 |
*/
|
|
401 |
{
|
|
402 |
// Test open message store and get info
|
|
403 |
RMobileSmsStore simStore;
|
|
404 |
// Nokia 9210 doesn't support ME SMS storage.
|
|
405 |
// This flag is used to skip the related tests.
|
|
406 |
TBool meSupported;
|
|
407 |
TInt ret=simStore.Open(iSms, KETelIccSmsStore);
|
|
408 |
TESTL(ret==KErrNone);
|
|
409 |
CleanupClosePushL(simStore);
|
|
410 |
INFO_PRINTF1(_L("SIM message store opened..."));
|
|
411 |
TRequestStatus reqStatus;
|
|
412 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1 simSmsInfo;
|
|
413 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg simSmsInfoPckg(simSmsInfo);
|
|
414 |
INFO_PRINTF1(_L("Retrieving SIM message store info..."));
|
|
415 |
simStore.GetInfo(reqStatus, simSmsInfoPckg);
|
|
416 |
User::WaitForRequest(reqStatus);
|
|
417 |
TEST(reqStatus==KErrNone);
|
|
418 |
if (reqStatus!=KErrNone)
|
|
419 |
INFO_PRINTF2(_L("Error %d retrieving SIM message store info"), ret);
|
|
420 |
else
|
|
421 |
{
|
|
422 |
TEST(simSmsInfo.iType==RMobilePhoneStore::EShortMessageStore);
|
|
423 |
// Print the result
|
|
424 |
INFO_PRINTF1(_L("Information retrieved about the message store"));
|
|
425 |
INFO_PRINTF2(_L("Name : %S"), &simSmsInfo.iName);
|
|
426 |
INFO_PRINTF2(_L("Total number of entries : %d"), simSmsInfo.iTotalEntries);
|
|
427 |
INFO_PRINTF2(_L("Number of used entries : %d"), simSmsInfo.iUsedEntries);
|
|
428 |
INFO_PRINTF2(_L("Capabilities(in hex) : %X"), simSmsInfo.iCaps);
|
|
429 |
PrintMessageStoreCaps(simSmsInfo.iCaps);
|
|
430 |
User::After(10000000); // Give user time to see the test results
|
|
431 |
}
|
|
432 |
// Test immediate cancelling of request
|
|
433 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1 simSmsInfo2;
|
|
434 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg simSmsInfoPckg2(simSmsInfo2);
|
|
435 |
INFO_PRINTF1(_L("Test immediate cancelling of GetInfo request..."));
|
|
436 |
simStore.GetInfo(reqStatus, simSmsInfoPckg2);
|
|
437 |
simStore.CancelAsyncRequest(EMobilePhoneStoreGetInfo);
|
|
438 |
User::WaitForRequest(reqStatus);
|
|
439 |
TEST(reqStatus==KErrCancel || reqStatus==KErrNone);
|
|
440 |
if (reqStatus==KErrCancel)
|
|
441 |
INFO_PRINTF1(_L("Request successfully cancelled"));
|
|
442 |
else
|
|
443 |
INFO_PRINTF1(_L("Request completed before it could be cancelled"));
|
|
444 |
// Test delayed cancelling of request
|
|
445 |
INFO_PRINTF1(_L("Test delayed cancelling of GetInfo request"));
|
|
446 |
simStore.GetInfo(reqStatus, simSmsInfoPckg2);
|
|
447 |
User::After(500000);
|
|
448 |
simStore.CancelAsyncRequest(EMobilePhoneStoreGetInfo);
|
|
449 |
User::WaitForRequest(reqStatus);
|
|
450 |
TEST(reqStatus==KErrCancel || reqStatus==KErrNone);
|
|
451 |
if (reqStatus==KErrCancel)
|
|
452 |
INFO_PRINTF1(_L("Request successfully cancelled"));
|
|
453 |
else
|
|
454 |
INFO_PRINTF1(_L("Request completed before it could be cancelled"));
|
|
455 |
// Test the same information retrieval for ME SMS store
|
|
456 |
RMobileSmsStore meStore;
|
|
457 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1 meSmsInfo;
|
|
458 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg meSmsInfoPckg(meSmsInfo);
|
|
459 |
ret=meStore.Open(iSms, KETelMeSmsStore);
|
|
460 |
TESTL(ret==KErrNone);
|
|
461 |
CleanupClosePushL(meStore);
|
|
462 |
INFO_PRINTF1(_L("ME message store opened."));
|
|
463 |
INFO_PRINTF1(_L("Retrieving ME message store info..."));
|
|
464 |
meStore.GetInfo(reqStatus, meSmsInfoPckg);
|
|
465 |
User::WaitForRequest(reqStatus);
|
|
466 |
if (reqStatus!=KErrNone)
|
|
467 |
{
|
|
468 |
INFO_PRINTF2(_L("Error %d retrieving ME message store info."), reqStatus.Int());
|
|
469 |
INFO_PRINTF1(_L("*** Please retry test with another phone ***"));
|
|
470 |
meSupported=FALSE;
|
|
471 |
if(TestStepResult() == EPass)
|
|
472 |
SetTestStepResult(EInconclusive);
|
|
473 |
}
|
|
474 |
else
|
|
475 |
{
|
|
476 |
TEST(meSmsInfo.iType==RMobilePhoneStore::EShortMessageStore);
|
|
477 |
// Print the result
|
|
478 |
INFO_PRINTF1(_L("Information retrieved about the message store"));
|
|
479 |
INFO_PRINTF2(_L("Name : %S"), &meSmsInfo.iName);
|
|
480 |
INFO_PRINTF2(_L("Total number of entries : %d"), meSmsInfo.iTotalEntries);
|
|
481 |
INFO_PRINTF2(_L("Number of used entries : %d"), meSmsInfo.iUsedEntries);
|
|
482 |
INFO_PRINTF2(_L("Capabilities(in hex) : %X"), meSmsInfo.iCaps);
|
|
483 |
PrintMessageStoreCaps(meSmsInfo.iCaps);
|
|
484 |
User::After(10000000); // Give user time to see the test results
|
|
485 |
meSupported=TRUE;
|
|
486 |
}
|
|
487 |
|
|
488 |
// Test immediate cancelling of request
|
|
489 |
if (meSupported==TRUE)
|
|
490 |
{
|
|
491 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1 meSmsInfo2;
|
|
492 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg meSmsInfoPckg2(meSmsInfo2);
|
|
493 |
INFO_PRINTF1(_L("Test immediate cancelling of GetInfo request..."));
|
|
494 |
meStore.GetInfo(reqStatus, meSmsInfoPckg2);
|
|
495 |
meStore.CancelAsyncRequest(EMobilePhoneStoreGetInfo);
|
|
496 |
User::WaitForRequest(reqStatus);
|
|
497 |
TEST(reqStatus==KErrCancel || reqStatus==KErrNone);
|
|
498 |
if (reqStatus==KErrCancel)
|
|
499 |
INFO_PRINTF1(_L("Request successfully cancelled"));
|
|
500 |
else
|
|
501 |
INFO_PRINTF1(_L("Request completed before it could be cancelled"));
|
|
502 |
|
|
503 |
// Test delayed cancelling of request
|
|
504 |
INFO_PRINTF1(_L("Test delayed cancelling of GetInfo request"));
|
|
505 |
meStore.GetInfo(reqStatus, meSmsInfoPckg2);
|
|
506 |
User::After(500000);
|
|
507 |
meStore.CancelAsyncRequest(EMobilePhoneStoreGetInfo);
|
|
508 |
User::WaitForRequest(reqStatus);
|
|
509 |
TEST(reqStatus==KErrCancel || reqStatus==KErrNone);
|
|
510 |
if (reqStatus==KErrCancel)
|
|
511 |
INFO_PRINTF1(_L("Request successfully cancelled"));
|
|
512 |
else
|
|
513 |
INFO_PRINTF1(_L("Request completed before it could be cancelled"));
|
|
514 |
}
|
|
515 |
|
|
516 |
// Test reading all the messages in SIM store
|
|
517 |
// Print details of each message
|
|
518 |
INFO_PRINTF1(_L("Reading Messages from SIM Store..."));
|
|
519 |
RMobileSmsStore::TMobileGsmSmsEntryV1 smsEntry;
|
|
520 |
RMobileSmsStore::TMobileGsmSmsEntryV1Pckg smsEntryPckg(smsEntry);
|
|
521 |
for (TInt i=1; i<=simSmsInfo.iUsedEntries; i++)
|
|
522 |
{
|
|
523 |
smsEntry.iIndex=i; // Entry to read
|
|
524 |
simStore.Read(reqStatus, smsEntryPckg);
|
|
525 |
User::WaitForRequest(reqStatus);
|
|
526 |
TESTL(reqStatus==KErrNone || reqStatus==KErrNotFound);
|
|
527 |
if (reqStatus == KErrNotFound)
|
|
528 |
INFO_PRINTF2((_L("The entry was not found, request status = %d")), reqStatus.Int());
|
|
529 |
else
|
|
530 |
{
|
|
531 |
INFO_PRINTF2(_L("Entry %d: Successfully read"),smsEntry.iIndex);
|
|
532 |
INFO_PRINTF2(_L("Status of entry = %d"),smsEntry.iMsgStatus);
|
|
533 |
INFO_PRINTF2(_L("Length of PDU in octets = %d"),smsEntry.iMsgData.Size());
|
|
534 |
}
|
|
535 |
}
|
|
536 |
// Test reading and cancelling
|
|
537 |
INFO_PRINTF1(_L("Test Cancel Read from SIM Store"));
|
|
538 |
TRequestStatus cancelReqStatus;
|
|
539 |
smsEntry.iIndex=simSmsInfo.iUsedEntries;
|
|
540 |
simStore.Read(cancelReqStatus, smsEntryPckg);
|
|
541 |
simStore.CancelAsyncRequest(EMobilePhoneStoreRead);
|
|
542 |
User::WaitForRequest(cancelReqStatus);
|
|
543 |
TEST(cancelReqStatus==KErrCancel || reqStatus==KErrNone || reqStatus==KErrNotFound);
|
|
544 |
if (cancelReqStatus==KErrCancel)
|
|
545 |
{
|
|
546 |
INFO_PRINTF1(_L("Request successfully cancelled"));
|
|
547 |
}
|
|
548 |
else
|
|
549 |
{
|
|
550 |
INFO_PRINTF2(_L("Request completed with %d before it could be cancelled"), reqStatus.Int());
|
|
551 |
}
|
|
552 |
// Test writing a dummy PDU to SIM store
|
|
553 |
// And then test reading it out and comparing it
|
|
554 |
INFO_PRINTF1(_L("Test Write to SIM Store"));
|
|
555 |
const TText8 MyPdu[] = {0x1d,0x00,0x0c,0x91,0x44,0x77,0x74,0x60,0x45,0x95,0x00,0x00,0x50,0x80,0x80,0x31,0x92,0x80,0x00,0x04,0xf4,0xf2,0x9c,0x0e};
|
|
556 |
smsEntry.iMsgStatus=RMobileSmsStore::EStoredMessageUnsent;
|
|
557 |
smsEntry.iMsgData.Copy(MyPdu, sizeof(MyPdu));
|
|
558 |
simStore.Write(reqStatus, smsEntryPckg);
|
|
559 |
User::WaitForRequest(reqStatus);
|
|
560 |
TEST(reqStatus==KErrNone);
|
|
561 |
if (reqStatus==KErrNone)
|
|
562 |
{
|
|
563 |
INFO_PRINTF2(_L("Write request successfully completed to index %d"), smsEntry.iIndex);
|
|
564 |
}
|
|
565 |
else
|
|
566 |
{
|
|
567 |
INFO_PRINTF2(_L("Error %d writing message to SIM store"), reqStatus.Int());
|
|
568 |
}
|
|
569 |
if (reqStatus==KErrNone)
|
|
570 |
{
|
|
571 |
INFO_PRINTF1(_L("Test Read of entry just written to SIM Store"));
|
|
572 |
RMobileSmsStore::TMobileGsmSmsEntryV1 smsReadEntry;
|
|
573 |
RMobileSmsStore::TMobileGsmSmsEntryV1Pckg smsReadEntryPckg(smsReadEntry);
|
|
574 |
smsReadEntry.iIndex=smsEntry.iIndex;
|
|
575 |
simStore.Read(reqStatus, smsReadEntryPckg);
|
|
576 |
User::WaitForRequest(reqStatus);
|
|
577 |
TESTL(reqStatus==KErrNone);
|
|
578 |
if (reqStatus != KErrNone)
|
|
579 |
{
|
|
580 |
INFO_PRINTF2((_L("The entry was not found, request status = %d")), reqStatus.Int());
|
|
581 |
}
|
|
582 |
else
|
|
583 |
{
|
|
584 |
INFO_PRINTF2(_L("Entry %d: Successfully read"),smsReadEntry.iIndex);
|
|
585 |
INFO_PRINTF2(_L("Status of entry = %d"),smsReadEntry.iMsgStatus);
|
|
586 |
INFO_PRINTF2(_L("Length of PDU in octets = %d"),smsReadEntry.iMsgData.Size());
|
|
587 |
if (smsReadEntry.iMsgData.Compare(smsEntry.iMsgData)==0)
|
|
588 |
{
|
|
589 |
INFO_PRINTF1(_L("Read entry successfully compared with Write entry"));
|
|
590 |
}
|
|
591 |
else
|
|
592 |
{
|
|
593 |
INFO_PRINTF1(_L("*** Read entry NOT matched with Write entry! ***"));
|
|
594 |
INFO_PRINTF1(_L("*** This test is known to fail with Ericsson phones ***"));
|
|
595 |
INFO_PRINTF1(_L("*** Please retry test with a different make of phone ***"));
|
|
596 |
|
|
597 |
if(TestStepResult() == EPass)
|
|
598 |
SetTestStepResult(EInconclusive);
|
|
599 |
}
|
|
600 |
}
|
|
601 |
}
|
|
602 |
// Test writing and cancelling to ME store first
|
|
603 |
if (meSupported==TRUE)
|
|
604 |
{
|
|
605 |
INFO_PRINTF1(_L("Test Cancel Write to ME Store"));
|
|
606 |
meStore.Write(cancelReqStatus, smsEntryPckg);
|
|
607 |
meStore.CancelAsyncRequest(EMobilePhoneStoreWrite);
|
|
608 |
User::WaitForRequest(cancelReqStatus);
|
|
609 |
TEST(cancelReqStatus==KErrCancel || reqStatus==KErrNone);
|
|
610 |
if (cancelReqStatus==KErrCancel)
|
|
611 |
INFO_PRINTF1(_L("Request successfully cancelled"));
|
|
612 |
else
|
|
613 |
INFO_PRINTF1(_L("Request completed before it could be cancelled"));
|
|
614 |
|
|
615 |
// Test writing the same PDU to ME store
|
|
616 |
// And then test reading it out and comparing it again
|
|
617 |
INFO_PRINTF1(_L("Test Write to ME Store"));
|
|
618 |
|
|
619 |
meStore.Write(reqStatus, smsEntryPckg);
|
|
620 |
User::WaitForRequest(reqStatus);
|
|
621 |
if (reqStatus==KErrNone)
|
|
622 |
{
|
|
623 |
INFO_PRINTF2(_L("Write request successfully completed to index %d"), smsEntry.iIndex);
|
|
624 |
}
|
|
625 |
else
|
|
626 |
{
|
|
627 |
INFO_PRINTF2(_L("Error %d writing message to ME store"), reqStatus.Int());
|
|
628 |
INFO_PRINTF1(_L("*** Please try running this test with another phone.***"));
|
|
629 |
if(TestStepResult() == EPass)
|
|
630 |
{
|
|
631 |
SetTestStepResult(EInconclusive);
|
|
632 |
}
|
|
633 |
}
|
|
634 |
if (reqStatus==KErrNone)
|
|
635 |
{
|
|
636 |
INFO_PRINTF1(_L("Test Read of entry just written to ME Store"));
|
|
637 |
RMobileSmsStore::TMobileGsmSmsEntryV1 smsReadEntry2;
|
|
638 |
RMobileSmsStore::TMobileGsmSmsEntryV1Pckg smsReadEntryPckg2(smsReadEntry2);
|
|
639 |
smsReadEntry2.iIndex=smsEntry.iIndex;
|
|
640 |
meStore.Read(reqStatus, smsReadEntryPckg2);
|
|
641 |
User::WaitForRequest(reqStatus);
|
|
642 |
if (reqStatus != KErrNone)
|
|
643 |
{
|
|
644 |
INFO_PRINTF2((_L("The entry was not found, request status = %d")), reqStatus.Int());
|
|
645 |
SetTestStepResult(EFail);
|
|
646 |
}
|
|
647 |
else
|
|
648 |
{
|
|
649 |
INFO_PRINTF2(_L("Entry %d: Successfully read"),smsReadEntry2.iIndex);
|
|
650 |
INFO_PRINTF2(_L("Status of entry = %d"),smsReadEntry2.iMsgStatus);
|
|
651 |
INFO_PRINTF2(_L("Length of PDU in octets = %d"),smsReadEntry2.iMsgData.Size());
|
|
652 |
if (smsReadEntry2.iMsgData.Compare(smsEntry.iMsgData)==0)
|
|
653 |
{
|
|
654 |
INFO_PRINTF1(_L("Read entry successfully compared with Write entry"));
|
|
655 |
}
|
|
656 |
else
|
|
657 |
{
|
|
658 |
INFO_PRINTF1(_L("*** Read entry NOT matched with Write entry! ***"));
|
|
659 |
INFO_PRINTF1(_L("*** This test is known to fail with Ericsson phones ***"));
|
|
660 |
INFO_PRINTF1(_L("*** Please retry test with a different make of phone ***"));
|
|
661 |
|
|
662 |
if(TestStepResult() == EPass)
|
|
663 |
SetTestStepResult(EInconclusive);
|
|
664 |
}
|
|
665 |
}
|
|
666 |
}
|
|
667 |
}
|
|
668 |
// Now test deletion of entries - test deletion of last entry
|
|
669 |
// Get info again in order to get up-to-date number of used entries
|
|
670 |
simStore.GetInfo(reqStatus, simSmsInfoPckg);
|
|
671 |
User::WaitForRequest(reqStatus);
|
|
672 |
TEST(reqStatus==KErrNone);
|
|
673 |
if (simSmsInfo.iUsedEntries > 0)
|
|
674 |
{
|
|
675 |
simStore.Delete(reqStatus, simSmsInfo.iUsedEntries);
|
|
676 |
User::WaitForRequest(reqStatus);
|
|
677 |
if (reqStatus == KErrNotFound)
|
|
678 |
{
|
|
679 |
INFO_PRINTF2((_L("The entry was not found, request status = %d")), reqStatus.Int());
|
|
680 |
SetTestStepResult(EFail);
|
|
681 |
}
|
|
682 |
else
|
|
683 |
INFO_PRINTF2(_L("Entry %d: Successfully deleted"),simSmsInfo.iUsedEntries);
|
|
684 |
}
|
|
685 |
if (meSupported==TRUE)
|
|
686 |
{
|
|
687 |
meStore.GetInfo(reqStatus, meSmsInfoPckg);
|
|
688 |
User::WaitForRequest(reqStatus);
|
|
689 |
TEST(reqStatus==KErrNone);
|
|
690 |
if(reqStatus==KErrNone)
|
|
691 |
{
|
|
692 |
if (meSmsInfo.iUsedEntries > 0)
|
|
693 |
{
|
|
694 |
meStore.Delete(reqStatus, meSmsInfo.iUsedEntries);
|
|
695 |
User::WaitForRequest(reqStatus);
|
|
696 |
if (reqStatus == KErrNotFound)
|
|
697 |
{
|
|
698 |
INFO_PRINTF2((_L("The entry was not found, request status = %d")), reqStatus.Int());
|
|
699 |
SetTestStepResult(EFail);
|
|
700 |
}
|
|
701 |
else
|
|
702 |
INFO_PRINTF2(_L("Entry %d: Successfully deleted"),meSmsInfo.iUsedEntries);
|
|
703 |
}
|
|
704 |
}
|
|
705 |
else
|
|
706 |
{
|
|
707 |
INFO_PRINTF1(_L("Failed to get ME store info"));
|
|
708 |
SetTestStepResult(EFail);
|
|
709 |
}
|
|
710 |
}
|
|
711 |
|
|
712 |
// Test deleting and cancelling
|
|
713 |
INFO_PRINTF1(_L("Test Cancel Delete from SIM Store"));
|
|
714 |
|
|
715 |
// Write an entry to be deleted first
|
|
716 |
simStore.Write(reqStatus, smsEntryPckg);
|
|
717 |
User::WaitForRequest(reqStatus);
|
|
718 |
if (reqStatus==KErrNone)
|
|
719 |
{
|
|
720 |
simStore.Delete(cancelReqStatus,smsEntry.iIndex);
|
|
721 |
simStore.CancelAsyncRequest(EMobilePhoneStoreDelete);
|
|
722 |
User::WaitForRequest(cancelReqStatus);
|
|
723 |
if (cancelReqStatus==KErrCancel)
|
|
724 |
INFO_PRINTF1(_L("Request successfully cancelled"));
|
|
725 |
else if (cancelReqStatus==KErrNone)
|
|
726 |
INFO_PRINTF1(_L("Request completed before it could be cancelled"));
|
|
727 |
else
|
|
728 |
{
|
|
729 |
INFO_PRINTF2(_L("Request failed with: %d"), reqStatus.Int());
|
|
730 |
SetTestStepResult(EFail);
|
|
731 |
}
|
|
732 |
}
|
|
733 |
else
|
|
734 |
{
|
|
735 |
INFO_PRINTF2(_L("Error %d writing message to SIM store"), reqStatus.Int());
|
|
736 |
SetTestStepResult(EFail);
|
|
737 |
}
|
|
738 |
|
|
739 |
CleanupStack::PopAndDestroy(&meStore);
|
|
740 |
CleanupStack::PopAndDestroy(&simStore);
|
|
741 |
|
|
742 |
return TestStepResult();
|
|
743 |
}
|
|
744 |
|
|
745 |
CTestReceiveUnstoredSms::CTestReceiveUnstoredSms()
|
|
746 |
{
|
|
747 |
SetTestStepName(_L("TestReceiveUnstoredSms"));
|
|
748 |
}
|
|
749 |
|
|
750 |
enum TVerdict CTestReceiveUnstoredSms::doTestStepL()
|
|
751 |
/**
|
|
752 |
* Receive an unstored Sms test.
|
|
753 |
* Currently the MMTSY does not support receive unstored mode, so that is what this test
|
|
754 |
* tests for.
|
|
755 |
*/
|
|
756 |
{
|
|
757 |
TRequestStatus status;
|
|
758 |
INFO_PRINTF1(_L("Setting receive mode to EReceiveUnstoredPhoneAck."));
|
|
759 |
User::After(2000000); // Gives a bit of time
|
|
760 |
iSms.SetReceiveMode(status, RMobileSmsMessaging::EReceiveUnstoredPhoneAck);
|
|
761 |
User::WaitForRequest(status);
|
|
762 |
//
|
|
763 |
// Only continue if we successfully set the SMS receive mode
|
|
764 |
TESTL(status == KErrNotSupported || status == KErrNone);
|
|
765 |
if(status==KErrNone)
|
|
766 |
{
|
|
767 |
INFO_PRINTF1(_L("Verifying that receive mode has changed ..."));
|
|
768 |
RMobileSmsMessaging::TMobileSmsReceiveMode mode;
|
|
769 |
TInt ret=iSms.GetReceiveMode(mode);
|
|
770 |
// TESTL(ret!=KErrNone || mode!=RMobileSmsMessaging::EReceiveUnstoredPhoneAck);
|
|
771 |
TESTL(ret==KErrNone && mode ==RMobileSmsMessaging::EReceiveUnstoredPhoneAck);
|
|
772 |
INFO_PRINTF1(_L("Calling Receive API ..."));
|
|
773 |
RMobileSmsMessaging::TMobileSmsGsmTpdu gsmMsg;
|
|
774 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 recAtt;
|
|
775 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg recAttPckg(recAtt);
|
|
776 |
iSms.ReceiveMessage(status, gsmMsg, recAttPckg);
|
|
777 |
INFO_PRINTF1(_L("Sending out a SMS ..."));
|
|
778 |
TRAP(ret, SendSms(ETrue));
|
|
779 |
TESTL(ret == KErrNone);
|
|
780 |
// Wait for the sent SMS to return to this phone with a timout of 30 s
|
|
781 |
WaitWithTimeout(status,30*KOneSecond);
|
|
782 |
TESTL(status.Int() == KErrNone);
|
|
783 |
}
|
|
784 |
else
|
|
785 |
{
|
|
786 |
INFO_PRINTF1(_L("*** Receive unstored mode not supported by this phone *** "));
|
|
787 |
INFO_PRINTF1(_L("*** Please retry test with another phone! *** "));
|
|
788 |
|
|
789 |
if(TestStepResult()==EPass)
|
|
790 |
SetTestStepResult(EInconclusive);
|
|
791 |
}
|
|
792 |
|
|
793 |
return TestStepResult();
|
|
794 |
}
|
|
795 |
|
|
796 |
CTestReceiveStoredSms::CTestReceiveStoredSms()
|
|
797 |
{
|
|
798 |
SetTestStepName(_L("TestReceiveStoredSms"));
|
|
799 |
}
|
|
800 |
|
|
801 |
enum TVerdict CTestReceiveStoredSms::doTestStepL()
|
|
802 |
/**
|
|
803 |
* Receive a stored Sms test.
|
|
804 |
* Currently the MMTSY does not support receive unstored mode, so that is what this test
|
|
805 |
* tests for.
|
|
806 |
*/
|
|
807 |
{
|
|
808 |
TRequestStatus status;
|
|
809 |
INFO_PRINTF1(_L("Setting receive mode to EReceiveStored."));
|
|
810 |
User::After(2000000); // Gives a bit of time
|
|
811 |
iSms.SetReceiveMode(status, RMobileSmsMessaging::EReceiveStored);
|
|
812 |
User::WaitForRequest(status);
|
|
813 |
if(status==KErrNone)
|
|
814 |
{
|
|
815 |
INFO_PRINTF1(_L("Verifying that receive mode has changed ..."));
|
|
816 |
RMobileSmsMessaging::TMobileSmsReceiveMode mode;
|
|
817 |
TInt ret=iSms.GetReceiveMode(mode);
|
|
818 |
TESTL(ret == KErrNone && mode == RMobileSmsMessaging::EReceiveStored);
|
|
819 |
INFO_PRINTF1(_L("Calling Receive API ..."));
|
|
820 |
RMobileSmsMessaging::TMobileSmsGsmTpdu gsmMsg;
|
|
821 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 recAtt;
|
|
822 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg recAttPckg(recAtt);
|
|
823 |
iSms.ReceiveMessage(status, gsmMsg, recAttPckg);
|
|
824 |
INFO_PRINTF1(_L("Sending out a SMS ..."));
|
|
825 |
TRAP(ret, SendSms(ETrue));
|
|
826 |
TESTL(ret == KErrNone);
|
|
827 |
// Wait for the sent SMS to return to this phone with a timout of 30 s
|
|
828 |
WaitWithTimeout(status,30*KOneSecond);
|
|
829 |
TESTL(status.Int() == KErrNone);
|
|
830 |
}
|
|
831 |
else
|
|
832 |
{
|
|
833 |
return EFail;
|
|
834 |
}
|
|
835 |
|
|
836 |
return TestStepResult();
|
|
837 |
}
|
|
838 |
|
|
839 |
CTestReceiveStoredSmsAndCancel::CTestReceiveStoredSmsAndCancel()
|
|
840 |
{
|
|
841 |
SetTestStepName(_L("TestReceiveStoredSmsAndCancel"));
|
|
842 |
}
|
|
843 |
|
|
844 |
enum TVerdict CTestReceiveStoredSmsAndCancel::doTestStepL()
|
|
845 |
{
|
|
846 |
TRequestStatus status;
|
|
847 |
INFO_PRINTF1(_L("Setting receive mode to EReceiveStored."));
|
|
848 |
User::After(2000000); // Gives a bit of time
|
|
849 |
iSms.SetReceiveMode(status, RMobileSmsMessaging::EReceiveStored);
|
|
850 |
User::WaitForRequest(status);
|
|
851 |
if(status==KErrNone)
|
|
852 |
{
|
|
853 |
INFO_PRINTF1(_L("Verifying that receive mode has changed ..."));
|
|
854 |
RMobileSmsMessaging::TMobileSmsReceiveMode mode;
|
|
855 |
TInt ret=iSms.GetReceiveMode(mode);
|
|
856 |
TESTL(ret==KErrNone && mode==RMobileSmsMessaging::EReceiveStored);
|
|
857 |
INFO_PRINTF1(_L("Calling Receive API ..."));
|
|
858 |
RMobileSmsMessaging::TMobileSmsGsmTpdu gsmMsg;
|
|
859 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 recAtt;
|
|
860 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg recAttPckg(recAtt);
|
|
861 |
iSms.ReceiveMessage(status, gsmMsg, recAttPckg);
|
|
862 |
INFO_PRINTF1(_L("Sending out a SMS ..."));
|
|
863 |
TRAP(ret, SendSms(ETrue));
|
|
864 |
TESTL(ret == KErrNone);
|
|
865 |
iSms.CancelAsyncRequest(EMobileSmsMessagingReceiveMessage); // Cancels ...
|
|
866 |
// Wait for the sent SMS to return to this phone with a timout of 30 s
|
|
867 |
WaitWithTimeout(status,30*KOneSecond);
|
|
868 |
TESTL((status.Int() == KErrCancel) || (status.Int() == KErrNone)) ;
|
|
869 |
}
|
|
870 |
else
|
|
871 |
{
|
|
872 |
return EFail;
|
|
873 |
}
|
|
874 |
|
|
875 |
return TestStepResult();
|
|
876 |
}
|
|
877 |
|
|
878 |
CTestSendSmsAndCancel::CTestSendSmsAndCancel()
|
|
879 |
{
|
|
880 |
SetTestStepName(_L("TestSendSmsAndCancel"));
|
|
881 |
}
|
|
882 |
|
|
883 |
enum TVerdict CTestSendSmsAndCancel::doTestStepL()
|
|
884 |
{
|
|
885 |
TInt i;
|
|
886 |
INFO_PRINTF1(_L("Sending SMS and cancelling."));
|
|
887 |
// Create message PDU and convert to binary
|
|
888 |
_LIT8(KMsgDataBeforeTargetAddress,"1d00");
|
|
889 |
|
|
890 |
// This data is taken from CSmsTestStep::SendSms, since this
|
|
891 |
// method should be attempting the same send functionality.
|
|
892 |
_LIT8(KMsgDataAfterTargetAddress,"00005080803192800004f4f29c0e");
|
|
893 |
|
|
894 |
TBuf8<400> msgData;
|
|
895 |
TLex8 lex;
|
|
896 |
TUint8 val;
|
|
897 |
msgData.Zero();
|
|
898 |
const TInt count_before((&KMsgDataBeforeTargetAddress)->Length()/2); // Assume length of pdu is always even
|
|
899 |
for(i=0;i<count_before;++i)
|
|
900 |
{
|
|
901 |
lex=(&KMsgDataBeforeTargetAddress)->Mid(i*2,2);
|
|
902 |
LEAVE_IF_ERROR(lex.Val(val,EHex));
|
|
903 |
msgData.Append(TChar(val));
|
|
904 |
}
|
|
905 |
TBuf8<20> targetAddressAscii;
|
|
906 |
targetAddressAscii.Zero();
|
|
907 |
RMobilePhone::TMobileAddress targetAddress;
|
|
908 |
targetAddress.iTypeOfNumber=RMobilePhone::EInternationalNumber;
|
|
909 |
targetAddress.iNumberPlan=RMobilePhone::EIsdnNumberPlan;
|
|
910 |
targetAddress.iTelNumber.Copy(iTelNumber);
|
|
911 |
TInt ret = AppendAddressToAscii(targetAddressAscii,targetAddress);
|
|
912 |
TESTL(ret == KErrNone);
|
|
913 |
const TInt count_address(targetAddressAscii.Length()/2); // Assume length is always even
|
|
914 |
for(i=0;i<count_address;++i)
|
|
915 |
{
|
|
916 |
lex=targetAddressAscii.Mid(i*2,2);
|
|
917 |
lex.Val(val,EHex);
|
|
918 |
msgData.Append(TChar(val));
|
|
919 |
}
|
|
920 |
const TInt count_after((&KMsgDataAfterTargetAddress)->Length()/2); // Assume length of pdu is always even
|
|
921 |
for(i=0;i<count_after;++i)
|
|
922 |
{
|
|
923 |
lex=(&KMsgDataAfterTargetAddress)->Mid(i*2,2);
|
|
924 |
lex.Val(val,EHex);
|
|
925 |
msgData.Append(TChar(val));
|
|
926 |
}
|
|
927 |
// Create message attibutes
|
|
928 |
RMobileSmsMessaging::TMobileSmsSendAttributesV1 msgAttr;
|
|
929 |
msgAttr.iFlags=RMobileSmsMessaging::KSmsDataFormat | RMobileSmsMessaging::KGsmServiceCentre;
|
|
930 |
msgAttr.iDataFormat=RMobileSmsMessaging::EFormatGsmTpdu;
|
|
931 |
msgAttr.iGsmServiceCentre.iTypeOfNumber=RMobilePhone::EInternationalNumber;
|
|
932 |
msgAttr.iGsmServiceCentre.iNumberPlan=RMobilePhone::EIsdnNumberPlan;
|
|
933 |
msgAttr.iGsmServiceCentre.iTelNumber.Copy(iSCANumber);
|
|
934 |
// Package up data ready for sending to etel
|
|
935 |
RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg msgAttrPkg(msgAttr);
|
|
936 |
// Send the message
|
|
937 |
INFO_PRINTF1(_L(".."));
|
|
938 |
iSms.SendMessage(iStatus,msgData,msgAttrPkg);
|
|
939 |
// Wait for a bit
|
|
940 |
User::After(1000000);
|
|
941 |
// Cancel sending, then wait for sending operation to complete
|
|
942 |
iSms.CancelAsyncRequest(EMobileSmsMessagingSendMessage);
|
|
943 |
User::WaitForRequest(iStatus);
|
|
944 |
INFO_PRINTF2(_L("Status = %d"),iStatus.Int());
|
|
945 |
TESTL(iStatus==KErrCancel || iStatus==KErrNone);
|
|
946 |
INFO_PRINTF1(_L("test(s) passed")); // If we don't cause a panic or leave the test has passed
|
|
947 |
|
|
948 |
return TestStepResult();
|
|
949 |
}
|