|
1 // Copyright (c) 2005-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 #include "Te_SimSmsRxTest.h" |
|
17 |
|
18 CSimSmsRxTest::CSimSmsRxTest() |
|
19 { |
|
20 SetTestStepName(_L("SmsRxTest")); |
|
21 } |
|
22 |
|
23 TVerdict CSimSmsRxTest::doTestStepL() |
|
24 { |
|
25 INFO_PRINTF1(_L("BeginSmsRxTest")); |
|
26 |
|
27 CreateConfigFileL(_L("c:\\config3.txt")); |
|
28 SetTestNumberL(8); |
|
29 |
|
30 TInt ret = iPhone.Open(iTelServer,KPhoneName); |
|
31 INFO_PRINTF2(_L("Result: %d"),ret); |
|
32 TESTL(ret == KErrNone); |
|
33 INFO_PRINTF1(_L("Opened phone object")); |
|
34 TESTL(iSmsMessaging.Open(iPhone)==KErrNone); |
|
35 INFO_PRINTF1(_L("Opened SMS Messaging object")); |
|
36 |
|
37 INFO_PRINTF1(_L("Testing GetCaps")); |
|
38 RMobileSmsMessaging::TMobileSmsCapsV1 caps; |
|
39 RMobileSmsMessaging::TMobileSmsCapsV1Pckg capsPckg(caps); |
|
40 iSmsMessaging.GetCaps(capsPckg); |
|
41 TESTL(caps.iSmsMode==RMobileSmsMessaging::KCapsGsmSms); |
|
42 TESTL(caps.iSmsControl==KSmsMessagingCaps); |
|
43 |
|
44 RMobileSmsMessaging::TMobileSmsReceiveMode rxMode; |
|
45 iSmsMessaging.GetReceiveMode(rxMode); |
|
46 TESTL(rxMode==RMobileSmsMessaging::EReceiveUnstoredClientAck); |
|
47 CHECKPOINTL(rxMode,RMobileSmsMessaging::EReceiveUnstoredClientAck,CHP_SMS_CASE("C.1")); |
|
48 |
|
49 INFO_PRINTF1(_L("Testing SMS PDU Retrieval")); |
|
50 TSmsPdu smsPdu; |
|
51 TRequestStatus stat0; |
|
52 RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 attrib; |
|
53 RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg attribPckg(attrib); |
|
54 iSmsMessaging.ReceiveMessage(stat0,smsPdu,attribPckg); |
|
55 INFO_PRINTF1(_L("1st receive Request sent")); |
|
56 |
|
57 //test message received 1 |
|
58 User::WaitForRequest(stat0); |
|
59 CHECKPOINTL(stat0,KErrNone,CHP_SMS_CASE("C.4")); |
|
60 INFO_PRINTF1(_L("Message received")); |
|
61 TESTL(smsPdu.Length()==sizeof(KTestPduA)); |
|
62 TInt i; |
|
63 for(i=0;i<smsPdu.Length();i++) |
|
64 TESTL(smsPdu[i]==KTestPduA[i]); |
|
65 TESTL(attrib.iGsmServiceCentre.iTelNumber==KScaNumberA); |
|
66 TESTL(attrib.iGsmServiceCentre.iTypeOfNumber==RMobilePhone::EInternationalNumber); |
|
67 TESTL(attrib.iGsmServiceCentre.iNumberPlan==RMobilePhone::EIsdnNumberPlan); |
|
68 |
|
69 //ack message |
|
70 iSmsMessaging.AckSmsStored(stat0,KTestDeliveryReport,EFalse); |
|
71 iSmsMessaging.CancelAsyncRequest(EMobileSmsMessagingAckSmsStored);//no implementation-does nothing |
|
72 User::WaitForRequest(stat0); |
|
73 TESTL(stat0==KErrNone); |
|
74 CHECKPOINTL(stat0,KErrNone,CHP_SMS_CASE("C.7")); |
|
75 INFO_PRINTF1(_L("Message 1 ack")); |
|
76 |
|
77 iSmsMessaging.ReceiveMessage(stat0,smsPdu,attribPckg); |
|
78 INFO_PRINTF1(_L("2nd receive Request sent")); |
|
79 User::WaitForRequest(stat0); |
|
80 CHECKPOINTL(stat0,KErrNone,CHP_SMS_CASE("C.5")); |
|
81 INFO_PRINTF1(_L("Message 2 received")); |
|
82 |
|
83 TESTL(smsPdu.Length()==sizeof(KTestPduB)); |
|
84 for(i=0;i<smsPdu.Length();i++) |
|
85 TESTL(smsPdu[i]==KTestPduB[i]); |
|
86 |
|
87 TESTL(attrib.iGsmServiceCentre.iTelNumber==KScaNumberB); |
|
88 TESTL(attrib.iGsmServiceCentre.iTypeOfNumber==RMobilePhone::EInternationalNumber); |
|
89 TESTL(attrib.iGsmServiceCentre.iNumberPlan==RMobilePhone::EIsdnNumberPlan); |
|
90 |
|
91 iSmsMessaging.AckSmsStored(stat0,KTestDeliveryReport,ETrue);//store is full |
|
92 iSmsMessaging.CancelAsyncRequest(EMobileSmsMessagingNackSmsStored);//no implementation-does nothing |
|
93 INFO_PRINTF1(_L("Message 2 Nack (full)")); |
|
94 User::WaitForRequest(stat0); |
|
95 TESTL(stat0==KErrNone); |
|
96 CHECKPOINTL(stat0,KErrNone,CHP_SMS_CASE("C.8")); |
|
97 |
|
98 iSmsMessaging.ResumeSmsReception(stat0); |
|
99 iSmsMessaging.CancelAsyncRequest(EMobileSmsMessagingResumeSmsReception); |
|
100 User::WaitForRequest(stat0); |
|
101 INFO_PRINTF1(_L("Resume reception ")); |
|
102 TESTL(stat0==KErrNone); |
|
103 CHECKPOINTL(stat0,KErrNone,CHP_SMS_CASE("C.10")); |
|
104 |
|
105 iSmsMessaging.ReceiveMessage(stat0,smsPdu,attribPckg); |
|
106 INFO_PRINTF1(_L("3rd receive Request sent")); |
|
107 User::WaitForRequest(stat0); |
|
108 INFO_PRINTF1(_L("Message 3 received")); |
|
109 |
|
110 |
|
111 iSmsMessaging.Close(); |
|
112 iPhone.Close(); |
|
113 ASSERT(RThread().RequestCount()==0); |
|
114 |
|
115 return TestStepResult(); |
|
116 } |
|
117 |