24
|
1 |
// Copyright (c) 2008-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 <emsformatie.h>
|
|
17 |
#include <emssoundie.h>
|
|
18 |
#include <emspictureie.h>
|
|
19 |
#include <emsanimationie.h>
|
|
20 |
#include <emsuserpromptie.h>
|
|
21 |
#include <emsobjectdistributionie.h>
|
|
22 |
#include <emsformatie.h>
|
|
23 |
#include "emstestutils.h"
|
|
24 |
#include <es_wsms.h>
|
|
25 |
#include <sacls.h>
|
|
26 |
#include <e32math.h>
|
|
27 |
#include <testconfigfileparser.h>
|
|
28 |
|
|
29 |
#include "TE_smsinterbase.h"
|
|
30 |
#include "TE_smsinter.h"
|
|
31 |
|
|
32 |
#include <gsmubuf.h>
|
|
33 |
#include <gsmumsg.h>
|
|
34 |
#include <smsuact.h>
|
|
35 |
#include <gsmuset.h>
|
|
36 |
#include <smsuaddr.h>
|
|
37 |
#include <smsustrm.h>
|
|
38 |
#include "smspdudb.h"
|
|
39 |
|
|
40 |
|
|
41 |
// general section
|
|
42 |
_LIT(KConfigFileDir, "sms");
|
|
43 |
_LIT(KConfigFilenameTest, "te_intersetupgsmsms.txt");
|
|
44 |
_LIT8(KSetupTelNumbers, "Defaults");
|
|
45 |
_LIT8(KServiceCenter, "ServiceCenter");
|
|
46 |
_LIT8(KTelefoneNumber, "TelephoneNumber");
|
|
47 |
|
|
48 |
// section names
|
|
49 |
_LIT8(KEnumerateReadWriteAndDeleteEMSOnSIM, "EnumerateReadWriteAndDeleteEMSOnSIM");
|
|
50 |
_LIT8(KEnumerateReadWriteAndDeleteEMSOnPhone, "EnumerateReadWriteAndDeleteEMSOnPhone");
|
|
51 |
|
|
52 |
// section names
|
|
53 |
_LIT8(KTestPublicMethods, "PublicMethods");
|
|
54 |
_LIT8(KTestSendAndReceive7bitMsgs, "SendAndReceive7bitMsgs");
|
|
55 |
_LIT8(KTestSendAndReceive8bitMsgs, "SendAndReceive8bitMsgs");
|
|
56 |
_LIT8(KTestSendAndReceive16bitMsgs, "SendAndReceive16bitMsgs");
|
|
57 |
_LIT8(KTestSendAndReceiveConcatenatedMsgs, "SendAndReceiveConcatenatedMsgs");
|
|
58 |
_LIT8(KSmsStoreMsgOfDifferentClasses, "SmsStoreMsgOfDifferentClasses");
|
|
59 |
_LIT8(KTestSendAndReceiveDifferentIEIs, "SendAndReceiveDifferentIEIs");
|
|
60 |
_LIT8(KTestSendAndReceiveBinaryData, "SendAndReceiveBinaryData");
|
|
61 |
_LIT8(KEnumerateAndWriteAndDeleteMessages, "EnumerateAndWriteAndDeleteMessages");
|
|
62 |
_LIT8(KPDUSlotStoreWithEnumeration, "PDUSlotStoreWithEnumeration");
|
|
63 |
_LIT8(KDeleteMessagesWithoutEnumeration, "DeleteMessagesWithoutEnumeration");
|
|
64 |
_LIT8(KTestSmartMessaging, "SmartMessaging");
|
|
65 |
_LIT8(KRetrieveAndStoreSmsParams, "RetrieveAndStoreSmsParams");
|
|
66 |
_LIT8(KDuplicatePdusOnStore, "DuplicatePdusOnStore");
|
|
67 |
_LIT8(KConcatenatedMessages, "ConcatenatedMessages");
|
|
68 |
_LIT8(KDeletingMessageInEmptyStore, "DeletingMessageInEmptyStore");
|
|
69 |
_LIT8(KOutOfMemoryWrite, "OutOfMemoryWrite");
|
|
70 |
_LIT8(KOutOfMemoryDelete, "OutOfMemoryDelete");
|
|
71 |
_LIT8(KTestSendSMS2Port0000, "SendSMS2Port0000");
|
|
72 |
|
|
73 |
// item names
|
|
74 |
_LIT8(KPDU, "PDU");
|
|
75 |
_LIT8(KAlphabet, "Alphabet");
|
|
76 |
_LIT8(KMessageLength, "MessageLength");
|
|
77 |
_LIT8(KExtendedCharacter, "ExtendedCharacter");
|
|
78 |
_LIT8(KInformationElement, "InformationElement");
|
|
79 |
_LIT8(KIEIData, "IEIData");
|
|
80 |
_LIT8(KServiceCentreAddress, "ServiceCentreAddress");
|
|
81 |
_LIT8(KSmspEntryValidParams, "SmspEntryValidParams");
|
|
82 |
_LIT8(KSmspEntryScTypeOfNumber, "SmspEntryScTypeOfNumber");
|
|
83 |
_LIT8(KSmspEntryScNumberPlan, "SmspEntryScNumberPlan");
|
|
84 |
_LIT8(KSmsClass, "SmsClass");
|
|
85 |
_LIT8(KSmsStorage, "SmsStorage");
|
|
86 |
|
|
87 |
|
|
88 |
// messages
|
|
89 |
_LIT8(KWapTestMsg,"BEGIN:VCARD\r\nVERSION:2.1\r\nFN:Jal\r\nN:Jal\r\nORG:PanSoftware\r\nTITLE:Director\r\nLABEL:Islington\r\nEND:VCARD\r\n");
|
|
90 |
_LIT(KFormatedMsg2,"This is a text formated message with all formats");
|
|
91 |
_LIT(KSoundMsg1, "First sound here, 2nd sound here, end");
|
|
92 |
_LIT(KPictureMsg1, "We got a picture here, small, large or variable");
|
|
93 |
_LIT(KPictureMsg2, "First picture here, 2nd picture here, end");
|
|
94 |
_LIT(KAnimationMsg1, "We got animation here, small or large");
|
|
95 |
_LIT(KAnimationMsg2, "First animation here, 2nd animation here, end");
|
|
96 |
_LIT(KLongEmsMsg, "This is an EMS Message with large picture ,user melody ,small animation ,followed by a large animation ,predef melody ,a small picture ,and nothing else in bold");
|
|
97 |
_LIT(KLongFormatMsg, "0123456789012345678 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"); // 200
|
|
98 |
_LIT(KTestEmsMsg8Bit1,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); // 268
|
|
99 |
_LIT(KTestEmsMsg8Bit2,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); // 258
|
|
100 |
_LIT(KTestEmsMsg8Bit3,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); // 264
|
|
101 |
_LIT(KTestEmsMsg16Bit1,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); //128
|
|
102 |
_LIT(KTest2PduMsg8Bit,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
|
|
103 |
_LIT(KTest2PduMsg7Bit,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABC");
|
|
104 |
_LIT(KTest2PduMsg16Bit,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
|
|
105 |
_LIT(KTestExtdMsg7Bit1,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB$"); //154(>134 Octet + 6 = 2 Msg
|
|
106 |
_LIT(KTestExtdMsg7Bit2,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB$$$$$$$$");
|
|
107 |
_LIT(KTestEmptyMsg8Bit,"");
|
|
108 |
|
|
109 |
|
|
110 |
_LIT8(KBarbieMelody,"MELODY:*3#g3e3#g3*5#c3*4a2r2#f3#d3#f3b3#g2#f3e3r2#c3#f#c2r2#f3e3#g2\r\n");
|
|
111 |
_LIT8(KOasisMelody,"MELODY:c2.c3c2c2c2f2f2d2#d2.#d3#d2#d2#d2#g2#g2c2.c3c2c2c2f2f2d2#d2.#d3#d2#d2#d2#g2g2c2.c3c2c2c2f2f\r\n");
|
|
112 |
|
|
113 |
|
|
114 |
TVerdict CSmsInterTestStep::doTestStepPreambleL()
|
|
115 |
{
|
|
116 |
__UHEAP_MARK;
|
|
117 |
|
|
118 |
//
|
|
119 |
// Create the Active Scheduler...
|
|
120 |
//
|
|
121 |
iScheduler = new(ELeave) CActiveScheduler;
|
|
122 |
CActiveScheduler::Install(iScheduler);
|
|
123 |
|
|
124 |
//
|
|
125 |
// Connect to File Server...
|
|
126 |
//
|
|
127 |
User::LeaveIfError(iFs.Connect());
|
|
128 |
|
|
129 |
//
|
|
130 |
// Ensure KUidPhonePwr is defined...
|
|
131 |
//
|
|
132 |
TInt defErr = RProperty::Define(KUidSystemCategory, KUidPhonePwr.iUid, RProperty::EInt);
|
|
133 |
if (defErr != KErrNone && defErr != KErrAlreadyExists)
|
|
134 |
{
|
|
135 |
User::Leave(defErr);
|
|
136 |
}
|
|
137 |
|
|
138 |
User::LeaveIfError(RProperty::Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOn));
|
|
139 |
|
|
140 |
//
|
|
141 |
// Parse the settings from the INI file...
|
|
142 |
//
|
|
143 |
CTestConfig* configFile = CTestConfig::NewLC(iFs,KConfigFileDir,KConfigFilenameTest);
|
|
144 |
const CTestConfigSection* cfgFile = configFile->Section(KSetupTelNumbers);
|
|
145 |
if (cfgFile == NULL)
|
|
146 |
{
|
|
147 |
User::Leave(KErrNotFound);
|
|
148 |
}
|
|
149 |
|
|
150 |
const CTestConfigItem* item = cfgFile->Item(KServiceCenter,0);
|
|
151 |
if (item == NULL)
|
|
152 |
{
|
|
153 |
User::Leave(KErrNotFound);
|
|
154 |
}
|
|
155 |
|
|
156 |
iServiceCenterNumber.Copy(item->Value());
|
|
157 |
|
|
158 |
item = cfgFile->Item(KTelefoneNumber,0);
|
|
159 |
if (item == NULL)
|
|
160 |
{
|
|
161 |
User::Leave(KErrNotFound);
|
|
162 |
}
|
|
163 |
|
|
164 |
iTelephoneNumber.Copy(item->Value());
|
|
165 |
|
|
166 |
// beginning of the destruction
|
|
167 |
CleanupStack::PopAndDestroy(configFile);//configFile
|
|
168 |
|
|
169 |
INFO_PRINTF2(_L("TelNo: [%S]"), &iTelephoneNumber);
|
|
170 |
INFO_PRINTF2(_L("ScNo: [%S]"), &iServiceCenterNumber);
|
|
171 |
|
|
172 |
//
|
|
173 |
// Load the utility DLL...
|
|
174 |
//
|
|
175 |
iSmsStackTestUtils = CSmsStackTestUtils::NewL(this, iFs);
|
|
176 |
|
|
177 |
return TestStepResult();
|
|
178 |
} // CSmsInterTestStep::doTestStepPreambleL
|
|
179 |
|
|
180 |
|
|
181 |
TVerdict CSmsInterTestStep::doTestStepPostambleL()
|
|
182 |
{
|
|
183 |
delete iSmsStackTestUtils;
|
|
184 |
iSmsStackTestUtils = NULL;
|
|
185 |
|
|
186 |
iFs.Close();
|
|
187 |
|
|
188 |
delete iScheduler;
|
|
189 |
iScheduler = NULL;
|
|
190 |
|
|
191 |
__UHEAP_MARKEND;
|
|
192 |
|
|
193 |
return TestStepResult();
|
|
194 |
} // CSmsInterTestStep::doTestStepPostambleL
|
|
195 |
|
|
196 |
|
|
197 |
TBool CSmsInterTestStep::DoSingleTestCaseL( const TDesC8& aSection, TInt aCount )
|
|
198 |
{
|
|
199 |
|
|
200 |
CTestConfig* configFile; //< Pointer to the Configuration file reader
|
|
201 |
configFile=CTestConfig::NewLC(iFs,KConfigFileDir,KConfigFilenameTest);
|
|
202 |
|
|
203 |
TBuf8<64> sectionName(aSection);
|
|
204 |
sectionName.AppendNum(aCount);
|
|
205 |
const CTestConfigSection* section = NULL;
|
|
206 |
TBool found( ETrue );
|
|
207 |
|
|
208 |
if ( ( section = configFile->Section( sectionName ) ) != NULL )
|
|
209 |
{
|
|
210 |
if ( aSection == KEnumerateReadWriteAndDeleteEMSOnSIM )
|
|
211 |
{
|
|
212 |
RPointerArray<CSmsPduDbMessage> array;
|
|
213 |
CleanupResetAndDestroyPushL(array);
|
|
214 |
ReadPduL( sectionName, array );
|
|
215 |
EnumerateReadWriteAndDeleteEMSOnSIML( array );
|
|
216 |
CleanupStack::PopAndDestroy(&array);
|
|
217 |
}
|
|
218 |
else if ( aSection == KEnumerateReadWriteAndDeleteEMSOnPhone )
|
|
219 |
{
|
|
220 |
RPointerArray<CSmsPduDbMessage> array;
|
|
221 |
CleanupResetAndDestroyPushL(array);
|
|
222 |
ReadPduL( sectionName, array );
|
|
223 |
EnumerateReadWriteAndDeleteEMSOnPhoneL( array );
|
|
224 |
CleanupStack::PopAndDestroy(&array);
|
|
225 |
}
|
|
226 |
else if ( aSection == KTestPublicMethods )
|
|
227 |
{
|
|
228 |
RPointerArray<CSmsPduDbMessage> array;
|
|
229 |
CleanupResetAndDestroyPushL(array);
|
|
230 |
ReadPduL( sectionName, array );
|
|
231 |
TestPublicMethodsL( array );
|
|
232 |
CleanupStack::PopAndDestroy(&array);
|
|
233 |
}
|
|
234 |
else if ( aSection == KTestSendAndReceive7bitMsgs )
|
|
235 |
{
|
|
236 |
const TUint KStdDelimiter=',';
|
|
237 |
TPtrC8 pdu;
|
|
238 |
const CTestConfigItem* item = NULL;
|
|
239 |
item = section->Item( KPDU, 0 );
|
|
240 |
if ( item )
|
|
241 |
{
|
|
242 |
TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,pdu);
|
|
243 |
if( ret != KErrNone )
|
|
244 |
{
|
|
245 |
return EFalse;
|
|
246 |
}
|
|
247 |
}
|
|
248 |
TInt num( 1 );
|
|
249 |
CArrayFixFlat<TInt>* messageLengthArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
250 |
CleanupStack::PushL(messageLengthArray);
|
|
251 |
CArrayFixFlat<TInt>* charArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
252 |
CleanupStack::PushL(charArray);
|
|
253 |
|
|
254 |
TBuf8<32> itemName( KMessageLength );
|
|
255 |
itemName.AppendNum( num );
|
|
256 |
|
|
257 |
TInt param = section->ItemValue( (TPtrC8)itemName, 0xFF );
|
|
258 |
while ( param != 0xFF )
|
|
259 |
{
|
|
260 |
messageLengthArray->AppendL(param);
|
|
261 |
itemName = KMessageLength;
|
|
262 |
itemName.AppendNum( ++num );
|
|
263 |
param = section->ItemValue( (TPtrC8)itemName, 0xFF );
|
|
264 |
}
|
|
265 |
num = 1;
|
|
266 |
itemName = KExtendedCharacter;
|
|
267 |
TBuf8<32> itemName2( KExtendedCharacter );
|
|
268 |
itemName.AppendNum( num );
|
|
269 |
itemName.AppendNum( 1 );
|
|
270 |
itemName2.AppendNum( num );
|
|
271 |
itemName2.AppendNum( 2 );
|
|
272 |
|
|
273 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
274 |
TInt param2 = section->ItemValue( (TPtrC8)itemName2, KErrNotFound );
|
|
275 |
|
|
276 |
while ( param != KErrNotFound && param2 != KErrNotFound )
|
|
277 |
{
|
|
278 |
charArray->AppendL( param2 | ( param << 8) );
|
|
279 |
num++;
|
|
280 |
itemName = KExtendedCharacter;
|
|
281 |
itemName.AppendNum( num );
|
|
282 |
itemName.AppendNum( 1 );
|
|
283 |
itemName2 = KExtendedCharacter;
|
|
284 |
itemName2.AppendNum( num );
|
|
285 |
itemName2.AppendNum( 2 );
|
|
286 |
|
|
287 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
288 |
param2 = section->ItemValue( (TPtrC8)itemName2, KErrNotFound );
|
|
289 |
}
|
|
290 |
|
|
291 |
RPointerArray<CSmsPduDbMessage> array;
|
|
292 |
CleanupResetAndDestroyPushL(array);
|
|
293 |
ReadPduL( sectionName, array );
|
|
294 |
TestSendAndReceive7bitMsgsL( pdu, array, charArray, messageLengthArray );
|
|
295 |
CleanupStack::PopAndDestroy(&array);
|
|
296 |
CleanupStack::PopAndDestroy(charArray);
|
|
297 |
CleanupStack::PopAndDestroy(messageLengthArray);
|
|
298 |
|
|
299 |
}
|
|
300 |
else if ( aSection == KTestSendAndReceive8bitMsgs )
|
|
301 |
{
|
|
302 |
TInt num( 1 );
|
|
303 |
CArrayFixFlat<TInt>* messageLengthArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
304 |
CleanupStack::PushL(messageLengthArray);
|
|
305 |
|
|
306 |
TBuf8<32> itemName( KMessageLength );
|
|
307 |
itemName.AppendNum( num );
|
|
308 |
|
|
309 |
TInt param = section->ItemValue( (TPtrC8)itemName, 0xFF );
|
|
310 |
while ( param != 0xFF )
|
|
311 |
{
|
|
312 |
messageLengthArray->AppendL(param);
|
|
313 |
itemName = KMessageLength;
|
|
314 |
itemName.AppendNum( ++num );
|
|
315 |
param = section->ItemValue( (TPtrC8)itemName, 0xFF );
|
|
316 |
}
|
|
317 |
|
|
318 |
RPointerArray<CSmsPduDbMessage> array;
|
|
319 |
CleanupResetAndDestroyPushL(array);
|
|
320 |
ReadPduL( sectionName, array );
|
|
321 |
TestSendAndReceive8bitMsgsL( array, messageLengthArray );
|
|
322 |
CleanupStack::PopAndDestroy(&array);
|
|
323 |
CleanupStack::PopAndDestroy(messageLengthArray);
|
|
324 |
}
|
|
325 |
else if ( aSection == KTestSendAndReceive16bitMsgs )
|
|
326 |
{
|
|
327 |
TInt num( 1 );
|
|
328 |
CArrayFixFlat<TInt>* messageLengthArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
329 |
CleanupStack::PushL(messageLengthArray);
|
|
330 |
|
|
331 |
TBuf8<32> itemName( KMessageLength );
|
|
332 |
itemName.AppendNum( num );
|
|
333 |
|
|
334 |
TInt param = section->ItemValue( (TPtrC8)itemName, 0xFF );
|
|
335 |
while ( param != 0xFF )
|
|
336 |
{
|
|
337 |
messageLengthArray->AppendL(param);
|
|
338 |
itemName = KMessageLength;
|
|
339 |
itemName.AppendNum( ++num );
|
|
340 |
param = section->ItemValue( (TPtrC8)itemName, 0xFF );
|
|
341 |
}
|
|
342 |
|
|
343 |
RPointerArray<CSmsPduDbMessage> array;
|
|
344 |
CleanupResetAndDestroyPushL(array);
|
|
345 |
ReadPduL( sectionName, array );
|
|
346 |
TestSendAndReceive16bitMsgsL( array, messageLengthArray );
|
|
347 |
CleanupStack::PopAndDestroy(&array);
|
|
348 |
CleanupStack::PopAndDestroy(messageLengthArray);
|
|
349 |
}
|
|
350 |
else if ( aSection == KTestSendAndReceiveConcatenatedMsgs )
|
|
351 |
{
|
|
352 |
TInt num( 1 );
|
|
353 |
CArrayFixFlat<TInt>* alphabetArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
354 |
CleanupStack::PushL(alphabetArray);
|
|
355 |
|
|
356 |
TBuf8<32> itemName( KAlphabet );
|
|
357 |
itemName.AppendNum( num );
|
|
358 |
|
|
359 |
TInt param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
360 |
while ( param != KErrNotFound )
|
|
361 |
{
|
|
362 |
alphabetArray->AppendL(param);
|
|
363 |
itemName = KAlphabet;
|
|
364 |
itemName.AppendNum( ++num );
|
|
365 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
366 |
}
|
|
367 |
|
|
368 |
RPointerArray<CSmsPduDbMessage> array;
|
|
369 |
CleanupResetAndDestroyPushL(array);
|
|
370 |
ReadPduL( sectionName, array );
|
|
371 |
TestSendAndReceiveConcatenatedMsgsL( array, alphabetArray );
|
|
372 |
CleanupStack::PopAndDestroy(&array);
|
|
373 |
CleanupStack::PopAndDestroy(alphabetArray);
|
|
374 |
}
|
|
375 |
else if ( aSection == KTestSendAndReceiveDifferentIEIs )
|
|
376 |
{
|
|
377 |
TInt num( 1 );
|
|
378 |
CArrayFixFlat<TInt>* alphabetArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
379 |
CleanupStack::PushL(alphabetArray);
|
|
380 |
CArrayFixFlat<TInt>* informationElementArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
381 |
CleanupStack::PushL(informationElementArray);
|
|
382 |
|
|
383 |
CArrayFixFlat<TInt>* ieiDataArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
384 |
CleanupStack::PushL(ieiDataArray);
|
|
385 |
|
|
386 |
TBuf8<32> itemName( KAlphabet );
|
|
387 |
itemName.AppendNum( num );
|
|
388 |
|
|
389 |
TInt param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
390 |
while ( param != KErrNotFound )
|
|
391 |
{
|
|
392 |
alphabetArray->AppendL(param);
|
|
393 |
itemName = KAlphabet;
|
|
394 |
itemName.AppendNum( ++num );
|
|
395 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
396 |
}
|
|
397 |
num = 1;
|
|
398 |
itemName = KInformationElement;
|
|
399 |
itemName.AppendNum( num );
|
|
400 |
|
|
401 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
402 |
while ( param != KErrNotFound )
|
|
403 |
{
|
|
404 |
informationElementArray->AppendL(param);
|
|
405 |
itemName = KInformationElement;
|
|
406 |
itemName.AppendNum( ++num );
|
|
407 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
408 |
}
|
|
409 |
|
|
410 |
num = 1;
|
|
411 |
itemName = KIEIData;
|
|
412 |
itemName.AppendNum( num );
|
|
413 |
|
|
414 |
for ( TInt i = 1; i <= alphabetArray->Count(); i++ )
|
|
415 |
{
|
|
416 |
|
|
417 |
TInt j = 1;
|
|
418 |
itemName = KIEIData;
|
|
419 |
itemName.AppendNum( i );
|
|
420 |
itemName.AppendNum( j );
|
|
421 |
|
|
422 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
423 |
while ( param != KErrNotFound )
|
|
424 |
{
|
|
425 |
ieiDataArray->AppendL(param);
|
|
426 |
itemName = KIEIData;
|
|
427 |
itemName.AppendNum( i );
|
|
428 |
itemName.AppendNum( ++j );
|
|
429 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
430 |
}
|
|
431 |
ieiDataArray->AppendL(KErrNotFound);
|
|
432 |
|
|
433 |
}
|
|
434 |
|
|
435 |
RPointerArray<CSmsPduDbMessage> array;
|
|
436 |
CleanupResetAndDestroyPushL(array);
|
|
437 |
ReadPduL( sectionName, array );
|
|
438 |
TestSendAndReceiveDifferentIEIsL( array, alphabetArray, informationElementArray, ieiDataArray );
|
|
439 |
CleanupStack::PopAndDestroy(&array);
|
|
440 |
CleanupStack::PopAndDestroy(ieiDataArray);
|
|
441 |
CleanupStack::PopAndDestroy(informationElementArray);
|
|
442 |
CleanupStack::PopAndDestroy(alphabetArray);
|
|
443 |
}
|
|
444 |
else if ( aSection == KTestSendAndReceiveBinaryData )
|
|
445 |
{
|
|
446 |
TInt num( 1 );
|
|
447 |
CArrayFixFlat<TInt>* messageLengthArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
448 |
CleanupStack::PushL(messageLengthArray);
|
|
449 |
|
|
450 |
TBuf8<32> itemName( KMessageLength );
|
|
451 |
itemName.AppendNum( num );
|
|
452 |
|
|
453 |
TInt param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
454 |
while ( param != KErrNotFound )
|
|
455 |
{
|
|
456 |
messageLengthArray->AppendL(param);
|
|
457 |
itemName = KMessageLength;
|
|
458 |
itemName.AppendNum( ++num );
|
|
459 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
460 |
}
|
|
461 |
TestSendAndReceiveBinaryDataL( messageLengthArray );
|
|
462 |
CleanupStack::PopAndDestroy(messageLengthArray);
|
|
463 |
}
|
|
464 |
else if ( aSection == KEnumerateAndWriteAndDeleteMessages )
|
|
465 |
{
|
|
466 |
RPointerArray<CSmsPduDbMessage> array;
|
|
467 |
CleanupResetAndDestroyPushL(array);
|
|
468 |
ReadPduL( sectionName, array );
|
|
469 |
TestEnumerateAndWriteAndDeleteMessagesL( array );
|
|
470 |
CleanupStack::PopAndDestroy(&array);
|
|
471 |
}
|
|
472 |
else if ( aSection == KPDUSlotStoreWithEnumeration )
|
|
473 |
{
|
|
474 |
RPointerArray<CSmsPduDbMessage> array;
|
|
475 |
CleanupResetAndDestroyPushL(array);
|
|
476 |
ReadPduL( sectionName, array );
|
|
477 |
TestPDUSlotStoreWithEnumerationL( array );
|
|
478 |
CleanupStack::PopAndDestroy(&array);
|
|
479 |
}
|
|
480 |
else if ( aSection == KDeleteMessagesWithoutEnumeration )
|
|
481 |
{
|
|
482 |
RPointerArray<CSmsPduDbMessage> array;
|
|
483 |
CleanupResetAndDestroyPushL(array);
|
|
484 |
ReadPduL( sectionName, array );
|
|
485 |
TestDeleteMessagesWithoutEnumerationL( array );
|
|
486 |
CleanupStack::PopAndDestroy(&array);
|
|
487 |
}
|
|
488 |
else if ( aSection == KTestSmartMessaging )
|
|
489 |
{
|
|
490 |
TInt num( 1 );
|
|
491 |
CArrayFixFlat<TInt>* ieiDataArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
492 |
CleanupStack::PushL(ieiDataArray);
|
|
493 |
CArrayFixFlat<TInt>* informationElementArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
494 |
CleanupStack::PushL(informationElementArray);
|
|
495 |
CArrayFixFlat<TInt>* alphabetArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
496 |
CleanupStack::PushL(alphabetArray);
|
|
497 |
|
|
498 |
TBuf8<32> itemName( KAlphabet );
|
|
499 |
itemName.AppendNum( num );
|
|
500 |
|
|
501 |
TInt param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
502 |
while ( param != KErrNotFound )
|
|
503 |
{
|
|
504 |
alphabetArray->AppendL(param);
|
|
505 |
itemName = KAlphabet;
|
|
506 |
itemName.AppendNum( ++num );
|
|
507 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
508 |
}
|
|
509 |
num = 1;
|
|
510 |
itemName = KInformationElement;
|
|
511 |
itemName.AppendNum( num );
|
|
512 |
|
|
513 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
514 |
while ( param != KErrNotFound )
|
|
515 |
{
|
|
516 |
informationElementArray->AppendL(param);
|
|
517 |
itemName = KInformationElement;
|
|
518 |
itemName.AppendNum( ++num );
|
|
519 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
520 |
}
|
|
521 |
|
|
522 |
num = 1;
|
|
523 |
itemName = KIEIData;
|
|
524 |
itemName.AppendNum( num );
|
|
525 |
|
|
526 |
for ( TInt i = 1; i <= alphabetArray->Count(); i++ )
|
|
527 |
{
|
|
528 |
|
|
529 |
TInt j = 1;
|
|
530 |
itemName = KIEIData;
|
|
531 |
itemName.AppendNum( i );
|
|
532 |
itemName.AppendNum( j );
|
|
533 |
|
|
534 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
535 |
while ( param != KErrNotFound )
|
|
536 |
{
|
|
537 |
ieiDataArray->AppendL(param);
|
|
538 |
itemName = KIEIData;
|
|
539 |
itemName.AppendNum( i );
|
|
540 |
itemName.AppendNum( ++j );
|
|
541 |
param = section->ItemValue( (TPtrC8)itemName, KErrNotFound );
|
|
542 |
}
|
|
543 |
ieiDataArray->AppendL(KErrNotFound);
|
|
544 |
|
|
545 |
}
|
|
546 |
|
|
547 |
RPointerArray<CSmsPduDbMessage> array;
|
|
548 |
CleanupResetAndDestroyPushL(array);
|
|
549 |
ReadPduL( sectionName, array );
|
|
550 |
TestSmartMessagingL( array, ieiDataArray, informationElementArray, alphabetArray );
|
|
551 |
CleanupStack::PopAndDestroy(&array);
|
|
552 |
CleanupStack::PopAndDestroy(alphabetArray);
|
|
553 |
CleanupStack::PopAndDestroy(informationElementArray);
|
|
554 |
CleanupStack::PopAndDestroy(ieiDataArray);
|
|
555 |
|
|
556 |
}
|
|
557 |
else if ( aSection == KRetrieveAndStoreSmsParams )
|
|
558 |
{
|
|
559 |
TInt param = section->ItemValue(KSmspEntryValidParams, 2);
|
|
560 |
RMobileSmsMessaging::TMobileSmspStoreValidParams smspEntryValidParams = ( RMobileSmsMessaging::TMobileSmspStoreValidParams )param;
|
|
561 |
param = section->ItemValue(KSmspEntryScTypeOfNumber, 1);
|
|
562 |
RMobilePhone::TMobileTON smspEntryScTypeOfNumber = ( RMobilePhone::TMobileTON )param;
|
|
563 |
param = section->ItemValue(KSmspEntryScNumberPlan, 1);
|
|
564 |
RMobilePhone::TMobileNPI smspEntryScNumberPlan = ( RMobilePhone::TMobileNPI )param;
|
|
565 |
const TDesC8& smspEntryScTelNumber = section->ItemValue(KServiceCentreAddress, (_L8("+358508771010")));
|
|
566 |
|
|
567 |
TestRetrieveAndStoreSmsParamsL(smspEntryValidParams, smspEntryScTypeOfNumber, smspEntryScNumberPlan, smspEntryScTelNumber );
|
|
568 |
}
|
|
569 |
else if ( aSection == KSmsStoreMsgOfDifferentClasses )
|
|
570 |
{
|
|
571 |
TInt num( 0 );
|
|
572 |
CArrayFixFlat<TInt>* smsClassArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
573 |
CleanupStack::PushL(smsClassArray);
|
|
574 |
CArrayFixFlat<TInt>* smsStorageArray = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
|
|
575 |
CleanupStack::PushL(smsStorageArray);
|
|
576 |
|
|
577 |
TBuf8<16> itemName( KSmsClass );
|
|
578 |
itemName.AppendNum( num );
|
|
579 |
|
|
580 |
TInt param = section->ItemValue( (TPtrC8)itemName, 0xFF );
|
|
581 |
while ( param != 0xFF )
|
|
582 |
{
|
|
583 |
smsClassArray->AppendL(param);
|
|
584 |
itemName = KSmsClass;
|
|
585 |
itemName.AppendNum( ++num );
|
|
586 |
param = section->ItemValue( (TPtrC8)itemName, 0xFF );
|
|
587 |
}
|
|
588 |
num = 0;
|
|
589 |
itemName = KSmsStorage;
|
|
590 |
itemName.AppendNum( num );
|
|
591 |
|
|
592 |
param = section->ItemValue( (TPtrC8)itemName, 0xFF );
|
|
593 |
while ( param != 0xFF )
|
|
594 |
{
|
|
595 |
smsStorageArray->AppendL(param);
|
|
596 |
itemName = KSmsStorage;
|
|
597 |
itemName.AppendNum( ++num );
|
|
598 |
param = section->ItemValue( (TPtrC8)itemName, 0xFF );
|
|
599 |
}
|
|
600 |
|
|
601 |
RPointerArray<CSmsPduDbMessage> array;
|
|
602 |
CleanupResetAndDestroyPushL(array);
|
|
603 |
ReadPduL( sectionName, array );
|
|
604 |
TestSmsStoreMsgOfDifferentClassesL( array, smsStorageArray, smsClassArray );
|
|
605 |
CleanupStack::PopAndDestroy(&array);
|
|
606 |
CleanupStack::PopAndDestroy(smsStorageArray);
|
|
607 |
CleanupStack::PopAndDestroy(smsClassArray);
|
|
608 |
}
|
|
609 |
else if ( aSection == KDuplicatePdusOnStore )
|
|
610 |
{
|
|
611 |
RPointerArray<CSmsPduDbMessage> array;
|
|
612 |
CleanupResetAndDestroyPushL(array);
|
|
613 |
ReadPduL( sectionName, array );
|
|
614 |
TestDuplicatePdusOnStoreL( array );
|
|
615 |
CleanupStack::PopAndDestroy(&array);
|
|
616 |
}
|
|
617 |
else if ( aSection == KDeletingMessageInEmptyStore )
|
|
618 |
{
|
|
619 |
RPointerArray<CSmsPduDbMessage> array;
|
|
620 |
CleanupResetAndDestroyPushL(array);
|
|
621 |
ReadPduL( sectionName, array );
|
|
622 |
TestDeletingMessageInEmptyStoreL( array );
|
|
623 |
CleanupStack::PopAndDestroy(&array);
|
|
624 |
}
|
|
625 |
else if ( aSection == KConcatenatedMessages )
|
|
626 |
{
|
|
627 |
RPointerArray<CSmsPduDbMessage> array;
|
|
628 |
CleanupResetAndDestroyPushL(array);
|
|
629 |
ReadPduL( sectionName, array );
|
|
630 |
TestConcatenatedMessagesL( array );
|
|
631 |
CleanupStack::PopAndDestroy(&array);
|
|
632 |
}
|
|
633 |
else if ( aSection == KOutOfMemoryWrite )
|
|
634 |
{
|
|
635 |
RPointerArray<CSmsPduDbMessage> array;
|
|
636 |
CleanupResetAndDestroyPushL(array);
|
|
637 |
ReadPduL( sectionName, array );
|
|
638 |
TestOutOfMemoryWriteL( array );
|
|
639 |
CleanupStack::PopAndDestroy(&array);
|
|
640 |
}
|
|
641 |
else if ( aSection == KOutOfMemoryDelete )
|
|
642 |
{
|
|
643 |
RPointerArray<CSmsPduDbMessage> array;
|
|
644 |
CleanupResetAndDestroyPushL(array);
|
|
645 |
ReadPduL( sectionName, array );
|
|
646 |
TestOutOfMemoryDeleteL( array );
|
|
647 |
CleanupStack::PopAndDestroy(&array);
|
|
648 |
}
|
|
649 |
else if ( aSection == KTestSendSMS2Port0000 )
|
|
650 |
{
|
|
651 |
RPointerArray<CSmsPduDbMessage> array;
|
|
652 |
CleanupResetAndDestroyPushL(array);
|
|
653 |
ReadPduL( sectionName, array );
|
|
654 |
TestSendSMS2Port0000L( array );
|
|
655 |
CleanupStack::PopAndDestroy(&array);
|
|
656 |
}
|
|
657 |
else
|
|
658 |
found = EFalse;
|
|
659 |
}
|
|
660 |
else
|
|
661 |
found = EFalse;
|
|
662 |
|
|
663 |
CleanupStack::PopAndDestroy(configFile);//configFile
|
|
664 |
|
|
665 |
return found;
|
|
666 |
}
|
|
667 |
|
|
668 |
|
|
669 |
void CSmsInterTestStep::ReadPduL( TBuf8<64> aSectionName, RPointerArray<CSmsPduDbMessage>& aArray )
|
|
670 |
{
|
|
671 |
|
|
672 |
CSmsPduDatabase* db = CSmsPduDatabase::NewL(iFs, aSectionName, KConfigFilenameTest, KConfigFileDir);
|
|
673 |
CleanupStack::PushL(db);
|
|
674 |
|
|
675 |
db->GetMessageL(aArray, CSmsPDU::ESmsSubmit);
|
|
676 |
|
|
677 |
CleanupStack::PopAndDestroy(db);
|
|
678 |
}
|
|
679 |
|
|
680 |
|
|
681 |
void CSmsInterTestStep::TestCreateSocketL()
|
|
682 |
/**
|
|
683 |
* @test Create a socket
|
|
684 |
*/
|
|
685 |
{
|
|
686 |
INFO_PRINTF1(_L("Create a socket") );
|
|
687 |
|
|
688 |
RSocketServ socketServer;
|
|
689 |
Connect2EsockLC(socketServer);
|
|
690 |
RSocket socket;
|
|
691 |
TInt ret=socket.Open(socketServer,KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol);
|
|
692 |
TEST(ret==KErrNone);
|
|
693 |
CleanupClosePushL(socket);
|
|
694 |
TSmsAddr smsaddr;
|
|
695 |
smsaddr.SetSmsAddrFamily(ESmsAddrRecvAny);
|
|
696 |
ret=socket.Bind(smsaddr);
|
|
697 |
TEST(ret==KErrNone);
|
|
698 |
CleanupStack::PopAndDestroy(&socket);
|
|
699 |
|
|
700 |
User::After(2000000); // wait for socket to close before reopening
|
|
701 |
|
|
702 |
RSocket socket2;
|
|
703 |
ret=socket2.Open(socketServer,KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol);
|
|
704 |
TEST(ret==KErrNone);
|
|
705 |
CleanupClosePushL(socket2);
|
|
706 |
smsaddr.SetSmsAddrFamily(ESmsAddrRecvAny);
|
|
707 |
ret=socket2.Bind(smsaddr);
|
|
708 |
TEST(ret==KErrNone);
|
|
709 |
CleanupStack::PopAndDestroy(&socket2);
|
|
710 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
711 |
|
|
712 |
User::After(2000000); // wait for socket to close before reopening
|
|
713 |
}
|
|
714 |
|
|
715 |
|
|
716 |
void CSmsInterTestStep::TestPublicMethodsL( const RPointerArray<CSmsPduDbMessage>& aArray )
|
|
717 |
/**
|
|
718 |
* @test Briefly test all public methods
|
|
719 |
*/
|
|
720 |
{
|
|
721 |
INFO_PRINTF1(_L("Briefly test all public methods"));
|
|
722 |
|
|
723 |
RSocketServ socketServer;
|
|
724 |
Connect2EsockLC(socketServer);
|
|
725 |
|
|
726 |
CSmsBuffer* smsBuffer=CSmsBuffer::NewL();
|
|
727 |
CSmsPDU::TSmsPDUType pdu = CSmsPDU::ESmsSubmit;
|
|
728 |
CSmsMessage* smsMsg = CSmsMessage::NewL(iFs, pdu,smsBuffer);
|
|
729 |
CleanupStack::PushL(smsMsg);
|
|
730 |
|
|
731 |
smsMsg->IsComplete();
|
|
732 |
smsMsg->IsDecoded();
|
|
733 |
smsMsg->Status();
|
|
734 |
|
|
735 |
smsMsg->SetStatus(NMobileSmsStore::EStoredMessageUnread);
|
|
736 |
|
|
737 |
smsMsg->LogServerId();
|
|
738 |
smsMsg->SetLogServerId(1);
|
|
739 |
smsMsg->Time();
|
|
740 |
|
|
741 |
TTime time;
|
|
742 |
time.UniversalTime();
|
|
743 |
smsMsg->SetTime(time);
|
|
744 |
smsMsg->SetUTCOffset(User::UTCOffset());
|
|
745 |
smsMsg->UTCOffset();
|
|
746 |
|
|
747 |
smsMsg->ServiceCenterAddress();
|
|
748 |
smsMsg->SetServiceCenterAddressL(_L("+44385016005"));
|
|
749 |
|
|
750 |
TGsmSmsTelNumber address;
|
|
751 |
smsMsg->ParsedServiceCenterAddress(address);
|
|
752 |
smsMsg->SetParsedServiceCenterAddressL(address);
|
|
753 |
TPtrC toFromAddress=smsMsg->ToFromAddress();
|
|
754 |
smsMsg->SetToFromAddressL(toFromAddress);
|
|
755 |
smsMsg->ParsedToFromAddress(address);
|
|
756 |
smsMsg->SetParsedToFromAddressL(address);
|
|
757 |
|
|
758 |
smsMsg->TextPresent();
|
|
759 |
smsMsg->NumMessagePDUsL();
|
|
760 |
smsMsg->MaxMessageLength();
|
|
761 |
smsMsg->MessageLengthL();
|
|
762 |
|
|
763 |
TSmsUserDataSettings smsSettings;
|
|
764 |
smsMsg->UserDataSettings(smsSettings);
|
|
765 |
smsMsg->SetUserDataSettingsL(smsSettings);
|
|
766 |
|
|
767 |
TInt numUnconvChars;
|
|
768 |
TInt indexOfFirstUnconvChar;
|
|
769 |
|
|
770 |
TInt bufLen=aArray[0]->iSmsMessage->Buffer().Length();
|
|
771 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
772 |
CleanupStack::PushL(textBuf);
|
|
773 |
TPtr textPtr(textBuf->Des());
|
|
774 |
aArray[0]->iSmsMessage->Buffer().Extract(textPtr,0,bufLen);
|
|
775 |
|
|
776 |
smsMsg->IsSupportedL(textPtr,numUnconvChars,indexOfFirstUnconvChar);
|
|
777 |
|
|
778 |
CArrayFix<TGsmSms>* smsArray= new(ELeave) CArrayFixFlat<TGsmSms>(10);
|
|
779 |
CleanupStack::PushL(smsArray);
|
|
780 |
smsMsg->EncodeMessagePDUsL(*smsArray);
|
|
781 |
|
|
782 |
CleanupStack::PopAndDestroy(smsArray);
|
|
783 |
CleanupStack::PopAndDestroy(textBuf);
|
|
784 |
CleanupStack::PopAndDestroy(smsMsg);
|
|
785 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
786 |
|
|
787 |
User::After(2000000); // wait for socket to close before reopening
|
|
788 |
}
|
|
789 |
|
|
790 |
|
|
791 |
CSmsMessage* CSmsInterTestStep::CreateAndSetMessageWithOneIEL( const RPointerArray<CSmsPduDbMessage>& aArray, TInt aArrayIndex )
|
|
792 |
{
|
|
793 |
/*
|
|
794 |
* Create messages and set them up for SIM storage
|
|
795 |
*/
|
|
796 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
797 |
|
|
798 |
CSmsBufferBase& smsBuffer=aArray[aArrayIndex]->iSmsMessage->Buffer();
|
|
799 |
TInt bufLen=smsBuffer.Length();
|
|
800 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
801 |
CleanupStack::PushL(textBuf);
|
|
802 |
TPtr buffer(textBuf->Des());
|
|
803 |
smsBuffer.Extract(buffer,0,bufLen);
|
|
804 |
|
|
805 |
CSmsMessage* smsMessage=CreateSmsMessageL(buffer,alphabet);
|
|
806 |
CleanupStack::PopAndDestroy(textBuf);
|
|
807 |
|
|
808 |
// add information element
|
|
809 |
CEmsFormatIE* object = CEmsFormatIE::NewL();
|
|
810 |
object->SetStartPosition(4);
|
|
811 |
object->SetFormatLength(5);
|
|
812 |
object->SetBold(ETrue);
|
|
813 |
CleanupStack::PushL(object);
|
|
814 |
smsMessage->AddEMSInformationElementL(*object);
|
|
815 |
CleanupStack::PopAndDestroy(object);
|
|
816 |
|
|
817 |
smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage);
|
|
818 |
return smsMessage;
|
|
819 |
}
|
|
820 |
|
|
821 |
|
|
822 |
CSmsMessage* CSmsInterTestStep::CreateAndSetMessageWithOneIEOnPhoneL( const RPointerArray<CSmsPduDbMessage>& aArray, TInt aArrayIndex )
|
|
823 |
{
|
|
824 |
/*
|
|
825 |
* Create messages and set them up for phone storage
|
|
826 |
*/
|
|
827 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
828 |
|
|
829 |
CSmsBufferBase& smsBuffer=aArray[aArrayIndex]->iSmsMessage->Buffer();
|
|
830 |
TInt bufLen=smsBuffer.Length();
|
|
831 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
832 |
CleanupStack::PushL(textBuf);
|
|
833 |
TPtr buffer(textBuf->Des());
|
|
834 |
smsBuffer.Extract(buffer,0,bufLen);
|
|
835 |
|
|
836 |
CSmsMessage* smsMessage=CreateSmsMessageL(buffer,alphabet);
|
|
837 |
CleanupStack::PopAndDestroy(textBuf);
|
|
838 |
|
|
839 |
// add information element
|
|
840 |
CEmsFormatIE* object = CEmsFormatIE::NewL();
|
|
841 |
object->SetStartPosition(4);
|
|
842 |
object->SetFormatLength(5);
|
|
843 |
object->SetBold(ETrue);
|
|
844 |
CleanupStack::PushL(object);
|
|
845 |
smsMessage->AddEMSInformationElementL(*object);
|
|
846 |
CleanupStack::Pop(object);
|
|
847 |
|
|
848 |
smsMessage->SetStorage(CSmsMessage::ESmsPhoneStorage);
|
|
849 |
return smsMessage;
|
|
850 |
}
|
|
851 |
|
|
852 |
|
|
853 |
HBufC8* CSmsInterTestStep::CreatePictureBufferL(const CFbsBitmap& aBitmap)
|
|
854 |
/**
|
|
855 |
* Creates buffer and fullfills it bny contents of the bitmap
|
|
856 |
*/
|
|
857 |
{
|
|
858 |
const TSize size = aBitmap.SizeInPixels();
|
|
859 |
const TInt numLineBytes = size.iWidth/8;
|
|
860 |
HBufC8* pictureBuf = HBufC8::NewLC(numLineBytes * size.iHeight);
|
|
861 |
|
|
862 |
HBufC8* scanLine = HBufC8::NewLC(numLineBytes);
|
|
863 |
TPtr8 line(scanLine->Des());
|
|
864 |
|
|
865 |
HBufC8* working = HBufC8::NewLC(numLineBytes);
|
|
866 |
TPtr8 convertedScanLine(working->Des());
|
|
867 |
convertedScanLine.SetLength(numLineBytes);
|
|
868 |
|
|
869 |
for (TInt a=0; a<size.iHeight; a++)
|
|
870 |
{
|
|
871 |
aBitmap.GetScanLine(line, TPoint(0,a), size.iWidth, EGray2);
|
|
872 |
|
|
873 |
for (TInt word=0; word<numLineBytes; word++)
|
|
874 |
{
|
|
875 |
convertedScanLine[word] = line[word];
|
|
876 |
}
|
|
877 |
|
|
878 |
pictureBuf->Des().Append(convertedScanLine);
|
|
879 |
}
|
|
880 |
|
|
881 |
CleanupStack::PopAndDestroy(2, scanLine);
|
|
882 |
return pictureBuf;
|
|
883 |
}
|
|
884 |
|
|
885 |
|
|
886 |
TBool CSmsInterTestStep::CompareEmsElementL(const CEmsInformationElement& aOriginalElement,RPointerArray<const CEmsInformationElement>& aOtherElementsArray)
|
|
887 |
/**
|
|
888 |
* Finds a EMS information element in the array and compares contents against found object
|
|
889 |
*/
|
|
890 |
{
|
|
891 |
TBool ret=EFalse;
|
|
892 |
TUint startPosition=aOriginalElement.StartPosition();
|
|
893 |
TSmsId id=aOriginalElement.Identifier();
|
|
894 |
|
|
895 |
TInt count=aOtherElementsArray.Count();
|
|
896 |
TInt i=0;
|
|
897 |
const CEmsInformationElement* ie=NULL;
|
|
898 |
|
|
899 |
if(id == CSmsInformationElement::ESmsEnhancedTextFormatting)
|
|
900 |
{
|
|
901 |
for ( i=--count; ret == EFalse && i >= 0 ; --i)
|
|
902 |
{
|
|
903 |
ie = aOtherElementsArray[i];
|
|
904 |
if(ie->Identifier() == CSmsInformationElement::ESmsEnhancedTextFormatting)
|
|
905 |
{
|
|
906 |
CEmsFormatIE& formatIe = (CEmsFormatIE&) *ie;
|
|
907 |
if(startPosition == formatIe.StartPosition()
|
|
908 |
&& ((CEmsFormatIE&)aOriginalElement).Bold()==formatIe.Bold()
|
|
909 |
&& ((CEmsFormatIE&)aOriginalElement).Italic()==formatIe.Italic()
|
|
910 |
&& ((CEmsFormatIE&)aOriginalElement).Underline()==formatIe.Underline()
|
|
911 |
&& ((CEmsFormatIE&)aOriginalElement).Strikethrough()==formatIe.Strikethrough()
|
|
912 |
&& ((CEmsFormatIE&)aOriginalElement).Alignment()==formatIe.Alignment()
|
|
913 |
&& ((CEmsFormatIE&)aOriginalElement).FontSize()==formatIe.FontSize())
|
|
914 |
{
|
|
915 |
ret= ETrue;
|
|
916 |
}
|
|
917 |
if(ret)
|
|
918 |
{
|
|
919 |
if(((CEmsFormatIE&)aOriginalElement).FormatLength()==formatIe.FormatLength())break;
|
|
920 |
else if(((CEmsFormatIE&)aOriginalElement).FormatLength() > formatIe.FormatLength())
|
|
921 |
{ // just in case original format length goes beyond text
|
|
922 |
CEmsFormatIE* object2 = (CEmsFormatIE*)aOriginalElement.DuplicateL();
|
|
923 |
CleanupStack::PushL(object2);
|
|
924 |
aOtherElementsArray.Remove(i);
|
|
925 |
object2->SetFormatLength(formatIe.FormatLength()-formatIe.FormatLength());
|
|
926 |
object2->SetStartPosition(formatIe.StartPosition()+formatIe.FormatLength());
|
|
927 |
ret=CompareEmsElementL(*object2,aOtherElementsArray);
|
|
928 |
CleanupStack::PopAndDestroy(object2);
|
|
929 |
}
|
|
930 |
}
|
|
931 |
}
|
|
932 |
|
|
933 |
}
|
|
934 |
}
|
|
935 |
else
|
|
936 |
{
|
|
937 |
for ( i=--count; ret == EFalse && i >= 0 ; --i)
|
|
938 |
{
|
|
939 |
ie = aOtherElementsArray[i];
|
|
940 |
if(startPosition == ie->StartPosition() && id == ie->Identifier())
|
|
941 |
{
|
|
942 |
// compare contents
|
|
943 |
switch (id)
|
|
944 |
{
|
|
945 |
case CSmsInformationElement::ESmsEnhancedUserDefinedSound:
|
|
946 |
{
|
|
947 |
CEmsSoundIE& soundIe = (CEmsSoundIE&)*ie;
|
|
948 |
const HBufC8* melody=soundIe.Melody();
|
|
949 |
|
|
950 |
const HBufC8* originalMelody=((CEmsSoundIE&)aOriginalElement).Melody();
|
|
951 |
|
|
952 |
if(Mem::Compare(melody->Ptr(),melody->Size(),
|
|
953 |
originalMelody->Ptr(),originalMelody->Size())==0)
|
|
954 |
{
|
|
955 |
aOtherElementsArray.Remove(i);
|
|
956 |
ret=ETrue;
|
|
957 |
}
|
|
958 |
}
|
|
959 |
break;
|
|
960 |
case CSmsInformationElement::ESmsEnhancedPredefinedSound:
|
|
961 |
{
|
|
962 |
CEmsPreDefSoundIE& soundIe = (CEmsPreDefSoundIE&) *ie;
|
|
963 |
if(((CEmsPreDefSoundIE&)aOriginalElement).PredefinedSound()==soundIe.PredefinedSound())
|
|
964 |
{
|
|
965 |
aOtherElementsArray.Remove(i);
|
|
966 |
ret=ETrue;
|
|
967 |
}
|
|
968 |
}
|
|
969 |
break;
|
|
970 |
case CSmsInformationElement::ESmsEnhancedSmallPicture:
|
|
971 |
case CSmsInformationElement::ESmsEnhancedLargePicture:
|
|
972 |
case CSmsInformationElement::ESmsEnhancedVariablePicture:
|
|
973 |
{
|
|
974 |
CEmsPictureIE& picIe = (CEmsPictureIE&) *ie;
|
|
975 |
CFbsBitmap* pic = picIe.GetBitmapL();
|
|
976 |
CleanupStack::PushL(pic);
|
|
977 |
|
|
978 |
CFbsBitmap* originalPic = ((CEmsPictureIE&)aOriginalElement).GetBitmapL();
|
|
979 |
CleanupStack::PushL(originalPic);
|
|
980 |
|
|
981 |
if(pic->SizeInPixels()==originalPic->SizeInPixels())
|
|
982 |
{
|
|
983 |
const HBufC8* picBuf=CreatePictureBufferL(*pic);
|
|
984 |
const HBufC8* originalPicBuf=CreatePictureBufferL(*originalPic);
|
|
985 |
|
|
986 |
if(Mem::Compare(picBuf->Ptr(),picBuf->Size(),
|
|
987 |
originalPicBuf->Ptr(),originalPicBuf->Size())==0)
|
|
988 |
{
|
|
989 |
aOtherElementsArray.Remove(i);
|
|
990 |
ret=ETrue;
|
|
991 |
}
|
|
992 |
CleanupStack::PopAndDestroy(2);
|
|
993 |
}
|
|
994 |
|
|
995 |
CleanupStack::PopAndDestroy(originalPic);
|
|
996 |
CleanupStack::PopAndDestroy(pic);
|
|
997 |
}
|
|
998 |
break;
|
|
999 |
case CSmsInformationElement::ESmsEnhancedSmallAnimation:
|
|
1000 |
case CSmsInformationElement::ESmsEnhancedLargeAnimation:
|
|
1001 |
{
|
|
1002 |
CEmsAnimationIE& picIe = (CEmsAnimationIE&) *ie;
|
|
1003 |
CFbsBitmap* pic = picIe.GetBitmapL();
|
|
1004 |
CleanupStack::PushL(pic);
|
|
1005 |
|
|
1006 |
CFbsBitmap* originalPic = ((CEmsAnimationIE&)aOriginalElement).GetBitmapL();
|
|
1007 |
CleanupStack::PushL(originalPic);
|
|
1008 |
|
|
1009 |
if(pic->SizeInPixels()==originalPic->SizeInPixels())
|
|
1010 |
{
|
|
1011 |
const HBufC8* picBuf=CreatePictureBufferL(*pic);
|
|
1012 |
const HBufC8* originalPicBuf=CreatePictureBufferL(*originalPic);
|
|
1013 |
|
|
1014 |
if(Mem::Compare(picBuf->Ptr(),picBuf->Size(),
|
|
1015 |
originalPicBuf->Ptr(),originalPicBuf->Size())==0)
|
|
1016 |
{
|
|
1017 |
aOtherElementsArray.Remove(i);
|
|
1018 |
ret=ETrue;
|
|
1019 |
}
|
|
1020 |
CleanupStack::PopAndDestroy(2);
|
|
1021 |
}
|
|
1022 |
|
|
1023 |
CleanupStack::PopAndDestroy(originalPic);
|
|
1024 |
CleanupStack::PopAndDestroy(pic);
|
|
1025 |
}
|
|
1026 |
break;
|
|
1027 |
case CSmsInformationElement::ESmsEnhancedPredefinedAnimation:
|
|
1028 |
{
|
|
1029 |
CEmsPreDefAnimationIE& animIe = (CEmsPreDefAnimationIE&) *ie;
|
|
1030 |
if(((CEmsPreDefAnimationIE&)aOriginalElement).Animation()==animIe.Animation())
|
|
1031 |
{
|
|
1032 |
aOtherElementsArray.Remove(i);
|
|
1033 |
ret=ETrue;
|
|
1034 |
}
|
|
1035 |
}
|
|
1036 |
break;
|
|
1037 |
case CSmsInformationElement::ESmsEnhancedUserPromptIndicator:
|
|
1038 |
{
|
|
1039 |
CEmsUserPrompt& upIe = (CEmsUserPrompt&) *ie;
|
|
1040 |
if(((CEmsUserPrompt&)aOriginalElement).ObjectCount()==upIe.ObjectCount())
|
|
1041 |
{
|
|
1042 |
aOtherElementsArray.Remove(i);
|
|
1043 |
ret=ETrue;
|
|
1044 |
}
|
|
1045 |
}
|
|
1046 |
break;
|
|
1047 |
case CSmsInformationElement::ESmsEnhancedODI:
|
|
1048 |
{
|
|
1049 |
CEmsObjectDistribution& upIe = (CEmsObjectDistribution&) *ie;
|
|
1050 |
if(((CEmsObjectDistribution&)aOriginalElement).ObjectCount()==upIe.ObjectCount() && ((CEmsObjectDistribution&)aOriginalElement).Forwarding()==upIe.Forwarding())
|
|
1051 |
{
|
|
1052 |
aOtherElementsArray.Remove(i);
|
|
1053 |
ret=ETrue;
|
|
1054 |
}
|
|
1055 |
}
|
|
1056 |
break;
|
|
1057 |
default:
|
|
1058 |
break;
|
|
1059 |
} //end switch id
|
|
1060 |
} // end if start position and identifier
|
|
1061 |
} //end for
|
|
1062 |
} //end else
|
|
1063 |
return ret;
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
|
|
1067 |
void CSmsInterTestStep::CompareEmsElementsL(CSmsMessage& aOriginalMessage,CSmsMessage& aOtherMessage)
|
|
1068 |
/**
|
|
1069 |
* Compares contents of EMS messages
|
|
1070 |
*/
|
|
1071 |
{
|
|
1072 |
// extract and compare text
|
|
1073 |
CSmsBufferBase& sendBuffer=aOriginalMessage.Buffer();
|
|
1074 |
CSmsBufferBase& recvBuffer=aOtherMessage.Buffer();
|
|
1075 |
TInt sendBufLen=sendBuffer.Length();
|
|
1076 |
TInt recvBufLen=recvBuffer.Length();
|
|
1077 |
HBufC* sendTextBuf=HBufC::NewL(sendBufLen);
|
|
1078 |
CleanupStack::PushL(sendTextBuf);
|
|
1079 |
HBufC* recvTextBuf=HBufC::NewL(recvBufLen);
|
|
1080 |
CleanupStack::PushL(recvTextBuf);
|
|
1081 |
|
|
1082 |
TPtr sendTextPtr(sendTextBuf->Des());
|
|
1083 |
TPtr recvTextPtr(recvTextBuf->Des());
|
|
1084 |
sendBuffer.Extract(sendTextPtr,0,sendBufLen);
|
|
1085 |
recvBuffer.Extract(recvTextPtr,0,recvBufLen);
|
|
1086 |
|
|
1087 |
if (sendTextPtr==recvTextPtr)
|
|
1088 |
{
|
|
1089 |
INFO_PRINTF1(_L("Incoming text matches outgoing text!") );
|
|
1090 |
}
|
|
1091 |
else
|
|
1092 |
{
|
|
1093 |
INFO_PRINTF1(_L("Incoming text does not match outgoing text!"));
|
|
1094 |
|
|
1095 |
if (aOriginalMessage.SmsPDU().Alphabet() == TSmsDataCodingScheme::ESmsAlphabetUCS2)
|
|
1096 |
{
|
|
1097 |
INFO_PRINTF1(_L("<font color=Orange>This is a UCS2 message and some Service Centres (such as Vodafone UK) can drop the last character at the end of a PDU.</font>"));
|
|
1098 |
INFO_PRINTF1(_L("<font color=Orange>If the incoming text message is similiar to the outgoing one, then ignore the failure.</font>"));
|
|
1099 |
}
|
|
1100 |
|
|
1101 |
INFO_PRINTF2(_L("Outgoing text was: \"%S\""), &sendTextPtr);
|
|
1102 |
INFO_PRINTF2(_L("Incoming text was: \"%S\""), &recvTextPtr);
|
|
1103 |
|
|
1104 |
TEST(sendTextPtr==recvTextPtr);
|
|
1105 |
}
|
|
1106 |
|
|
1107 |
//compare number of segments
|
|
1108 |
TInt numSendMsg = aOriginalMessage.NumMessagePDUsL();
|
|
1109 |
TInt numRecvMsg = aOtherMessage.NumMessagePDUsL();
|
|
1110 |
|
|
1111 |
TEST(numSendMsg==numRecvMsg);
|
|
1112 |
INFO_PRINTF2(_L("Incoming number of segments = %d matches outgoing!"), numRecvMsg);
|
|
1113 |
|
|
1114 |
// now compare IEs
|
|
1115 |
const RPointerArray<const CEmsInformationElement>& emsOriginalElements= aOriginalMessage.GetEMSInformationElementsL();
|
|
1116 |
RPointerArray<const CEmsInformationElement> copyOfOriginalElements;
|
|
1117 |
CleanupClosePushL(copyOfOriginalElements);
|
|
1118 |
|
|
1119 |
const RPointerArray<const CEmsInformationElement>& emsOtherElements= aOtherMessage.GetEMSInformationElementsL();
|
|
1120 |
RPointerArray<const CEmsInformationElement> copyOfOtherElements;
|
|
1121 |
CleanupClosePushL(copyOfOtherElements);
|
|
1122 |
|
|
1123 |
TInt originalCount=emsOriginalElements.Count();
|
|
1124 |
TInt i=0;
|
|
1125 |
const CEmsInformationElement* ie=NULL;
|
|
1126 |
|
|
1127 |
for ( i=--originalCount; i >= 0 ; --i)
|
|
1128 |
{
|
|
1129 |
ie = emsOriginalElements[i];
|
|
1130 |
copyOfOriginalElements.Append(ie);
|
|
1131 |
}
|
|
1132 |
|
|
1133 |
TInt otherCount=emsOtherElements.Count();
|
|
1134 |
|
|
1135 |
for ( i=--otherCount; i >= 0 ; --i)
|
|
1136 |
{
|
|
1137 |
ie = emsOtherElements[i];
|
|
1138 |
copyOfOtherElements.Append(ie);
|
|
1139 |
}
|
|
1140 |
|
|
1141 |
TBool ret=EFalse;
|
|
1142 |
FbsStartup();
|
|
1143 |
User::LeaveIfError(RFbsSession::Connect());
|
|
1144 |
|
|
1145 |
i=0;
|
|
1146 |
while(i < originalCount)
|
|
1147 |
{
|
|
1148 |
const CEmsInformationElement& ie=*copyOfOriginalElements[i];
|
|
1149 |
if(ie.Identifier()==CSmsInformationElement::ESmsEnhancedTextFormatting)
|
|
1150 |
{
|
|
1151 |
const CEmsFormatIE& formatIE=(CEmsFormatIE&)ie;
|
|
1152 |
if(aOriginalMessage.MessageLengthL() < (TInt)(formatIE.FormatLength() + formatIE.StartPosition()))
|
|
1153 |
{
|
|
1154 |
CEmsFormatIE* newIE=(CEmsFormatIE*)ie.DuplicateL();
|
|
1155 |
CleanupStack::PushL(newIE);
|
|
1156 |
newIE->SetFormatLength(aOriginalMessage.MessageLengthL()-formatIE.StartPosition());
|
|
1157 |
ret=CompareEmsElementL(*newIE,copyOfOtherElements);
|
|
1158 |
CleanupStack::PopAndDestroy(newIE);
|
|
1159 |
}
|
|
1160 |
else
|
|
1161 |
ret=CompareEmsElementL(ie,copyOfOtherElements);
|
|
1162 |
}
|
|
1163 |
else
|
|
1164 |
ret=CompareEmsElementL(ie,copyOfOtherElements);
|
|
1165 |
if(ret)
|
|
1166 |
{
|
|
1167 |
}
|
|
1168 |
else
|
|
1169 |
{
|
|
1170 |
switch (ie.Identifier())
|
|
1171 |
{
|
|
1172 |
case CSmsInformationElement::ESmsEnhancedTextFormatting:
|
|
1173 |
{
|
|
1174 |
CEmsFormatIE& formatIe = (CEmsFormatIE&) ie;
|
|
1175 |
INFO_PRINTF6(_L("Cannot find FormatIE : start position: %d format length: %d bold: %d italic: %d alignment: %d "), formatIe.StartPosition(),formatIe.FormatLength(),formatIe.Bold(),formatIe.Italic(),formatIe.Alignment());
|
|
1176 |
//gTest.Getch();
|
|
1177 |
}
|
|
1178 |
break;
|
|
1179 |
case CSmsInformationElement::ESmsEnhancedUserDefinedSound:
|
|
1180 |
{
|
|
1181 |
CEmsSoundIE& soundIe = (CEmsSoundIE&) ie;
|
|
1182 |
INFO_PRINTF3(_L("Cannot find UserDefinedSoundIE start position: %d size: %d"),soundIe.StartPosition(),soundIe.Melody()->Size());
|
|
1183 |
//gTest.Getch();
|
|
1184 |
}
|
|
1185 |
break;
|
|
1186 |
case CSmsInformationElement::ESmsEnhancedPredefinedSound:
|
|
1187 |
{
|
|
1188 |
CEmsPreDefSoundIE& soundIe = (CEmsPreDefSoundIE&) ie;
|
|
1189 |
INFO_PRINTF3(_L("Cannot find PrefinedSoundIE start position: %d type: %d "),soundIe.StartPosition(),soundIe.PredefinedSound());
|
|
1190 |
//gTest.Getch();
|
|
1191 |
}
|
|
1192 |
break;
|
|
1193 |
case CSmsInformationElement::ESmsEnhancedSmallPicture:
|
|
1194 |
{
|
|
1195 |
CEmsPictureIE& picIe = (CEmsPictureIE&) ie;
|
|
1196 |
INFO_PRINTF4(_L("Cannot find SmallPictureIE start position: %d width: %d height: %d"),picIe.StartPosition(),picIe.SizeInPixels().iWidth,picIe.SizeInPixels().iHeight);
|
|
1197 |
//gTest.Getch();
|
|
1198 |
}
|
|
1199 |
break;
|
|
1200 |
case CSmsInformationElement::ESmsEnhancedLargePicture:
|
|
1201 |
{
|
|
1202 |
CEmsPictureIE& picIe = (CEmsPictureIE&) ie;
|
|
1203 |
INFO_PRINTF4(_L("Cannot find LargePictureIE start position: %d width: %d height: %d"),picIe.StartPosition(),picIe.SizeInPixels().iWidth,picIe.SizeInPixels().iHeight);
|
|
1204 |
//gTest.Getch();
|
|
1205 |
}
|
|
1206 |
break;
|
|
1207 |
case CSmsInformationElement::ESmsEnhancedVariablePicture:
|
|
1208 |
{
|
|
1209 |
CEmsPictureIE& picIe = (CEmsPictureIE&) ie;
|
|
1210 |
INFO_PRINTF4(_L("Cannot find VariablePictureIE start position: %d width: %d height: %d"),picIe.StartPosition(),picIe.SizeInPixels().iWidth,picIe.SizeInPixels().iHeight);
|
|
1211 |
//gTest.Getch();
|
|
1212 |
}
|
|
1213 |
break;
|
|
1214 |
case CSmsInformationElement::ESmsEnhancedSmallAnimation:
|
|
1215 |
{
|
|
1216 |
CEmsAnimationIE& picIe = (CEmsAnimationIE&) ie;
|
|
1217 |
INFO_PRINTF2(_L("Cannot find SmallAnimationIE start position: %d "),picIe.StartPosition());
|
|
1218 |
//gTest.Getch();
|
|
1219 |
}
|
|
1220 |
break;
|
|
1221 |
case CSmsInformationElement::ESmsEnhancedLargeAnimation:
|
|
1222 |
{
|
|
1223 |
CEmsAnimationIE& picIe = (CEmsAnimationIE&) ie;
|
|
1224 |
INFO_PRINTF2(_L("Cannot find LargeAnimationIE start position %d "),picIe.StartPosition());
|
|
1225 |
//gTest.Getch();
|
|
1226 |
}
|
|
1227 |
break;
|
|
1228 |
case CSmsInformationElement::ESmsEnhancedPredefinedAnimation:
|
|
1229 |
{
|
|
1230 |
CEmsPreDefAnimationIE& animIe = (CEmsPreDefAnimationIE&) ie;
|
|
1231 |
INFO_PRINTF3(_L("Cannot find PreDefinedAnimationIE start position: %d type: %d "),animIe.StartPosition(),animIe.Animation());
|
|
1232 |
//gTest.Getch();
|
|
1233 |
}
|
|
1234 |
break;
|
|
1235 |
case CSmsInformationElement::ESmsEnhancedUserPromptIndicator:
|
|
1236 |
{
|
|
1237 |
CEmsUserPrompt& upIe = (CEmsUserPrompt&) ie;
|
|
1238 |
INFO_PRINTF3(_L("Cannot find UserPromptIE start position:%d number of objects: %d"),upIe.StartPosition(),upIe.ObjectCount() );
|
|
1239 |
//gTest.Getch();
|
|
1240 |
}
|
|
1241 |
break;
|
|
1242 |
case CSmsInformationElement::ESmsEnhancedODI:
|
|
1243 |
{
|
|
1244 |
CEmsObjectDistribution& odiIe = (CEmsObjectDistribution&) ie;
|
|
1245 |
INFO_PRINTF4(_L("Cannot find ObjectDistributionIE start position:%d number of objects: %d forwarding: %d"),odiIe.StartPosition(),odiIe.ObjectCount(), odiIe.Forwarding() );
|
|
1246 |
//gTest.Getch();
|
|
1247 |
}
|
|
1248 |
break;
|
|
1249 |
default:
|
|
1250 |
break;
|
|
1251 |
}
|
|
1252 |
}
|
|
1253 |
i++;
|
|
1254 |
}
|
|
1255 |
RFbsSession::Disconnect();
|
|
1256 |
CleanupStack::PopAndDestroy(©OfOtherElements);
|
|
1257 |
CleanupStack::PopAndDestroy(©OfOriginalElements);
|
|
1258 |
CleanupStack::PopAndDestroy(recvTextBuf);
|
|
1259 |
CleanupStack::PopAndDestroy(sendTextBuf);
|
|
1260 |
}
|
|
1261 |
|
|
1262 |
|
|
1263 |
void CSmsInterTestStep::SendRecvTextFormated7BitEMSL()
|
|
1264 |
/**
|
|
1265 |
* @test Send and Receive 7Bit EMS message with all supported formating
|
|
1266 |
*/
|
|
1267 |
{
|
|
1268 |
INFO_PRINTF1(_L("Send and receive 7Bit Ems message with text formating "));
|
|
1269 |
|
|
1270 |
RSocketServ socketServer;
|
|
1271 |
Connect2EsockLC(socketServer);
|
|
1272 |
RSocket socket;
|
|
1273 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
1274 |
|
|
1275 |
// create EMS message
|
|
1276 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
1277 |
CSmsMessage* sendMessage=CreateSmsMessageL(KFormatedMsg2,alphabet);
|
|
1278 |
CleanupStack::PushL(sendMessage);
|
|
1279 |
|
|
1280 |
// add information element
|
|
1281 |
CEmsFormatIE* object = CEmsFormatIE::NewL();
|
|
1282 |
object->SetStartPosition(5);
|
|
1283 |
object->SetFormatLength(10);
|
|
1284 |
object->SetBold(ETrue);
|
|
1285 |
object->SetItalic(ETrue);
|
|
1286 |
object->SetUnderline(ETrue);
|
|
1287 |
object->SetStrikethrough(ETrue);
|
|
1288 |
object->SetAlignment(CEmsFormatIE::ECenter);
|
|
1289 |
object->SetFontSize(CEmsFormatIE::ELarge);
|
|
1290 |
CleanupStack::PushL(object);
|
|
1291 |
sendMessage->AddEMSInformationElementL(*object);
|
|
1292 |
CleanupStack::PopAndDestroy(object);
|
|
1293 |
|
|
1294 |
|
|
1295 |
// send EMS message
|
|
1296 |
SendSmsL(sendMessage,socket);
|
|
1297 |
|
|
1298 |
WaitForRecvL(socket);
|
|
1299 |
|
|
1300 |
CSmsMessage* recvMessage = RecvSmsL(socket);
|
|
1301 |
CleanupStack::PushL(recvMessage);
|
|
1302 |
//compare send and received messages
|
|
1303 |
CompareEmsElementsL(*sendMessage, *recvMessage);
|
|
1304 |
|
|
1305 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
1306 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
1307 |
CleanupStack::PopAndDestroy(&socket);
|
|
1308 |
//closing is too fast when using EKA2
|
|
1309 |
User::After(2000000);
|
|
1310 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
1311 |
|
|
1312 |
|
|
1313 |
|
|
1314 |
User::After(2000000); // wait for socket to close before reopening
|
|
1315 |
}
|
|
1316 |
|
|
1317 |
void CSmsInterTestStep::SendRecvTextFormated8BitEMSL()
|
|
1318 |
/**
|
|
1319 |
* @test Send and Receive 8Bit EMS message with all supported formating
|
|
1320 |
*/
|
|
1321 |
{
|
|
1322 |
INFO_PRINTF1(_L("Send and receive 8Bit Ems message with text formating "));
|
|
1323 |
|
|
1324 |
RSocketServ socketServer;
|
|
1325 |
Connect2EsockLC(socketServer);
|
|
1326 |
RSocket socket;
|
|
1327 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
1328 |
|
|
1329 |
// create EMS message
|
|
1330 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit;
|
|
1331 |
CSmsMessage* sendMessage=CreateSmsMessageL(KFormatedMsg2,alphabet);
|
|
1332 |
CleanupStack::PushL(sendMessage);
|
|
1333 |
|
|
1334 |
// add information element
|
|
1335 |
CEmsFormatIE* object = CEmsFormatIE::NewL();
|
|
1336 |
object->SetStartPosition(5);
|
|
1337 |
object->SetFormatLength(10);
|
|
1338 |
object->SetBold(ETrue);
|
|
1339 |
object->SetItalic(ETrue);
|
|
1340 |
object->SetUnderline(ETrue);
|
|
1341 |
object->SetStrikethrough(ETrue);
|
|
1342 |
object->SetAlignment(CEmsFormatIE::ECenter);
|
|
1343 |
object->SetFontSize(CEmsFormatIE::ELarge);
|
|
1344 |
CleanupStack::PushL(object);
|
|
1345 |
sendMessage->AddEMSInformationElementL(*object);
|
|
1346 |
CleanupStack::PopAndDestroy(object);
|
|
1347 |
|
|
1348 |
|
|
1349 |
// send EMS message
|
|
1350 |
SendSmsL(sendMessage,socket);
|
|
1351 |
|
|
1352 |
WaitForRecvL(socket);
|
|
1353 |
CSmsMessage* recvMessage = RecvSmsL(socket);
|
|
1354 |
CleanupStack::PushL(recvMessage);
|
|
1355 |
|
|
1356 |
|
|
1357 |
//compare send and received messages
|
|
1358 |
CompareEmsElementsL(*sendMessage, *recvMessage);
|
|
1359 |
|
|
1360 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
1361 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
1362 |
CleanupStack::PopAndDestroy(&socket);
|
|
1363 |
//closing is too fast when using EKA2
|
|
1364 |
User::After(2000000);
|
|
1365 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
1366 |
|
|
1367 |
User::After(2000000); // wait for socket to close before reopening
|
|
1368 |
}
|
|
1369 |
|
|
1370 |
void CSmsInterTestStep::SendRecvTextFormated16BitEMSL()
|
|
1371 |
/**
|
|
1372 |
* @test Send and Receive 8Bit EMS message with all supported formating
|
|
1373 |
*/
|
|
1374 |
{
|
|
1375 |
INFO_PRINTF1(_L("Send and receive 16Bit Ems message with text formating "));
|
|
1376 |
|
|
1377 |
RSocketServ socketServer;
|
|
1378 |
Connect2EsockLC(socketServer);
|
|
1379 |
RSocket socket;
|
|
1380 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
1381 |
|
|
1382 |
// create EMS message
|
|
1383 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabetUCS2;
|
|
1384 |
CSmsMessage* sendMessage=CreateSmsMessageL(KFormatedMsg2,alphabet);
|
|
1385 |
CleanupStack::PushL(sendMessage);
|
|
1386 |
|
|
1387 |
// add information element
|
|
1388 |
CEmsFormatIE* object = CEmsFormatIE::NewL();
|
|
1389 |
object->SetStartPosition(5);
|
|
1390 |
object->SetFormatLength(10);
|
|
1391 |
object->SetBold(ETrue);
|
|
1392 |
object->SetItalic(ETrue);
|
|
1393 |
object->SetUnderline(ETrue);
|
|
1394 |
object->SetStrikethrough(ETrue);
|
|
1395 |
object->SetAlignment(CEmsFormatIE::ECenter);
|
|
1396 |
object->SetFontSize(CEmsFormatIE::ELarge);
|
|
1397 |
CleanupStack::PushL(object);
|
|
1398 |
sendMessage->AddEMSInformationElementL(*object);
|
|
1399 |
CleanupStack::PopAndDestroy(object);
|
|
1400 |
|
|
1401 |
|
|
1402 |
// send EMS message
|
|
1403 |
SendSmsL(sendMessage,socket);
|
|
1404 |
|
|
1405 |
WaitForRecvL(socket);
|
|
1406 |
CSmsMessage* recvMessage = RecvSmsL(socket);
|
|
1407 |
CleanupStack::PushL(recvMessage);
|
|
1408 |
|
|
1409 |
|
|
1410 |
//compare send and received messages
|
|
1411 |
CompareEmsElementsL(*sendMessage, *recvMessage);
|
|
1412 |
|
|
1413 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
1414 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
1415 |
CleanupStack::PopAndDestroy(&socket);
|
|
1416 |
//closing is too fast when using EKA2
|
|
1417 |
User::After(2000000);
|
|
1418 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
1419 |
|
|
1420 |
User::After(2000000); // wait for socket to close before reopening
|
|
1421 |
}
|
|
1422 |
|
|
1423 |
void CSmsInterTestStep::EnumerateReadWriteAndDeleteEMSOnSIML( const RPointerArray<CSmsPduDbMessage>& aArray )
|
|
1424 |
/**
|
|
1425 |
* @test Switch on the phone with a SIM.
|
|
1426 |
* Enumerate, delete (first message if exist and last message after writing),
|
|
1427 |
* write (two messages to the sim store)
|
|
1428 |
*/
|
|
1429 |
{
|
|
1430 |
RSocketServ socketServer;
|
|
1431 |
Connect2EsockLC(socketServer);
|
|
1432 |
|
|
1433 |
// Open the socket for SIM operations
|
|
1434 |
RSocket socket;
|
|
1435 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation);
|
|
1436 |
|
|
1437 |
TInt ret = 0;
|
|
1438 |
CSmsMessage* smsmessage;
|
|
1439 |
|
|
1440 |
// Enumerate messages
|
|
1441 |
INFO_PRINTF1(_L("Enumeration"));
|
|
1442 |
RPointerArray<CSmsMessage> messages;
|
|
1443 |
CleanupResetAndDestroyPushL(messages);
|
|
1444 |
ReadSmsStoreL(socket, messages);
|
|
1445 |
TInt count = messages.Count();
|
|
1446 |
TInt index = 0;
|
|
1447 |
|
|
1448 |
// Delete messages
|
|
1449 |
INFO_PRINTF1(_L("Delete messages"));
|
|
1450 |
while ( index < count )
|
|
1451 |
{
|
|
1452 |
smsmessage = messages[index++];
|
|
1453 |
|
|
1454 |
INFO_PRINTF2(_L("Delete %d. message from the store "), index );
|
|
1455 |
ret = DeleteSmsL(*smsmessage, socket);
|
|
1456 |
TEST( !( ret == KErrNone ) );
|
|
1457 |
|
|
1458 |
}
|
|
1459 |
messages.ResetAndDestroy();
|
|
1460 |
|
|
1461 |
// Create and store messages
|
|
1462 |
INFO_PRINTF1(_L("store messages"));
|
|
1463 |
count = aArray.Count();
|
|
1464 |
index = 0;
|
|
1465 |
while ( index < count )
|
|
1466 |
{
|
|
1467 |
INFO_PRINTF2(_L("Write %d. message"),index+1);
|
|
1468 |
CSmsMessage* emsMessage = CreateAndSetMessageWithOneIEL( aArray, index++ );
|
|
1469 |
CleanupStack::PushL(emsMessage);
|
|
1470 |
WriteSmsToSimL(*emsMessage, socket);
|
|
1471 |
CleanupStack::PopAndDestroy(emsMessage);
|
|
1472 |
}
|
|
1473 |
|
|
1474 |
// Enumerate messages
|
|
1475 |
INFO_PRINTF1(_L("Enumeration"));
|
|
1476 |
ReadSmsStoreL(socket, messages);
|
|
1477 |
count = messages.Count();
|
|
1478 |
index = 0;
|
|
1479 |
|
|
1480 |
// Delete messages
|
|
1481 |
INFO_PRINTF1(_L("Delete messages"));
|
|
1482 |
while ( index < count )
|
|
1483 |
{
|
|
1484 |
smsmessage = messages[index++];
|
|
1485 |
INFO_PRINTF2(_L("Delete %d. message from the store"), index );
|
|
1486 |
ret = DeleteSmsL(*smsmessage, socket);
|
|
1487 |
TEST( !( ret == KErrNone ) );
|
|
1488 |
}
|
|
1489 |
|
|
1490 |
CleanupStack::PopAndDestroy(&messages);
|
|
1491 |
CleanupStack::PopAndDestroy(&socket);
|
|
1492 |
//closing is too fast when using EKA2
|
|
1493 |
User::After(2000000);
|
|
1494 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
1495 |
User::After(2000000); // wait for socket to close before reopening
|
|
1496 |
}
|
|
1497 |
|
|
1498 |
void CSmsInterTestStep::SendRecvPreDefSoundEMSL()
|
|
1499 |
/**
|
|
1500 |
* @test Send and Receive EMS message with multiple predefined sound IEs
|
|
1501 |
*/
|
|
1502 |
{
|
|
1503 |
INFO_PRINTF1(_L("Send and receive EMS with multiple predefined sound "));
|
|
1504 |
|
|
1505 |
RSocketServ socketServer;
|
|
1506 |
Connect2EsockLC(socketServer);
|
|
1507 |
RSocket socket;
|
|
1508 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
1509 |
|
|
1510 |
// create EMS message
|
|
1511 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
1512 |
CSmsMessage* sendMessage=CreateSmsMessageL(KSoundMsg1,alphabet);
|
|
1513 |
CleanupStack::PushL(sendMessage);
|
|
1514 |
|
|
1515 |
// add two sound objects
|
|
1516 |
CEmsPreDefSoundIE* object1 = CEmsPreDefSoundIE::NewL( CEmsPreDefSoundIE::EChordLow);
|
|
1517 |
CleanupStack::PushL(object1);
|
|
1518 |
object1->SetStartPosition(17);
|
|
1519 |
sendMessage->AddEMSInformationElementL(*object1);
|
|
1520 |
CleanupStack::PopAndDestroy(object1);
|
|
1521 |
|
|
1522 |
|
|
1523 |
CEmsPreDefSoundIE* object2 = CEmsPreDefSoundIE::NewL(CEmsPreDefSoundIE::ETaDa);
|
|
1524 |
CleanupStack::PushL(object2);
|
|
1525 |
object2->SetStartPosition(33);
|
|
1526 |
sendMessage->AddEMSInformationElementL(*object2);
|
|
1527 |
CleanupStack::PopAndDestroy(object2);
|
|
1528 |
|
|
1529 |
// send EMS message
|
|
1530 |
SendSmsL(sendMessage,socket);
|
|
1531 |
|
|
1532 |
WaitForRecvL(socket);
|
|
1533 |
CSmsMessage* recvMessage = RecvSmsL(socket);
|
|
1534 |
CleanupStack::PushL(recvMessage);
|
|
1535 |
|
|
1536 |
|
|
1537 |
//compare send and received messages
|
|
1538 |
CompareEmsElementsL(*sendMessage, *recvMessage);
|
|
1539 |
|
|
1540 |
|
|
1541 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
1542 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
1543 |
CleanupStack::PopAndDestroy(&socket);
|
|
1544 |
//closing is too fast when using EKA2
|
|
1545 |
User::After(2000000);
|
|
1546 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
1547 |
|
|
1548 |
User::After(2000000); // wait for socket to close before reopening
|
|
1549 |
}
|
|
1550 |
|
|
1551 |
void CSmsInterTestStep::SendRecvUserDefSoundEMSL()
|
|
1552 |
/**
|
|
1553 |
* @test Send and Receive EMS message with multiple user defined sound IEs
|
|
1554 |
*/
|
|
1555 |
{
|
|
1556 |
INFO_PRINTF1(_L("Send and receive EMS with multiple user defined sound "));
|
|
1557 |
|
|
1558 |
RSocketServ socketServer;
|
|
1559 |
Connect2EsockLC(socketServer);
|
|
1560 |
RSocket socket;
|
|
1561 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
1562 |
|
|
1563 |
// create EMS message
|
|
1564 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit;
|
|
1565 |
CSmsMessage* sendMessage=CreateSmsMessageL(KSoundMsg1,alphabet);
|
|
1566 |
CleanupStack::PushL(sendMessage);
|
|
1567 |
|
|
1568 |
// add two user melodies
|
|
1569 |
CEmsSoundIE* object1 = CEmsSoundIE::NewL(KBarbieMelody());
|
|
1570 |
CleanupStack::PushL(object1);
|
|
1571 |
object1->SetStartPosition(17);
|
|
1572 |
sendMessage->AddEMSInformationElementL(*object1);
|
|
1573 |
CleanupStack::PopAndDestroy(object1);
|
|
1574 |
|
|
1575 |
CEmsSoundIE* object2 = CEmsSoundIE::NewL(KOasisMelody());
|
|
1576 |
CleanupStack::PushL(object2);
|
|
1577 |
object2->SetStartPosition(33);
|
|
1578 |
sendMessage->AddEMSInformationElementL(*object2);
|
|
1579 |
CleanupStack::PopAndDestroy(object2);
|
|
1580 |
|
|
1581 |
// send EMS message
|
|
1582 |
SendSmsL(sendMessage,socket);
|
|
1583 |
|
|
1584 |
WaitForRecvL(socket);
|
|
1585 |
CSmsMessage* recvMessage = RecvSmsL(socket);
|
|
1586 |
CleanupStack::PushL(recvMessage);
|
|
1587 |
|
|
1588 |
|
|
1589 |
//compare send and received messages
|
|
1590 |
CompareEmsElementsL(*sendMessage, *recvMessage);
|
|
1591 |
|
|
1592 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
1593 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
1594 |
CleanupStack::PopAndDestroy(&socket);
|
|
1595 |
//closing is too fast when using EKA2
|
|
1596 |
User::After(2000000);
|
|
1597 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
1598 |
|
|
1599 |
User::After(2000000); // wait for socket to close before reopening
|
|
1600 |
}
|
|
1601 |
|
|
1602 |
void CSmsInterTestStep::EnumerateReadWriteAndDeleteEMSOnPhoneL( const RPointerArray<CSmsPduDbMessage>& aArray )
|
|
1603 |
/**
|
|
1604 |
* @test Switch on the phone with a SIM.
|
|
1605 |
* Enumerate, delete (first message if exist and last message after writing),
|
|
1606 |
* write (two messages to the phone store)
|
|
1607 |
*/
|
|
1608 |
{
|
|
1609 |
RSocketServ socketServer;
|
|
1610 |
Connect2EsockLC(socketServer);
|
|
1611 |
|
|
1612 |
// Open the socket for SIM operations
|
|
1613 |
RSocket socket;
|
|
1614 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation);
|
|
1615 |
|
|
1616 |
TInt ret = 0;
|
|
1617 |
CSmsMessage* smsmessage;
|
|
1618 |
|
|
1619 |
// Enumerate messages
|
|
1620 |
INFO_PRINTF1(_L("Enumeration"));
|
|
1621 |
RPointerArray<CSmsMessage> messages;
|
|
1622 |
CleanupResetAndDestroyPushL(messages);
|
|
1623 |
ReadSmsStoreL(socket, messages);
|
|
1624 |
TInt count = messages.Count();
|
|
1625 |
TInt index = 0;
|
|
1626 |
|
|
1627 |
// Delete messages
|
|
1628 |
INFO_PRINTF1(_L("Delete messages"));
|
|
1629 |
while ( index < count )
|
|
1630 |
{
|
|
1631 |
smsmessage = messages[index++];
|
|
1632 |
|
|
1633 |
INFO_PRINTF2(_L("Delete %d. message from the store "), index );
|
|
1634 |
ret = DeleteSmsL(*smsmessage, socket);
|
|
1635 |
TEST( !( ret == KErrNone ) );
|
|
1636 |
|
|
1637 |
}
|
|
1638 |
messages.ResetAndDestroy();
|
|
1639 |
|
|
1640 |
// Create and store messages
|
|
1641 |
INFO_PRINTF1(_L("store messages"));
|
|
1642 |
count = aArray.Count();
|
|
1643 |
index = 0;
|
|
1644 |
while ( index < count )
|
|
1645 |
{
|
|
1646 |
INFO_PRINTF2(_L("Write %d. message"),index+1);
|
|
1647 |
CSmsMessage* emsMessage = CreateAndSetMessageWithOneIEOnPhoneL( aArray, index++ );
|
|
1648 |
CleanupStack::PushL(emsMessage);
|
|
1649 |
/*
|
|
1650 |
Some phones doesn't support phone memory. In this case SMS stack completes
|
|
1651 |
write request with KErrNotFound, or KErrNoMemory.
|
|
1652 |
*/
|
|
1653 |
TRAPD(ret, WriteSmsLeaveIfErrorL(*emsMessage, socket););
|
|
1654 |
if(ret == KErrNoMemory || ret == KErrNotFound)
|
|
1655 |
{
|
|
1656 |
INFO_PRINTF1(_L("Phone does not support phone memory!"));
|
|
1657 |
User::After(5000000);
|
|
1658 |
CleanupStack::PopAndDestroy(emsMessage);
|
|
1659 |
break;
|
|
1660 |
}
|
|
1661 |
CleanupStack::PopAndDestroy(emsMessage);
|
|
1662 |
}
|
|
1663 |
|
|
1664 |
// Enumerate messages
|
|
1665 |
INFO_PRINTF1(_L("Enumeration"));
|
|
1666 |
ReadSmsStoreL(socket, messages);
|
|
1667 |
count = messages.Count();
|
|
1668 |
index = 0;
|
|
1669 |
|
|
1670 |
// Delete messages
|
|
1671 |
INFO_PRINTF1(_L("Delete messages"));
|
|
1672 |
while ( index < count )
|
|
1673 |
{
|
|
1674 |
smsmessage = messages[index++];
|
|
1675 |
INFO_PRINTF2(_L("Delete %d. message from the store"), index );
|
|
1676 |
ret = DeleteSmsL(*smsmessage, socket);
|
|
1677 |
TEST( !( ret == KErrNone ) );
|
|
1678 |
}
|
|
1679 |
|
|
1680 |
CleanupStack::PopAndDestroy(&messages);
|
|
1681 |
CleanupStack::PopAndDestroy(&socket);
|
|
1682 |
//closing is too fast when using EKA2
|
|
1683 |
User::After(2000000);
|
|
1684 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
1685 |
User::After(2000000); // wait for socket to close before reopening
|
|
1686 |
}
|
|
1687 |
|
|
1688 |
|
|
1689 |
void CSmsInterTestStep::SendRecvPicturesEMSL()
|
|
1690 |
/**
|
|
1691 |
* @test Send and Receive EMS message with multiple pictures
|
|
1692 |
*/
|
|
1693 |
{
|
|
1694 |
INFO_PRINTF1(_L("Send and receive EMS messages with pictures "));
|
|
1695 |
|
|
1696 |
RSocketServ socketServer;
|
|
1697 |
Connect2EsockLC(socketServer);
|
|
1698 |
RSocket socket;
|
|
1699 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
1700 |
|
|
1701 |
// send, receive and compare EMS with one small picture, 7Bit coding
|
|
1702 |
INFO_PRINTF1(_L("Send EMS with 1 small picture "));
|
|
1703 |
TSmsDataCodingScheme::TSmsAlphabet alphabet1=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
1704 |
CSmsMessage* sendMessage1=CreateSmsMessageL(KPictureMsg1,alphabet1);
|
|
1705 |
CleanupStack::PushL(sendMessage1);
|
|
1706 |
|
|
1707 |
CEmsPictureIE* pic1 = EmsTestUtils::CreatePictureL(0); // 0 for small pic
|
|
1708 |
CleanupStack::PushL(pic1);
|
|
1709 |
pic1->SetStartPosition(22);
|
|
1710 |
|
|
1711 |
sendMessage1->AddEMSInformationElementL(*pic1);
|
|
1712 |
CleanupStack::PopAndDestroy(pic1);
|
|
1713 |
|
|
1714 |
SendSmsL(sendMessage1,socket);
|
|
1715 |
|
|
1716 |
WaitForRecvL(socket);
|
|
1717 |
CSmsMessage* recvMessage1 = RecvSmsL(socket);
|
|
1718 |
CleanupStack::PushL(recvMessage1);
|
|
1719 |
|
|
1720 |
CompareEmsElementsL(*sendMessage1, *recvMessage1);
|
|
1721 |
|
|
1722 |
CleanupStack::PopAndDestroy(recvMessage1);
|
|
1723 |
CleanupStack::PopAndDestroy(sendMessage1);
|
|
1724 |
|
|
1725 |
// send, receive and compare EMS with one large picture, 16Bit coding
|
|
1726 |
|
|
1727 |
INFO_PRINTF1(_L("Send EMS with 1 large picture "));
|
|
1728 |
TSmsDataCodingScheme::TSmsAlphabet alphabet2=TSmsDataCodingScheme::ESmsAlphabetUCS2;
|
|
1729 |
CSmsMessage* sendMessage2=CreateSmsMessageL(KPictureMsg1,alphabet2);
|
|
1730 |
CleanupStack::PushL(sendMessage2);
|
|
1731 |
|
|
1732 |
CEmsPictureIE* pic2 = EmsTestUtils::CreatePictureL(1); // 1 for large pic
|
|
1733 |
CleanupStack::PushL(pic2);
|
|
1734 |
pic2->SetStartPosition(22);
|
|
1735 |
|
|
1736 |
sendMessage2->AddEMSInformationElementL(*pic2);
|
|
1737 |
CleanupStack::PopAndDestroy(pic2);
|
|
1738 |
|
|
1739 |
SendSmsL(sendMessage2,socket);
|
|
1740 |
|
|
1741 |
WaitForRecvL(socket);
|
|
1742 |
CSmsMessage* recvMessage2 = RecvSmsL(socket);
|
|
1743 |
CleanupStack::PushL(recvMessage2);
|
|
1744 |
|
|
1745 |
CompareEmsElementsL(*sendMessage2, *recvMessage2);
|
|
1746 |
|
|
1747 |
CleanupStack::PopAndDestroy(recvMessage2);
|
|
1748 |
CleanupStack::PopAndDestroy(sendMessage2);
|
|
1749 |
|
|
1750 |
// send, receive and compare EMS with one variable picture, 8Bit coding
|
|
1751 |
|
|
1752 |
INFO_PRINTF1(_L("Send EMS with 1 variable picture "));
|
|
1753 |
TSmsDataCodingScheme::TSmsAlphabet alphabet3=TSmsDataCodingScheme::ESmsAlphabet8Bit;
|
|
1754 |
CSmsMessage* sendMessage3=CreateSmsMessageL(KPictureMsg1,alphabet3);
|
|
1755 |
CleanupStack::PushL(sendMessage3);
|
|
1756 |
|
|
1757 |
CEmsPictureIE* pic3 = EmsTestUtils::CreatePictureL(2); // 2 for variable pic
|
|
1758 |
CleanupStack::PushL(pic3);
|
|
1759 |
pic3->SetStartPosition(22);
|
|
1760 |
|
|
1761 |
sendMessage3->AddEMSInformationElementL(*pic3);
|
|
1762 |
CleanupStack::PopAndDestroy(pic3);
|
|
1763 |
|
|
1764 |
SendSmsL(sendMessage3,socket);
|
|
1765 |
|
|
1766 |
WaitForRecvL(socket);
|
|
1767 |
CSmsMessage* recvMessage3 = RecvSmsL(socket);
|
|
1768 |
CleanupStack::PushL(recvMessage3);
|
|
1769 |
|
|
1770 |
CompareEmsElementsL(*sendMessage3, *recvMessage3);
|
|
1771 |
|
|
1772 |
CleanupStack::PopAndDestroy(recvMessage3);
|
|
1773 |
CleanupStack::PopAndDestroy(sendMessage3);
|
|
1774 |
|
|
1775 |
// send, receive and compare EMS with two small pictures, 7Bit coding
|
|
1776 |
|
|
1777 |
INFO_PRINTF1(_L("Send EMS with 2 small pictures "));
|
|
1778 |
TSmsDataCodingScheme::TSmsAlphabet alphabet4=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
1779 |
CSmsMessage* sendMessage4=CreateSmsMessageL(KPictureMsg2,alphabet4);
|
|
1780 |
CleanupStack::PushL(sendMessage4);
|
|
1781 |
|
|
1782 |
CEmsPictureIE* pic4 = EmsTestUtils::CreatePictureL(0);
|
|
1783 |
CleanupStack::PushL(pic4);
|
|
1784 |
pic4->SetStartPosition(19);
|
|
1785 |
|
|
1786 |
sendMessage4->AddEMSInformationElementL(*pic4);
|
|
1787 |
CleanupStack::PopAndDestroy(pic4);
|
|
1788 |
|
|
1789 |
CEmsPictureIE* pic5 = EmsTestUtils::CreatePictureL(0);
|
|
1790 |
CleanupStack::PushL(pic5);
|
|
1791 |
pic5->SetStartPosition(37);
|
|
1792 |
|
|
1793 |
sendMessage4->AddEMSInformationElementL(*pic5);
|
|
1794 |
CleanupStack::PopAndDestroy(pic5);
|
|
1795 |
|
|
1796 |
SendSmsL(sendMessage4,socket);
|
|
1797 |
|
|
1798 |
WaitForRecvL(socket);
|
|
1799 |
CSmsMessage* recvMessage4 = RecvSmsL(socket);
|
|
1800 |
CleanupStack::PushL(recvMessage4);
|
|
1801 |
|
|
1802 |
CompareEmsElementsL(*sendMessage4, *recvMessage4);
|
|
1803 |
|
|
1804 |
CleanupStack::PopAndDestroy(recvMessage4);
|
|
1805 |
CleanupStack::PopAndDestroy(sendMessage4);
|
|
1806 |
|
|
1807 |
CleanupStack::PopAndDestroy(&socket);
|
|
1808 |
//closing is too fast when using EKA2
|
|
1809 |
User::After(2000000);
|
|
1810 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
1811 |
|
|
1812 |
User::After(2000000); // wait for socket to close before reopening
|
|
1813 |
}
|
|
1814 |
|
|
1815 |
void CSmsInterTestStep::SendRecvPreDefAnimationL()
|
|
1816 |
/**
|
|
1817 |
* @test Send and Receive EMS message with multiple predefined animation
|
|
1818 |
*/
|
|
1819 |
{
|
|
1820 |
INFO_PRINTF1(_L("Send and receive EMS messages with predefined animation "));
|
|
1821 |
|
|
1822 |
RSocketServ socketServer;
|
|
1823 |
Connect2EsockLC(socketServer);
|
|
1824 |
RSocket socket;
|
|
1825 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
1826 |
|
|
1827 |
// send, receive and compare EMS with one predefined animation, 16Bit coding
|
|
1828 |
INFO_PRINTF1(_L("Send EMS with 1 predefined animation "));
|
|
1829 |
TSmsDataCodingScheme::TSmsAlphabet alphabet1=TSmsDataCodingScheme::ESmsAlphabetUCS2;
|
|
1830 |
CSmsMessage* sendMessage1=CreateSmsMessageL(KAnimationMsg1,alphabet1);
|
|
1831 |
CleanupStack::PushL(sendMessage1);
|
|
1832 |
CEmsPreDefAnimationIE* anim1=NULL;
|
|
1833 |
|
|
1834 |
anim1 = CEmsPreDefAnimationIE::NewL(CEmsPreDefAnimationIE::EWinking);
|
|
1835 |
CleanupStack::PushL(anim1);
|
|
1836 |
anim1->SetStartPosition(22);
|
|
1837 |
|
|
1838 |
sendMessage1->AddEMSInformationElementL(*anim1);
|
|
1839 |
CleanupStack::PopAndDestroy(anim1);
|
|
1840 |
|
|
1841 |
SendSmsL(sendMessage1,socket);
|
|
1842 |
|
|
1843 |
WaitForRecvL(socket);
|
|
1844 |
CSmsMessage* recvMessage1 = RecvSmsL(socket);
|
|
1845 |
CleanupStack::PushL(recvMessage1);
|
|
1846 |
|
|
1847 |
CompareEmsElementsL(*sendMessage1, *recvMessage1);
|
|
1848 |
|
|
1849 |
CleanupStack::PopAndDestroy(recvMessage1);
|
|
1850 |
CleanupStack::PopAndDestroy(sendMessage1);
|
|
1851 |
|
|
1852 |
// send, receive and compare EMS with two predefined animation, 7Bit coding
|
|
1853 |
|
|
1854 |
INFO_PRINTF1(_L("Send EMS with 2 predefined animation "));
|
|
1855 |
TSmsDataCodingScheme::TSmsAlphabet alphabet2=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
1856 |
CSmsMessage* sendMessage2=CreateSmsMessageL(KAnimationMsg2,alphabet2);
|
|
1857 |
CleanupStack::PushL(sendMessage2);
|
|
1858 |
CEmsPreDefAnimationIE* anim2=NULL;
|
|
1859 |
|
|
1860 |
anim2 = CEmsPreDefAnimationIE::NewL(CEmsPreDefAnimationIE::ECrying);
|
|
1861 |
CleanupStack::PushL(anim2);
|
|
1862 |
anim2->SetStartPosition(21);
|
|
1863 |
|
|
1864 |
sendMessage2->AddEMSInformationElementL(*anim2);
|
|
1865 |
CleanupStack::PopAndDestroy(anim2);
|
|
1866 |
|
|
1867 |
CEmsPreDefAnimationIE* anim3=NULL;
|
|
1868 |
|
|
1869 |
anim3 = CEmsPreDefAnimationIE::NewL(CEmsPreDefAnimationIE::ELaughing);
|
|
1870 |
CleanupStack::PushL(anim3);
|
|
1871 |
anim3->SetStartPosition(41);
|
|
1872 |
|
|
1873 |
sendMessage2->AddEMSInformationElementL(*anim3);
|
|
1874 |
CleanupStack::PopAndDestroy(anim3);
|
|
1875 |
|
|
1876 |
SendSmsL(sendMessage2,socket);
|
|
1877 |
|
|
1878 |
WaitForRecvL(socket);
|
|
1879 |
CSmsMessage* recvMessage2 = RecvSmsL(socket);
|
|
1880 |
CleanupStack::PushL(recvMessage2);
|
|
1881 |
|
|
1882 |
CompareEmsElementsL(*sendMessage2, *recvMessage2);
|
|
1883 |
|
|
1884 |
CleanupStack::PopAndDestroy(recvMessage2);
|
|
1885 |
CleanupStack::PopAndDestroy(sendMessage2);
|
|
1886 |
|
|
1887 |
CleanupStack::PopAndDestroy(&socket);
|
|
1888 |
//closing is too fast when using EKA2
|
|
1889 |
User::After(2000000);
|
|
1890 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
1891 |
|
|
1892 |
User::After(2000000); // wait for socket to close before reopening
|
|
1893 |
}
|
|
1894 |
|
|
1895 |
void CSmsInterTestStep::SendRecvUserDefAnimationL()
|
|
1896 |
/**
|
|
1897 |
* @test Send and Receive EMS message with multiple user defined animation
|
|
1898 |
*/
|
|
1899 |
{
|
|
1900 |
INFO_PRINTF1(_L("Send and receive EMS messages with user defined animation "));
|
|
1901 |
|
|
1902 |
RSocketServ socketServer;
|
|
1903 |
Connect2EsockLC(socketServer);
|
|
1904 |
RSocket socket;
|
|
1905 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
1906 |
|
|
1907 |
// send, receive and compare EMS with one small animation, 16Bit coding
|
|
1908 |
INFO_PRINTF1(_L("Send EMS with 1 small user animation "));
|
|
1909 |
TSmsDataCodingScheme::TSmsAlphabet alphabet1=TSmsDataCodingScheme::ESmsAlphabetUCS2;
|
|
1910 |
CSmsMessage* sendMessage1=CreateSmsMessageL(KAnimationMsg1,alphabet1);
|
|
1911 |
CleanupStack::PushL(sendMessage1);
|
|
1912 |
|
|
1913 |
CEmsAnimationIE* anim1 = EmsTestUtils::CreateAnimationL(0); // 0 for small animation
|
|
1914 |
CleanupStack::PushL(anim1);
|
|
1915 |
anim1->SetStartPosition(22);
|
|
1916 |
|
|
1917 |
sendMessage1->AddEMSInformationElementL(*anim1);
|
|
1918 |
CleanupStack::PopAndDestroy(anim1);
|
|
1919 |
|
|
1920 |
SendSmsL(sendMessage1,socket);
|
|
1921 |
|
|
1922 |
WaitForRecvL(socket);
|
|
1923 |
CSmsMessage* recvMessage1 = RecvSmsL(socket);
|
|
1924 |
CleanupStack::PushL(recvMessage1);
|
|
1925 |
|
|
1926 |
CompareEmsElementsL(*sendMessage1, *recvMessage1);
|
|
1927 |
|
|
1928 |
CleanupStack::PopAndDestroy(recvMessage1);
|
|
1929 |
CleanupStack::PopAndDestroy(sendMessage1);
|
|
1930 |
|
|
1931 |
// send, receive and compare EMS with one large animation, 8Bit coding
|
|
1932 |
|
|
1933 |
INFO_PRINTF1(_L("Send EMS with 1 large user animation "));
|
|
1934 |
TSmsDataCodingScheme::TSmsAlphabet alphabet2=TSmsDataCodingScheme::ESmsAlphabet8Bit;
|
|
1935 |
CSmsMessage* sendMessage2=CreateSmsMessageL(KAnimationMsg1,alphabet2);
|
|
1936 |
CleanupStack::PushL(sendMessage2);
|
|
1937 |
|
|
1938 |
CEmsAnimationIE* anim2 = EmsTestUtils::CreateAnimationL(1); // 1 for large animation
|
|
1939 |
CleanupStack::PushL(anim2);
|
|
1940 |
anim2->SetStartPosition(22);
|
|
1941 |
|
|
1942 |
sendMessage2->AddEMSInformationElementL(*anim2);
|
|
1943 |
CleanupStack::PopAndDestroy(anim2);
|
|
1944 |
|
|
1945 |
SendSmsL(sendMessage2,socket);
|
|
1946 |
|
|
1947 |
WaitForRecvL(socket);
|
|
1948 |
CSmsMessage* recvMessage2 = RecvSmsL(socket);
|
|
1949 |
CleanupStack::PushL(recvMessage2);
|
|
1950 |
|
|
1951 |
CompareEmsElementsL(*sendMessage2, *recvMessage2);
|
|
1952 |
|
|
1953 |
CleanupStack::PopAndDestroy(recvMessage2);
|
|
1954 |
CleanupStack::PopAndDestroy(sendMessage2);
|
|
1955 |
|
|
1956 |
// send, receive and compare EMS with two small animation, 7Bit coding
|
|
1957 |
|
|
1958 |
INFO_PRINTF1(_L("Send EMS with 2 small user animation "));
|
|
1959 |
TSmsDataCodingScheme::TSmsAlphabet alphabet3=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
1960 |
CSmsMessage* sendMessage3=CreateSmsMessageL(KAnimationMsg2,alphabet3);
|
|
1961 |
CleanupStack::PushL(sendMessage3);
|
|
1962 |
|
|
1963 |
CEmsAnimationIE* anim3 = EmsTestUtils::CreateAnimationL(0);
|
|
1964 |
CleanupStack::PushL(anim3);
|
|
1965 |
anim3->SetStartPosition(21);
|
|
1966 |
|
|
1967 |
sendMessage3->AddEMSInformationElementL(*anim3);
|
|
1968 |
CleanupStack::PopAndDestroy(anim3);
|
|
1969 |
|
|
1970 |
CEmsAnimationIE* anim4 = EmsTestUtils::CreateAnimationL(0);
|
|
1971 |
CleanupStack::PushL(anim4);
|
|
1972 |
anim4->SetStartPosition(41);
|
|
1973 |
|
|
1974 |
sendMessage3->AddEMSInformationElementL(*anim4);
|
|
1975 |
CleanupStack::PopAndDestroy(anim4);
|
|
1976 |
|
|
1977 |
SendSmsL(sendMessage3,socket);
|
|
1978 |
|
|
1979 |
WaitForRecvL(socket);
|
|
1980 |
CSmsMessage* recvMessage3 = RecvSmsL(socket);
|
|
1981 |
CleanupStack::PushL(recvMessage3);
|
|
1982 |
|
|
1983 |
CompareEmsElementsL(*sendMessage3, *recvMessage3);
|
|
1984 |
|
|
1985 |
CleanupStack::PopAndDestroy(recvMessage3);
|
|
1986 |
CleanupStack::PopAndDestroy(sendMessage3);
|
|
1987 |
|
|
1988 |
CleanupStack::PopAndDestroy(&socket);
|
|
1989 |
//closing is too fast when using EKA2
|
|
1990 |
User::After(2000000);
|
|
1991 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
1992 |
|
|
1993 |
User::After(2000000); // wait for socket to close before reopening
|
|
1994 |
}
|
|
1995 |
|
|
1996 |
void CSmsInterTestStep::SendRecvUserPromptEMSL()
|
|
1997 |
/**
|
|
1998 |
* @test Send and Receive EMS message with user prompt indicator
|
|
1999 |
*/
|
|
2000 |
{
|
|
2001 |
INFO_PRINTF1(_L("Send and receive EMS messages with user prompt indicator"));
|
|
2002 |
|
|
2003 |
RSocketServ socketServer;
|
|
2004 |
Connect2EsockLC(socketServer);
|
|
2005 |
RSocket socket;
|
|
2006 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
2007 |
|
|
2008 |
// send, receive and compare EMS with one small picture and a user prompt, 7Bit coding
|
|
2009 |
INFO_PRINTF1(_L("Send EMS with 1 small picture and a user prompt "));
|
|
2010 |
TSmsDataCodingScheme::TSmsAlphabet alphabet1=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
2011 |
CSmsMessage* sendMessage1=CreateSmsMessageL(KPictureMsg1,alphabet1);
|
|
2012 |
CleanupStack::PushL(sendMessage1);
|
|
2013 |
|
|
2014 |
CEmsPictureIE* pic1 = EmsTestUtils::CreatePictureL(0);
|
|
2015 |
CleanupStack::PushL(pic1);
|
|
2016 |
pic1->SetStartPosition(22);
|
|
2017 |
|
|
2018 |
sendMessage1->AddEMSInformationElementL(*pic1);
|
|
2019 |
CleanupStack::PopAndDestroy(pic1);
|
|
2020 |
|
|
2021 |
// add a user prompt
|
|
2022 |
CEmsUserPrompt* prompt1 = CEmsUserPrompt::NewL(1); //one picture
|
|
2023 |
CleanupStack::PushL(prompt1);
|
|
2024 |
prompt1->SetStartPosition(22);
|
|
2025 |
sendMessage1->AddEMSInformationElementL(*prompt1);
|
|
2026 |
CleanupStack::PopAndDestroy(prompt1);
|
|
2027 |
|
|
2028 |
SendSmsL(sendMessage1,socket);
|
|
2029 |
|
|
2030 |
WaitForRecvL(socket);
|
|
2031 |
CSmsMessage* recvMessage1 = RecvSmsL(socket);
|
|
2032 |
CleanupStack::PushL(recvMessage1);
|
|
2033 |
|
|
2034 |
CompareEmsElementsL(*sendMessage1, *recvMessage1);
|
|
2035 |
|
|
2036 |
CleanupStack::PopAndDestroy(recvMessage1);
|
|
2037 |
CleanupStack::PopAndDestroy(sendMessage1);
|
|
2038 |
|
|
2039 |
// Two small pictures in one position with a prompt on the same position, 8Bit
|
|
2040 |
|
|
2041 |
INFO_PRINTF1(_L("Send EMS with 2 small pictures and a user prompt"));
|
|
2042 |
TSmsDataCodingScheme::TSmsAlphabet alphabet2=TSmsDataCodingScheme::ESmsAlphabet8Bit;
|
|
2043 |
CSmsMessage* sendMessage2=CreateSmsMessageL(KPictureMsg2,alphabet2);
|
|
2044 |
CleanupStack::PushL(sendMessage2);
|
|
2045 |
|
|
2046 |
CEmsPictureIE* pic2 = EmsTestUtils::CreatePictureL(0);
|
|
2047 |
CleanupStack::PushL(pic2);
|
|
2048 |
pic2->SetStartPosition(19);
|
|
2049 |
|
|
2050 |
sendMessage2->AddEMSInformationElementL(*pic2);
|
|
2051 |
CleanupStack::PopAndDestroy(pic2);
|
|
2052 |
|
|
2053 |
CEmsPictureIE* pic3 = EmsTestUtils::CreatePictureL(0);
|
|
2054 |
CleanupStack::PushL(pic3);
|
|
2055 |
pic3->SetStartPosition(19);
|
|
2056 |
|
|
2057 |
sendMessage2->AddEMSInformationElementL(*pic3);
|
|
2058 |
CleanupStack::PopAndDestroy(pic3);
|
|
2059 |
|
|
2060 |
// add a user prompt
|
|
2061 |
CEmsUserPrompt* prompt2 = CEmsUserPrompt::NewL(2); //two pictures
|
|
2062 |
CleanupStack::PushL(prompt2);
|
|
2063 |
prompt2->SetStartPosition(19);
|
|
2064 |
sendMessage2->AddEMSInformationElementL(*prompt2);
|
|
2065 |
CleanupStack::PopAndDestroy(prompt2);
|
|
2066 |
|
|
2067 |
SendSmsL(sendMessage2,socket);
|
|
2068 |
|
|
2069 |
WaitForRecvL(socket);
|
|
2070 |
CSmsMessage* recvMessage2 = RecvSmsL(socket);
|
|
2071 |
CleanupStack::PushL(recvMessage2);
|
|
2072 |
|
|
2073 |
CompareEmsElementsL(*sendMessage2, *recvMessage2);
|
|
2074 |
|
|
2075 |
CleanupStack::PopAndDestroy(recvMessage2);
|
|
2076 |
CleanupStack::PopAndDestroy(sendMessage2);
|
|
2077 |
|
|
2078 |
// two small pictures and a user prompt positioned on the 2nd, 7Bit coding
|
|
2079 |
INFO_PRINTF1(_L("Send EMS with 2 small pictures and prompt on the 2nd"));
|
|
2080 |
TSmsDataCodingScheme::TSmsAlphabet alphabet3=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
2081 |
CSmsMessage* sendMessage3=CreateSmsMessageL(KPictureMsg2,alphabet3);
|
|
2082 |
CleanupStack::PushL(sendMessage3);
|
|
2083 |
|
|
2084 |
CEmsPictureIE* pic4 = EmsTestUtils::CreatePictureL(0);
|
|
2085 |
CleanupStack::PushL(pic4);
|
|
2086 |
pic4->SetStartPosition(19);
|
|
2087 |
|
|
2088 |
sendMessage3->AddEMSInformationElementL(*pic4);
|
|
2089 |
CleanupStack::PopAndDestroy(pic4);
|
|
2090 |
|
|
2091 |
CEmsPictureIE* pic5 = EmsTestUtils::CreatePictureL(0);
|
|
2092 |
CleanupStack::PushL(pic5);
|
|
2093 |
pic5->SetStartPosition(37);
|
|
2094 |
|
|
2095 |
sendMessage3->AddEMSInformationElementL(*pic5);
|
|
2096 |
CleanupStack::PopAndDestroy(pic5);
|
|
2097 |
|
|
2098 |
// add a user prompt
|
|
2099 |
CEmsUserPrompt* prompt3 = CEmsUserPrompt::NewL(1); //one pictures
|
|
2100 |
CleanupStack::PushL(prompt3);
|
|
2101 |
prompt3->SetStartPosition(37);
|
|
2102 |
sendMessage3->AddEMSInformationElementL(*prompt3);
|
|
2103 |
CleanupStack::PopAndDestroy(prompt3);
|
|
2104 |
|
|
2105 |
SendSmsL(sendMessage3,socket);
|
|
2106 |
|
|
2107 |
WaitForRecvL(socket);
|
|
2108 |
CSmsMessage* recvMessage3 = RecvSmsL(socket);
|
|
2109 |
CleanupStack::PushL(recvMessage3);
|
|
2110 |
|
|
2111 |
CompareEmsElementsL(*sendMessage3, *recvMessage3);
|
|
2112 |
|
|
2113 |
CleanupStack::PopAndDestroy(recvMessage3);
|
|
2114 |
CleanupStack::PopAndDestroy(sendMessage3);
|
|
2115 |
|
|
2116 |
CleanupStack::PopAndDestroy(&socket);
|
|
2117 |
//closing is too fast when using EKA2
|
|
2118 |
User::After(2000000);
|
|
2119 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
2120 |
|
|
2121 |
User::After(2000000); // wait for socket to close before reopening
|
|
2122 |
}
|
|
2123 |
|
|
2124 |
void CSmsInterTestStep::SendRecvObjectDistributionEMSL()
|
|
2125 |
/**
|
|
2126 |
* @test Send and Receive EMS message with user prompt indicator
|
|
2127 |
*/
|
|
2128 |
{
|
|
2129 |
INFO_PRINTF1(_L("Send and receive EMS messages with object distribution indicator"));
|
|
2130 |
|
|
2131 |
RSocketServ socketServer;
|
|
2132 |
Connect2EsockLC(socketServer);
|
|
2133 |
RSocket socket;
|
|
2134 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
2135 |
|
|
2136 |
// send, receive and compare EMS with one small picture and a odi, 7Bit coding
|
|
2137 |
INFO_PRINTF1(_L("Send EMS with 1 small picture and object distribution indicator "));
|
|
2138 |
TSmsDataCodingScheme::TSmsAlphabet alphabet1=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
2139 |
CSmsMessage* sendMessage1=CreateSmsMessageL(KPictureMsg1,alphabet1);
|
|
2140 |
CleanupStack::PushL(sendMessage1);
|
|
2141 |
|
|
2142 |
CEmsPictureIE* pic1 = EmsTestUtils::CreatePictureL(0);
|
|
2143 |
CleanupStack::PushL(pic1);
|
|
2144 |
pic1->SetStartPosition(22);
|
|
2145 |
|
|
2146 |
sendMessage1->AddEMSInformationElementL(*pic1);
|
|
2147 |
CleanupStack::PopAndDestroy(pic1);
|
|
2148 |
|
|
2149 |
// add an object distribution indicator
|
|
2150 |
CEmsObjectDistribution* odi1 = CEmsObjectDistribution::NewL(1, CEmsObjectDistribution::EForward); //one picture
|
|
2151 |
CleanupStack::PushL(odi1);
|
|
2152 |
odi1->SetStartPosition(22);
|
|
2153 |
sendMessage1->AddEMSInformationElementL(*odi1);
|
|
2154 |
CleanupStack::PopAndDestroy(odi1);
|
|
2155 |
|
|
2156 |
SendSmsL(sendMessage1,socket);
|
|
2157 |
|
|
2158 |
WaitForRecvL(socket);
|
|
2159 |
CSmsMessage* recvMessage1 = RecvSmsL(socket);
|
|
2160 |
CleanupStack::PushL(recvMessage1);
|
|
2161 |
|
|
2162 |
CompareEmsElementsL(*sendMessage1, *recvMessage1);
|
|
2163 |
|
|
2164 |
CleanupStack::PopAndDestroy(recvMessage1);
|
|
2165 |
CleanupStack::PopAndDestroy(sendMessage1);
|
|
2166 |
|
|
2167 |
// Two small pictures in one position with an odi on the same position, 8Bit
|
|
2168 |
|
|
2169 |
INFO_PRINTF1(_L("Send EMS with 2 small pictures and an object distribution indicator"));
|
|
2170 |
TSmsDataCodingScheme::TSmsAlphabet alphabet2=TSmsDataCodingScheme::ESmsAlphabet8Bit;
|
|
2171 |
CSmsMessage* sendMessage2=CreateSmsMessageL(KPictureMsg2,alphabet2);
|
|
2172 |
CleanupStack::PushL(sendMessage2);
|
|
2173 |
|
|
2174 |
CEmsPictureIE* pic2 = EmsTestUtils::CreatePictureL(0);
|
|
2175 |
CleanupStack::PushL(pic2);
|
|
2176 |
pic2->SetStartPosition(19);
|
|
2177 |
|
|
2178 |
sendMessage2->AddEMSInformationElementL(*pic2);
|
|
2179 |
CleanupStack::PopAndDestroy(pic2);
|
|
2180 |
|
|
2181 |
CEmsPictureIE* pic3 = EmsTestUtils::CreatePictureL(0);
|
|
2182 |
CleanupStack::PushL(pic3);
|
|
2183 |
pic3->SetStartPosition(19);
|
|
2184 |
|
|
2185 |
sendMessage2->AddEMSInformationElementL(*pic3);
|
|
2186 |
CleanupStack::PopAndDestroy(pic3);
|
|
2187 |
|
|
2188 |
// add an object distribution indicator
|
|
2189 |
CEmsObjectDistribution* odi2 = CEmsObjectDistribution::NewL(2, CEmsObjectDistribution::EForward); //two pictures
|
|
2190 |
CleanupStack::PushL(odi2);
|
|
2191 |
odi2->SetStartPosition(19);
|
|
2192 |
sendMessage2->AddEMSInformationElementL(*odi2);
|
|
2193 |
CleanupStack::PopAndDestroy(odi2);
|
|
2194 |
|
|
2195 |
SendSmsL(sendMessage2,socket);
|
|
2196 |
|
|
2197 |
WaitForRecvL(socket);
|
|
2198 |
CSmsMessage* recvMessage2 = RecvSmsL(socket);
|
|
2199 |
CleanupStack::PushL(recvMessage2);
|
|
2200 |
|
|
2201 |
CompareEmsElementsL(*sendMessage2, *recvMessage2);
|
|
2202 |
|
|
2203 |
CleanupStack::PopAndDestroy(recvMessage2);
|
|
2204 |
CleanupStack::PopAndDestroy(sendMessage2);
|
|
2205 |
|
|
2206 |
// two small pictures and an object distribution indicator positioned on the 2nd, 7Bit coding
|
|
2207 |
INFO_PRINTF1(_L("Send EMS with 2 small pictures and an object distribution indicator on the 2nd"));
|
|
2208 |
TSmsDataCodingScheme::TSmsAlphabet alphabet3=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
2209 |
CSmsMessage* sendMessage3=CreateSmsMessageL(KPictureMsg2,alphabet3);
|
|
2210 |
CleanupStack::PushL(sendMessage3);
|
|
2211 |
|
|
2212 |
CEmsPictureIE* pic4 = EmsTestUtils::CreatePictureL(0);
|
|
2213 |
CleanupStack::PushL(pic4);
|
|
2214 |
pic4->SetStartPosition(19);
|
|
2215 |
|
|
2216 |
sendMessage3->AddEMSInformationElementL(*pic4);
|
|
2217 |
CleanupStack::PopAndDestroy(pic4);
|
|
2218 |
|
|
2219 |
CEmsPictureIE* pic5 = EmsTestUtils::CreatePictureL(0);
|
|
2220 |
CleanupStack::PushL(pic5);
|
|
2221 |
pic5->SetStartPosition(37);
|
|
2222 |
|
|
2223 |
sendMessage3->AddEMSInformationElementL(*pic5);
|
|
2224 |
CleanupStack::PopAndDestroy(pic5);
|
|
2225 |
|
|
2226 |
// add a object distribution indicator
|
|
2227 |
CEmsObjectDistribution* odi3 = CEmsObjectDistribution::NewL(1, CEmsObjectDistribution::EForward); //one picture
|
|
2228 |
CleanupStack::PushL(odi3);
|
|
2229 |
odi3->SetStartPosition(37);
|
|
2230 |
sendMessage3->AddEMSInformationElementL(*odi3);
|
|
2231 |
CleanupStack::PopAndDestroy(odi3);
|
|
2232 |
|
|
2233 |
SendSmsL(sendMessage3,socket);
|
|
2234 |
|
|
2235 |
WaitForRecvL(socket);
|
|
2236 |
CSmsMessage* recvMessage3 = RecvSmsL(socket);
|
|
2237 |
CleanupStack::PushL(recvMessage3);
|
|
2238 |
|
|
2239 |
CompareEmsElementsL(*sendMessage3, *recvMessage3);
|
|
2240 |
|
|
2241 |
CleanupStack::PopAndDestroy(recvMessage3);
|
|
2242 |
CleanupStack::PopAndDestroy(sendMessage3);
|
|
2243 |
|
|
2244 |
CleanupStack::PopAndDestroy(&socket);
|
|
2245 |
//closing is too fast when using EKA2
|
|
2246 |
User::After(2000000);
|
|
2247 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
2248 |
|
|
2249 |
User::After(2000000); // wait for socket to close before reopening
|
|
2250 |
}
|
|
2251 |
|
|
2252 |
void CSmsInterTestStep::SendRecvManyEMSObjectsL()
|
|
2253 |
/**
|
|
2254 |
* @test Send and Receive EMS message with many objects of different types
|
|
2255 |
*/
|
|
2256 |
{
|
|
2257 |
INFO_PRINTF1(_L("Send and receive EMS messages with 7 objects"));
|
|
2258 |
|
|
2259 |
RSocketServ socketServer;
|
|
2260 |
Connect2EsockLC(socketServer);
|
|
2261 |
RSocket socket;
|
|
2262 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
2263 |
|
|
2264 |
// create EMS message
|
|
2265 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
2266 |
CSmsMessage* sendMessage=CreateSmsMessageL(KLongEmsMsg,alphabet);
|
|
2267 |
CleanupStack::PushL(sendMessage);
|
|
2268 |
|
|
2269 |
// add a large picture in position 42
|
|
2270 |
CEmsPictureIE* pic1 = EmsTestUtils::CreatePictureL(1);
|
|
2271 |
CleanupStack::PushL(pic1);
|
|
2272 |
pic1->SetStartPosition(42);
|
|
2273 |
sendMessage->AddEMSInformationElementL(*pic1);
|
|
2274 |
CleanupStack::PopAndDestroy(pic1);
|
|
2275 |
|
|
2276 |
//add a user melody in position 55
|
|
2277 |
CEmsSoundIE* melody1 = CEmsSoundIE::NewL(KBarbieMelody());
|
|
2278 |
CleanupStack::PushL(melody1);
|
|
2279 |
melody1->SetStartPosition(55);
|
|
2280 |
sendMessage->AddEMSInformationElementL(*melody1);
|
|
2281 |
CleanupStack::PopAndDestroy(melody1);
|
|
2282 |
|
|
2283 |
//add a small animation in position 72
|
|
2284 |
CEmsAnimationIE* anim1 = EmsTestUtils::CreateAnimationL(0);
|
|
2285 |
CleanupStack::PushL(anim1);
|
|
2286 |
anim1->SetStartPosition(72);
|
|
2287 |
|
|
2288 |
sendMessage->AddEMSInformationElementL(*anim1);
|
|
2289 |
CleanupStack::PopAndDestroy(anim1);
|
|
2290 |
|
|
2291 |
//add a large animation in position 103
|
|
2292 |
CEmsAnimationIE* anim2 = EmsTestUtils::CreateAnimationL(1);
|
|
2293 |
CleanupStack::PushL(anim2);
|
|
2294 |
anim2->SetStartPosition(103);
|
|
2295 |
|
|
2296 |
sendMessage->AddEMSInformationElementL(*anim2);
|
|
2297 |
CleanupStack::PopAndDestroy(anim2);
|
|
2298 |
|
|
2299 |
//add a predef melody in position 117
|
|
2300 |
CEmsPreDefSoundIE* sound1 = CEmsPreDefSoundIE::NewL( CEmsPreDefSoundIE::EChordLow);
|
|
2301 |
CleanupStack::PushL(sound1);
|
|
2302 |
sound1->SetStartPosition(117);
|
|
2303 |
sendMessage->AddEMSInformationElementL(*sound1);
|
|
2304 |
CleanupStack::PopAndDestroy(sound1);
|
|
2305 |
|
|
2306 |
// add a small picture in position 134
|
|
2307 |
CEmsPictureIE* pic2 = EmsTestUtils::CreatePictureL(0);
|
|
2308 |
CleanupStack::PushL(pic2);
|
|
2309 |
pic2->SetStartPosition(134);
|
|
2310 |
sendMessage->AddEMSInformationElementL(*pic2);
|
|
2311 |
CleanupStack::PopAndDestroy(pic2);
|
|
2312 |
|
|
2313 |
// add text formating in position 140, 12 char long
|
|
2314 |
CEmsFormatIE* format1 = CEmsFormatIE::NewL();
|
|
2315 |
format1->SetStartPosition(140);
|
|
2316 |
format1->SetFormatLength(12);
|
|
2317 |
format1->SetBold(ETrue);
|
|
2318 |
CleanupStack::PushL(format1);
|
|
2319 |
sendMessage->AddEMSInformationElementL(*format1);
|
|
2320 |
CleanupStack::PopAndDestroy(format1);
|
|
2321 |
|
|
2322 |
// now send and receive the EMS message
|
|
2323 |
SendSmsL(sendMessage,socket);
|
|
2324 |
|
|
2325 |
WaitForRecvL(socket);
|
|
2326 |
CSmsMessage* recvMessage = RecvSmsL(socket);
|
|
2327 |
CleanupStack::PushL(recvMessage);
|
|
2328 |
|
|
2329 |
CompareEmsElementsL(*sendMessage, *recvMessage);
|
|
2330 |
|
|
2331 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
2332 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
2333 |
|
|
2334 |
CleanupStack::PopAndDestroy(&socket);
|
|
2335 |
//closing is too fast when using EKA2
|
|
2336 |
User::After(2000000);
|
|
2337 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
2338 |
|
|
2339 |
User::After(2000000); // wait for socket to close before reopening
|
|
2340 |
}
|
|
2341 |
|
|
2342 |
void CSmsInterTestStep::SendRecvEMSOn8BitPortL()
|
|
2343 |
/**
|
|
2344 |
* @test Send and Receive EMS message using 8-Bit port addressing
|
|
2345 |
* Use t_editdb to setup the service centre number in the right modem record,
|
|
2346 |
* otherwise this case will fail.
|
|
2347 |
*/
|
|
2348 |
{
|
|
2349 |
INFO_PRINTF1(_L("Send and receive EMS using 8-Bit port addressing "));
|
|
2350 |
|
|
2351 |
RSocketServ socketServer;
|
|
2352 |
Connect2EsockLC(socketServer);
|
|
2353 |
RSocket socket;
|
|
2354 |
RSocket wapSocket;
|
|
2355 |
TSmsAddr addr8;
|
|
2356 |
addr8.SetSmsAddrFamily(ESmsAddrApplication8BitPort);
|
|
2357 |
TWapAddr wapAddr8;
|
|
2358 |
|
|
2359 |
TInt port8 = 245;
|
|
2360 |
TInt wapPort8 = 246;
|
|
2361 |
addr8.SetPort(port8);
|
|
2362 |
wapAddr8.SetWapPort(TWapPortNumber(wapPort8));
|
|
2363 |
TBuf8<100> buf8;
|
|
2364 |
buf8.Copy(iTelephoneNumber);
|
|
2365 |
wapAddr8.SetWapAddress(buf8);
|
|
2366 |
TInt ret = 0;
|
|
2367 |
// open sockets and bind them to ports
|
|
2368 |
ret = socket.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
2369 |
TEST(ret==KErrNone);
|
|
2370 |
ret = socket.Bind(addr8);
|
|
2371 |
TEST(ret==KErrNone);
|
|
2372 |
ret = wapSocket.Open(socketServer,KWAPSMSAddrFamily,KSockDatagram,KWAPSMSDatagramProtocol);
|
|
2373 |
TEST(ret==KErrNone);
|
|
2374 |
ret = wapSocket.Bind(wapAddr8);
|
|
2375 |
TEST(ret==KErrNone);
|
|
2376 |
|
|
2377 |
// create EMS message
|
|
2378 |
//TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
2379 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit;
|
|
2380 |
CSmsMessage* sendMessage=CreateSmsMessageL(KSoundMsg1,alphabet);
|
|
2381 |
CleanupStack::PushL(sendMessage);
|
|
2382 |
|
|
2383 |
// add two sound objects
|
|
2384 |
CEmsPreDefSoundIE* object1 = CEmsPreDefSoundIE::NewL( CEmsPreDefSoundIE::EChordLow);
|
|
2385 |
CleanupStack::PushL(object1);
|
|
2386 |
object1->SetStartPosition(17);
|
|
2387 |
sendMessage->AddEMSInformationElementL(*object1);
|
|
2388 |
CleanupStack::PopAndDestroy(object1);
|
|
2389 |
|
|
2390 |
CEmsPreDefSoundIE* object2 = CEmsPreDefSoundIE::NewL(CEmsPreDefSoundIE::ETaDa);
|
|
2391 |
CleanupStack::PushL(object2);
|
|
2392 |
object2->SetStartPosition(33);
|
|
2393 |
sendMessage->AddEMSInformationElementL(*object2);
|
|
2394 |
CleanupStack::PopAndDestroy(object2);
|
|
2395 |
|
|
2396 |
// set SMS port addresing for 8 Bit ports
|
|
2397 |
CSmsPDU& pdu = sendMessage->SmsPDU();
|
|
2398 |
pdu.SetApplicationPortAddressingL(ETrue, port8, port8, EFalse);
|
|
2399 |
|
|
2400 |
// send EMS message
|
|
2401 |
SendSmsL(sendMessage,socket);
|
|
2402 |
|
|
2403 |
WaitForRecvL(socket);
|
|
2404 |
CSmsMessage* recvMessage = RecvSmsL(socket);
|
|
2405 |
CleanupStack::PushL(recvMessage);
|
|
2406 |
|
|
2407 |
//compare send and received messages
|
|
2408 |
CompareEmsElementsL(*sendMessage, *recvMessage);
|
|
2409 |
|
|
2410 |
// now send a message to the wap socket
|
|
2411 |
TWapAddr recvWapAddr;
|
|
2412 |
TBuf8<256> recvBuf;
|
|
2413 |
TRequestStatus recvStatus;
|
|
2414 |
wapSocket.RecvFrom(recvBuf,recvWapAddr,0,recvStatus);
|
|
2415 |
|
|
2416 |
TRequestStatus status;
|
|
2417 |
wapSocket.SendTo(KWapTestMsg,wapAddr8,0,status);
|
|
2418 |
User::WaitForRequest(status);
|
|
2419 |
TEST(status.Int()==KErrNone);
|
|
2420 |
|
|
2421 |
User::WaitForRequest(recvStatus);
|
|
2422 |
|
|
2423 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
2424 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
2425 |
socket.Close();
|
|
2426 |
wapSocket.Close();
|
|
2427 |
//closing is too fast when using EKA2
|
|
2428 |
User::After(2000000);
|
|
2429 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
2430 |
|
|
2431 |
User::After(2000000); // wait for socket to close before reopening
|
|
2432 |
}
|
|
2433 |
|
|
2434 |
void CSmsInterTestStep::SendRecvEMSOn16BitPortL()
|
|
2435 |
/*
|
|
2436 |
* @test Send and Receive EMS message using 16-Bit port addressing
|
|
2437 |
* Use t_editdb to setup the service centre number in the right modem record,
|
|
2438 |
* otherwise this case will fail.
|
|
2439 |
*/
|
|
2440 |
{
|
|
2441 |
INFO_PRINTF1(_L("Send and receive EMS using 16-Bit port addressing "));
|
|
2442 |
|
|
2443 |
RSocketServ socketServer;
|
|
2444 |
Connect2EsockLC(socketServer);
|
|
2445 |
RSocket socket;
|
|
2446 |
RSocket wapSocket;
|
|
2447 |
TSmsAddr addr16;
|
|
2448 |
addr16.SetSmsAddrFamily(ESmsAddrApplication16BitPort);
|
|
2449 |
TWapAddr wapAddr16;
|
|
2450 |
|
|
2451 |
TInt port16 = 16001;
|
|
2452 |
TInt wapPort16 = 16002;
|
|
2453 |
addr16.SetPort(port16);
|
|
2454 |
wapAddr16.SetWapPort(TWapPortNumber(wapPort16));
|
|
2455 |
TBuf8<100> buf8;
|
|
2456 |
buf8.Copy(iTelephoneNumber);
|
|
2457 |
wapAddr16.SetWapAddress(buf8);
|
|
2458 |
TInt ret = 0;
|
|
2459 |
// open sockets and bind them to ports
|
|
2460 |
ret = socket.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
2461 |
TEST(ret==KErrNone);
|
|
2462 |
ret = socket.Bind(addr16);
|
|
2463 |
TEST(ret==KErrNone);
|
|
2464 |
ret = wapSocket.Open(socketServer,KWAPSMSAddrFamily,KSockDatagram,KWAPSMSDatagramProtocol);
|
|
2465 |
TEST(ret==KErrNone);
|
|
2466 |
ret = wapSocket.Bind(wapAddr16);
|
|
2467 |
TEST(ret==KErrNone);
|
|
2468 |
|
|
2469 |
// create EMS message
|
|
2470 |
//TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
2471 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit;
|
|
2472 |
CSmsMessage* sendMessage=CreateSmsMessageL(KSoundMsg1,alphabet);
|
|
2473 |
CleanupStack::PushL(sendMessage);
|
|
2474 |
|
|
2475 |
// add two sound objects
|
|
2476 |
CEmsPreDefSoundIE* object1 = CEmsPreDefSoundIE::NewL( CEmsPreDefSoundIE::EChordLow);
|
|
2477 |
CleanupStack::PushL(object1);
|
|
2478 |
object1->SetStartPosition(17);
|
|
2479 |
sendMessage->AddEMSInformationElementL(*object1);
|
|
2480 |
CleanupStack::PopAndDestroy(object1);
|
|
2481 |
|
|
2482 |
CEmsPreDefSoundIE* object2 = CEmsPreDefSoundIE::NewL(CEmsPreDefSoundIE::ETaDa);
|
|
2483 |
CleanupStack::PushL(object2);
|
|
2484 |
object2->SetStartPosition(33);
|
|
2485 |
sendMessage->AddEMSInformationElementL(*object2);
|
|
2486 |
CleanupStack::PopAndDestroy(object2);
|
|
2487 |
|
|
2488 |
// set SMS port addresing for 8 Bit ports
|
|
2489 |
CSmsPDU& pdu = sendMessage->SmsPDU();
|
|
2490 |
pdu.SetApplicationPortAddressingL(ETrue, port16, port16, ETrue);
|
|
2491 |
|
|
2492 |
// send EMS message
|
|
2493 |
SendSmsL(sendMessage,socket);
|
|
2494 |
|
|
2495 |
WaitForRecvL(socket);
|
|
2496 |
CSmsMessage* recvMessage = RecvSmsL(socket);
|
|
2497 |
CleanupStack::PushL(recvMessage);
|
|
2498 |
|
|
2499 |
//compare send and received messages
|
|
2500 |
CompareEmsElementsL(*sendMessage, *recvMessage);
|
|
2501 |
|
|
2502 |
// now send a message to the wap socket
|
|
2503 |
TWapAddr recvWapAddr;
|
|
2504 |
TBuf8<256> recvBuf;
|
|
2505 |
TRequestStatus recvStatus;
|
|
2506 |
wapSocket.RecvFrom(recvBuf,recvWapAddr,0,recvStatus);
|
|
2507 |
|
|
2508 |
TRequestStatus status;
|
|
2509 |
wapSocket.SendTo(KWapTestMsg,wapAddr16,0,status);
|
|
2510 |
User::WaitForRequest(status);
|
|
2511 |
TEST(status.Int() == KErrNone);
|
|
2512 |
|
|
2513 |
User::WaitForRequest(recvStatus);
|
|
2514 |
|
|
2515 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
2516 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
2517 |
socket.Close();
|
|
2518 |
wapSocket.Close();
|
|
2519 |
//closing is too fast when using EKA2
|
|
2520 |
User::After(2000000);
|
|
2521 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
2522 |
|
|
2523 |
User::After(2000000); // wait for socket to close before reopening
|
|
2524 |
}
|
|
2525 |
|
|
2526 |
void CSmsInterTestStep::TestFormattingSegmentationL(void)
|
|
2527 |
/*
|
|
2528 |
* Test correct text format segmentation upon send and receive.
|
|
2529 |
* Format length goes beyond text, therefore, received FormatLength
|
|
2530 |
* will not be the same as the sent one.
|
|
2531 |
*/
|
|
2532 |
{
|
|
2533 |
INFO_PRINTF1(_L("Send/Receive EMS with correct formatted segments"));
|
|
2534 |
|
|
2535 |
RSocketServ socketServer;
|
|
2536 |
Connect2EsockLC(socketServer);
|
|
2537 |
RSocket socket;
|
|
2538 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
2539 |
|
|
2540 |
// send/receive EMS message with format stretching over 3 PDUs, 8 Bit
|
|
2541 |
INFO_PRINTF1(_L("Sending 8-Bit EMS with format stretching over 3 PDUs "));
|
|
2542 |
CSmsMessage* sendMessage1 = CreateSmsMessageL(KTestEmsMsg8Bit1,TSmsDataCodingScheme::ESmsAlphabet8Bit);
|
|
2543 |
CleanupStack::PushL(sendMessage1);
|
|
2544 |
|
|
2545 |
CEmsFormatIE* object1 = CEmsFormatIE::NewL();
|
|
2546 |
object1->SetStartPosition(10);
|
|
2547 |
object1->SetFormatLength(261); //271, gose beyond message
|
|
2548 |
object1->SetBold(ETrue);
|
|
2549 |
CleanupStack::PushL(object1);
|
|
2550 |
sendMessage1->AddEMSInformationElementL(*object1);
|
|
2551 |
CleanupStack::PopAndDestroy(object1);
|
|
2552 |
|
|
2553 |
SendSmsL(sendMessage1,socket);
|
|
2554 |
|
|
2555 |
WaitForRecvL(socket);
|
|
2556 |
CSmsMessage* recvMessage1 = RecvSmsL(socket);
|
|
2557 |
CleanupStack::PushL(recvMessage1);
|
|
2558 |
|
|
2559 |
// compare sent and received
|
|
2560 |
CompareEmsElementsL(*sendMessage1, *recvMessage1);
|
|
2561 |
|
|
2562 |
CleanupStack::PopAndDestroy(recvMessage1);
|
|
2563 |
CleanupStack::PopAndDestroy(sendMessage1);
|
|
2564 |
|
|
2565 |
// send/receive EMS message with format stretching over 2 PDUs, 8 Bit
|
|
2566 |
INFO_PRINTF1(_L("Sending 8-Bit EMS with format stretching over 2 PDUs "));
|
|
2567 |
CSmsMessage* sendMessage2 = CreateSmsMessageL(KTestEmsMsg8Bit2,TSmsDataCodingScheme::ESmsAlphabet8Bit);
|
|
2568 |
CleanupStack::PushL(sendMessage2);
|
|
2569 |
|
|
2570 |
CEmsFormatIE* object2 = CEmsFormatIE::NewL();
|
|
2571 |
object2->SetStartPosition(10);
|
|
2572 |
object2->SetFormatLength(261); //271 goes beyond message
|
|
2573 |
object2->SetBold(ETrue);
|
|
2574 |
CleanupStack::PushL(object2);
|
|
2575 |
sendMessage2->AddEMSInformationElementL(*object2);
|
|
2576 |
CleanupStack::PopAndDestroy(object2);
|
|
2577 |
|
|
2578 |
SendSmsL(sendMessage2,socket);
|
|
2579 |
|
|
2580 |
WaitForRecvL(socket);
|
|
2581 |
CSmsMessage* recvMessage2 = RecvSmsL(socket);
|
|
2582 |
CleanupStack::PushL(recvMessage2);
|
|
2583 |
|
|
2584 |
// compare sent and received
|
|
2585 |
CompareEmsElementsL(*sendMessage2, *recvMessage2);
|
|
2586 |
|
|
2587 |
CleanupStack::PopAndDestroy(recvMessage2);
|
|
2588 |
CleanupStack::PopAndDestroy(sendMessage2);
|
|
2589 |
|
|
2590 |
// send/receive EMS message with format stretching over middle PDU, 8 Bit
|
|
2591 |
INFO_PRINTF1(_L("Sending 8-Bit EMS with format stretching over middle PDU "));
|
|
2592 |
CSmsMessage* sendMessage3 = CreateSmsMessageL(KTestEmsMsg8Bit3,TSmsDataCodingScheme::ESmsAlphabet8Bit);
|
|
2593 |
CleanupStack::PushL(sendMessage3);
|
|
2594 |
|
|
2595 |
CEmsFormatIE* object3 = CEmsFormatIE::NewL();
|
|
2596 |
object3->SetStartPosition(134);
|
|
2597 |
object3->SetFormatLength(129); //263 withen message
|
|
2598 |
object3->SetBold(ETrue);
|
|
2599 |
CleanupStack::PushL(object3);
|
|
2600 |
sendMessage3->AddEMSInformationElementL(*object3);
|
|
2601 |
CleanupStack::PopAndDestroy(object3);
|
|
2602 |
|
|
2603 |
SendSmsL(sendMessage3,socket);
|
|
2604 |
|
|
2605 |
WaitForRecvL(socket);
|
|
2606 |
CSmsMessage* recvMessage3 = RecvSmsL(socket);
|
|
2607 |
CleanupStack::PushL(recvMessage3);
|
|
2608 |
|
|
2609 |
// compare sent and received
|
|
2610 |
CompareEmsElementsL(*sendMessage3, *recvMessage3);
|
|
2611 |
|
|
2612 |
CleanupStack::PopAndDestroy(recvMessage3);
|
|
2613 |
CleanupStack::PopAndDestroy(sendMessage3);
|
|
2614 |
|
|
2615 |
// send/receive EMS message with format stretching over middle PDU, 16 Bit
|
|
2616 |
INFO_PRINTF1(_L("Sending 16-Bit EMS with format stretching over 3 PDUs "));
|
|
2617 |
CSmsMessage* sendMessage4 = CreateSmsMessageL(KTestEmsMsg16Bit1,TSmsDataCodingScheme::ESmsAlphabetUCS2);
|
|
2618 |
CleanupStack::PushL(sendMessage4);
|
|
2619 |
|
|
2620 |
CEmsFormatIE* object4 = CEmsFormatIE::NewL();
|
|
2621 |
object4->SetStartPosition(10);
|
|
2622 |
object4->SetFormatLength(261); //271 goes beyond message
|
|
2623 |
object4->SetBold(ETrue);
|
|
2624 |
CleanupStack::PushL(object4);
|
|
2625 |
sendMessage4->AddEMSInformationElementL(*object4);
|
|
2626 |
CleanupStack::PopAndDestroy(object4);
|
|
2627 |
|
|
2628 |
SendSmsL(sendMessage4,socket);
|
|
2629 |
|
|
2630 |
WaitForRecvL(socket);
|
|
2631 |
CSmsMessage* recvMessage4 = RecvSmsL(socket);
|
|
2632 |
CleanupStack::PushL(recvMessage4);
|
|
2633 |
|
|
2634 |
// compare sent and received
|
|
2635 |
CompareEmsElementsL(*sendMessage4, *recvMessage4);
|
|
2636 |
|
|
2637 |
CleanupStack::PopAndDestroy(recvMessage4);
|
|
2638 |
CleanupStack::PopAndDestroy(sendMessage4);
|
|
2639 |
|
|
2640 |
// Test correct coding of formatted text, regression for LEE-5AEF7Z
|
|
2641 |
INFO_PRINTF1(_L("Sending long format that contain a picture object "));
|
|
2642 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
2643 |
CSmsMessage* sendMessage5 = CreateSmsMessageL(KLongFormatMsg,alphabet);
|
|
2644 |
CleanupStack::PushL(sendMessage5);
|
|
2645 |
|
|
2646 |
CEmsFormatIE* object5 = CEmsFormatIE::NewL();
|
|
2647 |
CleanupStack::PushL(object5);
|
|
2648 |
|
|
2649 |
object5->SetStartPosition(10);
|
|
2650 |
object5->SetFormatLength(100); //110 withen message
|
|
2651 |
object5->SetBold(ETrue);
|
|
2652 |
object5->SetItalic(ETrue);
|
|
2653 |
object5->SetUnderline(ETrue);
|
|
2654 |
object5->SetStrikethrough(ETrue);
|
|
2655 |
|
|
2656 |
sendMessage5->AddEMSInformationElementL(*object5);
|
|
2657 |
CleanupStack::PopAndDestroy(object5);
|
|
2658 |
|
|
2659 |
CEmsPictureIE* object6 = EmsTestUtils::CreatePictureL(1);
|
|
2660 |
CleanupStack::PushL(object6);
|
|
2661 |
object6->SetStartPosition(20);
|
|
2662 |
|
|
2663 |
sendMessage5->AddEMSInformationElementL(*object6);
|
|
2664 |
CleanupStack::PopAndDestroy(object6);
|
|
2665 |
|
|
2666 |
SendSmsL(sendMessage5,socket);
|
|
2667 |
|
|
2668 |
WaitForRecvL(socket);
|
|
2669 |
CSmsMessage* recvMessage5 = RecvSmsL(socket);
|
|
2670 |
CleanupStack::PushL(recvMessage5);
|
|
2671 |
|
|
2672 |
// compare sent and received
|
|
2673 |
CompareEmsElementsL(*sendMessage5, *recvMessage5);
|
|
2674 |
|
|
2675 |
CleanupStack::PopAndDestroy(recvMessage5);
|
|
2676 |
CleanupStack::PopAndDestroy(sendMessage5);
|
|
2677 |
|
|
2678 |
CleanupStack::PopAndDestroy(&socket);
|
|
2679 |
//closing is too fast when using EKA2
|
|
2680 |
User::After(2000000);
|
|
2681 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
2682 |
|
|
2683 |
User::After(2000000); // wait for socket to close before reopening
|
|
2684 |
}
|
|
2685 |
|
|
2686 |
void CSmsInterTestStep::TestNumberOfMessagesL(void)
|
|
2687 |
/*
|
|
2688 |
* Test correct segmentation of EMS messages upon send and receive.
|
|
2689 |
*/
|
|
2690 |
{
|
|
2691 |
INFO_PRINTF1(_L("Send/Receive EMS with correct number of segments"));
|
|
2692 |
|
|
2693 |
RSocketServ socketServer;
|
|
2694 |
Connect2EsockLC(socketServer);
|
|
2695 |
RSocket socket;
|
|
2696 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
2697 |
|
|
2698 |
// send/receive 8-Bit EMS message with 2 PDU.
|
|
2699 |
INFO_PRINTF1(_L("Sending 8-Bit EMS with 2 PDUs "));
|
|
2700 |
|
|
2701 |
CSmsMessage* sendMessage1 = CreateSmsMessageL(KTest2PduMsg8Bit,TSmsDataCodingScheme::ESmsAlphabet8Bit);
|
|
2702 |
CleanupStack::PushL(sendMessage1);
|
|
2703 |
|
|
2704 |
CEmsFormatIE* object1 = CEmsFormatIE::NewL();
|
|
2705 |
object1->SetStartPosition(100);
|
|
2706 |
object1->SetFormatLength(10);
|
|
2707 |
object1->SetBold(ETrue);
|
|
2708 |
CleanupStack::PushL(object1);
|
|
2709 |
sendMessage1->AddEMSInformationElementL(*object1);
|
|
2710 |
CleanupStack::PopAndDestroy(object1);
|
|
2711 |
|
|
2712 |
SendSmsL(sendMessage1,socket);
|
|
2713 |
|
|
2714 |
WaitForRecvL(socket);
|
|
2715 |
CSmsMessage* recvMessage1 = RecvSmsL(socket);
|
|
2716 |
CleanupStack::PushL(recvMessage1);
|
|
2717 |
|
|
2718 |
// compare sent and received
|
|
2719 |
CompareEmsElementsL(*sendMessage1, *recvMessage1);
|
|
2720 |
|
|
2721 |
CleanupStack::PopAndDestroy(recvMessage1);
|
|
2722 |
CleanupStack::PopAndDestroy(sendMessage1);
|
|
2723 |
|
|
2724 |
// send/receive 7-Bit EMS message with 2 PDU.
|
|
2725 |
INFO_PRINTF1(_L("Sending 7-Bit EMS with 2 PDUs "));
|
|
2726 |
CSmsMessage* sendMessage2 = CreateSmsMessageL(KTest2PduMsg7Bit,TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
2727 |
CleanupStack::PushL(sendMessage2);
|
|
2728 |
|
|
2729 |
CEmsFormatIE* object2 = CEmsFormatIE::NewL();
|
|
2730 |
object2->SetStartPosition(100);
|
|
2731 |
object2->SetFormatLength(10);
|
|
2732 |
object2->SetBold(ETrue);
|
|
2733 |
CleanupStack::PushL(object2);
|
|
2734 |
sendMessage2->AddEMSInformationElementL(*object2);
|
|
2735 |
CleanupStack::PopAndDestroy(object2);
|
|
2736 |
|
|
2737 |
SendSmsL(sendMessage2,socket);
|
|
2738 |
|
|
2739 |
WaitForRecvL(socket);
|
|
2740 |
CSmsMessage* recvMessage2 = RecvSmsL(socket);
|
|
2741 |
CleanupStack::PushL(recvMessage2);
|
|
2742 |
|
|
2743 |
// compare sent and received
|
|
2744 |
CompareEmsElementsL(*sendMessage2, *recvMessage2);
|
|
2745 |
|
|
2746 |
CleanupStack::PopAndDestroy(recvMessage2);
|
|
2747 |
CleanupStack::PopAndDestroy(sendMessage2);
|
|
2748 |
|
|
2749 |
// send/receive 16-Bit EMS message with 2 PDU.
|
|
2750 |
INFO_PRINTF1(_L("Sending 16-Bit EMS with 2 PDUs "));
|
|
2751 |
CSmsMessage* sendMessage3 = CreateSmsMessageL(KTest2PduMsg16Bit,TSmsDataCodingScheme::ESmsAlphabetUCS2);
|
|
2752 |
CleanupStack::PushL(sendMessage3);
|
|
2753 |
|
|
2754 |
CEmsFormatIE* object3 = CEmsFormatIE::NewL();
|
|
2755 |
object3->SetStartPosition(40);
|
|
2756 |
object3->SetFormatLength(10);
|
|
2757 |
object3->SetBold(ETrue);
|
|
2758 |
CleanupStack::PushL(object3);
|
|
2759 |
sendMessage3->AddEMSInformationElementL(*object3);
|
|
2760 |
CleanupStack::PopAndDestroy(object3);
|
|
2761 |
|
|
2762 |
SendSmsL(sendMessage3,socket);
|
|
2763 |
|
|
2764 |
WaitForRecvL(socket);
|
|
2765 |
CSmsMessage* recvMessage3 = RecvSmsL(socket);
|
|
2766 |
CleanupStack::PushL(recvMessage3);
|
|
2767 |
|
|
2768 |
// compare sent and received
|
|
2769 |
CompareEmsElementsL(*sendMessage3, *recvMessage3);
|
|
2770 |
|
|
2771 |
CleanupStack::PopAndDestroy(recvMessage3);
|
|
2772 |
CleanupStack::PopAndDestroy(sendMessage3);
|
|
2773 |
|
|
2774 |
// send/receive 8-Bit empty text EMS message with no IEs
|
|
2775 |
INFO_PRINTF1(_L("Sending 8-Bit empty text EMS with no IEs "));
|
|
2776 |
|
|
2777 |
CSmsMessage* sendMessage4 = CreateSmsMessageL(KTestEmptyMsg8Bit,TSmsDataCodingScheme::ESmsAlphabet8Bit);
|
|
2778 |
CleanupStack::PushL(sendMessage4);
|
|
2779 |
|
|
2780 |
SendSmsL(sendMessage4,socket);
|
|
2781 |
|
|
2782 |
WaitForRecvL(socket);
|
|
2783 |
CSmsMessage* recvMessage4 = RecvSmsL(socket);
|
|
2784 |
CleanupStack::PushL(recvMessage4);
|
|
2785 |
|
|
2786 |
// compare sent and received
|
|
2787 |
CompareEmsElementsL(*sendMessage4, *recvMessage4);
|
|
2788 |
|
|
2789 |
CleanupStack::PopAndDestroy(recvMessage4);
|
|
2790 |
CleanupStack::PopAndDestroy(sendMessage4);
|
|
2791 |
|
|
2792 |
// send/receive 8-Bit empty text EMS message with IE pointing to the empty text
|
|
2793 |
INFO_PRINTF1(_L("Sending 8-Bit EMS with IE points to empty text "));
|
|
2794 |
|
|
2795 |
CSmsMessage* sendMessage5 = CreateSmsMessageL(KTestEmptyMsg8Bit,TSmsDataCodingScheme::ESmsAlphabet8Bit);
|
|
2796 |
CleanupStack::PushL(sendMessage5);
|
|
2797 |
|
|
2798 |
CEmsFormatIE* object5 = CEmsFormatIE::NewL();
|
|
2799 |
object5->SetStartPosition(0);
|
|
2800 |
object5->SetFormatLength(0);
|
|
2801 |
object5->SetBold(ETrue);
|
|
2802 |
CleanupStack::PushL(object5);
|
|
2803 |
sendMessage5->AddEMSInformationElementL(*object5);
|
|
2804 |
CleanupStack::PopAndDestroy(object5);
|
|
2805 |
|
|
2806 |
SendSmsL(sendMessage5,socket);
|
|
2807 |
|
|
2808 |
WaitForRecvL(socket);
|
|
2809 |
CSmsMessage* recvMessage5 = RecvSmsL(socket);
|
|
2810 |
CleanupStack::PushL(recvMessage5);
|
|
2811 |
|
|
2812 |
// compare sent and received
|
|
2813 |
CompareEmsElementsL(*sendMessage5, *recvMessage5);
|
|
2814 |
|
|
2815 |
CleanupStack::PopAndDestroy(recvMessage5);
|
|
2816 |
CleanupStack::PopAndDestroy(sendMessage5);
|
|
2817 |
|
|
2818 |
// send/receive 7-Bit EMS with 2 PDU and extended char at boundary
|
|
2819 |
INFO_PRINTF1(_L("Sending EMS with extended char at boundary "));
|
|
2820 |
|
|
2821 |
TInt bufLen = KTestExtdMsg7Bit1().Length();
|
|
2822 |
HBufC* textBuf1=KTestExtdMsg7Bit1().AllocLC();
|
|
2823 |
TPtr textPtr1(textBuf1->Des());
|
|
2824 |
textPtr1[bufLen - 1] = 0x20ac; //Unicode Euro sign
|
|
2825 |
|
|
2826 |
CSmsMessage* sendMessage6 = CreateSmsMessageL(*textBuf1,TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
2827 |
CleanupStack::PushL(sendMessage6);
|
|
2828 |
|
|
2829 |
CEmsFormatIE* object6 = CEmsFormatIE::NewL();
|
|
2830 |
object6->SetStartPosition(100);
|
|
2831 |
object6->SetFormatLength(10);
|
|
2832 |
object6->SetBold(ETrue);
|
|
2833 |
CleanupStack::PushL(object6);
|
|
2834 |
sendMessage6->AddEMSInformationElementL(*object6);
|
|
2835 |
CleanupStack::PopAndDestroy(object6);
|
|
2836 |
|
|
2837 |
SendSmsL(sendMessage6,socket);
|
|
2838 |
|
|
2839 |
WaitForRecvL(socket);
|
|
2840 |
CSmsMessage* recvMessage6 = RecvSmsL(socket);
|
|
2841 |
CleanupStack::PushL(recvMessage6);
|
|
2842 |
|
|
2843 |
// compare sent and received
|
|
2844 |
CompareEmsElementsL(*sendMessage6, *recvMessage6);
|
|
2845 |
|
|
2846 |
CleanupStack::PopAndDestroy(recvMessage6);
|
|
2847 |
CleanupStack::PopAndDestroy(sendMessage6);
|
|
2848 |
CleanupStack::PopAndDestroy(textBuf1);
|
|
2849 |
|
|
2850 |
// send/receive 7-Bit EMS with 2 PDU and IE pointing to extended char at boundary
|
|
2851 |
INFO_PRINTF1(_L("Sending EMS with IE pointing to extended char at boundary "));
|
|
2852 |
|
|
2853 |
bufLen = KTestExtdMsg7Bit2().Length();
|
|
2854 |
HBufC* textBuf2=KTestExtdMsg7Bit2().AllocLC();
|
|
2855 |
TPtr textPtr2(textBuf2->Des());
|
|
2856 |
for(TInt i=1;i<=8;i++)
|
|
2857 |
textPtr2[bufLen - i] = 0x20ac;
|
|
2858 |
|
|
2859 |
CSmsMessage* sendMessage7 = CreateSmsMessageL(*textBuf2,TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
2860 |
CleanupStack::PushL(sendMessage7);
|
|
2861 |
|
|
2862 |
CEmsFormatIE* object7 = CEmsFormatIE::NewL();
|
|
2863 |
object7->SetStartPosition(153);
|
|
2864 |
object7->SetFormatLength(2);
|
|
2865 |
object7->SetBold(ETrue);
|
|
2866 |
CleanupStack::PushL(object7);
|
|
2867 |
sendMessage7->AddEMSInformationElementL(*object7);
|
|
2868 |
CleanupStack::PopAndDestroy(object7);
|
|
2869 |
|
|
2870 |
SendSmsL(sendMessage7,socket);
|
|
2871 |
|
|
2872 |
WaitForRecvL(socket);
|
|
2873 |
CSmsMessage* recvMessage7 = RecvSmsL(socket);
|
|
2874 |
CleanupStack::PushL(recvMessage7);
|
|
2875 |
|
|
2876 |
// compare sent and received
|
|
2877 |
CompareEmsElementsL(*sendMessage7, *recvMessage7);
|
|
2878 |
|
|
2879 |
CleanupStack::PopAndDestroy(recvMessage7);
|
|
2880 |
CleanupStack::PopAndDestroy(sendMessage7);
|
|
2881 |
CleanupStack::PopAndDestroy(textBuf2);
|
|
2882 |
|
|
2883 |
CleanupStack::PopAndDestroy(&socket);
|
|
2884 |
//closing is too fast when using EKA2
|
|
2885 |
User::After(2000000);
|
|
2886 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
2887 |
|
|
2888 |
User::After(2000000); // wait for socket to close before reopening
|
|
2889 |
}
|
|
2890 |
|
|
2891 |
void CSmsInterTestStep::EnumerateReadWriteAndDeleteEMSOnSIML(void)
|
|
2892 |
{
|
|
2893 |
TBool found( ETrue );
|
|
2894 |
TInt count( 0 );
|
|
2895 |
while( found )
|
|
2896 |
{
|
|
2897 |
//run the test
|
|
2898 |
found = DoSingleTestCaseL( KEnumerateReadWriteAndDeleteEMSOnSIM, count++ );
|
|
2899 |
}
|
|
2900 |
}
|
|
2901 |
|
|
2902 |
void CSmsInterTestStep::EnumerateReadWriteAndDeleteEMSOnPhoneL(void)
|
|
2903 |
{
|
|
2904 |
/*
|
|
2905 |
if( gAutoTest->KeepGoing() )
|
|
2906 |
return;
|
|
2907 |
*/
|
|
2908 |
TBool found( ETrue );
|
|
2909 |
TInt count( 0 );
|
|
2910 |
while( found )
|
|
2911 |
{
|
|
2912 |
//run the test
|
|
2913 |
found = DoSingleTestCaseL( KEnumerateReadWriteAndDeleteEMSOnPhone, count++ );
|
|
2914 |
}
|
|
2915 |
}
|
|
2916 |
|
|
2917 |
CSmsMessage* CSmsInterTestStep::CreateAndSetMessageL( const RPointerArray<CSmsPduDbMessage>& aArray, TInt aArrayIndex )
|
|
2918 |
{
|
|
2919 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
2920 |
|
|
2921 |
CSmsBufferBase& smsBuffer=aArray[aArrayIndex]->iSmsMessage->Buffer();
|
|
2922 |
TInt bufLen=smsBuffer.Length();
|
|
2923 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
2924 |
CleanupStack::PushL(textBuf);
|
|
2925 |
TPtr buffer(textBuf->Des());
|
|
2926 |
smsBuffer.Extract(buffer,0,bufLen);
|
|
2927 |
|
|
2928 |
CSmsMessage* smsMessage=CreateSmsMessageL(buffer,alphabet,CSmsPDU::ESmsDeliver);
|
|
2929 |
CleanupStack::PopAndDestroy(textBuf);
|
|
2930 |
|
|
2931 |
smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage);
|
|
2932 |
return smsMessage;
|
|
2933 |
} // CSmsInterTestStep::CreateAndSetMessageL
|
|
2934 |
|
|
2935 |
|
|
2936 |
void CSmsInterTestStep::TestSendAndReceive7bitMsgsL( TPtrC8 aPdu,
|
|
2937 |
const RPointerArray<CSmsPduDbMessage>& aArray,
|
|
2938 |
const CArrayFixFlat<TInt>* aCharArray,
|
|
2939 |
const CArrayFixFlat<TInt>* aMessageLengthArray )
|
|
2940 |
/**
|
|
2941 |
* @test Send and Receive 7-bit SMS messages with different message lengths
|
|
2942 |
*/
|
|
2943 |
{
|
|
2944 |
INFO_PRINTF1(_L("Send and Receive SMS messages with different message lengths"));
|
|
2945 |
INFO_PRINTF1(_L("GT83-T_SmsSendReceive-006"));
|
|
2946 |
|
|
2947 |
RSocketServ socketServer;
|
|
2948 |
Connect2EsockLC(socketServer);
|
|
2949 |
RSocket socket;
|
|
2950 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
2951 |
|
|
2952 |
TInt bufLen=aArray[0]->iSmsMessage->Buffer().Length();
|
|
2953 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
2954 |
CleanupStack::PushL(textBuf);
|
|
2955 |
TPtr textPtr(textBuf->Des());
|
|
2956 |
aArray[0]->iSmsMessage->Buffer().Extract(textPtr,0,bufLen);
|
|
2957 |
|
|
2958 |
SendAndRecvSms7BitL( textPtr, socket );
|
|
2959 |
CleanupStack::PopAndDestroy(textBuf);
|
|
2960 |
|
|
2961 |
for ( TInt i = 0; i < aMessageLengthArray->Count(); i++ )
|
|
2962 |
{
|
|
2963 |
TInt length = aMessageLengthArray->At(i);
|
|
2964 |
|
|
2965 |
SendAndRecvSms7BitL(length, socket);
|
|
2966 |
|
|
2967 |
}
|
|
2968 |
|
|
2969 |
// Test extended characters
|
|
2970 |
TInt charCount = aCharArray->Count();
|
|
2971 |
|
|
2972 |
bufLen=aArray[1]->iSmsMessage->Buffer().Length();
|
|
2973 |
bufLen+= charCount;
|
|
2974 |
HBufC* textBuf2=HBufC::NewL(bufLen);
|
|
2975 |
CleanupStack::PushL(textBuf2);
|
|
2976 |
TPtr textPtr2(textBuf2->Des());
|
|
2977 |
aArray[1]->iSmsMessage->Buffer().Extract(textPtr2,0,bufLen-( charCount * 2 ) );
|
|
2978 |
|
|
2979 |
for ( TInt j = 0; j < charCount; j++ )
|
|
2980 |
textPtr2.Append(aCharArray->At(j) );
|
|
2981 |
|
|
2982 |
SendAndRecvSms7BitL( textPtr2, socket );
|
|
2983 |
CleanupStack::PopAndDestroy(textBuf2);
|
|
2984 |
|
|
2985 |
// Next tests extended character split across PDU boundary
|
|
2986 |
INFO_PRINTF1(_L("Sending message with extended char split over PDU boundary"));
|
|
2987 |
|
|
2988 |
TInt pduLength = aPdu.Length();
|
|
2989 |
TBuf16<165> buffer;
|
|
2990 |
|
|
2991 |
for (TInt k = 0; k < pduLength; k += 1 )
|
|
2992 |
buffer.Append( TUint16( aPdu[k] ) );
|
|
2993 |
|
|
2994 |
SendAndRecvSms7BitL( buffer , socket );
|
|
2995 |
|
|
2996 |
CleanupStack::PopAndDestroy(&socket);
|
|
2997 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
2998 |
|
|
2999 |
User::After(2000000); // wait for socket to close before reopening
|
|
3000 |
}
|
|
3001 |
|
|
3002 |
|
|
3003 |
void CSmsInterTestStep::TestSendAndReceive8bitMsgsL( const RPointerArray<CSmsPduDbMessage>& aArray,
|
|
3004 |
const CArrayFixFlat<TInt>* aMessageLengthArray )
|
|
3005 |
/**
|
|
3006 |
* @test Send and Recieve 8bit messages (no UDH information)
|
|
3007 |
*/
|
|
3008 |
{
|
|
3009 |
INFO_PRINTF1(_L("Send and Receive 8bit messages"));
|
|
3010 |
|
|
3011 |
RSocketServ socketServer;
|
|
3012 |
Connect2EsockLC(socketServer);
|
|
3013 |
RSocket socket;
|
|
3014 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
3015 |
|
|
3016 |
TInt bufLen=aArray[0]->iSmsMessage->Buffer().Length();
|
|
3017 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
3018 |
CleanupStack::PushL(textBuf);
|
|
3019 |
TPtr textPtr(textBuf->Des());
|
|
3020 |
aArray[0]->iSmsMessage->Buffer().Extract(textPtr,0,bufLen);
|
|
3021 |
|
|
3022 |
INFO_PRINTF1( _L( "Sending message: ") );
|
|
3023 |
INFO_PRINTF1( textPtr );
|
|
3024 |
SendAndRecvSms8BitL( textPtr, socket );
|
|
3025 |
CleanupStack::PopAndDestroy(textBuf);
|
|
3026 |
|
|
3027 |
for ( TInt i = 0; i < aMessageLengthArray->Count(); i++ )
|
|
3028 |
{
|
|
3029 |
TInt length = aMessageLengthArray->At(i);
|
|
3030 |
|
|
3031 |
INFO_PRINTF2(_L("Sending %d byte message"), length);
|
|
3032 |
SendAndRecvSms8BitL(length, socket);
|
|
3033 |
|
|
3034 |
}
|
|
3035 |
|
|
3036 |
CleanupStack::PopAndDestroy(&socket);
|
|
3037 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3038 |
|
|
3039 |
User::After(2000000); // wait for socket to close before reopening
|
|
3040 |
}
|
|
3041 |
|
|
3042 |
void CSmsInterTestStep::TestSendAndReceive16bitMsgsL( const RPointerArray<CSmsPduDbMessage>& aArray,
|
|
3043 |
const CArrayFixFlat<TInt>* aMessageLengthArray )
|
|
3044 |
/**
|
|
3045 |
* @test Send and Recieve 16bit messages (no UDH information)
|
|
3046 |
*/
|
|
3047 |
{
|
|
3048 |
INFO_PRINTF1(_L("Send and Receive 16bit messages"));
|
|
3049 |
|
|
3050 |
RSocketServ socketServer;
|
|
3051 |
Connect2EsockLC(socketServer);
|
|
3052 |
RSocket socket;
|
|
3053 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
3054 |
|
|
3055 |
TInt bufLen=aArray[0]->iSmsMessage->Buffer().Length();
|
|
3056 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
3057 |
CleanupStack::PushL(textBuf);
|
|
3058 |
TPtr textPtr(textBuf->Des());
|
|
3059 |
aArray[0]->iSmsMessage->Buffer().Extract(textPtr,0,bufLen);
|
|
3060 |
|
|
3061 |
INFO_PRINTF1( _L( "Sending message: ") );
|
|
3062 |
INFO_PRINTF1( textPtr );
|
|
3063 |
SendAndRecvSms16BitL( textPtr, socket );
|
|
3064 |
CleanupStack::PopAndDestroy(textBuf);
|
|
3065 |
|
|
3066 |
for ( TInt i = 0; i < aMessageLengthArray->Count(); i++ )
|
|
3067 |
{
|
|
3068 |
TInt length = aMessageLengthArray->At(i);
|
|
3069 |
|
|
3070 |
INFO_PRINTF2(_L("Sending %d byte message"), length);
|
|
3071 |
SendAndRecvSms16BitL(length, socket);
|
|
3072 |
|
|
3073 |
}
|
|
3074 |
|
|
3075 |
CleanupStack::PopAndDestroy(&socket);
|
|
3076 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3077 |
|
|
3078 |
User::After(2000000); // wait for socket to close before reopening
|
|
3079 |
}
|
|
3080 |
|
|
3081 |
void CSmsInterTestStep::TestSendAndReceiveConcatenatedMsgsL( const RPointerArray<CSmsPduDbMessage>& aArray,
|
|
3082 |
const CArrayFixFlat<TInt>* aAlphabetArray )
|
|
3083 |
/**
|
|
3084 |
* Test transmition and reception of a concatenated SMS message spanning 3 TPDUs
|
|
3085 |
*/
|
|
3086 |
{
|
|
3087 |
INFO_PRINTF1(_L("Test Tx and Rx SMS with different alphabet types "));
|
|
3088 |
|
|
3089 |
RSocketServ socketServer;
|
|
3090 |
Connect2EsockLC(socketServer);
|
|
3091 |
RSocket socket;
|
|
3092 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
3093 |
|
|
3094 |
for ( TInt i = 0; i < aAlphabetArray->Count(); i++ )
|
|
3095 |
{
|
|
3096 |
|
|
3097 |
TSmsDataCodingScheme::TSmsAlphabet alphabet = ( TSmsDataCodingScheme::TSmsAlphabet )aAlphabetArray->At(i);
|
|
3098 |
|
|
3099 |
TInt bufLen=aArray[i]->iSmsMessage->Buffer().Length();
|
|
3100 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
3101 |
CleanupStack::PushL(textBuf);
|
|
3102 |
TPtr testText(textBuf->Des());
|
|
3103 |
aArray[i]->iSmsMessage->Buffer().Extract(testText,0,bufLen);
|
|
3104 |
|
|
3105 |
CSmsMessage* smsMessage;
|
|
3106 |
if ( i == 0 )
|
|
3107 |
smsMessage=CreateSmsWithStatusReportReqL(testText,alphabet);
|
|
3108 |
else
|
|
3109 |
smsMessage=CreateSmsMessageL(testText,alphabet);
|
|
3110 |
|
|
3111 |
CleanupStack::PushL(smsMessage);
|
|
3112 |
SendSmsL(smsMessage,socket);
|
|
3113 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
3114 |
|
|
3115 |
WaitForRecvL(socket);
|
|
3116 |
smsMessage = RecvSmsL(socket);
|
|
3117 |
CleanupStack::PushL(smsMessage);
|
|
3118 |
|
|
3119 |
TestSmsContentsL(smsMessage,testText);
|
|
3120 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
3121 |
|
|
3122 |
CleanupStack::PopAndDestroy(textBuf);
|
|
3123 |
}
|
|
3124 |
|
|
3125 |
CleanupStack::PopAndDestroy(&socket);
|
|
3126 |
//closing is too fast when using EKA2
|
|
3127 |
User::After(2000000);
|
|
3128 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3129 |
User::After(2000000); // wait for socket to close before reopening
|
|
3130 |
}
|
|
3131 |
|
|
3132 |
void CSmsInterTestStep::TestStringMatchingIncomingMsgL()
|
|
3133 |
/**
|
|
3134 |
* @test Test string matching incoming Sms
|
|
3135 |
*/
|
|
3136 |
{
|
|
3137 |
INFO_PRINTF1(_L("Test string matching of incoming Sms Messages"));
|
|
3138 |
|
|
3139 |
//Once all the tests are fixed try uncommenting this and run the test
|
|
3140 |
|
|
3141 |
/*TTestCase tests[] =
|
|
3142 |
{
|
|
3143 |
TTestCase( _L("Message String"), _L("Message String")),
|
|
3144 |
TTestCase( _L("AABB: TestMessage1"), _L("AABB:") ),
|
|
3145 |
TTestCase( _L("AAB: Another test"), _L("AAB:") ),
|
|
3146 |
TTestCase( _L("xyqwerty") ), // Recv any
|
|
3147 |
TTestCase( _L("xyzuiop"), _L("xyz") ),
|
|
3148 |
TTestCase( _L("AAA abcdefg"), _L("aa") ),
|
|
3149 |
TTestCase( _L("Voicemail Indication"), TSmsDataCodingScheme::ESmsVoicemailMessageWaiting,
|
|
3150 |
TSmsDataCodingScheme::ESmsDCSMessageWaitingIndication7Bit,
|
|
3151 |
TSmsDataCodingScheme::ESmsIndicationActive)
|
|
3152 |
};*/
|
|
3153 |
|
|
3154 |
TTestCase tests[] =
|
|
3155 |
{
|
|
3156 |
TTestCase( _L("Message String"), _L("Message String")),
|
|
3157 |
TTestCase( _L("AABB: TestMessage1"), _L("AABB:") ),
|
|
3158 |
TTestCase( _L("AAB: Another test"), _L("AAB:") ),
|
|
3159 |
TTestCase( _L("xyzuiop"), _L("xyz") ),
|
|
3160 |
TTestCase( _L("AAA abcdefg"), _L("aa") ),
|
|
3161 |
|
|
3162 |
};
|
|
3163 |
RSocketServ socketServer;
|
|
3164 |
Connect2EsockLC(socketServer);
|
|
3165 |
|
|
3166 |
RSocket socket;
|
|
3167 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrSendOnly);
|
|
3168 |
|
|
3169 |
const TInt numTests = sizeof(tests)/sizeof(TTestCase);
|
|
3170 |
CActiveReceiver* msgReceiver = CActiveReceiver::NewL(socketServer, iFs);
|
|
3171 |
CleanupStack::PushL(msgReceiver);
|
|
3172 |
|
|
3173 |
msgReceiver->StopIfKeyPressedL();
|
|
3174 |
for (TInt i=0; i<numTests; i++)
|
|
3175 |
msgReceiver->AddTestL(tests[i]);
|
|
3176 |
for (TInt j=0; j<numTests; j++)
|
|
3177 |
{
|
|
3178 |
SendTestMessageL(tests[j],socket);
|
|
3179 |
User::After(30000000);
|
|
3180 |
}
|
|
3181 |
msgReceiver->StartTestsL();
|
|
3182 |
CleanupStack::PopAndDestroy();
|
|
3183 |
|
|
3184 |
CleanupStack::PopAndDestroy(&socket);
|
|
3185 |
//closing is too fast when using EKA2
|
|
3186 |
User::After(2000000);
|
|
3187 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3188 |
User::After(2000000); // wait for socket to close before reopening
|
|
3189 |
}
|
|
3190 |
|
|
3191 |
void CSmsInterTestStep::TestSendAndReceiveDifferentIEIsL( const RPointerArray<CSmsPduDbMessage>& aArray,
|
|
3192 |
const CArrayFixFlat<TInt>* aAlphabetArray,
|
|
3193 |
const CArrayFixFlat<TInt>* aInformationElementArray,
|
|
3194 |
const CArrayFixFlat<TInt>* aIeiDataArray )
|
|
3195 |
/**
|
|
3196 |
* @test Send and receive messages of different IEIs
|
|
3197 |
* TODO - 6210 doesn't route incoming ESmsIEIApplicationPortAddressing8Bit and
|
|
3198 |
* ESmsIEIApplicationPortAddressing16Bit messages to the MMTSY.
|
|
3199 |
*/
|
|
3200 |
{
|
|
3201 |
INFO_PRINTF1(_L("Send and receive messages with different IEIs"));
|
|
3202 |
|
|
3203 |
RSocketServ socketServer;
|
|
3204 |
Connect2EsockLC(socketServer);
|
|
3205 |
RSocket socket;
|
|
3206 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
3207 |
|
|
3208 |
for ( TInt i = 0; i < aArray.Count(); i++ )
|
|
3209 |
{
|
|
3210 |
|
|
3211 |
TSmsDataCodingScheme::TSmsAlphabet alphabet = ( TSmsDataCodingScheme::TSmsAlphabet )aAlphabetArray->At(i);
|
|
3212 |
CSmsInformationElement::TSmsInformationElementIdentifier iei = ( CSmsInformationElement::TSmsInformationElementIdentifier )aInformationElementArray->At(i);
|
|
3213 |
|
|
3214 |
TBuf8<20> ieiData;
|
|
3215 |
TInt testCaseNum(0), count(0);
|
|
3216 |
while ( testCaseNum < i )
|
|
3217 |
if ( aIeiDataArray->At(count++) == KErrNotFound )
|
|
3218 |
testCaseNum++;
|
|
3219 |
|
|
3220 |
while ( aIeiDataArray->At(count) != KErrNotFound )
|
|
3221 |
ieiData.Append(aIeiDataArray->At(count++));
|
|
3222 |
|
|
3223 |
TInt bufLen=aArray[i]->iSmsMessage->Buffer().Length();
|
|
3224 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
3225 |
CleanupStack::PushL(textBuf);
|
|
3226 |
TPtr testText(textBuf->Des());
|
|
3227 |
aArray[i]->iSmsMessage->Buffer().Extract(testText,0,bufLen);
|
|
3228 |
|
|
3229 |
SendAndRecvAndCompareMessageIEIL( testText, ieiData, socket, alphabet, iei );
|
|
3230 |
|
|
3231 |
CleanupStack::PopAndDestroy(textBuf);
|
|
3232 |
}
|
|
3233 |
|
|
3234 |
CleanupStack::PopAndDestroy(&socket);
|
|
3235 |
//closing is too fast when using EKA2
|
|
3236 |
User::After(2000000);
|
|
3237 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3238 |
User::After(2000000); // wait for socket to close before reopening
|
|
3239 |
}
|
|
3240 |
|
|
3241 |
void CSmsInterTestStep::TestSendAndReceiveBinaryDataL( const CArrayFixFlat<TInt>* aMessageLengthArray )
|
|
3242 |
/**
|
|
3243 |
* @test Send and Recieve binary data (+ UDH information)
|
|
3244 |
* TODO These tests doesn't work with 6210. It is possible to send message, but
|
|
3245 |
* phone won't route incoming message to the MMTSY.
|
|
3246 |
*/
|
|
3247 |
{
|
|
3248 |
INFO_PRINTF1(_L("Send and Receive binary data"));
|
|
3249 |
|
|
3250 |
RSocketServ socketServer;
|
|
3251 |
Connect2EsockLC(socketServer);
|
|
3252 |
RSocket socket;
|
|
3253 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
3254 |
|
|
3255 |
for ( TInt i = 0; i < aMessageLengthArray->Count(); i++ )
|
|
3256 |
{
|
|
3257 |
|
|
3258 |
TInt messageLength = aMessageLengthArray->At(i);
|
|
3259 |
INFO_PRINTF2(_L("Sending %d byte message"),messageLength);
|
|
3260 |
SendAndRecvSmsBinaryL(messageLength,socket);
|
|
3261 |
|
|
3262 |
}
|
|
3263 |
|
|
3264 |
CleanupStack::PopAndDestroy(&socket);
|
|
3265 |
//closing is too fast when using EKA2
|
|
3266 |
User::After(2000000);
|
|
3267 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3268 |
User::After(2000000); // wait for socket to close before reopening
|
|
3269 |
}
|
|
3270 |
|
|
3271 |
void CSmsInterTestStep::TestOOML()
|
|
3272 |
/**
|
|
3273 |
* Low memory testing
|
|
3274 |
*/
|
|
3275 |
{
|
|
3276 |
#if defined(_DEBUG)
|
|
3277 |
INFO_PRINTF1(_L("Low memory tests"));
|
|
3278 |
|
|
3279 |
RSocketServ debugSocketServer;
|
|
3280 |
TInt ret=debugSocketServer.Connect(KSocketMessageSlots);
|
|
3281 |
TEST(ret==KErrNone);
|
|
3282 |
CleanupClosePushL(debugSocketServer);
|
|
3283 |
|
|
3284 |
debugSocketServer.__DbgMarkHeap();
|
|
3285 |
|
|
3286 |
|
|
3287 |
RSocketServ socketServer;
|
|
3288 |
Connect2EsockLC(socketServer);
|
|
3289 |
|
|
3290 |
RSocket socket;
|
|
3291 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
3292 |
|
|
3293 |
TInt count=0;
|
|
3294 |
ret=KErrNoMemory;
|
|
3295 |
while (ret==KErrNoMemory || count < 7)
|
|
3296 |
{
|
|
3297 |
INFO_PRINTF2(_L("Creating message ... No. of allocations = %d"),count);
|
|
3298 |
debugSocketServer.__DbgFailNext(count);
|
|
3299 |
CSmsMessage* sms=NULL;
|
|
3300 |
TRAP(ret,sms=CreateSmsMessageL(_L("Test message"),TSmsDataCodingScheme::ESmsAlphabet7Bit));
|
|
3301 |
delete sms;
|
|
3302 |
count++;
|
|
3303 |
}
|
|
3304 |
|
|
3305 |
INFO_PRINTF1(_L(""));
|
|
3306 |
debugSocketServer.__DbgFailNext(-1); // Reset heap
|
|
3307 |
|
|
3308 |
|
|
3309 |
count=0;
|
|
3310 |
ret=KErrNoMemory;
|
|
3311 |
while (ret==KErrNoMemory || count < 7)
|
|
3312 |
{
|
|
3313 |
INFO_PRINTF2(_L("Creating message ... No. of allocations = %d"),count);
|
|
3314 |
debugSocketServer.__DbgFailNext(count);
|
|
3315 |
TRAP(ret,SendAndRecvSms7BitL(_L("x"),socket););
|
|
3316 |
count++;
|
|
3317 |
}
|
|
3318 |
|
|
3319 |
INFO_PRINTF1(_L(""));
|
|
3320 |
debugSocketServer.__DbgFailNext(-1); // Reset heap
|
|
3321 |
|
|
3322 |
CleanupStack::PopAndDestroy(&socket);
|
|
3323 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3324 |
User::After(2000000); // wait for socket to close
|
|
3325 |
|
|
3326 |
debugSocketServer.__DbgMarkEnd(0);
|
|
3327 |
|
|
3328 |
CleanupStack::PopAndDestroy(1); //debugSocketServer
|
|
3329 |
|
|
3330 |
|
|
3331 |
#else
|
|
3332 |
INFO_PRINTF1(_L("No low memory tests in release builds"));
|
|
3333 |
#endif
|
|
3334 |
}
|
|
3335 |
|
|
3336 |
void CSmsInterTestStep::TestSmsWapEmailNotificationL(void)
|
|
3337 |
/**
|
|
3338 |
* @test Test Email notification according to Smart Messaging
|
|
3339 |
* spec 2.0.0
|
|
3340 |
*/
|
|
3341 |
{
|
|
3342 |
_LIT(KEmailNot, "//SCKL1588\n42");
|
|
3343 |
|
|
3344 |
INFO_PRINTF1(_L("test Email Notification"));
|
|
3345 |
|
|
3346 |
RSocketServ socketServer;
|
|
3347 |
Connect2EsockLC(socketServer);
|
|
3348 |
RSocket socket;
|
|
3349 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
3350 |
|
|
3351 |
//
|
|
3352 |
// Tx
|
|
3353 |
//
|
|
3354 |
INFO_PRINTF1(_L("sending Email Notification "));
|
|
3355 |
CSmsMessage* smsMessage=CreateSmsMessageL(KEmailNot, TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
3356 |
CleanupStack::PushL(smsMessage);
|
|
3357 |
SendSmsL(smsMessage,socket);
|
|
3358 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
3359 |
|
|
3360 |
//
|
|
3361 |
// Rx
|
|
3362 |
//
|
|
3363 |
INFO_PRINTF1(_L("waiting for incoming WAP SMS"));
|
|
3364 |
WaitForRecvL(socket);
|
|
3365 |
smsMessage = RecvSmsL(socket);
|
|
3366 |
CleanupStack::PushL(smsMessage);
|
|
3367 |
CSmsBuffer& smsbuffer = (CSmsBuffer&)smsMessage->Buffer();
|
|
3368 |
TInt len = smsbuffer.Length();
|
|
3369 |
HBufC* hbuf = HBufC::NewL(len);
|
|
3370 |
TPtr ptr = hbuf->Des();
|
|
3371 |
smsbuffer.Extract(ptr,0,len);
|
|
3372 |
INFO_PRINTF2(_L("SMS contains %S"),&ptr);
|
|
3373 |
delete hbuf;
|
|
3374 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
3375 |
|
|
3376 |
//
|
|
3377 |
// cleanup
|
|
3378 |
//
|
|
3379 |
CleanupStack::PopAndDestroy(&socket);
|
|
3380 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3381 |
User::After(2000000); // wait for socket to close before reopening
|
|
3382 |
INFO_PRINTF1(_L("Done"));
|
|
3383 |
}
|
|
3384 |
|
|
3385 |
void CSmsInterTestStep::TestSendAndReceive159bytesMsgL()
|
|
3386 |
/**
|
|
3387 |
* @test Send and Receive 7-bit SMS message with 159 characters
|
|
3388 |
*/
|
|
3389 |
{
|
|
3390 |
INFO_PRINTF1(_L("Sending 159 byte message"));
|
|
3391 |
|
|
3392 |
RSocketServ socketServer;
|
|
3393 |
Connect2EsockLC(socketServer);
|
|
3394 |
RSocket socket;
|
|
3395 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
3396 |
|
|
3397 |
SendAndRecvSms7BitL(159,socket);
|
|
3398 |
CleanupStack::PopAndDestroy(&socket);
|
|
3399 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3400 |
User::After(2000000); // wait for socket to close before reopening
|
|
3401 |
}
|
|
3402 |
|
|
3403 |
void CSmsInterTestStep::TestSendAndReceive1byteMsgL()
|
|
3404 |
/**
|
|
3405 |
* @test Send and Receive 7-bit SMS message with 1 characters
|
|
3406 |
* TODO this is only a placeholder at the moment to
|
|
3407 |
* keep the numbering of the test cases because
|
|
3408 |
* SendSMS2Port0000L has been moved to the manual test code
|
|
3409 |
* This method can be removed later
|
|
3410 |
*/
|
|
3411 |
{
|
|
3412 |
INFO_PRINTF1(_L("Sending 1 byte message"));
|
|
3413 |
|
|
3414 |
RSocketServ socketServer;
|
|
3415 |
Connect2EsockLC(socketServer);
|
|
3416 |
RSocket socket;
|
|
3417 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
3418 |
|
|
3419 |
SendAndRecvSms7BitL(1,socket);
|
|
3420 |
CleanupStack::PopAndDestroy(&socket);
|
|
3421 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3422 |
User::After(2000000); // wait for socket to close before reopening
|
|
3423 |
}
|
|
3424 |
|
|
3425 |
void CSmsInterTestStep::TestSocketConnectTwiceL()
|
|
3426 |
/**
|
|
3427 |
* @test connecting to the sockets server twice
|
|
3428 |
*
|
|
3429 |
* added after problems reported with NBS watchers and Esock's
|
|
3430 |
* RSocketServ::Connect hanging the second time.
|
|
3431 |
*/
|
|
3432 |
{
|
|
3433 |
INFO_PRINTF1(_L("connecting to the sockets server twice") );
|
|
3434 |
|
|
3435 |
RSocketServ socketServer;
|
|
3436 |
Connect2EsockLC(socketServer);
|
|
3437 |
|
|
3438 |
TInt ret;
|
|
3439 |
INFO_PRINTF1(_L("socket 1...") );
|
|
3440 |
RSocketServ serv1;
|
|
3441 |
ret = serv1.Connect();
|
|
3442 |
TEST(ret==KErrNone);
|
|
3443 |
RSocket socket1;
|
|
3444 |
ret = socket1.Open(serv1, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
3445 |
TEST(ret==KErrNone);
|
|
3446 |
TSmsAddr smsaddr;
|
|
3447 |
smsaddr.SetSmsAddrFamily(ESmsAddrRecvAny);
|
|
3448 |
ret = socket1.Bind(smsaddr);
|
|
3449 |
TEST(ret==KErrNone);
|
|
3450 |
socket1.Close();
|
|
3451 |
serv1.Close();
|
|
3452 |
INFO_PRINTF1(_L("Done") );
|
|
3453 |
|
|
3454 |
INFO_PRINTF1(_L("socket 2...") );
|
|
3455 |
RSocketServ serv2;
|
|
3456 |
ret = serv2.Connect();
|
|
3457 |
TEST(ret==KErrNone);
|
|
3458 |
RSocket socket2;
|
|
3459 |
ret = socket2.Open(serv2, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
3460 |
TEST(ret==KErrNone);
|
|
3461 |
smsaddr.SetSmsAddrFamily(ESmsAddrRecvAny);
|
|
3462 |
ret = socket2.Bind(smsaddr);
|
|
3463 |
TEST(ret==KErrNone);
|
|
3464 |
socket2.Close();
|
|
3465 |
serv2.Close();
|
|
3466 |
INFO_PRINTF1(_L("Done") );
|
|
3467 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3468 |
User::After(2000000); // wait for socket to close before reopening
|
|
3469 |
}
|
|
3470 |
|
|
3471 |
void CSmsInterTestStep::TestSocketBindingL()
|
|
3472 |
/**
|
|
3473 |
* Test opening and binding the socket to different SMS Address types
|
|
3474 |
*/
|
|
3475 |
{
|
|
3476 |
INFO_PRINTF1(_L("Test Open & Bind the Socket"));
|
|
3477 |
|
|
3478 |
RSocketServ socketServer;
|
|
3479 |
Connect2EsockLC(socketServer);
|
|
3480 |
|
|
3481 |
RSocket socket1;
|
|
3482 |
RSocket socket2;
|
|
3483 |
TInt ret1=socket1.Open(socketServer,KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol);
|
|
3484 |
TEST(ret1 == KErrNone);
|
|
3485 |
CleanupClosePushL(socket1);
|
|
3486 |
TSmsAddr smsaddr1;
|
|
3487 |
|
|
3488 |
TInt ret2=socket2.Open(socketServer,KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol);
|
|
3489 |
TEST(ret2 == KErrNone);
|
|
3490 |
CleanupClosePushL(socket2);
|
|
3491 |
TSmsAddr smsaddr2;
|
|
3492 |
|
|
3493 |
//ESmsAddrUnbound
|
|
3494 |
smsaddr1.SetSmsAddrFamily(ESmsAddrUnbound);
|
|
3495 |
ret1=socket1.Bind(smsaddr1);
|
|
3496 |
TEST(ret1 == KErrNone);
|
|
3497 |
|
|
3498 |
smsaddr2.SetSmsAddrFamily(ESmsAddrUnbound);
|
|
3499 |
ret2=socket2.Bind(smsaddr2);
|
|
3500 |
TEST(ret2 == KErrNone);
|
|
3501 |
|
|
3502 |
//ESmsAddrSendOnly
|
|
3503 |
smsaddr1.SetSmsAddrFamily(ESmsAddrSendOnly);
|
|
3504 |
ret1=socket1.Bind(smsaddr1);
|
|
3505 |
TEST(ret1 == KErrNone);
|
|
3506 |
|
|
3507 |
smsaddr2.SetSmsAddrFamily(ESmsAddrSendOnly);
|
|
3508 |
ret2=socket1.Bind(smsaddr2);
|
|
3509 |
TEST(ret2 == KErrNone);
|
|
3510 |
|
|
3511 |
//ESmsAddrMessageIndication
|
|
3512 |
smsaddr1.SetSmsAddrFamily(ESmsAddrMessageIndication);
|
|
3513 |
ret1=socket1.Bind(smsaddr1);
|
|
3514 |
TEST(ret1 == KErrNone);
|
|
3515 |
|
|
3516 |
// Only one client could bind to ESmsAddrMessageIndication at a time
|
|
3517 |
// This address type is returned with KErrAlreadyExists
|
|
3518 |
smsaddr2.SetSmsAddrFamily(ESmsAddrMessageIndication);
|
|
3519 |
ret2=socket2.Bind(smsaddr2);
|
|
3520 |
TEST(ret2==KErrAlreadyExists);
|
|
3521 |
|
|
3522 |
//ESmsAddrMatchIEI
|
|
3523 |
smsaddr1.SetSmsAddrFamily(ESmsAddrMatchIEI);
|
|
3524 |
smsaddr1.SetIdentifierMatch(CSmsInformationElement::ESmsIEIConcatenatedShortMessages8BitReference);
|
|
3525 |
ret1=socket1.Bind(smsaddr1);
|
|
3526 |
TEST(ret1 == KErrNone);
|
|
3527 |
|
|
3528 |
smsaddr2.SetSmsAddrFamily(ESmsAddrMatchIEI);
|
|
3529 |
smsaddr2.SetIdentifierMatch(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication);
|
|
3530 |
ret2=socket1.Bind(smsaddr2);
|
|
3531 |
TEST(ret2 == KErrNone);
|
|
3532 |
|
|
3533 |
//ESmsAddrMatchText
|
|
3534 |
smsaddr1.SetSmsAddrFamily(ESmsAddrMatchText);
|
|
3535 |
smsaddr1.SetTextMatch(_L8("test message, len"));
|
|
3536 |
ret1=socket1.Bind(smsaddr1);
|
|
3537 |
TEST(ret1 == KErrNone);
|
|
3538 |
|
|
3539 |
smsaddr2.SetSmsAddrFamily(ESmsAddrMatchText);
|
|
3540 |
smsaddr2.SetTextMatch(_L8("test message,"));
|
|
3541 |
ret2=socket1.Bind(smsaddr2);
|
|
3542 |
TEST(ret2 == KErrNone);
|
|
3543 |
|
|
3544 |
//ESmsAddrRecvAny
|
|
3545 |
smsaddr1.SetSmsAddrFamily(ESmsAddrRecvAny);
|
|
3546 |
ret1=socket1.Bind(smsaddr1);
|
|
3547 |
TEST(ret1 == KErrNone);
|
|
3548 |
|
|
3549 |
// Only one client could bind to ESmsAddrRecvAny at a time
|
|
3550 |
// This address type is returned with KErrAlreadyExists
|
|
3551 |
smsaddr2.SetSmsAddrFamily(ESmsAddrRecvAny);
|
|
3552 |
ret2=socket2.Bind(smsaddr2);
|
|
3553 |
TEST(ret2==KErrAlreadyExists);
|
|
3554 |
|
|
3555 |
//ESmsAddrStatusReport
|
|
3556 |
smsaddr1.SetSmsAddrFamily(ESmsAddrStatusReport);
|
|
3557 |
ret1=socket1.Bind(smsaddr1);
|
|
3558 |
TEST(ret1 == KErrNone);
|
|
3559 |
|
|
3560 |
// Only one client could bind to ESmsAddrStatusReport at a time
|
|
3561 |
// This address type is returned with KErrAlreadyExists
|
|
3562 |
smsaddr2.SetSmsAddrFamily(ESmsAddrStatusReport);
|
|
3563 |
ret2=socket2.Bind(smsaddr2);
|
|
3564 |
TEST(ret2 == KErrAlreadyExists);
|
|
3565 |
|
|
3566 |
//ESmsAddrLocalOperation
|
|
3567 |
smsaddr1.SetSmsAddrFamily(ESmsAddrLocalOperation);
|
|
3568 |
ret1=socket1.Bind(smsaddr1);
|
|
3569 |
TEST(ret1 == KErrNone);
|
|
3570 |
|
|
3571 |
smsaddr2.SetSmsAddrFamily(ESmsAddrLocalOperation);
|
|
3572 |
ret2=socket2.Bind(smsaddr2);
|
|
3573 |
TEST(ret2 == KErrNone);
|
|
3574 |
|
|
3575 |
CleanupStack::PopAndDestroy(&socket2);
|
|
3576 |
CleanupStack::PopAndDestroy(&socket1);
|
|
3577 |
|
|
3578 |
INFO_PRINTF1(_L("All bindings ok!"));
|
|
3579 |
|
|
3580 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3581 |
User::After(2000000); // wait for socket to close before reopening
|
|
3582 |
}
|
|
3583 |
|
|
3584 |
void CSmsInterTestStep::TestEnumerateAndReceiveMessagesL()
|
|
3585 |
/**
|
|
3586 |
* @test Enumerate and receive the messages
|
|
3587 |
*/
|
|
3588 |
{
|
|
3589 |
INFO_PRINTF1(_L("Enumeration"));
|
|
3590 |
INFO_PRINTF1(_L("Place SIM in phone that has one SMS message present"));
|
|
3591 |
|
|
3592 |
RSocketServ socketServer;
|
|
3593 |
Connect2EsockLC(socketServer);
|
|
3594 |
|
|
3595 |
RSocket socket;
|
|
3596 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
3597 |
|
|
3598 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
3599 |
TPckgBuf<TUint> sbuf;
|
|
3600 |
TRequestStatus status;
|
|
3601 |
socket.Ioctl(KIoctlEnumerateSmsMessages,status,&sbuf, KSolSmsProv);
|
|
3602 |
User::WaitForRequest(status);
|
|
3603 |
TEST(status.Int() == KErrNone);
|
|
3604 |
TInt count=sbuf();
|
|
3605 |
INFO_PRINTF2(_L("Enumerated %d messages"),count);
|
|
3606 |
|
|
3607 |
CSmsMessage* smsMessage = CreateSmsMessageL(_L(""),TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
3608 |
CleanupStack::PushL(smsMessage);
|
|
3609 |
|
|
3610 |
RSmsSocketReadStream readstream(socket);
|
|
3611 |
TPtr ptr(NULL,0);
|
|
3612 |
for (TInt i=0; i<count; i++)
|
|
3613 |
{
|
|
3614 |
TRAPD(ret,readstream >> *smsMessage);
|
|
3615 |
TEST(ret==KErrNone);
|
|
3616 |
socket.Ioctl(KIoctlReadMessageSucceeded,status,NULL, KSolSmsProv);
|
|
3617 |
User::WaitForRequest(status);
|
|
3618 |
TEST(status.Int() == KErrNone);
|
|
3619 |
|
|
3620 |
|
|
3621 |
INFO_PRINTF1(smsMessage->ToFromAddress());
|
|
3622 |
INFO_PRINTF1(_L(" "));
|
|
3623 |
INFO_PRINTF1(smsMessage->ServiceCenterAddress());
|
|
3624 |
INFO_PRINTF1(_L(""));
|
|
3625 |
|
|
3626 |
CSmsBufferBase& buffer = smsMessage->Buffer();
|
|
3627 |
TInt length=buffer.Length();
|
|
3628 |
HBufC* buf=HBufC::New(length);
|
|
3629 |
TEST(buf != KErrNone);
|
|
3630 |
ptr.Set((TText*) buf->Des().Ptr(),length,length);
|
|
3631 |
buffer.Extract(ptr,0,length);
|
|
3632 |
TPtrC displayBuf(ptr.Mid(0,(length>80? 80: length)));
|
|
3633 |
INFO_PRINTF2(_L("%S"),&displayBuf);
|
|
3634 |
delete buf;
|
|
3635 |
}
|
|
3636 |
|
|
3637 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
3638 |
CleanupStack::PopAndDestroy(&socket);
|
|
3639 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3640 |
User::After(2000000); // wait for socket to close before reopening
|
|
3641 |
}
|
|
3642 |
|
|
3643 |
void CSmsInterTestStep::TestEnumerateAndDeleteMessagesL()
|
|
3644 |
/**
|
|
3645 |
* @test Enumerate and delete all messages
|
|
3646 |
*/
|
|
3647 |
{
|
|
3648 |
INFO_PRINTF1(_L("Enumerate and delete messages"));
|
|
3649 |
INFO_PRINTF1(_L("Enumeration"));
|
|
3650 |
|
|
3651 |
RSocketServ socketServer;
|
|
3652 |
Connect2EsockLC(socketServer);
|
|
3653 |
|
|
3654 |
RSocket socket;
|
|
3655 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
3656 |
|
|
3657 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
3658 |
TPckgBuf<TUint> sbuf;
|
|
3659 |
TRequestStatus status;
|
|
3660 |
socket.Ioctl(KIoctlEnumerateSmsMessages,status,&sbuf, KSolSmsProv);
|
|
3661 |
User::WaitForRequest(status);
|
|
3662 |
TEST(status.Int() == KErrNone);
|
|
3663 |
TInt count=sbuf();
|
|
3664 |
INFO_PRINTF2(_L("Enumerated %d messages"),count);
|
|
3665 |
|
|
3666 |
CSmsMessage* smsMessage = CreateSmsMessageL(_L(""),TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
3667 |
CleanupStack::PushL(smsMessage);
|
|
3668 |
|
|
3669 |
RSmsSocketReadStream readstream(socket);
|
|
3670 |
TPtr ptr(NULL,0);
|
|
3671 |
for (TInt i=0; i<count; i++)
|
|
3672 |
{
|
|
3673 |
TRAPD(ret,readstream >> *smsMessage);
|
|
3674 |
TEST(ret==KErrNone);
|
|
3675 |
socket.Ioctl(KIoctlReadMessageSucceeded,status,NULL, KSolSmsProv);
|
|
3676 |
User::WaitForRequest(status);
|
|
3677 |
TEST(status.Int() == KErrNone);
|
|
3678 |
|
|
3679 |
|
|
3680 |
INFO_PRINTF1(smsMessage->ToFromAddress());
|
|
3681 |
INFO_PRINTF1(_L(" "));
|
|
3682 |
INFO_PRINTF1(smsMessage->ServiceCenterAddress());
|
|
3683 |
INFO_PRINTF1(_L(""));
|
|
3684 |
|
|
3685 |
CSmsBufferBase& buffer = smsMessage->Buffer();
|
|
3686 |
TInt length=buffer.Length();
|
|
3687 |
HBufC* buf=HBufC::New(length);
|
|
3688 |
TEST(buf != KErrNone);
|
|
3689 |
ptr.Set((TText*) buf->Des().Ptr(),length,length);
|
|
3690 |
buffer.Extract(ptr,0,length);
|
|
3691 |
TPtrC displayBuf(ptr.Mid(0,(length>70? 70: length)));
|
|
3692 |
INFO_PRINTF2(_L("%S"),&displayBuf);
|
|
3693 |
|
|
3694 |
INFO_PRINTF1(_L("Deleting message ..."));
|
|
3695 |
RSmsSocketWriteStream writestream(socket);
|
|
3696 |
writestream << *smsMessage;
|
|
3697 |
writestream.CommitL();
|
|
3698 |
socket.Ioctl(KIoctlDeleteSmsMessage,status,NULL, KSolSmsProv);
|
|
3699 |
User::WaitForRequest(status);
|
|
3700 |
TEST(status.Int() == KErrNone);
|
|
3701 |
|
|
3702 |
delete buf;
|
|
3703 |
}
|
|
3704 |
|
|
3705 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
3706 |
CleanupStack::PopAndDestroy(&socket);
|
|
3707 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3708 |
User::After(2000000); // wait for socket to close before reopening
|
|
3709 |
}
|
|
3710 |
|
|
3711 |
void CSmsInterTestStep::TestEnumerateAndWriteAndDeleteMessagesL( const RPointerArray<CSmsPduDbMessage>& aArray )
|
|
3712 |
/**
|
|
3713 |
* @test Switch on the phone with a SIM.
|
|
3714 |
* Enumerate, delete (first message if exist and last message after writing),
|
|
3715 |
* write (two messages to the sim)
|
|
3716 |
*/
|
|
3717 |
{
|
|
3718 |
RSocketServ socketServer;
|
|
3719 |
Connect2EsockLC(socketServer);
|
|
3720 |
|
|
3721 |
// Open the socket for SIM operations
|
|
3722 |
RSocket socket;
|
|
3723 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation);
|
|
3724 |
|
|
3725 |
TInt ret = 0;
|
|
3726 |
CSmsMessage* smsmessage;
|
|
3727 |
|
|
3728 |
// Enumerate messages
|
|
3729 |
INFO_PRINTF1(_L("Enumeration"));
|
|
3730 |
RPointerArray<CSmsMessage> messages;
|
|
3731 |
CleanupResetAndDestroyPushL(messages);
|
|
3732 |
ReadSmsStoreL(socket, messages);
|
|
3733 |
TInt count = messages.Count();
|
|
3734 |
TInt index = 0;
|
|
3735 |
|
|
3736 |
// Delete messages
|
|
3737 |
INFO_PRINTF1(_L("Delete messages"));
|
|
3738 |
while ( index < count )
|
|
3739 |
{
|
|
3740 |
smsmessage = messages[index++];
|
|
3741 |
|
|
3742 |
INFO_PRINTF2(_L("Delete %d. message from the store "), index );
|
|
3743 |
ret = DeleteSmsL(*smsmessage, socket);
|
|
3744 |
TEST( !( ret == KErrNone ) );
|
|
3745 |
|
|
3746 |
}
|
|
3747 |
messages.ResetAndDestroy();
|
|
3748 |
|
|
3749 |
// Create and store messages
|
|
3750 |
INFO_PRINTF1(_L("store messages"));
|
|
3751 |
count = aArray.Count();
|
|
3752 |
index = 0;
|
|
3753 |
while ( index < count )
|
|
3754 |
{
|
|
3755 |
INFO_PRINTF2(_L("Write %d. message"),index+1);
|
|
3756 |
CSmsMessage* smsMessage = CreateAndSetMessageL( aArray, index++ );
|
|
3757 |
CleanupStack::PushL(smsMessage);
|
|
3758 |
WriteSmsToSimL(*smsMessage, socket);
|
|
3759 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
3760 |
}
|
|
3761 |
|
|
3762 |
// Enumerate messages
|
|
3763 |
INFO_PRINTF1(_L("Enumeration"));
|
|
3764 |
ReadSmsStoreL(socket, messages);
|
|
3765 |
count = messages.Count();
|
|
3766 |
index = 0;
|
|
3767 |
|
|
3768 |
// Delete messages
|
|
3769 |
INFO_PRINTF1(_L("Delete messages"));
|
|
3770 |
while ( index < count )
|
|
3771 |
{
|
|
3772 |
smsmessage = messages[index++];
|
|
3773 |
INFO_PRINTF2(_L("Delete %d. message from the store"), index );
|
|
3774 |
ret = DeleteSmsL(*smsmessage, socket);
|
|
3775 |
TEST( ( ret == KErrNone ) );
|
|
3776 |
}
|
|
3777 |
|
|
3778 |
CleanupStack::PopAndDestroy(&messages);
|
|
3779 |
CleanupStack::PopAndDestroy(&socket);
|
|
3780 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
3781 |
User::After(2000000); // wait for socket to close before reopening
|
|
3782 |
}
|
|
3783 |
|
|
3784 |
TInt CSmsInterTestStep::TestParametersL(CMobilePhoneSmspList& aLeft,CMobilePhoneSmspList& aRight)
|
|
3785 |
/**
|
|
3786 |
* Compare sms parameters taken from chunk to parameters retrieved from SIM
|
|
3787 |
* @param aLeft sms parameters taken from the Dummychunk
|
|
3788 |
* @param aRight sms parameters retrieved from the SIM
|
|
3789 |
* @return TInt : The error code
|
|
3790 |
*/
|
|
3791 |
{
|
|
3792 |
TInt ret(KErrNone);
|
|
3793 |
|
|
3794 |
if(aLeft.Enumerate() == aRight.Enumerate())
|
|
3795 |
{
|
|
3796 |
for(TInt storeIndex=0; storeIndex<aLeft.Enumerate(); storeIndex++)
|
|
3797 |
{
|
|
3798 |
const RMobileSmsMessaging::TMobileSmspEntryV1& leftEntry=aLeft.GetEntryL(storeIndex);
|
|
3799 |
TBool found=EFalse;
|
|
3800 |
|
|
3801 |
for(TInt writeIndex=0; writeIndex<aRight.Enumerate(); writeIndex++)
|
|
3802 |
{
|
|
3803 |
const RMobileSmsMessaging::TMobileSmspEntryV1& rigthEntry=aRight.GetEntryL(writeIndex);
|
|
3804 |
if(leftEntry.iIndex == rigthEntry.iIndex)
|
|
3805 |
{
|
|
3806 |
found=ETrue;
|
|
3807 |
if((leftEntry.iValidParams != rigthEntry.iValidParams) ||
|
|
3808 |
(leftEntry.iText != rigthEntry.iText))
|
|
3809 |
{
|
|
3810 |
ret = KErrCorrupt;
|
|
3811 |
break;
|
|
3812 |
}
|
|
3813 |
if(leftEntry.iValidParams & RMobileSmsMessaging::KDestinationIncluded)
|
|
3814 |
{
|
|
3815 |
ret = TestPhoneNumbers(leftEntry.iDestination,rigthEntry.iDestination);
|
|
3816 |
if(ret)
|
|
3817 |
break;
|
|
3818 |
}
|
|
3819 |
if(leftEntry.iValidParams & RMobileSmsMessaging::KSCAIncluded)
|
|
3820 |
{
|
|
3821 |
ret = TestPhoneNumbers(leftEntry.iServiceCentre,rigthEntry.iServiceCentre);
|
|
3822 |
if(ret)
|
|
3823 |
break;
|
|
3824 |
}
|
|
3825 |
if((leftEntry.iValidParams & RMobileSmsMessaging::KProtocolIdIncluded) &&
|
|
3826 |
(leftEntry.iProtocolId != rigthEntry.iProtocolId))
|
|
3827 |
ret = KErrCorrupt;
|
|
3828 |
if((leftEntry.iValidParams & RMobileSmsMessaging::KValidityPeriodIncluded) &&
|
|
3829 |
(leftEntry.iValidityPeriod != rigthEntry.iValidityPeriod))
|
|
3830 |
ret = KErrCorrupt;
|
|
3831 |
if((leftEntry.iValidParams & RMobileSmsMessaging::KDcsIncluded) &&
|
|
3832 |
(leftEntry.iDcs != rigthEntry.iDcs))
|
|
3833 |
ret = KErrCorrupt;
|
|
3834 |
break;
|
|
3835 |
}
|
|
3836 |
}
|
|
3837 |
|
|
3838 |
if(!found || ret != KErrNone)
|
|
3839 |
{
|
|
3840 |
ret = KErrCorrupt;
|
|
3841 |
break;
|
|
3842 |
}
|
|
3843 |
}
|
|
3844 |
}
|
|
3845 |
else
|
|
3846 |
{
|
|
3847 |
ret = KErrCorrupt;
|
|
3848 |
}
|
|
3849 |
|
|
3850 |
if(ret == KErrNone)
|
|
3851 |
{
|
|
3852 |
INFO_PRINTF1(_L("SMS Parameters Ok!") );
|
|
3853 |
}
|
|
3854 |
else
|
|
3855 |
{
|
|
3856 |
INFO_PRINTF2(_L("ERROR: SMSP lists doesn't match: %d"), ret );
|
|
3857 |
}
|
|
3858 |
|
|
3859 |
return ret;
|
|
3860 |
}
|
|
3861 |
|
|
3862 |
TInt CSmsInterTestStep::TestPhoneNumbers(const RMobilePhone::TMobileAddress& aLeftNumber,const RMobilePhone::TMobileAddress& aRightNumber)
|
|
3863 |
/**
|
|
3864 |
* Compare phone numbers
|
|
3865 |
* @param aLeftNumber reference to TMobileAddress object
|
|
3866 |
* @param aRightNumber reference to TMobileAddress object
|
|
3867 |
*/
|
|
3868 |
{
|
|
3869 |
TInt ret(KErrNone);
|
|
3870 |
TBuf<TGsmSmsTelNumberMaxLen> leftNumber;
|
|
3871 |
TBuf<TGsmSmsTelNumberMaxLen> rightNumber;
|
|
3872 |
|
|
3873 |
//Take '+' sign away first
|
|
3874 |
leftNumber.Copy(aLeftNumber.iTelNumber);
|
|
3875 |
if(leftNumber.Length() > 0 && leftNumber[0] == '+')
|
|
3876 |
{
|
|
3877 |
// Remove "+" sign from telephony number
|
|
3878 |
leftNumber.Delete(0,1);
|
|
3879 |
leftNumber.Trim();
|
|
3880 |
}
|
|
3881 |
//Take '+' sign away first
|
|
3882 |
rightNumber.Copy(aRightNumber.iTelNumber);
|
|
3883 |
if(rightNumber.Length() > 0 && rightNumber[0] == '+')
|
|
3884 |
{
|
|
3885 |
// Remove "+" sign from telephony number
|
|
3886 |
rightNumber.Delete(0,1);
|
|
3887 |
rightNumber.Trim();
|
|
3888 |
}
|
|
3889 |
if((leftNumber.Compare(rightNumber) != 0) ||
|
|
3890 |
(aLeftNumber.iTypeOfNumber != aRightNumber.iTypeOfNumber) ||
|
|
3891 |
(aLeftNumber.iNumberPlan != aRightNumber.iNumberPlan))
|
|
3892 |
{
|
|
3893 |
ret = KErrCorrupt;
|
|
3894 |
}
|
|
3895 |
return(ret);
|
|
3896 |
}
|
|
3897 |
|
|
3898 |
|
|
3899 |
void CSmsInterTestStep::TestRetrieveAndStoreSmsParamsL(
|
|
3900 |
RMobileSmsMessaging::TMobileSmspStoreValidParams aSmspEntryValidParams,
|
|
3901 |
RMobilePhone::TMobileTON aSmspEntryScTypeOfNumber,
|
|
3902 |
RMobilePhone::TMobileNPI aSmspEntryScNumberPlan,
|
|
3903 |
const TDesC8& aSmspEntryScTelNumber )
|
|
3904 |
{
|
|
3905 |
INFO_PRINTF1(_L("SMS parameters test"));
|
|
3906 |
|
|
3907 |
RSocketServ socketServer;
|
|
3908 |
Connect2EsockLC(socketServer);
|
|
3909 |
RSocket socket;
|
|
3910 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation);
|
|
3911 |
|
|
3912 |
RSmsSocketReadStream readstream(socket);
|
|
3913 |
TRequestStatus status;
|
|
3914 |
|
|
3915 |
//
|
|
3916 |
//Retrieve SMSP list
|
|
3917 |
//
|
|
3918 |
// Create the smspList
|
|
3919 |
CMobilePhoneSmspList* orginalSmspList = CMobilePhoneSmspList::NewL();
|
|
3920 |
CleanupStack::PushL(orginalSmspList);
|
|
3921 |
|
|
3922 |
// Make read SMS params request to the SMS Stack.
|
|
3923 |
socket.Ioctl(KIoctlReadSmsParams,status,NULL, KSolSmsProv);
|
|
3924 |
INFO_PRINTF1(_L("waiting for SMS parameters...") );
|
|
3925 |
User::WaitForRequest(status);
|
|
3926 |
TEST(status.Int() == KErrNone);
|
|
3927 |
|
|
3928 |
// Read list from stream and make positive acknowledgement to the SMS Stack
|
|
3929 |
TRAPD(ret,readstream >> *orginalSmspList);
|
|
3930 |
TEST(ret==KErrNone);
|
|
3931 |
socket.Ioctl(KIoctlCompleteReadSmsParams,status,NULL, KSolSmsProv);
|
|
3932 |
User::WaitForRequest(status);
|
|
3933 |
TEST(status.Int() == KErrNone);
|
|
3934 |
TInt maxNumberEntries = orginalSmspList->MaxNumberEntries();
|
|
3935 |
// There should be one SMSP entry
|
|
3936 |
TEST(maxNumberEntries != 0);
|
|
3937 |
|
|
3938 |
//
|
|
3939 |
//Store SMSP list
|
|
3940 |
//
|
|
3941 |
// Create the smspList
|
|
3942 |
CMobilePhoneSmspList* smspList1 = CMobilePhoneSmspList::NewL();
|
|
3943 |
CleanupStack::PushL(smspList1);
|
|
3944 |
|
|
3945 |
// Because of AT-command limitations we can store only SC address to the phone.
|
|
3946 |
RMobileSmsMessaging::TMobileSmspEntryV1 smspEntry;
|
|
3947 |
smspEntry.iValidParams = aSmspEntryValidParams;
|
|
3948 |
smspEntry.iServiceCentre.iTypeOfNumber = aSmspEntryScTypeOfNumber;
|
|
3949 |
smspEntry.iServiceCentre.iNumberPlan = aSmspEntryScNumberPlan;
|
|
3950 |
smspEntry.iServiceCentre.iTelNumber.Copy(aSmspEntryScTelNumber);
|
|
3951 |
|
|
3952 |
//Add first too many SMSP entries to the list
|
|
3953 |
TInt i=0;
|
|
3954 |
for(i=0;i<(maxNumberEntries+1);i++)
|
|
3955 |
{
|
|
3956 |
smspEntry.iIndex = i;
|
|
3957 |
smspList1->AddEntryL(smspEntry);
|
|
3958 |
}
|
|
3959 |
|
|
3960 |
INFO_PRINTF1(_L("writing SMS parameters...") );
|
|
3961 |
ret = iSmsStackTestUtils->StoreParamsL(*smspList1,socket,EFalse);
|
|
3962 |
TEST(ret==KErrArgument);
|
|
3963 |
// Writing failed because SMSP list contained too many entries.
|
|
3964 |
|
|
3965 |
// Delete one entry from SMSP list and try to write the list again.
|
|
3966 |
smspList1->DeleteEntryL(i-1);
|
|
3967 |
|
|
3968 |
INFO_PRINTF1(_L("writing SMS parameters...") );
|
|
3969 |
ret = iSmsStackTestUtils->StoreParamsL(*smspList1,socket,EFalse);
|
|
3970 |
TEST(ret==KErrNone);
|
|
3971 |
|
|
3972 |
INFO_PRINTF1(_L("SMS stack has now buffered stored parameters to it's internal memory.") );
|
|
3973 |
INFO_PRINTF1(_L("Shut down SMS stack before retrieving parameters again.") );
|
|
3974 |
socket.Close();
|
|
3975 |
socketServer.Close();
|
|
3976 |
User::After(5000000); // Defect BEN-56FFEP - increase delay from 2 to 5s to prevent
|
|
3977 |
// hang when using slower phone
|
|
3978 |
|
|
3979 |
ret=socketServer.Connect(KSocketMessageSlots);
|
|
3980 |
TEST(ret==KErrNone);
|
|
3981 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation);
|
|
3982 |
CleanupStack::Pop(&socket); //already on the cleanupstack
|
|
3983 |
|
|
3984 |
//
|
|
3985 |
//Retrieve SMSP list again and compare stored and retrieved SMSP lists
|
|
3986 |
//
|
|
3987 |
// Create the smspList
|
|
3988 |
CMobilePhoneSmspList* smspList2 = CMobilePhoneSmspList::NewL();
|
|
3989 |
CleanupStack::PushL(smspList2);
|
|
3990 |
|
|
3991 |
// Make new read SMS params request to the SMS Stack.
|
|
3992 |
socket.Ioctl(KIoctlReadSmsParams,status,NULL, KSolSmsProv);
|
|
3993 |
INFO_PRINTF1(_L("waiting for SMS parameters...") );
|
|
3994 |
User::WaitForRequest(status);
|
|
3995 |
TEST(status.Int() == KErrNone);
|
|
3996 |
|
|
3997 |
// Read list from stream and make positive acknowledgement to the SMS Stack
|
|
3998 |
TRAP(ret,readstream >> *smspList2);
|
|
3999 |
TEST(ret==KErrNone);
|
|
4000 |
socket.Ioctl(KIoctlCompleteReadSmsParams,status,NULL, KSolSmsProv);
|
|
4001 |
User::WaitForRequest(status);
|
|
4002 |
TEST(status.Int() == KErrNone);
|
|
4003 |
|
|
4004 |
// Compare SMS parameter lists
|
|
4005 |
ret = TestParametersL(*smspList1,*smspList2);
|
|
4006 |
//TODO Fails here with 6210. Maybe there is defect in MMTSY.
|
|
4007 |
TEST(ret==KErrNone);
|
|
4008 |
|
|
4009 |
//
|
|
4010 |
//Return the orginal SMSP store
|
|
4011 |
//
|
|
4012 |
ret = iSmsStackTestUtils->StoreParamsL(*orginalSmspList,socket,EFalse);
|
|
4013 |
TEST(ret==KErrNone);
|
|
4014 |
|
|
4015 |
CleanupStack::PopAndDestroy(5); //orginalSmspList,smspList1,smspList2,socket,socketServer
|
|
4016 |
User::After(2000000); // wait for socket to close before reopening
|
|
4017 |
}
|
|
4018 |
|
|
4019 |
|
|
4020 |
void CSmsInterTestStep::TestPDUSlotStoreWithEnumerationL( const RPointerArray<CSmsPduDbMessage>& aArray )
|
|
4021 |
/**
|
|
4022 |
* @test Switch on the phone with a SIM.
|
|
4023 |
* Enumerate, delete (first message if exist and last message after writing),
|
|
4024 |
* write (one message to the sim), enumerate and compare with returned PDU slots,
|
|
4025 |
* write a further message, enumerate and compare with update PDU
|
|
4026 |
*/
|
|
4027 |
{
|
|
4028 |
RSocketServ socketServer;
|
|
4029 |
Connect2EsockLC(socketServer);
|
|
4030 |
|
|
4031 |
// Open the socket for SIM operations
|
|
4032 |
RSocket socket;
|
|
4033 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation);
|
|
4034 |
|
|
4035 |
TInt ret = 0;
|
|
4036 |
CSmsMessage* tempSmsMessage;
|
|
4037 |
|
|
4038 |
// Enumerate messages
|
|
4039 |
INFO_PRINTF1(_L("Enumeration"));
|
|
4040 |
RPointerArray<CSmsMessage> messages;
|
|
4041 |
CleanupResetAndDestroyPushL(messages);
|
|
4042 |
ReadSmsStoreL(socket, messages);
|
|
4043 |
TInt count = messages.Count();
|
|
4044 |
TInt index = 0;
|
|
4045 |
|
|
4046 |
// Delete messages
|
|
4047 |
INFO_PRINTF1(_L("Delete messages"));
|
|
4048 |
while ( index < count )
|
|
4049 |
{
|
|
4050 |
tempSmsMessage = messages[index++];
|
|
4051 |
|
|
4052 |
INFO_PRINTF2(_L("Delete %d. message from the store "), index );
|
|
4053 |
ret = DeleteSmsL(*tempSmsMessage, socket);
|
|
4054 |
TEST( !( ret == KErrNone ) );
|
|
4055 |
|
|
4056 |
}
|
|
4057 |
messages.ResetAndDestroy();
|
|
4058 |
|
|
4059 |
// Create and store messages
|
|
4060 |
INFO_PRINTF1(_L("store messages"));
|
|
4061 |
count = aArray.Count();
|
|
4062 |
index = 0;
|
|
4063 |
ret=KErrNone;
|
|
4064 |
TBuf8<100> buf;
|
|
4065 |
|
|
4066 |
// Write a message, enumerate and check updated slot info
|
|
4067 |
INFO_PRINTF2(_L("Write %d. message"),index+1);
|
|
4068 |
CSmsMessage* smsMessage1 = CreateAndSetMessageL( aArray, index );
|
|
4069 |
CleanupStack::PushL(smsMessage1);
|
|
4070 |
TRAP(ret,WriteSmsToSimL(*smsMessage1, socket, &buf));
|
|
4071 |
TEST(ret==KErrNone);
|
|
4072 |
TRAP(ret,smsMessage1->UpdateSlotsL(buf));
|
|
4073 |
TEST(ret==KErrNone);
|
|
4074 |
|
|
4075 |
// Create and store a further message
|
|
4076 |
INFO_PRINTF2(_L("Write %d. message"),1);
|
|
4077 |
CSmsMessage* smsMessage2 = CreateAndSetMessageL( aArray, 1 ); // Point to final message
|
|
4078 |
CleanupStack::PushL(smsMessage2);
|
|
4079 |
TRAP(ret,WriteSmsToSimL(*smsMessage2, socket, &buf));
|
|
4080 |
|
|
4081 |
TEST(ret==KErrNone);
|
|
4082 |
TRAP(ret,smsMessage2->UpdateSlotsL(buf));
|
|
4083 |
TEST(ret==KErrNone);
|
|
4084 |
|
|
4085 |
// Enumerate messages
|
|
4086 |
INFO_PRINTF1(_L("Enumeration"));
|
|
4087 |
ReadSmsStoreL(socket, messages);
|
|
4088 |
count = messages.Count();
|
|
4089 |
TEST(!(smsMessage1->MatchSlots(messages[0]->iSlotArray) == EFalse));
|
|
4090 |
TEST(!(smsMessage2->MatchSlots(messages[1]->iSlotArray) == EFalse));
|
|
4091 |
CleanupStack::PopAndDestroy(smsMessage2);
|
|
4092 |
CleanupStack::PopAndDestroy(smsMessage1);
|
|
4093 |
|
|
4094 |
index = 0;
|
|
4095 |
|
|
4096 |
// Delete messages
|
|
4097 |
INFO_PRINTF1(_L("Delete messages"));
|
|
4098 |
while ( index < count )
|
|
4099 |
{
|
|
4100 |
tempSmsMessage = messages[index++];
|
|
4101 |
INFO_PRINTF2(_L("Delete %d. message from the store"), index );
|
|
4102 |
ret = DeleteSmsL(*tempSmsMessage, socket);
|
|
4103 |
TEST( ( ret == KErrNone ) );
|
|
4104 |
}
|
|
4105 |
|
|
4106 |
CleanupStack::PopAndDestroy(&messages);
|
|
4107 |
CleanupStack::PopAndDestroy(&socket);
|
|
4108 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
4109 |
User::After(2000000); // wait for socket to close before reopening
|
|
4110 |
}
|
|
4111 |
|
|
4112 |
void CSmsInterTestStep::TestDeleteMessagesWithoutEnumerationL( const RPointerArray<CSmsPduDbMessage>& aArray )
|
|
4113 |
/**
|
|
4114 |
* @test Switch on the phone with a SIM.
|
|
4115 |
* Enumerate, delete (first message if exist and last message after writing),
|
|
4116 |
* write (one messages to the sim), delete message without enumeration based on slot information
|
|
4117 |
*/
|
|
4118 |
{
|
|
4119 |
RSocketServ socketServer;
|
|
4120 |
Connect2EsockLC(socketServer);
|
|
4121 |
|
|
4122 |
// Open the socket for SIM operations
|
|
4123 |
RSocket socket;
|
|
4124 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation);
|
|
4125 |
|
|
4126 |
TInt ret = 0;
|
|
4127 |
CSmsMessage* tempSmsMessage;
|
|
4128 |
|
|
4129 |
// Enumerate messages
|
|
4130 |
INFO_PRINTF1(_L("Enumeration"));
|
|
4131 |
RPointerArray<CSmsMessage> messages;
|
|
4132 |
CleanupResetAndDestroyPushL(messages);
|
|
4133 |
ReadSmsStoreL(socket, messages);
|
|
4134 |
TInt count = messages.Count();
|
|
4135 |
TInt index = 0;
|
|
4136 |
|
|
4137 |
// Delete messages
|
|
4138 |
INFO_PRINTF1(_L("Delete messages"));
|
|
4139 |
while ( index < count )
|
|
4140 |
{
|
|
4141 |
tempSmsMessage = messages[index++];
|
|
4142 |
|
|
4143 |
INFO_PRINTF2(_L("Delete %d. message from the store "), index );
|
|
4144 |
ret = DeleteSmsL(*tempSmsMessage, socket);
|
|
4145 |
TEST( !( ret == KErrNone ) );
|
|
4146 |
|
|
4147 |
}
|
|
4148 |
messages.ResetAndDestroy();
|
|
4149 |
|
|
4150 |
// Create and store messages
|
|
4151 |
INFO_PRINTF1(_L("store messages"));
|
|
4152 |
count = aArray.Count();
|
|
4153 |
index = 0;
|
|
4154 |
ret=KErrNone;
|
|
4155 |
TBuf8<100> buf;
|
|
4156 |
|
|
4157 |
CSmsMessage* smsMessage = 0;
|
|
4158 |
// Write message
|
|
4159 |
while ( ret == KErrNone && index < count-1 )
|
|
4160 |
{
|
|
4161 |
INFO_PRINTF2(_L("Write %d. message"),index+1);
|
|
4162 |
smsMessage = CreateAndSetMessageL( aArray, index++ );
|
|
4163 |
CleanupStack::PushL(smsMessage);
|
|
4164 |
TRAP(ret,WriteSmsToSimL(*smsMessage, socket, &buf));
|
|
4165 |
TEST(ret==KErrNone);
|
|
4166 |
TRAP(ret,smsMessage->UpdateSlotsL(buf));
|
|
4167 |
TEST(ret==KErrNone);
|
|
4168 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
4169 |
}
|
|
4170 |
|
|
4171 |
INFO_PRINTF2(_L("Write %d. message"),count);
|
|
4172 |
smsMessage = CreateAndSetMessageL( aArray, count-1 );
|
|
4173 |
CleanupStack::PushL(smsMessage);
|
|
4174 |
TRAP(ret,WriteSmsToSimL(*smsMessage, socket, &buf));
|
|
4175 |
TEST(ret==KErrNone);
|
|
4176 |
TRAP(ret,smsMessage->UpdateSlotsL(buf));
|
|
4177 |
TEST(ret==KErrNone);
|
|
4178 |
|
|
4179 |
// Enumerate messages
|
|
4180 |
INFO_PRINTF1(_L("Enumeration"));
|
|
4181 |
ReadSmsStoreL(socket, messages);
|
|
4182 |
count = messages.Count();
|
|
4183 |
|
|
4184 |
messages.ResetAndDestroy();
|
|
4185 |
|
|
4186 |
// Ensure three messages remain on SIM
|
|
4187 |
INFO_PRINTF2(_L("Count = %d. "),count);
|
|
4188 |
|
|
4189 |
TEST((count == 3));
|
|
4190 |
|
|
4191 |
|
|
4192 |
// Delete message
|
|
4193 |
ret = DeleteSmsL(*smsMessage, socket);
|
|
4194 |
|
|
4195 |
TEST( ( ret == KErrNone ) );
|
|
4196 |
|
|
4197 |
// Enumerate messages
|
|
4198 |
INFO_PRINTF1(_L("Enumeration"));
|
|
4199 |
ReadSmsStoreL(socket, messages);
|
|
4200 |
count = messages.Count();
|
|
4201 |
|
|
4202 |
//Ensure only two messages remain on SIM
|
|
4203 |
TEST((count == 2));
|
|
4204 |
|
|
4205 |
//Ensure that deleted message no longer present on sim
|
|
4206 |
for (index = 0; index < count; index++)
|
|
4207 |
{
|
|
4208 |
TEST((smsMessage->MatchSlots(messages[count-1]->iSlotArray) == EFalse));
|
|
4209 |
}
|
|
4210 |
|
|
4211 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
4212 |
|
|
4213 |
index = 0;
|
|
4214 |
|
|
4215 |
// Delete messages
|
|
4216 |
INFO_PRINTF1(_L("Delete messages"));
|
|
4217 |
while ( index < count )
|
|
4218 |
{
|
|
4219 |
tempSmsMessage = messages[index++];
|
|
4220 |
INFO_PRINTF2(_L("Delete %d. message from the store"), index );
|
|
4221 |
ret = DeleteSmsL(*tempSmsMessage, socket);
|
|
4222 |
TEST( ( ret == KErrNone ) );
|
|
4223 |
}
|
|
4224 |
|
|
4225 |
CleanupStack::PopAndDestroy(&messages);
|
|
4226 |
CleanupStack::PopAndDestroy(&socket);
|
|
4227 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
4228 |
User::After(2000000); // wait for socket to close before reopening
|
|
4229 |
}
|
|
4230 |
|
|
4231 |
|
|
4232 |
void CSmsInterTestStep::TestRetrieveAndStoreSmsParamsOOML()
|
|
4233 |
/**
|
|
4234 |
* @test Retrieve and store SMS parameters - OOM condition applied
|
|
4235 |
*/
|
|
4236 |
{
|
|
4237 |
INFO_PRINTF1(_L("Test out of memory handling"));
|
|
4238 |
#ifdef _DEBUG
|
|
4239 |
RSocketServ debugSocketServer;
|
|
4240 |
TInt ret=debugSocketServer.Connect(KSocketMessageSlots);
|
|
4241 |
TEST(ret==KErrNone);
|
|
4242 |
CleanupClosePushL(debugSocketServer);
|
|
4243 |
|
|
4244 |
debugSocketServer.__DbgMarkHeap();
|
|
4245 |
|
|
4246 |
RSocketServ socketServer;
|
|
4247 |
Connect2EsockLC(socketServer);
|
|
4248 |
RSocket socket;
|
|
4249 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation);
|
|
4250 |
|
|
4251 |
RSmsSocketReadStream readstream(socket);
|
|
4252 |
|
|
4253 |
|
|
4254 |
//
|
|
4255 |
//Retrieve SMS parameters
|
|
4256 |
//
|
|
4257 |
CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL();
|
|
4258 |
CleanupStack::PushL(smspList);
|
|
4259 |
INFO_PRINTF1(_L("Retrieve SMS parameters."));
|
|
4260 |
TInt count=0;
|
|
4261 |
ret=KErrNoMemory;
|
|
4262 |
while (ret==KErrNoMemory || count < 7)
|
|
4263 |
{
|
|
4264 |
debugSocketServer.__DbgFailNext(count);
|
|
4265 |
TRAP(ret,iSmsStackTestUtils->MakeParametersReadRequestL(socket););
|
|
4266 |
count++;
|
|
4267 |
}
|
|
4268 |
|
|
4269 |
INFO_PRINTF1(_L(""));
|
|
4270 |
debugSocketServer.__DbgFailNext(-1); // Reset heap
|
|
4271 |
|
|
4272 |
// Read list from stream and make acknowledgement to the SMS Stack
|
|
4273 |
readstream >> *smspList;
|
|
4274 |
TRequestStatus status;
|
|
4275 |
socket.Ioctl(KIoctlCompleteReadSmsParams,status,NULL,KSolSmsProv);
|
|
4276 |
User::WaitForRequest(status);
|
|
4277 |
TEST(status.Int() == KErrNone);
|
|
4278 |
TInt maxNumberEntries = smspList->MaxNumberEntries();
|
|
4279 |
// There should be one SMSP entry
|
|
4280 |
TEST(maxNumberEntries != 0);
|
|
4281 |
|
|
4282 |
//
|
|
4283 |
//Store parameters
|
|
4284 |
//
|
|
4285 |
INFO_PRINTF1(_L("Store SMS parameters."));
|
|
4286 |
count=0;
|
|
4287 |
ret=KErrNoMemory;
|
|
4288 |
while (ret==KErrNoMemory || count < 7)
|
|
4289 |
{
|
|
4290 |
debugSocketServer.__DbgFailNext(count);
|
|
4291 |
TRAP(ret,iSmsStackTestUtils->StoreParamsLeaveIfErrorL(*smspList, socket););
|
|
4292 |
count++;
|
|
4293 |
}
|
|
4294 |
|
|
4295 |
INFO_PRINTF1(_L(""));
|
|
4296 |
debugSocketServer.__DbgFailNext(-1); // Reset heap
|
|
4297 |
|
|
4298 |
CleanupStack::PopAndDestroy(smspList);
|
|
4299 |
CleanupStack::PopAndDestroy(&socket);
|
|
4300 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
4301 |
|
|
4302 |
User::After(5000000); // wait for socket to close before reopening
|
|
4303 |
debugSocketServer.__DbgMarkEnd(0);
|
|
4304 |
CleanupStack::PopAndDestroy(1); //debugSocketServer
|
|
4305 |
|
|
4306 |
#endif
|
|
4307 |
}
|
|
4308 |
|
|
4309 |
void CSmsInterTestStep::TestSmsStoreMsgOfDifferentClassesL( const RPointerArray<CSmsPduDbMessage>& aArray,
|
|
4310 |
const CArrayFixFlat<TInt>* aSmsStorageArray,
|
|
4311 |
const CArrayFixFlat<TInt>* aSmsClassArray )
|
|
4312 |
/**
|
|
4313 |
* Test read, write and delete messages of different classes to/from
|
|
4314 |
* SIM & phone memory.
|
|
4315 |
*/
|
|
4316 |
{
|
|
4317 |
INFO_PRINTF1(_L("Read, write and delete messages of different classes"));
|
|
4318 |
|
|
4319 |
RSocketServ socketServer;
|
|
4320 |
Connect2EsockLC(socketServer);
|
|
4321 |
|
|
4322 |
RSocket socket;
|
|
4323 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
4324 |
|
|
4325 |
TInt ret(KErrNone);
|
|
4326 |
|
|
4327 |
//
|
|
4328 |
// Enumerate messages
|
|
4329 |
//
|
|
4330 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
4331 |
RPointerArray<CSmsMessage> orginalMessages;
|
|
4332 |
CleanupResetAndDestroyPushL(orginalMessages);
|
|
4333 |
ReadSmsStoreL(socket, orginalMessages);
|
|
4334 |
|
|
4335 |
//
|
|
4336 |
// Delete all messages
|
|
4337 |
//
|
|
4338 |
INFO_PRINTF1(_L("Deleting all messages from phone side SMS storage ..."));
|
|
4339 |
TInt msgCount = orginalMessages.Count();
|
|
4340 |
while(msgCount--)
|
|
4341 |
{
|
|
4342 |
ret = DeleteSmsL(*orginalMessages[msgCount], socket);
|
|
4343 |
TEST(ret==KErrNone);
|
|
4344 |
}
|
|
4345 |
|
|
4346 |
|
|
4347 |
//
|
|
4348 |
// Write messages
|
|
4349 |
//
|
|
4350 |
INFO_PRINTF1(_L("Write, read and delete messages with different classes to/from SIM and phone memory "));
|
|
4351 |
|
|
4352 |
|
|
4353 |
CSmsMessage* smsMessage = CreateAndSetMessageL( aArray, 0 );
|
|
4354 |
CleanupStack::PushL(smsMessage);
|
|
4355 |
|
|
4356 |
smsMessage->SmsPDU().SetBits7To4(TSmsDataCodingScheme::ESmsDCSTextUncompressedWithClassInfo);
|
|
4357 |
|
|
4358 |
for ( TInt i = 0; i < aSmsStorageArray->Count(); i++ )
|
|
4359 |
{
|
|
4360 |
for ( TInt j = 0; j < aSmsClassArray->Count(); j++ )
|
|
4361 |
{
|
|
4362 |
|
|
4363 |
smsMessage->SmsPDU().SetClass( ETrue, ( TSmsDataCodingScheme::TSmsClass )aSmsClassArray->At(j) );
|
|
4364 |
smsMessage->SetStorage( ( CSmsMessage::TMobileSmsStorage )aSmsStorageArray->At(i) );
|
|
4365 |
|
|
4366 |
INFO_PRINTF2(_L("Writing Class %d Message ..."),aSmsClassArray->At(j));
|
|
4367 |
TRAPD(ret,WriteSmsLeaveIfErrorL(*smsMessage,socket););
|
|
4368 |
// Some phones doesn't support phone memory. In this case SMS Stack
|
|
4369 |
// completes write request with KErrNotFound.
|
|
4370 |
// Some phones has phone memory that can be used only by phone
|
|
4371 |
// when SIM comes full (6210). Store info from this kind of
|
|
4372 |
// phone memory tells that iTotalEntries==iUsedEntries. In this case
|
|
4373 |
// SMS Stack completes write request with KErrNoMemory.
|
|
4374 |
if(ret == KErrNoMemory || ret == KErrNotFound)
|
|
4375 |
{
|
|
4376 |
INFO_PRINTF1(_L("Phone does not support phone memory!"));
|
|
4377 |
break;
|
|
4378 |
}
|
|
4379 |
//
|
|
4380 |
// Read message and compare it to written message
|
|
4381 |
//
|
|
4382 |
if(( CSmsMessage::TMobileSmsStorage )aSmsStorageArray->At(i) == CSmsMessage::ESmsSIMStorage)
|
|
4383 |
{
|
|
4384 |
RPointerArray<CSmsMessage> messages2;
|
|
4385 |
CleanupResetAndDestroyPushL(messages2);
|
|
4386 |
ReadSmsStoreL(socket, messages2);
|
|
4387 |
TestSmsContentsL(smsMessage,aArray[0]->iSmsMessage->Buffer());
|
|
4388 |
TEST(smsMessage->ToFromAddress()==messages2[0]->ToFromAddress());
|
|
4389 |
if(messages2[0]->ServiceCenterAddress().Length())
|
|
4390 |
// if the test is run on live netwrok then uncomment this
|
|
4391 |
// TEST(smsMessage->ServiceCenterAddress()==messages2[0]->ServiceCenterAddress());
|
|
4392 |
|
|
4393 |
//
|
|
4394 |
// Delete message
|
|
4395 |
//
|
|
4396 |
ret = DeleteSmsL(*messages2[0], socket);
|
|
4397 |
TEST(ret==KErrNone);
|
|
4398 |
|
|
4399 |
CleanupStack::PopAndDestroy(&messages2); // smsMessage, messages
|
|
4400 |
}
|
|
4401 |
}
|
|
4402 |
}
|
|
4403 |
|
|
4404 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
4405 |
|
|
4406 |
//
|
|
4407 |
// Enumerate messages and check that message count is zero
|
|
4408 |
//
|
|
4409 |
INFO_PRINTF1(_L("Enumerating messages and checking that phone store is empty ..."));
|
|
4410 |
RPointerArray<CSmsMessage> messages;
|
|
4411 |
CleanupResetAndDestroyPushL(messages);
|
|
4412 |
ReadSmsStoreL(socket, messages);
|
|
4413 |
TEST(messages.Count() == 0);
|
|
4414 |
|
|
4415 |
//
|
|
4416 |
// Return the original phone side SMS store
|
|
4417 |
//
|
|
4418 |
INFO_PRINTF1(_L("Returning the original phone side SMS store ..."));
|
|
4419 |
msgCount = orginalMessages.Count();
|
|
4420 |
while(msgCount--)
|
|
4421 |
{
|
|
4422 |
WriteSmsToSimL(*orginalMessages[msgCount], socket);
|
|
4423 |
}
|
|
4424 |
|
|
4425 |
CleanupStack::PopAndDestroy(2); // messages, orginalMessages
|
|
4426 |
CleanupStack::PopAndDestroy(&socket);
|
|
4427 |
//closing is too fast when using EKA2
|
|
4428 |
User::After(2000000);
|
|
4429 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
4430 |
User::After(2000000); // wait for socket to close before reopening
|
|
4431 |
}
|
|
4432 |
|
|
4433 |
void CSmsInterTestStep::TestDuplicatePdusOnStoreL( const RPointerArray<CSmsPduDbMessage>& aArray )
|
|
4434 |
/**
|
|
4435 |
* Test read, write and delete duplicate PDUs to/from SIM & phone store.
|
|
4436 |
*/
|
|
4437 |
{
|
|
4438 |
INFO_PRINTF1(_L("Read, write and delete duplicate PDUs to/from store"));
|
|
4439 |
|
|
4440 |
RSocketServ socketServer;
|
|
4441 |
Connect2EsockLC(socketServer);
|
|
4442 |
|
|
4443 |
RSocket socket;
|
|
4444 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
4445 |
|
|
4446 |
TInt ret(KErrNone);
|
|
4447 |
|
|
4448 |
//
|
|
4449 |
// Enumerate messages
|
|
4450 |
//
|
|
4451 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
4452 |
RPointerArray<CSmsMessage> orginalMessages;
|
|
4453 |
CleanupResetAndDestroyPushL(orginalMessages);
|
|
4454 |
ReadSmsStoreL(socket, orginalMessages);
|
|
4455 |
|
|
4456 |
//
|
|
4457 |
// Delete all messages
|
|
4458 |
//
|
|
4459 |
INFO_PRINTF1(_L("Deleting all messages from phone side SMS storage ..."));
|
|
4460 |
TInt msgCount = orginalMessages.Count();
|
|
4461 |
while(msgCount--)
|
|
4462 |
{
|
|
4463 |
ret = DeleteSmsL(*orginalMessages[msgCount], socket);
|
|
4464 |
TEST(ret==KErrNone);
|
|
4465 |
}
|
|
4466 |
|
|
4467 |
//
|
|
4468 |
// Write duplicate messages to the SIM and phone memory
|
|
4469 |
//
|
|
4470 |
CSmsMessage* smsMessage = CreateAndSetMessageL( aArray, 0 );
|
|
4471 |
CleanupStack::PushL(smsMessage);
|
|
4472 |
|
|
4473 |
INFO_PRINTF1(_L("Writing 4 duplicate messages to SIM storage ..."));
|
|
4474 |
msgCount=4;
|
|
4475 |
while(msgCount--)
|
|
4476 |
WriteSmsToSimL(*smsMessage, socket);
|
|
4477 |
|
|
4478 |
INFO_PRINTF1(_L("Writing 4 duplicate messages to phone memory ..."));
|
|
4479 |
smsMessage->SetStorage(CSmsMessage::ESmsPhoneStorage);
|
|
4480 |
msgCount=4;
|
|
4481 |
while(msgCount--)
|
|
4482 |
{
|
|
4483 |
TRAP(ret,WriteSmsLeaveIfErrorL(*smsMessage,socket););
|
|
4484 |
// Some phones doesn't support phone memory. In this case SMS Stack
|
|
4485 |
// completes write request with KErrNotFound.
|
|
4486 |
// Some phones has phone memory that can be used only by phone
|
|
4487 |
// when SIM comes full (6210). Store info from this kind of
|
|
4488 |
// phone memory tells that iTotalEntries==iUsedEntries. In this case
|
|
4489 |
// SMS Stack completes write request with KErrNoMemory.
|
|
4490 |
if(ret == KErrNoMemory || ret == KErrNotFound)
|
|
4491 |
{
|
|
4492 |
INFO_PRINTF1(_L("Phone does not support phone memory!"));
|
|
4493 |
break;
|
|
4494 |
}
|
|
4495 |
}
|
|
4496 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
4497 |
|
|
4498 |
//
|
|
4499 |
// Read duplicate messages
|
|
4500 |
//
|
|
4501 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
4502 |
RPointerArray<CSmsMessage> messages;
|
|
4503 |
CleanupResetAndDestroyPushL(messages);
|
|
4504 |
ReadSmsStoreL(socket, messages);
|
|
4505 |
msgCount = messages.Count();
|
|
4506 |
|
|
4507 |
TEST(msgCount == 4);
|
|
4508 |
|
|
4509 |
//
|
|
4510 |
// Check messages contents and after that delete messages
|
|
4511 |
//
|
|
4512 |
while(msgCount--)
|
|
4513 |
{
|
|
4514 |
TestSmsContentsL( messages[msgCount], aArray[0]->iSmsMessage->Buffer() );
|
|
4515 |
ret = DeleteSmsL(*messages[msgCount], socket);
|
|
4516 |
TEST(ret==KErrNone);
|
|
4517 |
}
|
|
4518 |
messages.ResetAndDestroy();
|
|
4519 |
|
|
4520 |
//
|
|
4521 |
// Read messages again and check that message count is zero
|
|
4522 |
//
|
|
4523 |
INFO_PRINTF1(_L("Enumerating and checking that whole message store is empty ..."));
|
|
4524 |
ReadSmsStoreL(socket, messages);
|
|
4525 |
TEST(!(messages.Count()));
|
|
4526 |
|
|
4527 |
//
|
|
4528 |
// Return the original phone side SMS store
|
|
4529 |
//
|
|
4530 |
INFO_PRINTF1(_L("Returning the original phone side SMS store ..."));
|
|
4531 |
msgCount = orginalMessages.Count();
|
|
4532 |
while(msgCount--)
|
|
4533 |
WriteSmsToSimL(*orginalMessages[msgCount], socket);
|
|
4534 |
|
|
4535 |
CleanupStack::PopAndDestroy(2); // messages, orginalMessages
|
|
4536 |
CleanupStack::PopAndDestroy(&socket);
|
|
4537 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
4538 |
User::After(2000000); // wait for socket to close before reopening
|
|
4539 |
}
|
|
4540 |
|
|
4541 |
void CSmsInterTestStep::TestMaxNumberOfPdusOnStoreL()
|
|
4542 |
/**
|
|
4543 |
* Test Write to store until it's full and then read and delete all
|
|
4544 |
*/
|
|
4545 |
{
|
|
4546 |
INFO_PRINTF1(_L("Read, write and delete duplicate PDUs to/from store"));
|
|
4547 |
|
|
4548 |
RSocketServ socketServer;
|
|
4549 |
Connect2EsockLC(socketServer);
|
|
4550 |
|
|
4551 |
RSocket socket;
|
|
4552 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
4553 |
|
|
4554 |
TInt ret(KErrNone);
|
|
4555 |
|
|
4556 |
//
|
|
4557 |
// Enumerate messages
|
|
4558 |
//
|
|
4559 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
4560 |
RPointerArray<CSmsMessage> orginalMessages;
|
|
4561 |
CleanupResetAndDestroyPushL(orginalMessages);
|
|
4562 |
ReadSmsStoreL(socket, orginalMessages);
|
|
4563 |
|
|
4564 |
//
|
|
4565 |
// Delete all messages
|
|
4566 |
//
|
|
4567 |
INFO_PRINTF1(_L("Deleting all messages from phone side SMS storage ..."));
|
|
4568 |
TInt msgCount = orginalMessages.Count();
|
|
4569 |
while(msgCount--)
|
|
4570 |
{
|
|
4571 |
ret = DeleteSmsL(*orginalMessages[msgCount], socket);
|
|
4572 |
TEST(ret==KErrNone);
|
|
4573 |
}
|
|
4574 |
|
|
4575 |
//
|
|
4576 |
// Write messages until storage comes full
|
|
4577 |
//
|
|
4578 |
RPointerArray<CSmsMessage> writtenMessages;
|
|
4579 |
CleanupResetAndDestroyPushL(writtenMessages);
|
|
4580 |
|
|
4581 |
INFO_PRINTF1(_L("Writing messages until SIM comes full ..."));
|
|
4582 |
WriteMessagesUntilStoreComesFullL(writtenMessages,CSmsMessage::ESmsSIMStorage,socket);
|
|
4583 |
|
|
4584 |
//
|
|
4585 |
// Enumerate messages
|
|
4586 |
//
|
|
4587 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
4588 |
RPointerArray<CSmsMessage> readMessages;
|
|
4589 |
CleanupResetAndDestroyPushL(readMessages);
|
|
4590 |
ReadSmsStoreL(socket, readMessages);
|
|
4591 |
INFO_PRINTF1(_L("Comparing written and read messages ..."));
|
|
4592 |
TRAPD(testSmsListsErr, TestSmsListsL(readMessages,writtenMessages));
|
|
4593 |
TEST(testSmsListsErr == KErrNone);
|
|
4594 |
|
|
4595 |
//
|
|
4596 |
// Delete all messages
|
|
4597 |
//
|
|
4598 |
INFO_PRINTF1(_L("Deleting all messages from phone side SMS storage ..."));
|
|
4599 |
msgCount = readMessages.Count();
|
|
4600 |
while(msgCount--)
|
|
4601 |
{
|
|
4602 |
ret = DeleteSmsL(*readMessages[msgCount], socket);
|
|
4603 |
TEST(ret==KErrNone);
|
|
4604 |
}
|
|
4605 |
readMessages.ResetAndDestroy();
|
|
4606 |
|
|
4607 |
//
|
|
4608 |
// Read messages again and check that message count is zero
|
|
4609 |
//
|
|
4610 |
INFO_PRINTF1(_L("Enumerating and checking that whole message store is empty ..."));
|
|
4611 |
ReadSmsStoreL(socket, readMessages);
|
|
4612 |
TEST(readMessages.Count()==0);
|
|
4613 |
|
|
4614 |
//
|
|
4615 |
// Return the original phone side SMS store
|
|
4616 |
//
|
|
4617 |
INFO_PRINTF1(_L("Returning the original phone side SMS store ..."));
|
|
4618 |
msgCount = orginalMessages.Count();
|
|
4619 |
while(msgCount--)
|
|
4620 |
WriteSmsToSimL(*orginalMessages[msgCount], socket);
|
|
4621 |
|
|
4622 |
CleanupStack::PopAndDestroy(3); //readMessages,writtenMessages,orginalMessages
|
|
4623 |
CleanupStack::PopAndDestroy(&socket);
|
|
4624 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
4625 |
User::After(2000000); // wait for socket to close before reopening
|
|
4626 |
}
|
|
4627 |
|
|
4628 |
void CSmsInterTestStep::TestDeletingMessageInEmptyStoreL( RPointerArray<CSmsPduDbMessage> aArray )
|
|
4629 |
/**
|
|
4630 |
* @test Attempt to delete a message in the empty store
|
|
4631 |
*/
|
|
4632 |
{
|
|
4633 |
INFO_PRINTF1(_L("Attempt to delete a message in the empty store"));
|
|
4634 |
|
|
4635 |
RSocketServ socketServer;
|
|
4636 |
Connect2EsockLC(socketServer);
|
|
4637 |
RSocket socket;
|
|
4638 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
4639 |
|
|
4640 |
TInt ret(KErrNone);
|
|
4641 |
|
|
4642 |
//
|
|
4643 |
// Enumerate messages
|
|
4644 |
//
|
|
4645 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
4646 |
RPointerArray<CSmsMessage> orginalMessages;
|
|
4647 |
CleanupResetAndDestroyPushL(orginalMessages);
|
|
4648 |
ReadSmsStoreL(socket, orginalMessages);
|
|
4649 |
|
|
4650 |
//
|
|
4651 |
// Delete all messages
|
|
4652 |
//
|
|
4653 |
INFO_PRINTF1(_L("Deleting all messages from phone side SMS storage ..."));
|
|
4654 |
TInt msgCount = orginalMessages.Count();
|
|
4655 |
while(msgCount--)
|
|
4656 |
{
|
|
4657 |
ret = DeleteSmsL(*orginalMessages[msgCount], socket);
|
|
4658 |
TEST(ret==KErrNone);
|
|
4659 |
}
|
|
4660 |
|
|
4661 |
//
|
|
4662 |
// Try to delete messages in the empty store
|
|
4663 |
//
|
|
4664 |
CSmsMessage* smsMessage = CreateAndSetMessageL( aArray, 0 );
|
|
4665 |
CleanupStack::PushL(smsMessage);
|
|
4666 |
|
|
4667 |
INFO_PRINTF1(_L("Trying to delete message from empty SIM storage ..."));
|
|
4668 |
ret = DeleteSmsL(*smsMessage, socket);
|
|
4669 |
TEST(ret == KErrArgument);
|
|
4670 |
|
|
4671 |
INFO_PRINTF1(_L("Trying to delete message from empty phone storage ..."));
|
|
4672 |
smsMessage->SetStorage(CSmsMessage::ESmsPhoneStorage);
|
|
4673 |
ret = DeleteSmsL(*smsMessage, socket);
|
|
4674 |
TEST(ret == KErrArgument);
|
|
4675 |
|
|
4676 |
//
|
|
4677 |
// Return the original phone side SMS store
|
|
4678 |
//
|
|
4679 |
INFO_PRINTF1(_L("Returning the original phone side SMS store ..."));
|
|
4680 |
msgCount = orginalMessages.Count();
|
|
4681 |
while(msgCount--)
|
|
4682 |
{
|
|
4683 |
WriteSmsToSimL(*orginalMessages[msgCount], socket);
|
|
4684 |
}
|
|
4685 |
|
|
4686 |
CleanupStack::PopAndDestroy(2); // smsMessage, orginalMessages
|
|
4687 |
CleanupStack::PopAndDestroy(&socket);
|
|
4688 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
4689 |
User::After(2000000); // wait for socket to close before reopening
|
|
4690 |
}
|
|
4691 |
|
|
4692 |
void CSmsInterTestStep::TestConcatenatedMessagesL( const RPointerArray<CSmsPduDbMessage>& aArray )
|
|
4693 |
/**
|
|
4694 |
* Test enumerate and write and delete concatenated messages
|
|
4695 |
*/
|
|
4696 |
{
|
|
4697 |
INFO_PRINTF1(_L("Enumerate and write and delete concatenated messages"));
|
|
4698 |
|
|
4699 |
RSocketServ socketServer;
|
|
4700 |
Connect2EsockLC(socketServer);
|
|
4701 |
|
|
4702 |
RSocket socket;
|
|
4703 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
4704 |
|
|
4705 |
TInt ret(KErrNone);
|
|
4706 |
|
|
4707 |
//
|
|
4708 |
// Enumerate messages
|
|
4709 |
//
|
|
4710 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
4711 |
RPointerArray<CSmsMessage> orginalMessages;
|
|
4712 |
CleanupResetAndDestroyPushL(orginalMessages);
|
|
4713 |
ReadSmsStoreL(socket, orginalMessages);
|
|
4714 |
|
|
4715 |
//
|
|
4716 |
// Delete all messages
|
|
4717 |
//
|
|
4718 |
INFO_PRINTF1(_L("Deleting all messages from phone side SMS storage ..."));
|
|
4719 |
TInt msgCount = orginalMessages.Count();
|
|
4720 |
while(msgCount--)
|
|
4721 |
{
|
|
4722 |
ret = DeleteSmsL(*orginalMessages[msgCount], socket);
|
|
4723 |
TEST(ret==KErrNone);
|
|
4724 |
}
|
|
4725 |
|
|
4726 |
//
|
|
4727 |
// Write concatenated message to SIM and phone memory
|
|
4728 |
//
|
|
4729 |
CSmsMessage* smsMessage = CreateAndSetMessageL( aArray, 0 );
|
|
4730 |
CleanupStack::PushL(smsMessage);
|
|
4731 |
|
|
4732 |
INFO_PRINTF1(_L("Writing concatenated message to the SIM ..."));
|
|
4733 |
WriteSmsToSimL(*smsMessage, socket);
|
|
4734 |
|
|
4735 |
smsMessage->SetStorage(CSmsMessage::ESmsPhoneStorage);
|
|
4736 |
INFO_PRINTF1(_L("Writing concatenated message to the phone memory ..."));
|
|
4737 |
TRAP(ret,WriteSmsLeaveIfErrorL(*smsMessage,socket););
|
|
4738 |
// Some phones doesn't support phone memory. In this case SMS Stack
|
|
4739 |
// completes write request with KErrNotFound.
|
|
4740 |
// Some phones has phone memory that can be used only by phone
|
|
4741 |
// when SIM comes full (6210). Store info from this kind of
|
|
4742 |
// phone memory tells that iTotalEntries==iUsedEntries. In this case
|
|
4743 |
// SMS Stack completes write request with KErrNoMemory.
|
|
4744 |
if(ret == KErrNoMemory || ret == KErrNotFound)
|
|
4745 |
{
|
|
4746 |
INFO_PRINTF1(_L("Phone does not support phone memory!"));
|
|
4747 |
}
|
|
4748 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
4749 |
|
|
4750 |
//TODO SKU?? Add more concatenated messages to this test case when PDU library system is ready
|
|
4751 |
|
|
4752 |
//
|
|
4753 |
// Enumerate messages
|
|
4754 |
//
|
|
4755 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
4756 |
RPointerArray<CSmsMessage> messages;
|
|
4757 |
CleanupResetAndDestroyPushL(messages);
|
|
4758 |
ReadSmsStoreL(socket, messages);
|
|
4759 |
INFO_PRINTF1(_L("Comparing written and read messages ..."));
|
|
4760 |
msgCount = messages.Count();
|
|
4761 |
while(msgCount--)
|
|
4762 |
{
|
|
4763 |
TestSmsContentsL( messages[msgCount], aArray[0]->iSmsMessage->Buffer() );
|
|
4764 |
}
|
|
4765 |
|
|
4766 |
//
|
|
4767 |
// Delete all messages
|
|
4768 |
//
|
|
4769 |
INFO_PRINTF1(_L("Deleting messages from phone side SMS storage ..."));
|
|
4770 |
msgCount = messages.Count();
|
|
4771 |
while(msgCount--)
|
|
4772 |
{
|
|
4773 |
ret = DeleteSmsL(*messages[msgCount], socket);
|
|
4774 |
TEST(ret==KErrNone);
|
|
4775 |
}
|
|
4776 |
|
|
4777 |
//
|
|
4778 |
// Return the original phone side SMS store
|
|
4779 |
//
|
|
4780 |
INFO_PRINTF1(_L("Returning the original phone side SMS store ..."));
|
|
4781 |
msgCount = orginalMessages.Count();
|
|
4782 |
while(msgCount--)
|
|
4783 |
WriteSmsToSimL(*orginalMessages[msgCount], socket);
|
|
4784 |
|
|
4785 |
CleanupStack::PopAndDestroy(2); //messages,orginalMessages
|
|
4786 |
CleanupStack::PopAndDestroy(&socket);
|
|
4787 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
4788 |
User::After(2000000); // wait for socket to close before reopening
|
|
4789 |
}
|
|
4790 |
|
|
4791 |
void CSmsInterTestStep::TestOutOfMemoryWriteL( const RPointerArray<CSmsPduDbMessage>& aArray )
|
|
4792 |
/**
|
|
4793 |
* Test out of memory handling while write process
|
|
4794 |
*/
|
|
4795 |
{
|
|
4796 |
INFO_PRINTF1(_L("Test out of memory handling while write process"));
|
|
4797 |
#ifdef _DEBUG
|
|
4798 |
/* Open dedicated debug socket server in order to detect heap imbalance after cache has been removed */
|
|
4799 |
RSocketServ debugSocketServer;
|
|
4800 |
TInt ret=debugSocketServer.Connect(KSocketMessageSlots);
|
|
4801 |
TEST(ret==KErrNone);
|
|
4802 |
CleanupClosePushL(debugSocketServer);
|
|
4803 |
|
|
4804 |
debugSocketServer.__DbgMarkHeap();
|
|
4805 |
|
|
4806 |
|
|
4807 |
RSocketServ socketServer;
|
|
4808 |
Connect2EsockLC(socketServer);
|
|
4809 |
RSocket socket;
|
|
4810 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
4811 |
|
|
4812 |
//
|
|
4813 |
// Enumerate messages
|
|
4814 |
//
|
|
4815 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
4816 |
RPointerArray<CSmsMessage> orginalMessages;
|
|
4817 |
CleanupResetAndDestroyPushL(orginalMessages);
|
|
4818 |
ReadSmsStoreL(socket, orginalMessages);
|
|
4819 |
|
|
4820 |
//
|
|
4821 |
// Delete all messages
|
|
4822 |
//
|
|
4823 |
INFO_PRINTF1(_L("Deleting all messages from phone side SMS storage ..."));
|
|
4824 |
TInt count = orginalMessages.Count();
|
|
4825 |
while(count--)
|
|
4826 |
{
|
|
4827 |
ret = DeleteSmsL(*orginalMessages[count], socket);
|
|
4828 |
TEST(ret==KErrNone);
|
|
4829 |
}
|
|
4830 |
|
|
4831 |
//
|
|
4832 |
// Write SMS
|
|
4833 |
//
|
|
4834 |
CSmsMessage* smsMessage = CreateAndSetMessageL( aArray, 0 );
|
|
4835 |
CleanupStack::PushL(smsMessage);
|
|
4836 |
|
|
4837 |
INFO_PRINTF1(_L("Write SMS message to SIM"));
|
|
4838 |
count=0;
|
|
4839 |
ret=KErrNoMemory;
|
|
4840 |
while (ret==KErrNoMemory || count < 7)
|
|
4841 |
{
|
|
4842 |
debugSocketServer.__DbgFailNext(count);
|
|
4843 |
TRAP(ret,WriteSmsLeaveIfErrorL(*smsMessage,socket););
|
|
4844 |
count++;
|
|
4845 |
}
|
|
4846 |
|
|
4847 |
debugSocketServer.__DbgFailNext(-1); // Reset heap
|
|
4848 |
|
|
4849 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
4850 |
|
|
4851 |
INFO_PRINTF1(_L("Shut down SMS stack and retrieve messages.") );
|
|
4852 |
|
|
4853 |
//
|
|
4854 |
// Enumerate messages
|
|
4855 |
//
|
|
4856 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
4857 |
RPointerArray<CSmsMessage> messages;
|
|
4858 |
CleanupResetAndDestroyPushL(messages);
|
|
4859 |
ReadSmsStoreL(socket, messages);
|
|
4860 |
|
|
4861 |
//
|
|
4862 |
// Delete messages
|
|
4863 |
//
|
|
4864 |
INFO_PRINTF1(_L("Deleting written messages from phone side SMS storage ..."));
|
|
4865 |
count = messages.Count();
|
|
4866 |
while(count--)
|
|
4867 |
{
|
|
4868 |
ret = DeleteSmsL(*messages[count], socket);
|
|
4869 |
TEST(ret==KErrNone);
|
|
4870 |
}
|
|
4871 |
|
|
4872 |
//
|
|
4873 |
// Return the original phone side SMS store
|
|
4874 |
//
|
|
4875 |
INFO_PRINTF1(_L("Returning the original phone side SMS store ..."));
|
|
4876 |
count = orginalMessages.Count();
|
|
4877 |
while(count--)
|
|
4878 |
WriteSmsToSimL(*orginalMessages[count], socket);
|
|
4879 |
|
|
4880 |
CleanupStack::PopAndDestroy(4); //orginalMessages,socketServer,socket,messages
|
|
4881 |
User::After(2000000); // wait for socket to close before reopening
|
|
4882 |
debugSocketServer.__DbgMarkEnd(0);
|
|
4883 |
CleanupStack::PopAndDestroy(1); //debugSocketServer
|
|
4884 |
|
|
4885 |
#else
|
|
4886 |
(void) aArray;
|
|
4887 |
#endif
|
|
4888 |
}
|
|
4889 |
|
|
4890 |
void CSmsInterTestStep::TestOutOfMemoryReadL()
|
|
4891 |
/**
|
|
4892 |
* Test out of memory handling while read process
|
|
4893 |
*/
|
|
4894 |
{
|
|
4895 |
INFO_PRINTF1(_L("Test out of memory handling while read process"));
|
|
4896 |
#ifdef _DEBUG
|
|
4897 |
/* Open dedicated debug socket server in order to detect heap imbalance after cache has been removed */
|
|
4898 |
RSocketServ debugSocketServer;
|
|
4899 |
TInt ret=debugSocketServer.Connect(KSocketMessageSlots);
|
|
4900 |
TEST(ret==KErrNone);
|
|
4901 |
CleanupClosePushL(debugSocketServer);
|
|
4902 |
|
|
4903 |
debugSocketServer.__DbgMarkHeap();
|
|
4904 |
|
|
4905 |
RSocketServ socketServer;
|
|
4906 |
Connect2EsockLC(socketServer);
|
|
4907 |
RSocket socket;
|
|
4908 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
4909 |
|
|
4910 |
RSmsSocketReadStream readstream(socket);
|
|
4911 |
TRequestStatus status;
|
|
4912 |
|
|
4913 |
//
|
|
4914 |
// Enumerate messages
|
|
4915 |
//
|
|
4916 |
TInt numberOfMessages(0);
|
|
4917 |
TInt count(0);
|
|
4918 |
ret=KErrNoMemory;
|
|
4919 |
while ((ret==KErrNoMemory || count < 7) && (ret != KErrNone))
|
|
4920 |
{
|
|
4921 |
debugSocketServer.__DbgFailNext(count);
|
|
4922 |
TRAP(ret,numberOfMessages=MakeReadSmsStoreRequestL(socket););
|
|
4923 |
count++;
|
|
4924 |
}
|
|
4925 |
debugSocketServer.__DbgFailNext(-1); // Reset heap
|
|
4926 |
|
|
4927 |
|
|
4928 |
INFO_PRINTF2(_L("%d enumerated messages"), numberOfMessages);
|
|
4929 |
|
|
4930 |
//Check that test client can read all messages from the stream
|
|
4931 |
for(TInt i=0; i< numberOfMessages; i++)
|
|
4932 |
{
|
|
4933 |
CSmsBuffer* buffer=CSmsBuffer::NewL();
|
|
4934 |
CSmsMessage* smsMessage=CSmsMessage::NewL(iFs, CSmsPDU::ESmsDeliver,buffer);
|
|
4935 |
CleanupStack::PushL(smsMessage);
|
|
4936 |
|
|
4937 |
readstream >> *smsMessage;
|
|
4938 |
socket.Ioctl(KIoctlReadMessageSucceeded, status, NULL, KSolSmsProv);
|
|
4939 |
User::WaitForRequest(status);
|
|
4940 |
TEST(status.Int() == KErrNone);
|
|
4941 |
|
|
4942 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
4943 |
}
|
|
4944 |
CleanupStack::PopAndDestroy(&socket);
|
|
4945 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
4946 |
User::After(2000000); // wait for socket to close before reopening
|
|
4947 |
debugSocketServer.__DbgMarkEnd(0);
|
|
4948 |
|
|
4949 |
CleanupStack::PopAndDestroy(1); //debugSocketServer
|
|
4950 |
#endif
|
|
4951 |
}
|
|
4952 |
|
|
4953 |
void CSmsInterTestStep::TestOutOfMemoryDeleteL( const RPointerArray<CSmsPduDbMessage>& aArray )
|
|
4954 |
/**
|
|
4955 |
* Test out of memory handling while delete process
|
|
4956 |
*/
|
|
4957 |
{
|
|
4958 |
INFO_PRINTF1(_L("Test out of memory handling while delete process"));
|
|
4959 |
#ifdef _DEBUG
|
|
4960 |
/* Open dedicated debug socket server in order to detect heap imbalance after cache has been removed */
|
|
4961 |
RSocketServ debugSocketServer;
|
|
4962 |
TInt ret=debugSocketServer.Connect(KSocketMessageSlots);
|
|
4963 |
TEST(ret==KErrNone);
|
|
4964 |
CleanupClosePushL(debugSocketServer);
|
|
4965 |
|
|
4966 |
debugSocketServer.__DbgMarkHeap();
|
|
4967 |
|
|
4968 |
RSocketServ socketServer;
|
|
4969 |
Connect2EsockLC(socketServer);
|
|
4970 |
RSocket socket;
|
|
4971 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
4972 |
|
|
4973 |
TBool returnOriginalStore(EFalse);
|
|
4974 |
TInt count(0);
|
|
4975 |
|
|
4976 |
//
|
|
4977 |
// Enumerate messages
|
|
4978 |
//
|
|
4979 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
4980 |
RPointerArray<CSmsMessage> originalMessages;
|
|
4981 |
RPointerArray<CSmsMessage> addedMessages;
|
|
4982 |
CleanupResetAndDestroyPushL(originalMessages);
|
|
4983 |
CleanupResetAndDestroyPushL(addedMessages);
|
|
4984 |
|
|
4985 |
ReadSmsStoreL(socket, originalMessages);
|
|
4986 |
|
|
4987 |
//
|
|
4988 |
// Write couple messages if store was empty
|
|
4989 |
//
|
|
4990 |
if(0==originalMessages.Count())
|
|
4991 |
{
|
|
4992 |
returnOriginalStore=EFalse;
|
|
4993 |
TInt arrayCount = aArray.Count();
|
|
4994 |
INFO_PRINTF2(_L("Store is empty. Writing %d messages ..."), arrayCount );
|
|
4995 |
|
|
4996 |
count=0;
|
|
4997 |
while( count < arrayCount )
|
|
4998 |
{
|
|
4999 |
|
|
5000 |
CSmsMessage* smsMessage = CreateAndSetMessageL( aArray, count++ );
|
|
5001 |
|
|
5002 |
CleanupStack::PushL(smsMessage);
|
|
5003 |
WriteSmsToSimL(*smsMessage,socket);
|
|
5004 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
5005 |
}
|
|
5006 |
}
|
|
5007 |
else
|
|
5008 |
returnOriginalStore=ETrue;
|
|
5009 |
|
|
5010 |
ReadSmsStoreL(socket, addedMessages);
|
|
5011 |
//
|
|
5012 |
// Delete all messages
|
|
5013 |
//
|
|
5014 |
INFO_PRINTF1(_L("Deleting all messages from phone side SMS storage ..."));
|
|
5015 |
TInt i(0);
|
|
5016 |
count=1;
|
|
5017 |
ret=KErrNoMemory;
|
|
5018 |
while (i<addedMessages.Count())
|
|
5019 |
{
|
|
5020 |
if(count<5)
|
|
5021 |
debugSocketServer.__DbgFailNext(count);
|
|
5022 |
TRAP(ret,DeleteSmsLeaveIfErrorL(*addedMessages[i],socket));
|
|
5023 |
|
|
5024 |
if(ret == KErrNone)
|
|
5025 |
{
|
|
5026 |
INFO_PRINTF2(_L("Deleting %d. message was successfull"),i+1);
|
|
5027 |
i++;
|
|
5028 |
}
|
|
5029 |
count++;
|
|
5030 |
}
|
|
5031 |
|
|
5032 |
INFO_PRINTF1(_L("before reseting the heap ..."));
|
|
5033 |
|
|
5034 |
debugSocketServer.__DbgFailNext(-1); // Reset heap
|
|
5035 |
INFO_PRINTF1(_L("after reseting the heap ..."));
|
|
5036 |
|
|
5037 |
if(i<addedMessages.Count()) //we havn't managed to delete all messages from SIM
|
|
5038 |
{
|
|
5039 |
while (i< addedMessages.Count() )
|
|
5040 |
{
|
|
5041 |
TRAP(ret,DeleteSmsLeaveIfErrorL(*addedMessages[i],socket));
|
|
5042 |
if(ret == KErrNone)
|
|
5043 |
{
|
|
5044 |
INFO_PRINTF2(_L("Deleting %d. message was successfull"),i+1);
|
|
5045 |
i++;
|
|
5046 |
}
|
|
5047 |
}
|
|
5048 |
}
|
|
5049 |
|
|
5050 |
INFO_PRINTF1(_L("Shut down SMS stack .") );
|
|
5051 |
|
|
5052 |
//
|
|
5053 |
// Return the original phone side SMS store if it contained messages when test started
|
|
5054 |
//
|
|
5055 |
if(returnOriginalStore)
|
|
5056 |
{
|
|
5057 |
INFO_PRINTF1(_L("Returning the original phone side SMS store ..."));
|
|
5058 |
count = originalMessages.Count();
|
|
5059 |
while(count--)
|
|
5060 |
WriteSmsToSimL(*originalMessages[count], socket);
|
|
5061 |
}
|
|
5062 |
|
|
5063 |
|
|
5064 |
User::After(2000000); // wait for socket to close before reopening
|
|
5065 |
CleanupStack::PopAndDestroy(4); //originalMessages,addedMessages, socket, socketServer
|
|
5066 |
User::After(2000000); // wait for socket to close before reopening
|
|
5067 |
//INFO_PRINTF1(_L("before reset heap..."));
|
|
5068 |
|
|
5069 |
INFO_PRINTF1(_L("before ending the heap ..."));
|
|
5070 |
|
|
5071 |
debugSocketServer.__DbgMarkEnd(0);
|
|
5072 |
|
|
5073 |
User::After(2000000);
|
|
5074 |
INFO_PRINTF1(_L("After debug end ..."));
|
|
5075 |
CleanupStack::PopAndDestroy(1); //debugSocketServer
|
|
5076 |
|
|
5077 |
#else
|
|
5078 |
(void)aArray;
|
|
5079 |
#endif
|
|
5080 |
}
|
|
5081 |
|
|
5082 |
void CSmsInterTestStep::TestSmartMessagingL( const RPointerArray<CSmsPduDbMessage>& aArray,
|
|
5083 |
const CArrayFixFlat<TInt>* aIeiDataArray,
|
|
5084 |
const CArrayFixFlat<TInt>* aInformationElementArray,
|
|
5085 |
const CArrayFixFlat<TInt>* aAlphabetArray )
|
|
5086 |
/**
|
|
5087 |
* @test Send and receive smart messages
|
|
5088 |
* Note! This test doesn't work properly with 6210. Phone doesn't route incoming application port address
|
|
5089 |
* messages to the MM TSY.
|
|
5090 |
* TODO 6210 won't show received vCards to user. Maybe used version is not supported or destination port
|
|
5091 |
* is wrong?
|
|
5092 |
*/
|
|
5093 |
{
|
|
5094 |
INFO_PRINTF1(_L("Send and receive smart messages"));
|
|
5095 |
|
|
5096 |
RSocketServ socketServer;
|
|
5097 |
Connect2EsockLC(socketServer);
|
|
5098 |
RSocket socket;
|
|
5099 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
5100 |
|
|
5101 |
TBuf<512> confFileBuf;
|
|
5102 |
TBuf<255> dataBuf;
|
|
5103 |
TBuf8<5> ieiData;
|
|
5104 |
|
|
5105 |
TSmsDataCodingScheme::TSmsAlphabet alphabet;
|
|
5106 |
CSmsInformationElement::TSmsInformationElementIdentifier iei;
|
|
5107 |
|
|
5108 |
TInt index = 2;
|
|
5109 |
for ( ; index < aArray.Count(); index++ )
|
|
5110 |
{
|
|
5111 |
alphabet = ( TSmsDataCodingScheme::TSmsAlphabet )aAlphabetArray->At(index);
|
|
5112 |
iei = ( CSmsInformationElement::TSmsInformationElementIdentifier )aInformationElementArray->At(index);
|
|
5113 |
|
|
5114 |
TInt bufLen=aArray[index]->iSmsMessage->Buffer().Length();
|
|
5115 |
aArray[index]->iSmsMessage->Buffer().Extract(confFileBuf,0,bufLen);
|
|
5116 |
|
|
5117 |
TInt ind(0);
|
|
5118 |
dataBuf.SetLength(0);
|
|
5119 |
TInt length = confFileBuf.Length();
|
|
5120 |
|
|
5121 |
//Changes \n to be 0x0A for SendAndRecvAndCompareMessageIEIL
|
|
5122 |
if ( index != 2 )
|
|
5123 |
while ( ind < length )
|
|
5124 |
{
|
|
5125 |
if ( confFileBuf[ind] == 0x5C && confFileBuf[ind+1] == 0x6E ) //0x5C=='\', 0x6E=='n'
|
|
5126 |
{
|
|
5127 |
dataBuf.Append( 0x0A ); //"\n"
|
|
5128 |
ind += 2;
|
|
5129 |
}
|
|
5130 |
else
|
|
5131 |
dataBuf.Append( confFileBuf[ind++] );
|
|
5132 |
}
|
|
5133 |
else
|
|
5134 |
{
|
|
5135 |
|
|
5136 |
for(TInt pos = 0;pos < length; pos += 2)
|
|
5137 |
{
|
|
5138 |
const TPtrC asciiVal(confFileBuf.Mid(pos,2));
|
|
5139 |
TUint8 val;
|
|
5140 |
TLex lexer(asciiVal);
|
|
5141 |
lexer.Val(val,EHex);
|
|
5142 |
|
|
5143 |
dataBuf.Append(val);
|
|
5144 |
}
|
|
5145 |
}
|
|
5146 |
|
|
5147 |
TInt testCaseNum(0), count(0);
|
|
5148 |
ieiData.SetLength(0);
|
|
5149 |
while ( testCaseNum < index )
|
|
5150 |
if ( aIeiDataArray->At(count++) == KErrNotFound )
|
|
5151 |
testCaseNum++;
|
|
5152 |
|
|
5153 |
while ( aIeiDataArray->At(count) != KErrNotFound )
|
|
5154 |
ieiData.Append(aIeiDataArray->At(count++));
|
|
5155 |
|
|
5156 |
|
|
5157 |
SendAndRecvAndCompareMessageIEIL( dataBuf, ieiData, socket, alphabet, iei );
|
|
5158 |
|
|
5159 |
}
|
|
5160 |
CleanupStack::PopAndDestroy(&socket);
|
|
5161 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
5162 |
}
|
|
5163 |
|
|
5164 |
void CSmsInterTestStep::TestSendSMS2Port0000L( const RPointerArray<CSmsPduDbMessage>& aArray )
|
|
5165 |
/**
|
|
5166 |
* @test Send and Receive message to port 0000 and 23F4
|
|
5167 |
* TODO This test doesn't work with 6210 because phone doesn't route incoming
|
|
5168 |
* application port addressing messages to the MM TSY.
|
|
5169 |
*/
|
|
5170 |
{
|
|
5171 |
INFO_PRINTF1(_L("Sending a SMS 2 port 0x0000 "));
|
|
5172 |
|
|
5173 |
RSocketServ socketServer;
|
|
5174 |
Connect2EsockLC(socketServer);
|
|
5175 |
RSocket socket;
|
|
5176 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
5177 |
|
|
5178 |
for ( TInt i = 0; i < aArray.Count(); i++ )
|
|
5179 |
{
|
|
5180 |
TInt bufLen=aArray[i]->iSmsMessage->Buffer().Length();
|
|
5181 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
5182 |
CleanupStack::PushL(textBuf);
|
|
5183 |
TPtr textPtr(textBuf->Des());
|
|
5184 |
aArray[i]->iSmsMessage->Buffer().Extract(textPtr,0,bufLen);
|
|
5185 |
|
|
5186 |
SendAndRecvSms7BitL( textPtr, socket );
|
|
5187 |
CleanupStack::PopAndDestroy(textBuf);
|
|
5188 |
}
|
|
5189 |
|
|
5190 |
CleanupStack::PopAndDestroy(&socket);
|
|
5191 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
5192 |
}
|
|
5193 |
|
|
5194 |
void CSmsInterTestStep::TestReceiveLongClass2L()
|
|
5195 |
/**
|
|
5196 |
* @test Receive a concatenated class 2 SMS message which is too long
|
|
5197 |
* to fit on the SIM so the other parts have yet to be sent from
|
|
5198 |
* the SMSC
|
|
5199 |
*/
|
|
5200 |
{
|
|
5201 |
INFO_PRINTF1(_L("<font color=Orange>This test does not run in automated mode yet.</font>"));
|
|
5202 |
|
|
5203 |
|
|
5204 |
|
|
5205 |
INFO_PRINTF1(_L("Send message too long for SIM"));
|
|
5206 |
|
|
5207 |
RSocketServ socketServer;
|
|
5208 |
Connect2EsockLC(socketServer);
|
|
5209 |
RSocket socket;
|
|
5210 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
5211 |
|
|
5212 |
RPointerArray<CSmsMessage> writtenMessages;
|
|
5213 |
CleanupResetAndDestroyPushL(writtenMessages);
|
|
5214 |
|
|
5215 |
INFO_PRINTF1(_L("Writing messages until SIM comes full ..."));
|
|
5216 |
WriteMessagesUntilStoreComesFullL(writtenMessages,CSmsMessage::ESmsSIMStorage,socket);
|
|
5217 |
|
|
5218 |
|
|
5219 |
INFO_PRINTF1(_L("Please manually delete three messages from the SIM."));
|
|
5220 |
//gTest.Getch();
|
|
5221 |
|
|
5222 |
INFO_PRINTF1(_L("A message concatenated into 3 parts will now be sent."));
|
|
5223 |
|
|
5224 |
TInt messageNum = 3;
|
|
5225 |
TInt msgSize = messageNum * KMaxNumberOfCharsFor7BitSms - (KMaxNumberOfCharsFor7BitSms / 2);
|
|
5226 |
|
|
5227 |
HBufC* msgBuf = HBufC::NewLC(msgSize);
|
|
5228 |
TPtr msgPtr = msgBuf->Des();
|
|
5229 |
FillDes(msgPtr,msgSize);
|
|
5230 |
|
|
5231 |
TTestCase testMsg(*msgBuf);
|
|
5232 |
testMsg.SetSmsClass(TSmsDataCodingScheme::ESmsClass2);
|
|
5233 |
INFO_PRINTF1(_L("testMsg.SetSmsClass()"));
|
|
5234 |
SendAndRecvTestMessageL(testMsg,socket);
|
|
5235 |
CleanupStack::PopAndDestroy(msgBuf);
|
|
5236 |
|
|
5237 |
CleanupStack::PopAndDestroy(1);
|
|
5238 |
CleanupStack::PopAndDestroy(&socket);
|
|
5239 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
5240 |
|
|
5241 |
}
|
|
5242 |
|
|
5243 |
void CSmsInterTestStep::TestSendAndReceiveConcatenated1L()
|
|
5244 |
/**
|
|
5245 |
* @test Receive a concatenated SMS with all message parts on the phone
|
|
5246 |
*/
|
|
5247 |
{
|
|
5248 |
INFO_PRINTF1(_L("Receive a concatenated SMS with all message parts on the phone"));
|
|
5249 |
INFO_PRINTF1(_L("Please ensure 3 SMS messages can be stored on the phone."));
|
|
5250 |
|
|
5251 |
RSocketServ socketServer;
|
|
5252 |
Connect2EsockLC(socketServer);
|
|
5253 |
RSocket socket;
|
|
5254 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrSendOnly);
|
|
5255 |
|
|
5256 |
TInt messageNum = 3;
|
|
5257 |
TInt msgSize = messageNum * KMaxNumberOfCharsFor7BitSms - (KMaxNumberOfCharsFor7BitSms / 2);
|
|
5258 |
|
|
5259 |
HBufC* msgBuf = HBufC::NewLC(msgSize);
|
|
5260 |
TPtr msgPtr = msgBuf->Des();
|
|
5261 |
FillDes(msgPtr,msgSize);
|
|
5262 |
|
|
5263 |
TTestCase testMsg(*msgBuf);
|
|
5264 |
|
|
5265 |
RSocket socketRecv;
|
|
5266 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socketRecv,ESmsAddrRecvAny);
|
|
5267 |
|
|
5268 |
SendTestMessageL(testMsg,socket);
|
|
5269 |
|
|
5270 |
INFO_PRINTF1(_L("Press any key once all 3 parts of the message have arrived."));
|
|
5271 |
//gTest.Getch();
|
|
5272 |
INFO_PRINTF1(_L("Attempting to receive message."));
|
|
5273 |
|
|
5274 |
WaitForRecvL(socketRecv);
|
|
5275 |
CSmsMessage* smsMessage = RecvSmsL(socketRecv);
|
|
5276 |
CleanupStack::PushL(smsMessage);
|
|
5277 |
TestMessageContentsL(smsMessage,testMsg);
|
|
5278 |
CleanupStack::PopAndDestroy(3); // msgBuf, socketRecv, smsMessage
|
|
5279 |
CleanupStack::PopAndDestroy(&socket);
|
|
5280 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
5281 |
}
|
|
5282 |
|
|
5283 |
void CSmsInterTestStep::TestSendAndReceiveConcatenated2L()
|
|
5284 |
/**
|
|
5285 |
* @test Receive a concatenated SMS with some parts missing from the phone
|
|
5286 |
*/
|
|
5287 |
{
|
|
5288 |
INFO_PRINTF1(_L("Receive a concatenated SMS with some parts missing from the phone"));
|
|
5289 |
INFO_PRINTF1(_L("Please ensure 3 SMS messages can be stored on the phone."));
|
|
5290 |
|
|
5291 |
RSocketServ socketServer;
|
|
5292 |
Connect2EsockLC(socketServer);
|
|
5293 |
RSocket socket;
|
|
5294 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrSendOnly);
|
|
5295 |
|
|
5296 |
TInt messageNum = 3;
|
|
5297 |
TInt msgSize = messageNum * KMaxNumberOfCharsFor7BitSms - (KMaxNumberOfCharsFor7BitSms / 2);
|
|
5298 |
|
|
5299 |
HBufC* msgBuf = HBufC::NewLC(msgSize);
|
|
5300 |
TPtr msgPtr = msgBuf->Des();
|
|
5301 |
FillDes(msgPtr,msgSize);
|
|
5302 |
|
|
5303 |
TTestCase testMsg(*msgBuf);
|
|
5304 |
RSocket socketRecv;
|
|
5305 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socketRecv,ESmsAddrRecvAny);
|
|
5306 |
|
|
5307 |
SendTestMessageL(testMsg,socket);
|
|
5308 |
|
|
5309 |
INFO_PRINTF1(_L("Delete one message part then press any key."));
|
|
5310 |
//gTest.Getch();
|
|
5311 |
INFO_PRINTF1(_L("Attempting to receive message."));
|
|
5312 |
|
|
5313 |
WaitForRecvL(socketRecv);
|
|
5314 |
CSmsMessage* smsMessage = RecvSmsL(socketRecv);
|
|
5315 |
CleanupStack::PushL(smsMessage);
|
|
5316 |
TestMessageContentsL(smsMessage,testMsg);
|
|
5317 |
CleanupStack::PopAndDestroy(3); // msgBuf, socketRecv, smsMessage
|
|
5318 |
CleanupStack::PopAndDestroy(&socket);
|
|
5319 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
5320 |
}
|
|
5321 |
|
|
5322 |
void CSmsInterTestStep::TestBindingToApplicationPortL()
|
|
5323 |
/**
|
|
5324 |
* @test Binding to application port address family
|
|
5325 |
*/
|
|
5326 |
{
|
|
5327 |
INFO_PRINTF1(_L("Test binding using application port addressing "));
|
|
5328 |
|
|
5329 |
RSocketServ socketServer;
|
|
5330 |
Connect2EsockLC(socketServer);
|
|
5331 |
TSmsAddr addr8,addr16;
|
|
5332 |
addr8.SetSmsAddrFamily(ESmsAddrApplication8BitPort);
|
|
5333 |
addr16.SetSmsAddrFamily(ESmsAddrApplication16BitPort);
|
|
5334 |
TInt port(245),portother(255);
|
|
5335 |
addr8.SetPort(port);
|
|
5336 |
addr16.SetPort(port);
|
|
5337 |
|
|
5338 |
RSocket socket8,socket16;
|
|
5339 |
|
|
5340 |
TInt ret = 0;
|
|
5341 |
// 001 open sockets and bind them to the same port of both families, 8-bit addressing first
|
|
5342 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5343 |
TEST(ret==KErrNone);
|
|
5344 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5345 |
TEST(ret==KErrNone);
|
|
5346 |
|
|
5347 |
// bind them to ports
|
|
5348 |
ret = socket8.Bind(addr8);
|
|
5349 |
TEST(ret==KErrNone);
|
|
5350 |
ret = socket16.Bind(addr16);
|
|
5351 |
TEST(ret==KErrNone);
|
|
5352 |
|
|
5353 |
socket8.Close();
|
|
5354 |
socket16.Close();
|
|
5355 |
|
|
5356 |
// 002 open sockets and bind them to the same port of both families, 16-bit family first
|
|
5357 |
|
|
5358 |
// open sockets
|
|
5359 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5360 |
TEST(ret==KErrNone);
|
|
5361 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5362 |
TEST(ret==KErrNone);
|
|
5363 |
// bind sockets
|
|
5364 |
ret = socket16.Bind(addr16);
|
|
5365 |
TEST(ret==KErrNone);
|
|
5366 |
ret = socket8.Bind(addr8);
|
|
5367 |
TEST(ret==KErrNone);
|
|
5368 |
|
|
5369 |
socket8.Close();
|
|
5370 |
socket16.Close();
|
|
5371 |
|
|
5372 |
// 003 rebind socket 8-bit family
|
|
5373 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5374 |
TEST(ret==KErrNone);
|
|
5375 |
// bind sockets
|
|
5376 |
ret = socket8.Bind(addr8);
|
|
5377 |
TEST(ret==KErrNone);
|
|
5378 |
|
|
5379 |
addr8.SetPort(portother);
|
|
5380 |
ret = socket8.Bind(addr8);
|
|
5381 |
TEST(ret==KErrNone);
|
|
5382 |
|
|
5383 |
socket8.Close();
|
|
5384 |
|
|
5385 |
// 004 rebind socket 16-bit family
|
|
5386 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5387 |
TEST(ret==KErrNone);
|
|
5388 |
// bind sockets
|
|
5389 |
ret = socket16.Bind(addr16);
|
|
5390 |
TEST(ret==KErrNone);
|
|
5391 |
|
|
5392 |
addr8.SetPort(portother);
|
|
5393 |
ret = socket16.Bind(addr16);
|
|
5394 |
TEST(ret==KErrNone);
|
|
5395 |
|
|
5396 |
socket16.Close();
|
|
5397 |
|
|
5398 |
// 005-6 open sockets and bind them to the same port of the same family
|
|
5399 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5400 |
TEST(ret==KErrNone);
|
|
5401 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5402 |
TEST(ret==KErrNone);
|
|
5403 |
|
|
5404 |
RSocket socket8other,socket16other;
|
|
5405 |
ret = socket8other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5406 |
TEST(ret==KErrNone);
|
|
5407 |
ret = socket16other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5408 |
TEST(ret==KErrNone);
|
|
5409 |
|
|
5410 |
// bind them to ports
|
|
5411 |
ret = socket8.Bind(addr8);
|
|
5412 |
TEST(ret==KErrNone);
|
|
5413 |
|
|
5414 |
ret = socket8other.Bind(addr8);
|
|
5415 |
TEST(ret==KErrAlreadyExists);
|
|
5416 |
|
|
5417 |
ret = socket16.Bind(addr16);
|
|
5418 |
TEST(ret==KErrNone);
|
|
5419 |
|
|
5420 |
ret = socket16other.Bind(addr16);
|
|
5421 |
TEST(ret==KErrAlreadyExists);
|
|
5422 |
|
|
5423 |
socket8.Close();
|
|
5424 |
socket16.Close();
|
|
5425 |
socket8other.Close();
|
|
5426 |
socket16other.Close();
|
|
5427 |
|
|
5428 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
5429 |
User::After(2000000); // wait for socket to close before reopening
|
|
5430 |
}
|
|
5431 |
|
|
5432 |
void CSmsInterTestStep::TestSendAndReceiveAndDeleteClass2MsgsL()
|
|
5433 |
/**
|
|
5434 |
* @test Send and Recieve Class 2 message, attempt to delete. Test needs phone that reports store information so GT code is responsible for deletion
|
|
5435 |
*/
|
|
5436 |
{
|
|
5437 |
INFO_PRINTF1(_L("Send receive and attempt to delete a class 2 message"));
|
|
5438 |
|
|
5439 |
RSocketServ socketServer;
|
|
5440 |
Connect2EsockLC(socketServer);
|
|
5441 |
RSocket socket;
|
|
5442 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
5443 |
|
|
5444 |
//
|
|
5445 |
// Enumerate messages
|
|
5446 |
//
|
|
5447 |
INFO_PRINTF1(_L("Starting enumeration ..."));
|
|
5448 |
RPointerArray<CSmsMessage> orginalMessages;
|
|
5449 |
CleanupResetAndDestroyPushL(orginalMessages);
|
|
5450 |
ReadSmsStoreL(socket, orginalMessages);
|
|
5451 |
|
|
5452 |
//
|
|
5453 |
// Delete all messages
|
|
5454 |
//
|
|
5455 |
INFO_PRINTF1(_L("Deleting all messages from phone side SMS storage ..."));
|
|
5456 |
TInt msgCount = orginalMessages.Count();
|
|
5457 |
while(msgCount--)
|
|
5458 |
{
|
|
5459 |
TInt ret = DeleteSmsL(*orginalMessages[msgCount], socket);
|
|
5460 |
TEST(ret==KErrNone);
|
|
5461 |
}
|
|
5462 |
|
|
5463 |
TInt messageNum = 1;
|
|
5464 |
TInt msgSize = messageNum * KMaxNumberOfCharsFor7BitSms - (KMaxNumberOfCharsFor7BitSms / 2);
|
|
5465 |
|
|
5466 |
HBufC* msgBuf = HBufC::NewLC(msgSize);
|
|
5467 |
TPtr msgPtr = msgBuf->Des();
|
|
5468 |
FillDes(msgPtr,msgSize);
|
|
5469 |
|
|
5470 |
TTestCase testMsg(*msgBuf);
|
|
5471 |
testMsg.SetSmsClass(TSmsDataCodingScheme::ESmsClass2);
|
|
5472 |
|
|
5473 |
SendTestMessageL(testMsg, socket);
|
|
5474 |
|
|
5475 |
WaitForRecvL(socket);
|
|
5476 |
CSmsMessage* smsMessage = RecvSmsL(socket);
|
|
5477 |
CleanupStack::PushL(smsMessage);
|
|
5478 |
TestMessageContentsL(smsMessage,testMsg);
|
|
5479 |
|
|
5480 |
// Attempt to delete received message
|
|
5481 |
TInt ret = DeleteSmsL(*smsMessage, socket);
|
|
5482 |
if (ret != 0)
|
|
5483 |
INFO_PRINTF1(_L("Test is not valid with this phone as it doesn't report required storage information, try T65"));
|
|
5484 |
|
|
5485 |
TEST(ret == 0);
|
|
5486 |
|
|
5487 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
5488 |
|
|
5489 |
CleanupStack::PopAndDestroy(msgBuf);
|
|
5490 |
CleanupStack::PopAndDestroy(&orginalMessages);
|
|
5491 |
CleanupStack::PopAndDestroy(&socket);
|
|
5492 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
5493 |
}
|
|
5494 |
|
|
5495 |
void CSmsInterTestStep::PublishandSubscribeTestL()
|
|
5496 |
/**
|
|
5497 |
* @test This is the regression test for defect PEN-4TKC82 (Defect Database v4)
|
|
5498 |
* 'SMSProt reschedules the phone initilization by timer'.
|
|
5499 |
* test updated to use Publish and Subscribe
|
|
5500 |
*/
|
|
5501 |
{
|
|
5502 |
//
|
|
5503 |
// Start-up
|
|
5504 |
//
|
|
5505 |
INFO_PRINTF1(_L("Create a socket") );
|
|
5506 |
|
|
5507 |
RSocketServ socketServer;
|
|
5508 |
Connect2EsockLC(socketServer);
|
|
5509 |
|
|
5510 |
INFO_PRINTF1(_L("Attaching to phone power property"));
|
|
5511 |
RProperty phonePowerProperty;
|
|
5512 |
User::LeaveIfError(phonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid));
|
|
5513 |
CleanupClosePushL(phonePowerProperty);
|
|
5514 |
|
|
5515 |
TRequestStatus status;
|
|
5516 |
INFO_PRINTF1(_L("Set phone power property to off"));
|
|
5517 |
TInt phonePowerCheck;
|
|
5518 |
do
|
|
5519 |
{
|
|
5520 |
phonePowerProperty.Subscribe(status);
|
|
5521 |
User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOff));
|
|
5522 |
User::After(5 * 1000000); // sleep 5 secs;
|
|
5523 |
User::WaitForRequest(status);
|
|
5524 |
TEST(status.Int() == KErrNone);
|
|
5525 |
User::LeaveIfError(phonePowerProperty.Get(phonePowerCheck));
|
|
5526 |
}
|
|
5527 |
while (phonePowerCheck==ESAPhoneOn);
|
|
5528 |
|
|
5529 |
INFO_PRINTF1(_L("Starting up Sms Stack"));
|
|
5530 |
RSocket socket;
|
|
5531 |
iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny);
|
|
5532 |
|
|
5533 |
_LIT(KSmsTestMessage,"Test message");
|
|
5534 |
CSmsMessage* smsMessage=CreateSmsMessageL(KSmsTestMessage,TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
5535 |
CleanupStack::PushL(smsMessage);
|
|
5536 |
CSmsSubmit& submitPdu=(CSmsSubmit&)smsMessage->SmsPDU();
|
|
5537 |
submitPdu.SetReplyPath(ETrue);
|
|
5538 |
|
|
5539 |
//
|
|
5540 |
// Check that Sms Stack can handle starting up with phone off
|
|
5541 |
//
|
|
5542 |
INFO_PRINTF1(_L("Checking that Sms Stack will NOT allow us to send an SMS"));
|
|
5543 |
TRAPD(ret,SendSmsDontCheckReturnValueL(smsMessage,socket));
|
|
5544 |
if(ret!=KErrDisconnected)
|
|
5545 |
User::Leave(KErrGeneral);
|
|
5546 |
|
|
5547 |
//
|
|
5548 |
// Check that Sms Stack can handle the phone being switched on
|
|
5549 |
//
|
|
5550 |
INFO_PRINTF1(_L("Set phone power property to on"));
|
|
5551 |
do
|
|
5552 |
{
|
|
5553 |
phonePowerProperty.Subscribe(status);
|
|
5554 |
User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOn));
|
|
5555 |
User::After(5 * 1000000); // sleep 5 secs;
|
|
5556 |
User::WaitForRequest(status);
|
|
5557 |
TEST(status.Int() == KErrNone);
|
|
5558 |
User::LeaveIfError(phonePowerProperty.Get(phonePowerCheck));
|
|
5559 |
}
|
|
5560 |
while (phonePowerCheck==ESAPhoneOff);
|
|
5561 |
|
|
5562 |
INFO_PRINTF1(_L("Checking that Sms Stack will allow us to send an SMS"));
|
|
5563 |
TRAP(ret,SendSmsDontCheckReturnValueL(smsMessage,socket));
|
|
5564 |
TEST(ret==KErrNone);
|
|
5565 |
|
|
5566 |
WaitForRecvL(socket);
|
|
5567 |
CSmsMessage* recvMessage = RecvSmsL(socket);
|
|
5568 |
delete recvMessage;
|
|
5569 |
|
|
5570 |
//
|
|
5571 |
// Check that Sms Stack can handle the phone being switched off
|
|
5572 |
//
|
|
5573 |
INFO_PRINTF1(_L("Set phone power property to off"));
|
|
5574 |
do
|
|
5575 |
{
|
|
5576 |
phonePowerProperty.Subscribe(status);
|
|
5577 |
User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOff));
|
|
5578 |
User::After(5 * 1000000); // sleep 5 secs;
|
|
5579 |
User::WaitForRequest(status);
|
|
5580 |
TEST(status.Int() == KErrNone);
|
|
5581 |
User::LeaveIfError(phonePowerProperty.Get(phonePowerCheck));
|
|
5582 |
}
|
|
5583 |
while (phonePowerCheck==ESAPhoneOn);
|
|
5584 |
|
|
5585 |
|
|
5586 |
INFO_PRINTF1(_L("Checking that Sms Stack will NOT allow us to send an SMS"));
|
|
5587 |
TRAP(ret,SendSmsDontCheckReturnValueL(smsMessage,socket));
|
|
5588 |
if(ret!=KErrDisconnected)
|
|
5589 |
User::Leave(KErrGeneral);
|
|
5590 |
|
|
5591 |
//
|
|
5592 |
// Check that Sms Stack can handle the phone being switched on (just for good measures ;-))
|
|
5593 |
//
|
|
5594 |
INFO_PRINTF1(_L("Set phone power property to on"));
|
|
5595 |
do
|
|
5596 |
{
|
|
5597 |
phonePowerProperty.Subscribe(status);
|
|
5598 |
User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOn));
|
|
5599 |
User::After(5 * 1000000); // sleep 5 secs;
|
|
5600 |
User::WaitForRequest(status);
|
|
5601 |
TEST(status.Int() == KErrNone);
|
|
5602 |
User::LeaveIfError(phonePowerProperty.Get(phonePowerCheck));
|
|
5603 |
}
|
|
5604 |
while (phonePowerCheck==ESAPhoneOff);
|
|
5605 |
|
|
5606 |
INFO_PRINTF1(_L("Checking that Sms Stack will allow us to send an SMS"));
|
|
5607 |
TRAP(ret,SendSmsDontCheckReturnValueL(smsMessage,socket));
|
|
5608 |
TEST(ret==KErrNone);
|
|
5609 |
|
|
5610 |
WaitForRecvL(socket);
|
|
5611 |
recvMessage = RecvSmsL(socket);
|
|
5612 |
delete recvMessage;
|
|
5613 |
|
|
5614 |
//
|
|
5615 |
// Shut-down
|
|
5616 |
//
|
|
5617 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
5618 |
|
|
5619 |
INFO_PRINTF1(_L("Closing down Sms Stack"));
|
|
5620 |
CleanupStack::PopAndDestroy(&socket);
|
|
5621 |
|
|
5622 |
INFO_PRINTF1(_L("Releasing handle to phone power property"));
|
|
5623 |
CleanupStack::PopAndDestroy(&phonePowerProperty);
|
|
5624 |
//closing is too fast when using EKA2
|
|
5625 |
User::After(2000000);
|
|
5626 |
|
|
5627 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
5628 |
User::After(2000000); // wait for socket to close before reopening
|
|
5629 |
}
|
|
5630 |
|
|
5631 |
void CSmsInterTestStep::TestSendingReceivingViaAppPortPublishAndSubscribeL()
|
|
5632 |
/**
|
|
5633 |
* @test Send & receive via application port bound sockets with publish and subscribe
|
|
5634 |
*/
|
|
5635 |
{
|
|
5636 |
INFO_PRINTF1(_L("Test sending and receiving utilising application port addressing "));
|
|
5637 |
|
|
5638 |
RSocketServ socketServer;
|
|
5639 |
TSmsAddr addr8,addr16,addrany,addr8other,addr16other;
|
|
5640 |
addr8.SetSmsAddrFamily(ESmsAddrApplication8BitPort);
|
|
5641 |
addr16.SetSmsAddrFamily(ESmsAddrApplication16BitPort);
|
|
5642 |
addrany.SetSmsAddrFamily(ESmsAddrRecvAny);
|
|
5643 |
addr8other.SetSmsAddrFamily(ESmsAddrApplication8BitPort);
|
|
5644 |
addr16other.SetSmsAddrFamily(ESmsAddrApplication16BitPort);
|
|
5645 |
|
|
5646 |
TInt port(245),portother(255);
|
|
5647 |
|
|
5648 |
TBuf<256> buf;
|
|
5649 |
|
|
5650 |
addr8.SetPort(port);
|
|
5651 |
addr16.SetPort(port);
|
|
5652 |
addr8other.SetPort(portother);
|
|
5653 |
addr16other.SetPort(portother);
|
|
5654 |
|
|
5655 |
RSocket socket8,socket16,socketany,socket8other,socket16other;
|
|
5656 |
|
|
5657 |
TInt ret = 0;
|
|
5658 |
|
|
5659 |
Connect2EsockLC(socketServer);
|
|
5660 |
|
|
5661 |
RProperty phonePowerProperty;
|
|
5662 |
User::LeaveIfError(phonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid));
|
|
5663 |
CleanupClosePushL(phonePowerProperty);
|
|
5664 |
|
|
5665 |
TRequestStatus status;
|
|
5666 |
TInt phonePowerCheck;
|
|
5667 |
do
|
|
5668 |
{
|
|
5669 |
phonePowerProperty.Subscribe(status);
|
|
5670 |
User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOn));
|
|
5671 |
User::After(5 * 1000000); // sleep 5 secs;
|
|
5672 |
User::WaitForRequest(status);
|
|
5673 |
TEST(status.Int() == KErrNone);
|
|
5674 |
User::LeaveIfError(phonePowerProperty.Get(phonePowerCheck));
|
|
5675 |
}
|
|
5676 |
while (phonePowerCheck==ESAPhoneOff);
|
|
5677 |
|
|
5678 |
// 013 send from socket bound to recv any address to another socket bound to 8-bit addressing port
|
|
5679 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5680 |
TEST(ret==KErrNone);
|
|
5681 |
ret = socketany.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5682 |
TEST(ret==KErrNone);
|
|
5683 |
|
|
5684 |
// bind them to ports
|
|
5685 |
ret = socket8.Bind(addr8);
|
|
5686 |
TEST(ret==KErrNone);
|
|
5687 |
|
|
5688 |
ret = socketany.Bind(addrany);
|
|
5689 |
TEST(ret==KErrNone);
|
|
5690 |
|
|
5691 |
CleanupClosePushL(socket8);
|
|
5692 |
CleanupClosePushL(socketany);
|
|
5693 |
|
|
5694 |
//
|
|
5695 |
// create SMS message
|
|
5696 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
5697 |
buf.Format(_L("013 - SendingRecevingViaApplicationPortL Msg"));
|
|
5698 |
CSmsMessage* sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
5699 |
CleanupStack::PushL(sendMessage);
|
|
5700 |
|
|
5701 |
// set SMS port addresing for 8 Bit ports
|
|
5702 |
CSmsPDU& pdu = sendMessage->SmsPDU();
|
|
5703 |
pdu.SetApplicationPortAddressingL(ETrue, port, port, EFalse);
|
|
5704 |
|
|
5705 |
// send SMS message
|
|
5706 |
SendSmsL(sendMessage,socketany);
|
|
5707 |
|
|
5708 |
WaitForRecvL(socket8);
|
|
5709 |
CSmsMessage* recvMessage = RecvSmsL(socket8);
|
|
5710 |
CleanupStack::PushL(recvMessage);
|
|
5711 |
|
|
5712 |
//compare sent and received messages
|
|
5713 |
TestSmsContentsL(recvMessage,buf);
|
|
5714 |
|
|
5715 |
//
|
|
5716 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
5717 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
5718 |
CleanupStack::PopAndDestroy(&socketany);
|
|
5719 |
CleanupStack::PopAndDestroy(&socket8);
|
|
5720 |
|
|
5721 |
|
|
5722 |
// 014 send from socket bound to recv any address to another socket bound to 16-bit addressing port
|
|
5723 |
|
|
5724 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5725 |
TEST(ret==KErrNone);
|
|
5726 |
ret = socketany.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5727 |
TEST(ret==KErrNone);
|
|
5728 |
|
|
5729 |
// bind them to ports
|
|
5730 |
ret = socket16.Bind(addr16);
|
|
5731 |
TEST(ret==KErrNone);
|
|
5732 |
ret = socketany.Bind(addrany);
|
|
5733 |
TEST(ret==KErrNone);
|
|
5734 |
|
|
5735 |
CleanupClosePushL(socket16);
|
|
5736 |
CleanupClosePushL(socketany);
|
|
5737 |
|
|
5738 |
//
|
|
5739 |
// create SMS message
|
|
5740 |
buf.Format(_L("014 - SendingRecevingViaApplicationPortL Msg"));
|
|
5741 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
5742 |
CleanupStack::PushL(sendMessage);
|
|
5743 |
|
|
5744 |
// set SMS port addresing for 16 Bit ports
|
|
5745 |
CSmsPDU& pdu16 = sendMessage->SmsPDU();
|
|
5746 |
pdu16.SetApplicationPortAddressingL(ETrue, port, port, ETrue);
|
|
5747 |
|
|
5748 |
// send SMS message
|
|
5749 |
SendSmsL(sendMessage,socketany);
|
|
5750 |
|
|
5751 |
WaitForRecvL(socket16);
|
|
5752 |
recvMessage = RecvSmsL(socket16);
|
|
5753 |
CleanupStack::PushL(recvMessage);
|
|
5754 |
|
|
5755 |
//compare sent and received messages
|
|
5756 |
TestSmsContentsL(recvMessage,buf);
|
|
5757 |
|
|
5758 |
//
|
|
5759 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
5760 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
5761 |
|
|
5762 |
CleanupStack::PopAndDestroy(&socketany);
|
|
5763 |
CleanupStack::PopAndDestroy(&socket16);
|
|
5764 |
|
|
5765 |
// 015 send from socket bound to 8-bit addressing port to itself
|
|
5766 |
|
|
5767 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5768 |
TEST(ret==KErrNone);
|
|
5769 |
|
|
5770 |
|
|
5771 |
// bind them to ports
|
|
5772 |
ret = socket8.Bind(addr8);
|
|
5773 |
TEST(ret==KErrNone);
|
|
5774 |
|
|
5775 |
CleanupClosePushL(socket8);
|
|
5776 |
|
|
5777 |
//
|
|
5778 |
// create SMS message
|
|
5779 |
buf.Format(_L("015 - SendingRecevingViaApplicationPortL Msg"));
|
|
5780 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
5781 |
CleanupStack::PushL(sendMessage);
|
|
5782 |
|
|
5783 |
// set SMS port addresing for 8 Bit ports
|
|
5784 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, port, port, EFalse);
|
|
5785 |
|
|
5786 |
// send EMS message
|
|
5787 |
SendSmsL(sendMessage,socket8);
|
|
5788 |
|
|
5789 |
WaitForRecvL(socket8);
|
|
5790 |
recvMessage = RecvSmsL(socket8);
|
|
5791 |
CleanupStack::PushL(recvMessage);
|
|
5792 |
|
|
5793 |
//compare sent and received messages
|
|
5794 |
TestSmsContentsL(recvMessage,buf);
|
|
5795 |
|
|
5796 |
//
|
|
5797 |
|
|
5798 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
5799 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
5800 |
|
|
5801 |
CleanupStack::PopAndDestroy(&socket8);
|
|
5802 |
|
|
5803 |
// 016 send from socket bound to 16-bit addressing port to itself
|
|
5804 |
|
|
5805 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5806 |
TEST(ret==KErrNone);
|
|
5807 |
|
|
5808 |
|
|
5809 |
// bind it
|
|
5810 |
ret = socket16.Bind(addr16);
|
|
5811 |
TEST(ret==KErrNone);
|
|
5812 |
|
|
5813 |
CleanupClosePushL(socket16);
|
|
5814 |
|
|
5815 |
//
|
|
5816 |
// create SMS message
|
|
5817 |
buf.Format(_L("016 - SendingRecevingViaApplicationPortL Msg"));
|
|
5818 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
5819 |
CleanupStack::PushL(sendMessage);
|
|
5820 |
|
|
5821 |
// set SMS port addresing for 16 Bit port
|
|
5822 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, port, port, ETrue);
|
|
5823 |
|
|
5824 |
// send SMS message
|
|
5825 |
SendSmsL(sendMessage,socket16);
|
|
5826 |
|
|
5827 |
WaitForRecvL(socket16);
|
|
5828 |
recvMessage = RecvSmsL(socket16);
|
|
5829 |
CleanupStack::PushL(recvMessage);
|
|
5830 |
|
|
5831 |
//compare sent and received messages
|
|
5832 |
TestSmsContentsL(recvMessage,buf);
|
|
5833 |
|
|
5834 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
5835 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
5836 |
|
|
5837 |
CleanupStack::PopAndDestroy(&socket16);
|
|
5838 |
//
|
|
5839 |
|
|
5840 |
// 017 send from socket bound to recv any address to another socket bound to 8-bit addressing port, in presence
|
|
5841 |
// of another socket bound to the same 16-bit port
|
|
5842 |
|
|
5843 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5844 |
TEST(ret==KErrNone);
|
|
5845 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5846 |
TEST(ret==KErrNone);
|
|
5847 |
ret = socketany.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5848 |
TEST(ret==KErrNone);
|
|
5849 |
|
|
5850 |
// bind them to ports
|
|
5851 |
ret = socket8.Bind(addr8);
|
|
5852 |
TEST(ret==KErrNone);
|
|
5853 |
|
|
5854 |
ret = socket16.Bind(addr16);
|
|
5855 |
TEST(ret==KErrNone);
|
|
5856 |
|
|
5857 |
ret = socketany.Bind(addrany);
|
|
5858 |
TEST(ret==KErrNone);
|
|
5859 |
|
|
5860 |
CleanupClosePushL(socket8);
|
|
5861 |
CleanupClosePushL(socket16);
|
|
5862 |
CleanupClosePushL(socketany);
|
|
5863 |
|
|
5864 |
//
|
|
5865 |
// create SMS message
|
|
5866 |
buf.Format(_L("017 - SendingRecevingViaApplicationPortL Msg"));
|
|
5867 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
5868 |
CleanupStack::PushL(sendMessage);
|
|
5869 |
|
|
5870 |
// set SMS port addresing for 8 Bit ports
|
|
5871 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, port, port, EFalse);
|
|
5872 |
|
|
5873 |
// send SMS message
|
|
5874 |
SendSmsL(sendMessage,socketany);
|
|
5875 |
|
|
5876 |
WaitForRecvL(socket8);
|
|
5877 |
recvMessage = RecvSmsL(socket8);
|
|
5878 |
CleanupStack::PushL(recvMessage);
|
|
5879 |
|
|
5880 |
//compare sent and received messages
|
|
5881 |
TestSmsContentsL(recvMessage,buf);
|
|
5882 |
|
|
5883 |
//
|
|
5884 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
5885 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
5886 |
|
|
5887 |
CleanupStack::PopAndDestroy(&socketany);
|
|
5888 |
CleanupStack::PopAndDestroy(&socket16);
|
|
5889 |
CleanupStack::PopAndDestroy(&socket8);
|
|
5890 |
|
|
5891 |
|
|
5892 |
// 018 send from the socket bound to recv any address to another socket bound to 16-bit addressing port,
|
|
5893 |
// in presence of another socket bound to the same 8-bit application port
|
|
5894 |
|
|
5895 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5896 |
TEST(ret==KErrNone);
|
|
5897 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5898 |
TEST(ret==KErrNone);
|
|
5899 |
ret = socketany.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5900 |
TEST(ret==KErrNone);
|
|
5901 |
|
|
5902 |
// bind them to ports
|
|
5903 |
ret = socket16.Bind(addr16);
|
|
5904 |
TEST(ret==KErrNone);
|
|
5905 |
ret = socket8.Bind(addr8);
|
|
5906 |
TEST(ret==KErrNone);
|
|
5907 |
ret = socketany.Bind(addrany);
|
|
5908 |
TEST(ret==KErrNone);
|
|
5909 |
|
|
5910 |
CleanupClosePushL(socket16);
|
|
5911 |
CleanupClosePushL(socket8);
|
|
5912 |
CleanupClosePushL(socketany);
|
|
5913 |
|
|
5914 |
//
|
|
5915 |
// create SMS message
|
|
5916 |
buf.Format(_L("018 - SendingRecevingViaApplicationPortL Msg"));
|
|
5917 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
5918 |
CleanupStack::PushL(sendMessage);
|
|
5919 |
|
|
5920 |
// set SMS port addresing for 16 Bit ports
|
|
5921 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, port, port, ETrue);
|
|
5922 |
|
|
5923 |
// send SMS message
|
|
5924 |
SendSmsL(sendMessage,socketany);
|
|
5925 |
|
|
5926 |
WaitForRecvL(socket16);
|
|
5927 |
recvMessage = RecvSmsL(socket16);
|
|
5928 |
CleanupStack::PushL(recvMessage);
|
|
5929 |
|
|
5930 |
//compare sent and received messages
|
|
5931 |
TestSmsContentsL(recvMessage,buf);
|
|
5932 |
|
|
5933 |
//
|
|
5934 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
5935 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
5936 |
|
|
5937 |
|
|
5938 |
CleanupStack::PopAndDestroy(&socketany);
|
|
5939 |
CleanupStack::PopAndDestroy(&socket8);
|
|
5940 |
CleanupStack::PopAndDestroy(&socket16);
|
|
5941 |
|
|
5942 |
|
|
5943 |
// 019 send from socket bound to 8-bit addressing port to itself, in presence of another socket bound to
|
|
5944 |
// the same 16-bit port
|
|
5945 |
|
|
5946 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5947 |
TEST(ret==KErrNone);
|
|
5948 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5949 |
TEST(ret==KErrNone);
|
|
5950 |
|
|
5951 |
// bind them to ports
|
|
5952 |
ret = socket8.Bind(addr8);
|
|
5953 |
TEST(ret==KErrNone);
|
|
5954 |
ret = socket16.Bind(addr16);
|
|
5955 |
TEST(ret==KErrNone);
|
|
5956 |
|
|
5957 |
CleanupClosePushL(socket8);
|
|
5958 |
CleanupClosePushL(socket16);
|
|
5959 |
|
|
5960 |
//
|
|
5961 |
// create SMS message
|
|
5962 |
buf.Format(_L("019 - SendingRecevingViaApplicationPortL Msg"));
|
|
5963 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
5964 |
CleanupStack::PushL(sendMessage);
|
|
5965 |
|
|
5966 |
// set SMS port addresing for 8 Bit ports
|
|
5967 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, port, port, EFalse);
|
|
5968 |
|
|
5969 |
// send EMS message
|
|
5970 |
SendSmsL(sendMessage,socket8);
|
|
5971 |
|
|
5972 |
WaitForRecvL(socket8);
|
|
5973 |
recvMessage = RecvSmsL(socket8);
|
|
5974 |
CleanupStack::PushL(recvMessage);
|
|
5975 |
|
|
5976 |
//compare sent and received messages
|
|
5977 |
TestSmsContentsL(recvMessage,buf);
|
|
5978 |
|
|
5979 |
//
|
|
5980 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
5981 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
5982 |
|
|
5983 |
CleanupStack::PopAndDestroy(&socket16);
|
|
5984 |
CleanupStack::PopAndDestroy(&socket8);
|
|
5985 |
|
|
5986 |
// 020 send from socket bound to 16-bit addressing port to itself, in presence
|
|
5987 |
// of other socket bound to the same 8-bit port
|
|
5988 |
|
|
5989 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5990 |
TEST(ret==KErrNone);
|
|
5991 |
|
|
5992 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
5993 |
TEST(ret==KErrNone);
|
|
5994 |
|
|
5995 |
// bind it
|
|
5996 |
ret = socket16.Bind(addr16);
|
|
5997 |
TEST(ret==KErrNone);
|
|
5998 |
ret = socket8.Bind(addr8);
|
|
5999 |
TEST(ret==KErrNone);
|
|
6000 |
|
|
6001 |
CleanupClosePushL(socket16);
|
|
6002 |
CleanupClosePushL(socket8);
|
|
6003 |
|
|
6004 |
//
|
|
6005 |
// create SMS message
|
|
6006 |
buf.Format(_L("020 - SendingRecevingViaApplicationPortL Msg"));
|
|
6007 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
6008 |
CleanupStack::PushL(sendMessage);
|
|
6009 |
|
|
6010 |
// set SMS port addresing for 16 Bit port
|
|
6011 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, port, port, ETrue);
|
|
6012 |
|
|
6013 |
// send SMS message
|
|
6014 |
SendSmsL(sendMessage,socket16);
|
|
6015 |
|
|
6016 |
WaitForRecvL(socket16);
|
|
6017 |
recvMessage = RecvSmsL(socket16);
|
|
6018 |
CleanupStack::PushL(recvMessage);
|
|
6019 |
|
|
6020 |
//compare sent and received messages
|
|
6021 |
TestSmsContentsL(recvMessage,buf);
|
|
6022 |
|
|
6023 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
6024 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
6025 |
|
|
6026 |
CleanupStack::PopAndDestroy(&socket8);
|
|
6027 |
CleanupStack::PopAndDestroy(&socket16);
|
|
6028 |
|
|
6029 |
|
|
6030 |
// 021 send from the socket bound to 8-bit addressing port, to another
|
|
6031 |
// socket bound to other 8-bit port
|
|
6032 |
|
|
6033 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6034 |
TEST(ret==KErrNone);
|
|
6035 |
ret = socket8other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6036 |
TEST(ret==KErrNone);
|
|
6037 |
|
|
6038 |
// bind them to ports
|
|
6039 |
ret = socket8.Bind(addr8);
|
|
6040 |
TEST(ret==KErrNone);
|
|
6041 |
|
|
6042 |
ret = socket8other.Bind(addr8other);
|
|
6043 |
TEST(ret==KErrNone);
|
|
6044 |
|
|
6045 |
CleanupClosePushL(socket8);
|
|
6046 |
CleanupClosePushL(socket8other);
|
|
6047 |
|
|
6048 |
//
|
|
6049 |
// create SMS message
|
|
6050 |
buf.Format(_L("021 - SendingRecevingViaApplicationPortL Msg"));
|
|
6051 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
6052 |
CleanupStack::PushL(sendMessage);
|
|
6053 |
|
|
6054 |
// set SMS port addresing for 8 Bit ports
|
|
6055 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, portother, port, EFalse);
|
|
6056 |
|
|
6057 |
// send SMS message
|
|
6058 |
SendSmsL(sendMessage,socket8);
|
|
6059 |
|
|
6060 |
WaitForRecvL(socket8other);
|
|
6061 |
recvMessage = RecvSmsL(socket8other);
|
|
6062 |
CleanupStack::PushL(recvMessage);
|
|
6063 |
|
|
6064 |
//compare sent and received messages
|
|
6065 |
TestSmsContentsL(recvMessage,buf);
|
|
6066 |
|
|
6067 |
//
|
|
6068 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
6069 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
6070 |
|
|
6071 |
CleanupStack::PopAndDestroy(&socket8other);
|
|
6072 |
CleanupStack::PopAndDestroy(&socket8);
|
|
6073 |
|
|
6074 |
|
|
6075 |
// 022 send from the socket bound to 16-bit addressing port, to another
|
|
6076 |
// socket bound to other 16-bit port
|
|
6077 |
|
|
6078 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6079 |
TEST(ret==KErrNone);
|
|
6080 |
ret = socket16other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6081 |
TEST(ret==KErrNone);
|
|
6082 |
|
|
6083 |
// bind them to ports
|
|
6084 |
ret = socket16.Bind(addr16);
|
|
6085 |
TEST(ret==KErrNone);
|
|
6086 |
|
|
6087 |
ret = socket16other.Bind(addr16other);
|
|
6088 |
TEST(ret==KErrNone);
|
|
6089 |
|
|
6090 |
CleanupClosePushL(socket16);
|
|
6091 |
CleanupClosePushL(socket16other);
|
|
6092 |
|
|
6093 |
//
|
|
6094 |
// create SMS message
|
|
6095 |
buf.Format(_L("022 - SendingRecevingViaApplicationPortL Msg"));
|
|
6096 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
6097 |
CleanupStack::PushL(sendMessage);
|
|
6098 |
|
|
6099 |
// set SMS port addresing for 16 Bit ports
|
|
6100 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, portother, port, ETrue);
|
|
6101 |
|
|
6102 |
// send SMS message
|
|
6103 |
SendSmsL(sendMessage,socket16);
|
|
6104 |
|
|
6105 |
WaitForRecvL(socket16other);
|
|
6106 |
recvMessage = RecvSmsL(socket16other);
|
|
6107 |
CleanupStack::PushL(recvMessage);
|
|
6108 |
|
|
6109 |
//compare sent and received messages
|
|
6110 |
TestSmsContentsL(recvMessage,buf);
|
|
6111 |
|
|
6112 |
//
|
|
6113 |
|
|
6114 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
6115 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
6116 |
|
|
6117 |
CleanupStack::PopAndDestroy(&socket16other);
|
|
6118 |
CleanupStack::PopAndDestroy(&socket16);
|
|
6119 |
|
|
6120 |
// 023 send from the socket bound to 8-bit addressing port, to another
|
|
6121 |
// socket bound to 16-bit port
|
|
6122 |
|
|
6123 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6124 |
TEST(ret==KErrNone);
|
|
6125 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6126 |
TEST(ret==KErrNone);
|
|
6127 |
|
|
6128 |
// bind them to ports
|
|
6129 |
ret = socket8.Bind(addr8);
|
|
6130 |
TEST(ret==KErrNone);
|
|
6131 |
|
|
6132 |
ret = socket16.Bind(addr16);
|
|
6133 |
TEST(ret==KErrNone);
|
|
6134 |
|
|
6135 |
CleanupClosePushL(socket8);
|
|
6136 |
CleanupClosePushL(socket16);
|
|
6137 |
|
|
6138 |
//
|
|
6139 |
// create SMS message
|
|
6140 |
buf.Format(_L("023 - SendingRecevingViaApplicationPortL Msg"));
|
|
6141 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
6142 |
CleanupStack::PushL(sendMessage);
|
|
6143 |
|
|
6144 |
// set SMS port addresing for 16 Bit ports
|
|
6145 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, port, port, ETrue);
|
|
6146 |
|
|
6147 |
// send SMS message
|
|
6148 |
SendSmsL(sendMessage,socket8);
|
|
6149 |
|
|
6150 |
WaitForRecvL(socket16);
|
|
6151 |
recvMessage = RecvSmsL(socket16);
|
|
6152 |
CleanupStack::PushL(recvMessage);
|
|
6153 |
|
|
6154 |
//compare sent and received messages
|
|
6155 |
TestSmsContentsL(recvMessage,buf);
|
|
6156 |
|
|
6157 |
//
|
|
6158 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
6159 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
6160 |
|
|
6161 |
CleanupStack::PopAndDestroy(&socket16);
|
|
6162 |
CleanupStack::PopAndDestroy(&socket8);
|
|
6163 |
|
|
6164 |
// 024 send from the socket bound to 16-bit addressing port, to another
|
|
6165 |
// socket bound to 8-bit port
|
|
6166 |
|
|
6167 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6168 |
TEST(ret==KErrNone);
|
|
6169 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6170 |
TEST(ret==KErrNone);
|
|
6171 |
|
|
6172 |
// bind them to ports
|
|
6173 |
ret = socket8.Bind(addr8);
|
|
6174 |
TEST(ret==KErrNone);
|
|
6175 |
|
|
6176 |
ret = socket16.Bind(addr16);
|
|
6177 |
TEST(ret==KErrNone);
|
|
6178 |
|
|
6179 |
CleanupClosePushL(socket8);
|
|
6180 |
CleanupClosePushL(socket16);
|
|
6181 |
|
|
6182 |
//
|
|
6183 |
// create SMS message
|
|
6184 |
buf.Format(_L("024 - SendingRecevingViaApplicationPortL Msg"));
|
|
6185 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
6186 |
CleanupStack::PushL(sendMessage);
|
|
6187 |
|
|
6188 |
// set SMS port addresing for 16 Bit ports
|
|
6189 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, port, port, EFalse);
|
|
6190 |
|
|
6191 |
// send SMS message
|
|
6192 |
SendSmsL(sendMessage,socket16);
|
|
6193 |
|
|
6194 |
WaitForRecvL(socket8);
|
|
6195 |
recvMessage = RecvSmsL(socket8);
|
|
6196 |
CleanupStack::PushL(recvMessage);
|
|
6197 |
|
|
6198 |
//compare sent and received messages
|
|
6199 |
TestSmsContentsL(recvMessage,buf);
|
|
6200 |
|
|
6201 |
//
|
|
6202 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
6203 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
6204 |
|
|
6205 |
|
|
6206 |
CleanupStack::PopAndDestroy(&socket16);
|
|
6207 |
CleanupStack::PopAndDestroy(&socket8);
|
|
6208 |
|
|
6209 |
|
|
6210 |
// 025 send from the socket bound to 8-bit addressing port, to another
|
|
6211 |
// socket bound to other 8-bit port, in presence of another socket bound
|
|
6212 |
// to the same 16-bit port
|
|
6213 |
|
|
6214 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6215 |
TEST(ret==KErrNone);
|
|
6216 |
ret = socket8other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6217 |
TEST(ret==KErrNone);
|
|
6218 |
|
|
6219 |
ret = socket16other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6220 |
TEST(ret==KErrNone);
|
|
6221 |
|
|
6222 |
// bind them to ports
|
|
6223 |
ret = socket8.Bind(addr8);
|
|
6224 |
TEST(ret==KErrNone);
|
|
6225 |
|
|
6226 |
ret = socket8other.Bind(addr8other);
|
|
6227 |
TEST(ret==KErrNone);
|
|
6228 |
|
|
6229 |
ret = socket16other.Bind(addr16other);
|
|
6230 |
TEST(ret==KErrNone);
|
|
6231 |
|
|
6232 |
CleanupClosePushL(socket8);
|
|
6233 |
CleanupClosePushL(socket8other);
|
|
6234 |
CleanupClosePushL(socket16other);
|
|
6235 |
|
|
6236 |
//
|
|
6237 |
// create SMS message
|
|
6238 |
buf.Format(_L("025 - SendingRecevingViaApplicationPortL Msg"));
|
|
6239 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
6240 |
CleanupStack::PushL(sendMessage);
|
|
6241 |
|
|
6242 |
// set SMS port addresing for 8 Bit ports
|
|
6243 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, portother, port, EFalse);
|
|
6244 |
|
|
6245 |
// send SMS message
|
|
6246 |
SendSmsL(sendMessage,socket8);
|
|
6247 |
|
|
6248 |
WaitForRecvL(socket8other);
|
|
6249 |
recvMessage = RecvSmsL(socket8other);
|
|
6250 |
CleanupStack::PushL(recvMessage);
|
|
6251 |
|
|
6252 |
//compare sent and received messages
|
|
6253 |
TestSmsContentsL(recvMessage,buf);
|
|
6254 |
|
|
6255 |
//
|
|
6256 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
6257 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
6258 |
|
|
6259 |
CleanupStack::PopAndDestroy(&socket16other);
|
|
6260 |
CleanupStack::PopAndDestroy(&socket8other);
|
|
6261 |
CleanupStack::PopAndDestroy(&socket8);
|
|
6262 |
|
|
6263 |
|
|
6264 |
// 026 send from the socket bound to 16-bit addressing port, to another
|
|
6265 |
// socket bound to other 16-bit port, in presence of other socket bound
|
|
6266 |
// to the same 8-bit port
|
|
6267 |
|
|
6268 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6269 |
TEST(ret==KErrNone);
|
|
6270 |
ret = socket16other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6271 |
TEST(ret==KErrNone);
|
|
6272 |
ret = socket8other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6273 |
TEST(ret==KErrNone);
|
|
6274 |
|
|
6275 |
// bind them to ports
|
|
6276 |
ret = socket16.Bind(addr16);
|
|
6277 |
TEST(ret==KErrNone);
|
|
6278 |
|
|
6279 |
ret = socket16other.Bind(addr16other);
|
|
6280 |
TEST(ret==KErrNone);
|
|
6281 |
|
|
6282 |
ret = socket8other.Bind(addr8other);
|
|
6283 |
TEST(ret==KErrNone);
|
|
6284 |
|
|
6285 |
CleanupClosePushL(socket16);
|
|
6286 |
CleanupClosePushL(socket16other);
|
|
6287 |
CleanupClosePushL(socket8other);
|
|
6288 |
|
|
6289 |
//
|
|
6290 |
// create SMS message
|
|
6291 |
buf.Format(_L("026 - SendingRecevingViaApplicationPortL Msg"));
|
|
6292 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
6293 |
CleanupStack::PushL(sendMessage);
|
|
6294 |
|
|
6295 |
// set SMS port addresing for 16 Bit ports
|
|
6296 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, portother, port, ETrue);
|
|
6297 |
|
|
6298 |
// send SMS message
|
|
6299 |
SendSmsL(sendMessage,socket16);
|
|
6300 |
|
|
6301 |
WaitForRecvL(socket16other);
|
|
6302 |
recvMessage = RecvSmsL(socket16other);
|
|
6303 |
CleanupStack::PushL(recvMessage);
|
|
6304 |
|
|
6305 |
//compare sent and received messages
|
|
6306 |
TestSmsContentsL(recvMessage,buf);
|
|
6307 |
|
|
6308 |
//
|
|
6309 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
6310 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
6311 |
|
|
6312 |
CleanupStack::PopAndDestroy(&socket8other);
|
|
6313 |
CleanupStack::PopAndDestroy(&socket16other);
|
|
6314 |
CleanupStack::PopAndDestroy(&socket16);
|
|
6315 |
|
|
6316 |
// 027 send from the socket bound to 8-bit addressing port, to another
|
|
6317 |
// socket bound to 16-bit port, in presence of other socket bound
|
|
6318 |
// to the same 8-bit port
|
|
6319 |
|
|
6320 |
ret = socket8.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6321 |
TEST(ret==KErrNone);
|
|
6322 |
ret = socket8other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6323 |
TEST(ret==KErrNone);
|
|
6324 |
ret = socket16other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6325 |
TEST(ret==KErrNone);
|
|
6326 |
|
|
6327 |
// bind them to ports
|
|
6328 |
ret = socket8.Bind(addr8);
|
|
6329 |
TEST(ret==KErrNone);
|
|
6330 |
|
|
6331 |
ret = socket8other.Bind(addr8other);
|
|
6332 |
TEST(ret==KErrNone);
|
|
6333 |
|
|
6334 |
ret = socket16other.Bind(addr16other);
|
|
6335 |
TEST(ret==KErrNone);
|
|
6336 |
|
|
6337 |
CleanupClosePushL(socket8);
|
|
6338 |
CleanupClosePushL(socket8other);
|
|
6339 |
CleanupClosePushL(socket16other);
|
|
6340 |
|
|
6341 |
//
|
|
6342 |
// create SMS message
|
|
6343 |
buf.Format(_L("027 - SendingRecevingViaApplicationPortL Msg"));
|
|
6344 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
6345 |
CleanupStack::PushL(sendMessage);
|
|
6346 |
|
|
6347 |
// set SMS port addresing for 16 Bit ports
|
|
6348 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, portother, port, ETrue);
|
|
6349 |
|
|
6350 |
// send SMS message
|
|
6351 |
SendSmsL(sendMessage,socket8);
|
|
6352 |
|
|
6353 |
WaitForRecvL(socket16other);
|
|
6354 |
recvMessage = RecvSmsL(socket16other);
|
|
6355 |
CleanupStack::PushL(recvMessage);
|
|
6356 |
|
|
6357 |
//compare sent and received messages
|
|
6358 |
TestSmsContentsL(recvMessage,buf);
|
|
6359 |
|
|
6360 |
//
|
|
6361 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
6362 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
6363 |
|
|
6364 |
CleanupStack::PopAndDestroy(&socket16other);
|
|
6365 |
CleanupStack::PopAndDestroy(&socket8other);
|
|
6366 |
CleanupStack::PopAndDestroy(&socket8);
|
|
6367 |
|
|
6368 |
// 028 send from the socket bound to 16-bit addressing port, to another
|
|
6369 |
// socket bound to 8-bit port, in presence of another socket bound to the
|
|
6370 |
// same 16-bit port
|
|
6371 |
|
|
6372 |
ret = socket8other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6373 |
TEST(ret==KErrNone);
|
|
6374 |
ret = socket16.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6375 |
TEST(ret==KErrNone);
|
|
6376 |
ret = socket16other.Open(socketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
|
|
6377 |
TEST(ret==KErrNone);
|
|
6378 |
|
|
6379 |
// bind them to ports
|
|
6380 |
ret = socket8other.Bind(addr8other);
|
|
6381 |
TEST(ret==KErrNone);
|
|
6382 |
|
|
6383 |
ret = socket16.Bind(addr16);
|
|
6384 |
TEST(ret==KErrNone);
|
|
6385 |
|
|
6386 |
ret = socket16other.Bind(addr16other);
|
|
6387 |
TEST(ret==KErrNone);
|
|
6388 |
|
|
6389 |
CleanupClosePushL(socket8other);
|
|
6390 |
CleanupClosePushL(socket16);
|
|
6391 |
CleanupClosePushL(socket16other);
|
|
6392 |
|
|
6393 |
//
|
|
6394 |
// create SMS message
|
|
6395 |
buf.Format(_L("028 - SendingRecevingViaApplicationPortL Msg"));
|
|
6396 |
sendMessage=CreateSmsMessageL(buf,alphabet);
|
|
6397 |
CleanupStack::PushL(sendMessage);
|
|
6398 |
|
|
6399 |
// set SMS port addresing for 8 Bit ports
|
|
6400 |
sendMessage->SmsPDU().SetApplicationPortAddressingL(ETrue, portother, port, EFalse);
|
|
6401 |
|
|
6402 |
// send SMS message
|
|
6403 |
SendSmsL(sendMessage,socket16);
|
|
6404 |
|
|
6405 |
WaitForRecvL(socket8other);
|
|
6406 |
recvMessage = RecvSmsL(socket8other);
|
|
6407 |
CleanupStack::PushL(recvMessage);
|
|
6408 |
|
|
6409 |
//compare sent and received messages
|
|
6410 |
TestSmsContentsL(recvMessage,buf);
|
|
6411 |
|
|
6412 |
//
|
|
6413 |
|
|
6414 |
CleanupStack::PopAndDestroy(recvMessage);
|
|
6415 |
CleanupStack::PopAndDestroy(sendMessage);
|
|
6416 |
|
|
6417 |
CleanupStack::PopAndDestroy(&socket16other);
|
|
6418 |
CleanupStack::PopAndDestroy(&socket16);
|
|
6419 |
CleanupStack::PopAndDestroy(&socket8other);
|
|
6420 |
|
|
6421 |
INFO_PRINTF1(_L("Releasing handle to phone power property"));
|
|
6422 |
CleanupStack::PopAndDestroy(&phonePowerProperty);
|
|
6423 |
|
|
6424 |
//closing is too fast when using EKA2
|
|
6425 |
User::After(2000000);
|
|
6426 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
6427 |
User::After(2000000); // wait for socket to close before reopening
|
|
6428 |
}
|
|
6429 |
|
|
6430 |
|
|
6431 |
void CSmsInterTestStep::EnumerateAndWriteAndDeleteMessagesL(void)
|
|
6432 |
{
|
|
6433 |
TBool found( ETrue );
|
|
6434 |
TInt count( 0 );
|
|
6435 |
while( found )
|
|
6436 |
{
|
|
6437 |
//run the test
|
|
6438 |
found = DoSingleTestCaseL( KEnumerateAndWriteAndDeleteMessages, count++ );
|
|
6439 |
}
|
|
6440 |
}
|
|
6441 |
|
|
6442 |
void CSmsInterTestStep::PDUSlotStoreWithEnumerationL(void)
|
|
6443 |
{
|
|
6444 |
TBool found( ETrue );
|
|
6445 |
TInt count( 0 );
|
|
6446 |
while( found )
|
|
6447 |
{
|
|
6448 |
//run the test
|
|
6449 |
found = DoSingleTestCaseL( KPDUSlotStoreWithEnumeration, count++ );
|
|
6450 |
}
|
|
6451 |
}
|
|
6452 |
|
|
6453 |
void CSmsInterTestStep::DeleteMessagesWithoutEnumerationL(void)
|
|
6454 |
{
|
|
6455 |
TBool found( ETrue );
|
|
6456 |
TInt count( 0 );
|
|
6457 |
while( found )
|
|
6458 |
{
|
|
6459 |
//run the test
|
|
6460 |
found = DoSingleTestCaseL( KDeleteMessagesWithoutEnumeration, count++ );
|
|
6461 |
}
|
|
6462 |
}
|
|
6463 |
|
|
6464 |
void CSmsInterTestStep::SmartMessagingL(void)
|
|
6465 |
{
|
|
6466 |
TBool found( ETrue );
|
|
6467 |
TInt count( 0 );
|
|
6468 |
while( found )
|
|
6469 |
{
|
|
6470 |
//run the test
|
|
6471 |
found = DoSingleTestCaseL( KTestSmartMessaging, count++ );
|
|
6472 |
}
|
|
6473 |
}
|
|
6474 |
|
|
6475 |
void CSmsInterTestStep::RetrieveAndStoreSmsParamsL(void)
|
|
6476 |
{
|
|
6477 |
TBool found( ETrue );
|
|
6478 |
TInt count( 0 );
|
|
6479 |
while( found )
|
|
6480 |
{
|
|
6481 |
//run the test
|
|
6482 |
found = DoSingleTestCaseL( KRetrieveAndStoreSmsParams, count++ );
|
|
6483 |
}
|
|
6484 |
}
|
|
6485 |
void CSmsInterTestStep::DeletingMessageInEmptyStoreL(void)
|
|
6486 |
{
|
|
6487 |
TBool found( ETrue );
|
|
6488 |
TInt count( 0 );
|
|
6489 |
while( found )
|
|
6490 |
{
|
|
6491 |
//run the test
|
|
6492 |
found = DoSingleTestCaseL( KDeletingMessageInEmptyStore, count++ );
|
|
6493 |
}
|
|
6494 |
}
|
|
6495 |
void CSmsInterTestStep::SmsStoreMsgOfDifferentClassesL(void)
|
|
6496 |
{
|
|
6497 |
TBool found( ETrue );
|
|
6498 |
TInt count( 0 );
|
|
6499 |
while( found )
|
|
6500 |
{
|
|
6501 |
//run the test
|
|
6502 |
found = DoSingleTestCaseL( KSmsStoreMsgOfDifferentClasses, count++ );
|
|
6503 |
}
|
|
6504 |
}
|
|
6505 |
void CSmsInterTestStep::DuplicatePdusOnStoreL(void)
|
|
6506 |
{
|
|
6507 |
TBool found( ETrue );
|
|
6508 |
TInt count( 0 );
|
|
6509 |
while( found )
|
|
6510 |
{
|
|
6511 |
//run the test
|
|
6512 |
found = DoSingleTestCaseL( KDuplicatePdusOnStore, count++ );
|
|
6513 |
}
|
|
6514 |
}
|
|
6515 |
void CSmsInterTestStep::ConcatenatedMessagesL(void)
|
|
6516 |
{
|
|
6517 |
TBool found( ETrue );
|
|
6518 |
TInt count( 0 );
|
|
6519 |
while( found )
|
|
6520 |
{
|
|
6521 |
//run the test
|
|
6522 |
found = DoSingleTestCaseL( KConcatenatedMessages, count++ );
|
|
6523 |
}
|
|
6524 |
}
|
|
6525 |
void CSmsInterTestStep::OutOfMemoryWriteL(void)
|
|
6526 |
{
|
|
6527 |
TBool found( ETrue );
|
|
6528 |
TInt count( 0 );
|
|
6529 |
while( found )
|
|
6530 |
{
|
|
6531 |
//run the test
|
|
6532 |
found = DoSingleTestCaseL( KOutOfMemoryWrite, count++ );
|
|
6533 |
}
|
|
6534 |
}
|
|
6535 |
void CSmsInterTestStep::OutOfMemoryDeleteL(void)
|
|
6536 |
{
|
|
6537 |
TBool found( ETrue );
|
|
6538 |
TInt count( 0 );
|
|
6539 |
while( found )
|
|
6540 |
{
|
|
6541 |
//run the test
|
|
6542 |
found = DoSingleTestCaseL( KOutOfMemoryDelete, count++ );
|
|
6543 |
}
|
|
6544 |
}
|
|
6545 |
void CSmsInterTestStep::PublicMethodsL(void)
|
|
6546 |
{
|
|
6547 |
TBool found( ETrue );
|
|
6548 |
TInt count( 0 );
|
|
6549 |
while( found )
|
|
6550 |
{
|
|
6551 |
//run the test
|
|
6552 |
found = DoSingleTestCaseL( KTestPublicMethods, count++ );
|
|
6553 |
}
|
|
6554 |
}
|
|
6555 |
|
|
6556 |
void CSmsInterTestStep::SendAndReceive7bitMsgsL(void)
|
|
6557 |
{
|
|
6558 |
TBool found( ETrue );
|
|
6559 |
TInt count( 0 );
|
|
6560 |
while( found )
|
|
6561 |
{
|
|
6562 |
//run the test
|
|
6563 |
found = DoSingleTestCaseL( KTestSendAndReceive7bitMsgs, count++ );
|
|
6564 |
}
|
|
6565 |
}
|
|
6566 |
|
|
6567 |
void CSmsInterTestStep::SendAndReceive8bitMsgsL(void)
|
|
6568 |
{
|
|
6569 |
TBool found( ETrue );
|
|
6570 |
TInt count( 0 );
|
|
6571 |
while( found )
|
|
6572 |
{
|
|
6573 |
//run the test
|
|
6574 |
found = DoSingleTestCaseL( KTestSendAndReceive8bitMsgs, count++ );
|
|
6575 |
}
|
|
6576 |
}
|
|
6577 |
|
|
6578 |
void CSmsInterTestStep::SendAndReceive16bitMsgsL(void)
|
|
6579 |
{
|
|
6580 |
TBool found( ETrue );
|
|
6581 |
TInt count( 0 );
|
|
6582 |
while( found )
|
|
6583 |
{
|
|
6584 |
//run the test
|
|
6585 |
found = DoSingleTestCaseL( KTestSendAndReceive16bitMsgs, count++ );
|
|
6586 |
}
|
|
6587 |
}
|
|
6588 |
|
|
6589 |
void CSmsInterTestStep::SendAndReceiveConcatenatedMsgsL(void)
|
|
6590 |
{
|
|
6591 |
TBool found( ETrue );
|
|
6592 |
TInt count( 0 );
|
|
6593 |
while( found )
|
|
6594 |
{
|
|
6595 |
//run the test
|
|
6596 |
found = DoSingleTestCaseL( KTestSendAndReceiveConcatenatedMsgs, count++ );
|
|
6597 |
}
|
|
6598 |
}
|
|
6599 |
void CSmsInterTestStep::SendAndReceiveDifferentIEIsL(void)
|
|
6600 |
{
|
|
6601 |
TBool found( ETrue );
|
|
6602 |
TInt count( 0 );
|
|
6603 |
while( found )
|
|
6604 |
{
|
|
6605 |
//run the test
|
|
6606 |
found = DoSingleTestCaseL( KTestSendAndReceiveDifferentIEIs, count++ );
|
|
6607 |
}
|
|
6608 |
}
|
|
6609 |
void CSmsInterTestStep::SendAndReceiveBinaryDataL(void)
|
|
6610 |
{
|
|
6611 |
TBool found( ETrue );
|
|
6612 |
TInt count( 0 );
|
|
6613 |
while( found )
|
|
6614 |
{
|
|
6615 |
//run the test
|
|
6616 |
found = DoSingleTestCaseL( KTestSendAndReceiveBinaryData, count++ );
|
|
6617 |
}
|
|
6618 |
}
|
|
6619 |
|
|
6620 |
void CSmsInterTestStep::SendSMS2Port0000L(void)
|
|
6621 |
{
|
|
6622 |
TBool found( ETrue );
|
|
6623 |
TInt count( 0 );
|
|
6624 |
while( found )
|
|
6625 |
{
|
|
6626 |
//run the test
|
|
6627 |
found = DoSingleTestCaseL( KTestSendSMS2Port0000, count++ );
|
|
6628 |
}
|
|
6629 |
}
|
|
6630 |
|
|
6631 |
void CSmsInterTestStep::Connect2EsockLC(RSocketServ& aSocketServer)
|
|
6632 |
/**
|
|
6633 |
* seperating the connection to esock due to calling in every test case
|
|
6634 |
*/
|
|
6635 |
{
|
|
6636 |
// delete segmentation and reassembly store files before the test
|
|
6637 |
_LIT(KReassemblyStoreName,"C:\\Private\\101F7989\\sms\\smsreast.dat");
|
|
6638 |
_LIT(KSegmentationStoreName,"C:\\Private\\101F7989\\sms\\smssegst.dat");
|
|
6639 |
|
|
6640 |
TInt ret=0;
|
|
6641 |
ret=iFs.Delete(KReassemblyStoreName);
|
|
6642 |
ret=iFs.Delete(KSegmentationStoreName);
|
|
6643 |
|
|
6644 |
INFO_PRINTF1(_L(" ... Connecting to Socket Server ... ") );
|
|
6645 |
|
|
6646 |
ret=aSocketServer.Connect(KSocketMessageSlots);
|
|
6647 |
TEST(ret==KErrNone);
|
|
6648 |
CleanupClosePushL(aSocketServer);
|
|
6649 |
|
|
6650 |
}
|
|
6651 |
|
|
6652 |
CSmsMessage* CSmsInterTestStep::CreateSmsMessageL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet, CSmsPDU::TSmsPDUType aType)
|
|
6653 |
/**
|
|
6654 |
* Create a uninitialised SMS message
|
|
6655 |
* @param aDes contains text that will be inserted to the pdu
|
|
6656 |
* @param aAlphabet describes the alphabet of the pdu
|
|
6657 |
* @return CSmsMessage* :Pointer to the created CSmsMessage object.
|
|
6658 |
*/
|
|
6659 |
{
|
|
6660 |
CSmsBuffer* buffer=CSmsBuffer::NewL();
|
|
6661 |
CSmsMessage* smsMessage=CSmsMessage::NewL(iFs, aType, buffer);
|
|
6662 |
CleanupStack::PushL(smsMessage);
|
|
6663 |
|
|
6664 |
TSmsUserDataSettings smsSettings;
|
|
6665 |
smsSettings.SetAlphabet(aAlphabet);
|
|
6666 |
smsSettings.SetTextCompressed(EFalse);
|
|
6667 |
smsMessage->SetUserDataSettingsL(smsSettings);
|
|
6668 |
|
|
6669 |
smsMessage->SetToFromAddressL(iTelephoneNumber);
|
|
6670 |
smsMessage->SmsPDU().SetServiceCenterAddressL(iServiceCenterNumber);
|
|
6671 |
buffer->InsertL(0,aDes);
|
|
6672 |
CleanupStack::Pop(smsMessage);
|
|
6673 |
return smsMessage;
|
|
6674 |
}
|
|
6675 |
|
|
6676 |
CSmsMessage* CSmsInterTestStep::CreateSmsWithStatusReportReqL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet)
|
|
6677 |
/**
|
|
6678 |
* Create a uninitialised SMS message with Status Report request
|
|
6679 |
* @param aDes contains text that will be inserted to the pdu
|
|
6680 |
* @param aAlphabet describes the alphabet of the pdu
|
|
6681 |
* @return CSmsMessage* :Pointer to the created CSmsMessage object.
|
|
6682 |
*/
|
|
6683 |
{
|
|
6684 |
CSmsMessage* smsMessage=CreateSmsMessageL(aDes, aAlphabet);
|
|
6685 |
|
|
6686 |
CleanupStack::PushL(smsMessage);
|
|
6687 |
|
|
6688 |
//Set Status report request
|
|
6689 |
CSmsSubmit& submitPdu=(CSmsSubmit&)smsMessage->SmsPDU();
|
|
6690 |
submitPdu.SetStatusReportRequest(ETrue);
|
|
6691 |
|
|
6692 |
CleanupStack::Pop(smsMessage);
|
|
6693 |
return smsMessage;
|
|
6694 |
}
|
|
6695 |
|
|
6696 |
void CSmsInterTestStep::OpenSmsSocketMatchTextLC(RSocketServ& aSocketServer, RSocket& aSocket, TSmsAddrFamily aFamily, TDesC8* aTextMatch)
|
|
6697 |
/**
|
|
6698 |
* Initialise an RSocket for SMS, aSocket is pushed to CleanupStack.
|
|
6699 |
* @param aSocket The socket that will be opened
|
|
6700 |
* @param aFamily The sms address family
|
|
6701 |
* @param aTextMatch The text to which the socket is bound to match
|
|
6702 |
*/
|
|
6703 |
{
|
|
6704 |
TInt ret=aSocket.Open(aSocketServer,KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol);
|
|
6705 |
TEST(ret==KErrNone);
|
|
6706 |
CleanupClosePushL(aSocket);
|
|
6707 |
|
|
6708 |
//aFamily must be ESmsAddrMatchText!
|
|
6709 |
TEST(aFamily == ESmsAddrMatchText);
|
|
6710 |
|
|
6711 |
TSmsAddr smsaddr;
|
|
6712 |
smsaddr.SetSmsAddrFamily(aFamily);
|
|
6713 |
// _LIT(KTextMatch,"\\SCK");
|
|
6714 |
smsaddr.SetTextMatch(*aTextMatch);
|
|
6715 |
User::LeaveIfError(aSocket.Bind(smsaddr));
|
|
6716 |
}
|
|
6717 |
|
|
6718 |
void CSmsInterTestStep::SendSimpleSmsL(RSocket& aSocket)
|
|
6719 |
/**
|
|
6720 |
* Open the socket for sending a sms message
|
|
6721 |
* then stream the message out to the socket server
|
|
6722 |
* and wait for request to see that the message have been sent without any error
|
|
6723 |
* @leave Leaves if streaming the message to the socket server doesn't succeed
|
|
6724 |
* @leave Leaves if sending is completed with error code
|
|
6725 |
*/
|
|
6726 |
{
|
|
6727 |
// Create message with SRR
|
|
6728 |
_LIT(KText,"This is a simple SMS!");
|
|
6729 |
CSmsMessage* msg=CreateSmsMessageL(KText,TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
6730 |
CleanupStack::PushL(msg);
|
|
6731 |
|
|
6732 |
// Send message
|
|
6733 |
RSmsSocketWriteStream writestream(aSocket);
|
|
6734 |
TRAPD(ret,writestream << *msg);
|
|
6735 |
TEST(ret==KErrNone);
|
|
6736 |
TRAP(ret,writestream.CommitL());
|
|
6737 |
TEST(ret==KErrNone);
|
|
6738 |
|
|
6739 |
TPckgBuf<TUint> sbuf;
|
|
6740 |
TRequestStatus status;
|
|
6741 |
aSocket.Ioctl(KIoctlSendSmsMessage,status,&sbuf, KSolSmsProv);
|
|
6742 |
User::WaitForRequest(status);
|
|
6743 |
TEST(status.Int()==KErrNone);
|
|
6744 |
|
|
6745 |
CleanupStack::PopAndDestroy(msg);
|
|
6746 |
}
|
|
6747 |
|
|
6748 |
void CSmsInterTestStep::SendSmsL(const CSmsMessage* aSms, RSocket& aSocket)
|
|
6749 |
/**
|
|
6750 |
* Stream aSms out to the socket server
|
|
6751 |
* @param aSms contains the sms tpdu that will be streamed to the sms stack
|
|
6752 |
* @param aSocket is used to stream the aSms to the sms stack
|
|
6753 |
* @leave Leaves if streaming the message to the socket server doesn't succeed
|
|
6754 |
* @leave Leaves if sending is completed with error code
|
|
6755 |
*/
|
|
6756 |
{
|
|
6757 |
TBool tryAgain = ETrue;
|
|
6758 |
TInt sendTry (0);
|
|
6759 |
TRequestStatus status = KErrNone;
|
|
6760 |
|
|
6761 |
while (tryAgain && sendTry < 3)
|
|
6762 |
{
|
|
6763 |
RSmsSocketWriteStream writestream(aSocket);
|
|
6764 |
TRAPD(ret,writestream << *aSms);
|
|
6765 |
|
|
6766 |
TRAP(ret,writestream.CommitL());
|
|
6767 |
|
|
6768 |
TPckgBuf<TUint> sbuf;
|
|
6769 |
aSocket.Ioctl(KIoctlSendSmsMessage,status,&sbuf, KSolSmsProv);
|
|
6770 |
User::WaitForRequest(status);
|
|
6771 |
INFO_PRINTF2(_L("SendSmsL - sendSmsMessage returned %d"), status.Int());
|
|
6772 |
if (status.Int() )
|
|
6773 |
{
|
|
6774 |
tryAgain = ETrue;
|
|
6775 |
INFO_PRINTF1(_L("Try again... "));
|
|
6776 |
sendTry++;
|
|
6777 |
}
|
|
6778 |
else tryAgain = EFalse;
|
|
6779 |
}
|
|
6780 |
|
|
6781 |
TEST(status.Int()==KErrNone);
|
|
6782 |
|
|
6783 |
PrintMessageL(aSms);
|
|
6784 |
}
|
|
6785 |
|
|
6786 |
void CSmsInterTestStep::SendSmsErrorL(CSmsMessage* aSms, RSocket& aSocket)
|
|
6787 |
/**
|
|
6788 |
* Stream aSms out to the socket server. Sending is completed with error code.
|
|
6789 |
* @param aSms contains the sms tpdu that will be streamed to the sms stack
|
|
6790 |
* @param aSocket is used to stream the aSms to the sms stack
|
|
6791 |
* @leave Leaves if streaming the message to the socket server doesn't succeed
|
|
6792 |
* @leave Leaves if sending is completed with KErrNone
|
|
6793 |
*/
|
|
6794 |
{
|
|
6795 |
RSmsSocketWriteStream writestream(aSocket);
|
|
6796 |
TRAPD(ret,writestream << *aSms);
|
|
6797 |
TEST(ret==KErrNone);
|
|
6798 |
TRAP(ret,writestream.CommitL());
|
|
6799 |
TEST(ret==KErrNone);
|
|
6800 |
|
|
6801 |
TPckgBuf<TUint> sbuf;
|
|
6802 |
TRequestStatus status;
|
|
6803 |
|
|
6804 |
User::After(50000);
|
|
6805 |
// test cancel first
|
|
6806 |
aSocket.Ioctl(KIoctlSendSmsMessage,status,&sbuf, KSolSmsProv);
|
|
6807 |
aSocket.CancelIoctl();
|
|
6808 |
User::WaitForRequest(status);
|
|
6809 |
TEST(status.Int()==KErrCancel);
|
|
6810 |
|
|
6811 |
//Now send again, completed with error
|
|
6812 |
TRAP(ret,writestream << *aSms);
|
|
6813 |
TEST(ret==KErrNone);
|
|
6814 |
TRAP(ret,writestream.CommitL());
|
|
6815 |
TEST(ret==KErrNone);
|
|
6816 |
|
|
6817 |
aSocket.Ioctl(KIoctlSendSmsMessage,status,&sbuf, KSolSmsProv);
|
|
6818 |
User::WaitForRequest(status);
|
|
6819 |
INFO_PRINTF2(_L("SendSmsL - sendSmsMessage returned %d"), status.Int());
|
|
6820 |
PrintMessageL(aSms);
|
|
6821 |
INFO_PRINTF2(_L("Sending failed! %d"), status.Int());
|
|
6822 |
TEST(status.Int() != KErrNone);
|
|
6823 |
}
|
|
6824 |
|
|
6825 |
void CSmsInterTestStep::SendSmsDontCheckReturnValueL(CSmsMessage* aSms, RSocket& aSocket)
|
|
6826 |
/**
|
|
6827 |
* Stream aSms out to the socket server and don't check return value.
|
|
6828 |
* @param aSms contains the sms tpdu that will be streamed to the sms stack
|
|
6829 |
* @param aSocket is used to stream the aSms to the sms stack
|
|
6830 |
* @leave Leaves if streaming the message to the socket server doesn't succeed
|
|
6831 |
* @leave Leaves if sending is completed with KErrNone
|
|
6832 |
*/
|
|
6833 |
{
|
|
6834 |
RSmsSocketWriteStream writestream(aSocket);
|
|
6835 |
writestream << *aSms;
|
|
6836 |
writestream.CommitL();
|
|
6837 |
|
|
6838 |
TPckgBuf<TUint> sbuf;
|
|
6839 |
TRequestStatus status;
|
|
6840 |
aSocket.Ioctl(KIoctlSendSmsMessage,status,&sbuf, KSolSmsProv);
|
|
6841 |
User::WaitForRequest(status);
|
|
6842 |
INFO_PRINTF2(_L("Send SMS message returned %d"), status.Int());
|
|
6843 |
if(status.Int() != KErrNone)
|
|
6844 |
User::Leave(status.Int());
|
|
6845 |
}
|
|
6846 |
|
|
6847 |
void CSmsInterTestStep::SendCommandSmsL(CSmsMessage* aSms, RSocket& aSocket)
|
|
6848 |
/**
|
|
6849 |
* Stream command message out to the socket server and wait for the return status
|
|
6850 |
* @param aSms contains the sms tpdu that will be streamed to the sms stack
|
|
6851 |
* @param aSocket is used to stream the aSms to the sms stack
|
|
6852 |
* @leave Leaves if streaming the message to the socket server doesn't succeed
|
|
6853 |
* @leave Leaves if sending is completed with error code
|
|
6854 |
*/
|
|
6855 |
{
|
|
6856 |
RSmsSocketWriteStream writestream(aSocket);
|
|
6857 |
TRAPD(ret,writestream << *aSms);
|
|
6858 |
TEST(ret==KErrNone);
|
|
6859 |
TRAP(ret,writestream.CommitL());
|
|
6860 |
TEST(ret==KErrNone);
|
|
6861 |
|
|
6862 |
TRequestStatus status;
|
|
6863 |
TPckgBuf<TUint> sbuf;
|
|
6864 |
aSocket.Ioctl(KIoctlSendSmsMessage,status,&sbuf,KSolSmsProv);
|
|
6865 |
|
|
6866 |
User::WaitForRequest(status);
|
|
6867 |
|
|
6868 |
INFO_PRINTF2(_L("SendCommandSmsL, sendSms returned %d"), status.Int());
|
|
6869 |
User::After(1000000);
|
|
6870 |
TEST(status.Int()==KErrNone);
|
|
6871 |
|
|
6872 |
}
|
|
6873 |
|
|
6874 |
void CSmsInterTestStep::SendSmsCancelL(CSmsMessage* aSms, RSocket& aSocket1, RSocket& aSocket2)
|
|
6875 |
/**
|
|
6876 |
* Stream Sms out to the socket server by two RSmsSocketWriteStream object.
|
|
6877 |
* The first request is canceled and then the second request is completed with error code.
|
|
6878 |
* @param aSms contains the sms tpdu that will be streamed to the sms stack
|
|
6879 |
* @param aSocket1 The socket used with message that will be canceled
|
|
6880 |
* @param aSocket2 The socket used with message that will be completed with error code
|
|
6881 |
* @leave Leaves if streaming the message to the socket server doesn't succeed
|
|
6882 |
* @leave Leaves if sending is completed with KErrNone
|
|
6883 |
*/
|
|
6884 |
{
|
|
6885 |
RSmsSocketWriteStream writestream(aSocket1);
|
|
6886 |
TRAPD(ret,writestream << *aSms);
|
|
6887 |
TEST(ret==KErrNone);
|
|
6888 |
TRAP(ret,writestream.CommitL());
|
|
6889 |
TEST(ret==KErrNone);
|
|
6890 |
|
|
6891 |
TPckgBuf<TUint> sbuf;
|
|
6892 |
TRequestStatus status1,status2;
|
|
6893 |
|
|
6894 |
//stream to socket2
|
|
6895 |
RSmsSocketWriteStream writestream2(aSocket2);
|
|
6896 |
TRAP(ret,writestream2 << *aSms);
|
|
6897 |
TEST(ret==KErrNone);
|
|
6898 |
TRAP(ret,writestream2.CommitL());
|
|
6899 |
TEST(ret==KErrNone);
|
|
6900 |
|
|
6901 |
aSocket1.Ioctl(KIoctlSendSmsMessage,status1,&sbuf, KSolSmsProv);
|
|
6902 |
aSocket2.Ioctl(KIoctlSendSmsMessage,status2,&sbuf, KSolSmsProv);
|
|
6903 |
|
|
6904 |
User::After(2000000);
|
|
6905 |
|
|
6906 |
// Test cancel first
|
|
6907 |
aSocket1.CancelIoctl();
|
|
6908 |
User::WaitForRequest(status1);
|
|
6909 |
TEST(status1.Int()==KErrCancel);
|
|
6910 |
|
|
6911 |
User::After(50000);
|
|
6912 |
|
|
6913 |
|
|
6914 |
User::WaitForRequest(status2);
|
|
6915 |
|
|
6916 |
INFO_PRINTF2(_L("SendSmsL - sendSmsMessage returned %d"), status2.Int());
|
|
6917 |
PrintMessageL(aSms);
|
|
6918 |
|
|
6919 |
//Ensure the request is completed with error code ;)
|
|
6920 |
TEST(status2.Int() != KErrNone);
|
|
6921 |
INFO_PRINTF2(_L("Sending failed! %d"), status2.Int());
|
|
6922 |
}
|
|
6923 |
|
|
6924 |
void CSmsInterTestStep::SendAndRecvAndCompareMessageIEIL(const TDesC& aUserData,
|
|
6925 |
const TDesC8& aIEIOctets,
|
|
6926 |
RSocket& aSocket,
|
|
6927 |
TSmsDataCodingScheme::TSmsAlphabet aSmsAlphabet,
|
|
6928 |
CSmsInformationElement::TSmsInformationElementIdentifier aIEI)
|
|
6929 |
/**
|
|
6930 |
* Send and receive message. Compare sent and received message.
|
|
6931 |
* @param aUserData reference to message user data
|
|
6932 |
* @param aSocket reference to socket that is used for sending and receiving
|
|
6933 |
* @param aSmsAlphabet alphabet info is used while creating message
|
|
6934 |
* @param aIEI messages information element
|
|
6935 |
*/
|
|
6936 |
{
|
|
6937 |
CSmsMessage* sendMessage = CreateSmsMessageL(aUserData, aSmsAlphabet);
|
|
6938 |
CleanupStack::PushL(sendMessage);
|
|
6939 |
CSmsPDU& sendPdu = sendMessage->SmsPDU();
|
|
6940 |
CSmsUserData& sendUserData = sendPdu.UserData();
|
|
6941 |
sendUserData.AddInformationElementL(aIEI,aIEIOctets);
|
|
6942 |
SendSmsL(sendMessage,aSocket);
|
|
6943 |
|
|
6944 |
WaitForRecvL(aSocket);
|
|
6945 |
CSmsMessage* recvMessage = RecvSmsL(aSocket);
|
|
6946 |
CleanupStack::PushL(recvMessage);
|
|
6947 |
CSmsPDU& recvPdu = recvMessage->SmsPDU();
|
|
6948 |
CSmsUserData& recvUserData = recvPdu.UserData();
|
|
6949 |
|
|
6950 |
//compare send and received messages
|
|
6951 |
TestSmsContentsL(recvMessage,aUserData);
|
|
6952 |
CSmsInformationElement& sendInformationElement = sendUserData.InformationElement(0);
|
|
6953 |
if((sendInformationElement.Identifier() != CSmsInformationElement::ESmsIEIConcatenatedShortMessages8BitReference) &&
|
|
6954 |
(sendInformationElement.Identifier() != CSmsInformationElement::ESmsIEIConcatenatedShortMessages16BitReference))
|
|
6955 |
{
|
|
6956 |
CSmsInformationElement& recvInformationElement2 = recvUserData.InformationElement(0);
|
|
6957 |
TEST(sendInformationElement.Identifier() == recvInformationElement2.Identifier());
|
|
6958 |
}
|
|
6959 |
CleanupStack::PopAndDestroy(2); //sendMessage,recvMessage
|
|
6960 |
}
|
|
6961 |
|
|
6962 |
void CSmsInterTestStep::WaitForRecvL(RSocket& aSocket)
|
|
6963 |
/**
|
|
6964 |
* Wait for an Sms to be received
|
|
6965 |
* @param aSocket The status is return to this socket
|
|
6966 |
* @leave Leaves if receiving is completed with error code
|
|
6967 |
*/
|
|
6968 |
{
|
|
6969 |
TPckgBuf<TUint> sbuf;
|
|
6970 |
sbuf()=KSockSelectRead;
|
|
6971 |
TRequestStatus status;
|
|
6972 |
aSocket.Ioctl(KIOctlSelect,status,&sbuf,KSOLSocket);
|
|
6973 |
User::WaitForRequest(status);
|
|
6974 |
TEST(status.Int()==KErrNone);
|
|
6975 |
}
|
|
6976 |
|
|
6977 |
TBool CSmsInterTestStep::TimedWaitForRecvL(RSocket& aSocket, TUint aDelay)
|
|
6978 |
/**
|
|
6979 |
* Wait for up to the delay for an Sms to be received
|
|
6980 |
* @param aSocket The status is return to this socket
|
|
6981 |
* @param aDelay Maximum time to wait for receipt
|
|
6982 |
* @return ETrue if data received
|
|
6983 |
* @leave Leaves if receiving is completed with error code
|
|
6984 |
*/
|
|
6985 |
{
|
|
6986 |
TRequestStatus timerStatus;
|
|
6987 |
RTimer timer;
|
|
6988 |
timer.CreateLocal();
|
|
6989 |
timer.After(timerStatus, TTimeIntervalMicroSeconds32(aDelay));
|
|
6990 |
|
|
6991 |
TPckgBuf<TUint> sbuf;
|
|
6992 |
sbuf()=KSockSelectRead;
|
|
6993 |
TRequestStatus ioctlStatus;
|
|
6994 |
aSocket.Ioctl(KIOctlSelect, ioctlStatus, &sbuf, KSOLSocket);
|
|
6995 |
User::WaitForRequest(timerStatus, ioctlStatus);
|
|
6996 |
TBool retval;
|
|
6997 |
if(ioctlStatus.Int() != KErrNone)
|
|
6998 |
{
|
|
6999 |
aSocket.CancelIoctl();
|
|
7000 |
User::WaitForRequest(ioctlStatus);
|
|
7001 |
retval = EFalse;
|
|
7002 |
}
|
|
7003 |
else
|
|
7004 |
{
|
|
7005 |
timer.Cancel();
|
|
7006 |
User::WaitForRequest(timerStatus);
|
|
7007 |
retval = ETrue;
|
|
7008 |
}
|
|
7009 |
timer.Close();
|
|
7010 |
return retval;
|
|
7011 |
}
|
|
7012 |
|
|
7013 |
CSmsMessage* CSmsInterTestStep::RecvSmsL(RSocket& aSocket, TInt aIoctl)
|
|
7014 |
/**
|
|
7015 |
* Receive an Sms
|
|
7016 |
* @param aSocket is used to stream the sms message from the socket server
|
|
7017 |
* @return CSmsMessage* :Sms message from Sms stack
|
|
7018 |
* @leave Leaves if streaming the message from the socket server doesn't succeed
|
|
7019 |
*/
|
|
7020 |
{
|
|
7021 |
CSmsBuffer* buffer=CSmsBuffer::NewL();
|
|
7022 |
CSmsMessage* smsMessage=CSmsMessage::NewL(iFs, CSmsPDU::ESmsSubmit,buffer);
|
|
7023 |
CleanupStack::PushL(smsMessage);
|
|
7024 |
|
|
7025 |
RSmsSocketReadStream readstream(aSocket);
|
|
7026 |
TRAPD(ret,readstream >> *smsMessage);
|
|
7027 |
TEST(ret==KErrNone);
|
|
7028 |
|
|
7029 |
TPckgBuf<TUint> sbuf;
|
|
7030 |
TRequestStatus status;
|
|
7031 |
aSocket.Ioctl(aIoctl, status, &sbuf, KSolSmsProv);
|
|
7032 |
User::WaitForRequest(status);
|
|
7033 |
|
|
7034 |
CleanupStack::Pop(smsMessage);
|
|
7035 |
return smsMessage;
|
|
7036 |
}
|
|
7037 |
|
|
7038 |
CSmsMessage* CSmsInterTestStep::RecvSmsFailedL(RSocket& aSocket)
|
|
7039 |
/**
|
|
7040 |
* Receive an Sms, first nack the receive several times before succeeding
|
|
7041 |
* @param aSocket is used to stream the sms message from the socket server
|
|
7042 |
* @return CSmsMessage* :Sms message from Sms stack
|
|
7043 |
* @leave Leaves if streaming the message from the socket server doesn't succeed
|
|
7044 |
* @leave Leaves if nack of receiving is completed with error code
|
|
7045 |
* @leave Leaves if ack of receiving is completed with error code
|
|
7046 |
*/
|
|
7047 |
{
|
|
7048 |
CSmsBuffer* buffer=CSmsBuffer::NewL();
|
|
7049 |
CSmsMessage* smsMessage=CSmsMessage::NewL(iFs, CSmsPDU::ESmsSubmit,buffer);
|
|
7050 |
CleanupStack::PushL(smsMessage);
|
|
7051 |
RSmsSocketReadStream readstream(aSocket);
|
|
7052 |
|
|
7053 |
TPckgBuf<TUint> sbuf;
|
|
7054 |
TRequestStatus status;
|
|
7055 |
|
|
7056 |
for(TInt i=0; i<10; i++)
|
|
7057 |
{
|
|
7058 |
TRAPD(ret,readstream >> *smsMessage);
|
|
7059 |
TEST(ret==KErrNone);
|
|
7060 |
aSocket.Ioctl(KIoctlReadMessageFailed, status, &sbuf, KSolSmsProv);
|
|
7061 |
User::WaitForRequest(status);
|
|
7062 |
TEST(status.Int()==KErrNone);
|
|
7063 |
}
|
|
7064 |
|
|
7065 |
TRAPD(ret,readstream >> *smsMessage);
|
|
7066 |
TEST(ret==KErrNone);
|
|
7067 |
aSocket.Ioctl(KIoctlReadMessageSucceeded, status, NULL, KSolSmsProv);
|
|
7068 |
User::WaitForRequest(status);
|
|
7069 |
TEST(status.Int()==KErrNone);
|
|
7070 |
|
|
7071 |
CleanupStack::Pop(smsMessage);
|
|
7072 |
return smsMessage;
|
|
7073 |
}
|
|
7074 |
|
|
7075 |
void CSmsInterTestStep::RecvStatusReportL(TSmsServiceCenterAddress& aRecipientNumber, RSocket& aSocket)
|
|
7076 |
/**
|
|
7077 |
* Receive a Status report
|
|
7078 |
* @param aRecipientNumber The supposed recipient number
|
|
7079 |
* @param aSocket is used to stream the sms message from the socket server
|
|
7080 |
*/
|
|
7081 |
{
|
|
7082 |
//Receive SMS
|
|
7083 |
WaitForRecvL(aSocket);
|
|
7084 |
CSmsMessage* smsMessage = RecvSmsL(aSocket);
|
|
7085 |
CleanupStack::PushL(smsMessage);
|
|
7086 |
|
|
7087 |
//Check the status report
|
|
7088 |
TBool isSR = (smsMessage->Type()==CSmsPDU::ESmsStatusReport);
|
|
7089 |
if (isSR)
|
|
7090 |
{
|
|
7091 |
INFO_PRINTF1(_L("Received status report"));
|
|
7092 |
TSmsServiceCenterAddress telephoneNumber=smsMessage->ToFromAddress();
|
|
7093 |
TEST(telephoneNumber==aRecipientNumber);
|
|
7094 |
INFO_PRINTF2(_L("Message delivered to %S "),&telephoneNumber);
|
|
7095 |
}
|
|
7096 |
else
|
|
7097 |
INFO_PRINTF1(_L("Received SMS is NOT a Status report!"));
|
|
7098 |
|
|
7099 |
TEST(isSR);
|
|
7100 |
|
|
7101 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
7102 |
}
|
|
7103 |
|
|
7104 |
void CSmsInterTestStep::ReadSmsStoreL(RSocket& aSocket, RPointerArray<CSmsMessage>& aMessages)
|
|
7105 |
/**
|
|
7106 |
* This method retrieves SMS messages from SMS storage and print them out.
|
|
7107 |
* @param aSocket Used to stream SMS messages from the socket server
|
|
7108 |
* @param aMessages Sms messages will be streamed to this array
|
|
7109 |
* @leave Leaves if first request is NOT completed with KErrCancel
|
|
7110 |
* @leave Leaves if second request is completed with error code
|
|
7111 |
* @leave Leaves if streaming the message from the socket server doesn't succeed
|
|
7112 |
* @leave Leaves if nack of reading is completed with error code
|
|
7113 |
* @leave Leaves if ack of reading is completed with error code
|
|
7114 |
*/
|
|
7115 |
{
|
|
7116 |
INFO_PRINTF1(_L("Enumerating messages"));
|
|
7117 |
|
|
7118 |
TRequestStatus status;
|
|
7119 |
|
|
7120 |
TPckgBuf<TUint> sbuf;
|
|
7121 |
sbuf()=0;
|
|
7122 |
|
|
7123 |
// test cancel first - due to Lubbock problems canceled out
|
|
7124 |
aSocket.Ioctl(KIoctlEnumerateSmsMessages,status,&sbuf, KSolSmsProv);
|
|
7125 |
aSocket.CancelIoctl();
|
|
7126 |
User::WaitForRequest(status);
|
|
7127 |
INFO_PRINTF2(_L(" status = %d "),status.Int());
|
|
7128 |
TEST((status.Int()==KErrCancel) ||(status.Int()==KErrNone));
|
|
7129 |
|
|
7130 |
User::After(2000000);
|
|
7131 |
|
|
7132 |
//Now enumerate messages from store
|
|
7133 |
aSocket.Ioctl(KIoctlEnumerateSmsMessages,status,&sbuf, KSolSmsProv);
|
|
7134 |
User::WaitForRequest(status);
|
|
7135 |
TEST(status.Int()==KErrNone);
|
|
7136 |
|
|
7137 |
User::After(2000000);
|
|
7138 |
|
|
7139 |
|
|
7140 |
|
|
7141 |
//sbuf() includes the count of messages on Store
|
|
7142 |
TInt count = sbuf();
|
|
7143 |
INFO_PRINTF2(_L("%d enumerated messages"), count);
|
|
7144 |
|
|
7145 |
RSmsSocketReadStream readstream(aSocket);
|
|
7146 |
|
|
7147 |
//Read each message from the stream
|
|
7148 |
for(TInt i=0; i< count; i++)
|
|
7149 |
{
|
|
7150 |
CSmsBuffer* buffer=CSmsBuffer::NewL();
|
|
7151 |
CSmsMessage* smsmessage=CSmsMessage::NewL(iFs, CSmsPDU::ESmsDeliver,buffer);
|
|
7152 |
CleanupStack::PushL(smsmessage);
|
|
7153 |
|
|
7154 |
TRAPD(ret,readstream >> *smsmessage);
|
|
7155 |
TEST(ret==KErrNone);
|
|
7156 |
aSocket.Ioctl(KIoctlReadMessageFailed, status, NULL, KSolSmsProv);
|
|
7157 |
User::WaitForRequest(status);
|
|
7158 |
TEST(status.Int()==KErrNone);
|
|
7159 |
|
|
7160 |
TRAP(ret,readstream >> *smsmessage);
|
|
7161 |
TEST(ret==KErrNone);
|
|
7162 |
aSocket.Ioctl(KIoctlReadMessageSucceeded, status, NULL, KSolSmsProv);
|
|
7163 |
User::WaitForRequest(status);
|
|
7164 |
TEST(status.Int()==KErrNone);
|
|
7165 |
|
|
7166 |
INFO_PRINTF1(smsmessage->ToFromAddress());
|
|
7167 |
INFO_PRINTF1(_L(" "));
|
|
7168 |
INFO_PRINTF1(smsmessage->ServiceCenterAddress());
|
|
7169 |
INFO_PRINTF1(_L(""));
|
|
7170 |
|
|
7171 |
if(smsmessage->Storage() == CSmsMessage::ESmsSIMStorage)
|
|
7172 |
INFO_PRINTF1(_L("Store: SIM"));
|
|
7173 |
else if (smsmessage->Storage() == CSmsMessage::ESmsPhoneStorage)
|
|
7174 |
INFO_PRINTF1(_L("Store: Phone"));
|
|
7175 |
else if (smsmessage->Storage() == CSmsMessage::ESmsCombinedStorage)
|
|
7176 |
INFO_PRINTF1(_L("Store: Combined"));
|
|
7177 |
else INFO_PRINTF1(_L("Store: Unknown"));
|
|
7178 |
|
|
7179 |
|
|
7180 |
switch (smsmessage->Status())
|
|
7181 |
{
|
|
7182 |
case RMobileSmsStore::EStoredMessageUnread:
|
|
7183 |
INFO_PRINTF1(_L("Status: Unread"));
|
|
7184 |
break;
|
|
7185 |
|
|
7186 |
case RMobileSmsStore::EStoredMessageRead:
|
|
7187 |
INFO_PRINTF1(_L("Status: Read"));
|
|
7188 |
break;
|
|
7189 |
|
|
7190 |
case RMobileSmsStore::EStoredMessageUnsent:
|
|
7191 |
INFO_PRINTF1(_L("Status: Unsent"));
|
|
7192 |
break;
|
|
7193 |
|
|
7194 |
case RMobileSmsStore::EStoredMessageSent:
|
|
7195 |
INFO_PRINTF1(_L("Status: Sent"));
|
|
7196 |
break;
|
|
7197 |
|
|
7198 |
case RMobileSmsStore::EStoredMessageDelivered:
|
|
7199 |
INFO_PRINTF1(_L("Status: Delivered"));
|
|
7200 |
break;
|
|
7201 |
|
|
7202 |
case RMobileSmsStore::EStoredMessageUnknownStatus:
|
|
7203 |
default:
|
|
7204 |
INFO_PRINTF1(_L("Status: Unknown"));
|
|
7205 |
break;
|
|
7206 |
}
|
|
7207 |
|
|
7208 |
PrintMessageL(smsmessage);
|
|
7209 |
User::LeaveIfError(aMessages.Append(smsmessage));
|
|
7210 |
CleanupStack::Pop(smsmessage);
|
|
7211 |
}
|
|
7212 |
}
|
|
7213 |
|
|
7214 |
TInt CSmsInterTestStep::MakeReadSmsStoreRequestL(RSocket& aSocket)
|
|
7215 |
/**
|
|
7216 |
* This method retrieves SMS messages from SMS storage.
|
|
7217 |
* Main purpose is to test out of memory conditions.
|
|
7218 |
* @param aSocket Used to stream SMS messages from the sms stack
|
|
7219 |
* @param aMessages reference to CSmsMessage pointer array.
|
|
7220 |
*/
|
|
7221 |
{
|
|
7222 |
TRequestStatus status;
|
|
7223 |
TPckgBuf<TUint> sbuf;
|
|
7224 |
sbuf()=0;
|
|
7225 |
|
|
7226 |
//Now enumerate messages from SIM
|
|
7227 |
aSocket.Ioctl(KIoctlEnumerateSmsMessages,status,&sbuf, KSolSmsProv);
|
|
7228 |
User::WaitForRequest(status);
|
|
7229 |
INFO_PRINTF2(_L("Read SMS returned %d"), status.Int());
|
|
7230 |
if(status.Int() != KErrNone)
|
|
7231 |
User::Leave(status.Int());
|
|
7232 |
|
|
7233 |
//sbuf() includes the count of messages on SIM
|
|
7234 |
return sbuf();
|
|
7235 |
}
|
|
7236 |
|
|
7237 |
void CSmsInterTestStep::WriteSmsToSimL(CSmsMessage& aSms, RSocket& aSocket, TDes8* aDesc)
|
|
7238 |
/**
|
|
7239 |
* This method stores SMS messages to the SMS storage.
|
|
7240 |
* @param aSms SMS message that will be stored
|
|
7241 |
* @param aSocket Used to stream SMS message to the sms stack
|
|
7242 |
* @leave Leaves if streaming the message to the socket server doesn't succeed
|
|
7243 |
* @leave Leaves if store request is completed with error code
|
|
7244 |
*/
|
|
7245 |
{
|
|
7246 |
INFO_PRINTF1(_L("Write message"));
|
|
7247 |
|
|
7248 |
TRequestStatus status;
|
|
7249 |
|
|
7250 |
RSmsSocketWriteStream writestream(aSocket);
|
|
7251 |
TRAPD(ret,writestream << aSms);
|
|
7252 |
TEST(ret==KErrNone);
|
|
7253 |
TRAP(ret,writestream.CommitL());
|
|
7254 |
TEST(ret==KErrNone);
|
|
7255 |
aSocket.Ioctl(KIoctlWriteSmsMessage,status,aDesc, KSolSmsProv);
|
|
7256 |
User::WaitForRequest(status);
|
|
7257 |
INFO_PRINTF2(_L("WriteSmsToSimL - returned %d"), status.Int());
|
|
7258 |
}
|
|
7259 |
|
|
7260 |
TInt CSmsInterTestStep::CancelWriteSmsToSimL(CSmsMessage& aSms, RSocket& aSocket, TInt aDelay)
|
|
7261 |
/**
|
|
7262 |
* This method stores SMS messages to the SMS storage.
|
|
7263 |
* @param aSms SMS message that will be stored
|
|
7264 |
* @param aSocket Used to stream SMS message to the sms stack
|
|
7265 |
* @leave Leaves if streaming the message to the socket server doesn't succeed
|
|
7266 |
* @leave Leaves if store request is completed with error code
|
|
7267 |
*/
|
|
7268 |
{
|
|
7269 |
INFO_PRINTF1(_L("Write message"));
|
|
7270 |
|
|
7271 |
TRequestStatus status;
|
|
7272 |
|
|
7273 |
RSmsSocketWriteStream writestream(aSocket);
|
|
7274 |
TRAPD(ret,writestream << aSms);
|
|
7275 |
TEST(ret==KErrNone);
|
|
7276 |
TRAP(ret,writestream.CommitL());
|
|
7277 |
TEST(ret==KErrNone);
|
|
7278 |
|
|
7279 |
aSocket.Ioctl(KIoctlWriteSmsMessage,status,NULL, KSolSmsProv);
|
|
7280 |
INFO_PRINTF1(_L("Cancel"));
|
|
7281 |
User::After(aDelay);
|
|
7282 |
aSocket.CancelIoctl();
|
|
7283 |
User::WaitForRequest(status);
|
|
7284 |
INFO_PRINTF2(_L("WriteSmsToSimL - returned %d"), status.Int());
|
|
7285 |
|
|
7286 |
return status.Int();
|
|
7287 |
}
|
|
7288 |
|
|
7289 |
void CSmsInterTestStep::WriteMessagesUntilStoreComesFullL(RPointerArray<CSmsMessage>& aMessages, const CSmsMessage::TMobileSmsStorage& aStorage, RSocket& aSocket)
|
|
7290 |
/**
|
|
7291 |
* This method writes SMS messages to the SMS storage until SMS Stack completes
|
|
7292 |
* write request with KErrNoMemory.
|
|
7293 |
* @param aMessages an Array to where all successfully written PDUs that are stored
|
|
7294 |
* @param aStorage a store where message will be stored
|
|
7295 |
* @param aSocket Used to stream SMS message to the sms stack
|
|
7296 |
* @return TInt amounth of successfully writed messages
|
|
7297 |
*/
|
|
7298 |
{
|
|
7299 |
TBuf<20> msgBuffer;
|
|
7300 |
_LIT(KTestMessage,"Test message ");
|
|
7301 |
TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
7302 |
TInt writeCount(0);
|
|
7303 |
TInt ret(KErrNone);
|
|
7304 |
while (ret==KErrNone)
|
|
7305 |
{
|
|
7306 |
msgBuffer.Copy(KTestMessage);
|
|
7307 |
msgBuffer.AppendNum(writeCount);
|
|
7308 |
CSmsMessage* smsMessage=CreateSmsMessageL(msgBuffer,alphabet,CSmsPDU::ESmsDeliver);
|
|
7309 |
CleanupStack::PushL(smsMessage);
|
|
7310 |
smsMessage->SetStorage(aStorage);
|
|
7311 |
TRAP(ret,WriteSmsLeaveIfErrorL(*smsMessage,aSocket););
|
|
7312 |
if(ret==KErrNone)
|
|
7313 |
{
|
|
7314 |
User::LeaveIfError(aMessages.Append(smsMessage));
|
|
7315 |
CleanupStack::Pop(smsMessage);
|
|
7316 |
writeCount++;
|
|
7317 |
}
|
|
7318 |
else
|
|
7319 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
7320 |
}
|
|
7321 |
TEST(ret == KErrNoMemory || ret == KErrNotFound); // KErrNotFound means requested store n/a
|
|
7322 |
}
|
|
7323 |
|
|
7324 |
void CSmsInterTestStep::WriteSmsLeaveIfErrorL(const CSmsMessage& aSms, RSocket& aSocket)
|
|
7325 |
/**
|
|
7326 |
* This method stores SMS messages to the SMS storage.
|
|
7327 |
* @param aSms SMS message that will be stored
|
|
7328 |
* @param aSocket Used to stream SMS message to the sms stack
|
|
7329 |
*/
|
|
7330 |
{
|
|
7331 |
TRequestStatus status;
|
|
7332 |
RSmsSocketWriteStream writestream(aSocket);
|
|
7333 |
writestream << aSms;
|
|
7334 |
writestream.CommitL();
|
|
7335 |
aSocket.Ioctl(KIoctlWriteSmsMessage,status,NULL, KSolSmsProv);
|
|
7336 |
User::WaitForRequest(status);
|
|
7337 |
INFO_PRINTF2(_L("Write SMS message returned %d"), status.Int());
|
|
7338 |
if(status.Int() != KErrNone)
|
|
7339 |
User::Leave(status.Int());
|
|
7340 |
}
|
|
7341 |
|
|
7342 |
TInt CSmsInterTestStep::DeleteSmsL(const CSmsMessage& aSms, RSocket& aSocket)
|
|
7343 |
/**
|
|
7344 |
* This method deletes SMS message from the SMS storage.
|
|
7345 |
* @param aSms SMS message that will be deleted
|
|
7346 |
* @param aSocket Used to stream SMS message to the sms stack
|
|
7347 |
* @leave Leaves if delete request is completed with error code (except KErrNotFound)
|
|
7348 |
* @return TInt :error code
|
|
7349 |
*/
|
|
7350 |
{
|
|
7351 |
INFO_PRINTF1(_L("Delete message"));
|
|
7352 |
|
|
7353 |
TRequestStatus status;
|
|
7354 |
|
|
7355 |
RSmsSocketWriteStream writestream(aSocket);
|
|
7356 |
TRAPD(ret,writestream << aSms);
|
|
7357 |
TEST(ret==KErrNone);
|
|
7358 |
TRAP(ret,writestream.CommitL());
|
|
7359 |
TEST(ret==KErrNone);
|
|
7360 |
|
|
7361 |
aSocket.Ioctl(KIoctlDeleteSmsMessage, status, NULL, KSolSmsProv);
|
|
7362 |
User::WaitForRequest(status);
|
|
7363 |
INFO_PRINTF2(_L("DeleteSmsL - returned %d"), status.Int());
|
|
7364 |
|
|
7365 |
if (status.Int()!=KErrArgument)
|
|
7366 |
TEST(status.Int() == KErrNone);
|
|
7367 |
|
|
7368 |
return status.Int();
|
|
7369 |
}
|
|
7370 |
|
|
7371 |
void CSmsInterTestStep::DeleteSmsLeaveIfErrorL(const CSmsMessage& aSms, RSocket& aSocket)
|
|
7372 |
/**
|
|
7373 |
* This method deletes SMS message from the SMS storage.
|
|
7374 |
* @param aSms SMS message that will be deleted
|
|
7375 |
* @param aSocket Used to stream SMS message to the sms stack
|
|
7376 |
*/
|
|
7377 |
{
|
|
7378 |
TRequestStatus status;
|
|
7379 |
RSmsSocketWriteStream writestream(aSocket);
|
|
7380 |
writestream << aSms;
|
|
7381 |
writestream.CommitL();
|
|
7382 |
aSocket.Ioctl(KIoctlDeleteSmsMessage, status, NULL, KSolSmsProv);
|
|
7383 |
User::WaitForRequest(status);
|
|
7384 |
INFO_PRINTF2(_L("Delete SMS returned %d"), status.Int());
|
|
7385 |
if(status.Int() != KErrNone)
|
|
7386 |
User::Leave(status.Int());
|
|
7387 |
}
|
|
7388 |
|
|
7389 |
void CSmsInterTestStep::TestSmsContentsL(CSmsMessage* aSms, const TDesC& aDes)
|
|
7390 |
/**
|
|
7391 |
* Check that aSms contains text that matches to aDes
|
|
7392 |
* @param aSms SMS message that has been come from SMS stack
|
|
7393 |
* @param aDes SMS message's text that is defined at client side
|
|
7394 |
* @leave Leaves if aSms doesn't match to aDes
|
|
7395 |
*/
|
|
7396 |
{
|
|
7397 |
CSmsBufferBase& smsBuffer=aSms->Buffer();
|
|
7398 |
TInt bufLen=smsBuffer.Length();
|
|
7399 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
7400 |
CleanupStack::PushL(textBuf);
|
|
7401 |
TPtr textPtr(textBuf->Des());
|
|
7402 |
smsBuffer.Extract(textPtr,0,bufLen);
|
|
7403 |
TEST(textPtr==aDes);
|
|
7404 |
INFO_PRINTF1(_L("Incoming matches outgoing !") );
|
|
7405 |
CleanupStack::PopAndDestroy(textBuf);
|
|
7406 |
}
|
|
7407 |
|
|
7408 |
void CSmsInterTestStep::TestSmsContentsL(CSmsMessage* aSms, const CSmsBufferBase& aSmsBuffer )
|
|
7409 |
/**
|
|
7410 |
* Check that aSms contains text that matches to aDes
|
|
7411 |
* @param aSms SMS message that has been come from SMS stack
|
|
7412 |
* @param aDes SMS message's text that is defined at client side
|
|
7413 |
* @leave Leaves if aSms doesn't match to aDes
|
|
7414 |
*/
|
|
7415 |
{
|
|
7416 |
CSmsBufferBase& smsBuffer=aSms->Buffer();
|
|
7417 |
TInt bufLen=smsBuffer.Length();
|
|
7418 |
HBufC* textBuf=HBufC::NewL(bufLen);
|
|
7419 |
CleanupStack::PushL(textBuf);
|
|
7420 |
TPtr textPtr(textBuf->Des());
|
|
7421 |
smsBuffer.Extract(textPtr,0,bufLen);
|
|
7422 |
|
|
7423 |
TInt bufLen2=aSmsBuffer.Length();
|
|
7424 |
HBufC* textBuf2=HBufC::NewL(bufLen2);
|
|
7425 |
CleanupStack::PushL(textBuf2);
|
|
7426 |
TPtr textPtr2(textBuf2->Des());
|
|
7427 |
aSmsBuffer.Extract(textPtr2,0,bufLen2);
|
|
7428 |
|
|
7429 |
TEST(textPtr==textPtr2);
|
|
7430 |
INFO_PRINTF1(_L("Incoming matches outgoing !") );
|
|
7431 |
CleanupStack::PopAndDestroy(textBuf2);
|
|
7432 |
CleanupStack::PopAndDestroy(textBuf);
|
|
7433 |
}
|
|
7434 |
|
|
7435 |
void CSmsInterTestStep::TestSmsListsL(RPointerArray<CSmsMessage>& aLeft,RPointerArray<CSmsMessage>& aRight)
|
|
7436 |
/**
|
|
7437 |
* Compare sms lists
|
|
7438 |
* @param aLeft an Array containing CSmsMessage objects
|
|
7439 |
* @param aRight an Array containing CSmsMessage objects
|
|
7440 |
* @return TInt : The error code
|
|
7441 |
*/
|
|
7442 |
{
|
|
7443 |
if(aLeft.Count() == aRight.Count())
|
|
7444 |
{
|
|
7445 |
for(TInt leftIndex=0; leftIndex<aLeft.Count(); leftIndex++)
|
|
7446 |
{
|
|
7447 |
TBool found=EFalse;
|
|
7448 |
CSmsMessage* leftEntry=aLeft[leftIndex];
|
|
7449 |
|
|
7450 |
CSmsBufferBase& leftBuffer=leftEntry->Buffer();
|
|
7451 |
TInt bufLen=leftBuffer.Length();
|
|
7452 |
HBufC* leftTextBuf=HBufC::NewL(bufLen);
|
|
7453 |
CleanupStack::PushL(leftTextBuf);
|
|
7454 |
TPtr leftTextPtr(leftTextBuf->Des());
|
|
7455 |
leftBuffer.Extract(leftTextPtr,0,bufLen);
|
|
7456 |
|
|
7457 |
for(TInt rightIndex=0; rightIndex<aRight.Count(); rightIndex++)
|
|
7458 |
{
|
|
7459 |
CSmsMessage* rigthEntry=aRight[rightIndex];
|
|
7460 |
|
|
7461 |
CSmsBufferBase& rightBuffer=rigthEntry->Buffer();
|
|
7462 |
bufLen=rightBuffer.Length();
|
|
7463 |
HBufC* rigthTextBuf=HBufC::NewL(bufLen);
|
|
7464 |
CleanupStack::PushL(rigthTextBuf);
|
|
7465 |
TPtr rightTextPtr(rigthTextBuf->Des());
|
|
7466 |
rightBuffer.Extract(rightTextPtr,0,bufLen);
|
|
7467 |
|
|
7468 |
if((leftTextPtr == rightTextPtr) &&
|
|
7469 |
/* 9210 does not report SCA (leftEntry->ServiceCenterAddress() == rigthEntry->ServiceCenterAddress()) &&*/
|
|
7470 |
(leftEntry->ToFromAddress() == rigthEntry->ToFromAddress()) &&
|
|
7471 |
(leftEntry->Storage() == rigthEntry->Storage()) &&
|
|
7472 |
(leftEntry->Status() == rigthEntry->Status()))
|
|
7473 |
{
|
|
7474 |
found=ETrue;
|
|
7475 |
}
|
|
7476 |
CleanupStack::PopAndDestroy(rigthTextBuf);
|
|
7477 |
if(found)
|
|
7478 |
break;
|
|
7479 |
}
|
|
7480 |
CleanupStack::PopAndDestroy(leftTextBuf);
|
|
7481 |
|
|
7482 |
if(!found)
|
|
7483 |
{
|
|
7484 |
INFO_PRINTF1(_L("ERROR: SMS lists doesn't match: KErrCorrupt"));
|
|
7485 |
User::Leave(KErrNotFound);
|
|
7486 |
}
|
|
7487 |
}
|
|
7488 |
}
|
|
7489 |
else
|
|
7490 |
{
|
|
7491 |
INFO_PRINTF1(_L("ERROR: SMS lists doesn't match: KErrCorrupt"));
|
|
7492 |
User::Leave(KErrCorrupt);
|
|
7493 |
}
|
|
7494 |
|
|
7495 |
INFO_PRINTF1(_L("SMS list comparing Ok!") );
|
|
7496 |
}
|
|
7497 |
|
|
7498 |
void CSmsInterTestStep::DoSendSmsL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet, RSocket& aSocket)
|
|
7499 |
/**
|
|
7500 |
* Send an SMS
|
|
7501 |
* @param aDes contains text that will be inserted to the pdu at CreateSmsMessageL
|
|
7502 |
* @param aAlphabet describes the alphabet of the pdu that will be created at CreateSmsMessageL
|
|
7503 |
* @leave Leaves if any of the leaving functions used at this function leaves
|
|
7504 |
*/
|
|
7505 |
{
|
|
7506 |
CSmsMessage* smsMessage=CreateSmsMessageL(aDes, aAlphabet);
|
|
7507 |
CleanupStack::PushL(smsMessage);
|
|
7508 |
SendSmsL(smsMessage, aSocket);
|
|
7509 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
7510 |
}
|
|
7511 |
|
|
7512 |
void CSmsInterTestStep::SendSms7BitL(const TDesC& aDes, RSocket& aSocket)
|
|
7513 |
/**
|
|
7514 |
* Send a 7bit sms
|
|
7515 |
* @param aDes contains the text to be send
|
|
7516 |
* @leave Leaves if DoSendSmsL leaves
|
|
7517 |
*/
|
|
7518 |
{
|
|
7519 |
DoSendSmsL(aDes, TSmsDataCodingScheme::ESmsAlphabet7Bit, aSocket);
|
|
7520 |
}
|
|
7521 |
|
|
7522 |
void CSmsInterTestStep::SendSms8BitL(const TDesC& aDes, RSocket& aSocket)
|
|
7523 |
/**
|
|
7524 |
* Send a 8bit sms
|
|
7525 |
* @param aDes contains the text to be send
|
|
7526 |
* @leave Leaves if DoSendSmsL leaves
|
|
7527 |
*/
|
|
7528 |
{
|
|
7529 |
DoSendSmsL(aDes, TSmsDataCodingScheme::ESmsAlphabet8Bit, aSocket);
|
|
7530 |
}
|
|
7531 |
|
|
7532 |
void CSmsInterTestStep::SendSms16BitL(const TDesC& aDes, RSocket& aSocket)
|
|
7533 |
/**
|
|
7534 |
* Send a 16bit sms
|
|
7535 |
* @param aDes contains the text to be send
|
|
7536 |
* @leave Leaves if DoSendSmsL leaves
|
|
7537 |
*/
|
|
7538 |
{
|
|
7539 |
DoSendSmsL(aDes, TSmsDataCodingScheme::ESmsAlphabetUCS2, aSocket);
|
|
7540 |
}
|
|
7541 |
|
|
7542 |
|
|
7543 |
void CSmsInterTestStep::DoSendAndRecvSmsL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet, RSocket& aSocket)
|
|
7544 |
/**
|
|
7545 |
* Send and recv one sms,
|
|
7546 |
* then check that the sent message corresponds with the received message
|
|
7547 |
* @param aDes contains the text that will be inserted to the pdu at CreateSmsMessageL
|
|
7548 |
* @param aAlphabet describes the alphabet of the pdu that will be created at CreateSmsMessageL
|
|
7549 |
* @leave Leaves if any of the leaving functions used at this function leaves
|
|
7550 |
*/
|
|
7551 |
{
|
|
7552 |
CSmsMessage* smsMessage=CreateSmsMessageL(aDes, aAlphabet);
|
|
7553 |
CleanupStack::PushL(smsMessage);
|
|
7554 |
SendSmsL(smsMessage, aSocket);
|
|
7555 |
CleanupStack::PopAndDestroy(smsMessage); //destroyed because created again in RecvSmsL
|
|
7556 |
|
|
7557 |
WaitForRecvL( aSocket);
|
|
7558 |
smsMessage = RecvSmsL( aSocket);
|
|
7559 |
CleanupStack::PushL(smsMessage);
|
|
7560 |
|
|
7561 |
TestSmsContentsL(smsMessage,aDes);
|
|
7562 |
|
|
7563 |
User::After(1000000);
|
|
7564 |
|
|
7565 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
7566 |
}
|
|
7567 |
|
|
7568 |
|
|
7569 |
void CSmsInterTestStep::SendAndRecvSms7BitL(const TDesC& aDes, RSocket& aSocket)
|
|
7570 |
/**
|
|
7571 |
* Send and receive one 7bit sms
|
|
7572 |
* @param aDes contains the text to be send
|
|
7573 |
* @leave Leaves if DoSendAndRecvSmsL leaves
|
|
7574 |
*/
|
|
7575 |
{
|
|
7576 |
DoSendAndRecvSmsL(aDes,TSmsDataCodingScheme::ESmsAlphabet7Bit, aSocket);
|
|
7577 |
}
|
|
7578 |
|
|
7579 |
void CSmsInterTestStep::SendAndRecvSms8BitL(const TDesC& aDes, RSocket& aSocket)
|
|
7580 |
/**
|
|
7581 |
* Send and receive one 8bit sms
|
|
7582 |
* @param aDes contains the text to be send
|
|
7583 |
* @leave Leaves if DoSendAndRecvSmsL leaves
|
|
7584 |
*/
|
|
7585 |
{
|
|
7586 |
DoSendAndRecvSmsL(aDes,TSmsDataCodingScheme::ESmsAlphabet8Bit, aSocket);
|
|
7587 |
}
|
|
7588 |
|
|
7589 |
void CSmsInterTestStep::SendAndRecvSmsBinaryL(const TDesC& aDes, RSocket& aSocket)
|
|
7590 |
/**
|
|
7591 |
* Send and recv one sms containing binary data
|
|
7592 |
* @param aDes contains the text to be send
|
|
7593 |
* @leave Leaves if any of the leaving functions used at this function leaves
|
|
7594 |
*/
|
|
7595 |
{
|
|
7596 |
CSmsMessage* smsMessage=CreateSmsMessageL(aDes,TSmsDataCodingScheme::ESmsAlphabet8Bit);
|
|
7597 |
CleanupStack::PushL(smsMessage);
|
|
7598 |
|
|
7599 |
CSmsPDU& pdu = smsMessage->SmsPDU();
|
|
7600 |
CSmsUserData& userData = pdu.UserData();
|
|
7601 |
userData.AddInformationElementL(CSmsInformationElement::ESmsIEIApplicationPortAddressing8Bit,_L8("98"));
|
|
7602 |
|
|
7603 |
SendSmsL(smsMessage, aSocket);
|
|
7604 |
CleanupStack::PopAndDestroy(smsMessage); //destroyed because created again in RecvSmsL
|
|
7605 |
WaitForRecvL( aSocket);
|
|
7606 |
smsMessage = RecvSmsL( aSocket);
|
|
7607 |
CleanupStack::PushL(smsMessage);
|
|
7608 |
TestSmsContentsL(smsMessage,aDes);
|
|
7609 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
7610 |
}
|
|
7611 |
|
|
7612 |
void CSmsInterTestStep::SendAndRecvSms16BitL(const TDesC16& aDes, RSocket& aSocket)
|
|
7613 |
/**
|
|
7614 |
* Send and receive one 16bit sms
|
|
7615 |
* @param aDes contains the text to be send
|
|
7616 |
* @leave Leaves if DoSendAndRecvSmsL leaves
|
|
7617 |
*/
|
|
7618 |
{
|
|
7619 |
DoSendAndRecvSmsL(aDes,TSmsDataCodingScheme::ESmsAlphabetUCS2, aSocket);
|
|
7620 |
}
|
|
7621 |
|
|
7622 |
void CSmsInterTestStep::FillDes(TDes& aDes,TInt aLength)
|
|
7623 |
/**
|
|
7624 |
* Fill aDes with randomly generated 7bit data
|
|
7625 |
* @param aDes will be filled with random data
|
|
7626 |
* @param aLength has the length to be set to aDes
|
|
7627 |
*/
|
|
7628 |
{
|
|
7629 |
TText baseChar='A';
|
|
7630 |
|
|
7631 |
aDes.SetLength(aLength);
|
|
7632 |
for (TInt i=0;i<aLength;i++)
|
|
7633 |
aDes[i]=TText(baseChar + i%26 );
|
|
7634 |
}
|
|
7635 |
|
|
7636 |
void CSmsInterTestStep::SendAndRecvSms7BitL(TInt aLength, RSocket& aSocket)
|
|
7637 |
/**
|
|
7638 |
* Send and recv one sms of aLength with arbitrarily generated text
|
|
7639 |
* @param aLength has the length of the message to be created here
|
|
7640 |
* @leave Leaves if SendAndRecvSms7BitL leaves
|
|
7641 |
*/
|
|
7642 |
{
|
|
7643 |
HBufC* textBuf=HBufC::New(aLength);
|
|
7644 |
CleanupStack::PushL(textBuf);
|
|
7645 |
TPtr textPtr=textBuf->Des();
|
|
7646 |
FillDes(textPtr,aLength);
|
|
7647 |
SendAndRecvSms7BitL(textPtr, aSocket);
|
|
7648 |
CleanupStack::PopAndDestroy(textBuf);
|
|
7649 |
}
|
|
7650 |
|
|
7651 |
void CSmsInterTestStep::BinaryFillDes(TDes& aDes, TInt aLength)
|
|
7652 |
/**
|
|
7653 |
* Fill aDes with randomly initialised 8bit data
|
|
7654 |
* @param aDes will be filled with random data
|
|
7655 |
* @param aLength has the length to be set to aDes
|
|
7656 |
*/
|
|
7657 |
{
|
|
7658 |
TTime time;
|
|
7659 |
time.UniversalTime();
|
|
7660 |
TInt64 timeAs64BitInt = time.Int64();
|
|
7661 |
|
|
7662 |
TText8 baseChar = TText8( Math::Rand(timeAs64BitInt) );
|
|
7663 |
aDes.SetLength(aLength);
|
|
7664 |
for (TInt i=0;i<aLength;i++)
|
|
7665 |
{
|
|
7666 |
aDes[i] = TText8(baseChar++);
|
|
7667 |
}
|
|
7668 |
}
|
|
7669 |
|
|
7670 |
void CSmsInterTestStep::SendAndRecvSms8BitL(TInt aLength, RSocket& aSocket)
|
|
7671 |
/**
|
|
7672 |
* Send and recv one 8bit sms of aLength with arbitrarily generated text
|
|
7673 |
* @param aLength has the length of the message
|
|
7674 |
* @leave Leaves if SendAndRecvSms8BitL leaves
|
|
7675 |
*/
|
|
7676 |
{
|
|
7677 |
HBufC* textBuf=HBufC::New(aLength);
|
|
7678 |
CleanupStack::PushL(textBuf);
|
|
7679 |
TPtr textPtr=textBuf->Des();
|
|
7680 |
FillDes(textPtr,aLength);
|
|
7681 |
SendAndRecvSms8BitL(textPtr, aSocket);
|
|
7682 |
CleanupStack::PopAndDestroy(textBuf);
|
|
7683 |
}
|
|
7684 |
|
|
7685 |
void CSmsInterTestStep::SendAndRecvSmsBinaryL(TInt aLength, RSocket& aSocket)
|
|
7686 |
/**
|
|
7687 |
* Send and recv one binary sms message of aLength with arbitrarily generated text
|
|
7688 |
* @param aLength has the length of the message
|
|
7689 |
* @leave Leaves if SendAndRecvSmsBinaryL leaves
|
|
7690 |
*/
|
|
7691 |
{
|
|
7692 |
HBufC* textBuf=HBufC::New(aLength);
|
|
7693 |
CleanupStack::PushL(textBuf);
|
|
7694 |
TPtr textPtr=textBuf->Des();
|
|
7695 |
BinaryFillDes(textPtr,aLength);
|
|
7696 |
SendAndRecvSmsBinaryL(textPtr, aSocket);
|
|
7697 |
CleanupStack::PopAndDestroy(textBuf);
|
|
7698 |
}
|
|
7699 |
|
|
7700 |
void CSmsInterTestStep::SendAndRecvSms16BitL(TInt aLength, RSocket& aSocket)
|
|
7701 |
/**
|
|
7702 |
* Send and recv one 16bit sms of aLength with arbitrarily generated text
|
|
7703 |
* @param aLength has the length of the message
|
|
7704 |
* @leave Leaves if SendAndRecvSms16BitL leaves
|
|
7705 |
*/
|
|
7706 |
{
|
|
7707 |
HBufC16* textBuf=HBufC16::New(aLength);
|
|
7708 |
CleanupStack::PushL(textBuf);
|
|
7709 |
TPtr16 textPtr=textBuf->Des();
|
|
7710 |
FillDes(textPtr,aLength);
|
|
7711 |
SendAndRecvSms16BitL(textPtr, aSocket);
|
|
7712 |
CleanupStack::PopAndDestroy(textBuf);
|
|
7713 |
}
|
|
7714 |
|
|
7715 |
void CSmsInterTestStep::TestMessageContentsL(CSmsMessage* aSms, const TTestCase& aTestCase)
|
|
7716 |
/**
|
|
7717 |
* Check the sms matches the expected test result
|
|
7718 |
* @param aSms has the message to be tested with aTestCase.iMsg
|
|
7719 |
* @param aTestCase has information about the used test message, e.g. message data and DCS
|
|
7720 |
* @leave Leaves if TSmsClass isn't defined at the pdu
|
|
7721 |
* @leave Leaves if class of pdu doesn't match to supposed class (aTestCase.iSmsClass)
|
|
7722 |
*/
|
|
7723 |
{
|
|
7724 |
TestSmsContentsL(aSms,aTestCase.iMsg);
|
|
7725 |
CSmsPDU& pdu = aSms->SmsPDU();
|
|
7726 |
INFO_PRINTF1(_L("Send message too long for SIM"));
|
|
7727 |
if (aTestCase.iTestSmsClass)
|
|
7728 |
{
|
|
7729 |
INFO_PRINTF1(_L("Send message too long for SIM"));
|
|
7730 |
TSmsDataCodingScheme::TSmsClass smsClass;
|
|
7731 |
TBool isDefined = pdu.Class(smsClass);
|
|
7732 |
TEST(isDefined);
|
|
7733 |
TEST(smsClass == aTestCase.iSmsClass);
|
|
7734 |
}
|
|
7735 |
INFO_PRINTF1(_L("Send message too long for SIM"));
|
|
7736 |
if (aTestCase.iTestIndicators)
|
|
7737 |
{
|
|
7738 |
INFO_PRINTF1(_L("Send message too long for SIM"));
|
|
7739 |
TEST(pdu.Bits7To4() == aTestCase.iBits7To4);
|
|
7740 |
TEST(pdu.IndicationType() == aTestCase.iIndicationType);
|
|
7741 |
TEST(pdu.IndicationState() == aTestCase.iIndicationState);
|
|
7742 |
}
|
|
7743 |
INFO_PRINTF1(_L("Send message too long for SIM"));
|
|
7744 |
}
|
|
7745 |
|
|
7746 |
void CSmsInterTestStep::SetIndicatorL(const TTestCase& aTestCase, CSmsMessage* aSms)
|
|
7747 |
/**
|
|
7748 |
*
|
|
7749 |
*/
|
|
7750 |
{
|
|
7751 |
TSmsDataCodingScheme::TSmsAlphabet alphabet;
|
|
7752 |
if (aTestCase.iBits7To4 == TSmsDataCodingScheme::ESmsDCSMessageWaitingIndicationUCS2)
|
|
7753 |
alphabet = TSmsDataCodingScheme::ESmsAlphabetUCS2;
|
|
7754 |
else
|
|
7755 |
alphabet = TSmsDataCodingScheme::ESmsAlphabet7Bit;
|
|
7756 |
|
|
7757 |
TSmsUserDataSettings smsSettings;
|
|
7758 |
smsSettings.SetAlphabet(alphabet);
|
|
7759 |
smsSettings.SetTextCompressed(EFalse);
|
|
7760 |
aSms->SetUserDataSettingsL(smsSettings);
|
|
7761 |
|
|
7762 |
CSmsPDU& pdu = aSms->SmsPDU();
|
|
7763 |
pdu.SetBits7To4(aTestCase.iBits7To4);
|
|
7764 |
pdu.SetIndicationType(aTestCase.iIndicationType);
|
|
7765 |
pdu.SetIndicationState(aTestCase.iIndicationState);
|
|
7766 |
|
|
7767 |
}
|
|
7768 |
|
|
7769 |
void CSmsInterTestStep::SendAndRecvTestMessageL(const TTestCase& aTestCase, RSocket& aSocket)
|
|
7770 |
/**
|
|
7771 |
* Send a test message. This method is used to send and receive different DCS type messages
|
|
7772 |
* @param aTestCase has information about the used test message, e.g. message data and DCS
|
|
7773 |
* @leave Leaves if any of the leaving functions used at this function leaves
|
|
7774 |
*/
|
|
7775 |
{
|
|
7776 |
SendTestMessageL(aTestCase, aSocket);
|
|
7777 |
INFO_PRINTF1(_L("(SendTestMessageL"));
|
|
7778 |
WaitForRecvL(aSocket);
|
|
7779 |
INFO_PRINTF1(_L("(WaitForRecvL(aSocket)"));
|
|
7780 |
CSmsMessage* smsMessage = RecvSmsL(aSocket);
|
|
7781 |
INFO_PRINTF1(_L("(RecvSmsL(aSocket)"));
|
|
7782 |
CleanupStack::PushL(smsMessage);
|
|
7783 |
INFO_PRINTF1(_L("(RecvSmsL(aSocket)"));
|
|
7784 |
TestMessageContentsL(smsMessage,aTestCase);
|
|
7785 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
7786 |
}
|
|
7787 |
|
|
7788 |
void CSmsInterTestStep::SendTestMessageL(const TTestCase& aTestCase, RSocket& aSocket)
|
|
7789 |
/**
|
|
7790 |
* Send a test message
|
|
7791 |
* Assumes recv is already done.
|
|
7792 |
* @param aTestCase has information about the used test message, e.g. message data and DCS
|
|
7793 |
* @leave Leaves if any of the leaving functions used at this function leaves
|
|
7794 |
*/
|
|
7795 |
{
|
|
7796 |
CSmsMessage* smsMessage = CreateSmsMessageL(aTestCase.iMsg, TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
7797 |
CleanupStack::PushL(smsMessage);
|
|
7798 |
|
|
7799 |
CSmsPDU& pdu = smsMessage->SmsPDU();
|
|
7800 |
CSmsUserData& userData = pdu.UserData();
|
|
7801 |
|
|
7802 |
if (aTestCase.iMatchType == ESmsAddrMatchIEI)
|
|
7803 |
{
|
|
7804 |
userData.AddInformationElementL(aTestCase.iIdentifierMatch,_L8("98"));
|
|
7805 |
}
|
|
7806 |
|
|
7807 |
if (aTestCase.iTestSmsClass)
|
|
7808 |
{
|
|
7809 |
pdu.SetBits7To4(TSmsDataCodingScheme::ESmsDCSTextUncompressedWithClassInfo);
|
|
7810 |
pdu.SetClass(ETrue,aTestCase.iSmsClass);
|
|
7811 |
}
|
|
7812 |
|
|
7813 |
if (aTestCase.iTestValidityPeriod && pdu.Type()==CSmsPDU::ESmsSubmit)
|
|
7814 |
{
|
|
7815 |
CSmsSubmit* submitPdu = REINTERPRET_CAST(CSmsSubmit*,&pdu);
|
|
7816 |
submitPdu->SetValidityPeriod(aTestCase.iValidityPeriod);
|
|
7817 |
}
|
|
7818 |
|
|
7819 |
if (aTestCase.iTestIndicators && pdu.Type()==CSmsPDU::ESmsSubmit)
|
|
7820 |
{
|
|
7821 |
SetIndicatorL(aTestCase, smsMessage);
|
|
7822 |
}
|
|
7823 |
|
|
7824 |
SendSmsL(smsMessage, aSocket);
|
|
7825 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
7826 |
}
|
|
7827 |
|
|
7828 |
TInt CSmsInterTestStep::WriteReadAndDeleteMessageL(const TTestCase& aTestCase, const CSmsMessage::TMobileSmsStorage& aSmsStorage, RSocket& aSocket)
|
|
7829 |
/**
|
|
7830 |
* Write, read and delete a message to/from phone side SMS storage
|
|
7831 |
* Assumes phone side storage is empty
|
|
7832 |
* @param aTestCase has information about the used test message, e.g. message data and DCS
|
|
7833 |
* @leave Leaves if any of the leaving functions used at this function leaves
|
|
7834 |
*/
|
|
7835 |
{
|
|
7836 |
//
|
|
7837 |
// Write message
|
|
7838 |
//
|
|
7839 |
CSmsMessage* smsMessage = CreateSmsMessageL(aTestCase.iMsg, TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
7840 |
CleanupStack::PushL(smsMessage);
|
|
7841 |
smsMessage->SetStorage(aSmsStorage);
|
|
7842 |
CSmsPDU& pdu = smsMessage->SmsPDU();
|
|
7843 |
if (aTestCase.iTestSmsClass)
|
|
7844 |
{
|
|
7845 |
pdu.SetBits7To4(TSmsDataCodingScheme::ESmsDCSTextUncompressedWithClassInfo);
|
|
7846 |
pdu.SetClass(ETrue,aTestCase.iSmsClass);
|
|
7847 |
if(aTestCase.iSmsClass==TSmsDataCodingScheme::ESmsClass0)
|
|
7848 |
INFO_PRINTF1(_L("Writing Class 0 Message ..."));
|
|
7849 |
else if(aTestCase.iSmsClass==TSmsDataCodingScheme::ESmsClass1)
|
|
7850 |
INFO_PRINTF1(_L("Writing Class 1 Message ..."));
|
|
7851 |
else if(aTestCase.iSmsClass==TSmsDataCodingScheme::ESmsClass2)
|
|
7852 |
INFO_PRINTF1(_L("Writing Class 2 Message ..."));
|
|
7853 |
else if(aTestCase.iSmsClass==TSmsDataCodingScheme::ESmsClass3)
|
|
7854 |
INFO_PRINTF1(_L("Writing Class 3 Message ..."));
|
|
7855 |
}
|
|
7856 |
|
|
7857 |
TRAPD(ret,WriteSmsLeaveIfErrorL(*smsMessage,aSocket););
|
|
7858 |
// Some phones doesn't support phone memory. In this case SMS Stack
|
|
7859 |
// completes write request with KErrNotFound.
|
|
7860 |
// Some phones has phone memory that can be used only by phone
|
|
7861 |
// when SIM comes full (6210). Store info from this kind of
|
|
7862 |
// phone memory tells that iTotalEntries==iUsedEntries. In this case
|
|
7863 |
// SMS Stack completes write request with KErrNoMemory.
|
|
7864 |
if(ret == KErrNoMemory || ret == KErrNotFound)
|
|
7865 |
{
|
|
7866 |
TEST(ret==KErrNone);
|
|
7867 |
CleanupStack::PopAndDestroy(smsMessage);
|
|
7868 |
return ret;
|
|
7869 |
}
|
|
7870 |
else if(ret != KErrNone)
|
|
7871 |
{
|
|
7872 |
User::Leave(ret);
|
|
7873 |
}
|
|
7874 |
|
|
7875 |
//
|
|
7876 |
// Read message and compare it to written message
|
|
7877 |
//
|
|
7878 |
RPointerArray<CSmsMessage> messages;
|
|
7879 |
CleanupResetAndDestroyPushL(messages);
|
|
7880 |
ReadSmsStoreL(aSocket, messages);
|
|
7881 |
TestMessageContentsL(smsMessage,aTestCase);
|
|
7882 |
TEST(smsMessage->ToFromAddress()==messages[0]->ToFromAddress());
|
|
7883 |
TEST(smsMessage->ServiceCenterAddress()==messages[0]->ServiceCenterAddress());
|
|
7884 |
|
|
7885 |
//
|
|
7886 |
// Delete message
|
|
7887 |
//
|
|
7888 |
ret = DeleteSmsL(*messages[0], aSocket);
|
|
7889 |
TEST(ret==KErrNone);
|
|
7890 |
|
|
7891 |
CleanupStack::PopAndDestroy(2); // smsMessage, messages
|
|
7892 |
return KErrNone;
|
|
7893 |
}
|
|
7894 |
|
|
7895 |
void CSmsInterTestStep::SendMessagesUntilKeyPressL(RSocketServ& aSocketServer)
|
|
7896 |
/**
|
|
7897 |
* Keep sending messages until a key is pressed
|
|
7898 |
* @leave Leaves if any of the leaving functions used at this function leaves
|
|
7899 |
*/
|
|
7900 |
{
|
|
7901 |
CActiveSender* activeSender = CActiveSender::NewL(aSocketServer, iFs, iTelephoneNumber,
|
|
7902 |
iServiceCenterNumber);
|
|
7903 |
CleanupStack::PushL(activeSender);
|
|
7904 |
|
|
7905 |
activeSender->StopIfKeyPressedL();
|
|
7906 |
activeSender->StartSendingL();
|
|
7907 |
CleanupStack::PopAndDestroy(activeSender);
|
|
7908 |
}
|
|
7909 |
|
|
7910 |
|
|
7911 |
void CSmsInterTestStep::PrintMessageL(const CSmsMessage* aSms)
|
|
7912 |
/**
|
|
7913 |
* Print the content of SMS to the console
|
|
7914 |
*/
|
|
7915 |
{
|
|
7916 |
CSmsBuffer& smsbuffer = (CSmsBuffer&)aSms->Buffer();
|
|
7917 |
const TInt len = smsbuffer.Length();
|
|
7918 |
HBufC* hbuf = HBufC::NewL(len);
|
|
7919 |
TPtr ptr = hbuf->Des();
|
|
7920 |
smsbuffer.Extract(ptr,0,len);
|
|
7921 |
INFO_PRINTF1(_L("SMS contains..."));
|
|
7922 |
|
|
7923 |
for (TInt j = 0; j < len; j++)
|
|
7924 |
{
|
|
7925 |
if (ptr[j] < 0x20 || ptr[j] > 0xff)
|
|
7926 |
{
|
|
7927 |
ptr[j] = 0x007f;
|
|
7928 |
}
|
|
7929 |
}
|
|
7930 |
|
|
7931 |
INFO_PRINTF1(ptr);
|
|
7932 |
INFO_PRINTF1(_L(""));
|
|
7933 |
|
|
7934 |
delete hbuf;
|
|
7935 |
}
|