44
|
1 |
// Copyright (c) 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 |
//user include
|
|
18 |
#include "testltsysmsstore.h"
|
|
19 |
#include "testltsysmsatutil.h"
|
|
20 |
|
|
21 |
CTestLtsySmsStore::CTestLtsySmsStore(CTestLtsyModel& aTestModel)
|
|
22 |
: CTestLtsySmsBase(aTestModel)
|
|
23 |
{
|
|
24 |
|
|
25 |
}
|
|
26 |
|
|
27 |
CTestLtsySmsStore::~CTestLtsySmsStore()
|
|
28 |
{
|
|
29 |
}
|
|
30 |
|
|
31 |
CTestLtsySmsStore* CTestLtsySmsStore::NewLC(CTestLtsyModel& aTestModel)
|
|
32 |
{
|
|
33 |
CTestLtsySmsStore* self = new (ELeave)CTestLtsySmsStore(aTestModel);
|
|
34 |
CleanupStack::PushL(self);
|
|
35 |
self->ConstructL();
|
|
36 |
return self;
|
|
37 |
}
|
|
38 |
|
|
39 |
CTestLtsySmsStore* CTestLtsySmsStore::NewL(CTestLtsyModel& aTestModel)
|
|
40 |
{
|
|
41 |
CTestLtsySmsStore* self=CTestLtsySmsStore::NewLC(aTestModel);
|
|
42 |
CleanupStack::Pop(self);
|
|
43 |
return self;
|
|
44 |
}
|
|
45 |
|
|
46 |
void CTestLtsySmsStore::ConstructL()
|
|
47 |
{
|
|
48 |
|
|
49 |
}
|
|
50 |
|
|
51 |
TVerdict CTestLtsySmsStore::doTestStepPreambleL()
|
|
52 |
{
|
|
53 |
INFO_PRINTF1(_L("CTestLtsySmsStore::doTestStepPreambleL called"));
|
|
54 |
SetTestStepResult(EPass);
|
|
55 |
return TestStepResult();
|
|
56 |
}
|
|
57 |
|
|
58 |
TVerdict CTestLtsySmsStore::doTestStepL()
|
|
59 |
{
|
|
60 |
INFO_PRINTF1(_L("CTestLtsySmsStore::doTestStepL called"));
|
|
61 |
TRAPD(err,StoreSmsL());
|
|
62 |
if(err != KErrNone)
|
|
63 |
{
|
|
64 |
INFO_PRINTF2(_L("The error was returned %d!! when store sms"),err);
|
|
65 |
SetTestStepResult(EFail);
|
|
66 |
}
|
|
67 |
return TestStepResult();
|
|
68 |
}
|
|
69 |
|
|
70 |
TVerdict CTestLtsySmsStore::doTestStepPostambleL()
|
|
71 |
{
|
|
72 |
INFO_PRINTF1(_L("CTestLtsySmsStore::doTestStepPostambleL called"));
|
|
73 |
return TestStepResult();
|
|
74 |
}
|
|
75 |
void CTestLtsySmsStore::StoreSmsL()
|
|
76 |
{
|
|
77 |
ReceiveSmsL();
|
|
78 |
TRAPD(err,WriteSmsL());
|
|
79 |
if(err != KErrNone)
|
|
80 |
{
|
|
81 |
NackSmsStoredL();
|
|
82 |
}
|
|
83 |
else
|
|
84 |
{
|
|
85 |
AckSmsStoredL();
|
|
86 |
}
|
|
87 |
}
|
|
88 |
|
|
89 |
void CTestLtsySmsStore::ReceiveSmsL()
|
|
90 |
{
|
|
91 |
TRequestStatus status;
|
|
92 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg receiveAttrPckg(iReceiveAttr);
|
|
93 |
Sms().ReceiveMessage(status, iRecvMsg, receiveAttrPckg);
|
|
94 |
User::WaitForRequest(status);
|
|
95 |
TInt r = status.Int();
|
|
96 |
TBuf<200> outReceive;
|
|
97 |
outReceive.Copy(iRecvMsg);
|
|
98 |
INFO_PRINTF2(_L("Receiveing TPDU=%S"),&outReceive);
|
|
99 |
INFO_PRINTF2(_L("ReceiveMessage() request status = %d"),r);
|
|
100 |
}
|
|
101 |
|
|
102 |
void CTestLtsySmsStore::WriteSmsL()
|
|
103 |
{
|
|
104 |
TRequestStatus status;
|
|
105 |
RMobilePhone::TMobileAddress smsWriteAddr;
|
|
106 |
smsWriteAddr.iTypeOfNumber = iReceiveAttr.iGsmServiceCentre.iTypeOfNumber;
|
|
107 |
smsWriteAddr.iNumberPlan = iReceiveAttr.iGsmServiceCentre.iNumberPlan;
|
|
108 |
smsWriteAddr.iTelNumber = iReceiveAttr.iGsmServiceCentre.iTelNumber;
|
|
109 |
|
|
110 |
//For GsmTpdu
|
|
111 |
TBuf8<400> writePduData;
|
|
112 |
writePduData = iRecvMsg;
|
|
113 |
FillWriteSmsAttibutesL(writePduData,smsWriteAddr);
|
|
114 |
}
|
|
115 |
|
|
116 |
void CTestLtsySmsStore::AckSmsStoredL()
|
|
117 |
{
|
|
118 |
TBool full(EFalse);
|
|
119 |
TRequestStatus status;
|
|
120 |
_LIT8(KNullAck,"00");
|
|
121 |
Sms().AckSmsStored(status,KNullAck(),full);
|
|
122 |
User::WaitForRequest(status);
|
|
123 |
TInt r=status.Int();
|
|
124 |
INFO_PRINTF2(_L("AckSmsStored() request status = %d"),r);
|
|
125 |
}
|
|
126 |
|
|
127 |
void CTestLtsySmsStore::NackSmsStoredL()
|
|
128 |
{
|
|
129 |
TRequestStatus status;
|
|
130 |
TInt rpCause(2);
|
|
131 |
|
|
132 |
Sms().NackSmsStored(status,iRecvMsg,rpCause);
|
|
133 |
User::WaitForRequest(status);
|
|
134 |
TInt r=status.Int();
|
|
135 |
INFO_PRINTF2(_L("AckSmsStored() request status = %d"),r);
|
|
136 |
}
|
|
137 |
|
|
138 |
void CTestLtsySmsStore::FillWriteSmsAttibutesL(TBuf8<400> aTpdu,RMobilePhone::TMobileAddress aMsgSca)
|
|
139 |
{
|
|
140 |
TRequestStatus status;
|
|
141 |
RMobileSmsStore::TMobileGsmSmsEntryV1 smsEntry;
|
|
142 |
RMobileSmsStore::TMobileGsmSmsEntryV1Pckg smsEntryPckg(smsEntry);
|
|
143 |
smsEntry.iMsgStatus=RMobileSmsStore::EStoredMessageUnsent;
|
|
144 |
smsEntry.iMsgData = aTpdu;
|
|
145 |
smsEntry.iServiceCentre = aMsgSca;
|
|
146 |
SmsStore().Write(status, smsEntryPckg);
|
|
147 |
User::WaitForRequest(status);
|
|
148 |
TInt r = status.Int();
|
|
149 |
INFO_PRINTF2(_L("Write() request status = %d"),r);
|
|
150 |
}
|