24
|
1 |
// Copyright (c) 2003-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 |
// @file
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include "TE_smspdudbbase.h"
|
|
19 |
|
|
20 |
void CSmsPduDbTestStep::PrintBuffer(const CSmsPduDbBase& aPdu)
|
|
21 |
/**
|
|
22 |
* utility function PrintBuffer
|
|
23 |
*/
|
|
24 |
{
|
|
25 |
const CSmsBufferBase& buffer = aPdu.iSmsMessage->Buffer();
|
|
26 |
const TInt len = buffer.Length();
|
|
27 |
const TInt KMaxPrintLen = 200;
|
|
28 |
for (TInt j = 0; j < len; j += KMaxPrintLen)
|
|
29 |
{
|
|
30 |
TBuf<KMaxPrintLen> buf;
|
|
31 |
buf.Zero();
|
|
32 |
const TInt midLen = Min(KMaxPrintLen, len - j);
|
|
33 |
buffer.Extract(buf, j, midLen);
|
|
34 |
INFO_PRINTF2(_L("\tBody: %S"), &buf);
|
|
35 |
}
|
|
36 |
}
|
|
37 |
|
|
38 |
void CSmsPduDbTestStep::PrintMessage(TInt aIndex, const CSmsPduDbMessage& aMessage)
|
|
39 |
/**
|
|
40 |
* utility function PrintMessage
|
|
41 |
*/
|
|
42 |
{
|
|
43 |
INFO_PRINTF4(_L("%d Message [Id=%d Ttpe=%d Body=...]"), aIndex, aMessage.iId, aMessage.iType);
|
|
44 |
PrintBuffer(aMessage);
|
|
45 |
}
|
|
46 |
|
|
47 |
|
|
48 |
void CSmsPduDbTestStep::PrintPdu(TInt aIndex, const CSmsPduDbPdu& aPdu)
|
|
49 |
/**
|
|
50 |
* utility function PrintPdu
|
|
51 |
*/
|
|
52 |
{
|
|
53 |
INFO_PRINTF6(_L("%d Pdu [Id=%d Ttpe=%d DecodeErr=%d MsgErr=%d Body=...]"), aIndex, aPdu.iId, aPdu.iType, aPdu.iDecodeError, aPdu.iSmsMessageError);
|
|
54 |
if (aPdu.iDecodeError == KErrNone && aPdu.iSmsMessageError == KErrNone)
|
|
55 |
{
|
|
56 |
PrintBuffer(aPdu);
|
|
57 |
}
|
|
58 |
}
|
|
59 |
|
|
60 |
void CSmsPduDbTestStep::PrintSegment(TInt aIndex, const CSmsPduDbConcatSegment& aPdu)
|
|
61 |
/**
|
|
62 |
* utility function PrintSegment
|
|
63 |
*/
|
|
64 |
{
|
|
65 |
INFO_PRINTF7(_L("%d Segment [Id=%d Segment=%d Ttpe=%d DecodeErr=%d MsgErr=%d Body=...]"), aIndex, aPdu.iId, aPdu.iSegment, aPdu.iType, aPdu.iDecodeError, aPdu.iSmsMessageError);
|
|
66 |
if (aPdu.iDecodeError == KErrNone && aPdu.iSmsMessageError == KErrNone)
|
|
67 |
{
|
|
68 |
PrintBuffer(aPdu);
|
|
69 |
}
|
|
70 |
}
|
|
71 |
|
|
72 |
void CSmsPduDbTestStep::PrintConcat(TInt aIndex, const CSmsPduDbConcat& aConcat)
|
|
73 |
/**
|
|
74 |
* utility function PrintConcat
|
|
75 |
*/
|
|
76 |
{
|
|
77 |
const TInt count = aConcat.iSegments.Count();
|
|
78 |
INFO_PRINTF5(_L("%d Concat [Id=%d Concat=%d MsgErr=%d Body=...]"), aIndex, aConcat.iId, count, aConcat.iSmsMessageError);
|
|
79 |
if (aConcat.iSmsMessageError == KErrNone)
|
|
80 |
{
|
|
81 |
PrintBuffer(aConcat);
|
|
82 |
}
|
|
83 |
INFO_PRINTF1(_L("\tSegments..."));
|
|
84 |
for (TInt i = 0; i < count; i++)
|
|
85 |
{
|
|
86 |
PrintSegment(i, *aConcat.iSegments[i]);
|
|
87 |
}
|
|
88 |
}
|
|
89 |
|
|
90 |
void CSmsPduDbTestStep::DisplayCompileErrorL(const CTestConfigSection& aSection, const CTestConfigItem& aItem, TInt aError)
|
|
91 |
/**
|
|
92 |
* utility function DisplayCompileErrorL
|
|
93 |
*/
|
|
94 |
{
|
|
95 |
const TDesC8& itemTag = aItem.Item();
|
|
96 |
const TDesC8& itemVal = aItem.Value();
|
|
97 |
const TDesC8& sectionName = aSection.SectionName();
|
|
98 |
|
|
99 |
HBufC* itemTag16 = HBufC::NewLC(itemTag.Length());
|
|
100 |
itemTag16->Des().Copy(itemTag);
|
|
101 |
HBufC* itemVal16 = HBufC::NewLC(itemVal.Length());
|
|
102 |
itemVal16->Des().Copy(itemVal);
|
|
103 |
HBufC* sectionName16 = HBufC::NewLC(sectionName.Length());
|
|
104 |
sectionName16->Des().Copy(sectionName);
|
|
105 |
|
|
106 |
INFO_PRINTF4(_L("Section: \"%S\" Item: \"%S\" Error: %d"), sectionName16, itemTag16, aError);
|
|
107 |
|
|
108 |
const TInt KMaxBodyLen = 128;
|
|
109 |
const TInt valLen = itemVal16->Length();
|
|
110 |
|
|
111 |
for (TInt i = 0; i < valLen; i += KMaxBodyLen)
|
|
112 |
{
|
|
113 |
const TInt midLen = Min(KMaxBodyLen, valLen - i);
|
|
114 |
const TPtrC valPtr(itemVal16->Mid(i, midLen));
|
|
115 |
INFO_PRINTF2(_L("\tValue: %S"), &valPtr);
|
|
116 |
}
|
|
117 |
|
|
118 |
CleanupStack::PopAndDestroy(sectionName16);
|
|
119 |
CleanupStack::PopAndDestroy(itemVal16);
|
|
120 |
CleanupStack::PopAndDestroy(itemTag16);
|
|
121 |
|
|
122 |
}
|
|
123 |
|
|
124 |
TVerdict CSmsPduDbTestStep::doTestStepPreambleL( void )
|
|
125 |
{
|
|
126 |
__UHEAP_MARK;
|
|
127 |
|
|
128 |
User::LeaveIfError(iFs.Connect());
|
|
129 |
|
|
130 |
iSmsStackTestUtils = CSmsStackTestUtils::NewL(this, iFs);
|
|
131 |
|
|
132 |
return TestStepResult() ;
|
|
133 |
}
|
|
134 |
|
|
135 |
TVerdict CSmsPduDbTestStep::doTestStepPostambleL( void )
|
|
136 |
{
|
|
137 |
delete iSmsStackTestUtils;
|
|
138 |
iSmsStackTestUtils = NULL;
|
|
139 |
|
|
140 |
iFs.Close();
|
|
141 |
|
|
142 |
__UHEAP_MARKEND;
|
|
143 |
|
|
144 |
return TestStepResult() ;
|
|
145 |
}
|
|
146 |
|